diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-28 12:29:23 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-28 12:29:23 -0400 |
commit | 7a9f8f93d2dad38f30fbc79d8a1e6517373aa4b6 (patch) | |
tree | 9116e5bde860d00685c5b6eee7be5ba9899aabb9 /drivers | |
parent | 972c26bdd6b58e7534473c4f7928584578cf43f4 (diff) | |
parent | 5fadd053d9bb4345ec6f405d24db4e7eb49cf81e (diff) |
Merge branch 'master'
Diffstat (limited to 'drivers')
239 files changed, 7255 insertions, 5357 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index e36c5da2b31a..3937adf4e5e5 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -96,7 +96,7 @@ struct acpi_find_pci_root { | |||
96 | static acpi_status | 96 | static acpi_status |
97 | do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) | 97 | do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) |
98 | { | 98 | { |
99 | int *busnr = (int *)data; | 99 | unsigned long *busnr = (unsigned long *)data; |
100 | struct acpi_resource_address64 address; | 100 | struct acpi_resource_address64 address; |
101 | 101 | ||
102 | if (resource->id != ACPI_RSTYPE_ADDRESS16 && | 102 | if (resource->id != ACPI_RSTYPE_ADDRESS16 && |
@@ -115,13 +115,13 @@ do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) | |||
115 | static int get_root_bridge_busnr(acpi_handle handle) | 115 | static int get_root_bridge_busnr(acpi_handle handle) |
116 | { | 116 | { |
117 | acpi_status status; | 117 | acpi_status status; |
118 | int bus, bbn; | 118 | unsigned long bus, bbn; |
119 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 119 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
120 | 120 | ||
121 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | 121 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); |
122 | 122 | ||
123 | status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL, | 123 | status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL, |
124 | (unsigned long *)&bbn); | 124 | &bbn); |
125 | if (status == AE_NOT_FOUND) { | 125 | if (status == AE_NOT_FOUND) { |
126 | /* Assume bus = 0 */ | 126 | /* Assume bus = 0 */ |
127 | printk(KERN_INFO PREFIX | 127 | printk(KERN_INFO PREFIX |
@@ -153,7 +153,7 @@ static int get_root_bridge_busnr(acpi_handle handle) | |||
153 | } | 153 | } |
154 | exit: | 154 | exit: |
155 | acpi_os_free(buffer.pointer); | 155 | acpi_os_free(buffer.pointer); |
156 | return bbn; | 156 | return (int)bbn; |
157 | } | 157 | } |
158 | 158 | ||
159 | static acpi_status | 159 | static acpi_status |
diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c index 95c0a3690b0f..4081c36c8c19 100644 --- a/drivers/block/as-iosched.c +++ b/drivers/block/as-iosched.c | |||
@@ -98,7 +98,6 @@ struct as_data { | |||
98 | 98 | ||
99 | struct as_rq *next_arq[2]; /* next in sort order */ | 99 | struct as_rq *next_arq[2]; /* next in sort order */ |
100 | sector_t last_sector[2]; /* last REQ_SYNC & REQ_ASYNC sectors */ | 100 | sector_t last_sector[2]; /* last REQ_SYNC & REQ_ASYNC sectors */ |
101 | struct list_head *dispatch; /* driver dispatch queue */ | ||
102 | struct list_head *hash; /* request hash */ | 101 | struct list_head *hash; /* request hash */ |
103 | 102 | ||
104 | unsigned long exit_prob; /* probability a task will exit while | 103 | unsigned long exit_prob; /* probability a task will exit while |
@@ -239,6 +238,25 @@ static struct io_context *as_get_io_context(void) | |||
239 | return ioc; | 238 | return ioc; |
240 | } | 239 | } |
241 | 240 | ||
241 | static void as_put_io_context(struct as_rq *arq) | ||
242 | { | ||
243 | struct as_io_context *aic; | ||
244 | |||
245 | if (unlikely(!arq->io_context)) | ||
246 | return; | ||
247 | |||
248 | aic = arq->io_context->aic; | ||
249 | |||
250 | if (arq->is_sync == REQ_SYNC && aic) { | ||
251 | spin_lock(&aic->lock); | ||
252 | set_bit(AS_TASK_IORUNNING, &aic->state); | ||
253 | aic->last_end_request = jiffies; | ||
254 | spin_unlock(&aic->lock); | ||
255 | } | ||
256 | |||
257 | put_io_context(arq->io_context); | ||
258 | } | ||
259 | |||
242 | /* | 260 | /* |
243 | * the back merge hash support functions | 261 | * the back merge hash support functions |
244 | */ | 262 | */ |
@@ -261,14 +279,6 @@ static inline void as_del_arq_hash(struct as_rq *arq) | |||
261 | __as_del_arq_hash(arq); | 279 | __as_del_arq_hash(arq); |
262 | } | 280 | } |
263 | 281 | ||
264 | static void as_remove_merge_hints(request_queue_t *q, struct as_rq *arq) | ||
265 | { | ||
266 | as_del_arq_hash(arq); | ||
267 | |||
268 | if (q->last_merge == arq->request) | ||
269 | q->last_merge = NULL; | ||
270 | } | ||
271 | |||
272 | static void as_add_arq_hash(struct as_data *ad, struct as_rq *arq) | 282 | static void as_add_arq_hash(struct as_data *ad, struct as_rq *arq) |
273 | { | 283 | { |
274 | struct request *rq = arq->request; | 284 | struct request *rq = arq->request; |
@@ -312,7 +322,7 @@ static struct request *as_find_arq_hash(struct as_data *ad, sector_t offset) | |||
312 | BUG_ON(!arq->on_hash); | 322 | BUG_ON(!arq->on_hash); |
313 | 323 | ||
314 | if (!rq_mergeable(__rq)) { | 324 | if (!rq_mergeable(__rq)) { |
315 | as_remove_merge_hints(ad->q, arq); | 325 | as_del_arq_hash(arq); |
316 | continue; | 326 | continue; |
317 | } | 327 | } |
318 | 328 | ||
@@ -950,23 +960,12 @@ static void as_completed_request(request_queue_t *q, struct request *rq) | |||
950 | 960 | ||
951 | WARN_ON(!list_empty(&rq->queuelist)); | 961 | WARN_ON(!list_empty(&rq->queuelist)); |
952 | 962 | ||
953 | if (arq->state == AS_RQ_PRESCHED) { | ||
954 | WARN_ON(arq->io_context); | ||
955 | goto out; | ||
956 | } | ||
957 | |||
958 | if (arq->state == AS_RQ_MERGED) | ||
959 | goto out_ioc; | ||
960 | |||
961 | if (arq->state != AS_RQ_REMOVED) { | 963 | if (arq->state != AS_RQ_REMOVED) { |
962 | printk("arq->state %d\n", arq->state); | 964 | printk("arq->state %d\n", arq->state); |
963 | WARN_ON(1); | 965 | WARN_ON(1); |
964 | goto out; | 966 | goto out; |
965 | } | 967 | } |
966 | 968 | ||
967 | if (!blk_fs_request(rq)) | ||
968 | goto out; | ||
969 | |||
970 | if (ad->changed_batch && ad->nr_dispatched == 1) { | 969 | if (ad->changed_batch && ad->nr_dispatched == 1) { |
971 | kblockd_schedule_work(&ad->antic_work); | 970 | kblockd_schedule_work(&ad->antic_work); |
972 | ad->changed_batch = 0; | 971 | ad->changed_batch = 0; |
@@ -1001,21 +1000,7 @@ static void as_completed_request(request_queue_t *q, struct request *rq) | |||
1001 | } | 1000 | } |
1002 | } | 1001 | } |
1003 | 1002 | ||
1004 | out_ioc: | 1003 | as_put_io_context(arq); |
1005 | if (!arq->io_context) | ||
1006 | goto out; | ||
1007 | |||
1008 | if (arq->is_sync == REQ_SYNC) { | ||
1009 | struct as_io_context *aic = arq->io_context->aic; | ||
1010 | if (aic) { | ||
1011 | spin_lock(&aic->lock); | ||
1012 | set_bit(AS_TASK_IORUNNING, &aic->state); | ||
1013 | aic->last_end_request = jiffies; | ||
1014 | spin_unlock(&aic->lock); | ||
1015 | } | ||
1016 | } | ||
1017 | |||
1018 | put_io_context(arq->io_context); | ||
1019 | out: | 1004 | out: |
1020 | arq->state = AS_RQ_POSTSCHED; | 1005 | arq->state = AS_RQ_POSTSCHED; |
1021 | } | 1006 | } |
@@ -1047,73 +1032,11 @@ static void as_remove_queued_request(request_queue_t *q, struct request *rq) | |||
1047 | ad->next_arq[data_dir] = as_find_next_arq(ad, arq); | 1032 | ad->next_arq[data_dir] = as_find_next_arq(ad, arq); |
1048 | 1033 | ||
1049 | list_del_init(&arq->fifo); | 1034 | list_del_init(&arq->fifo); |
1050 | as_remove_merge_hints(q, arq); | 1035 | as_del_arq_hash(arq); |
1051 | as_del_arq_rb(ad, arq); | 1036 | as_del_arq_rb(ad, arq); |
1052 | } | 1037 | } |
1053 | 1038 | ||
1054 | /* | 1039 | /* |
1055 | * as_remove_dispatched_request is called to remove a request which has gone | ||
1056 | * to the dispatch list. | ||
1057 | */ | ||
1058 | static void as_remove_dispatched_request(request_queue_t *q, struct request *rq) | ||
1059 | { | ||
1060 | struct as_rq *arq = RQ_DATA(rq); | ||
1061 | struct as_io_context *aic; | ||
1062 | |||
1063 | if (!arq) { | ||
1064 | WARN_ON(1); | ||
1065 | return; | ||
1066 | } | ||
1067 | |||
1068 | WARN_ON(arq->state != AS_RQ_DISPATCHED); | ||
1069 | WARN_ON(ON_RB(&arq->rb_node)); | ||
1070 | if (arq->io_context && arq->io_context->aic) { | ||
1071 | aic = arq->io_context->aic; | ||
1072 | if (aic) { | ||
1073 | WARN_ON(!atomic_read(&aic->nr_dispatched)); | ||
1074 | atomic_dec(&aic->nr_dispatched); | ||
1075 | } | ||
1076 | } | ||
1077 | } | ||
1078 | |||
1079 | /* | ||
1080 | * as_remove_request is called when a driver has finished with a request. | ||
1081 | * This should be only called for dispatched requests, but for some reason | ||
1082 | * a POWER4 box running hwscan it does not. | ||
1083 | */ | ||
1084 | static void as_remove_request(request_queue_t *q, struct request *rq) | ||
1085 | { | ||
1086 | struct as_rq *arq = RQ_DATA(rq); | ||
1087 | |||
1088 | if (unlikely(arq->state == AS_RQ_NEW)) | ||
1089 | goto out; | ||
1090 | |||
1091 | if (ON_RB(&arq->rb_node)) { | ||
1092 | if (arq->state != AS_RQ_QUEUED) { | ||
1093 | printk("arq->state %d\n", arq->state); | ||
1094 | WARN_ON(1); | ||
1095 | goto out; | ||
1096 | } | ||
1097 | /* | ||
1098 | * We'll lose the aliased request(s) here. I don't think this | ||
1099 | * will ever happen, but if it does, hopefully someone will | ||
1100 | * report it. | ||
1101 | */ | ||
1102 | WARN_ON(!list_empty(&rq->queuelist)); | ||
1103 | as_remove_queued_request(q, rq); | ||
1104 | } else { | ||
1105 | if (arq->state != AS_RQ_DISPATCHED) { | ||
1106 | printk("arq->state %d\n", arq->state); | ||
1107 | WARN_ON(1); | ||
1108 | goto out; | ||
1109 | } | ||
1110 | as_remove_dispatched_request(q, rq); | ||
1111 | } | ||
1112 | out: | ||
1113 | arq->state = AS_RQ_REMOVED; | ||
1114 | } | ||
1115 | |||
1116 | /* | ||
1117 | * as_fifo_expired returns 0 if there are no expired reads on the fifo, | 1040 | * as_fifo_expired returns 0 if there are no expired reads on the fifo, |
1118 | * 1 otherwise. It is ratelimited so that we only perform the check once per | 1041 | * 1 otherwise. It is ratelimited so that we only perform the check once per |
1119 | * `fifo_expire' interval. Otherwise a large number of expired requests | 1042 | * `fifo_expire' interval. Otherwise a large number of expired requests |
@@ -1165,7 +1088,6 @@ static inline int as_batch_expired(struct as_data *ad) | |||
1165 | static void as_move_to_dispatch(struct as_data *ad, struct as_rq *arq) | 1088 | static void as_move_to_dispatch(struct as_data *ad, struct as_rq *arq) |
1166 | { | 1089 | { |
1167 | struct request *rq = arq->request; | 1090 | struct request *rq = arq->request; |
1168 | struct list_head *insert; | ||
1169 | const int data_dir = arq->is_sync; | 1091 | const int data_dir = arq->is_sync; |
1170 | 1092 | ||
1171 | BUG_ON(!ON_RB(&arq->rb_node)); | 1093 | BUG_ON(!ON_RB(&arq->rb_node)); |
@@ -1198,13 +1120,13 @@ static void as_move_to_dispatch(struct as_data *ad, struct as_rq *arq) | |||
1198 | /* | 1120 | /* |
1199 | * take it off the sort and fifo list, add to dispatch queue | 1121 | * take it off the sort and fifo list, add to dispatch queue |
1200 | */ | 1122 | */ |
1201 | insert = ad->dispatch->prev; | ||
1202 | |||
1203 | while (!list_empty(&rq->queuelist)) { | 1123 | while (!list_empty(&rq->queuelist)) { |
1204 | struct request *__rq = list_entry_rq(rq->queuelist.next); | 1124 | struct request *__rq = list_entry_rq(rq->queuelist.next); |
1205 | struct as_rq *__arq = RQ_DATA(__rq); | 1125 | struct as_rq *__arq = RQ_DATA(__rq); |
1206 | 1126 | ||
1207 | list_move_tail(&__rq->queuelist, ad->dispatch); | 1127 | list_del(&__rq->queuelist); |
1128 | |||
1129 | elv_dispatch_add_tail(ad->q, __rq); | ||
1208 | 1130 | ||
1209 | if (__arq->io_context && __arq->io_context->aic) | 1131 | if (__arq->io_context && __arq->io_context->aic) |
1210 | atomic_inc(&__arq->io_context->aic->nr_dispatched); | 1132 | atomic_inc(&__arq->io_context->aic->nr_dispatched); |
@@ -1218,7 +1140,8 @@ static void as_move_to_dispatch(struct as_data *ad, struct as_rq *arq) | |||
1218 | as_remove_queued_request(ad->q, rq); | 1140 | as_remove_queued_request(ad->q, rq); |
1219 | WARN_ON(arq->state != AS_RQ_QUEUED); | 1141 | WARN_ON(arq->state != AS_RQ_QUEUED); |
1220 | 1142 | ||
1221 | list_add(&rq->queuelist, insert); | 1143 | elv_dispatch_sort(ad->q, rq); |
1144 | |||
1222 | arq->state = AS_RQ_DISPATCHED; | 1145 | arq->state = AS_RQ_DISPATCHED; |
1223 | if (arq->io_context && arq->io_context->aic) | 1146 | if (arq->io_context && arq->io_context->aic) |
1224 | atomic_inc(&arq->io_context->aic->nr_dispatched); | 1147 | atomic_inc(&arq->io_context->aic->nr_dispatched); |
@@ -1230,12 +1153,42 @@ static void as_move_to_dispatch(struct as_data *ad, struct as_rq *arq) | |||
1230 | * read/write expire, batch expire, etc, and moves it to the dispatch | 1153 | * read/write expire, batch expire, etc, and moves it to the dispatch |
1231 | * queue. Returns 1 if a request was found, 0 otherwise. | 1154 | * queue. Returns 1 if a request was found, 0 otherwise. |
1232 | */ | 1155 | */ |
1233 | static int as_dispatch_request(struct as_data *ad) | 1156 | static int as_dispatch_request(request_queue_t *q, int force) |
1234 | { | 1157 | { |
1158 | struct as_data *ad = q->elevator->elevator_data; | ||
1235 | struct as_rq *arq; | 1159 | struct as_rq *arq; |
1236 | const int reads = !list_empty(&ad->fifo_list[REQ_SYNC]); | 1160 | const int reads = !list_empty(&ad->fifo_list[REQ_SYNC]); |
1237 | const int writes = !list_empty(&ad->fifo_list[REQ_ASYNC]); | 1161 | const int writes = !list_empty(&ad->fifo_list[REQ_ASYNC]); |
1238 | 1162 | ||
1163 | if (unlikely(force)) { | ||
1164 | /* | ||
1165 | * Forced dispatch, accounting is useless. Reset | ||
1166 | * accounting states and dump fifo_lists. Note that | ||
1167 | * batch_data_dir is reset to REQ_SYNC to avoid | ||
1168 | * screwing write batch accounting as write batch | ||
1169 | * accounting occurs on W->R transition. | ||
1170 | */ | ||
1171 | int dispatched = 0; | ||
1172 | |||
1173 | ad->batch_data_dir = REQ_SYNC; | ||
1174 | ad->changed_batch = 0; | ||
1175 | ad->new_batch = 0; | ||
1176 | |||
1177 | while (ad->next_arq[REQ_SYNC]) { | ||
1178 | as_move_to_dispatch(ad, ad->next_arq[REQ_SYNC]); | ||
1179 | dispatched++; | ||
1180 | } | ||
1181 | ad->last_check_fifo[REQ_SYNC] = jiffies; | ||
1182 | |||
1183 | while (ad->next_arq[REQ_ASYNC]) { | ||
1184 | as_move_to_dispatch(ad, ad->next_arq[REQ_ASYNC]); | ||
1185 | dispatched++; | ||
1186 | } | ||
1187 | ad->last_check_fifo[REQ_ASYNC] = jiffies; | ||
1188 | |||
1189 | return dispatched; | ||
1190 | } | ||
1191 | |||
1239 | /* Signal that the write batch was uncontended, so we can't time it */ | 1192 | /* Signal that the write batch was uncontended, so we can't time it */ |
1240 | if (ad->batch_data_dir == REQ_ASYNC && !reads) { | 1193 | if (ad->batch_data_dir == REQ_ASYNC && !reads) { |
1241 | if (ad->current_write_count == 0 || !writes) | 1194 | if (ad->current_write_count == 0 || !writes) |
@@ -1359,20 +1312,6 @@ fifo_expired: | |||
1359 | return 1; | 1312 | return 1; |
1360 | } | 1313 | } |
1361 | 1314 | ||
1362 | static struct request *as_next_request(request_queue_t *q) | ||
1363 | { | ||
1364 | struct as_data *ad = q->elevator->elevator_data; | ||
1365 | struct request *rq = NULL; | ||
1366 | |||
1367 | /* | ||
1368 | * if there are still requests on the dispatch queue, grab the first | ||
1369 | */ | ||
1370 | if (!list_empty(ad->dispatch) || as_dispatch_request(ad)) | ||
1371 | rq = list_entry_rq(ad->dispatch->next); | ||
1372 | |||
1373 | return rq; | ||
1374 | } | ||
1375 | |||
1376 | /* | 1315 | /* |
1377 | * Add arq to a list behind alias | 1316 | * Add arq to a list behind alias |
1378 | */ | 1317 | */ |
@@ -1404,17 +1343,25 @@ as_add_aliased_request(struct as_data *ad, struct as_rq *arq, struct as_rq *alia | |||
1404 | /* | 1343 | /* |
1405 | * Don't want to have to handle merges. | 1344 | * Don't want to have to handle merges. |
1406 | */ | 1345 | */ |
1407 | as_remove_merge_hints(ad->q, arq); | 1346 | as_del_arq_hash(arq); |
1408 | } | 1347 | } |
1409 | 1348 | ||
1410 | /* | 1349 | /* |
1411 | * add arq to rbtree and fifo | 1350 | * add arq to rbtree and fifo |
1412 | */ | 1351 | */ |
1413 | static void as_add_request(struct as_data *ad, struct as_rq *arq) | 1352 | static void as_add_request(request_queue_t *q, struct request *rq) |
1414 | { | 1353 | { |
1354 | struct as_data *ad = q->elevator->elevator_data; | ||
1355 | struct as_rq *arq = RQ_DATA(rq); | ||
1415 | struct as_rq *alias; | 1356 | struct as_rq *alias; |
1416 | int data_dir; | 1357 | int data_dir; |
1417 | 1358 | ||
1359 | if (arq->state != AS_RQ_PRESCHED) { | ||
1360 | printk("arq->state: %d\n", arq->state); | ||
1361 | WARN_ON(1); | ||
1362 | } | ||
1363 | arq->state = AS_RQ_NEW; | ||
1364 | |||
1418 | if (rq_data_dir(arq->request) == READ | 1365 | if (rq_data_dir(arq->request) == READ |
1419 | || current->flags&PF_SYNCWRITE) | 1366 | || current->flags&PF_SYNCWRITE) |
1420 | arq->is_sync = 1; | 1367 | arq->is_sync = 1; |
@@ -1437,12 +1384,8 @@ static void as_add_request(struct as_data *ad, struct as_rq *arq) | |||
1437 | arq->expires = jiffies + ad->fifo_expire[data_dir]; | 1384 | arq->expires = jiffies + ad->fifo_expire[data_dir]; |
1438 | list_add_tail(&arq->fifo, &ad->fifo_list[data_dir]); | 1385 | list_add_tail(&arq->fifo, &ad->fifo_list[data_dir]); |
1439 | 1386 | ||
1440 | if (rq_mergeable(arq->request)) { | 1387 | if (rq_mergeable(arq->request)) |
1441 | as_add_arq_hash(ad, arq); | 1388 | as_add_arq_hash(ad, arq); |
1442 | |||
1443 | if (!ad->q->last_merge) | ||
1444 | ad->q->last_merge = arq->request; | ||
1445 | } | ||
1446 | as_update_arq(ad, arq); /* keep state machine up to date */ | 1389 | as_update_arq(ad, arq); /* keep state machine up to date */ |
1447 | 1390 | ||
1448 | } else { | 1391 | } else { |
@@ -1463,96 +1406,24 @@ static void as_add_request(struct as_data *ad, struct as_rq *arq) | |||
1463 | arq->state = AS_RQ_QUEUED; | 1406 | arq->state = AS_RQ_QUEUED; |
1464 | } | 1407 | } |
1465 | 1408 | ||
1466 | static void as_deactivate_request(request_queue_t *q, struct request *rq) | 1409 | static void as_activate_request(request_queue_t *q, struct request *rq) |
1467 | { | 1410 | { |
1468 | struct as_data *ad = q->elevator->elevator_data; | ||
1469 | struct as_rq *arq = RQ_DATA(rq); | 1411 | struct as_rq *arq = RQ_DATA(rq); |
1470 | 1412 | ||
1471 | if (arq) { | 1413 | WARN_ON(arq->state != AS_RQ_DISPATCHED); |
1472 | if (arq->state == AS_RQ_REMOVED) { | 1414 | arq->state = AS_RQ_REMOVED; |
1473 | arq->state = AS_RQ_DISPATCHED; | 1415 | if (arq->io_context && arq->io_context->aic) |
1474 | if (arq->io_context && arq->io_context->aic) | 1416 | atomic_dec(&arq->io_context->aic->nr_dispatched); |
1475 | atomic_inc(&arq->io_context->aic->nr_dispatched); | ||
1476 | } | ||
1477 | } else | ||
1478 | WARN_ON(blk_fs_request(rq) | ||
1479 | && (!(rq->flags & (REQ_HARDBARRIER|REQ_SOFTBARRIER))) ); | ||
1480 | |||
1481 | /* Stop anticipating - let this request get through */ | ||
1482 | as_antic_stop(ad); | ||
1483 | } | ||
1484 | |||
1485 | /* | ||
1486 | * requeue the request. The request has not been completed, nor is it a | ||
1487 | * new request, so don't touch accounting. | ||
1488 | */ | ||
1489 | static void as_requeue_request(request_queue_t *q, struct request *rq) | ||
1490 | { | ||
1491 | as_deactivate_request(q, rq); | ||
1492 | list_add(&rq->queuelist, &q->queue_head); | ||
1493 | } | ||
1494 | |||
1495 | /* | ||
1496 | * Account a request that is inserted directly onto the dispatch queue. | ||
1497 | * arq->io_context->aic->nr_dispatched should not need to be incremented | ||
1498 | * because only new requests should come through here: requeues go through | ||
1499 | * our explicit requeue handler. | ||
1500 | */ | ||
1501 | static void as_account_queued_request(struct as_data *ad, struct request *rq) | ||
1502 | { | ||
1503 | if (blk_fs_request(rq)) { | ||
1504 | struct as_rq *arq = RQ_DATA(rq); | ||
1505 | arq->state = AS_RQ_DISPATCHED; | ||
1506 | ad->nr_dispatched++; | ||
1507 | } | ||
1508 | } | 1417 | } |
1509 | 1418 | ||
1510 | static void | 1419 | static void as_deactivate_request(request_queue_t *q, struct request *rq) |
1511 | as_insert_request(request_queue_t *q, struct request *rq, int where) | ||
1512 | { | 1420 | { |
1513 | struct as_data *ad = q->elevator->elevator_data; | ||
1514 | struct as_rq *arq = RQ_DATA(rq); | 1421 | struct as_rq *arq = RQ_DATA(rq); |
1515 | 1422 | ||
1516 | if (arq) { | 1423 | WARN_ON(arq->state != AS_RQ_REMOVED); |
1517 | if (arq->state != AS_RQ_PRESCHED) { | 1424 | arq->state = AS_RQ_DISPATCHED; |
1518 | printk("arq->state: %d\n", arq->state); | 1425 | if (arq->io_context && arq->io_context->aic) |
1519 | WARN_ON(1); | 1426 | atomic_inc(&arq->io_context->aic->nr_dispatched); |
1520 | } | ||
1521 | arq->state = AS_RQ_NEW; | ||
1522 | } | ||
1523 | |||
1524 | /* barriers must flush the reorder queue */ | ||
1525 | if (unlikely(rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER) | ||
1526 | && where == ELEVATOR_INSERT_SORT)) { | ||
1527 | WARN_ON(1); | ||
1528 | where = ELEVATOR_INSERT_BACK; | ||
1529 | } | ||
1530 | |||
1531 | switch (where) { | ||
1532 | case ELEVATOR_INSERT_BACK: | ||
1533 | while (ad->next_arq[REQ_SYNC]) | ||
1534 | as_move_to_dispatch(ad, ad->next_arq[REQ_SYNC]); | ||
1535 | |||
1536 | while (ad->next_arq[REQ_ASYNC]) | ||
1537 | as_move_to_dispatch(ad, ad->next_arq[REQ_ASYNC]); | ||
1538 | |||
1539 | list_add_tail(&rq->queuelist, ad->dispatch); | ||
1540 | as_account_queued_request(ad, rq); | ||
1541 | as_antic_stop(ad); | ||
1542 | break; | ||
1543 | case ELEVATOR_INSERT_FRONT: | ||
1544 | list_add(&rq->queuelist, ad->dispatch); | ||
1545 | as_account_queued_request(ad, rq); | ||
1546 | as_antic_stop(ad); | ||
1547 | break; | ||
1548 | case ELEVATOR_INSERT_SORT: | ||
1549 | BUG_ON(!blk_fs_request(rq)); | ||
1550 | as_add_request(ad, arq); | ||
1551 | break; | ||
1552 | default: | ||
1553 | BUG(); | ||
1554 | return; | ||
1555 | } | ||
1556 | } | 1427 | } |
1557 | 1428 | ||
1558 | /* | 1429 | /* |
@@ -1565,12 +1436,8 @@ static int as_queue_empty(request_queue_t *q) | |||
1565 | { | 1436 | { |
1566 | struct as_data *ad = q->elevator->elevator_data; | 1437 | struct as_data *ad = q->elevator->elevator_data; |
1567 | 1438 | ||
1568 | if (!list_empty(&ad->fifo_list[REQ_ASYNC]) | 1439 | return list_empty(&ad->fifo_list[REQ_ASYNC]) |
1569 | || !list_empty(&ad->fifo_list[REQ_SYNC]) | 1440 | && list_empty(&ad->fifo_list[REQ_SYNC]); |
1570 | || !list_empty(ad->dispatch)) | ||
1571 | return 0; | ||
1572 | |||
1573 | return 1; | ||
1574 | } | 1441 | } |
1575 | 1442 | ||
1576 | static struct request * | 1443 | static struct request * |
@@ -1608,15 +1475,6 @@ as_merge(request_queue_t *q, struct request **req, struct bio *bio) | |||
1608 | int ret; | 1475 | int ret; |
1609 | 1476 | ||
1610 | /* | 1477 | /* |
1611 | * try last_merge to avoid going to hash | ||
1612 | */ | ||
1613 | ret = elv_try_last_merge(q, bio); | ||
1614 | if (ret != ELEVATOR_NO_MERGE) { | ||
1615 | __rq = q->last_merge; | ||
1616 | goto out_insert; | ||
1617 | } | ||
1618 | |||
1619 | /* | ||
1620 | * see if the merge hash can satisfy a back merge | 1478 | * see if the merge hash can satisfy a back merge |
1621 | */ | 1479 | */ |
1622 | __rq = as_find_arq_hash(ad, bio->bi_sector); | 1480 | __rq = as_find_arq_hash(ad, bio->bi_sector); |
@@ -1644,9 +1502,6 @@ as_merge(request_queue_t *q, struct request **req, struct bio *bio) | |||
1644 | 1502 | ||
1645 | return ELEVATOR_NO_MERGE; | 1503 | return ELEVATOR_NO_MERGE; |
1646 | out: | 1504 | out: |
1647 | if (rq_mergeable(__rq)) | ||
1648 | q->last_merge = __rq; | ||
1649 | out_insert: | ||
1650 | if (ret) { | 1505 | if (ret) { |
1651 | if (rq_mergeable(__rq)) | 1506 | if (rq_mergeable(__rq)) |
1652 | as_hot_arq_hash(ad, RQ_DATA(__rq)); | 1507 | as_hot_arq_hash(ad, RQ_DATA(__rq)); |
@@ -1693,9 +1548,6 @@ static void as_merged_request(request_queue_t *q, struct request *req) | |||
1693 | * behind the disk head. We currently don't bother adjusting. | 1548 | * behind the disk head. We currently don't bother adjusting. |
1694 | */ | 1549 | */ |
1695 | } | 1550 | } |
1696 | |||
1697 | if (arq->on_hash) | ||
1698 | q->last_merge = req; | ||
1699 | } | 1551 | } |
1700 | 1552 | ||
1701 | static void | 1553 | static void |
@@ -1763,6 +1615,7 @@ as_merged_requests(request_queue_t *q, struct request *req, | |||
1763 | * kill knowledge of next, this one is a goner | 1615 | * kill knowledge of next, this one is a goner |
1764 | */ | 1616 | */ |
1765 | as_remove_queued_request(q, next); | 1617 | as_remove_queued_request(q, next); |
1618 | as_put_io_context(anext); | ||
1766 | 1619 | ||
1767 | anext->state = AS_RQ_MERGED; | 1620 | anext->state = AS_RQ_MERGED; |
1768 | } | 1621 | } |
@@ -1782,7 +1635,7 @@ static void as_work_handler(void *data) | |||
1782 | unsigned long flags; | 1635 | unsigned long flags; |
1783 | 1636 | ||
1784 | spin_lock_irqsave(q->queue_lock, flags); | 1637 | spin_lock_irqsave(q->queue_lock, flags); |
1785 | if (as_next_request(q)) | 1638 | if (!as_queue_empty(q)) |
1786 | q->request_fn(q); | 1639 | q->request_fn(q); |
1787 | spin_unlock_irqrestore(q->queue_lock, flags); | 1640 | spin_unlock_irqrestore(q->queue_lock, flags); |
1788 | } | 1641 | } |
@@ -1797,7 +1650,9 @@ static void as_put_request(request_queue_t *q, struct request *rq) | |||
1797 | return; | 1650 | return; |
1798 | } | 1651 | } |
1799 | 1652 | ||
1800 | if (arq->state != AS_RQ_POSTSCHED && arq->state != AS_RQ_PRESCHED) { | 1653 | if (unlikely(arq->state != AS_RQ_POSTSCHED && |
1654 | arq->state != AS_RQ_PRESCHED && | ||
1655 | arq->state != AS_RQ_MERGED)) { | ||
1801 | printk("arq->state %d\n", arq->state); | 1656 | printk("arq->state %d\n", arq->state); |
1802 | WARN_ON(1); | 1657 | WARN_ON(1); |
1803 | } | 1658 | } |
@@ -1807,7 +1662,7 @@ static void as_put_request(request_queue_t *q, struct request *rq) | |||
1807 | } | 1662 | } |
1808 | 1663 | ||
1809 | static int as_set_request(request_queue_t *q, struct request *rq, | 1664 | static int as_set_request(request_queue_t *q, struct request *rq, |
1810 | struct bio *bio, int gfp_mask) | 1665 | struct bio *bio, gfp_t gfp_mask) |
1811 | { | 1666 | { |
1812 | struct as_data *ad = q->elevator->elevator_data; | 1667 | struct as_data *ad = q->elevator->elevator_data; |
1813 | struct as_rq *arq = mempool_alloc(ad->arq_pool, gfp_mask); | 1668 | struct as_rq *arq = mempool_alloc(ad->arq_pool, gfp_mask); |
@@ -1907,7 +1762,6 @@ static int as_init_queue(request_queue_t *q, elevator_t *e) | |||
1907 | INIT_LIST_HEAD(&ad->fifo_list[REQ_ASYNC]); | 1762 | INIT_LIST_HEAD(&ad->fifo_list[REQ_ASYNC]); |
1908 | ad->sort_list[REQ_SYNC] = RB_ROOT; | 1763 | ad->sort_list[REQ_SYNC] = RB_ROOT; |
1909 | ad->sort_list[REQ_ASYNC] = RB_ROOT; | 1764 | ad->sort_list[REQ_ASYNC] = RB_ROOT; |
1910 | ad->dispatch = &q->queue_head; | ||
1911 | ad->fifo_expire[REQ_SYNC] = default_read_expire; | 1765 | ad->fifo_expire[REQ_SYNC] = default_read_expire; |
1912 | ad->fifo_expire[REQ_ASYNC] = default_write_expire; | 1766 | ad->fifo_expire[REQ_ASYNC] = default_write_expire; |
1913 | ad->antic_expire = default_antic_expire; | 1767 | ad->antic_expire = default_antic_expire; |
@@ -2072,10 +1926,9 @@ static struct elevator_type iosched_as = { | |||
2072 | .elevator_merge_fn = as_merge, | 1926 | .elevator_merge_fn = as_merge, |
2073 | .elevator_merged_fn = as_merged_request, | 1927 | .elevator_merged_fn = as_merged_request, |
2074 | .elevator_merge_req_fn = as_merged_requests, | 1928 | .elevator_merge_req_fn = as_merged_requests, |
2075 | .elevator_next_req_fn = as_next_request, | 1929 | .elevator_dispatch_fn = as_dispatch_request, |
2076 | .elevator_add_req_fn = as_insert_request, | 1930 | .elevator_add_req_fn = as_add_request, |
2077 | .elevator_remove_req_fn = as_remove_request, | 1931 | .elevator_activate_req_fn = as_activate_request, |
2078 | .elevator_requeue_req_fn = as_requeue_request, | ||
2079 | .elevator_deactivate_req_fn = as_deactivate_request, | 1932 | .elevator_deactivate_req_fn = as_deactivate_request, |
2080 | .elevator_queue_empty_fn = as_queue_empty, | 1933 | .elevator_queue_empty_fn = as_queue_empty, |
2081 | .elevator_completed_req_fn = as_completed_request, | 1934 | .elevator_completed_req_fn = as_completed_request, |
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c index cd056e7e64ec..94690e4d41e0 100644 --- a/drivers/block/cfq-iosched.c +++ b/drivers/block/cfq-iosched.c | |||
@@ -84,7 +84,6 @@ static int cfq_max_depth = 2; | |||
84 | (node)->rb_left = NULL; \ | 84 | (node)->rb_left = NULL; \ |
85 | } while (0) | 85 | } while (0) |
86 | #define RB_CLEAR_ROOT(root) ((root)->rb_node = NULL) | 86 | #define RB_CLEAR_ROOT(root) ((root)->rb_node = NULL) |
87 | #define ON_RB(node) ((node)->rb_color != RB_NONE) | ||
88 | #define rb_entry_crq(node) rb_entry((node), struct cfq_rq, rb_node) | 87 | #define rb_entry_crq(node) rb_entry((node), struct cfq_rq, rb_node) |
89 | #define rq_rb_key(rq) (rq)->sector | 88 | #define rq_rb_key(rq) (rq)->sector |
90 | 89 | ||
@@ -271,10 +270,7 @@ CFQ_CFQQ_FNS(expired); | |||
271 | #undef CFQ_CFQQ_FNS | 270 | #undef CFQ_CFQQ_FNS |
272 | 271 | ||
273 | enum cfq_rq_state_flags { | 272 | enum cfq_rq_state_flags { |
274 | CFQ_CRQ_FLAG_in_flight = 0, | 273 | CFQ_CRQ_FLAG_is_sync = 0, |
275 | CFQ_CRQ_FLAG_in_driver, | ||
276 | CFQ_CRQ_FLAG_is_sync, | ||
277 | CFQ_CRQ_FLAG_requeued, | ||
278 | }; | 274 | }; |
279 | 275 | ||
280 | #define CFQ_CRQ_FNS(name) \ | 276 | #define CFQ_CRQ_FNS(name) \ |
@@ -291,14 +287,11 @@ static inline int cfq_crq_##name(const struct cfq_rq *crq) \ | |||
291 | return (crq->crq_flags & (1 << CFQ_CRQ_FLAG_##name)) != 0; \ | 287 | return (crq->crq_flags & (1 << CFQ_CRQ_FLAG_##name)) != 0; \ |
292 | } | 288 | } |
293 | 289 | ||
294 | CFQ_CRQ_FNS(in_flight); | ||
295 | CFQ_CRQ_FNS(in_driver); | ||
296 | CFQ_CRQ_FNS(is_sync); | 290 | CFQ_CRQ_FNS(is_sync); |
297 | CFQ_CRQ_FNS(requeued); | ||
298 | #undef CFQ_CRQ_FNS | 291 | #undef CFQ_CRQ_FNS |
299 | 292 | ||
300 | static struct cfq_queue *cfq_find_cfq_hash(struct cfq_data *, unsigned int, unsigned short); | 293 | static struct cfq_queue *cfq_find_cfq_hash(struct cfq_data *, unsigned int, unsigned short); |
301 | static void cfq_dispatch_sort(request_queue_t *, struct cfq_rq *); | 294 | static void cfq_dispatch_insert(request_queue_t *, struct cfq_rq *); |
302 | static void cfq_put_cfqd(struct cfq_data *cfqd); | 295 | static void cfq_put_cfqd(struct cfq_data *cfqd); |
303 | 296 | ||
304 | #define process_sync(tsk) ((tsk)->flags & PF_SYNCWRITE) | 297 | #define process_sync(tsk) ((tsk)->flags & PF_SYNCWRITE) |
@@ -311,14 +304,6 @@ static inline void cfq_del_crq_hash(struct cfq_rq *crq) | |||
311 | hlist_del_init(&crq->hash); | 304 | hlist_del_init(&crq->hash); |
312 | } | 305 | } |
313 | 306 | ||
314 | static void cfq_remove_merge_hints(request_queue_t *q, struct cfq_rq *crq) | ||
315 | { | ||
316 | cfq_del_crq_hash(crq); | ||
317 | |||
318 | if (q->last_merge == crq->request) | ||
319 | q->last_merge = NULL; | ||
320 | } | ||
321 | |||
322 | static inline void cfq_add_crq_hash(struct cfq_data *cfqd, struct cfq_rq *crq) | 307 | static inline void cfq_add_crq_hash(struct cfq_data *cfqd, struct cfq_rq *crq) |
323 | { | 308 | { |
324 | const int hash_idx = CFQ_MHASH_FN(rq_hash_key(crq->request)); | 309 | const int hash_idx = CFQ_MHASH_FN(rq_hash_key(crq->request)); |
@@ -347,18 +332,13 @@ static struct request *cfq_find_rq_hash(struct cfq_data *cfqd, sector_t offset) | |||
347 | return NULL; | 332 | return NULL; |
348 | } | 333 | } |
349 | 334 | ||
350 | static inline int cfq_pending_requests(struct cfq_data *cfqd) | ||
351 | { | ||
352 | return !list_empty(&cfqd->queue->queue_head) || cfqd->busy_queues; | ||
353 | } | ||
354 | |||
355 | /* | 335 | /* |
356 | * scheduler run of queue, if there are requests pending and no one in the | 336 | * scheduler run of queue, if there are requests pending and no one in the |
357 | * driver that will restart queueing | 337 | * driver that will restart queueing |
358 | */ | 338 | */ |
359 | static inline void cfq_schedule_dispatch(struct cfq_data *cfqd) | 339 | static inline void cfq_schedule_dispatch(struct cfq_data *cfqd) |
360 | { | 340 | { |
361 | if (!cfqd->rq_in_driver && cfq_pending_requests(cfqd)) | 341 | if (!cfqd->rq_in_driver && cfqd->busy_queues) |
362 | kblockd_schedule_work(&cfqd->unplug_work); | 342 | kblockd_schedule_work(&cfqd->unplug_work); |
363 | } | 343 | } |
364 | 344 | ||
@@ -366,7 +346,7 @@ static int cfq_queue_empty(request_queue_t *q) | |||
366 | { | 346 | { |
367 | struct cfq_data *cfqd = q->elevator->elevator_data; | 347 | struct cfq_data *cfqd = q->elevator->elevator_data; |
368 | 348 | ||
369 | return !cfq_pending_requests(cfqd); | 349 | return !cfqd->busy_queues; |
370 | } | 350 | } |
371 | 351 | ||
372 | /* | 352 | /* |
@@ -386,11 +366,6 @@ cfq_choose_req(struct cfq_data *cfqd, struct cfq_rq *crq1, struct cfq_rq *crq2) | |||
386 | if (crq2 == NULL) | 366 | if (crq2 == NULL) |
387 | return crq1; | 367 | return crq1; |
388 | 368 | ||
389 | if (cfq_crq_requeued(crq1) && !cfq_crq_requeued(crq2)) | ||
390 | return crq1; | ||
391 | else if (cfq_crq_requeued(crq2) && !cfq_crq_requeued(crq1)) | ||
392 | return crq2; | ||
393 | |||
394 | if (cfq_crq_is_sync(crq1) && !cfq_crq_is_sync(crq2)) | 369 | if (cfq_crq_is_sync(crq1) && !cfq_crq_is_sync(crq2)) |
395 | return crq1; | 370 | return crq1; |
396 | else if (cfq_crq_is_sync(crq2) && !cfq_crq_is_sync(crq1)) | 371 | else if (cfq_crq_is_sync(crq2) && !cfq_crq_is_sync(crq1)) |
@@ -461,10 +436,7 @@ cfq_find_next_crq(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
461 | struct cfq_rq *crq_next = NULL, *crq_prev = NULL; | 436 | struct cfq_rq *crq_next = NULL, *crq_prev = NULL; |
462 | struct rb_node *rbnext, *rbprev; | 437 | struct rb_node *rbnext, *rbprev; |
463 | 438 | ||
464 | rbnext = NULL; | 439 | if (!(rbnext = rb_next(&last->rb_node))) { |
465 | if (ON_RB(&last->rb_node)) | ||
466 | rbnext = rb_next(&last->rb_node); | ||
467 | if (!rbnext) { | ||
468 | rbnext = rb_first(&cfqq->sort_list); | 440 | rbnext = rb_first(&cfqq->sort_list); |
469 | if (rbnext == &last->rb_node) | 441 | if (rbnext == &last->rb_node) |
470 | rbnext = NULL; | 442 | rbnext = NULL; |
@@ -545,13 +517,13 @@ static void cfq_resort_rr_list(struct cfq_queue *cfqq, int preempted) | |||
545 | * the pending list according to last request service | 517 | * the pending list according to last request service |
546 | */ | 518 | */ |
547 | static inline void | 519 | static inline void |
548 | cfq_add_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq, int requeue) | 520 | cfq_add_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq) |
549 | { | 521 | { |
550 | BUG_ON(cfq_cfqq_on_rr(cfqq)); | 522 | BUG_ON(cfq_cfqq_on_rr(cfqq)); |
551 | cfq_mark_cfqq_on_rr(cfqq); | 523 | cfq_mark_cfqq_on_rr(cfqq); |
552 | cfqd->busy_queues++; | 524 | cfqd->busy_queues++; |
553 | 525 | ||
554 | cfq_resort_rr_list(cfqq, requeue); | 526 | cfq_resort_rr_list(cfqq, 0); |
555 | } | 527 | } |
556 | 528 | ||
557 | static inline void | 529 | static inline void |
@@ -571,22 +543,19 @@ cfq_del_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
571 | static inline void cfq_del_crq_rb(struct cfq_rq *crq) | 543 | static inline void cfq_del_crq_rb(struct cfq_rq *crq) |
572 | { | 544 | { |
573 | struct cfq_queue *cfqq = crq->cfq_queue; | 545 | struct cfq_queue *cfqq = crq->cfq_queue; |
546 | struct cfq_data *cfqd = cfqq->cfqd; | ||
547 | const int sync = cfq_crq_is_sync(crq); | ||
574 | 548 | ||
575 | if (ON_RB(&crq->rb_node)) { | 549 | BUG_ON(!cfqq->queued[sync]); |
576 | struct cfq_data *cfqd = cfqq->cfqd; | 550 | cfqq->queued[sync]--; |
577 | const int sync = cfq_crq_is_sync(crq); | ||
578 | 551 | ||
579 | BUG_ON(!cfqq->queued[sync]); | 552 | cfq_update_next_crq(crq); |
580 | cfqq->queued[sync]--; | ||
581 | 553 | ||
582 | cfq_update_next_crq(crq); | 554 | rb_erase(&crq->rb_node, &cfqq->sort_list); |
555 | RB_CLEAR_COLOR(&crq->rb_node); | ||
583 | 556 | ||
584 | rb_erase(&crq->rb_node, &cfqq->sort_list); | 557 | if (cfq_cfqq_on_rr(cfqq) && RB_EMPTY(&cfqq->sort_list)) |
585 | RB_CLEAR_COLOR(&crq->rb_node); | 558 | cfq_del_cfqq_rr(cfqd, cfqq); |
586 | |||
587 | if (cfq_cfqq_on_rr(cfqq) && RB_EMPTY(&cfqq->sort_list)) | ||
588 | cfq_del_cfqq_rr(cfqd, cfqq); | ||
589 | } | ||
590 | } | 559 | } |
591 | 560 | ||
592 | static struct cfq_rq * | 561 | static struct cfq_rq * |
@@ -627,12 +596,12 @@ static void cfq_add_crq_rb(struct cfq_rq *crq) | |||
627 | * if that happens, put the alias on the dispatch list | 596 | * if that happens, put the alias on the dispatch list |
628 | */ | 597 | */ |
629 | while ((__alias = __cfq_add_crq_rb(crq)) != NULL) | 598 | while ((__alias = __cfq_add_crq_rb(crq)) != NULL) |
630 | cfq_dispatch_sort(cfqd->queue, __alias); | 599 | cfq_dispatch_insert(cfqd->queue, __alias); |
631 | 600 | ||
632 | rb_insert_color(&crq->rb_node, &cfqq->sort_list); | 601 | rb_insert_color(&crq->rb_node, &cfqq->sort_list); |
633 | 602 | ||
634 | if (!cfq_cfqq_on_rr(cfqq)) | 603 | if (!cfq_cfqq_on_rr(cfqq)) |
635 | cfq_add_cfqq_rr(cfqd, cfqq, cfq_crq_requeued(crq)); | 604 | cfq_add_cfqq_rr(cfqd, cfqq); |
636 | 605 | ||
637 | /* | 606 | /* |
638 | * check if this request is a better next-serve candidate | 607 | * check if this request is a better next-serve candidate |
@@ -643,10 +612,8 @@ static void cfq_add_crq_rb(struct cfq_rq *crq) | |||
643 | static inline void | 612 | static inline void |
644 | cfq_reposition_crq_rb(struct cfq_queue *cfqq, struct cfq_rq *crq) | 613 | cfq_reposition_crq_rb(struct cfq_queue *cfqq, struct cfq_rq *crq) |
645 | { | 614 | { |
646 | if (ON_RB(&crq->rb_node)) { | 615 | rb_erase(&crq->rb_node, &cfqq->sort_list); |
647 | rb_erase(&crq->rb_node, &cfqq->sort_list); | 616 | cfqq->queued[cfq_crq_is_sync(crq)]--; |
648 | cfqq->queued[cfq_crq_is_sync(crq)]--; | ||
649 | } | ||
650 | 617 | ||
651 | cfq_add_crq_rb(crq); | 618 | cfq_add_crq_rb(crq); |
652 | } | 619 | } |
@@ -676,49 +643,28 @@ out: | |||
676 | return NULL; | 643 | return NULL; |
677 | } | 644 | } |
678 | 645 | ||
679 | static void cfq_deactivate_request(request_queue_t *q, struct request *rq) | 646 | static void cfq_activate_request(request_queue_t *q, struct request *rq) |
680 | { | 647 | { |
681 | struct cfq_data *cfqd = q->elevator->elevator_data; | 648 | struct cfq_data *cfqd = q->elevator->elevator_data; |
682 | struct cfq_rq *crq = RQ_DATA(rq); | ||
683 | |||
684 | if (crq) { | ||
685 | struct cfq_queue *cfqq = crq->cfq_queue; | ||
686 | |||
687 | if (cfq_crq_in_driver(crq)) { | ||
688 | cfq_clear_crq_in_driver(crq); | ||
689 | WARN_ON(!cfqd->rq_in_driver); | ||
690 | cfqd->rq_in_driver--; | ||
691 | } | ||
692 | if (cfq_crq_in_flight(crq)) { | ||
693 | const int sync = cfq_crq_is_sync(crq); | ||
694 | 649 | ||
695 | cfq_clear_crq_in_flight(crq); | 650 | cfqd->rq_in_driver++; |
696 | WARN_ON(!cfqq->on_dispatch[sync]); | ||
697 | cfqq->on_dispatch[sync]--; | ||
698 | } | ||
699 | cfq_mark_crq_requeued(crq); | ||
700 | } | ||
701 | } | 651 | } |
702 | 652 | ||
703 | /* | 653 | static void cfq_deactivate_request(request_queue_t *q, struct request *rq) |
704 | * make sure the service time gets corrected on reissue of this request | ||
705 | */ | ||
706 | static void cfq_requeue_request(request_queue_t *q, struct request *rq) | ||
707 | { | 654 | { |
708 | cfq_deactivate_request(q, rq); | 655 | struct cfq_data *cfqd = q->elevator->elevator_data; |
709 | list_add(&rq->queuelist, &q->queue_head); | 656 | |
657 | WARN_ON(!cfqd->rq_in_driver); | ||
658 | cfqd->rq_in_driver--; | ||
710 | } | 659 | } |
711 | 660 | ||
712 | static void cfq_remove_request(request_queue_t *q, struct request *rq) | 661 | static void cfq_remove_request(struct request *rq) |
713 | { | 662 | { |
714 | struct cfq_rq *crq = RQ_DATA(rq); | 663 | struct cfq_rq *crq = RQ_DATA(rq); |
715 | 664 | ||
716 | if (crq) { | 665 | list_del_init(&rq->queuelist); |
717 | list_del_init(&rq->queuelist); | 666 | cfq_del_crq_rb(crq); |
718 | cfq_del_crq_rb(crq); | 667 | cfq_del_crq_hash(crq); |
719 | cfq_remove_merge_hints(q, crq); | ||
720 | |||
721 | } | ||
722 | } | 668 | } |
723 | 669 | ||
724 | static int | 670 | static int |
@@ -728,12 +674,6 @@ cfq_merge(request_queue_t *q, struct request **req, struct bio *bio) | |||
728 | struct request *__rq; | 674 | struct request *__rq; |
729 | int ret; | 675 | int ret; |
730 | 676 | ||
731 | ret = elv_try_last_merge(q, bio); | ||
732 | if (ret != ELEVATOR_NO_MERGE) { | ||
733 | __rq = q->last_merge; | ||
734 | goto out_insert; | ||
735 | } | ||
736 | |||
737 | __rq = cfq_find_rq_hash(cfqd, bio->bi_sector); | 677 | __rq = cfq_find_rq_hash(cfqd, bio->bi_sector); |
738 | if (__rq && elv_rq_merge_ok(__rq, bio)) { | 678 | if (__rq && elv_rq_merge_ok(__rq, bio)) { |
739 | ret = ELEVATOR_BACK_MERGE; | 679 | ret = ELEVATOR_BACK_MERGE; |
@@ -748,8 +688,6 @@ cfq_merge(request_queue_t *q, struct request **req, struct bio *bio) | |||
748 | 688 | ||
749 | return ELEVATOR_NO_MERGE; | 689 | return ELEVATOR_NO_MERGE; |
750 | out: | 690 | out: |
751 | q->last_merge = __rq; | ||
752 | out_insert: | ||
753 | *req = __rq; | 691 | *req = __rq; |
754 | return ret; | 692 | return ret; |
755 | } | 693 | } |
@@ -762,14 +700,12 @@ static void cfq_merged_request(request_queue_t *q, struct request *req) | |||
762 | cfq_del_crq_hash(crq); | 700 | cfq_del_crq_hash(crq); |
763 | cfq_add_crq_hash(cfqd, crq); | 701 | cfq_add_crq_hash(cfqd, crq); |
764 | 702 | ||
765 | if (ON_RB(&crq->rb_node) && (rq_rb_key(req) != crq->rb_key)) { | 703 | if (rq_rb_key(req) != crq->rb_key) { |
766 | struct cfq_queue *cfqq = crq->cfq_queue; | 704 | struct cfq_queue *cfqq = crq->cfq_queue; |
767 | 705 | ||
768 | cfq_update_next_crq(crq); | 706 | cfq_update_next_crq(crq); |
769 | cfq_reposition_crq_rb(cfqq, crq); | 707 | cfq_reposition_crq_rb(cfqq, crq); |
770 | } | 708 | } |
771 | |||
772 | q->last_merge = req; | ||
773 | } | 709 | } |
774 | 710 | ||
775 | static void | 711 | static void |
@@ -785,7 +721,7 @@ cfq_merged_requests(request_queue_t *q, struct request *rq, | |||
785 | time_before(next->start_time, rq->start_time)) | 721 | time_before(next->start_time, rq->start_time)) |
786 | list_move(&rq->queuelist, &next->queuelist); | 722 | list_move(&rq->queuelist, &next->queuelist); |
787 | 723 | ||
788 | cfq_remove_request(q, next); | 724 | cfq_remove_request(next); |
789 | } | 725 | } |
790 | 726 | ||
791 | static inline void | 727 | static inline void |
@@ -992,53 +928,15 @@ static int cfq_arm_slice_timer(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
992 | return 1; | 928 | return 1; |
993 | } | 929 | } |
994 | 930 | ||
995 | /* | 931 | static void cfq_dispatch_insert(request_queue_t *q, struct cfq_rq *crq) |
996 | * we dispatch cfqd->cfq_quantum requests in total from the rr_list queues, | ||
997 | * this function sector sorts the selected request to minimize seeks. we start | ||
998 | * at cfqd->last_sector, not 0. | ||
999 | */ | ||
1000 | static void cfq_dispatch_sort(request_queue_t *q, struct cfq_rq *crq) | ||
1001 | { | 932 | { |
1002 | struct cfq_data *cfqd = q->elevator->elevator_data; | 933 | struct cfq_data *cfqd = q->elevator->elevator_data; |
1003 | struct cfq_queue *cfqq = crq->cfq_queue; | 934 | struct cfq_queue *cfqq = crq->cfq_queue; |
1004 | struct list_head *head = &q->queue_head, *entry = head; | ||
1005 | struct request *__rq; | ||
1006 | sector_t last; | ||
1007 | |||
1008 | list_del(&crq->request->queuelist); | ||
1009 | |||
1010 | last = cfqd->last_sector; | ||
1011 | list_for_each_entry_reverse(__rq, head, queuelist) { | ||
1012 | struct cfq_rq *__crq = RQ_DATA(__rq); | ||
1013 | |||
1014 | if (blk_barrier_rq(__rq)) | ||
1015 | break; | ||
1016 | if (!blk_fs_request(__rq)) | ||
1017 | break; | ||
1018 | if (cfq_crq_requeued(__crq)) | ||
1019 | break; | ||
1020 | |||
1021 | if (__rq->sector <= crq->request->sector) | ||
1022 | break; | ||
1023 | if (__rq->sector > last && crq->request->sector < last) { | ||
1024 | last = crq->request->sector + crq->request->nr_sectors; | ||
1025 | break; | ||
1026 | } | ||
1027 | entry = &__rq->queuelist; | ||
1028 | } | ||
1029 | |||
1030 | cfqd->last_sector = last; | ||
1031 | 935 | ||
1032 | cfqq->next_crq = cfq_find_next_crq(cfqd, cfqq, crq); | 936 | cfqq->next_crq = cfq_find_next_crq(cfqd, cfqq, crq); |
1033 | 937 | cfq_remove_request(crq->request); | |
1034 | cfq_del_crq_rb(crq); | ||
1035 | cfq_remove_merge_hints(q, crq); | ||
1036 | |||
1037 | cfq_mark_crq_in_flight(crq); | ||
1038 | cfq_clear_crq_requeued(crq); | ||
1039 | |||
1040 | cfqq->on_dispatch[cfq_crq_is_sync(crq)]++; | 938 | cfqq->on_dispatch[cfq_crq_is_sync(crq)]++; |
1041 | list_add_tail(&crq->request->queuelist, entry); | 939 | elv_dispatch_sort(q, crq->request); |
1042 | } | 940 | } |
1043 | 941 | ||
1044 | /* | 942 | /* |
@@ -1159,7 +1057,7 @@ __cfq_dispatch_requests(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1159 | /* | 1057 | /* |
1160 | * finally, insert request into driver dispatch list | 1058 | * finally, insert request into driver dispatch list |
1161 | */ | 1059 | */ |
1162 | cfq_dispatch_sort(cfqd->queue, crq); | 1060 | cfq_dispatch_insert(cfqd->queue, crq); |
1163 | 1061 | ||
1164 | cfqd->dispatch_slice++; | 1062 | cfqd->dispatch_slice++; |
1165 | dispatched++; | 1063 | dispatched++; |
@@ -1194,7 +1092,7 @@ __cfq_dispatch_requests(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1194 | } | 1092 | } |
1195 | 1093 | ||
1196 | static int | 1094 | static int |
1197 | cfq_dispatch_requests(request_queue_t *q, int max_dispatch, int force) | 1095 | cfq_dispatch_requests(request_queue_t *q, int force) |
1198 | { | 1096 | { |
1199 | struct cfq_data *cfqd = q->elevator->elevator_data; | 1097 | struct cfq_data *cfqd = q->elevator->elevator_data; |
1200 | struct cfq_queue *cfqq; | 1098 | struct cfq_queue *cfqq; |
@@ -1204,12 +1102,25 @@ cfq_dispatch_requests(request_queue_t *q, int max_dispatch, int force) | |||
1204 | 1102 | ||
1205 | cfqq = cfq_select_queue(cfqd, force); | 1103 | cfqq = cfq_select_queue(cfqd, force); |
1206 | if (cfqq) { | 1104 | if (cfqq) { |
1105 | int max_dispatch; | ||
1106 | |||
1107 | /* | ||
1108 | * if idle window is disabled, allow queue buildup | ||
1109 | */ | ||
1110 | if (!cfq_cfqq_idle_window(cfqq) && | ||
1111 | cfqd->rq_in_driver >= cfqd->cfq_max_depth) | ||
1112 | return 0; | ||
1113 | |||
1207 | cfq_clear_cfqq_must_dispatch(cfqq); | 1114 | cfq_clear_cfqq_must_dispatch(cfqq); |
1208 | cfq_clear_cfqq_wait_request(cfqq); | 1115 | cfq_clear_cfqq_wait_request(cfqq); |
1209 | del_timer(&cfqd->idle_slice_timer); | 1116 | del_timer(&cfqd->idle_slice_timer); |
1210 | 1117 | ||
1211 | if (cfq_class_idle(cfqq)) | 1118 | if (!force) { |
1212 | max_dispatch = 1; | 1119 | max_dispatch = cfqd->cfq_quantum; |
1120 | if (cfq_class_idle(cfqq)) | ||
1121 | max_dispatch = 1; | ||
1122 | } else | ||
1123 | max_dispatch = INT_MAX; | ||
1213 | 1124 | ||
1214 | return __cfq_dispatch_requests(cfqd, cfqq, max_dispatch); | 1125 | return __cfq_dispatch_requests(cfqd, cfqq, max_dispatch); |
1215 | } | 1126 | } |
@@ -1217,93 +1128,6 @@ cfq_dispatch_requests(request_queue_t *q, int max_dispatch, int force) | |||
1217 | return 0; | 1128 | return 0; |
1218 | } | 1129 | } |
1219 | 1130 | ||
1220 | static inline void cfq_account_dispatch(struct cfq_rq *crq) | ||
1221 | { | ||
1222 | struct cfq_queue *cfqq = crq->cfq_queue; | ||
1223 | struct cfq_data *cfqd = cfqq->cfqd; | ||
1224 | |||
1225 | if (unlikely(!blk_fs_request(crq->request))) | ||
1226 | return; | ||
1227 | |||
1228 | /* | ||
1229 | * accounted bit is necessary since some drivers will call | ||
1230 | * elv_next_request() many times for the same request (eg ide) | ||
1231 | */ | ||
1232 | if (cfq_crq_in_driver(crq)) | ||
1233 | return; | ||
1234 | |||
1235 | cfq_mark_crq_in_driver(crq); | ||
1236 | cfqd->rq_in_driver++; | ||
1237 | } | ||
1238 | |||
1239 | static inline void | ||
1240 | cfq_account_completion(struct cfq_queue *cfqq, struct cfq_rq *crq) | ||
1241 | { | ||
1242 | struct cfq_data *cfqd = cfqq->cfqd; | ||
1243 | unsigned long now; | ||
1244 | |||
1245 | if (!cfq_crq_in_driver(crq)) | ||
1246 | return; | ||
1247 | |||
1248 | now = jiffies; | ||
1249 | |||
1250 | WARN_ON(!cfqd->rq_in_driver); | ||
1251 | cfqd->rq_in_driver--; | ||
1252 | |||
1253 | if (!cfq_class_idle(cfqq)) | ||
1254 | cfqd->last_end_request = now; | ||
1255 | |||
1256 | if (!cfq_cfqq_dispatched(cfqq)) { | ||
1257 | if (cfq_cfqq_on_rr(cfqq)) { | ||
1258 | cfqq->service_last = now; | ||
1259 | cfq_resort_rr_list(cfqq, 0); | ||
1260 | } | ||
1261 | if (cfq_cfqq_expired(cfqq)) { | ||
1262 | __cfq_slice_expired(cfqd, cfqq, 0); | ||
1263 | cfq_schedule_dispatch(cfqd); | ||
1264 | } | ||
1265 | } | ||
1266 | |||
1267 | if (cfq_crq_is_sync(crq)) | ||
1268 | crq->io_context->last_end_request = now; | ||
1269 | } | ||
1270 | |||
1271 | static struct request *cfq_next_request(request_queue_t *q) | ||
1272 | { | ||
1273 | struct cfq_data *cfqd = q->elevator->elevator_data; | ||
1274 | struct request *rq; | ||
1275 | |||
1276 | if (!list_empty(&q->queue_head)) { | ||
1277 | struct cfq_rq *crq; | ||
1278 | dispatch: | ||
1279 | rq = list_entry_rq(q->queue_head.next); | ||
1280 | |||
1281 | crq = RQ_DATA(rq); | ||
1282 | if (crq) { | ||
1283 | struct cfq_queue *cfqq = crq->cfq_queue; | ||
1284 | |||
1285 | /* | ||
1286 | * if idle window is disabled, allow queue buildup | ||
1287 | */ | ||
1288 | if (!cfq_crq_in_driver(crq) && | ||
1289 | !cfq_cfqq_idle_window(cfqq) && | ||
1290 | !blk_barrier_rq(rq) && | ||
1291 | cfqd->rq_in_driver >= cfqd->cfq_max_depth) | ||
1292 | return NULL; | ||
1293 | |||
1294 | cfq_remove_merge_hints(q, crq); | ||
1295 | cfq_account_dispatch(crq); | ||
1296 | } | ||
1297 | |||
1298 | return rq; | ||
1299 | } | ||
1300 | |||
1301 | if (cfq_dispatch_requests(q, cfqd->cfq_quantum, 0)) | ||
1302 | goto dispatch; | ||
1303 | |||
1304 | return NULL; | ||
1305 | } | ||
1306 | |||
1307 | /* | 1131 | /* |
1308 | * task holds one reference to the queue, dropped when task exits. each crq | 1132 | * task holds one reference to the queue, dropped when task exits. each crq |
1309 | * in-flight on this queue also holds a reference, dropped when crq is freed. | 1133 | * in-flight on this queue also holds a reference, dropped when crq is freed. |
@@ -1422,7 +1246,7 @@ static void cfq_exit_io_context(struct cfq_io_context *cic) | |||
1422 | } | 1246 | } |
1423 | 1247 | ||
1424 | static struct cfq_io_context * | 1248 | static struct cfq_io_context * |
1425 | cfq_alloc_io_context(struct cfq_data *cfqd, int gfp_mask) | 1249 | cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) |
1426 | { | 1250 | { |
1427 | struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask); | 1251 | struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask); |
1428 | 1252 | ||
@@ -1517,7 +1341,7 @@ static int cfq_ioc_set_ioprio(struct io_context *ioc, unsigned int ioprio) | |||
1517 | 1341 | ||
1518 | static struct cfq_queue * | 1342 | static struct cfq_queue * |
1519 | cfq_get_queue(struct cfq_data *cfqd, unsigned int key, unsigned short ioprio, | 1343 | cfq_get_queue(struct cfq_data *cfqd, unsigned int key, unsigned short ioprio, |
1520 | int gfp_mask) | 1344 | gfp_t gfp_mask) |
1521 | { | 1345 | { |
1522 | const int hashval = hash_long(key, CFQ_QHASH_SHIFT); | 1346 | const int hashval = hash_long(key, CFQ_QHASH_SHIFT); |
1523 | struct cfq_queue *cfqq, *new_cfqq = NULL; | 1347 | struct cfq_queue *cfqq, *new_cfqq = NULL; |
@@ -1578,7 +1402,7 @@ out: | |||
1578 | * cfqq, so we don't need to worry about it disappearing | 1402 | * cfqq, so we don't need to worry about it disappearing |
1579 | */ | 1403 | */ |
1580 | static struct cfq_io_context * | 1404 | static struct cfq_io_context * |
1581 | cfq_get_io_context(struct cfq_data *cfqd, pid_t pid, int gfp_mask) | 1405 | cfq_get_io_context(struct cfq_data *cfqd, pid_t pid, gfp_t gfp_mask) |
1582 | { | 1406 | { |
1583 | struct io_context *ioc = NULL; | 1407 | struct io_context *ioc = NULL; |
1584 | struct cfq_io_context *cic; | 1408 | struct cfq_io_context *cic; |
@@ -1816,8 +1640,9 @@ cfq_crq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
1816 | } | 1640 | } |
1817 | } | 1641 | } |
1818 | 1642 | ||
1819 | static void cfq_enqueue(struct cfq_data *cfqd, struct request *rq) | 1643 | static void cfq_insert_request(request_queue_t *q, struct request *rq) |
1820 | { | 1644 | { |
1645 | struct cfq_data *cfqd = q->elevator->elevator_data; | ||
1821 | struct cfq_rq *crq = RQ_DATA(rq); | 1646 | struct cfq_rq *crq = RQ_DATA(rq); |
1822 | struct cfq_queue *cfqq = crq->cfq_queue; | 1647 | struct cfq_queue *cfqq = crq->cfq_queue; |
1823 | 1648 | ||
@@ -1827,66 +1652,43 @@ static void cfq_enqueue(struct cfq_data *cfqd, struct request *rq) | |||
1827 | 1652 | ||
1828 | list_add_tail(&rq->queuelist, &cfqq->fifo); | 1653 | list_add_tail(&rq->queuelist, &cfqq->fifo); |
1829 | 1654 | ||
1830 | if (rq_mergeable(rq)) { | 1655 | if (rq_mergeable(rq)) |
1831 | cfq_add_crq_hash(cfqd, crq); | 1656 | cfq_add_crq_hash(cfqd, crq); |
1832 | 1657 | ||
1833 | if (!cfqd->queue->last_merge) | ||
1834 | cfqd->queue->last_merge = rq; | ||
1835 | } | ||
1836 | |||
1837 | cfq_crq_enqueued(cfqd, cfqq, crq); | 1658 | cfq_crq_enqueued(cfqd, cfqq, crq); |
1838 | } | 1659 | } |
1839 | 1660 | ||
1840 | static void | ||
1841 | cfq_insert_request(request_queue_t *q, struct request *rq, int where) | ||
1842 | { | ||
1843 | struct cfq_data *cfqd = q->elevator->elevator_data; | ||
1844 | |||
1845 | switch (where) { | ||
1846 | case ELEVATOR_INSERT_BACK: | ||
1847 | while (cfq_dispatch_requests(q, INT_MAX, 1)) | ||
1848 | ; | ||
1849 | list_add_tail(&rq->queuelist, &q->queue_head); | ||
1850 | /* | ||
1851 | * If we were idling with pending requests on | ||
1852 | * inactive cfqqs, force dispatching will | ||
1853 | * remove the idle timer and the queue won't | ||
1854 | * be kicked by __make_request() afterward. | ||
1855 | * Kick it here. | ||
1856 | */ | ||
1857 | cfq_schedule_dispatch(cfqd); | ||
1858 | break; | ||
1859 | case ELEVATOR_INSERT_FRONT: | ||
1860 | list_add(&rq->queuelist, &q->queue_head); | ||
1861 | break; | ||
1862 | case ELEVATOR_INSERT_SORT: | ||
1863 | BUG_ON(!blk_fs_request(rq)); | ||
1864 | cfq_enqueue(cfqd, rq); | ||
1865 | break; | ||
1866 | default: | ||
1867 | printk("%s: bad insert point %d\n", __FUNCTION__,where); | ||
1868 | return; | ||
1869 | } | ||
1870 | } | ||
1871 | |||
1872 | static void cfq_completed_request(request_queue_t *q, struct request *rq) | 1661 | static void cfq_completed_request(request_queue_t *q, struct request *rq) |
1873 | { | 1662 | { |
1874 | struct cfq_rq *crq = RQ_DATA(rq); | 1663 | struct cfq_rq *crq = RQ_DATA(rq); |
1875 | struct cfq_queue *cfqq; | 1664 | struct cfq_queue *cfqq = crq->cfq_queue; |
1665 | struct cfq_data *cfqd = cfqq->cfqd; | ||
1666 | const int sync = cfq_crq_is_sync(crq); | ||
1667 | unsigned long now; | ||
1876 | 1668 | ||
1877 | if (unlikely(!blk_fs_request(rq))) | 1669 | now = jiffies; |
1878 | return; | ||
1879 | 1670 | ||
1880 | cfqq = crq->cfq_queue; | 1671 | WARN_ON(!cfqd->rq_in_driver); |
1672 | WARN_ON(!cfqq->on_dispatch[sync]); | ||
1673 | cfqd->rq_in_driver--; | ||
1674 | cfqq->on_dispatch[sync]--; | ||
1881 | 1675 | ||
1882 | if (cfq_crq_in_flight(crq)) { | 1676 | if (!cfq_class_idle(cfqq)) |
1883 | const int sync = cfq_crq_is_sync(crq); | 1677 | cfqd->last_end_request = now; |
1884 | 1678 | ||
1885 | WARN_ON(!cfqq->on_dispatch[sync]); | 1679 | if (!cfq_cfqq_dispatched(cfqq)) { |
1886 | cfqq->on_dispatch[sync]--; | 1680 | if (cfq_cfqq_on_rr(cfqq)) { |
1681 | cfqq->service_last = now; | ||
1682 | cfq_resort_rr_list(cfqq, 0); | ||
1683 | } | ||
1684 | if (cfq_cfqq_expired(cfqq)) { | ||
1685 | __cfq_slice_expired(cfqd, cfqq, 0); | ||
1686 | cfq_schedule_dispatch(cfqd); | ||
1687 | } | ||
1887 | } | 1688 | } |
1888 | 1689 | ||
1889 | cfq_account_completion(cfqq, crq); | 1690 | if (cfq_crq_is_sync(crq)) |
1691 | crq->io_context->last_end_request = now; | ||
1890 | } | 1692 | } |
1891 | 1693 | ||
1892 | static struct request * | 1694 | static struct request * |
@@ -2075,7 +1877,7 @@ static void cfq_put_request(request_queue_t *q, struct request *rq) | |||
2075 | */ | 1877 | */ |
2076 | static int | 1878 | static int |
2077 | cfq_set_request(request_queue_t *q, struct request *rq, struct bio *bio, | 1879 | cfq_set_request(request_queue_t *q, struct request *rq, struct bio *bio, |
2078 | int gfp_mask) | 1880 | gfp_t gfp_mask) |
2079 | { | 1881 | { |
2080 | struct cfq_data *cfqd = q->elevator->elevator_data; | 1882 | struct cfq_data *cfqd = q->elevator->elevator_data; |
2081 | struct task_struct *tsk = current; | 1883 | struct task_struct *tsk = current; |
@@ -2118,9 +1920,6 @@ cfq_set_request(request_queue_t *q, struct request *rq, struct bio *bio, | |||
2118 | INIT_HLIST_NODE(&crq->hash); | 1920 | INIT_HLIST_NODE(&crq->hash); |
2119 | crq->cfq_queue = cfqq; | 1921 | crq->cfq_queue = cfqq; |
2120 | crq->io_context = cic; | 1922 | crq->io_context = cic; |
2121 | cfq_clear_crq_in_flight(crq); | ||
2122 | cfq_clear_crq_in_driver(crq); | ||
2123 | cfq_clear_crq_requeued(crq); | ||
2124 | 1923 | ||
2125 | if (rw == READ || process_sync(tsk)) | 1924 | if (rw == READ || process_sync(tsk)) |
2126 | cfq_mark_crq_is_sync(crq); | 1925 | cfq_mark_crq_is_sync(crq); |
@@ -2201,7 +2000,7 @@ static void cfq_idle_slice_timer(unsigned long data) | |||
2201 | * only expire and reinvoke request handler, if there are | 2000 | * only expire and reinvoke request handler, if there are |
2202 | * other queues with pending requests | 2001 | * other queues with pending requests |
2203 | */ | 2002 | */ |
2204 | if (!cfq_pending_requests(cfqd)) { | 2003 | if (!cfqd->busy_queues) { |
2205 | cfqd->idle_slice_timer.expires = min(now + cfqd->cfq_slice_idle, cfqq->slice_end); | 2004 | cfqd->idle_slice_timer.expires = min(now + cfqd->cfq_slice_idle, cfqq->slice_end); |
2206 | add_timer(&cfqd->idle_slice_timer); | 2005 | add_timer(&cfqd->idle_slice_timer); |
2207 | goto out_cont; | 2006 | goto out_cont; |
@@ -2576,10 +2375,9 @@ static struct elevator_type iosched_cfq = { | |||
2576 | .elevator_merge_fn = cfq_merge, | 2375 | .elevator_merge_fn = cfq_merge, |
2577 | .elevator_merged_fn = cfq_merged_request, | 2376 | .elevator_merged_fn = cfq_merged_request, |
2578 | .elevator_merge_req_fn = cfq_merged_requests, | 2377 | .elevator_merge_req_fn = cfq_merged_requests, |
2579 | .elevator_next_req_fn = cfq_next_request, | 2378 | .elevator_dispatch_fn = cfq_dispatch_requests, |
2580 | .elevator_add_req_fn = cfq_insert_request, | 2379 | .elevator_add_req_fn = cfq_insert_request, |
2581 | .elevator_remove_req_fn = cfq_remove_request, | 2380 | .elevator_activate_req_fn = cfq_activate_request, |
2582 | .elevator_requeue_req_fn = cfq_requeue_request, | ||
2583 | .elevator_deactivate_req_fn = cfq_deactivate_request, | 2381 | .elevator_deactivate_req_fn = cfq_deactivate_request, |
2584 | .elevator_queue_empty_fn = cfq_queue_empty, | 2382 | .elevator_queue_empty_fn = cfq_queue_empty, |
2585 | .elevator_completed_req_fn = cfq_completed_request, | 2383 | .elevator_completed_req_fn = cfq_completed_request, |
diff --git a/drivers/block/deadline-iosched.c b/drivers/block/deadline-iosched.c index 52a3ae5289a0..7929471d7df7 100644 --- a/drivers/block/deadline-iosched.c +++ b/drivers/block/deadline-iosched.c | |||
@@ -50,7 +50,6 @@ struct deadline_data { | |||
50 | * next in sort order. read, write or both are NULL | 50 | * next in sort order. read, write or both are NULL |
51 | */ | 51 | */ |
52 | struct deadline_rq *next_drq[2]; | 52 | struct deadline_rq *next_drq[2]; |
53 | struct list_head *dispatch; /* driver dispatch queue */ | ||
54 | struct list_head *hash; /* request hash */ | 53 | struct list_head *hash; /* request hash */ |
55 | unsigned int batching; /* number of sequential requests made */ | 54 | unsigned int batching; /* number of sequential requests made */ |
56 | sector_t last_sector; /* head position */ | 55 | sector_t last_sector; /* head position */ |
@@ -113,15 +112,6 @@ static inline void deadline_del_drq_hash(struct deadline_rq *drq) | |||
113 | __deadline_del_drq_hash(drq); | 112 | __deadline_del_drq_hash(drq); |
114 | } | 113 | } |
115 | 114 | ||
116 | static void | ||
117 | deadline_remove_merge_hints(request_queue_t *q, struct deadline_rq *drq) | ||
118 | { | ||
119 | deadline_del_drq_hash(drq); | ||
120 | |||
121 | if (q->last_merge == drq->request) | ||
122 | q->last_merge = NULL; | ||
123 | } | ||
124 | |||
125 | static inline void | 115 | static inline void |
126 | deadline_add_drq_hash(struct deadline_data *dd, struct deadline_rq *drq) | 116 | deadline_add_drq_hash(struct deadline_data *dd, struct deadline_rq *drq) |
127 | { | 117 | { |
@@ -239,10 +229,9 @@ deadline_del_drq_rb(struct deadline_data *dd, struct deadline_rq *drq) | |||
239 | dd->next_drq[data_dir] = rb_entry_drq(rbnext); | 229 | dd->next_drq[data_dir] = rb_entry_drq(rbnext); |
240 | } | 230 | } |
241 | 231 | ||
242 | if (ON_RB(&drq->rb_node)) { | 232 | BUG_ON(!ON_RB(&drq->rb_node)); |
243 | rb_erase(&drq->rb_node, DRQ_RB_ROOT(dd, drq)); | 233 | rb_erase(&drq->rb_node, DRQ_RB_ROOT(dd, drq)); |
244 | RB_CLEAR(&drq->rb_node); | 234 | RB_CLEAR(&drq->rb_node); |
245 | } | ||
246 | } | 235 | } |
247 | 236 | ||
248 | static struct request * | 237 | static struct request * |
@@ -286,7 +275,7 @@ deadline_find_first_drq(struct deadline_data *dd, int data_dir) | |||
286 | /* | 275 | /* |
287 | * add drq to rbtree and fifo | 276 | * add drq to rbtree and fifo |
288 | */ | 277 | */ |
289 | static inline void | 278 | static void |
290 | deadline_add_request(struct request_queue *q, struct request *rq) | 279 | deadline_add_request(struct request_queue *q, struct request *rq) |
291 | { | 280 | { |
292 | struct deadline_data *dd = q->elevator->elevator_data; | 281 | struct deadline_data *dd = q->elevator->elevator_data; |
@@ -301,12 +290,8 @@ deadline_add_request(struct request_queue *q, struct request *rq) | |||
301 | drq->expires = jiffies + dd->fifo_expire[data_dir]; | 290 | drq->expires = jiffies + dd->fifo_expire[data_dir]; |
302 | list_add_tail(&drq->fifo, &dd->fifo_list[data_dir]); | 291 | list_add_tail(&drq->fifo, &dd->fifo_list[data_dir]); |
303 | 292 | ||
304 | if (rq_mergeable(rq)) { | 293 | if (rq_mergeable(rq)) |
305 | deadline_add_drq_hash(dd, drq); | 294 | deadline_add_drq_hash(dd, drq); |
306 | |||
307 | if (!q->last_merge) | ||
308 | q->last_merge = rq; | ||
309 | } | ||
310 | } | 295 | } |
311 | 296 | ||
312 | /* | 297 | /* |
@@ -315,14 +300,11 @@ deadline_add_request(struct request_queue *q, struct request *rq) | |||
315 | static void deadline_remove_request(request_queue_t *q, struct request *rq) | 300 | static void deadline_remove_request(request_queue_t *q, struct request *rq) |
316 | { | 301 | { |
317 | struct deadline_rq *drq = RQ_DATA(rq); | 302 | struct deadline_rq *drq = RQ_DATA(rq); |
303 | struct deadline_data *dd = q->elevator->elevator_data; | ||
318 | 304 | ||
319 | if (drq) { | 305 | list_del_init(&drq->fifo); |
320 | struct deadline_data *dd = q->elevator->elevator_data; | 306 | deadline_del_drq_rb(dd, drq); |
321 | 307 | deadline_del_drq_hash(drq); | |
322 | list_del_init(&drq->fifo); | ||
323 | deadline_remove_merge_hints(q, drq); | ||
324 | deadline_del_drq_rb(dd, drq); | ||
325 | } | ||
326 | } | 308 | } |
327 | 309 | ||
328 | static int | 310 | static int |
@@ -333,15 +315,6 @@ deadline_merge(request_queue_t *q, struct request **req, struct bio *bio) | |||
333 | int ret; | 315 | int ret; |
334 | 316 | ||
335 | /* | 317 | /* |
336 | * try last_merge to avoid going to hash | ||
337 | */ | ||
338 | ret = elv_try_last_merge(q, bio); | ||
339 | if (ret != ELEVATOR_NO_MERGE) { | ||
340 | __rq = q->last_merge; | ||
341 | goto out_insert; | ||
342 | } | ||
343 | |||
344 | /* | ||
345 | * see if the merge hash can satisfy a back merge | 318 | * see if the merge hash can satisfy a back merge |
346 | */ | 319 | */ |
347 | __rq = deadline_find_drq_hash(dd, bio->bi_sector); | 320 | __rq = deadline_find_drq_hash(dd, bio->bi_sector); |
@@ -373,8 +346,6 @@ deadline_merge(request_queue_t *q, struct request **req, struct bio *bio) | |||
373 | 346 | ||
374 | return ELEVATOR_NO_MERGE; | 347 | return ELEVATOR_NO_MERGE; |
375 | out: | 348 | out: |
376 | q->last_merge = __rq; | ||
377 | out_insert: | ||
378 | if (ret) | 349 | if (ret) |
379 | deadline_hot_drq_hash(dd, RQ_DATA(__rq)); | 350 | deadline_hot_drq_hash(dd, RQ_DATA(__rq)); |
380 | *req = __rq; | 351 | *req = __rq; |
@@ -399,8 +370,6 @@ static void deadline_merged_request(request_queue_t *q, struct request *req) | |||
399 | deadline_del_drq_rb(dd, drq); | 370 | deadline_del_drq_rb(dd, drq); |
400 | deadline_add_drq_rb(dd, drq); | 371 | deadline_add_drq_rb(dd, drq); |
401 | } | 372 | } |
402 | |||
403 | q->last_merge = req; | ||
404 | } | 373 | } |
405 | 374 | ||
406 | static void | 375 | static void |
@@ -452,7 +421,7 @@ deadline_move_to_dispatch(struct deadline_data *dd, struct deadline_rq *drq) | |||
452 | request_queue_t *q = drq->request->q; | 421 | request_queue_t *q = drq->request->q; |
453 | 422 | ||
454 | deadline_remove_request(q, drq->request); | 423 | deadline_remove_request(q, drq->request); |
455 | list_add_tail(&drq->request->queuelist, dd->dispatch); | 424 | elv_dispatch_add_tail(q, drq->request); |
456 | } | 425 | } |
457 | 426 | ||
458 | /* | 427 | /* |
@@ -502,8 +471,9 @@ static inline int deadline_check_fifo(struct deadline_data *dd, int ddir) | |||
502 | * deadline_dispatch_requests selects the best request according to | 471 | * deadline_dispatch_requests selects the best request according to |
503 | * read/write expire, fifo_batch, etc | 472 | * read/write expire, fifo_batch, etc |
504 | */ | 473 | */ |
505 | static int deadline_dispatch_requests(struct deadline_data *dd) | 474 | static int deadline_dispatch_requests(request_queue_t *q, int force) |
506 | { | 475 | { |
476 | struct deadline_data *dd = q->elevator->elevator_data; | ||
507 | const int reads = !list_empty(&dd->fifo_list[READ]); | 477 | const int reads = !list_empty(&dd->fifo_list[READ]); |
508 | const int writes = !list_empty(&dd->fifo_list[WRITE]); | 478 | const int writes = !list_empty(&dd->fifo_list[WRITE]); |
509 | struct deadline_rq *drq; | 479 | struct deadline_rq *drq; |
@@ -597,65 +567,12 @@ dispatch_request: | |||
597 | return 1; | 567 | return 1; |
598 | } | 568 | } |
599 | 569 | ||
600 | static struct request *deadline_next_request(request_queue_t *q) | ||
601 | { | ||
602 | struct deadline_data *dd = q->elevator->elevator_data; | ||
603 | struct request *rq; | ||
604 | |||
605 | /* | ||
606 | * if there are still requests on the dispatch queue, grab the first one | ||
607 | */ | ||
608 | if (!list_empty(dd->dispatch)) { | ||
609 | dispatch: | ||
610 | rq = list_entry_rq(dd->dispatch->next); | ||
611 | return rq; | ||
612 | } | ||
613 | |||
614 | if (deadline_dispatch_requests(dd)) | ||
615 | goto dispatch; | ||
616 | |||
617 | return NULL; | ||
618 | } | ||
619 | |||
620 | static void | ||
621 | deadline_insert_request(request_queue_t *q, struct request *rq, int where) | ||
622 | { | ||
623 | struct deadline_data *dd = q->elevator->elevator_data; | ||
624 | |||
625 | /* barriers must flush the reorder queue */ | ||
626 | if (unlikely(rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER) | ||
627 | && where == ELEVATOR_INSERT_SORT)) | ||
628 | where = ELEVATOR_INSERT_BACK; | ||
629 | |||
630 | switch (where) { | ||
631 | case ELEVATOR_INSERT_BACK: | ||
632 | while (deadline_dispatch_requests(dd)) | ||
633 | ; | ||
634 | list_add_tail(&rq->queuelist, dd->dispatch); | ||
635 | break; | ||
636 | case ELEVATOR_INSERT_FRONT: | ||
637 | list_add(&rq->queuelist, dd->dispatch); | ||
638 | break; | ||
639 | case ELEVATOR_INSERT_SORT: | ||
640 | BUG_ON(!blk_fs_request(rq)); | ||
641 | deadline_add_request(q, rq); | ||
642 | break; | ||
643 | default: | ||
644 | printk("%s: bad insert point %d\n", __FUNCTION__,where); | ||
645 | return; | ||
646 | } | ||
647 | } | ||
648 | |||
649 | static int deadline_queue_empty(request_queue_t *q) | 570 | static int deadline_queue_empty(request_queue_t *q) |
650 | { | 571 | { |
651 | struct deadline_data *dd = q->elevator->elevator_data; | 572 | struct deadline_data *dd = q->elevator->elevator_data; |
652 | 573 | ||
653 | if (!list_empty(&dd->fifo_list[WRITE]) | 574 | return list_empty(&dd->fifo_list[WRITE]) |
654 | || !list_empty(&dd->fifo_list[READ]) | 575 | && list_empty(&dd->fifo_list[READ]); |
655 | || !list_empty(dd->dispatch)) | ||
656 | return 0; | ||
657 | |||
658 | return 1; | ||
659 | } | 576 | } |
660 | 577 | ||
661 | static struct request * | 578 | static struct request * |
@@ -733,7 +650,6 @@ static int deadline_init_queue(request_queue_t *q, elevator_t *e) | |||
733 | INIT_LIST_HEAD(&dd->fifo_list[WRITE]); | 650 | INIT_LIST_HEAD(&dd->fifo_list[WRITE]); |
734 | dd->sort_list[READ] = RB_ROOT; | 651 | dd->sort_list[READ] = RB_ROOT; |
735 | dd->sort_list[WRITE] = RB_ROOT; | 652 | dd->sort_list[WRITE] = RB_ROOT; |
736 | dd->dispatch = &q->queue_head; | ||
737 | dd->fifo_expire[READ] = read_expire; | 653 | dd->fifo_expire[READ] = read_expire; |
738 | dd->fifo_expire[WRITE] = write_expire; | 654 | dd->fifo_expire[WRITE] = write_expire; |
739 | dd->writes_starved = writes_starved; | 655 | dd->writes_starved = writes_starved; |
@@ -748,15 +664,13 @@ static void deadline_put_request(request_queue_t *q, struct request *rq) | |||
748 | struct deadline_data *dd = q->elevator->elevator_data; | 664 | struct deadline_data *dd = q->elevator->elevator_data; |
749 | struct deadline_rq *drq = RQ_DATA(rq); | 665 | struct deadline_rq *drq = RQ_DATA(rq); |
750 | 666 | ||
751 | if (drq) { | 667 | mempool_free(drq, dd->drq_pool); |
752 | mempool_free(drq, dd->drq_pool); | 668 | rq->elevator_private = NULL; |
753 | rq->elevator_private = NULL; | ||
754 | } | ||
755 | } | 669 | } |
756 | 670 | ||
757 | static int | 671 | static int |
758 | deadline_set_request(request_queue_t *q, struct request *rq, struct bio *bio, | 672 | deadline_set_request(request_queue_t *q, struct request *rq, struct bio *bio, |
759 | int gfp_mask) | 673 | gfp_t gfp_mask) |
760 | { | 674 | { |
761 | struct deadline_data *dd = q->elevator->elevator_data; | 675 | struct deadline_data *dd = q->elevator->elevator_data; |
762 | struct deadline_rq *drq; | 676 | struct deadline_rq *drq; |
@@ -917,9 +831,8 @@ static struct elevator_type iosched_deadline = { | |||
917 | .elevator_merge_fn = deadline_merge, | 831 | .elevator_merge_fn = deadline_merge, |
918 | .elevator_merged_fn = deadline_merged_request, | 832 | .elevator_merged_fn = deadline_merged_request, |
919 | .elevator_merge_req_fn = deadline_merged_requests, | 833 | .elevator_merge_req_fn = deadline_merged_requests, |
920 | .elevator_next_req_fn = deadline_next_request, | 834 | .elevator_dispatch_fn = deadline_dispatch_requests, |
921 | .elevator_add_req_fn = deadline_insert_request, | 835 | .elevator_add_req_fn = deadline_add_request, |
922 | .elevator_remove_req_fn = deadline_remove_request, | ||
923 | .elevator_queue_empty_fn = deadline_queue_empty, | 836 | .elevator_queue_empty_fn = deadline_queue_empty, |
924 | .elevator_former_req_fn = deadline_former_request, | 837 | .elevator_former_req_fn = deadline_former_request, |
925 | .elevator_latter_req_fn = deadline_latter_request, | 838 | .elevator_latter_req_fn = deadline_latter_request, |
diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c index 98f0126a2deb..55621d5c5774 100644 --- a/drivers/block/elevator.c +++ b/drivers/block/elevator.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/compiler.h> | 36 | #include <linux/compiler.h> |
37 | #include <linux/delay.h> | ||
37 | 38 | ||
38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
39 | 40 | ||
@@ -83,21 +84,11 @@ inline int elv_try_merge(struct request *__rq, struct bio *bio) | |||
83 | } | 84 | } |
84 | EXPORT_SYMBOL(elv_try_merge); | 85 | EXPORT_SYMBOL(elv_try_merge); |
85 | 86 | ||
86 | inline int elv_try_last_merge(request_queue_t *q, struct bio *bio) | ||
87 | { | ||
88 | if (q->last_merge) | ||
89 | return elv_try_merge(q->last_merge, bio); | ||
90 | |||
91 | return ELEVATOR_NO_MERGE; | ||
92 | } | ||
93 | EXPORT_SYMBOL(elv_try_last_merge); | ||
94 | |||
95 | static struct elevator_type *elevator_find(const char *name) | 87 | static struct elevator_type *elevator_find(const char *name) |
96 | { | 88 | { |
97 | struct elevator_type *e = NULL; | 89 | struct elevator_type *e = NULL; |
98 | struct list_head *entry; | 90 | struct list_head *entry; |
99 | 91 | ||
100 | spin_lock_irq(&elv_list_lock); | ||
101 | list_for_each(entry, &elv_list) { | 92 | list_for_each(entry, &elv_list) { |
102 | struct elevator_type *__e; | 93 | struct elevator_type *__e; |
103 | 94 | ||
@@ -108,7 +99,6 @@ static struct elevator_type *elevator_find(const char *name) | |||
108 | break; | 99 | break; |
109 | } | 100 | } |
110 | } | 101 | } |
111 | spin_unlock_irq(&elv_list_lock); | ||
112 | 102 | ||
113 | return e; | 103 | return e; |
114 | } | 104 | } |
@@ -120,12 +110,15 @@ static void elevator_put(struct elevator_type *e) | |||
120 | 110 | ||
121 | static struct elevator_type *elevator_get(const char *name) | 111 | static struct elevator_type *elevator_get(const char *name) |
122 | { | 112 | { |
123 | struct elevator_type *e = elevator_find(name); | 113 | struct elevator_type *e; |
124 | 114 | ||
125 | if (!e) | 115 | spin_lock_irq(&elv_list_lock); |
126 | return NULL; | 116 | |
127 | if (!try_module_get(e->elevator_owner)) | 117 | e = elevator_find(name); |
128 | return NULL; | 118 | if (e && !try_module_get(e->elevator_owner)) |
119 | e = NULL; | ||
120 | |||
121 | spin_unlock_irq(&elv_list_lock); | ||
129 | 122 | ||
130 | return e; | 123 | return e; |
131 | } | 124 | } |
@@ -139,8 +132,6 @@ static int elevator_attach(request_queue_t *q, struct elevator_type *e, | |||
139 | eq->ops = &e->ops; | 132 | eq->ops = &e->ops; |
140 | eq->elevator_type = e; | 133 | eq->elevator_type = e; |
141 | 134 | ||
142 | INIT_LIST_HEAD(&q->queue_head); | ||
143 | q->last_merge = NULL; | ||
144 | q->elevator = eq; | 135 | q->elevator = eq; |
145 | 136 | ||
146 | if (eq->ops->elevator_init_fn) | 137 | if (eq->ops->elevator_init_fn) |
@@ -153,11 +144,15 @@ static char chosen_elevator[16]; | |||
153 | 144 | ||
154 | static void elevator_setup_default(void) | 145 | static void elevator_setup_default(void) |
155 | { | 146 | { |
147 | struct elevator_type *e; | ||
148 | |||
156 | /* | 149 | /* |
157 | * check if default is set and exists | 150 | * check if default is set and exists |
158 | */ | 151 | */ |
159 | if (chosen_elevator[0] && elevator_find(chosen_elevator)) | 152 | if (chosen_elevator[0] && (e = elevator_get(chosen_elevator))) { |
153 | elevator_put(e); | ||
160 | return; | 154 | return; |
155 | } | ||
161 | 156 | ||
162 | #if defined(CONFIG_IOSCHED_AS) | 157 | #if defined(CONFIG_IOSCHED_AS) |
163 | strcpy(chosen_elevator, "anticipatory"); | 158 | strcpy(chosen_elevator, "anticipatory"); |
@@ -186,6 +181,11 @@ int elevator_init(request_queue_t *q, char *name) | |||
186 | struct elevator_queue *eq; | 181 | struct elevator_queue *eq; |
187 | int ret = 0; | 182 | int ret = 0; |
188 | 183 | ||
184 | INIT_LIST_HEAD(&q->queue_head); | ||
185 | q->last_merge = NULL; | ||
186 | q->end_sector = 0; | ||
187 | q->boundary_rq = NULL; | ||
188 | |||
189 | elevator_setup_default(); | 189 | elevator_setup_default(); |
190 | 190 | ||
191 | if (!name) | 191 | if (!name) |
@@ -220,9 +220,52 @@ void elevator_exit(elevator_t *e) | |||
220 | kfree(e); | 220 | kfree(e); |
221 | } | 221 | } |
222 | 222 | ||
223 | /* | ||
224 | * Insert rq into dispatch queue of q. Queue lock must be held on | ||
225 | * entry. If sort != 0, rq is sort-inserted; otherwise, rq will be | ||
226 | * appended to the dispatch queue. To be used by specific elevators. | ||
227 | */ | ||
228 | void elv_dispatch_sort(request_queue_t *q, struct request *rq) | ||
229 | { | ||
230 | sector_t boundary; | ||
231 | struct list_head *entry; | ||
232 | |||
233 | if (q->last_merge == rq) | ||
234 | q->last_merge = NULL; | ||
235 | |||
236 | boundary = q->end_sector; | ||
237 | |||
238 | list_for_each_prev(entry, &q->queue_head) { | ||
239 | struct request *pos = list_entry_rq(entry); | ||
240 | |||
241 | if (pos->flags & (REQ_SOFTBARRIER|REQ_HARDBARRIER|REQ_STARTED)) | ||
242 | break; | ||
243 | if (rq->sector >= boundary) { | ||
244 | if (pos->sector < boundary) | ||
245 | continue; | ||
246 | } else { | ||
247 | if (pos->sector >= boundary) | ||
248 | break; | ||
249 | } | ||
250 | if (rq->sector >= pos->sector) | ||
251 | break; | ||
252 | } | ||
253 | |||
254 | list_add(&rq->queuelist, entry); | ||
255 | } | ||
256 | |||
223 | int elv_merge(request_queue_t *q, struct request **req, struct bio *bio) | 257 | int elv_merge(request_queue_t *q, struct request **req, struct bio *bio) |
224 | { | 258 | { |
225 | elevator_t *e = q->elevator; | 259 | elevator_t *e = q->elevator; |
260 | int ret; | ||
261 | |||
262 | if (q->last_merge) { | ||
263 | ret = elv_try_merge(q->last_merge, bio); | ||
264 | if (ret != ELEVATOR_NO_MERGE) { | ||
265 | *req = q->last_merge; | ||
266 | return ret; | ||
267 | } | ||
268 | } | ||
226 | 269 | ||
227 | if (e->ops->elevator_merge_fn) | 270 | if (e->ops->elevator_merge_fn) |
228 | return e->ops->elevator_merge_fn(q, req, bio); | 271 | return e->ops->elevator_merge_fn(q, req, bio); |
@@ -236,6 +279,8 @@ void elv_merged_request(request_queue_t *q, struct request *rq) | |||
236 | 279 | ||
237 | if (e->ops->elevator_merged_fn) | 280 | if (e->ops->elevator_merged_fn) |
238 | e->ops->elevator_merged_fn(q, rq); | 281 | e->ops->elevator_merged_fn(q, rq); |
282 | |||
283 | q->last_merge = rq; | ||
239 | } | 284 | } |
240 | 285 | ||
241 | void elv_merge_requests(request_queue_t *q, struct request *rq, | 286 | void elv_merge_requests(request_queue_t *q, struct request *rq, |
@@ -243,20 +288,13 @@ void elv_merge_requests(request_queue_t *q, struct request *rq, | |||
243 | { | 288 | { |
244 | elevator_t *e = q->elevator; | 289 | elevator_t *e = q->elevator; |
245 | 290 | ||
246 | if (q->last_merge == next) | ||
247 | q->last_merge = NULL; | ||
248 | |||
249 | if (e->ops->elevator_merge_req_fn) | 291 | if (e->ops->elevator_merge_req_fn) |
250 | e->ops->elevator_merge_req_fn(q, rq, next); | 292 | e->ops->elevator_merge_req_fn(q, rq, next); |
293 | |||
294 | q->last_merge = rq; | ||
251 | } | 295 | } |
252 | 296 | ||
253 | /* | 297 | void elv_requeue_request(request_queue_t *q, struct request *rq) |
254 | * For careful internal use by the block layer. Essentially the same as | ||
255 | * a requeue in that it tells the io scheduler that this request is not | ||
256 | * active in the driver or hardware anymore, but we don't want the request | ||
257 | * added back to the scheduler. Function is not exported. | ||
258 | */ | ||
259 | void elv_deactivate_request(request_queue_t *q, struct request *rq) | ||
260 | { | 298 | { |
261 | elevator_t *e = q->elevator; | 299 | elevator_t *e = q->elevator; |
262 | 300 | ||
@@ -264,19 +302,14 @@ void elv_deactivate_request(request_queue_t *q, struct request *rq) | |||
264 | * it already went through dequeue, we need to decrement the | 302 | * it already went through dequeue, we need to decrement the |
265 | * in_flight count again | 303 | * in_flight count again |
266 | */ | 304 | */ |
267 | if (blk_account_rq(rq)) | 305 | if (blk_account_rq(rq)) { |
268 | q->in_flight--; | 306 | q->in_flight--; |
307 | if (blk_sorted_rq(rq) && e->ops->elevator_deactivate_req_fn) | ||
308 | e->ops->elevator_deactivate_req_fn(q, rq); | ||
309 | } | ||
269 | 310 | ||
270 | rq->flags &= ~REQ_STARTED; | 311 | rq->flags &= ~REQ_STARTED; |
271 | 312 | ||
272 | if (e->ops->elevator_deactivate_req_fn) | ||
273 | e->ops->elevator_deactivate_req_fn(q, rq); | ||
274 | } | ||
275 | |||
276 | void elv_requeue_request(request_queue_t *q, struct request *rq) | ||
277 | { | ||
278 | elv_deactivate_request(q, rq); | ||
279 | |||
280 | /* | 313 | /* |
281 | * if this is the flush, requeue the original instead and drop the flush | 314 | * if this is the flush, requeue the original instead and drop the flush |
282 | */ | 315 | */ |
@@ -285,31 +318,27 @@ void elv_requeue_request(request_queue_t *q, struct request *rq) | |||
285 | rq = rq->end_io_data; | 318 | rq = rq->end_io_data; |
286 | } | 319 | } |
287 | 320 | ||
288 | /* | 321 | __elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0); |
289 | * the request is prepped and may have some resources allocated. | ||
290 | * allowing unprepped requests to pass this one may cause resource | ||
291 | * deadlock. turn on softbarrier. | ||
292 | */ | ||
293 | rq->flags |= REQ_SOFTBARRIER; | ||
294 | |||
295 | /* | ||
296 | * if iosched has an explicit requeue hook, then use that. otherwise | ||
297 | * just put the request at the front of the queue | ||
298 | */ | ||
299 | if (q->elevator->ops->elevator_requeue_req_fn) | ||
300 | q->elevator->ops->elevator_requeue_req_fn(q, rq); | ||
301 | else | ||
302 | __elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0); | ||
303 | } | 322 | } |
304 | 323 | ||
305 | void __elv_add_request(request_queue_t *q, struct request *rq, int where, | 324 | void __elv_add_request(request_queue_t *q, struct request *rq, int where, |
306 | int plug) | 325 | int plug) |
307 | { | 326 | { |
308 | /* | 327 | if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) { |
309 | * barriers implicitly indicate back insertion | 328 | /* |
310 | */ | 329 | * barriers implicitly indicate back insertion |
311 | if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER) && | 330 | */ |
312 | where == ELEVATOR_INSERT_SORT) | 331 | if (where == ELEVATOR_INSERT_SORT) |
332 | where = ELEVATOR_INSERT_BACK; | ||
333 | |||
334 | /* | ||
335 | * this request is scheduling boundary, update end_sector | ||
336 | */ | ||
337 | if (blk_fs_request(rq)) { | ||
338 | q->end_sector = rq_end_sector(rq); | ||
339 | q->boundary_rq = rq; | ||
340 | } | ||
341 | } else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT) | ||
313 | where = ELEVATOR_INSERT_BACK; | 342 | where = ELEVATOR_INSERT_BACK; |
314 | 343 | ||
315 | if (plug) | 344 | if (plug) |
@@ -317,23 +346,54 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where, | |||
317 | 346 | ||
318 | rq->q = q; | 347 | rq->q = q; |
319 | 348 | ||
320 | if (!test_bit(QUEUE_FLAG_DRAIN, &q->queue_flags)) { | 349 | switch (where) { |
321 | q->elevator->ops->elevator_add_req_fn(q, rq, where); | 350 | case ELEVATOR_INSERT_FRONT: |
351 | rq->flags |= REQ_SOFTBARRIER; | ||
322 | 352 | ||
323 | if (blk_queue_plugged(q)) { | 353 | list_add(&rq->queuelist, &q->queue_head); |
324 | int nrq = q->rq.count[READ] + q->rq.count[WRITE] | 354 | break; |
325 | - q->in_flight; | ||
326 | 355 | ||
327 | if (nrq >= q->unplug_thresh) | 356 | case ELEVATOR_INSERT_BACK: |
328 | __generic_unplug_device(q); | 357 | rq->flags |= REQ_SOFTBARRIER; |
329 | } | 358 | |
330 | } else | 359 | while (q->elevator->ops->elevator_dispatch_fn(q, 1)) |
360 | ; | ||
361 | list_add_tail(&rq->queuelist, &q->queue_head); | ||
331 | /* | 362 | /* |
332 | * if drain is set, store the request "locally". when the drain | 363 | * We kick the queue here for the following reasons. |
333 | * is finished, the requests will be handed ordered to the io | 364 | * - The elevator might have returned NULL previously |
334 | * scheduler | 365 | * to delay requests and returned them now. As the |
366 | * queue wasn't empty before this request, ll_rw_blk | ||
367 | * won't run the queue on return, resulting in hang. | ||
368 | * - Usually, back inserted requests won't be merged | ||
369 | * with anything. There's no point in delaying queue | ||
370 | * processing. | ||
335 | */ | 371 | */ |
336 | list_add_tail(&rq->queuelist, &q->drain_list); | 372 | blk_remove_plug(q); |
373 | q->request_fn(q); | ||
374 | break; | ||
375 | |||
376 | case ELEVATOR_INSERT_SORT: | ||
377 | BUG_ON(!blk_fs_request(rq)); | ||
378 | rq->flags |= REQ_SORTED; | ||
379 | q->elevator->ops->elevator_add_req_fn(q, rq); | ||
380 | if (q->last_merge == NULL && rq_mergeable(rq)) | ||
381 | q->last_merge = rq; | ||
382 | break; | ||
383 | |||
384 | default: | ||
385 | printk(KERN_ERR "%s: bad insertion point %d\n", | ||
386 | __FUNCTION__, where); | ||
387 | BUG(); | ||
388 | } | ||
389 | |||
390 | if (blk_queue_plugged(q)) { | ||
391 | int nrq = q->rq.count[READ] + q->rq.count[WRITE] | ||
392 | - q->in_flight; | ||
393 | |||
394 | if (nrq >= q->unplug_thresh) | ||
395 | __generic_unplug_device(q); | ||
396 | } | ||
337 | } | 397 | } |
338 | 398 | ||
339 | void elv_add_request(request_queue_t *q, struct request *rq, int where, | 399 | void elv_add_request(request_queue_t *q, struct request *rq, int where, |
@@ -348,13 +408,19 @@ void elv_add_request(request_queue_t *q, struct request *rq, int where, | |||
348 | 408 | ||
349 | static inline struct request *__elv_next_request(request_queue_t *q) | 409 | static inline struct request *__elv_next_request(request_queue_t *q) |
350 | { | 410 | { |
351 | struct request *rq = q->elevator->ops->elevator_next_req_fn(q); | 411 | struct request *rq; |
412 | |||
413 | if (unlikely(list_empty(&q->queue_head) && | ||
414 | !q->elevator->ops->elevator_dispatch_fn(q, 0))) | ||
415 | return NULL; | ||
416 | |||
417 | rq = list_entry_rq(q->queue_head.next); | ||
352 | 418 | ||
353 | /* | 419 | /* |
354 | * if this is a barrier write and the device has to issue a | 420 | * if this is a barrier write and the device has to issue a |
355 | * flush sequence to support it, check how far we are | 421 | * flush sequence to support it, check how far we are |
356 | */ | 422 | */ |
357 | if (rq && blk_fs_request(rq) && blk_barrier_rq(rq)) { | 423 | if (blk_fs_request(rq) && blk_barrier_rq(rq)) { |
358 | BUG_ON(q->ordered == QUEUE_ORDERED_NONE); | 424 | BUG_ON(q->ordered == QUEUE_ORDERED_NONE); |
359 | 425 | ||
360 | if (q->ordered == QUEUE_ORDERED_FLUSH && | 426 | if (q->ordered == QUEUE_ORDERED_FLUSH && |
@@ -371,15 +437,30 @@ struct request *elv_next_request(request_queue_t *q) | |||
371 | int ret; | 437 | int ret; |
372 | 438 | ||
373 | while ((rq = __elv_next_request(q)) != NULL) { | 439 | while ((rq = __elv_next_request(q)) != NULL) { |
374 | /* | 440 | if (!(rq->flags & REQ_STARTED)) { |
375 | * just mark as started even if we don't start it, a request | 441 | elevator_t *e = q->elevator; |
376 | * that has been delayed should not be passed by new incoming | ||
377 | * requests | ||
378 | */ | ||
379 | rq->flags |= REQ_STARTED; | ||
380 | 442 | ||
381 | if (rq == q->last_merge) | 443 | /* |
382 | q->last_merge = NULL; | 444 | * This is the first time the device driver |
445 | * sees this request (possibly after | ||
446 | * requeueing). Notify IO scheduler. | ||
447 | */ | ||
448 | if (blk_sorted_rq(rq) && | ||
449 | e->ops->elevator_activate_req_fn) | ||
450 | e->ops->elevator_activate_req_fn(q, rq); | ||
451 | |||
452 | /* | ||
453 | * just mark as started even if we don't start | ||
454 | * it, a request that has been delayed should | ||
455 | * not be passed by new incoming requests | ||
456 | */ | ||
457 | rq->flags |= REQ_STARTED; | ||
458 | } | ||
459 | |||
460 | if (!q->boundary_rq || q->boundary_rq == rq) { | ||
461 | q->end_sector = rq_end_sector(rq); | ||
462 | q->boundary_rq = NULL; | ||
463 | } | ||
383 | 464 | ||
384 | if ((rq->flags & REQ_DONTPREP) || !q->prep_rq_fn) | 465 | if ((rq->flags & REQ_DONTPREP) || !q->prep_rq_fn) |
385 | break; | 466 | break; |
@@ -391,9 +472,9 @@ struct request *elv_next_request(request_queue_t *q) | |||
391 | /* | 472 | /* |
392 | * the request may have been (partially) prepped. | 473 | * the request may have been (partially) prepped. |
393 | * we need to keep this request in the front to | 474 | * we need to keep this request in the front to |
394 | * avoid resource deadlock. turn on softbarrier. | 475 | * avoid resource deadlock. REQ_STARTED will |
476 | * prevent other fs requests from passing this one. | ||
395 | */ | 477 | */ |
396 | rq->flags |= REQ_SOFTBARRIER; | ||
397 | rq = NULL; | 478 | rq = NULL; |
398 | break; | 479 | break; |
399 | } else if (ret == BLKPREP_KILL) { | 480 | } else if (ret == BLKPREP_KILL) { |
@@ -416,42 +497,32 @@ struct request *elv_next_request(request_queue_t *q) | |||
416 | return rq; | 497 | return rq; |
417 | } | 498 | } |
418 | 499 | ||
419 | void elv_remove_request(request_queue_t *q, struct request *rq) | 500 | void elv_dequeue_request(request_queue_t *q, struct request *rq) |
420 | { | 501 | { |
421 | elevator_t *e = q->elevator; | 502 | BUG_ON(list_empty(&rq->queuelist)); |
503 | |||
504 | list_del_init(&rq->queuelist); | ||
422 | 505 | ||
423 | /* | 506 | /* |
424 | * the time frame between a request being removed from the lists | 507 | * the time frame between a request being removed from the lists |
425 | * and to it is freed is accounted as io that is in progress at | 508 | * and to it is freed is accounted as io that is in progress at |
426 | * the driver side. note that we only account requests that the | 509 | * the driver side. |
427 | * driver has seen (REQ_STARTED set), to avoid false accounting | ||
428 | * for request-request merges | ||
429 | */ | 510 | */ |
430 | if (blk_account_rq(rq)) | 511 | if (blk_account_rq(rq)) |
431 | q->in_flight++; | 512 | q->in_flight++; |
432 | |||
433 | /* | ||
434 | * the main clearing point for q->last_merge is on retrieval of | ||
435 | * request by driver (it calls elv_next_request()), but it _can_ | ||
436 | * also happen here if a request is added to the queue but later | ||
437 | * deleted without ever being given to driver (merged with another | ||
438 | * request). | ||
439 | */ | ||
440 | if (rq == q->last_merge) | ||
441 | q->last_merge = NULL; | ||
442 | |||
443 | if (e->ops->elevator_remove_req_fn) | ||
444 | e->ops->elevator_remove_req_fn(q, rq); | ||
445 | } | 513 | } |
446 | 514 | ||
447 | int elv_queue_empty(request_queue_t *q) | 515 | int elv_queue_empty(request_queue_t *q) |
448 | { | 516 | { |
449 | elevator_t *e = q->elevator; | 517 | elevator_t *e = q->elevator; |
450 | 518 | ||
519 | if (!list_empty(&q->queue_head)) | ||
520 | return 0; | ||
521 | |||
451 | if (e->ops->elevator_queue_empty_fn) | 522 | if (e->ops->elevator_queue_empty_fn) |
452 | return e->ops->elevator_queue_empty_fn(q); | 523 | return e->ops->elevator_queue_empty_fn(q); |
453 | 524 | ||
454 | return list_empty(&q->queue_head); | 525 | return 1; |
455 | } | 526 | } |
456 | 527 | ||
457 | struct request *elv_latter_request(request_queue_t *q, struct request *rq) | 528 | struct request *elv_latter_request(request_queue_t *q, struct request *rq) |
@@ -487,7 +558,7 @@ struct request *elv_former_request(request_queue_t *q, struct request *rq) | |||
487 | } | 558 | } |
488 | 559 | ||
489 | int elv_set_request(request_queue_t *q, struct request *rq, struct bio *bio, | 560 | int elv_set_request(request_queue_t *q, struct request *rq, struct bio *bio, |
490 | int gfp_mask) | 561 | gfp_t gfp_mask) |
491 | { | 562 | { |
492 | elevator_t *e = q->elevator; | 563 | elevator_t *e = q->elevator; |
493 | 564 | ||
@@ -523,11 +594,11 @@ void elv_completed_request(request_queue_t *q, struct request *rq) | |||
523 | /* | 594 | /* |
524 | * request is released from the driver, io must be done | 595 | * request is released from the driver, io must be done |
525 | */ | 596 | */ |
526 | if (blk_account_rq(rq)) | 597 | if (blk_account_rq(rq)) { |
527 | q->in_flight--; | 598 | q->in_flight--; |
528 | 599 | if (blk_sorted_rq(rq) && e->ops->elevator_completed_req_fn) | |
529 | if (e->ops->elevator_completed_req_fn) | 600 | e->ops->elevator_completed_req_fn(q, rq); |
530 | e->ops->elevator_completed_req_fn(q, rq); | 601 | } |
531 | } | 602 | } |
532 | 603 | ||
533 | int elv_register_queue(struct request_queue *q) | 604 | int elv_register_queue(struct request_queue *q) |
@@ -555,10 +626,9 @@ void elv_unregister_queue(struct request_queue *q) | |||
555 | 626 | ||
556 | int elv_register(struct elevator_type *e) | 627 | int elv_register(struct elevator_type *e) |
557 | { | 628 | { |
629 | spin_lock_irq(&elv_list_lock); | ||
558 | if (elevator_find(e->elevator_name)) | 630 | if (elevator_find(e->elevator_name)) |
559 | BUG(); | 631 | BUG(); |
560 | |||
561 | spin_lock_irq(&elv_list_lock); | ||
562 | list_add_tail(&e->list, &elv_list); | 632 | list_add_tail(&e->list, &elv_list); |
563 | spin_unlock_irq(&elv_list_lock); | 633 | spin_unlock_irq(&elv_list_lock); |
564 | 634 | ||
@@ -582,25 +652,36 @@ EXPORT_SYMBOL_GPL(elv_unregister); | |||
582 | * switch to new_e io scheduler. be careful not to introduce deadlocks - | 652 | * switch to new_e io scheduler. be careful not to introduce deadlocks - |
583 | * we don't free the old io scheduler, before we have allocated what we | 653 | * we don't free the old io scheduler, before we have allocated what we |
584 | * need for the new one. this way we have a chance of going back to the old | 654 | * need for the new one. this way we have a chance of going back to the old |
585 | * one, if the new one fails init for some reason. we also do an intermediate | 655 | * one, if the new one fails init for some reason. |
586 | * switch to noop to ensure safety with stack-allocated requests, since they | ||
587 | * don't originate from the block layer allocator. noop is safe here, because | ||
588 | * it never needs to touch the elevator itself for completion events. DRAIN | ||
589 | * flags will make sure we don't touch it for additions either. | ||
590 | */ | 656 | */ |
591 | static void elevator_switch(request_queue_t *q, struct elevator_type *new_e) | 657 | static void elevator_switch(request_queue_t *q, struct elevator_type *new_e) |
592 | { | 658 | { |
593 | elevator_t *e = kmalloc(sizeof(elevator_t), GFP_KERNEL); | 659 | elevator_t *old_elevator, *e; |
594 | struct elevator_type *noop_elevator = NULL; | ||
595 | elevator_t *old_elevator; | ||
596 | 660 | ||
661 | /* | ||
662 | * Allocate new elevator | ||
663 | */ | ||
664 | e = kmalloc(sizeof(elevator_t), GFP_KERNEL); | ||
597 | if (!e) | 665 | if (!e) |
598 | goto error; | 666 | goto error; |
599 | 667 | ||
600 | /* | 668 | /* |
601 | * first step, drain requests from the block freelist | 669 | * Turn on BYPASS and drain all requests w/ elevator private data |
602 | */ | 670 | */ |
603 | blk_wait_queue_drained(q, 0); | 671 | spin_lock_irq(q->queue_lock); |
672 | |||
673 | set_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); | ||
674 | |||
675 | while (q->elevator->ops->elevator_dispatch_fn(q, 1)) | ||
676 | ; | ||
677 | |||
678 | while (q->rq.elvpriv) { | ||
679 | spin_unlock_irq(q->queue_lock); | ||
680 | msleep(10); | ||
681 | spin_lock_irq(q->queue_lock); | ||
682 | } | ||
683 | |||
684 | spin_unlock_irq(q->queue_lock); | ||
604 | 685 | ||
605 | /* | 686 | /* |
606 | * unregister old elevator data | 687 | * unregister old elevator data |
@@ -609,18 +690,6 @@ static void elevator_switch(request_queue_t *q, struct elevator_type *new_e) | |||
609 | old_elevator = q->elevator; | 690 | old_elevator = q->elevator; |
610 | 691 | ||
611 | /* | 692 | /* |
612 | * next step, switch to noop since it uses no private rq structures | ||
613 | * and doesn't allocate any memory for anything. then wait for any | ||
614 | * non-fs requests in-flight | ||
615 | */ | ||
616 | noop_elevator = elevator_get("noop"); | ||
617 | spin_lock_irq(q->queue_lock); | ||
618 | elevator_attach(q, noop_elevator, e); | ||
619 | spin_unlock_irq(q->queue_lock); | ||
620 | |||
621 | blk_wait_queue_drained(q, 1); | ||
622 | |||
623 | /* | ||
624 | * attach and start new elevator | 693 | * attach and start new elevator |
625 | */ | 694 | */ |
626 | if (elevator_attach(q, new_e, e)) | 695 | if (elevator_attach(q, new_e, e)) |
@@ -630,11 +699,10 @@ static void elevator_switch(request_queue_t *q, struct elevator_type *new_e) | |||
630 | goto fail_register; | 699 | goto fail_register; |
631 | 700 | ||
632 | /* | 701 | /* |
633 | * finally exit old elevator and start queue again | 702 | * finally exit old elevator and turn off BYPASS. |
634 | */ | 703 | */ |
635 | elevator_exit(old_elevator); | 704 | elevator_exit(old_elevator); |
636 | blk_finish_queue_drain(q); | 705 | clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); |
637 | elevator_put(noop_elevator); | ||
638 | return; | 706 | return; |
639 | 707 | ||
640 | fail_register: | 708 | fail_register: |
@@ -643,13 +711,13 @@ fail_register: | |||
643 | * one again (along with re-adding the sysfs dir) | 711 | * one again (along with re-adding the sysfs dir) |
644 | */ | 712 | */ |
645 | elevator_exit(e); | 713 | elevator_exit(e); |
714 | e = NULL; | ||
646 | fail: | 715 | fail: |
647 | q->elevator = old_elevator; | 716 | q->elevator = old_elevator; |
648 | elv_register_queue(q); | 717 | elv_register_queue(q); |
649 | blk_finish_queue_drain(q); | 718 | clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); |
719 | kfree(e); | ||
650 | error: | 720 | error: |
651 | if (noop_elevator) | ||
652 | elevator_put(noop_elevator); | ||
653 | elevator_put(new_e); | 721 | elevator_put(new_e); |
654 | printk(KERN_ERR "elevator: switch to %s failed\n",new_e->elevator_name); | 722 | printk(KERN_ERR "elevator: switch to %s failed\n",new_e->elevator_name); |
655 | } | 723 | } |
@@ -701,11 +769,12 @@ ssize_t elv_iosched_show(request_queue_t *q, char *name) | |||
701 | return len; | 769 | return len; |
702 | } | 770 | } |
703 | 771 | ||
772 | EXPORT_SYMBOL(elv_dispatch_sort); | ||
704 | EXPORT_SYMBOL(elv_add_request); | 773 | EXPORT_SYMBOL(elv_add_request); |
705 | EXPORT_SYMBOL(__elv_add_request); | 774 | EXPORT_SYMBOL(__elv_add_request); |
706 | EXPORT_SYMBOL(elv_requeue_request); | 775 | EXPORT_SYMBOL(elv_requeue_request); |
707 | EXPORT_SYMBOL(elv_next_request); | 776 | EXPORT_SYMBOL(elv_next_request); |
708 | EXPORT_SYMBOL(elv_remove_request); | 777 | EXPORT_SYMBOL(elv_dequeue_request); |
709 | EXPORT_SYMBOL(elv_queue_empty); | 778 | EXPORT_SYMBOL(elv_queue_empty); |
710 | EXPORT_SYMBOL(elv_completed_request); | 779 | EXPORT_SYMBOL(elv_completed_request); |
711 | EXPORT_SYMBOL(elevator_exit); | 780 | EXPORT_SYMBOL(elevator_exit); |
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index baedac522945..0af73512b9a8 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c | |||
@@ -263,8 +263,6 @@ void blk_queue_make_request(request_queue_t * q, make_request_fn * mfn) | |||
263 | blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH); | 263 | blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH); |
264 | 264 | ||
265 | blk_queue_activity_fn(q, NULL, NULL); | 265 | blk_queue_activity_fn(q, NULL, NULL); |
266 | |||
267 | INIT_LIST_HEAD(&q->drain_list); | ||
268 | } | 266 | } |
269 | 267 | ||
270 | EXPORT_SYMBOL(blk_queue_make_request); | 268 | EXPORT_SYMBOL(blk_queue_make_request); |
@@ -353,6 +351,8 @@ static void blk_pre_flush_end_io(struct request *flush_rq) | |||
353 | struct request *rq = flush_rq->end_io_data; | 351 | struct request *rq = flush_rq->end_io_data; |
354 | request_queue_t *q = rq->q; | 352 | request_queue_t *q = rq->q; |
355 | 353 | ||
354 | elv_completed_request(q, flush_rq); | ||
355 | |||
356 | rq->flags |= REQ_BAR_PREFLUSH; | 356 | rq->flags |= REQ_BAR_PREFLUSH; |
357 | 357 | ||
358 | if (!flush_rq->errors) | 358 | if (!flush_rq->errors) |
@@ -369,6 +369,8 @@ static void blk_post_flush_end_io(struct request *flush_rq) | |||
369 | struct request *rq = flush_rq->end_io_data; | 369 | struct request *rq = flush_rq->end_io_data; |
370 | request_queue_t *q = rq->q; | 370 | request_queue_t *q = rq->q; |
371 | 371 | ||
372 | elv_completed_request(q, flush_rq); | ||
373 | |||
372 | rq->flags |= REQ_BAR_POSTFLUSH; | 374 | rq->flags |= REQ_BAR_POSTFLUSH; |
373 | 375 | ||
374 | q->end_flush_fn(q, flush_rq); | 376 | q->end_flush_fn(q, flush_rq); |
@@ -408,8 +410,6 @@ struct request *blk_start_pre_flush(request_queue_t *q, struct request *rq) | |||
408 | if (!list_empty(&rq->queuelist)) | 410 | if (!list_empty(&rq->queuelist)) |
409 | blkdev_dequeue_request(rq); | 411 | blkdev_dequeue_request(rq); |
410 | 412 | ||
411 | elv_deactivate_request(q, rq); | ||
412 | |||
413 | flush_rq->end_io_data = rq; | 413 | flush_rq->end_io_data = rq; |
414 | flush_rq->end_io = blk_pre_flush_end_io; | 414 | flush_rq->end_io = blk_pre_flush_end_io; |
415 | 415 | ||
@@ -1040,6 +1040,7 @@ EXPORT_SYMBOL(blk_queue_invalidate_tags); | |||
1040 | static char *rq_flags[] = { | 1040 | static char *rq_flags[] = { |
1041 | "REQ_RW", | 1041 | "REQ_RW", |
1042 | "REQ_FAILFAST", | 1042 | "REQ_FAILFAST", |
1043 | "REQ_SORTED", | ||
1043 | "REQ_SOFTBARRIER", | 1044 | "REQ_SOFTBARRIER", |
1044 | "REQ_HARDBARRIER", | 1045 | "REQ_HARDBARRIER", |
1045 | "REQ_CMD", | 1046 | "REQ_CMD", |
@@ -1047,6 +1048,7 @@ static char *rq_flags[] = { | |||
1047 | "REQ_STARTED", | 1048 | "REQ_STARTED", |
1048 | "REQ_DONTPREP", | 1049 | "REQ_DONTPREP", |
1049 | "REQ_QUEUED", | 1050 | "REQ_QUEUED", |
1051 | "REQ_ELVPRIV", | ||
1050 | "REQ_PC", | 1052 | "REQ_PC", |
1051 | "REQ_BLOCK_PC", | 1053 | "REQ_BLOCK_PC", |
1052 | "REQ_SENSE", | 1054 | "REQ_SENSE", |
@@ -1637,9 +1639,9 @@ static int blk_init_free_list(request_queue_t *q) | |||
1637 | 1639 | ||
1638 | rl->count[READ] = rl->count[WRITE] = 0; | 1640 | rl->count[READ] = rl->count[WRITE] = 0; |
1639 | rl->starved[READ] = rl->starved[WRITE] = 0; | 1641 | rl->starved[READ] = rl->starved[WRITE] = 0; |
1642 | rl->elvpriv = 0; | ||
1640 | init_waitqueue_head(&rl->wait[READ]); | 1643 | init_waitqueue_head(&rl->wait[READ]); |
1641 | init_waitqueue_head(&rl->wait[WRITE]); | 1644 | init_waitqueue_head(&rl->wait[WRITE]); |
1642 | init_waitqueue_head(&rl->drain); | ||
1643 | 1645 | ||
1644 | rl->rq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, | 1646 | rl->rq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab, |
1645 | mempool_free_slab, request_cachep, q->node); | 1647 | mempool_free_slab, request_cachep, q->node); |
@@ -1652,13 +1654,13 @@ static int blk_init_free_list(request_queue_t *q) | |||
1652 | 1654 | ||
1653 | static int __make_request(request_queue_t *, struct bio *); | 1655 | static int __make_request(request_queue_t *, struct bio *); |
1654 | 1656 | ||
1655 | request_queue_t *blk_alloc_queue(int gfp_mask) | 1657 | request_queue_t *blk_alloc_queue(gfp_t gfp_mask) |
1656 | { | 1658 | { |
1657 | return blk_alloc_queue_node(gfp_mask, -1); | 1659 | return blk_alloc_queue_node(gfp_mask, -1); |
1658 | } | 1660 | } |
1659 | EXPORT_SYMBOL(blk_alloc_queue); | 1661 | EXPORT_SYMBOL(blk_alloc_queue); |
1660 | 1662 | ||
1661 | request_queue_t *blk_alloc_queue_node(int gfp_mask, int node_id) | 1663 | request_queue_t *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) |
1662 | { | 1664 | { |
1663 | request_queue_t *q; | 1665 | request_queue_t *q; |
1664 | 1666 | ||
@@ -1782,12 +1784,14 @@ EXPORT_SYMBOL(blk_get_queue); | |||
1782 | 1784 | ||
1783 | static inline void blk_free_request(request_queue_t *q, struct request *rq) | 1785 | static inline void blk_free_request(request_queue_t *q, struct request *rq) |
1784 | { | 1786 | { |
1785 | elv_put_request(q, rq); | 1787 | if (rq->flags & REQ_ELVPRIV) |
1788 | elv_put_request(q, rq); | ||
1786 | mempool_free(rq, q->rq.rq_pool); | 1789 | mempool_free(rq, q->rq.rq_pool); |
1787 | } | 1790 | } |
1788 | 1791 | ||
1789 | static inline struct request * | 1792 | static inline struct request * |
1790 | blk_alloc_request(request_queue_t *q, int rw, struct bio *bio, int gfp_mask) | 1793 | blk_alloc_request(request_queue_t *q, int rw, struct bio *bio, |
1794 | int priv, gfp_t gfp_mask) | ||
1791 | { | 1795 | { |
1792 | struct request *rq = mempool_alloc(q->rq.rq_pool, gfp_mask); | 1796 | struct request *rq = mempool_alloc(q->rq.rq_pool, gfp_mask); |
1793 | 1797 | ||
@@ -1800,11 +1804,15 @@ blk_alloc_request(request_queue_t *q, int rw, struct bio *bio, int gfp_mask) | |||
1800 | */ | 1804 | */ |
1801 | rq->flags = rw; | 1805 | rq->flags = rw; |
1802 | 1806 | ||
1803 | if (!elv_set_request(q, rq, bio, gfp_mask)) | 1807 | if (priv) { |
1804 | return rq; | 1808 | if (unlikely(elv_set_request(q, rq, bio, gfp_mask))) { |
1809 | mempool_free(rq, q->rq.rq_pool); | ||
1810 | return NULL; | ||
1811 | } | ||
1812 | rq->flags |= REQ_ELVPRIV; | ||
1813 | } | ||
1805 | 1814 | ||
1806 | mempool_free(rq, q->rq.rq_pool); | 1815 | return rq; |
1807 | return NULL; | ||
1808 | } | 1816 | } |
1809 | 1817 | ||
1810 | /* | 1818 | /* |
@@ -1860,22 +1868,18 @@ static void __freed_request(request_queue_t *q, int rw) | |||
1860 | * A request has just been released. Account for it, update the full and | 1868 | * A request has just been released. Account for it, update the full and |
1861 | * congestion status, wake up any waiters. Called under q->queue_lock. | 1869 | * congestion status, wake up any waiters. Called under q->queue_lock. |
1862 | */ | 1870 | */ |
1863 | static void freed_request(request_queue_t *q, int rw) | 1871 | static void freed_request(request_queue_t *q, int rw, int priv) |
1864 | { | 1872 | { |
1865 | struct request_list *rl = &q->rq; | 1873 | struct request_list *rl = &q->rq; |
1866 | 1874 | ||
1867 | rl->count[rw]--; | 1875 | rl->count[rw]--; |
1876 | if (priv) | ||
1877 | rl->elvpriv--; | ||
1868 | 1878 | ||
1869 | __freed_request(q, rw); | 1879 | __freed_request(q, rw); |
1870 | 1880 | ||
1871 | if (unlikely(rl->starved[rw ^ 1])) | 1881 | if (unlikely(rl->starved[rw ^ 1])) |
1872 | __freed_request(q, rw ^ 1); | 1882 | __freed_request(q, rw ^ 1); |
1873 | |||
1874 | if (!rl->count[READ] && !rl->count[WRITE]) { | ||
1875 | smp_mb(); | ||
1876 | if (unlikely(waitqueue_active(&rl->drain))) | ||
1877 | wake_up(&rl->drain); | ||
1878 | } | ||
1879 | } | 1883 | } |
1880 | 1884 | ||
1881 | #define blkdev_free_rq(list) list_entry((list)->next, struct request, queuelist) | 1885 | #define blkdev_free_rq(list) list_entry((list)->next, struct request, queuelist) |
@@ -1885,14 +1889,12 @@ static void freed_request(request_queue_t *q, int rw) | |||
1885 | * Returns !NULL on success, with queue_lock *not held*. | 1889 | * Returns !NULL on success, with queue_lock *not held*. |
1886 | */ | 1890 | */ |
1887 | static struct request *get_request(request_queue_t *q, int rw, struct bio *bio, | 1891 | static struct request *get_request(request_queue_t *q, int rw, struct bio *bio, |
1888 | int gfp_mask) | 1892 | gfp_t gfp_mask) |
1889 | { | 1893 | { |
1890 | struct request *rq = NULL; | 1894 | struct request *rq = NULL; |
1891 | struct request_list *rl = &q->rq; | 1895 | struct request_list *rl = &q->rq; |
1892 | struct io_context *ioc = current_io_context(GFP_ATOMIC); | 1896 | struct io_context *ioc = current_io_context(GFP_ATOMIC); |
1893 | 1897 | int priv; | |
1894 | if (unlikely(test_bit(QUEUE_FLAG_DRAIN, &q->queue_flags))) | ||
1895 | goto out; | ||
1896 | 1898 | ||
1897 | if (rl->count[rw]+1 >= q->nr_requests) { | 1899 | if (rl->count[rw]+1 >= q->nr_requests) { |
1898 | /* | 1900 | /* |
@@ -1937,9 +1939,14 @@ get_rq: | |||
1937 | rl->starved[rw] = 0; | 1939 | rl->starved[rw] = 0; |
1938 | if (rl->count[rw] >= queue_congestion_on_threshold(q)) | 1940 | if (rl->count[rw] >= queue_congestion_on_threshold(q)) |
1939 | set_queue_congested(q, rw); | 1941 | set_queue_congested(q, rw); |
1942 | |||
1943 | priv = !test_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); | ||
1944 | if (priv) | ||
1945 | rl->elvpriv++; | ||
1946 | |||
1940 | spin_unlock_irq(q->queue_lock); | 1947 | spin_unlock_irq(q->queue_lock); |
1941 | 1948 | ||
1942 | rq = blk_alloc_request(q, rw, bio, gfp_mask); | 1949 | rq = blk_alloc_request(q, rw, bio, priv, gfp_mask); |
1943 | if (!rq) { | 1950 | if (!rq) { |
1944 | /* | 1951 | /* |
1945 | * Allocation failed presumably due to memory. Undo anything | 1952 | * Allocation failed presumably due to memory. Undo anything |
@@ -1949,7 +1956,7 @@ get_rq: | |||
1949 | * wait queue, but this is pretty rare. | 1956 | * wait queue, but this is pretty rare. |
1950 | */ | 1957 | */ |
1951 | spin_lock_irq(q->queue_lock); | 1958 | spin_lock_irq(q->queue_lock); |
1952 | freed_request(q, rw); | 1959 | freed_request(q, rw, priv); |
1953 | 1960 | ||
1954 | /* | 1961 | /* |
1955 | * in the very unlikely event that allocation failed and no | 1962 | * in the very unlikely event that allocation failed and no |
@@ -2019,7 +2026,7 @@ static struct request *get_request_wait(request_queue_t *q, int rw, | |||
2019 | return rq; | 2026 | return rq; |
2020 | } | 2027 | } |
2021 | 2028 | ||
2022 | struct request *blk_get_request(request_queue_t *q, int rw, int gfp_mask) | 2029 | struct request *blk_get_request(request_queue_t *q, int rw, gfp_t gfp_mask) |
2023 | { | 2030 | { |
2024 | struct request *rq; | 2031 | struct request *rq; |
2025 | 2032 | ||
@@ -2251,7 +2258,7 @@ EXPORT_SYMBOL(blk_rq_unmap_user); | |||
2251 | * @gfp_mask: memory allocation flags | 2258 | * @gfp_mask: memory allocation flags |
2252 | */ | 2259 | */ |
2253 | int blk_rq_map_kern(request_queue_t *q, struct request *rq, void *kbuf, | 2260 | int blk_rq_map_kern(request_queue_t *q, struct request *rq, void *kbuf, |
2254 | unsigned int len, unsigned int gfp_mask) | 2261 | unsigned int len, gfp_t gfp_mask) |
2255 | { | 2262 | { |
2256 | struct bio *bio; | 2263 | struct bio *bio; |
2257 | 2264 | ||
@@ -2433,13 +2440,15 @@ void disk_round_stats(struct gendisk *disk) | |||
2433 | { | 2440 | { |
2434 | unsigned long now = jiffies; | 2441 | unsigned long now = jiffies; |
2435 | 2442 | ||
2436 | __disk_stat_add(disk, time_in_queue, | 2443 | if (now == disk->stamp) |
2437 | disk->in_flight * (now - disk->stamp)); | 2444 | return; |
2438 | disk->stamp = now; | ||
2439 | 2445 | ||
2440 | if (disk->in_flight) | 2446 | if (disk->in_flight) { |
2441 | __disk_stat_add(disk, io_ticks, (now - disk->stamp_idle)); | 2447 | __disk_stat_add(disk, time_in_queue, |
2442 | disk->stamp_idle = now; | 2448 | disk->in_flight * (now - disk->stamp)); |
2449 | __disk_stat_add(disk, io_ticks, (now - disk->stamp)); | ||
2450 | } | ||
2451 | disk->stamp = now; | ||
2443 | } | 2452 | } |
2444 | 2453 | ||
2445 | /* | 2454 | /* |
@@ -2454,6 +2463,8 @@ static void __blk_put_request(request_queue_t *q, struct request *req) | |||
2454 | if (unlikely(--req->ref_count)) | 2463 | if (unlikely(--req->ref_count)) |
2455 | return; | 2464 | return; |
2456 | 2465 | ||
2466 | elv_completed_request(q, req); | ||
2467 | |||
2457 | req->rq_status = RQ_INACTIVE; | 2468 | req->rq_status = RQ_INACTIVE; |
2458 | req->rl = NULL; | 2469 | req->rl = NULL; |
2459 | 2470 | ||
@@ -2463,26 +2474,25 @@ static void __blk_put_request(request_queue_t *q, struct request *req) | |||
2463 | */ | 2474 | */ |
2464 | if (rl) { | 2475 | if (rl) { |
2465 | int rw = rq_data_dir(req); | 2476 | int rw = rq_data_dir(req); |
2466 | 2477 | int priv = req->flags & REQ_ELVPRIV; | |
2467 | elv_completed_request(q, req); | ||
2468 | 2478 | ||
2469 | BUG_ON(!list_empty(&req->queuelist)); | 2479 | BUG_ON(!list_empty(&req->queuelist)); |
2470 | 2480 | ||
2471 | blk_free_request(q, req); | 2481 | blk_free_request(q, req); |
2472 | freed_request(q, rw); | 2482 | freed_request(q, rw, priv); |
2473 | } | 2483 | } |
2474 | } | 2484 | } |
2475 | 2485 | ||
2476 | void blk_put_request(struct request *req) | 2486 | void blk_put_request(struct request *req) |
2477 | { | 2487 | { |
2488 | unsigned long flags; | ||
2489 | request_queue_t *q = req->q; | ||
2490 | |||
2478 | /* | 2491 | /* |
2479 | * if req->rl isn't set, this request didnt originate from the | 2492 | * Gee, IDE calls in w/ NULL q. Fix IDE and remove the |
2480 | * block layer, so it's safe to just disregard it | 2493 | * following if (q) test. |
2481 | */ | 2494 | */ |
2482 | if (req->rl) { | 2495 | if (q) { |
2483 | unsigned long flags; | ||
2484 | request_queue_t *q = req->q; | ||
2485 | |||
2486 | spin_lock_irqsave(q->queue_lock, flags); | 2496 | spin_lock_irqsave(q->queue_lock, flags); |
2487 | __blk_put_request(q, req); | 2497 | __blk_put_request(q, req); |
2488 | spin_unlock_irqrestore(q->queue_lock, flags); | 2498 | spin_unlock_irqrestore(q->queue_lock, flags); |
@@ -2797,97 +2807,6 @@ static inline void blk_partition_remap(struct bio *bio) | |||
2797 | } | 2807 | } |
2798 | } | 2808 | } |
2799 | 2809 | ||
2800 | void blk_finish_queue_drain(request_queue_t *q) | ||
2801 | { | ||
2802 | struct request_list *rl = &q->rq; | ||
2803 | struct request *rq; | ||
2804 | int requeued = 0; | ||
2805 | |||
2806 | spin_lock_irq(q->queue_lock); | ||
2807 | clear_bit(QUEUE_FLAG_DRAIN, &q->queue_flags); | ||
2808 | |||
2809 | while (!list_empty(&q->drain_list)) { | ||
2810 | rq = list_entry_rq(q->drain_list.next); | ||
2811 | |||
2812 | list_del_init(&rq->queuelist); | ||
2813 | elv_requeue_request(q, rq); | ||
2814 | requeued++; | ||
2815 | } | ||
2816 | |||
2817 | if (requeued) | ||
2818 | q->request_fn(q); | ||
2819 | |||
2820 | spin_unlock_irq(q->queue_lock); | ||
2821 | |||
2822 | wake_up(&rl->wait[0]); | ||
2823 | wake_up(&rl->wait[1]); | ||
2824 | wake_up(&rl->drain); | ||
2825 | } | ||
2826 | |||
2827 | static int wait_drain(request_queue_t *q, struct request_list *rl, int dispatch) | ||
2828 | { | ||
2829 | int wait = rl->count[READ] + rl->count[WRITE]; | ||
2830 | |||
2831 | if (dispatch) | ||
2832 | wait += !list_empty(&q->queue_head); | ||
2833 | |||
2834 | return wait; | ||
2835 | } | ||
2836 | |||
2837 | /* | ||
2838 | * We rely on the fact that only requests allocated through blk_alloc_request() | ||
2839 | * have io scheduler private data structures associated with them. Any other | ||
2840 | * type of request (allocated on stack or through kmalloc()) should not go | ||
2841 | * to the io scheduler core, but be attached to the queue head instead. | ||
2842 | */ | ||
2843 | void blk_wait_queue_drained(request_queue_t *q, int wait_dispatch) | ||
2844 | { | ||
2845 | struct request_list *rl = &q->rq; | ||
2846 | DEFINE_WAIT(wait); | ||
2847 | |||
2848 | spin_lock_irq(q->queue_lock); | ||
2849 | set_bit(QUEUE_FLAG_DRAIN, &q->queue_flags); | ||
2850 | |||
2851 | while (wait_drain(q, rl, wait_dispatch)) { | ||
2852 | prepare_to_wait(&rl->drain, &wait, TASK_UNINTERRUPTIBLE); | ||
2853 | |||
2854 | if (wait_drain(q, rl, wait_dispatch)) { | ||
2855 | __generic_unplug_device(q); | ||
2856 | spin_unlock_irq(q->queue_lock); | ||
2857 | io_schedule(); | ||
2858 | spin_lock_irq(q->queue_lock); | ||
2859 | } | ||
2860 | |||
2861 | finish_wait(&rl->drain, &wait); | ||
2862 | } | ||
2863 | |||
2864 | spin_unlock_irq(q->queue_lock); | ||
2865 | } | ||
2866 | |||
2867 | /* | ||
2868 | * block waiting for the io scheduler being started again. | ||
2869 | */ | ||
2870 | static inline void block_wait_queue_running(request_queue_t *q) | ||
2871 | { | ||
2872 | DEFINE_WAIT(wait); | ||
2873 | |||
2874 | while (unlikely(test_bit(QUEUE_FLAG_DRAIN, &q->queue_flags))) { | ||
2875 | struct request_list *rl = &q->rq; | ||
2876 | |||
2877 | prepare_to_wait_exclusive(&rl->drain, &wait, | ||
2878 | TASK_UNINTERRUPTIBLE); | ||
2879 | |||
2880 | /* | ||
2881 | * re-check the condition. avoids using prepare_to_wait() | ||
2882 | * in the fast path (queue is running) | ||
2883 | */ | ||
2884 | if (test_bit(QUEUE_FLAG_DRAIN, &q->queue_flags)) | ||
2885 | io_schedule(); | ||
2886 | |||
2887 | finish_wait(&rl->drain, &wait); | ||
2888 | } | ||
2889 | } | ||
2890 | |||
2891 | static void handle_bad_sector(struct bio *bio) | 2810 | static void handle_bad_sector(struct bio *bio) |
2892 | { | 2811 | { |
2893 | char b[BDEVNAME_SIZE]; | 2812 | char b[BDEVNAME_SIZE]; |
@@ -2983,8 +2902,6 @@ end_io: | |||
2983 | if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) | 2902 | if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) |
2984 | goto end_io; | 2903 | goto end_io; |
2985 | 2904 | ||
2986 | block_wait_queue_running(q); | ||
2987 | |||
2988 | /* | 2905 | /* |
2989 | * If this device has partitions, remap block n | 2906 | * If this device has partitions, remap block n |
2990 | * of partition p to block n+start(p) of the disk. | 2907 | * of partition p to block n+start(p) of the disk. |
@@ -3393,7 +3310,7 @@ void exit_io_context(void) | |||
3393 | * but since the current task itself holds a reference, the context can be | 3310 | * but since the current task itself holds a reference, the context can be |
3394 | * used in general code, so long as it stays within `current` context. | 3311 | * used in general code, so long as it stays within `current` context. |
3395 | */ | 3312 | */ |
3396 | struct io_context *current_io_context(int gfp_flags) | 3313 | struct io_context *current_io_context(gfp_t gfp_flags) |
3397 | { | 3314 | { |
3398 | struct task_struct *tsk = current; | 3315 | struct task_struct *tsk = current; |
3399 | struct io_context *ret; | 3316 | struct io_context *ret; |
@@ -3424,7 +3341,7 @@ EXPORT_SYMBOL(current_io_context); | |||
3424 | * | 3341 | * |
3425 | * This is always called in the context of the task which submitted the I/O. | 3342 | * This is always called in the context of the task which submitted the I/O. |
3426 | */ | 3343 | */ |
3427 | struct io_context *get_io_context(int gfp_flags) | 3344 | struct io_context *get_io_context(gfp_t gfp_flags) |
3428 | { | 3345 | { |
3429 | struct io_context *ret; | 3346 | struct io_context *ret; |
3430 | ret = current_io_context(gfp_flags); | 3347 | ret = current_io_context(gfp_flags); |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index b35e08876dd4..96c664af8d06 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -881,7 +881,7 @@ loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer, | |||
881 | static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev) | 881 | static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev) |
882 | { | 882 | { |
883 | struct file *filp = lo->lo_backing_file; | 883 | struct file *filp = lo->lo_backing_file; |
884 | int gfp = lo->old_gfp_mask; | 884 | gfp_t gfp = lo->old_gfp_mask; |
885 | 885 | ||
886 | if (lo->lo_state != Lo_bound) | 886 | if (lo->lo_state != Lo_bound) |
887 | return -ENXIO; | 887 | return -ENXIO; |
diff --git a/drivers/block/noop-iosched.c b/drivers/block/noop-iosched.c index b1730b62c37e..f56b8edb06e4 100644 --- a/drivers/block/noop-iosched.c +++ b/drivers/block/noop-iosched.c | |||
@@ -7,57 +7,19 @@ | |||
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | 9 | ||
10 | /* | 10 | static void elevator_noop_add_request(request_queue_t *q, struct request *rq) |
11 | * See if we can find a request that this buffer can be coalesced with. | ||
12 | */ | ||
13 | static int elevator_noop_merge(request_queue_t *q, struct request **req, | ||
14 | struct bio *bio) | ||
15 | { | ||
16 | int ret; | ||
17 | |||
18 | ret = elv_try_last_merge(q, bio); | ||
19 | if (ret != ELEVATOR_NO_MERGE) | ||
20 | *req = q->last_merge; | ||
21 | |||
22 | return ret; | ||
23 | } | ||
24 | |||
25 | static void elevator_noop_merge_requests(request_queue_t *q, struct request *req, | ||
26 | struct request *next) | ||
27 | { | ||
28 | list_del_init(&next->queuelist); | ||
29 | } | ||
30 | |||
31 | static void elevator_noop_add_request(request_queue_t *q, struct request *rq, | ||
32 | int where) | ||
33 | { | 11 | { |
34 | if (where == ELEVATOR_INSERT_FRONT) | 12 | elv_dispatch_add_tail(q, rq); |
35 | list_add(&rq->queuelist, &q->queue_head); | ||
36 | else | ||
37 | list_add_tail(&rq->queuelist, &q->queue_head); | ||
38 | |||
39 | /* | ||
40 | * new merges must not precede this barrier | ||
41 | */ | ||
42 | if (rq->flags & REQ_HARDBARRIER) | ||
43 | q->last_merge = NULL; | ||
44 | else if (!q->last_merge) | ||
45 | q->last_merge = rq; | ||
46 | } | 13 | } |
47 | 14 | ||
48 | static struct request *elevator_noop_next_request(request_queue_t *q) | 15 | static int elevator_noop_dispatch(request_queue_t *q, int force) |
49 | { | 16 | { |
50 | if (!list_empty(&q->queue_head)) | 17 | return 0; |
51 | return list_entry_rq(q->queue_head.next); | ||
52 | |||
53 | return NULL; | ||
54 | } | 18 | } |
55 | 19 | ||
56 | static struct elevator_type elevator_noop = { | 20 | static struct elevator_type elevator_noop = { |
57 | .ops = { | 21 | .ops = { |
58 | .elevator_merge_fn = elevator_noop_merge, | 22 | .elevator_dispatch_fn = elevator_noop_dispatch, |
59 | .elevator_merge_req_fn = elevator_noop_merge_requests, | ||
60 | .elevator_next_req_fn = elevator_noop_next_request, | ||
61 | .elevator_add_req_fn = elevator_noop_add_request, | 23 | .elevator_add_req_fn = elevator_noop_add_request, |
62 | }, | 24 | }, |
63 | .elevator_name = "noop", | 25 | .elevator_name = "noop", |
diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 145c1fbffe01..68c60a5bcdab 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c | |||
@@ -348,7 +348,7 @@ static int rd_open(struct inode *inode, struct file *filp) | |||
348 | struct block_device *bdev = inode->i_bdev; | 348 | struct block_device *bdev = inode->i_bdev; |
349 | struct address_space *mapping; | 349 | struct address_space *mapping; |
350 | unsigned bsize; | 350 | unsigned bsize; |
351 | int gfp_mask; | 351 | gfp_t gfp_mask; |
352 | 352 | ||
353 | inode = igrab(bdev->bd_inode); | 353 | inode = igrab(bdev->bd_inode); |
354 | rd_bdev[unit] = bdev; | 354 | rd_bdev[unit] = bdev; |
diff --git a/drivers/char/.gitignore b/drivers/char/.gitignore new file mode 100644 index 000000000000..2b6b1d772ed7 --- /dev/null +++ b/drivers/char/.gitignore | |||
@@ -0,0 +1,3 @@ | |||
1 | consolemap_deftbl.c | ||
2 | defkeymap.c | ||
3 | |||
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c index ced4215e2275..39ea96e42c5b 100644 --- a/drivers/char/drm/drm_vm.c +++ b/drivers/char/drm/drm_vm.c | |||
@@ -148,7 +148,8 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, | |||
148 | 148 | ||
149 | offset = address - vma->vm_start; | 149 | offset = address - vma->vm_start; |
150 | i = (unsigned long)map->handle + offset; | 150 | i = (unsigned long)map->handle + offset; |
151 | page = vmalloc_to_page((void *)i); | 151 | page = (map->type == _DRM_CONSISTENT) ? |
152 | virt_to_page((void *)i) : vmalloc_to_page((void *)i); | ||
152 | if (!page) | 153 | if (!page) |
153 | return NOPAGE_OOM; | 154 | return NOPAGE_OOM; |
154 | get_page(page); | 155 | get_page(page); |
diff --git a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c index fc7d4a594bca..c8e1b6c83636 100644 --- a/drivers/char/drm/mga_dma.c +++ b/drivers/char/drm/mga_dma.c | |||
@@ -437,7 +437,7 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
437 | drm_mga_dma_bootstrap_t * dma_bs) | 437 | drm_mga_dma_bootstrap_t * dma_bs) |
438 | { | 438 | { |
439 | drm_mga_private_t * const dev_priv = (drm_mga_private_t *) dev->dev_private; | 439 | drm_mga_private_t * const dev_priv = (drm_mga_private_t *) dev->dev_private; |
440 | const unsigned int warp_size = mga_warp_microcode_size(dev_priv); | 440 | unsigned int warp_size = mga_warp_microcode_size(dev_priv); |
441 | int err; | 441 | int err; |
442 | unsigned offset; | 442 | unsigned offset; |
443 | const unsigned secondary_size = dma_bs->secondary_bin_count | 443 | const unsigned secondary_size = dma_bs->secondary_bin_count |
@@ -499,6 +499,12 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
499 | return err; | 499 | return err; |
500 | } | 500 | } |
501 | 501 | ||
502 | /* Make drm_addbufs happy by not trying to create a mapping for less | ||
503 | * than a page. | ||
504 | */ | ||
505 | if (warp_size < PAGE_SIZE) | ||
506 | warp_size = PAGE_SIZE; | ||
507 | |||
502 | offset = 0; | 508 | offset = 0; |
503 | err = drm_addmap( dev, offset, warp_size, | 509 | err = drm_addmap( dev, offset, warp_size, |
504 | _DRM_AGP, _DRM_READ_ONLY, & dev_priv->warp ); | 510 | _DRM_AGP, _DRM_READ_ONLY, & dev_priv->warp ); |
@@ -587,7 +593,7 @@ static int mga_do_pci_dma_bootstrap(drm_device_t * dev, | |||
587 | drm_mga_dma_bootstrap_t * dma_bs) | 593 | drm_mga_dma_bootstrap_t * dma_bs) |
588 | { | 594 | { |
589 | drm_mga_private_t * const dev_priv = (drm_mga_private_t *) dev->dev_private; | 595 | drm_mga_private_t * const dev_priv = (drm_mga_private_t *) dev->dev_private; |
590 | const unsigned int warp_size = mga_warp_microcode_size(dev_priv); | 596 | unsigned int warp_size = mga_warp_microcode_size(dev_priv); |
591 | unsigned int primary_size; | 597 | unsigned int primary_size; |
592 | unsigned int bin_count; | 598 | unsigned int bin_count; |
593 | int err; | 599 | int err; |
@@ -599,6 +605,12 @@ static int mga_do_pci_dma_bootstrap(drm_device_t * dev, | |||
599 | return DRM_ERR(EFAULT); | 605 | return DRM_ERR(EFAULT); |
600 | } | 606 | } |
601 | 607 | ||
608 | /* Make drm_addbufs happy by not trying to create a mapping for less | ||
609 | * than a page. | ||
610 | */ | ||
611 | if (warp_size < PAGE_SIZE) | ||
612 | warp_size = PAGE_SIZE; | ||
613 | |||
602 | /* The proper alignment is 0x100 for this mapping */ | 614 | /* The proper alignment is 0x100 for this mapping */ |
603 | err = drm_addmap(dev, 0, warp_size, _DRM_CONSISTENT, | 615 | err = drm_addmap(dev, 0, warp_size, _DRM_CONSISTENT, |
604 | _DRM_READ_ONLY, &dev_priv->warp); | 616 | _DRM_READ_ONLY, &dev_priv->warp); |
@@ -812,6 +824,10 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) | |||
812 | } | 824 | } |
813 | 825 | ||
814 | if (! dev_priv->used_new_dma_init) { | 826 | if (! dev_priv->used_new_dma_init) { |
827 | |||
828 | dev_priv->dma_access = MGA_PAGPXFER; | ||
829 | dev_priv->wagp_enable = MGA_WAGP_ENABLE; | ||
830 | |||
815 | dev_priv->status = drm_core_findmap(dev, init->status_offset); | 831 | dev_priv->status = drm_core_findmap(dev, init->status_offset); |
816 | if (!dev_priv->status) { | 832 | if (!dev_priv->status) { |
817 | DRM_ERROR("failed to find status page!\n"); | 833 | DRM_ERROR("failed to find status page!\n"); |
@@ -928,7 +944,7 @@ static int mga_do_cleanup_dma( drm_device_t *dev ) | |||
928 | drm_mga_private_t *dev_priv = dev->dev_private; | 944 | drm_mga_private_t *dev_priv = dev->dev_private; |
929 | 945 | ||
930 | if ((dev_priv->warp != NULL) | 946 | if ((dev_priv->warp != NULL) |
931 | && (dev_priv->mmio->type != _DRM_CONSISTENT)) | 947 | && (dev_priv->warp->type != _DRM_CONSISTENT)) |
932 | drm_core_ioremapfree(dev_priv->warp, dev); | 948 | drm_core_ioremapfree(dev_priv->warp, dev); |
933 | 949 | ||
934 | if ((dev_priv->primary != NULL) | 950 | if ((dev_priv->primary != NULL) |
diff --git a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h index b22fdbd4f830..6059c5a5b105 100644 --- a/drivers/char/drm/mga_drv.h +++ b/drivers/char/drm/mga_drv.h | |||
@@ -227,7 +227,7 @@ static inline u32 _MGA_READ(u32 *addr) | |||
227 | #define MGA_EMIT_STATE( dev_priv, dirty ) \ | 227 | #define MGA_EMIT_STATE( dev_priv, dirty ) \ |
228 | do { \ | 228 | do { \ |
229 | if ( (dirty) & ~MGA_UPLOAD_CLIPRECTS ) { \ | 229 | if ( (dirty) & ~MGA_UPLOAD_CLIPRECTS ) { \ |
230 | if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { \ | 230 | if ( dev_priv->chipset >= MGA_CARD_TYPE_G400 ) { \ |
231 | mga_g400_emit_state( dev_priv ); \ | 231 | mga_g400_emit_state( dev_priv ); \ |
232 | } else { \ | 232 | } else { \ |
233 | mga_g200_emit_state( dev_priv ); \ | 233 | mga_g200_emit_state( dev_priv ); \ |
diff --git a/drivers/char/drm/mga_state.c b/drivers/char/drm/mga_state.c index 05bbb4719376..6ac5e006226f 100644 --- a/drivers/char/drm/mga_state.c +++ b/drivers/char/drm/mga_state.c | |||
@@ -53,7 +53,7 @@ static void mga_emit_clip_rect( drm_mga_private_t *dev_priv, | |||
53 | 53 | ||
54 | /* Force reset of DWGCTL on G400 (eliminates clip disable bit). | 54 | /* Force reset of DWGCTL on G400 (eliminates clip disable bit). |
55 | */ | 55 | */ |
56 | if (dev_priv->chipset == MGA_CARD_TYPE_G400) { | 56 | if (dev_priv->chipset >= MGA_CARD_TYPE_G400) { |
57 | DMA_BLOCK(MGA_DWGCTL, ctx->dwgctl, | 57 | DMA_BLOCK(MGA_DWGCTL, ctx->dwgctl, |
58 | MGA_LEN + MGA_EXEC, 0x80000000, | 58 | MGA_LEN + MGA_EXEC, 0x80000000, |
59 | MGA_DWGCTL, ctx->dwgctl, | 59 | MGA_DWGCTL, ctx->dwgctl, |
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 6d9080a3ca7e..12ef13ff04ca 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c | |||
@@ -1133,10 +1133,10 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev, | |||
1133 | ring_start = (dev_priv->cp_ring->offset | 1133 | ring_start = (dev_priv->cp_ring->offset |
1134 | - dev->agp->base | 1134 | - dev->agp->base |
1135 | + dev_priv->gart_vm_start); | 1135 | + dev_priv->gart_vm_start); |
1136 | } else | 1136 | } else |
1137 | #endif | 1137 | #endif |
1138 | ring_start = (dev_priv->cp_ring->offset | 1138 | ring_start = (dev_priv->cp_ring->offset |
1139 | - dev->sg->handle | 1139 | - (unsigned long)dev->sg->virtual |
1140 | + dev_priv->gart_vm_start); | 1140 | + dev_priv->gart_vm_start); |
1141 | 1141 | ||
1142 | RADEON_WRITE( RADEON_CP_RB_BASE, ring_start ); | 1142 | RADEON_WRITE( RADEON_CP_RB_BASE, ring_start ); |
@@ -1164,7 +1164,8 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev, | |||
1164 | drm_sg_mem_t *entry = dev->sg; | 1164 | drm_sg_mem_t *entry = dev->sg; |
1165 | unsigned long tmp_ofs, page_ofs; | 1165 | unsigned long tmp_ofs, page_ofs; |
1166 | 1166 | ||
1167 | tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; | 1167 | tmp_ofs = dev_priv->ring_rptr->offset - |
1168 | (unsigned long)dev->sg->virtual; | ||
1168 | page_ofs = tmp_ofs >> PAGE_SHIFT; | 1169 | page_ofs = tmp_ofs >> PAGE_SHIFT; |
1169 | 1170 | ||
1170 | RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, | 1171 | RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, |
@@ -1491,8 +1492,8 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) | |||
1491 | else | 1492 | else |
1492 | #endif | 1493 | #endif |
1493 | dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset | 1494 | dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset |
1494 | - dev->sg->handle | 1495 | - (unsigned long)dev->sg->virtual |
1495 | + dev_priv->gart_vm_start); | 1496 | + dev_priv->gart_vm_start); |
1496 | 1497 | ||
1497 | DRM_DEBUG( "dev_priv->gart_size %d\n", | 1498 | DRM_DEBUG( "dev_priv->gart_size %d\n", |
1498 | dev_priv->gart_size ); | 1499 | dev_priv->gart_size ); |
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index c9bdf544ed2c..c556f4d3ccd7 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -62,7 +62,7 @@ | |||
62 | 62 | ||
63 | static inline unsigned char *alloc_buf(void) | 63 | static inline unsigned char *alloc_buf(void) |
64 | { | 64 | { |
65 | unsigned int prio = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; | 65 | gfp_t prio = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; |
66 | 66 | ||
67 | if (PAGE_SIZE != N_TTY_BUF_SIZE) | 67 | if (PAGE_SIZE != N_TTY_BUF_SIZE) |
68 | return kmalloc(N_TTY_BUF_SIZE, prio); | 68 | return kmalloc(N_TTY_BUF_SIZE, prio); |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index e1df376e709e..2ed5c4363b53 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -315,9 +315,9 @@ static void dbs_check_cpu(int cpu) | |||
315 | policy = this_dbs_info->cur_policy; | 315 | policy = this_dbs_info->cur_policy; |
316 | 316 | ||
317 | if ( init_flag == 0 ) { | 317 | if ( init_flag == 0 ) { |
318 | for ( /* NULL */; init_flag < NR_CPUS; init_flag++ ) { | 318 | for_each_online_cpu(j) { |
319 | dbs_info = &per_cpu(cpu_dbs_info, init_flag); | 319 | dbs_info = &per_cpu(cpu_dbs_info, j); |
320 | requested_freq[cpu] = dbs_info->cur_policy->cur; | 320 | requested_freq[j] = dbs_info->cur_policy->cur; |
321 | } | 321 | } |
322 | init_flag = 1; | 322 | init_flag = 1; |
323 | } | 323 | } |
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 4802bbbb6dc9..c9e92d85c893 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -1630,7 +1630,7 @@ static void ether1394_complete_cb(void *__ptask) | |||
1630 | /* Transmit a packet (called by kernel) */ | 1630 | /* Transmit a packet (called by kernel) */ |
1631 | static int ether1394_tx (struct sk_buff *skb, struct net_device *dev) | 1631 | static int ether1394_tx (struct sk_buff *skb, struct net_device *dev) |
1632 | { | 1632 | { |
1633 | int kmflags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; | 1633 | gfp_t kmflags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; |
1634 | struct eth1394hdr *eth; | 1634 | struct eth1394hdr *eth; |
1635 | struct eth1394_priv *priv = netdev_priv(dev); | 1635 | struct eth1394_priv *priv = netdev_priv(dev); |
1636 | int proto; | 1636 | int proto; |
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 6a6acbd80af4..4cf9b8f3e336 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c | |||
@@ -2283,8 +2283,9 @@ static void ohci_schedule_iso_tasklets(struct ti_ohci *ohci, | |||
2283 | { | 2283 | { |
2284 | struct ohci1394_iso_tasklet *t; | 2284 | struct ohci1394_iso_tasklet *t; |
2285 | unsigned long mask; | 2285 | unsigned long mask; |
2286 | unsigned long flags; | ||
2286 | 2287 | ||
2287 | spin_lock(&ohci->iso_tasklet_list_lock); | 2288 | spin_lock_irqsave(&ohci->iso_tasklet_list_lock, flags); |
2288 | 2289 | ||
2289 | list_for_each_entry(t, &ohci->iso_tasklet_list, link) { | 2290 | list_for_each_entry(t, &ohci->iso_tasklet_list, link) { |
2290 | mask = 1 << t->context; | 2291 | mask = 1 << t->context; |
@@ -2295,8 +2296,7 @@ static void ohci_schedule_iso_tasklets(struct ti_ohci *ohci, | |||
2295 | tasklet_schedule(&t->tasklet); | 2296 | tasklet_schedule(&t->tasklet); |
2296 | } | 2297 | } |
2297 | 2298 | ||
2298 | spin_unlock(&ohci->iso_tasklet_list_lock); | 2299 | spin_unlock_irqrestore(&ohci->iso_tasklet_list_lock, flags); |
2299 | |||
2300 | } | 2300 | } |
2301 | 2301 | ||
2302 | static irqreturn_t ohci_irq_handler(int irq, void *dev_id, | 2302 | static irqreturn_t ohci_irq_handler(int irq, void *dev_id, |
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 315f5ca8bedb..0470f77a9cd1 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -412,6 +412,7 @@ static void fcp_request(struct hpsb_host *host, int nodeid, int direction, | |||
412 | static ssize_t raw1394_read(struct file *file, char __user * buffer, | 412 | static ssize_t raw1394_read(struct file *file, char __user * buffer, |
413 | size_t count, loff_t * offset_is_ignored) | 413 | size_t count, loff_t * offset_is_ignored) |
414 | { | 414 | { |
415 | unsigned long flags; | ||
415 | struct file_info *fi = (struct file_info *)file->private_data; | 416 | struct file_info *fi = (struct file_info *)file->private_data; |
416 | struct list_head *lh; | 417 | struct list_head *lh; |
417 | struct pending_request *req; | 418 | struct pending_request *req; |
@@ -435,10 +436,10 @@ static ssize_t raw1394_read(struct file *file, char __user * buffer, | |||
435 | } | 436 | } |
436 | } | 437 | } |
437 | 438 | ||
438 | spin_lock_irq(&fi->reqlists_lock); | 439 | spin_lock_irqsave(&fi->reqlists_lock, flags); |
439 | lh = fi->req_complete.next; | 440 | lh = fi->req_complete.next; |
440 | list_del(lh); | 441 | list_del(lh); |
441 | spin_unlock_irq(&fi->reqlists_lock); | 442 | spin_unlock_irqrestore(&fi->reqlists_lock, flags); |
442 | 443 | ||
443 | req = list_entry(lh, struct pending_request, list); | 444 | req = list_entry(lh, struct pending_request, list); |
444 | 445 | ||
@@ -486,6 +487,7 @@ static int state_opened(struct file_info *fi, struct pending_request *req) | |||
486 | 487 | ||
487 | static int state_initialized(struct file_info *fi, struct pending_request *req) | 488 | static int state_initialized(struct file_info *fi, struct pending_request *req) |
488 | { | 489 | { |
490 | unsigned long flags; | ||
489 | struct host_info *hi; | 491 | struct host_info *hi; |
490 | struct raw1394_khost_list *khl; | 492 | struct raw1394_khost_list *khl; |
491 | 493 | ||
@@ -499,7 +501,7 @@ static int state_initialized(struct file_info *fi, struct pending_request *req) | |||
499 | 501 | ||
500 | switch (req->req.type) { | 502 | switch (req->req.type) { |
501 | case RAW1394_REQ_LIST_CARDS: | 503 | case RAW1394_REQ_LIST_CARDS: |
502 | spin_lock_irq(&host_info_lock); | 504 | spin_lock_irqsave(&host_info_lock, flags); |
503 | khl = kmalloc(sizeof(struct raw1394_khost_list) * host_count, | 505 | khl = kmalloc(sizeof(struct raw1394_khost_list) * host_count, |
504 | SLAB_ATOMIC); | 506 | SLAB_ATOMIC); |
505 | 507 | ||
@@ -513,7 +515,7 @@ static int state_initialized(struct file_info *fi, struct pending_request *req) | |||
513 | khl++; | 515 | khl++; |
514 | } | 516 | } |
515 | } | 517 | } |
516 | spin_unlock_irq(&host_info_lock); | 518 | spin_unlock_irqrestore(&host_info_lock, flags); |
517 | 519 | ||
518 | if (khl != NULL) { | 520 | if (khl != NULL) { |
519 | req->req.error = RAW1394_ERROR_NONE; | 521 | req->req.error = RAW1394_ERROR_NONE; |
@@ -528,7 +530,7 @@ static int state_initialized(struct file_info *fi, struct pending_request *req) | |||
528 | break; | 530 | break; |
529 | 531 | ||
530 | case RAW1394_REQ_SET_CARD: | 532 | case RAW1394_REQ_SET_CARD: |
531 | spin_lock_irq(&host_info_lock); | 533 | spin_lock_irqsave(&host_info_lock, flags); |
532 | if (req->req.misc < host_count) { | 534 | if (req->req.misc < host_count) { |
533 | list_for_each_entry(hi, &host_info_list, list) { | 535 | list_for_each_entry(hi, &host_info_list, list) { |
534 | if (!req->req.misc--) | 536 | if (!req->req.misc--) |
@@ -550,7 +552,7 @@ static int state_initialized(struct file_info *fi, struct pending_request *req) | |||
550 | } else { | 552 | } else { |
551 | req->req.error = RAW1394_ERROR_INVALID_ARG; | 553 | req->req.error = RAW1394_ERROR_INVALID_ARG; |
552 | } | 554 | } |
553 | spin_unlock_irq(&host_info_lock); | 555 | spin_unlock_irqrestore(&host_info_lock, flags); |
554 | 556 | ||
555 | req->req.length = 0; | 557 | req->req.length = 0; |
556 | break; | 558 | break; |
@@ -569,7 +571,6 @@ static void handle_iso_listen(struct file_info *fi, struct pending_request *req) | |||
569 | { | 571 | { |
570 | int channel = req->req.misc; | 572 | int channel = req->req.misc; |
571 | 573 | ||
572 | spin_lock_irq(&host_info_lock); | ||
573 | if ((channel > 63) || (channel < -64)) { | 574 | if ((channel > 63) || (channel < -64)) { |
574 | req->req.error = RAW1394_ERROR_INVALID_ARG; | 575 | req->req.error = RAW1394_ERROR_INVALID_ARG; |
575 | } else if (channel >= 0) { | 576 | } else if (channel >= 0) { |
@@ -601,7 +602,6 @@ static void handle_iso_listen(struct file_info *fi, struct pending_request *req) | |||
601 | 602 | ||
602 | req->req.length = 0; | 603 | req->req.length = 0; |
603 | queue_complete_req(req); | 604 | queue_complete_req(req); |
604 | spin_unlock_irq(&host_info_lock); | ||
605 | } | 605 | } |
606 | 606 | ||
607 | static void handle_fcp_listen(struct file_info *fi, struct pending_request *req) | 607 | static void handle_fcp_listen(struct file_info *fi, struct pending_request *req) |
@@ -627,6 +627,7 @@ static void handle_fcp_listen(struct file_info *fi, struct pending_request *req) | |||
627 | static int handle_async_request(struct file_info *fi, | 627 | static int handle_async_request(struct file_info *fi, |
628 | struct pending_request *req, int node) | 628 | struct pending_request *req, int node) |
629 | { | 629 | { |
630 | unsigned long flags; | ||
630 | struct hpsb_packet *packet = NULL; | 631 | struct hpsb_packet *packet = NULL; |
631 | u64 addr = req->req.address & 0xffffffffffffULL; | 632 | u64 addr = req->req.address & 0xffffffffffffULL; |
632 | 633 | ||
@@ -761,9 +762,9 @@ static int handle_async_request(struct file_info *fi, | |||
761 | hpsb_set_packet_complete_task(packet, | 762 | hpsb_set_packet_complete_task(packet, |
762 | (void (*)(void *))queue_complete_cb, req); | 763 | (void (*)(void *))queue_complete_cb, req); |
763 | 764 | ||
764 | spin_lock_irq(&fi->reqlists_lock); | 765 | spin_lock_irqsave(&fi->reqlists_lock, flags); |
765 | list_add_tail(&req->list, &fi->req_pending); | 766 | list_add_tail(&req->list, &fi->req_pending); |
766 | spin_unlock_irq(&fi->reqlists_lock); | 767 | spin_unlock_irqrestore(&fi->reqlists_lock, flags); |
767 | 768 | ||
768 | packet->generation = req->req.generation; | 769 | packet->generation = req->req.generation; |
769 | 770 | ||
@@ -779,6 +780,7 @@ static int handle_async_request(struct file_info *fi, | |||
779 | static int handle_iso_send(struct file_info *fi, struct pending_request *req, | 780 | static int handle_iso_send(struct file_info *fi, struct pending_request *req, |
780 | int channel) | 781 | int channel) |
781 | { | 782 | { |
783 | unsigned long flags; | ||
782 | struct hpsb_packet *packet; | 784 | struct hpsb_packet *packet; |
783 | 785 | ||
784 | packet = hpsb_make_isopacket(fi->host, req->req.length, channel & 0x3f, | 786 | packet = hpsb_make_isopacket(fi->host, req->req.length, channel & 0x3f, |
@@ -804,9 +806,9 @@ static int handle_iso_send(struct file_info *fi, struct pending_request *req, | |||
804 | (void (*)(void *))queue_complete_req, | 806 | (void (*)(void *))queue_complete_req, |
805 | req); | 807 | req); |
806 | 808 | ||
807 | spin_lock_irq(&fi->reqlists_lock); | 809 | spin_lock_irqsave(&fi->reqlists_lock, flags); |
808 | list_add_tail(&req->list, &fi->req_pending); | 810 | list_add_tail(&req->list, &fi->req_pending); |
809 | spin_unlock_irq(&fi->reqlists_lock); | 811 | spin_unlock_irqrestore(&fi->reqlists_lock, flags); |
810 | 812 | ||
811 | /* Update the generation of the packet just before sending. */ | 813 | /* Update the generation of the packet just before sending. */ |
812 | packet->generation = req->req.generation; | 814 | packet->generation = req->req.generation; |
@@ -821,6 +823,7 @@ static int handle_iso_send(struct file_info *fi, struct pending_request *req, | |||
821 | 823 | ||
822 | static int handle_async_send(struct file_info *fi, struct pending_request *req) | 824 | static int handle_async_send(struct file_info *fi, struct pending_request *req) |
823 | { | 825 | { |
826 | unsigned long flags; | ||
824 | struct hpsb_packet *packet; | 827 | struct hpsb_packet *packet; |
825 | int header_length = req->req.misc & 0xffff; | 828 | int header_length = req->req.misc & 0xffff; |
826 | int expect_response = req->req.misc >> 16; | 829 | int expect_response = req->req.misc >> 16; |
@@ -867,9 +870,9 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req) | |||
867 | hpsb_set_packet_complete_task(packet, | 870 | hpsb_set_packet_complete_task(packet, |
868 | (void (*)(void *))queue_complete_cb, req); | 871 | (void (*)(void *))queue_complete_cb, req); |
869 | 872 | ||
870 | spin_lock_irq(&fi->reqlists_lock); | 873 | spin_lock_irqsave(&fi->reqlists_lock, flags); |
871 | list_add_tail(&req->list, &fi->req_pending); | 874 | list_add_tail(&req->list, &fi->req_pending); |
872 | spin_unlock_irq(&fi->reqlists_lock); | 875 | spin_unlock_irqrestore(&fi->reqlists_lock, flags); |
873 | 876 | ||
874 | /* Update the generation of the packet just before sending. */ | 877 | /* Update the generation of the packet just before sending. */ |
875 | packet->generation = req->req.generation; | 878 | packet->generation = req->req.generation; |
@@ -885,6 +888,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req) | |||
885 | static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer, | 888 | static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer, |
886 | u64 addr, size_t length, u16 flags) | 889 | u64 addr, size_t length, u16 flags) |
887 | { | 890 | { |
891 | unsigned long irqflags; | ||
888 | struct pending_request *req; | 892 | struct pending_request *req; |
889 | struct host_info *hi; | 893 | struct host_info *hi; |
890 | struct file_info *fi = NULL; | 894 | struct file_info *fi = NULL; |
@@ -899,7 +903,7 @@ static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer, | |||
899 | "addr: %4.4x %8.8x length: %Zu", nodeid, | 903 | "addr: %4.4x %8.8x length: %Zu", nodeid, |
900 | (u16) ((addr >> 32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF), | 904 | (u16) ((addr >> 32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF), |
901 | length); | 905 | length); |
902 | spin_lock(&host_info_lock); | 906 | spin_lock_irqsave(&host_info_lock, irqflags); |
903 | hi = find_host_info(host); /* search address-entry */ | 907 | hi = find_host_info(host); /* search address-entry */ |
904 | if (hi != NULL) { | 908 | if (hi != NULL) { |
905 | list_for_each_entry(fi, &hi->file_info_list, list) { | 909 | list_for_each_entry(fi, &hi->file_info_list, list) { |
@@ -924,7 +928,7 @@ static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer, | |||
924 | if (!found) { | 928 | if (!found) { |
925 | printk(KERN_ERR "raw1394: arm_read FAILED addr_entry not found" | 929 | printk(KERN_ERR "raw1394: arm_read FAILED addr_entry not found" |
926 | " -> rcode_address_error\n"); | 930 | " -> rcode_address_error\n"); |
927 | spin_unlock(&host_info_lock); | 931 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
928 | return (RCODE_ADDRESS_ERROR); | 932 | return (RCODE_ADDRESS_ERROR); |
929 | } else { | 933 | } else { |
930 | DBGMSG("arm_read addr_entry FOUND"); | 934 | DBGMSG("arm_read addr_entry FOUND"); |
@@ -954,7 +958,7 @@ static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer, | |||
954 | req = __alloc_pending_request(SLAB_ATOMIC); | 958 | req = __alloc_pending_request(SLAB_ATOMIC); |
955 | if (!req) { | 959 | if (!req) { |
956 | DBGMSG("arm_read -> rcode_conflict_error"); | 960 | DBGMSG("arm_read -> rcode_conflict_error"); |
957 | spin_unlock(&host_info_lock); | 961 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
958 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. | 962 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. |
959 | The request may be retried */ | 963 | The request may be retried */ |
960 | } | 964 | } |
@@ -974,7 +978,7 @@ static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer, | |||
974 | if (!(req->data)) { | 978 | if (!(req->data)) { |
975 | free_pending_request(req); | 979 | free_pending_request(req); |
976 | DBGMSG("arm_read -> rcode_conflict_error"); | 980 | DBGMSG("arm_read -> rcode_conflict_error"); |
977 | spin_unlock(&host_info_lock); | 981 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
978 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. | 982 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. |
979 | The request may be retried */ | 983 | The request may be retried */ |
980 | } | 984 | } |
@@ -1031,13 +1035,14 @@ static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer, | |||
1031 | sizeof(struct arm_request)); | 1035 | sizeof(struct arm_request)); |
1032 | queue_complete_req(req); | 1036 | queue_complete_req(req); |
1033 | } | 1037 | } |
1034 | spin_unlock(&host_info_lock); | 1038 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1035 | return (rcode); | 1039 | return (rcode); |
1036 | } | 1040 | } |
1037 | 1041 | ||
1038 | static int arm_write(struct hpsb_host *host, int nodeid, int destid, | 1042 | static int arm_write(struct hpsb_host *host, int nodeid, int destid, |
1039 | quadlet_t * data, u64 addr, size_t length, u16 flags) | 1043 | quadlet_t * data, u64 addr, size_t length, u16 flags) |
1040 | { | 1044 | { |
1045 | unsigned long irqflags; | ||
1041 | struct pending_request *req; | 1046 | struct pending_request *req; |
1042 | struct host_info *hi; | 1047 | struct host_info *hi; |
1043 | struct file_info *fi = NULL; | 1048 | struct file_info *fi = NULL; |
@@ -1052,7 +1057,7 @@ static int arm_write(struct hpsb_host *host, int nodeid, int destid, | |||
1052 | "addr: %4.4x %8.8x length: %Zu", nodeid, | 1057 | "addr: %4.4x %8.8x length: %Zu", nodeid, |
1053 | (u16) ((addr >> 32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF), | 1058 | (u16) ((addr >> 32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF), |
1054 | length); | 1059 | length); |
1055 | spin_lock(&host_info_lock); | 1060 | spin_lock_irqsave(&host_info_lock, irqflags); |
1056 | hi = find_host_info(host); /* search address-entry */ | 1061 | hi = find_host_info(host); /* search address-entry */ |
1057 | if (hi != NULL) { | 1062 | if (hi != NULL) { |
1058 | list_for_each_entry(fi, &hi->file_info_list, list) { | 1063 | list_for_each_entry(fi, &hi->file_info_list, list) { |
@@ -1077,7 +1082,7 @@ static int arm_write(struct hpsb_host *host, int nodeid, int destid, | |||
1077 | if (!found) { | 1082 | if (!found) { |
1078 | printk(KERN_ERR "raw1394: arm_write FAILED addr_entry not found" | 1083 | printk(KERN_ERR "raw1394: arm_write FAILED addr_entry not found" |
1079 | " -> rcode_address_error\n"); | 1084 | " -> rcode_address_error\n"); |
1080 | spin_unlock(&host_info_lock); | 1085 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1081 | return (RCODE_ADDRESS_ERROR); | 1086 | return (RCODE_ADDRESS_ERROR); |
1082 | } else { | 1087 | } else { |
1083 | DBGMSG("arm_write addr_entry FOUND"); | 1088 | DBGMSG("arm_write addr_entry FOUND"); |
@@ -1106,7 +1111,7 @@ static int arm_write(struct hpsb_host *host, int nodeid, int destid, | |||
1106 | req = __alloc_pending_request(SLAB_ATOMIC); | 1111 | req = __alloc_pending_request(SLAB_ATOMIC); |
1107 | if (!req) { | 1112 | if (!req) { |
1108 | DBGMSG("arm_write -> rcode_conflict_error"); | 1113 | DBGMSG("arm_write -> rcode_conflict_error"); |
1109 | spin_unlock(&host_info_lock); | 1114 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1110 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. | 1115 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. |
1111 | The request my be retried */ | 1116 | The request my be retried */ |
1112 | } | 1117 | } |
@@ -1118,7 +1123,7 @@ static int arm_write(struct hpsb_host *host, int nodeid, int destid, | |||
1118 | if (!(req->data)) { | 1123 | if (!(req->data)) { |
1119 | free_pending_request(req); | 1124 | free_pending_request(req); |
1120 | DBGMSG("arm_write -> rcode_conflict_error"); | 1125 | DBGMSG("arm_write -> rcode_conflict_error"); |
1121 | spin_unlock(&host_info_lock); | 1126 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1122 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. | 1127 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. |
1123 | The request may be retried */ | 1128 | The request may be retried */ |
1124 | } | 1129 | } |
@@ -1165,7 +1170,7 @@ static int arm_write(struct hpsb_host *host, int nodeid, int destid, | |||
1165 | sizeof(struct arm_request)); | 1170 | sizeof(struct arm_request)); |
1166 | queue_complete_req(req); | 1171 | queue_complete_req(req); |
1167 | } | 1172 | } |
1168 | spin_unlock(&host_info_lock); | 1173 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1169 | return (rcode); | 1174 | return (rcode); |
1170 | } | 1175 | } |
1171 | 1176 | ||
@@ -1173,6 +1178,7 @@ static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store, | |||
1173 | u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, | 1178 | u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, |
1174 | u16 flags) | 1179 | u16 flags) |
1175 | { | 1180 | { |
1181 | unsigned long irqflags; | ||
1176 | struct pending_request *req; | 1182 | struct pending_request *req; |
1177 | struct host_info *hi; | 1183 | struct host_info *hi; |
1178 | struct file_info *fi = NULL; | 1184 | struct file_info *fi = NULL; |
@@ -1198,7 +1204,7 @@ static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store, | |||
1198 | (u32) (addr & 0xFFFFFFFF), ext_tcode & 0xFF, | 1204 | (u32) (addr & 0xFFFFFFFF), ext_tcode & 0xFF, |
1199 | be32_to_cpu(data), be32_to_cpu(arg)); | 1205 | be32_to_cpu(data), be32_to_cpu(arg)); |
1200 | } | 1206 | } |
1201 | spin_lock(&host_info_lock); | 1207 | spin_lock_irqsave(&host_info_lock, irqflags); |
1202 | hi = find_host_info(host); /* search address-entry */ | 1208 | hi = find_host_info(host); /* search address-entry */ |
1203 | if (hi != NULL) { | 1209 | if (hi != NULL) { |
1204 | list_for_each_entry(fi, &hi->file_info_list, list) { | 1210 | list_for_each_entry(fi, &hi->file_info_list, list) { |
@@ -1224,7 +1230,7 @@ static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store, | |||
1224 | if (!found) { | 1230 | if (!found) { |
1225 | printk(KERN_ERR "raw1394: arm_lock FAILED addr_entry not found" | 1231 | printk(KERN_ERR "raw1394: arm_lock FAILED addr_entry not found" |
1226 | " -> rcode_address_error\n"); | 1232 | " -> rcode_address_error\n"); |
1227 | spin_unlock(&host_info_lock); | 1233 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1228 | return (RCODE_ADDRESS_ERROR); | 1234 | return (RCODE_ADDRESS_ERROR); |
1229 | } else { | 1235 | } else { |
1230 | DBGMSG("arm_lock addr_entry FOUND"); | 1236 | DBGMSG("arm_lock addr_entry FOUND"); |
@@ -1307,7 +1313,7 @@ static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store, | |||
1307 | req = __alloc_pending_request(SLAB_ATOMIC); | 1313 | req = __alloc_pending_request(SLAB_ATOMIC); |
1308 | if (!req) { | 1314 | if (!req) { |
1309 | DBGMSG("arm_lock -> rcode_conflict_error"); | 1315 | DBGMSG("arm_lock -> rcode_conflict_error"); |
1310 | spin_unlock(&host_info_lock); | 1316 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1311 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. | 1317 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. |
1312 | The request may be retried */ | 1318 | The request may be retried */ |
1313 | } | 1319 | } |
@@ -1316,7 +1322,7 @@ static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store, | |||
1316 | if (!(req->data)) { | 1322 | if (!(req->data)) { |
1317 | free_pending_request(req); | 1323 | free_pending_request(req); |
1318 | DBGMSG("arm_lock -> rcode_conflict_error"); | 1324 | DBGMSG("arm_lock -> rcode_conflict_error"); |
1319 | spin_unlock(&host_info_lock); | 1325 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1320 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. | 1326 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. |
1321 | The request may be retried */ | 1327 | The request may be retried */ |
1322 | } | 1328 | } |
@@ -1382,7 +1388,7 @@ static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store, | |||
1382 | sizeof(struct arm_response) + 2 * sizeof(*store)); | 1388 | sizeof(struct arm_response) + 2 * sizeof(*store)); |
1383 | queue_complete_req(req); | 1389 | queue_complete_req(req); |
1384 | } | 1390 | } |
1385 | spin_unlock(&host_info_lock); | 1391 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1386 | return (rcode); | 1392 | return (rcode); |
1387 | } | 1393 | } |
1388 | 1394 | ||
@@ -1390,6 +1396,7 @@ static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store, | |||
1390 | u64 addr, octlet_t data, octlet_t arg, int ext_tcode, | 1396 | u64 addr, octlet_t data, octlet_t arg, int ext_tcode, |
1391 | u16 flags) | 1397 | u16 flags) |
1392 | { | 1398 | { |
1399 | unsigned long irqflags; | ||
1393 | struct pending_request *req; | 1400 | struct pending_request *req; |
1394 | struct host_info *hi; | 1401 | struct host_info *hi; |
1395 | struct file_info *fi = NULL; | 1402 | struct file_info *fi = NULL; |
@@ -1422,7 +1429,7 @@ static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store, | |||
1422 | (u32) ((be64_to_cpu(arg) >> 32) & 0xFFFFFFFF), | 1429 | (u32) ((be64_to_cpu(arg) >> 32) & 0xFFFFFFFF), |
1423 | (u32) (be64_to_cpu(arg) & 0xFFFFFFFF)); | 1430 | (u32) (be64_to_cpu(arg) & 0xFFFFFFFF)); |
1424 | } | 1431 | } |
1425 | spin_lock(&host_info_lock); | 1432 | spin_lock_irqsave(&host_info_lock, irqflags); |
1426 | hi = find_host_info(host); /* search addressentry in file_info's for host */ | 1433 | hi = find_host_info(host); /* search addressentry in file_info's for host */ |
1427 | if (hi != NULL) { | 1434 | if (hi != NULL) { |
1428 | list_for_each_entry(fi, &hi->file_info_list, list) { | 1435 | list_for_each_entry(fi, &hi->file_info_list, list) { |
@@ -1449,7 +1456,7 @@ static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store, | |||
1449 | printk(KERN_ERR | 1456 | printk(KERN_ERR |
1450 | "raw1394: arm_lock64 FAILED addr_entry not found" | 1457 | "raw1394: arm_lock64 FAILED addr_entry not found" |
1451 | " -> rcode_address_error\n"); | 1458 | " -> rcode_address_error\n"); |
1452 | spin_unlock(&host_info_lock); | 1459 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1453 | return (RCODE_ADDRESS_ERROR); | 1460 | return (RCODE_ADDRESS_ERROR); |
1454 | } else { | 1461 | } else { |
1455 | DBGMSG("arm_lock64 addr_entry FOUND"); | 1462 | DBGMSG("arm_lock64 addr_entry FOUND"); |
@@ -1533,7 +1540,7 @@ static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store, | |||
1533 | DBGMSG("arm_lock64 -> entering notification-section"); | 1540 | DBGMSG("arm_lock64 -> entering notification-section"); |
1534 | req = __alloc_pending_request(SLAB_ATOMIC); | 1541 | req = __alloc_pending_request(SLAB_ATOMIC); |
1535 | if (!req) { | 1542 | if (!req) { |
1536 | spin_unlock(&host_info_lock); | 1543 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1537 | DBGMSG("arm_lock64 -> rcode_conflict_error"); | 1544 | DBGMSG("arm_lock64 -> rcode_conflict_error"); |
1538 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. | 1545 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. |
1539 | The request may be retried */ | 1546 | The request may be retried */ |
@@ -1542,7 +1549,7 @@ static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store, | |||
1542 | req->data = kmalloc(size, SLAB_ATOMIC); | 1549 | req->data = kmalloc(size, SLAB_ATOMIC); |
1543 | if (!(req->data)) { | 1550 | if (!(req->data)) { |
1544 | free_pending_request(req); | 1551 | free_pending_request(req); |
1545 | spin_unlock(&host_info_lock); | 1552 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1546 | DBGMSG("arm_lock64 -> rcode_conflict_error"); | 1553 | DBGMSG("arm_lock64 -> rcode_conflict_error"); |
1547 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. | 1554 | return (RCODE_CONFLICT_ERROR); /* A resource conflict was detected. |
1548 | The request may be retried */ | 1555 | The request may be retried */ |
@@ -1609,7 +1616,7 @@ static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store, | |||
1609 | sizeof(struct arm_response) + 2 * sizeof(*store)); | 1616 | sizeof(struct arm_response) + 2 * sizeof(*store)); |
1610 | queue_complete_req(req); | 1617 | queue_complete_req(req); |
1611 | } | 1618 | } |
1612 | spin_unlock(&host_info_lock); | 1619 | spin_unlock_irqrestore(&host_info_lock, irqflags); |
1613 | return (rcode); | 1620 | return (rcode); |
1614 | } | 1621 | } |
1615 | 1622 | ||
@@ -1980,6 +1987,7 @@ static int write_phypacket(struct file_info *fi, struct pending_request *req) | |||
1980 | struct hpsb_packet *packet = NULL; | 1987 | struct hpsb_packet *packet = NULL; |
1981 | int retval = 0; | 1988 | int retval = 0; |
1982 | quadlet_t data; | 1989 | quadlet_t data; |
1990 | unsigned long flags; | ||
1983 | 1991 | ||
1984 | data = be32_to_cpu((u32) req->req.sendb); | 1992 | data = be32_to_cpu((u32) req->req.sendb); |
1985 | DBGMSG("write_phypacket called - quadlet 0x%8.8x ", data); | 1993 | DBGMSG("write_phypacket called - quadlet 0x%8.8x ", data); |
@@ -1990,9 +1998,9 @@ static int write_phypacket(struct file_info *fi, struct pending_request *req) | |||
1990 | req->packet = packet; | 1998 | req->packet = packet; |
1991 | hpsb_set_packet_complete_task(packet, | 1999 | hpsb_set_packet_complete_task(packet, |
1992 | (void (*)(void *))queue_complete_cb, req); | 2000 | (void (*)(void *))queue_complete_cb, req); |
1993 | spin_lock_irq(&fi->reqlists_lock); | 2001 | spin_lock_irqsave(&fi->reqlists_lock, flags); |
1994 | list_add_tail(&req->list, &fi->req_pending); | 2002 | list_add_tail(&req->list, &fi->req_pending); |
1995 | spin_unlock_irq(&fi->reqlists_lock); | 2003 | spin_unlock_irqrestore(&fi->reqlists_lock, flags); |
1996 | packet->generation = req->req.generation; | 2004 | packet->generation = req->req.generation; |
1997 | retval = hpsb_send_packet(packet); | 2005 | retval = hpsb_send_packet(packet); |
1998 | DBGMSG("write_phypacket send_packet called => retval: %d ", retval); | 2006 | DBGMSG("write_phypacket send_packet called => retval: %d ", retval); |
@@ -2659,14 +2667,15 @@ static unsigned int raw1394_poll(struct file *file, poll_table * pt) | |||
2659 | { | 2667 | { |
2660 | struct file_info *fi = file->private_data; | 2668 | struct file_info *fi = file->private_data; |
2661 | unsigned int mask = POLLOUT | POLLWRNORM; | 2669 | unsigned int mask = POLLOUT | POLLWRNORM; |
2670 | unsigned long flags; | ||
2662 | 2671 | ||
2663 | poll_wait(file, &fi->poll_wait_complete, pt); | 2672 | poll_wait(file, &fi->poll_wait_complete, pt); |
2664 | 2673 | ||
2665 | spin_lock_irq(&fi->reqlists_lock); | 2674 | spin_lock_irqsave(&fi->reqlists_lock, flags); |
2666 | if (!list_empty(&fi->req_complete)) { | 2675 | if (!list_empty(&fi->req_complete)) { |
2667 | mask |= POLLIN | POLLRDNORM; | 2676 | mask |= POLLIN | POLLRDNORM; |
2668 | } | 2677 | } |
2669 | spin_unlock_irq(&fi->reqlists_lock); | 2678 | spin_unlock_irqrestore(&fi->reqlists_lock, flags); |
2670 | 2679 | ||
2671 | return mask; | 2680 | return mask; |
2672 | } | 2681 | } |
@@ -2710,6 +2719,7 @@ static int raw1394_release(struct inode *inode, struct file *file) | |||
2710 | struct arm_addr *arm_addr = NULL; | 2719 | struct arm_addr *arm_addr = NULL; |
2711 | int another_host; | 2720 | int another_host; |
2712 | int csr_mod = 0; | 2721 | int csr_mod = 0; |
2722 | unsigned long flags; | ||
2713 | 2723 | ||
2714 | if (fi->iso_state != RAW1394_ISO_INACTIVE) | 2724 | if (fi->iso_state != RAW1394_ISO_INACTIVE) |
2715 | raw1394_iso_shutdown(fi); | 2725 | raw1394_iso_shutdown(fi); |
@@ -2720,13 +2730,11 @@ static int raw1394_release(struct inode *inode, struct file *file) | |||
2720 | } | 2730 | } |
2721 | } | 2731 | } |
2722 | 2732 | ||
2723 | spin_lock_irq(&host_info_lock); | 2733 | spin_lock_irqsave(&host_info_lock, flags); |
2724 | fi->listen_channels = 0; | 2734 | fi->listen_channels = 0; |
2725 | spin_unlock_irq(&host_info_lock); | ||
2726 | 2735 | ||
2727 | fail = 0; | 2736 | fail = 0; |
2728 | /* set address-entries invalid */ | 2737 | /* set address-entries invalid */ |
2729 | spin_lock_irq(&host_info_lock); | ||
2730 | 2738 | ||
2731 | while (!list_empty(&fi->addr_list)) { | 2739 | while (!list_empty(&fi->addr_list)) { |
2732 | another_host = 0; | 2740 | another_host = 0; |
@@ -2777,14 +2785,14 @@ static int raw1394_release(struct inode *inode, struct file *file) | |||
2777 | vfree(addr->addr_space_buffer); | 2785 | vfree(addr->addr_space_buffer); |
2778 | kfree(addr); | 2786 | kfree(addr); |
2779 | } /* while */ | 2787 | } /* while */ |
2780 | spin_unlock_irq(&host_info_lock); | 2788 | spin_unlock_irqrestore(&host_info_lock, flags); |
2781 | if (fail > 0) { | 2789 | if (fail > 0) { |
2782 | printk(KERN_ERR "raw1394: during addr_list-release " | 2790 | printk(KERN_ERR "raw1394: during addr_list-release " |
2783 | "error(s) occurred \n"); | 2791 | "error(s) occurred \n"); |
2784 | } | 2792 | } |
2785 | 2793 | ||
2786 | while (!done) { | 2794 | while (!done) { |
2787 | spin_lock_irq(&fi->reqlists_lock); | 2795 | spin_lock_irqsave(&fi->reqlists_lock, flags); |
2788 | 2796 | ||
2789 | while (!list_empty(&fi->req_complete)) { | 2797 | while (!list_empty(&fi->req_complete)) { |
2790 | lh = fi->req_complete.next; | 2798 | lh = fi->req_complete.next; |
@@ -2798,7 +2806,7 @@ static int raw1394_release(struct inode *inode, struct file *file) | |||
2798 | if (list_empty(&fi->req_pending)) | 2806 | if (list_empty(&fi->req_pending)) |
2799 | done = 1; | 2807 | done = 1; |
2800 | 2808 | ||
2801 | spin_unlock_irq(&fi->reqlists_lock); | 2809 | spin_unlock_irqrestore(&fi->reqlists_lock, flags); |
2802 | 2810 | ||
2803 | if (!done) | 2811 | if (!done) |
2804 | down_interruptible(&fi->complete_sem); | 2812 | down_interruptible(&fi->complete_sem); |
@@ -2828,9 +2836,9 @@ static int raw1394_release(struct inode *inode, struct file *file) | |||
2828 | fi->host->id); | 2836 | fi->host->id); |
2829 | 2837 | ||
2830 | if (fi->state == connected) { | 2838 | if (fi->state == connected) { |
2831 | spin_lock_irq(&host_info_lock); | 2839 | spin_lock_irqsave(&host_info_lock, flags); |
2832 | list_del(&fi->list); | 2840 | list_del(&fi->list); |
2833 | spin_unlock_irq(&host_info_lock); | 2841 | spin_unlock_irqrestore(&host_info_lock, flags); |
2834 | 2842 | ||
2835 | put_device(&fi->host->device); | 2843 | put_device(&fi->host->device); |
2836 | } | 2844 | } |
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c index f6a8ac026557..378646b5a1b8 100644 --- a/drivers/infiniband/hw/mthca/mthca_cmd.c +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c | |||
@@ -524,7 +524,7 @@ void mthca_cmd_use_polling(struct mthca_dev *dev) | |||
524 | } | 524 | } |
525 | 525 | ||
526 | struct mthca_mailbox *mthca_alloc_mailbox(struct mthca_dev *dev, | 526 | struct mthca_mailbox *mthca_alloc_mailbox(struct mthca_dev *dev, |
527 | unsigned int gfp_mask) | 527 | gfp_t gfp_mask) |
528 | { | 528 | { |
529 | struct mthca_mailbox *mailbox; | 529 | struct mthca_mailbox *mailbox; |
530 | 530 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.h b/drivers/infiniband/hw/mthca/mthca_cmd.h index 65f976a13e02..18175bec84c2 100644 --- a/drivers/infiniband/hw/mthca/mthca_cmd.h +++ b/drivers/infiniband/hw/mthca/mthca_cmd.h | |||
@@ -248,7 +248,7 @@ void mthca_cmd_event(struct mthca_dev *dev, u16 token, | |||
248 | u8 status, u64 out_param); | 248 | u8 status, u64 out_param); |
249 | 249 | ||
250 | struct mthca_mailbox *mthca_alloc_mailbox(struct mthca_dev *dev, | 250 | struct mthca_mailbox *mthca_alloc_mailbox(struct mthca_dev *dev, |
251 | unsigned int gfp_mask); | 251 | gfp_t gfp_mask); |
252 | void mthca_free_mailbox(struct mthca_dev *dev, struct mthca_mailbox *mailbox); | 252 | void mthca_free_mailbox(struct mthca_dev *dev, struct mthca_mailbox *mailbox); |
253 | 253 | ||
254 | int mthca_SYS_EN(struct mthca_dev *dev, u8 *status); | 254 | int mthca_SYS_EN(struct mthca_dev *dev, u8 *status); |
diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c index c81fa8e975ef..8dfafda5ed24 100644 --- a/drivers/infiniband/hw/mthca/mthca_eq.c +++ b/drivers/infiniband/hw/mthca/mthca_eq.c | |||
@@ -396,20 +396,21 @@ static irqreturn_t mthca_tavor_interrupt(int irq, void *dev_ptr, struct pt_regs | |||
396 | writel(dev->eq_table.clr_mask, dev->eq_table.clr_int); | 396 | writel(dev->eq_table.clr_mask, dev->eq_table.clr_int); |
397 | 397 | ||
398 | ecr = readl(dev->eq_regs.tavor.ecr_base + 4); | 398 | ecr = readl(dev->eq_regs.tavor.ecr_base + 4); |
399 | if (ecr) { | 399 | if (!ecr) |
400 | writel(ecr, dev->eq_regs.tavor.ecr_base + | 400 | return IRQ_NONE; |
401 | MTHCA_ECR_CLR_BASE - MTHCA_ECR_BASE + 4); | ||
402 | 401 | ||
403 | for (i = 0; i < MTHCA_NUM_EQ; ++i) | 402 | writel(ecr, dev->eq_regs.tavor.ecr_base + |
404 | if (ecr & dev->eq_table.eq[i].eqn_mask && | 403 | MTHCA_ECR_CLR_BASE - MTHCA_ECR_BASE + 4); |
405 | mthca_eq_int(dev, &dev->eq_table.eq[i])) { | 404 | |
405 | for (i = 0; i < MTHCA_NUM_EQ; ++i) | ||
406 | if (ecr & dev->eq_table.eq[i].eqn_mask) { | ||
407 | if (mthca_eq_int(dev, &dev->eq_table.eq[i])) | ||
406 | tavor_set_eq_ci(dev, &dev->eq_table.eq[i], | 408 | tavor_set_eq_ci(dev, &dev->eq_table.eq[i], |
407 | dev->eq_table.eq[i].cons_index); | 409 | dev->eq_table.eq[i].cons_index); |
408 | tavor_eq_req_not(dev, dev->eq_table.eq[i].eqn); | 410 | tavor_eq_req_not(dev, dev->eq_table.eq[i].eqn); |
409 | } | 411 | } |
410 | } | ||
411 | 412 | ||
412 | return IRQ_RETVAL(ecr); | 413 | return IRQ_HANDLED; |
413 | } | 414 | } |
414 | 415 | ||
415 | static irqreturn_t mthca_tavor_msi_x_interrupt(int irq, void *eq_ptr, | 416 | static irqreturn_t mthca_tavor_msi_x_interrupt(int irq, void *eq_ptr, |
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c index 7bd7a4bec7b4..9ad8b3b6cfef 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c | |||
@@ -82,7 +82,7 @@ void mthca_free_icm(struct mthca_dev *dev, struct mthca_icm *icm) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, | 84 | struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, |
85 | unsigned int gfp_mask) | 85 | gfp_t gfp_mask) |
86 | { | 86 | { |
87 | struct mthca_icm *icm; | 87 | struct mthca_icm *icm; |
88 | struct mthca_icm_chunk *chunk = NULL; | 88 | struct mthca_icm_chunk *chunk = NULL; |
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.h b/drivers/infiniband/hw/mthca/mthca_memfree.h index bafa51544aa3..29433f295253 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.h +++ b/drivers/infiniband/hw/mthca/mthca_memfree.h | |||
@@ -77,7 +77,7 @@ struct mthca_icm_iter { | |||
77 | struct mthca_dev; | 77 | struct mthca_dev; |
78 | 78 | ||
79 | struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, | 79 | struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, |
80 | unsigned int gfp_mask); | 80 | gfp_t gfp_mask); |
81 | void mthca_free_icm(struct mthca_dev *dev, struct mthca_icm *icm); | 81 | void mthca_free_icm(struct mthca_dev *dev, struct mthca_icm *icm); |
82 | 82 | ||
83 | struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev, | 83 | struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev, |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 2fba2bbe72d8..01654fcabc52 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -91,7 +91,7 @@ int bitmap_active(struct bitmap *bitmap) | |||
91 | 91 | ||
92 | #define WRITE_POOL_SIZE 256 | 92 | #define WRITE_POOL_SIZE 256 |
93 | /* mempool for queueing pending writes on the bitmap file */ | 93 | /* mempool for queueing pending writes on the bitmap file */ |
94 | static void *write_pool_alloc(unsigned int gfp_flags, void *data) | 94 | static void *write_pool_alloc(gfp_t gfp_flags, void *data) |
95 | { | 95 | { |
96 | return kmalloc(sizeof(struct page_list), gfp_flags); | 96 | return kmalloc(sizeof(struct page_list), gfp_flags); |
97 | } | 97 | } |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index b6148f6f7836..28c1a628621f 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -331,7 +331,7 @@ crypt_alloc_buffer(struct crypt_config *cc, unsigned int size, | |||
331 | { | 331 | { |
332 | struct bio *bio; | 332 | struct bio *bio; |
333 | unsigned int nr_iovecs = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; | 333 | unsigned int nr_iovecs = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; |
334 | int gfp_mask = GFP_NOIO | __GFP_HIGHMEM; | 334 | gfp_t gfp_mask = GFP_NOIO | __GFP_HIGHMEM; |
335 | unsigned int i; | 335 | unsigned int i; |
336 | 336 | ||
337 | /* | 337 | /* |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 2897df90df44..2a8a5696bf8a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -3063,6 +3063,7 @@ static int md_thread(void * arg) | |||
3063 | * many dirty RAID5 blocks. | 3063 | * many dirty RAID5 blocks. |
3064 | */ | 3064 | */ |
3065 | 3065 | ||
3066 | allow_signal(SIGKILL); | ||
3066 | complete(thread->event); | 3067 | complete(thread->event); |
3067 | while (!kthread_should_stop()) { | 3068 | while (!kthread_should_stop()) { |
3068 | void (*run)(mddev_t *); | 3069 | void (*run)(mddev_t *); |
@@ -3111,7 +3112,7 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev, | |||
3111 | thread->mddev = mddev; | 3112 | thread->mddev = mddev; |
3112 | thread->name = name; | 3113 | thread->name = name; |
3113 | thread->timeout = MAX_SCHEDULE_TIMEOUT; | 3114 | thread->timeout = MAX_SCHEDULE_TIMEOUT; |
3114 | thread->tsk = kthread_run(md_thread, thread, mdname(thread->mddev)); | 3115 | thread->tsk = kthread_run(md_thread, thread, name, mdname(thread->mddev)); |
3115 | if (IS_ERR(thread->tsk)) { | 3116 | if (IS_ERR(thread->tsk)) { |
3116 | kfree(thread); | 3117 | kfree(thread); |
3117 | return NULL; | 3118 | return NULL; |
@@ -3567,8 +3568,10 @@ static void md_do_sync(mddev_t *mddev) | |||
3567 | mddev->curr_resync = 2; | 3568 | mddev->curr_resync = 2; |
3568 | 3569 | ||
3569 | try_again: | 3570 | try_again: |
3570 | if (signal_pending(current)) { | 3571 | if (signal_pending(current) || |
3572 | kthread_should_stop()) { | ||
3571 | flush_signals(current); | 3573 | flush_signals(current); |
3574 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | ||
3572 | goto skip; | 3575 | goto skip; |
3573 | } | 3576 | } |
3574 | ITERATE_MDDEV(mddev2,tmp) { | 3577 | ITERATE_MDDEV(mddev2,tmp) { |
@@ -3588,8 +3591,9 @@ static void md_do_sync(mddev_t *mddev) | |||
3588 | */ | 3591 | */ |
3589 | continue; | 3592 | continue; |
3590 | prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE); | 3593 | prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE); |
3591 | if (!signal_pending(current) | 3594 | if (!signal_pending(current) && |
3592 | && mddev2->curr_resync >= mddev->curr_resync) { | 3595 | !kthread_should_stop() && |
3596 | mddev2->curr_resync >= mddev->curr_resync) { | ||
3593 | printk(KERN_INFO "md: delaying resync of %s" | 3597 | printk(KERN_INFO "md: delaying resync of %s" |
3594 | " until %s has finished resync (they" | 3598 | " until %s has finished resync (they" |
3595 | " share one or more physical units)\n", | 3599 | " share one or more physical units)\n", |
@@ -3695,7 +3699,7 @@ static void md_do_sync(mddev_t *mddev) | |||
3695 | } | 3699 | } |
3696 | 3700 | ||
3697 | 3701 | ||
3698 | if (signal_pending(current)) { | 3702 | if (signal_pending(current) || kthread_should_stop()) { |
3699 | /* | 3703 | /* |
3700 | * got a signal, exit. | 3704 | * got a signal, exit. |
3701 | */ | 3705 | */ |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 93570355819a..bbb989df4cf0 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -262,7 +262,6 @@ config VIDEO_SAA7134_DVB | |||
262 | depends on VIDEO_SAA7134 && DVB_CORE | 262 | depends on VIDEO_SAA7134 && DVB_CORE |
263 | select VIDEO_BUF_DVB | 263 | select VIDEO_BUF_DVB |
264 | select DVB_MT352 | 264 | select DVB_MT352 |
265 | select DVB_CX22702 | ||
266 | select DVB_TDA1004X | 265 | select DVB_TDA1004X |
267 | ---help--- | 266 | ---help--- |
268 | This adds support for DVB cards based on the | 267 | This adds support for DVB cards based on the |
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 429820e48c69..7de19a84dc74 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -257,8 +257,8 @@ static void mptsas_print_device_pg0(SasDevicePage0_t *pg0) | |||
257 | printk("SAS Address=0x%llX\n", le64_to_cpu(sas_address)); | 257 | printk("SAS Address=0x%llX\n", le64_to_cpu(sas_address)); |
258 | printk("Target ID=0x%X\n", pg0->TargetID); | 258 | printk("Target ID=0x%X\n", pg0->TargetID); |
259 | printk("Bus=0x%X\n", pg0->Bus); | 259 | printk("Bus=0x%X\n", pg0->Bus); |
260 | printk("PhyNum=0x%X\n", pg0->PhyNum); | 260 | printk("Parent Phy Num=0x%X\n", pg0->PhyNum); |
261 | printk("AccessStatus=0x%X\n", le16_to_cpu(pg0->AccessStatus)); | 261 | printk("Access Status=0x%X\n", le16_to_cpu(pg0->AccessStatus)); |
262 | printk("Device Info=0x%X\n", le32_to_cpu(pg0->DeviceInfo)); | 262 | printk("Device Info=0x%X\n", le32_to_cpu(pg0->DeviceInfo)); |
263 | printk("Flags=0x%X\n", le16_to_cpu(pg0->Flags)); | 263 | printk("Flags=0x%X\n", le16_to_cpu(pg0->Flags)); |
264 | printk("Physical Port=0x%X\n", pg0->PhysicalPort); | 264 | printk("Physical Port=0x%X\n", pg0->PhysicalPort); |
@@ -270,7 +270,7 @@ static void mptsas_print_expander_pg1(SasExpanderPage1_t *pg1) | |||
270 | printk("---- SAS EXPANDER PAGE 1 ------------\n"); | 270 | printk("---- SAS EXPANDER PAGE 1 ------------\n"); |
271 | 271 | ||
272 | printk("Physical Port=0x%X\n", pg1->PhysicalPort); | 272 | printk("Physical Port=0x%X\n", pg1->PhysicalPort); |
273 | printk("PHY Identifier=0x%X\n", pg1->Phy); | 273 | printk("PHY Identifier=0x%X\n", pg1->PhyIdentifier); |
274 | printk("Negotiated Link Rate=0x%X\n", pg1->NegotiatedLinkRate); | 274 | printk("Negotiated Link Rate=0x%X\n", pg1->NegotiatedLinkRate); |
275 | printk("Programmed Link Rate=0x%X\n", pg1->ProgrammedLinkRate); | 275 | printk("Programmed Link Rate=0x%X\n", pg1->ProgrammedLinkRate); |
276 | printk("Hardware Link Rate=0x%X\n", pg1->HwLinkRate); | 276 | printk("Hardware Link Rate=0x%X\n", pg1->HwLinkRate); |
@@ -604,7 +604,7 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, | |||
604 | mptsas_print_expander_pg1(buffer); | 604 | mptsas_print_expander_pg1(buffer); |
605 | 605 | ||
606 | /* save config data */ | 606 | /* save config data */ |
607 | phy_info->phy_id = buffer->Phy; | 607 | phy_info->phy_id = buffer->PhyIdentifier; |
608 | phy_info->port_id = buffer->PhysicalPort; | 608 | phy_info->port_id = buffer->PhysicalPort; |
609 | phy_info->negotiated_link_rate = buffer->NegotiatedLinkRate; | 609 | phy_info->negotiated_link_rate = buffer->NegotiatedLinkRate; |
610 | phy_info->programmed_link_rate = buffer->ProgrammedLinkRate; | 610 | phy_info->programmed_link_rate = buffer->ProgrammedLinkRate; |
@@ -825,6 +825,8 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc, int *index) | |||
825 | mptsas_sas_device_pg0(ioc, &port_info->phy_info[i].identify, | 825 | mptsas_sas_device_pg0(ioc, &port_info->phy_info[i].identify, |
826 | (MPI_SAS_DEVICE_PGAD_FORM_GET_NEXT_HANDLE << | 826 | (MPI_SAS_DEVICE_PGAD_FORM_GET_NEXT_HANDLE << |
827 | MPI_SAS_DEVICE_PGAD_FORM_SHIFT), handle); | 827 | MPI_SAS_DEVICE_PGAD_FORM_SHIFT), handle); |
828 | port_info->phy_info[i].identify.phy_id = | ||
829 | port_info->phy_info[i].phy_id; | ||
828 | handle = port_info->phy_info[i].identify.handle; | 830 | handle = port_info->phy_info[i].identify.handle; |
829 | 831 | ||
830 | if (port_info->phy_info[i].attached.handle) { | 832 | if (port_info->phy_info[i].attached.handle) { |
@@ -881,6 +883,8 @@ mptsas_probe_expander_phys(MPT_ADAPTER *ioc, u32 *handle, int *index) | |||
881 | (MPI_SAS_DEVICE_PGAD_FORM_HANDLE << | 883 | (MPI_SAS_DEVICE_PGAD_FORM_HANDLE << |
882 | MPI_SAS_DEVICE_PGAD_FORM_SHIFT), | 884 | MPI_SAS_DEVICE_PGAD_FORM_SHIFT), |
883 | port_info->phy_info[i].identify.handle); | 885 | port_info->phy_info[i].identify.handle); |
886 | port_info->phy_info[i].identify.phy_id = | ||
887 | port_info->phy_info[i].phy_id; | ||
884 | } | 888 | } |
885 | 889 | ||
886 | if (port_info->phy_info[i].attached.handle) { | 890 | if (port_info->phy_info[i].attached.handle) { |
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index bc537440ca02..f822cd3025ff 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -1027,8 +1027,7 @@ static void cp_reset_hw (struct cp_private *cp) | |||
1027 | if (!(cpr8(Cmd) & CmdReset)) | 1027 | if (!(cpr8(Cmd) & CmdReset)) |
1028 | return; | 1028 | return; |
1029 | 1029 | ||
1030 | set_current_state(TASK_UNINTERRUPTIBLE); | 1030 | schedule_timeout_uninterruptible(10); |
1031 | schedule_timeout(10); | ||
1032 | } | 1031 | } |
1033 | 1032 | ||
1034 | printk(KERN_ERR "%s: hardware reset timeout\n", cp->dev->name); | 1033 | printk(KERN_ERR "%s: hardware reset timeout\n", cp->dev->name); |
@@ -1575,6 +1574,7 @@ static struct ethtool_ops cp_ethtool_ops = { | |||
1575 | .set_wol = cp_set_wol, | 1574 | .set_wol = cp_set_wol, |
1576 | .get_strings = cp_get_strings, | 1575 | .get_strings = cp_get_strings, |
1577 | .get_ethtool_stats = cp_get_ethtool_stats, | 1576 | .get_ethtool_stats = cp_get_ethtool_stats, |
1577 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
1578 | }; | 1578 | }; |
1579 | 1579 | ||
1580 | static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | 1580 | static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) |
@@ -1773,6 +1773,7 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1773 | for (i = 0; i < 3; i++) | 1773 | for (i = 0; i < 3; i++) |
1774 | ((u16 *) (dev->dev_addr))[i] = | 1774 | ((u16 *) (dev->dev_addr))[i] = |
1775 | le16_to_cpu (read_eeprom (regs, i + 7, addr_len)); | 1775 | le16_to_cpu (read_eeprom (regs, i + 7, addr_len)); |
1776 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
1776 | 1777 | ||
1777 | dev->open = cp_open; | 1778 | dev->open = cp_open; |
1778 | dev->stop = cp_close; | 1779 | dev->stop = cp_close; |
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 4c2cf7bbd252..30bee11c48bd 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -552,7 +552,8 @@ const static struct { | |||
552 | 552 | ||
553 | { "RTL-8100B/8139D", | 553 | { "RTL-8100B/8139D", |
554 | HW_REVID(1, 1, 1, 0, 1, 0, 1), | 554 | HW_REVID(1, 1, 1, 0, 1, 0, 1), |
555 | HasLWake, | 555 | HasHltClk /* XXX undocumented? */ |
556 | | HasLWake, | ||
556 | }, | 557 | }, |
557 | 558 | ||
558 | { "RTL-8101", | 559 | { "RTL-8101", |
@@ -970,6 +971,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev, | |||
970 | for (i = 0; i < 3; i++) | 971 | for (i = 0; i < 3; i++) |
971 | ((u16 *) (dev->dev_addr))[i] = | 972 | ((u16 *) (dev->dev_addr))[i] = |
972 | le16_to_cpu (read_eeprom (ioaddr, i + 7, addr_len)); | 973 | le16_to_cpu (read_eeprom (ioaddr, i + 7, addr_len)); |
974 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
973 | 975 | ||
974 | /* The Rtl8139-specific entries in the device structure. */ | 976 | /* The Rtl8139-specific entries in the device structure. */ |
975 | dev->open = rtl8139_open; | 977 | dev->open = rtl8139_open; |
@@ -2465,6 +2467,7 @@ static struct ethtool_ops rtl8139_ethtool_ops = { | |||
2465 | .get_strings = rtl8139_get_strings, | 2467 | .get_strings = rtl8139_get_strings, |
2466 | .get_stats_count = rtl8139_get_stats_count, | 2468 | .get_stats_count = rtl8139_get_stats_count, |
2467 | .get_ethtool_stats = rtl8139_get_ethtool_stats, | 2469 | .get_ethtool_stats = rtl8139_get_ethtool_stats, |
2470 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
2468 | }; | 2471 | }; |
2469 | 2472 | ||
2470 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 2473 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index c748b0e16419..5148d47492a0 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -475,6 +475,14 @@ config SGI_IOC3_ETH_HW_TX_CSUM | |||
475 | the moment only acceleration of IPv4 is supported. This option | 475 | the moment only acceleration of IPv4 is supported. This option |
476 | enables offloading for checksums on transmit. If unsure, say Y. | 476 | enables offloading for checksums on transmit. If unsure, say Y. |
477 | 477 | ||
478 | config MIPS_SIM_NET | ||
479 | tristate "MIPS simulator Network device (EXPERIMENTAL)" | ||
480 | depends on NETDEVICES && MIPS_SIM && EXPERIMENTAL | ||
481 | help | ||
482 | The MIPSNET device is a simple Ethernet network device which is | ||
483 | emulated by the MIPS Simulator. | ||
484 | If you are not using a MIPSsim or are unsure, say N. | ||
485 | |||
478 | config SGI_O2MACE_ETH | 486 | config SGI_O2MACE_ETH |
479 | tristate "SGI O2 MACE Fast Ethernet support" | 487 | tristate "SGI O2 MACE Fast Ethernet support" |
480 | depends on NET_ETHERNET && SGI_IP32=y | 488 | depends on NET_ETHERNET && SGI_IP32=y |
@@ -2083,6 +2091,7 @@ config SPIDER_NET | |||
2083 | config GIANFAR | 2091 | config GIANFAR |
2084 | tristate "Gianfar Ethernet" | 2092 | tristate "Gianfar Ethernet" |
2085 | depends on 85xx || 83xx | 2093 | depends on 85xx || 83xx |
2094 | select PHYLIB | ||
2086 | help | 2095 | help |
2087 | This driver supports the Gigabit TSEC on the MPC85xx | 2096 | This driver supports the Gigabit TSEC on the MPC85xx |
2088 | family of chips, and the FEC on the 8540 | 2097 | family of chips, and the FEC on the 8540 |
@@ -2243,6 +2252,20 @@ config ISERIES_VETH | |||
2243 | tristate "iSeries Virtual Ethernet driver support" | 2252 | tristate "iSeries Virtual Ethernet driver support" |
2244 | depends on PPC_ISERIES | 2253 | depends on PPC_ISERIES |
2245 | 2254 | ||
2255 | config RIONET | ||
2256 | tristate "RapidIO Ethernet over messaging driver support" | ||
2257 | depends on NETDEVICES && RAPIDIO | ||
2258 | |||
2259 | config RIONET_TX_SIZE | ||
2260 | int "Number of outbound queue entries" | ||
2261 | depends on RIONET | ||
2262 | default "128" | ||
2263 | |||
2264 | config RIONET_RX_SIZE | ||
2265 | int "Number of inbound queue entries" | ||
2266 | depends on RIONET | ||
2267 | default "128" | ||
2268 | |||
2246 | config FDDI | 2269 | config FDDI |
2247 | bool "FDDI driver support" | 2270 | bool "FDDI driver support" |
2248 | depends on (PCI || EISA) | 2271 | depends on (PCI || EISA) |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 8aeec9f2495b..1a84e0435f64 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -13,7 +13,7 @@ obj-$(CONFIG_CHELSIO_T1) += chelsio/ | |||
13 | obj-$(CONFIG_BONDING) += bonding/ | 13 | obj-$(CONFIG_BONDING) += bonding/ |
14 | obj-$(CONFIG_GIANFAR) += gianfar_driver.o | 14 | obj-$(CONFIG_GIANFAR) += gianfar_driver.o |
15 | 15 | ||
16 | gianfar_driver-objs := gianfar.o gianfar_ethtool.o gianfar_phy.o | 16 | gianfar_driver-objs := gianfar.o gianfar_ethtool.o gianfar_mii.o |
17 | 17 | ||
18 | # | 18 | # |
19 | # link order important here | 19 | # link order important here |
@@ -64,6 +64,7 @@ obj-$(CONFIG_SKFP) += skfp/ | |||
64 | obj-$(CONFIG_VIA_RHINE) += via-rhine.o | 64 | obj-$(CONFIG_VIA_RHINE) += via-rhine.o |
65 | obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o | 65 | obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o |
66 | obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o | 66 | obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o |
67 | obj-$(CONFIG_RIONET) += rionet.o | ||
67 | 68 | ||
68 | # | 69 | # |
69 | # end link order section | 70 | # end link order section |
@@ -166,6 +167,7 @@ obj-$(CONFIG_EQUALIZER) += eql.o | |||
166 | obj-$(CONFIG_MIPS_JAZZ_SONIC) += jazzsonic.o | 167 | obj-$(CONFIG_MIPS_JAZZ_SONIC) += jazzsonic.o |
167 | obj-$(CONFIG_MIPS_GT96100ETH) += gt96100eth.o | 168 | obj-$(CONFIG_MIPS_GT96100ETH) += gt96100eth.o |
168 | obj-$(CONFIG_MIPS_AU1X00_ENET) += au1000_eth.o | 169 | obj-$(CONFIG_MIPS_AU1X00_ENET) += au1000_eth.o |
170 | obj-$(CONFIG_MIPS_SIM_NET) += mipsnet.o | ||
169 | obj-$(CONFIG_SGI_IOC3_ETH) += ioc3-eth.o | 171 | obj-$(CONFIG_SGI_IOC3_ETH) += ioc3-eth.o |
170 | obj-$(CONFIG_DECLANCE) += declance.o | 172 | obj-$(CONFIG_DECLANCE) += declance.o |
171 | obj-$(CONFIG_ATARILANCE) += atarilance.o | 173 | obj-$(CONFIG_ATARILANCE) += atarilance.o |
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index c82b9cd1c924..78506911d656 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
@@ -151,13 +151,6 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES]; | |||
151 | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | \ | 151 | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | \ |
152 | SUPPORTED_Autoneg | 152 | SUPPORTED_Autoneg |
153 | 153 | ||
154 | static char *phy_link[] = | ||
155 | { "unknown", | ||
156 | "10Base2", "10BaseT", | ||
157 | "AUI", | ||
158 | "100BaseT", "100BaseTX", "100BaseFX" | ||
159 | }; | ||
160 | |||
161 | int bcm_5201_init(struct net_device *dev, int phy_addr) | 154 | int bcm_5201_init(struct net_device *dev, int phy_addr) |
162 | { | 155 | { |
163 | s16 data; | 156 | s16 data; |
@@ -785,6 +778,7 @@ static struct mii_chip_info { | |||
785 | {"Broadcom BCM5201 10/100 BaseT PHY",0x0040,0x6212, &bcm_5201_ops,0}, | 778 | {"Broadcom BCM5201 10/100 BaseT PHY",0x0040,0x6212, &bcm_5201_ops,0}, |
786 | {"Broadcom BCM5221 10/100 BaseT PHY",0x0040,0x61e4, &bcm_5201_ops,0}, | 779 | {"Broadcom BCM5221 10/100 BaseT PHY",0x0040,0x61e4, &bcm_5201_ops,0}, |
787 | {"Broadcom BCM5222 10/100 BaseT PHY",0x0040,0x6322, &bcm_5201_ops,1}, | 780 | {"Broadcom BCM5222 10/100 BaseT PHY",0x0040,0x6322, &bcm_5201_ops,1}, |
781 | {"NS DP83847 PHY", 0x2000, 0x5c30, &bcm_5201_ops ,0}, | ||
788 | {"AMD 79C901 HomePNA PHY",0x0000,0x35c8, &am79c901_ops,0}, | 782 | {"AMD 79C901 HomePNA PHY",0x0000,0x35c8, &am79c901_ops,0}, |
789 | {"AMD 79C874 10/100 BaseT PHY",0x0022,0x561b, &am79c874_ops,0}, | 783 | {"AMD 79C874 10/100 BaseT PHY",0x0022,0x561b, &am79c874_ops,0}, |
790 | {"LSI 80227 10/100 BaseT PHY",0x0016,0xf840, &lsi_80227_ops,0}, | 784 | {"LSI 80227 10/100 BaseT PHY",0x0016,0xf840, &lsi_80227_ops,0}, |
@@ -1045,7 +1039,7 @@ found: | |||
1045 | #endif | 1039 | #endif |
1046 | 1040 | ||
1047 | if (aup->mii->chip_info == NULL) { | 1041 | if (aup->mii->chip_info == NULL) { |
1048 | printk(KERN_ERR "%s: Au1x No MII transceivers found!\n", | 1042 | printk(KERN_ERR "%s: Au1x No known MII transceivers found!\n", |
1049 | dev->name); | 1043 | dev->name); |
1050 | return -1; | 1044 | return -1; |
1051 | } | 1045 | } |
@@ -1546,6 +1540,9 @@ au1000_probe(u32 ioaddr, int irq, int port_num) | |||
1546 | printk(KERN_ERR "%s: out of memory\n", dev->name); | 1540 | printk(KERN_ERR "%s: out of memory\n", dev->name); |
1547 | goto err_out; | 1541 | goto err_out; |
1548 | } | 1542 | } |
1543 | aup->mii->next = NULL; | ||
1544 | aup->mii->chip_info = NULL; | ||
1545 | aup->mii->status = 0; | ||
1549 | aup->mii->mii_control_reg = 0; | 1546 | aup->mii->mii_control_reg = 0; |
1550 | aup->mii->mii_data_reg = 0; | 1547 | aup->mii->mii_data_reg = 0; |
1551 | 1548 | ||
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 94939f570f78..282ebd15f011 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -106,6 +106,29 @@ static int b44_poll(struct net_device *dev, int *budget); | |||
106 | static void b44_poll_controller(struct net_device *dev); | 106 | static void b44_poll_controller(struct net_device *dev); |
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | static int dma_desc_align_mask; | ||
110 | static int dma_desc_sync_size; | ||
111 | |||
112 | static inline void b44_sync_dma_desc_for_device(struct pci_dev *pdev, | ||
113 | dma_addr_t dma_base, | ||
114 | unsigned long offset, | ||
115 | enum dma_data_direction dir) | ||
116 | { | ||
117 | dma_sync_single_range_for_device(&pdev->dev, dma_base, | ||
118 | offset & dma_desc_align_mask, | ||
119 | dma_desc_sync_size, dir); | ||
120 | } | ||
121 | |||
122 | static inline void b44_sync_dma_desc_for_cpu(struct pci_dev *pdev, | ||
123 | dma_addr_t dma_base, | ||
124 | unsigned long offset, | ||
125 | enum dma_data_direction dir) | ||
126 | { | ||
127 | dma_sync_single_range_for_cpu(&pdev->dev, dma_base, | ||
128 | offset & dma_desc_align_mask, | ||
129 | dma_desc_sync_size, dir); | ||
130 | } | ||
131 | |||
109 | static inline unsigned long br32(const struct b44 *bp, unsigned long reg) | 132 | static inline unsigned long br32(const struct b44 *bp, unsigned long reg) |
110 | { | 133 | { |
111 | return readl(bp->regs + reg); | 134 | return readl(bp->regs + reg); |
@@ -668,6 +691,11 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
668 | dp->ctrl = cpu_to_le32(ctrl); | 691 | dp->ctrl = cpu_to_le32(ctrl); |
669 | dp->addr = cpu_to_le32((u32) mapping + bp->rx_offset + bp->dma_offset); | 692 | dp->addr = cpu_to_le32((u32) mapping + bp->rx_offset + bp->dma_offset); |
670 | 693 | ||
694 | if (bp->flags & B44_FLAG_RX_RING_HACK) | ||
695 | b44_sync_dma_desc_for_device(bp->pdev, bp->rx_ring_dma, | ||
696 | dest_idx * sizeof(dp), | ||
697 | DMA_BIDIRECTIONAL); | ||
698 | |||
671 | return RX_PKT_BUF_SZ; | 699 | return RX_PKT_BUF_SZ; |
672 | } | 700 | } |
673 | 701 | ||
@@ -692,6 +720,11 @@ static void b44_recycle_rx(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
692 | pci_unmap_addr_set(dest_map, mapping, | 720 | pci_unmap_addr_set(dest_map, mapping, |
693 | pci_unmap_addr(src_map, mapping)); | 721 | pci_unmap_addr(src_map, mapping)); |
694 | 722 | ||
723 | if (bp->flags & B44_FLAG_RX_RING_HACK) | ||
724 | b44_sync_dma_desc_for_cpu(bp->pdev, bp->rx_ring_dma, | ||
725 | src_idx * sizeof(src_desc), | ||
726 | DMA_BIDIRECTIONAL); | ||
727 | |||
695 | ctrl = src_desc->ctrl; | 728 | ctrl = src_desc->ctrl; |
696 | if (dest_idx == (B44_RX_RING_SIZE - 1)) | 729 | if (dest_idx == (B44_RX_RING_SIZE - 1)) |
697 | ctrl |= cpu_to_le32(DESC_CTRL_EOT); | 730 | ctrl |= cpu_to_le32(DESC_CTRL_EOT); |
@@ -700,8 +733,14 @@ static void b44_recycle_rx(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
700 | 733 | ||
701 | dest_desc->ctrl = ctrl; | 734 | dest_desc->ctrl = ctrl; |
702 | dest_desc->addr = src_desc->addr; | 735 | dest_desc->addr = src_desc->addr; |
736 | |||
703 | src_map->skb = NULL; | 737 | src_map->skb = NULL; |
704 | 738 | ||
739 | if (bp->flags & B44_FLAG_RX_RING_HACK) | ||
740 | b44_sync_dma_desc_for_device(bp->pdev, bp->rx_ring_dma, | ||
741 | dest_idx * sizeof(dest_desc), | ||
742 | DMA_BIDIRECTIONAL); | ||
743 | |||
705 | pci_dma_sync_single_for_device(bp->pdev, src_desc->addr, | 744 | pci_dma_sync_single_for_device(bp->pdev, src_desc->addr, |
706 | RX_PKT_BUF_SZ, | 745 | RX_PKT_BUF_SZ, |
707 | PCI_DMA_FROMDEVICE); | 746 | PCI_DMA_FROMDEVICE); |
@@ -959,6 +998,11 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
959 | bp->tx_ring[entry].ctrl = cpu_to_le32(ctrl); | 998 | bp->tx_ring[entry].ctrl = cpu_to_le32(ctrl); |
960 | bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping+bp->dma_offset); | 999 | bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping+bp->dma_offset); |
961 | 1000 | ||
1001 | if (bp->flags & B44_FLAG_TX_RING_HACK) | ||
1002 | b44_sync_dma_desc_for_device(bp->pdev, bp->tx_ring_dma, | ||
1003 | entry * sizeof(bp->tx_ring[0]), | ||
1004 | DMA_TO_DEVICE); | ||
1005 | |||
962 | entry = NEXT_TX(entry); | 1006 | entry = NEXT_TX(entry); |
963 | 1007 | ||
964 | bp->tx_prod = entry; | 1008 | bp->tx_prod = entry; |
@@ -1064,6 +1108,16 @@ static void b44_init_rings(struct b44 *bp) | |||
1064 | memset(bp->rx_ring, 0, B44_RX_RING_BYTES); | 1108 | memset(bp->rx_ring, 0, B44_RX_RING_BYTES); |
1065 | memset(bp->tx_ring, 0, B44_TX_RING_BYTES); | 1109 | memset(bp->tx_ring, 0, B44_TX_RING_BYTES); |
1066 | 1110 | ||
1111 | if (bp->flags & B44_FLAG_RX_RING_HACK) | ||
1112 | dma_sync_single_for_device(&bp->pdev->dev, bp->rx_ring_dma, | ||
1113 | DMA_TABLE_BYTES, | ||
1114 | PCI_DMA_BIDIRECTIONAL); | ||
1115 | |||
1116 | if (bp->flags & B44_FLAG_TX_RING_HACK) | ||
1117 | dma_sync_single_for_device(&bp->pdev->dev, bp->tx_ring_dma, | ||
1118 | DMA_TABLE_BYTES, | ||
1119 | PCI_DMA_TODEVICE); | ||
1120 | |||
1067 | for (i = 0; i < bp->rx_pending; i++) { | 1121 | for (i = 0; i < bp->rx_pending; i++) { |
1068 | if (b44_alloc_rx_skb(bp, -1, i) < 0) | 1122 | if (b44_alloc_rx_skb(bp, -1, i) < 0) |
1069 | break; | 1123 | break; |
@@ -1085,14 +1139,28 @@ static void b44_free_consistent(struct b44 *bp) | |||
1085 | bp->tx_buffers = NULL; | 1139 | bp->tx_buffers = NULL; |
1086 | } | 1140 | } |
1087 | if (bp->rx_ring) { | 1141 | if (bp->rx_ring) { |
1088 | pci_free_consistent(bp->pdev, DMA_TABLE_BYTES, | 1142 | if (bp->flags & B44_FLAG_RX_RING_HACK) { |
1089 | bp->rx_ring, bp->rx_ring_dma); | 1143 | dma_unmap_single(&bp->pdev->dev, bp->rx_ring_dma, |
1144 | DMA_TABLE_BYTES, | ||
1145 | DMA_BIDIRECTIONAL); | ||
1146 | kfree(bp->rx_ring); | ||
1147 | } else | ||
1148 | pci_free_consistent(bp->pdev, DMA_TABLE_BYTES, | ||
1149 | bp->rx_ring, bp->rx_ring_dma); | ||
1090 | bp->rx_ring = NULL; | 1150 | bp->rx_ring = NULL; |
1151 | bp->flags &= ~B44_FLAG_RX_RING_HACK; | ||
1091 | } | 1152 | } |
1092 | if (bp->tx_ring) { | 1153 | if (bp->tx_ring) { |
1093 | pci_free_consistent(bp->pdev, DMA_TABLE_BYTES, | 1154 | if (bp->flags & B44_FLAG_TX_RING_HACK) { |
1094 | bp->tx_ring, bp->tx_ring_dma); | 1155 | dma_unmap_single(&bp->pdev->dev, bp->tx_ring_dma, |
1156 | DMA_TABLE_BYTES, | ||
1157 | DMA_TO_DEVICE); | ||
1158 | kfree(bp->tx_ring); | ||
1159 | } else | ||
1160 | pci_free_consistent(bp->pdev, DMA_TABLE_BYTES, | ||
1161 | bp->tx_ring, bp->tx_ring_dma); | ||
1095 | bp->tx_ring = NULL; | 1162 | bp->tx_ring = NULL; |
1163 | bp->flags &= ~B44_FLAG_TX_RING_HACK; | ||
1096 | } | 1164 | } |
1097 | } | 1165 | } |
1098 | 1166 | ||
@@ -1118,12 +1186,56 @@ static int b44_alloc_consistent(struct b44 *bp) | |||
1118 | 1186 | ||
1119 | size = DMA_TABLE_BYTES; | 1187 | size = DMA_TABLE_BYTES; |
1120 | bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma); | 1188 | bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma); |
1121 | if (!bp->rx_ring) | 1189 | if (!bp->rx_ring) { |
1122 | goto out_err; | 1190 | /* Allocation may have failed due to pci_alloc_consistent |
1191 | insisting on use of GFP_DMA, which is more restrictive | ||
1192 | than necessary... */ | ||
1193 | struct dma_desc *rx_ring; | ||
1194 | dma_addr_t rx_ring_dma; | ||
1195 | |||
1196 | if (!(rx_ring = (struct dma_desc *)kmalloc(size, GFP_KERNEL))) | ||
1197 | goto out_err; | ||
1198 | |||
1199 | memset(rx_ring, 0, size); | ||
1200 | rx_ring_dma = dma_map_single(&bp->pdev->dev, rx_ring, | ||
1201 | DMA_TABLE_BYTES, | ||
1202 | DMA_BIDIRECTIONAL); | ||
1203 | |||
1204 | if (rx_ring_dma + size > B44_DMA_MASK) { | ||
1205 | kfree(rx_ring); | ||
1206 | goto out_err; | ||
1207 | } | ||
1208 | |||
1209 | bp->rx_ring = rx_ring; | ||
1210 | bp->rx_ring_dma = rx_ring_dma; | ||
1211 | bp->flags |= B44_FLAG_RX_RING_HACK; | ||
1212 | } | ||
1123 | 1213 | ||
1124 | bp->tx_ring = pci_alloc_consistent(bp->pdev, size, &bp->tx_ring_dma); | 1214 | bp->tx_ring = pci_alloc_consistent(bp->pdev, size, &bp->tx_ring_dma); |
1125 | if (!bp->tx_ring) | 1215 | if (!bp->tx_ring) { |
1126 | goto out_err; | 1216 | /* Allocation may have failed due to pci_alloc_consistent |
1217 | insisting on use of GFP_DMA, which is more restrictive | ||
1218 | than necessary... */ | ||
1219 | struct dma_desc *tx_ring; | ||
1220 | dma_addr_t tx_ring_dma; | ||
1221 | |||
1222 | if (!(tx_ring = (struct dma_desc *)kmalloc(size, GFP_KERNEL))) | ||
1223 | goto out_err; | ||
1224 | |||
1225 | memset(tx_ring, 0, size); | ||
1226 | tx_ring_dma = dma_map_single(&bp->pdev->dev, tx_ring, | ||
1227 | DMA_TABLE_BYTES, | ||
1228 | DMA_TO_DEVICE); | ||
1229 | |||
1230 | if (tx_ring_dma + size > B44_DMA_MASK) { | ||
1231 | kfree(tx_ring); | ||
1232 | goto out_err; | ||
1233 | } | ||
1234 | |||
1235 | bp->tx_ring = tx_ring; | ||
1236 | bp->tx_ring_dma = tx_ring_dma; | ||
1237 | bp->flags |= B44_FLAG_TX_RING_HACK; | ||
1238 | } | ||
1127 | 1239 | ||
1128 | return 0; | 1240 | return 0; |
1129 | 1241 | ||
@@ -1676,6 +1788,7 @@ static struct ethtool_ops b44_ethtool_ops = { | |||
1676 | .set_pauseparam = b44_set_pauseparam, | 1788 | .set_pauseparam = b44_set_pauseparam, |
1677 | .get_msglevel = b44_get_msglevel, | 1789 | .get_msglevel = b44_get_msglevel, |
1678 | .set_msglevel = b44_set_msglevel, | 1790 | .set_msglevel = b44_set_msglevel, |
1791 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
1679 | }; | 1792 | }; |
1680 | 1793 | ||
1681 | static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 1794 | static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
@@ -1718,6 +1831,7 @@ static int __devinit b44_get_invariants(struct b44 *bp) | |||
1718 | bp->dev->dev_addr[3] = eeprom[80]; | 1831 | bp->dev->dev_addr[3] = eeprom[80]; |
1719 | bp->dev->dev_addr[4] = eeprom[83]; | 1832 | bp->dev->dev_addr[4] = eeprom[83]; |
1720 | bp->dev->dev_addr[5] = eeprom[82]; | 1833 | bp->dev->dev_addr[5] = eeprom[82]; |
1834 | memcpy(bp->dev->perm_addr, bp->dev->dev_addr, bp->dev->addr_len); | ||
1721 | 1835 | ||
1722 | bp->phy_addr = eeprom[90] & 0x1f; | 1836 | bp->phy_addr = eeprom[90] & 0x1f; |
1723 | 1837 | ||
@@ -1971,6 +2085,12 @@ static struct pci_driver b44_driver = { | |||
1971 | 2085 | ||
1972 | static int __init b44_init(void) | 2086 | static int __init b44_init(void) |
1973 | { | 2087 | { |
2088 | unsigned int dma_desc_align_size = dma_get_cache_alignment(); | ||
2089 | |||
2090 | /* Setup paramaters for syncing RX/TX DMA descriptors */ | ||
2091 | dma_desc_align_mask = ~(dma_desc_align_size - 1); | ||
2092 | dma_desc_sync_size = max(dma_desc_align_size, sizeof(struct dma_desc)); | ||
2093 | |||
1974 | return pci_module_init(&b44_driver); | 2094 | return pci_module_init(&b44_driver); |
1975 | } | 2095 | } |
1976 | 2096 | ||
diff --git a/drivers/net/b44.h b/drivers/net/b44.h index 11c40a2e71c7..593cb0ad4100 100644 --- a/drivers/net/b44.h +++ b/drivers/net/b44.h | |||
@@ -400,6 +400,8 @@ struct b44 { | |||
400 | #define B44_FLAG_ADV_100HALF 0x04000000 | 400 | #define B44_FLAG_ADV_100HALF 0x04000000 |
401 | #define B44_FLAG_ADV_100FULL 0x08000000 | 401 | #define B44_FLAG_ADV_100FULL 0x08000000 |
402 | #define B44_FLAG_INTERNAL_PHY 0x10000000 | 402 | #define B44_FLAG_INTERNAL_PHY 0x10000000 |
403 | #define B44_FLAG_RX_RING_HACK 0x20000000 | ||
404 | #define B44_FLAG_TX_RING_HACK 0x40000000 | ||
403 | 405 | ||
404 | u32 rx_offset; | 406 | u32 rx_offset; |
405 | 407 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index f264ff162979..8032126fd589 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -4241,6 +4241,43 @@ out: | |||
4241 | return 0; | 4241 | return 0; |
4242 | } | 4242 | } |
4243 | 4243 | ||
4244 | static void bond_activebackup_xmit_copy(struct sk_buff *skb, | ||
4245 | struct bonding *bond, | ||
4246 | struct slave *slave) | ||
4247 | { | ||
4248 | struct sk_buff *skb2 = skb_copy(skb, GFP_ATOMIC); | ||
4249 | struct ethhdr *eth_data; | ||
4250 | u8 *hwaddr; | ||
4251 | int res; | ||
4252 | |||
4253 | if (!skb2) { | ||
4254 | printk(KERN_ERR DRV_NAME ": Error: " | ||
4255 | "bond_activebackup_xmit_copy(): skb_copy() failed\n"); | ||
4256 | return; | ||
4257 | } | ||
4258 | |||
4259 | skb2->mac.raw = (unsigned char *)skb2->data; | ||
4260 | eth_data = eth_hdr(skb2); | ||
4261 | |||
4262 | /* Pick an appropriate source MAC address | ||
4263 | * -- use slave's perm MAC addr, unless used by bond | ||
4264 | * -- otherwise, borrow active slave's perm MAC addr | ||
4265 | * since that will not be used | ||
4266 | */ | ||
4267 | hwaddr = slave->perm_hwaddr; | ||
4268 | if (!memcmp(eth_data->h_source, hwaddr, ETH_ALEN)) | ||
4269 | hwaddr = bond->curr_active_slave->perm_hwaddr; | ||
4270 | |||
4271 | /* Set source MAC address appropriately */ | ||
4272 | memcpy(eth_data->h_source, hwaddr, ETH_ALEN); | ||
4273 | |||
4274 | res = bond_dev_queue_xmit(bond, skb2, slave->dev); | ||
4275 | if (res) | ||
4276 | dev_kfree_skb(skb2); | ||
4277 | |||
4278 | return; | ||
4279 | } | ||
4280 | |||
4244 | /* | 4281 | /* |
4245 | * in active-backup mode, we know that bond->curr_active_slave is always valid if | 4282 | * in active-backup mode, we know that bond->curr_active_slave is always valid if |
4246 | * the bond has a usable interface. | 4283 | * the bond has a usable interface. |
@@ -4257,10 +4294,26 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d | |||
4257 | goto out; | 4294 | goto out; |
4258 | } | 4295 | } |
4259 | 4296 | ||
4260 | if (bond->curr_active_slave) { /* one usable interface */ | 4297 | if (!bond->curr_active_slave) |
4261 | res = bond_dev_queue_xmit(bond, skb, bond->curr_active_slave->dev); | 4298 | goto out; |
4299 | |||
4300 | /* Xmit IGMP frames on all slaves to ensure rapid fail-over | ||
4301 | for multicast traffic on snooping switches */ | ||
4302 | if (skb->protocol == __constant_htons(ETH_P_IP) && | ||
4303 | skb->nh.iph->protocol == IPPROTO_IGMP) { | ||
4304 | struct slave *slave, *active_slave; | ||
4305 | int i; | ||
4306 | |||
4307 | active_slave = bond->curr_active_slave; | ||
4308 | bond_for_each_slave_from_to(bond, slave, i, active_slave->next, | ||
4309 | active_slave->prev) | ||
4310 | if (IS_UP(slave->dev) && | ||
4311 | (slave->link == BOND_LINK_UP)) | ||
4312 | bond_activebackup_xmit_copy(skb, bond, slave); | ||
4262 | } | 4313 | } |
4263 | 4314 | ||
4315 | res = bond_dev_queue_xmit(bond, skb, bond->curr_active_slave->dev); | ||
4316 | |||
4264 | out: | 4317 | out: |
4265 | if (res) { | 4318 | if (res) { |
4266 | /* no suitable interface, frame not sent */ | 4319 | /* no suitable interface, frame not sent */ |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 2e617424d3fb..50f43dbf31ae 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -489,7 +489,7 @@ static int cas_page_free(struct cas *cp, cas_page_t *page) | |||
489 | /* local page allocation routines for the receive buffers. jumbo pages | 489 | /* local page allocation routines for the receive buffers. jumbo pages |
490 | * require at least 8K contiguous and 8K aligned buffers. | 490 | * require at least 8K contiguous and 8K aligned buffers. |
491 | */ | 491 | */ |
492 | static cas_page_t *cas_page_alloc(struct cas *cp, const int flags) | 492 | static cas_page_t *cas_page_alloc(struct cas *cp, const gfp_t flags) |
493 | { | 493 | { |
494 | cas_page_t *page; | 494 | cas_page_t *page; |
495 | 495 | ||
@@ -561,7 +561,7 @@ static void cas_spare_free(struct cas *cp) | |||
561 | } | 561 | } |
562 | 562 | ||
563 | /* replenish spares if needed */ | 563 | /* replenish spares if needed */ |
564 | static void cas_spare_recover(struct cas *cp, const int flags) | 564 | static void cas_spare_recover(struct cas *cp, const gfp_t flags) |
565 | { | 565 | { |
566 | struct list_head list, *elem, *tmp; | 566 | struct list_head list, *elem, *tmp; |
567 | int needed, i; | 567 | int needed, i; |
diff --git a/drivers/net/declance.c b/drivers/net/declance.c index 521c83137bf6..f130bdab3fd3 100644 --- a/drivers/net/declance.c +++ b/drivers/net/declance.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * adopted from sunlance.c by Richard van den Berg | 6 | * adopted from sunlance.c by Richard van den Berg |
7 | * | 7 | * |
8 | * Copyright (C) 2002, 2003 Maciej W. Rozycki | 8 | * Copyright (C) 2002, 2003, 2005 Maciej W. Rozycki |
9 | * | 9 | * |
10 | * additional sources: | 10 | * additional sources: |
11 | * - PMAD-AA TURBOchannel Ethernet Module Functional Specification, | 11 | * - PMAD-AA TURBOchannel Ethernet Module Functional Specification, |
@@ -57,13 +57,15 @@ | |||
57 | #include <linux/string.h> | 57 | #include <linux/string.h> |
58 | 58 | ||
59 | #include <asm/addrspace.h> | 59 | #include <asm/addrspace.h> |
60 | #include <asm/system.h> | ||
61 | |||
60 | #include <asm/dec/interrupts.h> | 62 | #include <asm/dec/interrupts.h> |
61 | #include <asm/dec/ioasic.h> | 63 | #include <asm/dec/ioasic.h> |
62 | #include <asm/dec/ioasic_addrs.h> | 64 | #include <asm/dec/ioasic_addrs.h> |
63 | #include <asm/dec/kn01.h> | 65 | #include <asm/dec/kn01.h> |
64 | #include <asm/dec/machtype.h> | 66 | #include <asm/dec/machtype.h> |
67 | #include <asm/dec/system.h> | ||
65 | #include <asm/dec/tc.h> | 68 | #include <asm/dec/tc.h> |
66 | #include <asm/system.h> | ||
67 | 69 | ||
68 | static char version[] __devinitdata = | 70 | static char version[] __devinitdata = |
69 | "declance.c: v0.009 by Linux MIPS DECstation task force\n"; | 71 | "declance.c: v0.009 by Linux MIPS DECstation task force\n"; |
@@ -79,10 +81,6 @@ MODULE_LICENSE("GPL"); | |||
79 | #define PMAD_LANCE 2 | 81 | #define PMAD_LANCE 2 |
80 | #define PMAX_LANCE 3 | 82 | #define PMAX_LANCE 3 |
81 | 83 | ||
82 | #ifndef CONFIG_TC | ||
83 | unsigned long system_base; | ||
84 | unsigned long dmaptr; | ||
85 | #endif | ||
86 | 84 | ||
87 | #define LE_CSR0 0 | 85 | #define LE_CSR0 0 |
88 | #define LE_CSR1 1 | 86 | #define LE_CSR1 1 |
@@ -237,7 +235,7 @@ struct lance_init_block { | |||
237 | /* | 235 | /* |
238 | * This works *only* for the ring descriptors | 236 | * This works *only* for the ring descriptors |
239 | */ | 237 | */ |
240 | #define LANCE_ADDR(x) (PHYSADDR(x) >> 1) | 238 | #define LANCE_ADDR(x) (CPHYSADDR(x) >> 1) |
241 | 239 | ||
242 | struct lance_private { | 240 | struct lance_private { |
243 | struct net_device *next; | 241 | struct net_device *next; |
@@ -697,12 +695,13 @@ out: | |||
697 | spin_unlock(&lp->lock); | 695 | spin_unlock(&lp->lock); |
698 | } | 696 | } |
699 | 697 | ||
700 | static void lance_dma_merr_int(const int irq, void *dev_id, | 698 | static irqreturn_t lance_dma_merr_int(const int irq, void *dev_id, |
701 | struct pt_regs *regs) | 699 | struct pt_regs *regs) |
702 | { | 700 | { |
703 | struct net_device *dev = (struct net_device *) dev_id; | 701 | struct net_device *dev = (struct net_device *) dev_id; |
704 | 702 | ||
705 | printk("%s: DMA error\n", dev->name); | 703 | printk("%s: DMA error\n", dev->name); |
704 | return IRQ_HANDLED; | ||
706 | } | 705 | } |
707 | 706 | ||
708 | static irqreturn_t | 707 | static irqreturn_t |
@@ -1026,10 +1025,6 @@ static int __init dec_lance_init(const int type, const int slot) | |||
1026 | unsigned long esar_base; | 1025 | unsigned long esar_base; |
1027 | unsigned char *esar; | 1026 | unsigned char *esar; |
1028 | 1027 | ||
1029 | #ifndef CONFIG_TC | ||
1030 | system_base = KN01_LANCE_BASE; | ||
1031 | #endif | ||
1032 | |||
1033 | if (dec_lance_debug && version_printed++ == 0) | 1028 | if (dec_lance_debug && version_printed++ == 0) |
1034 | printk(version); | 1029 | printk(version); |
1035 | 1030 | ||
@@ -1062,16 +1057,16 @@ static int __init dec_lance_init(const int type, const int slot) | |||
1062 | switch (type) { | 1057 | switch (type) { |
1063 | #ifdef CONFIG_TC | 1058 | #ifdef CONFIG_TC |
1064 | case ASIC_LANCE: | 1059 | case ASIC_LANCE: |
1065 | dev->base_addr = system_base + IOASIC_LANCE; | 1060 | dev->base_addr = CKSEG1ADDR(dec_kn_slot_base + IOASIC_LANCE); |
1066 | 1061 | ||
1067 | /* buffer space for the on-board LANCE shared memory */ | 1062 | /* buffer space for the on-board LANCE shared memory */ |
1068 | /* | 1063 | /* |
1069 | * FIXME: ugly hack! | 1064 | * FIXME: ugly hack! |
1070 | */ | 1065 | */ |
1071 | dev->mem_start = KSEG1ADDR(0x00020000); | 1066 | dev->mem_start = CKSEG1ADDR(0x00020000); |
1072 | dev->mem_end = dev->mem_start + 0x00020000; | 1067 | dev->mem_end = dev->mem_start + 0x00020000; |
1073 | dev->irq = dec_interrupt[DEC_IRQ_LANCE]; | 1068 | dev->irq = dec_interrupt[DEC_IRQ_LANCE]; |
1074 | esar_base = system_base + IOASIC_ESAR; | 1069 | esar_base = CKSEG1ADDR(dec_kn_slot_base + IOASIC_ESAR); |
1075 | 1070 | ||
1076 | /* Workaround crash with booting KN04 2.1k from Disk */ | 1071 | /* Workaround crash with booting KN04 2.1k from Disk */ |
1077 | memset((void *)dev->mem_start, 0, | 1072 | memset((void *)dev->mem_start, 0, |
@@ -1101,14 +1096,14 @@ static int __init dec_lance_init(const int type, const int slot) | |||
1101 | /* Setup I/O ASIC LANCE DMA. */ | 1096 | /* Setup I/O ASIC LANCE DMA. */ |
1102 | lp->dma_irq = dec_interrupt[DEC_IRQ_LANCE_MERR]; | 1097 | lp->dma_irq = dec_interrupt[DEC_IRQ_LANCE_MERR]; |
1103 | ioasic_write(IO_REG_LANCE_DMA_P, | 1098 | ioasic_write(IO_REG_LANCE_DMA_P, |
1104 | PHYSADDR(dev->mem_start) << 3); | 1099 | CPHYSADDR(dev->mem_start) << 3); |
1105 | 1100 | ||
1106 | break; | 1101 | break; |
1107 | 1102 | ||
1108 | case PMAD_LANCE: | 1103 | case PMAD_LANCE: |
1109 | claim_tc_card(slot); | 1104 | claim_tc_card(slot); |
1110 | 1105 | ||
1111 | dev->mem_start = get_tc_base_addr(slot); | 1106 | dev->mem_start = CKSEG1ADDR(get_tc_base_addr(slot)); |
1112 | dev->base_addr = dev->mem_start + 0x100000; | 1107 | dev->base_addr = dev->mem_start + 0x100000; |
1113 | dev->irq = get_tc_irq_nr(slot); | 1108 | dev->irq = get_tc_irq_nr(slot); |
1114 | esar_base = dev->mem_start + 0x1c0002; | 1109 | esar_base = dev->mem_start + 0x1c0002; |
@@ -1137,9 +1132,9 @@ static int __init dec_lance_init(const int type, const int slot) | |||
1137 | 1132 | ||
1138 | case PMAX_LANCE: | 1133 | case PMAX_LANCE: |
1139 | dev->irq = dec_interrupt[DEC_IRQ_LANCE]; | 1134 | dev->irq = dec_interrupt[DEC_IRQ_LANCE]; |
1140 | dev->base_addr = KN01_LANCE_BASE; | 1135 | dev->base_addr = CKSEG1ADDR(KN01_SLOT_BASE + KN01_LANCE); |
1141 | dev->mem_start = KN01_LANCE_BASE + 0x01000000; | 1136 | dev->mem_start = CKSEG1ADDR(KN01_SLOT_BASE + KN01_LANCE_MEM); |
1142 | esar_base = KN01_RTC_BASE + 1; | 1137 | esar_base = CKSEG1ADDR(KN01_SLOT_BASE + KN01_ESAR + 1); |
1143 | lp->dma_irq = -1; | 1138 | lp->dma_irq = -1; |
1144 | 1139 | ||
1145 | /* | 1140 | /* |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 40887f09b681..eb169a8e8773 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -2201,6 +2201,7 @@ static struct ethtool_ops e100_ethtool_ops = { | |||
2201 | .phys_id = e100_phys_id, | 2201 | .phys_id = e100_phys_id, |
2202 | .get_stats_count = e100_get_stats_count, | 2202 | .get_stats_count = e100_get_stats_count, |
2203 | .get_ethtool_stats = e100_get_ethtool_stats, | 2203 | .get_ethtool_stats = e100_get_ethtool_stats, |
2204 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
2204 | }; | 2205 | }; |
2205 | 2206 | ||
2206 | static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | 2207 | static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) |
@@ -2351,7 +2352,8 @@ static int __devinit e100_probe(struct pci_dev *pdev, | |||
2351 | e100_phy_init(nic); | 2352 | e100_phy_init(nic); |
2352 | 2353 | ||
2353 | memcpy(netdev->dev_addr, nic->eeprom, ETH_ALEN); | 2354 | memcpy(netdev->dev_addr, nic->eeprom, ETH_ALEN); |
2354 | if(!is_valid_ether_addr(netdev->dev_addr)) { | 2355 | memcpy(netdev->perm_addr, nic->eeprom, ETH_ALEN); |
2356 | if(!is_valid_ether_addr(netdev->perm_addr)) { | ||
2355 | DPRINTK(PROBE, ERR, "Invalid MAC address from " | 2357 | DPRINTK(PROBE, ERR, "Invalid MAC address from " |
2356 | "EEPROM, aborting.\n"); | 2358 | "EEPROM, aborting.\n"); |
2357 | err = -EAGAIN; | 2359 | err = -EAGAIN; |
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index 092757bc721f..3f653a93e1bc 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h | |||
@@ -72,6 +72,10 @@ | |||
72 | #include <linux/mii.h> | 72 | #include <linux/mii.h> |
73 | #include <linux/ethtool.h> | 73 | #include <linux/ethtool.h> |
74 | #include <linux/if_vlan.h> | 74 | #include <linux/if_vlan.h> |
75 | #ifdef CONFIG_E1000_MQ | ||
76 | #include <linux/cpu.h> | ||
77 | #include <linux/smp.h> | ||
78 | #endif | ||
75 | 79 | ||
76 | #define BAR_0 0 | 80 | #define BAR_0 0 |
77 | #define BAR_1 1 | 81 | #define BAR_1 1 |
@@ -165,10 +169,33 @@ struct e1000_buffer { | |||
165 | uint16_t next_to_watch; | 169 | uint16_t next_to_watch; |
166 | }; | 170 | }; |
167 | 171 | ||
168 | struct e1000_ps_page { struct page *ps_page[MAX_PS_BUFFERS]; }; | 172 | struct e1000_ps_page { struct page *ps_page[PS_PAGE_BUFFERS]; }; |
169 | struct e1000_ps_page_dma { uint64_t ps_page_dma[MAX_PS_BUFFERS]; }; | 173 | struct e1000_ps_page_dma { uint64_t ps_page_dma[PS_PAGE_BUFFERS]; }; |
174 | |||
175 | struct e1000_tx_ring { | ||
176 | /* pointer to the descriptor ring memory */ | ||
177 | void *desc; | ||
178 | /* physical address of the descriptor ring */ | ||
179 | dma_addr_t dma; | ||
180 | /* length of descriptor ring in bytes */ | ||
181 | unsigned int size; | ||
182 | /* number of descriptors in the ring */ | ||
183 | unsigned int count; | ||
184 | /* next descriptor to associate a buffer with */ | ||
185 | unsigned int next_to_use; | ||
186 | /* next descriptor to check for DD status bit */ | ||
187 | unsigned int next_to_clean; | ||
188 | /* array of buffer information structs */ | ||
189 | struct e1000_buffer *buffer_info; | ||
190 | |||
191 | struct e1000_buffer previous_buffer_info; | ||
192 | spinlock_t tx_lock; | ||
193 | uint16_t tdh; | ||
194 | uint16_t tdt; | ||
195 | uint64_t pkt; | ||
196 | }; | ||
170 | 197 | ||
171 | struct e1000_desc_ring { | 198 | struct e1000_rx_ring { |
172 | /* pointer to the descriptor ring memory */ | 199 | /* pointer to the descriptor ring memory */ |
173 | void *desc; | 200 | void *desc; |
174 | /* physical address of the descriptor ring */ | 201 | /* physical address of the descriptor ring */ |
@@ -186,6 +213,10 @@ struct e1000_desc_ring { | |||
186 | /* arrays of page information for packet split */ | 213 | /* arrays of page information for packet split */ |
187 | struct e1000_ps_page *ps_page; | 214 | struct e1000_ps_page *ps_page; |
188 | struct e1000_ps_page_dma *ps_page_dma; | 215 | struct e1000_ps_page_dma *ps_page_dma; |
216 | |||
217 | uint16_t rdh; | ||
218 | uint16_t rdt; | ||
219 | uint64_t pkt; | ||
189 | }; | 220 | }; |
190 | 221 | ||
191 | #define E1000_DESC_UNUSED(R) \ | 222 | #define E1000_DESC_UNUSED(R) \ |
@@ -227,9 +258,10 @@ struct e1000_adapter { | |||
227 | unsigned long led_status; | 258 | unsigned long led_status; |
228 | 259 | ||
229 | /* TX */ | 260 | /* TX */ |
230 | struct e1000_desc_ring tx_ring; | 261 | struct e1000_tx_ring *tx_ring; /* One per active queue */ |
231 | struct e1000_buffer previous_buffer_info; | 262 | #ifdef CONFIG_E1000_MQ |
232 | spinlock_t tx_lock; | 263 | struct e1000_tx_ring **cpu_tx_ring; /* per-cpu */ |
264 | #endif | ||
233 | uint32_t txd_cmd; | 265 | uint32_t txd_cmd; |
234 | uint32_t tx_int_delay; | 266 | uint32_t tx_int_delay; |
235 | uint32_t tx_abs_int_delay; | 267 | uint32_t tx_abs_int_delay; |
@@ -246,19 +278,33 @@ struct e1000_adapter { | |||
246 | 278 | ||
247 | /* RX */ | 279 | /* RX */ |
248 | #ifdef CONFIG_E1000_NAPI | 280 | #ifdef CONFIG_E1000_NAPI |
249 | boolean_t (*clean_rx) (struct e1000_adapter *adapter, int *work_done, | 281 | boolean_t (*clean_rx) (struct e1000_adapter *adapter, |
250 | int work_to_do); | 282 | struct e1000_rx_ring *rx_ring, |
283 | int *work_done, int work_to_do); | ||
251 | #else | 284 | #else |
252 | boolean_t (*clean_rx) (struct e1000_adapter *adapter); | 285 | boolean_t (*clean_rx) (struct e1000_adapter *adapter, |
286 | struct e1000_rx_ring *rx_ring); | ||
253 | #endif | 287 | #endif |
254 | void (*alloc_rx_buf) (struct e1000_adapter *adapter); | 288 | void (*alloc_rx_buf) (struct e1000_adapter *adapter, |
255 | struct e1000_desc_ring rx_ring; | 289 | struct e1000_rx_ring *rx_ring); |
290 | struct e1000_rx_ring *rx_ring; /* One per active queue */ | ||
291 | #ifdef CONFIG_E1000_NAPI | ||
292 | struct net_device *polling_netdev; /* One per active queue */ | ||
293 | #endif | ||
294 | #ifdef CONFIG_E1000_MQ | ||
295 | struct net_device **cpu_netdev; /* per-cpu */ | ||
296 | struct call_async_data_struct rx_sched_call_data; | ||
297 | int cpu_for_queue[4]; | ||
298 | #endif | ||
299 | int num_queues; | ||
300 | |||
256 | uint64_t hw_csum_err; | 301 | uint64_t hw_csum_err; |
257 | uint64_t hw_csum_good; | 302 | uint64_t hw_csum_good; |
303 | uint64_t rx_hdr_split; | ||
258 | uint32_t rx_int_delay; | 304 | uint32_t rx_int_delay; |
259 | uint32_t rx_abs_int_delay; | 305 | uint32_t rx_abs_int_delay; |
260 | boolean_t rx_csum; | 306 | boolean_t rx_csum; |
261 | boolean_t rx_ps; | 307 | unsigned int rx_ps_pages; |
262 | uint32_t gorcl; | 308 | uint32_t gorcl; |
263 | uint64_t gorcl_old; | 309 | uint64_t gorcl_old; |
264 | uint16_t rx_ps_bsize0; | 310 | uint16_t rx_ps_bsize0; |
@@ -278,8 +324,8 @@ struct e1000_adapter { | |||
278 | struct e1000_phy_stats phy_stats; | 324 | struct e1000_phy_stats phy_stats; |
279 | 325 | ||
280 | uint32_t test_icr; | 326 | uint32_t test_icr; |
281 | struct e1000_desc_ring test_tx_ring; | 327 | struct e1000_tx_ring test_tx_ring; |
282 | struct e1000_desc_ring test_rx_ring; | 328 | struct e1000_rx_ring test_rx_ring; |
283 | 329 | ||
284 | 330 | ||
285 | int msg_enable; | 331 | int msg_enable; |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index f133ff0b0b94..6b9acc7f94a3 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -39,10 +39,10 @@ extern int e1000_up(struct e1000_adapter *adapter); | |||
39 | extern void e1000_down(struct e1000_adapter *adapter); | 39 | extern void e1000_down(struct e1000_adapter *adapter); |
40 | extern void e1000_reset(struct e1000_adapter *adapter); | 40 | extern void e1000_reset(struct e1000_adapter *adapter); |
41 | extern int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx); | 41 | extern int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx); |
42 | extern int e1000_setup_rx_resources(struct e1000_adapter *adapter); | 42 | extern int e1000_setup_all_rx_resources(struct e1000_adapter *adapter); |
43 | extern int e1000_setup_tx_resources(struct e1000_adapter *adapter); | 43 | extern int e1000_setup_all_tx_resources(struct e1000_adapter *adapter); |
44 | extern void e1000_free_rx_resources(struct e1000_adapter *adapter); | 44 | extern void e1000_free_all_rx_resources(struct e1000_adapter *adapter); |
45 | extern void e1000_free_tx_resources(struct e1000_adapter *adapter); | 45 | extern void e1000_free_all_tx_resources(struct e1000_adapter *adapter); |
46 | extern void e1000_update_stats(struct e1000_adapter *adapter); | 46 | extern void e1000_update_stats(struct e1000_adapter *adapter); |
47 | 47 | ||
48 | struct e1000_stats { | 48 | struct e1000_stats { |
@@ -91,7 +91,8 @@ static const struct e1000_stats e1000_gstrings_stats[] = { | |||
91 | { "tx_flow_control_xoff", E1000_STAT(stats.xofftxc) }, | 91 | { "tx_flow_control_xoff", E1000_STAT(stats.xofftxc) }, |
92 | { "rx_long_byte_count", E1000_STAT(stats.gorcl) }, | 92 | { "rx_long_byte_count", E1000_STAT(stats.gorcl) }, |
93 | { "rx_csum_offload_good", E1000_STAT(hw_csum_good) }, | 93 | { "rx_csum_offload_good", E1000_STAT(hw_csum_good) }, |
94 | { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) } | 94 | { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) }, |
95 | { "rx_header_split", E1000_STAT(rx_hdr_split) }, | ||
95 | }; | 96 | }; |
96 | #define E1000_STATS_LEN \ | 97 | #define E1000_STATS_LEN \ |
97 | sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats) | 98 | sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats) |
@@ -546,8 +547,10 @@ e1000_set_eeprom(struct net_device *netdev, | |||
546 | ret_val = e1000_write_eeprom(hw, first_word, | 547 | ret_val = e1000_write_eeprom(hw, first_word, |
547 | last_word - first_word + 1, eeprom_buff); | 548 | last_word - first_word + 1, eeprom_buff); |
548 | 549 | ||
549 | /* Update the checksum over the first part of the EEPROM if needed */ | 550 | /* Update the checksum over the first part of the EEPROM if needed |
550 | if((ret_val == 0) && first_word <= EEPROM_CHECKSUM_REG) | 551 | * and flush shadow RAM for 82573 conrollers */ |
552 | if((ret_val == 0) && ((first_word <= EEPROM_CHECKSUM_REG) || | ||
553 | (hw->mac_type == e1000_82573))) | ||
551 | e1000_update_eeprom_checksum(hw); | 554 | e1000_update_eeprom_checksum(hw); |
552 | 555 | ||
553 | kfree(eeprom_buff); | 556 | kfree(eeprom_buff); |
@@ -576,8 +579,8 @@ e1000_get_ringparam(struct net_device *netdev, | |||
576 | { | 579 | { |
577 | struct e1000_adapter *adapter = netdev_priv(netdev); | 580 | struct e1000_adapter *adapter = netdev_priv(netdev); |
578 | e1000_mac_type mac_type = adapter->hw.mac_type; | 581 | e1000_mac_type mac_type = adapter->hw.mac_type; |
579 | struct e1000_desc_ring *txdr = &adapter->tx_ring; | 582 | struct e1000_tx_ring *txdr = adapter->tx_ring; |
580 | struct e1000_desc_ring *rxdr = &adapter->rx_ring; | 583 | struct e1000_rx_ring *rxdr = adapter->rx_ring; |
581 | 584 | ||
582 | ring->rx_max_pending = (mac_type < e1000_82544) ? E1000_MAX_RXD : | 585 | ring->rx_max_pending = (mac_type < e1000_82544) ? E1000_MAX_RXD : |
583 | E1000_MAX_82544_RXD; | 586 | E1000_MAX_82544_RXD; |
@@ -597,20 +600,40 @@ e1000_set_ringparam(struct net_device *netdev, | |||
597 | { | 600 | { |
598 | struct e1000_adapter *adapter = netdev_priv(netdev); | 601 | struct e1000_adapter *adapter = netdev_priv(netdev); |
599 | e1000_mac_type mac_type = adapter->hw.mac_type; | 602 | e1000_mac_type mac_type = adapter->hw.mac_type; |
600 | struct e1000_desc_ring *txdr = &adapter->tx_ring; | 603 | struct e1000_tx_ring *txdr, *tx_old, *tx_new; |
601 | struct e1000_desc_ring *rxdr = &adapter->rx_ring; | 604 | struct e1000_rx_ring *rxdr, *rx_old, *rx_new; |
602 | struct e1000_desc_ring tx_old, tx_new, rx_old, rx_new; | 605 | int i, err, tx_ring_size, rx_ring_size; |
603 | int err; | 606 | |
607 | tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_queues; | ||
608 | rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_queues; | ||
609 | |||
610 | if (netif_running(adapter->netdev)) | ||
611 | e1000_down(adapter); | ||
604 | 612 | ||
605 | tx_old = adapter->tx_ring; | 613 | tx_old = adapter->tx_ring; |
606 | rx_old = adapter->rx_ring; | 614 | rx_old = adapter->rx_ring; |
607 | 615 | ||
616 | adapter->tx_ring = kmalloc(tx_ring_size, GFP_KERNEL); | ||
617 | if (!adapter->tx_ring) { | ||
618 | err = -ENOMEM; | ||
619 | goto err_setup_rx; | ||
620 | } | ||
621 | memset(adapter->tx_ring, 0, tx_ring_size); | ||
622 | |||
623 | adapter->rx_ring = kmalloc(rx_ring_size, GFP_KERNEL); | ||
624 | if (!adapter->rx_ring) { | ||
625 | kfree(adapter->tx_ring); | ||
626 | err = -ENOMEM; | ||
627 | goto err_setup_rx; | ||
628 | } | ||
629 | memset(adapter->rx_ring, 0, rx_ring_size); | ||
630 | |||
631 | txdr = adapter->tx_ring; | ||
632 | rxdr = adapter->rx_ring; | ||
633 | |||
608 | if((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) | 634 | if((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) |
609 | return -EINVAL; | 635 | return -EINVAL; |
610 | 636 | ||
611 | if(netif_running(adapter->netdev)) | ||
612 | e1000_down(adapter); | ||
613 | |||
614 | rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD); | 637 | rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD); |
615 | rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ? | 638 | rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ? |
616 | E1000_MAX_RXD : E1000_MAX_82544_RXD)); | 639 | E1000_MAX_RXD : E1000_MAX_82544_RXD)); |
@@ -621,11 +644,16 @@ e1000_set_ringparam(struct net_device *netdev, | |||
621 | E1000_MAX_TXD : E1000_MAX_82544_TXD)); | 644 | E1000_MAX_TXD : E1000_MAX_82544_TXD)); |
622 | E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); | 645 | E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); |
623 | 646 | ||
647 | for (i = 0; i < adapter->num_queues; i++) { | ||
648 | txdr[i].count = txdr->count; | ||
649 | rxdr[i].count = rxdr->count; | ||
650 | } | ||
651 | |||
624 | if(netif_running(adapter->netdev)) { | 652 | if(netif_running(adapter->netdev)) { |
625 | /* Try to get new resources before deleting old */ | 653 | /* Try to get new resources before deleting old */ |
626 | if((err = e1000_setup_rx_resources(adapter))) | 654 | if ((err = e1000_setup_all_rx_resources(adapter))) |
627 | goto err_setup_rx; | 655 | goto err_setup_rx; |
628 | if((err = e1000_setup_tx_resources(adapter))) | 656 | if ((err = e1000_setup_all_tx_resources(adapter))) |
629 | goto err_setup_tx; | 657 | goto err_setup_tx; |
630 | 658 | ||
631 | /* save the new, restore the old in order to free it, | 659 | /* save the new, restore the old in order to free it, |
@@ -635,8 +663,10 @@ e1000_set_ringparam(struct net_device *netdev, | |||
635 | tx_new = adapter->tx_ring; | 663 | tx_new = adapter->tx_ring; |
636 | adapter->rx_ring = rx_old; | 664 | adapter->rx_ring = rx_old; |
637 | adapter->tx_ring = tx_old; | 665 | adapter->tx_ring = tx_old; |
638 | e1000_free_rx_resources(adapter); | 666 | e1000_free_all_rx_resources(adapter); |
639 | e1000_free_tx_resources(adapter); | 667 | e1000_free_all_tx_resources(adapter); |
668 | kfree(tx_old); | ||
669 | kfree(rx_old); | ||
640 | adapter->rx_ring = rx_new; | 670 | adapter->rx_ring = rx_new; |
641 | adapter->tx_ring = tx_new; | 671 | adapter->tx_ring = tx_new; |
642 | if((err = e1000_up(adapter))) | 672 | if((err = e1000_up(adapter))) |
@@ -645,7 +675,7 @@ e1000_set_ringparam(struct net_device *netdev, | |||
645 | 675 | ||
646 | return 0; | 676 | return 0; |
647 | err_setup_tx: | 677 | err_setup_tx: |
648 | e1000_free_rx_resources(adapter); | 678 | e1000_free_all_rx_resources(adapter); |
649 | err_setup_rx: | 679 | err_setup_rx: |
650 | adapter->rx_ring = rx_old; | 680 | adapter->rx_ring = rx_old; |
651 | adapter->tx_ring = tx_old; | 681 | adapter->tx_ring = tx_old; |
@@ -696,6 +726,11 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) | |||
696 | * Some bits that get toggled are ignored. | 726 | * Some bits that get toggled are ignored. |
697 | */ | 727 | */ |
698 | switch (adapter->hw.mac_type) { | 728 | switch (adapter->hw.mac_type) { |
729 | /* there are several bits on newer hardware that are r/w */ | ||
730 | case e1000_82571: | ||
731 | case e1000_82572: | ||
732 | toggle = 0x7FFFF3FF; | ||
733 | break; | ||
699 | case e1000_82573: | 734 | case e1000_82573: |
700 | toggle = 0x7FFFF033; | 735 | toggle = 0x7FFFF033; |
701 | break; | 736 | break; |
@@ -898,8 +933,8 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) | |||
898 | static void | 933 | static void |
899 | e1000_free_desc_rings(struct e1000_adapter *adapter) | 934 | e1000_free_desc_rings(struct e1000_adapter *adapter) |
900 | { | 935 | { |
901 | struct e1000_desc_ring *txdr = &adapter->test_tx_ring; | 936 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; |
902 | struct e1000_desc_ring *rxdr = &adapter->test_rx_ring; | 937 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; |
903 | struct pci_dev *pdev = adapter->pdev; | 938 | struct pci_dev *pdev = adapter->pdev; |
904 | int i; | 939 | int i; |
905 | 940 | ||
@@ -941,8 +976,8 @@ e1000_free_desc_rings(struct e1000_adapter *adapter) | |||
941 | static int | 976 | static int |
942 | e1000_setup_desc_rings(struct e1000_adapter *adapter) | 977 | e1000_setup_desc_rings(struct e1000_adapter *adapter) |
943 | { | 978 | { |
944 | struct e1000_desc_ring *txdr = &adapter->test_tx_ring; | 979 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; |
945 | struct e1000_desc_ring *rxdr = &adapter->test_rx_ring; | 980 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; |
946 | struct pci_dev *pdev = adapter->pdev; | 981 | struct pci_dev *pdev = adapter->pdev; |
947 | uint32_t rctl; | 982 | uint32_t rctl; |
948 | int size, i, ret_val; | 983 | int size, i, ret_val; |
@@ -1245,6 +1280,8 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter) | |||
1245 | case e1000_82541_rev_2: | 1280 | case e1000_82541_rev_2: |
1246 | case e1000_82547: | 1281 | case e1000_82547: |
1247 | case e1000_82547_rev_2: | 1282 | case e1000_82547_rev_2: |
1283 | case e1000_82571: | ||
1284 | case e1000_82572: | ||
1248 | case e1000_82573: | 1285 | case e1000_82573: |
1249 | return e1000_integrated_phy_loopback(adapter); | 1286 | return e1000_integrated_phy_loopback(adapter); |
1250 | break; | 1287 | break; |
@@ -1340,8 +1377,8 @@ e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) | |||
1340 | static int | 1377 | static int |
1341 | e1000_run_loopback_test(struct e1000_adapter *adapter) | 1378 | e1000_run_loopback_test(struct e1000_adapter *adapter) |
1342 | { | 1379 | { |
1343 | struct e1000_desc_ring *txdr = &adapter->test_tx_ring; | 1380 | struct e1000_tx_ring *txdr = &adapter->test_tx_ring; |
1344 | struct e1000_desc_ring *rxdr = &adapter->test_rx_ring; | 1381 | struct e1000_rx_ring *rxdr = &adapter->test_rx_ring; |
1345 | struct pci_dev *pdev = adapter->pdev; | 1382 | struct pci_dev *pdev = adapter->pdev; |
1346 | int i, j, k, l, lc, good_cnt, ret_val=0; | 1383 | int i, j, k, l, lc, good_cnt, ret_val=0; |
1347 | unsigned long time; | 1384 | unsigned long time; |
@@ -1509,6 +1546,7 @@ e1000_diag_test(struct net_device *netdev, | |||
1509 | data[2] = 0; | 1546 | data[2] = 0; |
1510 | data[3] = 0; | 1547 | data[3] = 0; |
1511 | } | 1548 | } |
1549 | msleep_interruptible(4 * 1000); | ||
1512 | } | 1550 | } |
1513 | 1551 | ||
1514 | static void | 1552 | static void |
@@ -1625,7 +1663,7 @@ e1000_phys_id(struct net_device *netdev, uint32_t data) | |||
1625 | if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) | 1663 | if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ)) |
1626 | data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); | 1664 | data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ); |
1627 | 1665 | ||
1628 | if(adapter->hw.mac_type < e1000_82573) { | 1666 | if(adapter->hw.mac_type < e1000_82571) { |
1629 | if(!adapter->blink_timer.function) { | 1667 | if(!adapter->blink_timer.function) { |
1630 | init_timer(&adapter->blink_timer); | 1668 | init_timer(&adapter->blink_timer); |
1631 | adapter->blink_timer.function = e1000_led_blink_callback; | 1669 | adapter->blink_timer.function = e1000_led_blink_callback; |
@@ -1739,6 +1777,7 @@ struct ethtool_ops e1000_ethtool_ops = { | |||
1739 | .phys_id = e1000_phys_id, | 1777 | .phys_id = e1000_phys_id, |
1740 | .get_stats_count = e1000_get_stats_count, | 1778 | .get_stats_count = e1000_get_stats_count, |
1741 | .get_ethtool_stats = e1000_get_ethtool_stats, | 1779 | .get_ethtool_stats = e1000_get_ethtool_stats, |
1780 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
1742 | }; | 1781 | }; |
1743 | 1782 | ||
1744 | void e1000_set_ethtool_ops(struct net_device *netdev) | 1783 | void e1000_set_ethtool_ops(struct net_device *netdev) |
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 045f5426ab9a..8fc876da43b4 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -83,14 +83,14 @@ uint16_t e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] = | |||
83 | 83 | ||
84 | static const | 84 | static const |
85 | uint16_t e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] = | 85 | uint16_t e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] = |
86 | { 8, 13, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, | 86 | { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21, |
87 | 22, 24, 27, 30, 32, 35, 37, 40, 42, 44, 47, 49, 51, 54, 56, 58, | 87 | 0, 0, 0, 3, 6, 10, 13, 16, 19, 23, 26, 29, 32, 35, 38, 41, |
88 | 32, 35, 38, 41, 44, 47, 50, 53, 55, 58, 61, 63, 66, 69, 71, 74, | 88 | 6, 10, 14, 18, 22, 26, 30, 33, 37, 41, 44, 48, 51, 54, 58, 61, |
89 | 43, 47, 51, 54, 58, 61, 64, 67, 71, 74, 77, 80, 82, 85, 88, 90, | 89 | 21, 26, 31, 35, 40, 44, 49, 53, 57, 61, 65, 68, 72, 75, 79, 82, |
90 | 57, 62, 66, 70, 74, 77, 81, 85, 88, 91, 94, 97, 100, 103, 106, 108, | 90 | 40, 45, 51, 56, 61, 66, 70, 75, 79, 83, 87, 91, 94, 98, 101, 104, |
91 | 73, 78, 82, 87, 91, 95, 98, 102, 105, 109, 112, 114, 117, 119, 122, 124, | 91 | 60, 66, 72, 77, 82, 87, 92, 96, 100, 104, 108, 111, 114, 117, 119, 121, |
92 | 91, 96, 101, 105, 109, 113, 116, 119, 122, 125, 127, 128, 128, 128, 128, 128, | 92 | 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124, |
93 | 108, 113, 117, 121, 124, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}; | 93 | 104, 109, 114, 118, 121, 124}; |
94 | 94 | ||
95 | 95 | ||
96 | /****************************************************************************** | 96 | /****************************************************************************** |
@@ -286,7 +286,6 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
286 | case E1000_DEV_ID_82546GB_FIBER: | 286 | case E1000_DEV_ID_82546GB_FIBER: |
287 | case E1000_DEV_ID_82546GB_SERDES: | 287 | case E1000_DEV_ID_82546GB_SERDES: |
288 | case E1000_DEV_ID_82546GB_PCIE: | 288 | case E1000_DEV_ID_82546GB_PCIE: |
289 | case E1000_DEV_ID_82546GB_QUAD_COPPER: | ||
290 | hw->mac_type = e1000_82546_rev_3; | 289 | hw->mac_type = e1000_82546_rev_3; |
291 | break; | 290 | break; |
292 | case E1000_DEV_ID_82541EI: | 291 | case E1000_DEV_ID_82541EI: |
@@ -305,8 +304,19 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
305 | case E1000_DEV_ID_82547GI: | 304 | case E1000_DEV_ID_82547GI: |
306 | hw->mac_type = e1000_82547_rev_2; | 305 | hw->mac_type = e1000_82547_rev_2; |
307 | break; | 306 | break; |
307 | case E1000_DEV_ID_82571EB_COPPER: | ||
308 | case E1000_DEV_ID_82571EB_FIBER: | ||
309 | case E1000_DEV_ID_82571EB_SERDES: | ||
310 | hw->mac_type = e1000_82571; | ||
311 | break; | ||
312 | case E1000_DEV_ID_82572EI_COPPER: | ||
313 | case E1000_DEV_ID_82572EI_FIBER: | ||
314 | case E1000_DEV_ID_82572EI_SERDES: | ||
315 | hw->mac_type = e1000_82572; | ||
316 | break; | ||
308 | case E1000_DEV_ID_82573E: | 317 | case E1000_DEV_ID_82573E: |
309 | case E1000_DEV_ID_82573E_IAMT: | 318 | case E1000_DEV_ID_82573E_IAMT: |
319 | case E1000_DEV_ID_82573L: | ||
310 | hw->mac_type = e1000_82573; | 320 | hw->mac_type = e1000_82573; |
311 | break; | 321 | break; |
312 | default: | 322 | default: |
@@ -315,6 +325,8 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
315 | } | 325 | } |
316 | 326 | ||
317 | switch(hw->mac_type) { | 327 | switch(hw->mac_type) { |
328 | case e1000_82571: | ||
329 | case e1000_82572: | ||
318 | case e1000_82573: | 330 | case e1000_82573: |
319 | hw->eeprom_semaphore_present = TRUE; | 331 | hw->eeprom_semaphore_present = TRUE; |
320 | /* fall through */ | 332 | /* fall through */ |
@@ -351,6 +363,8 @@ e1000_set_media_type(struct e1000_hw *hw) | |||
351 | switch (hw->device_id) { | 363 | switch (hw->device_id) { |
352 | case E1000_DEV_ID_82545GM_SERDES: | 364 | case E1000_DEV_ID_82545GM_SERDES: |
353 | case E1000_DEV_ID_82546GB_SERDES: | 365 | case E1000_DEV_ID_82546GB_SERDES: |
366 | case E1000_DEV_ID_82571EB_SERDES: | ||
367 | case E1000_DEV_ID_82572EI_SERDES: | ||
354 | hw->media_type = e1000_media_type_internal_serdes; | 368 | hw->media_type = e1000_media_type_internal_serdes; |
355 | break; | 369 | break; |
356 | default: | 370 | default: |
@@ -523,6 +537,8 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
523 | E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); | 537 | E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); |
524 | E1000_WRITE_FLUSH(hw); | 538 | E1000_WRITE_FLUSH(hw); |
525 | /* fall through */ | 539 | /* fall through */ |
540 | case e1000_82571: | ||
541 | case e1000_82572: | ||
526 | ret_val = e1000_get_auto_rd_done(hw); | 542 | ret_val = e1000_get_auto_rd_done(hw); |
527 | if(ret_val) | 543 | if(ret_val) |
528 | /* We don't want to continue accessing MAC registers. */ | 544 | /* We don't want to continue accessing MAC registers. */ |
@@ -683,6 +699,9 @@ e1000_init_hw(struct e1000_hw *hw) | |||
683 | switch (hw->mac_type) { | 699 | switch (hw->mac_type) { |
684 | default: | 700 | default: |
685 | break; | 701 | break; |
702 | case e1000_82571: | ||
703 | case e1000_82572: | ||
704 | ctrl |= (1 << 22); | ||
686 | case e1000_82573: | 705 | case e1000_82573: |
687 | ctrl |= E1000_TXDCTL_COUNT_DESC; | 706 | ctrl |= E1000_TXDCTL_COUNT_DESC; |
688 | break; | 707 | break; |
@@ -694,6 +713,26 @@ e1000_init_hw(struct e1000_hw *hw) | |||
694 | e1000_enable_tx_pkt_filtering(hw); | 713 | e1000_enable_tx_pkt_filtering(hw); |
695 | } | 714 | } |
696 | 715 | ||
716 | switch (hw->mac_type) { | ||
717 | default: | ||
718 | break; | ||
719 | case e1000_82571: | ||
720 | case e1000_82572: | ||
721 | ctrl = E1000_READ_REG(hw, TXDCTL1); | ||
722 | ctrl &= ~E1000_TXDCTL_WTHRESH; | ||
723 | ctrl |= E1000_TXDCTL_COUNT_DESC | E1000_TXDCTL_FULL_TX_DESC_WB; | ||
724 | ctrl |= (1 << 22); | ||
725 | E1000_WRITE_REG(hw, TXDCTL1, ctrl); | ||
726 | break; | ||
727 | } | ||
728 | |||
729 | |||
730 | |||
731 | if (hw->mac_type == e1000_82573) { | ||
732 | uint32_t gcr = E1000_READ_REG(hw, GCR); | ||
733 | gcr |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX; | ||
734 | E1000_WRITE_REG(hw, GCR, gcr); | ||
735 | } | ||
697 | 736 | ||
698 | /* Clear all of the statistics registers (clear on read). It is | 737 | /* Clear all of the statistics registers (clear on read). It is |
699 | * important that we do this after we have tried to establish link | 738 | * important that we do this after we have tried to establish link |
@@ -878,6 +917,14 @@ e1000_setup_fiber_serdes_link(struct e1000_hw *hw) | |||
878 | 917 | ||
879 | DEBUGFUNC("e1000_setup_fiber_serdes_link"); | 918 | DEBUGFUNC("e1000_setup_fiber_serdes_link"); |
880 | 919 | ||
920 | /* On 82571 and 82572 Fiber connections, SerDes loopback mode persists | ||
921 | * until explicitly turned off or a power cycle is performed. A read to | ||
922 | * the register does not indicate its status. Therefore, we ensure | ||
923 | * loopback mode is disabled during initialization. | ||
924 | */ | ||
925 | if (hw->mac_type == e1000_82571 || hw->mac_type == e1000_82572) | ||
926 | E1000_WRITE_REG(hw, SCTL, E1000_DISABLE_SERDES_LOOPBACK); | ||
927 | |||
881 | /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be | 928 | /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be |
882 | * set when the optics detect a signal. On older adapters, it will be | 929 | * set when the optics detect a signal. On older adapters, it will be |
883 | * cleared when there is a signal. This applies to fiber media only. | 930 | * cleared when there is a signal. This applies to fiber media only. |
@@ -2943,6 +2990,8 @@ e1000_phy_reset(struct e1000_hw *hw) | |||
2943 | 2990 | ||
2944 | switch (hw->mac_type) { | 2991 | switch (hw->mac_type) { |
2945 | case e1000_82541_rev_2: | 2992 | case e1000_82541_rev_2: |
2993 | case e1000_82571: | ||
2994 | case e1000_82572: | ||
2946 | ret_val = e1000_phy_hw_reset(hw); | 2995 | ret_val = e1000_phy_hw_reset(hw); |
2947 | if(ret_val) | 2996 | if(ret_val) |
2948 | return ret_val; | 2997 | return ret_val; |
@@ -2981,6 +3030,16 @@ e1000_detect_gig_phy(struct e1000_hw *hw) | |||
2981 | 3030 | ||
2982 | DEBUGFUNC("e1000_detect_gig_phy"); | 3031 | DEBUGFUNC("e1000_detect_gig_phy"); |
2983 | 3032 | ||
3033 | /* The 82571 firmware may still be configuring the PHY. In this | ||
3034 | * case, we cannot access the PHY until the configuration is done. So | ||
3035 | * we explicitly set the PHY values. */ | ||
3036 | if(hw->mac_type == e1000_82571 || | ||
3037 | hw->mac_type == e1000_82572) { | ||
3038 | hw->phy_id = IGP01E1000_I_PHY_ID; | ||
3039 | hw->phy_type = e1000_phy_igp_2; | ||
3040 | return E1000_SUCCESS; | ||
3041 | } | ||
3042 | |||
2984 | /* Read the PHY ID Registers to identify which PHY is onboard. */ | 3043 | /* Read the PHY ID Registers to identify which PHY is onboard. */ |
2985 | ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); | 3044 | ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); |
2986 | if(ret_val) | 3045 | if(ret_val) |
@@ -3334,6 +3393,21 @@ e1000_init_eeprom_params(struct e1000_hw *hw) | |||
3334 | eeprom->use_eerd = FALSE; | 3393 | eeprom->use_eerd = FALSE; |
3335 | eeprom->use_eewr = FALSE; | 3394 | eeprom->use_eewr = FALSE; |
3336 | break; | 3395 | break; |
3396 | case e1000_82571: | ||
3397 | case e1000_82572: | ||
3398 | eeprom->type = e1000_eeprom_spi; | ||
3399 | eeprom->opcode_bits = 8; | ||
3400 | eeprom->delay_usec = 1; | ||
3401 | if (eecd & E1000_EECD_ADDR_BITS) { | ||
3402 | eeprom->page_size = 32; | ||
3403 | eeprom->address_bits = 16; | ||
3404 | } else { | ||
3405 | eeprom->page_size = 8; | ||
3406 | eeprom->address_bits = 8; | ||
3407 | } | ||
3408 | eeprom->use_eerd = FALSE; | ||
3409 | eeprom->use_eewr = FALSE; | ||
3410 | break; | ||
3337 | case e1000_82573: | 3411 | case e1000_82573: |
3338 | eeprom->type = e1000_eeprom_spi; | 3412 | eeprom->type = e1000_eeprom_spi; |
3339 | eeprom->opcode_bits = 8; | 3413 | eeprom->opcode_bits = 8; |
@@ -3543,25 +3617,26 @@ e1000_acquire_eeprom(struct e1000_hw *hw) | |||
3543 | eecd = E1000_READ_REG(hw, EECD); | 3617 | eecd = E1000_READ_REG(hw, EECD); |
3544 | 3618 | ||
3545 | if (hw->mac_type != e1000_82573) { | 3619 | if (hw->mac_type != e1000_82573) { |
3546 | /* Request EEPROM Access */ | 3620 | /* Request EEPROM Access */ |
3547 | if(hw->mac_type > e1000_82544) { | 3621 | if(hw->mac_type > e1000_82544) { |
3548 | eecd |= E1000_EECD_REQ; | 3622 | eecd |= E1000_EECD_REQ; |
3549 | E1000_WRITE_REG(hw, EECD, eecd); | ||
3550 | eecd = E1000_READ_REG(hw, EECD); | ||
3551 | while((!(eecd & E1000_EECD_GNT)) && | ||
3552 | (i < E1000_EEPROM_GRANT_ATTEMPTS)) { | ||
3553 | i++; | ||
3554 | udelay(5); | ||
3555 | eecd = E1000_READ_REG(hw, EECD); | ||
3556 | } | ||
3557 | if(!(eecd & E1000_EECD_GNT)) { | ||
3558 | eecd &= ~E1000_EECD_REQ; | ||
3559 | E1000_WRITE_REG(hw, EECD, eecd); | 3623 | E1000_WRITE_REG(hw, EECD, eecd); |
3560 | DEBUGOUT("Could not acquire EEPROM grant\n"); | 3624 | eecd = E1000_READ_REG(hw, EECD); |
3561 | return -E1000_ERR_EEPROM; | 3625 | while((!(eecd & E1000_EECD_GNT)) && |
3626 | (i < E1000_EEPROM_GRANT_ATTEMPTS)) { | ||
3627 | i++; | ||
3628 | udelay(5); | ||
3629 | eecd = E1000_READ_REG(hw, EECD); | ||
3630 | } | ||
3631 | if(!(eecd & E1000_EECD_GNT)) { | ||
3632 | eecd &= ~E1000_EECD_REQ; | ||
3633 | E1000_WRITE_REG(hw, EECD, eecd); | ||
3634 | DEBUGOUT("Could not acquire EEPROM grant\n"); | ||
3635 | e1000_put_hw_eeprom_semaphore(hw); | ||
3636 | return -E1000_ERR_EEPROM; | ||
3637 | } | ||
3562 | } | 3638 | } |
3563 | } | 3639 | } |
3564 | } | ||
3565 | 3640 | ||
3566 | /* Setup EEPROM for Read/Write */ | 3641 | /* Setup EEPROM for Read/Write */ |
3567 | 3642 | ||
@@ -4064,7 +4139,7 @@ e1000_write_eeprom(struct e1000_hw *hw, | |||
4064 | return -E1000_ERR_EEPROM; | 4139 | return -E1000_ERR_EEPROM; |
4065 | } | 4140 | } |
4066 | 4141 | ||
4067 | /* 82573 reads only through eerd */ | 4142 | /* 82573 writes only through eewr */ |
4068 | if(eeprom->use_eewr == TRUE) | 4143 | if(eeprom->use_eewr == TRUE) |
4069 | return e1000_write_eeprom_eewr(hw, offset, words, data); | 4144 | return e1000_write_eeprom_eewr(hw, offset, words, data); |
4070 | 4145 | ||
@@ -4353,9 +4428,16 @@ e1000_read_mac_addr(struct e1000_hw * hw) | |||
4353 | hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); | 4428 | hw->perm_mac_addr[i] = (uint8_t) (eeprom_data & 0x00FF); |
4354 | hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8); | 4429 | hw->perm_mac_addr[i+1] = (uint8_t) (eeprom_data >> 8); |
4355 | } | 4430 | } |
4356 | if(((hw->mac_type == e1000_82546) || (hw->mac_type == e1000_82546_rev_3)) && | 4431 | switch (hw->mac_type) { |
4357 | (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) | 4432 | default: |
4433 | break; | ||
4434 | case e1000_82546: | ||
4435 | case e1000_82546_rev_3: | ||
4436 | case e1000_82571: | ||
4437 | if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) | ||
4358 | hw->perm_mac_addr[5] ^= 0x01; | 4438 | hw->perm_mac_addr[5] ^= 0x01; |
4439 | break; | ||
4440 | } | ||
4359 | 4441 | ||
4360 | for(i = 0; i < NODE_ADDRESS_SIZE; i++) | 4442 | for(i = 0; i < NODE_ADDRESS_SIZE; i++) |
4361 | hw->mac_addr[i] = hw->perm_mac_addr[i]; | 4443 | hw->mac_addr[i] = hw->perm_mac_addr[i]; |
@@ -4385,6 +4467,12 @@ e1000_init_rx_addrs(struct e1000_hw *hw) | |||
4385 | e1000_rar_set(hw, hw->mac_addr, 0); | 4467 | e1000_rar_set(hw, hw->mac_addr, 0); |
4386 | 4468 | ||
4387 | rar_num = E1000_RAR_ENTRIES; | 4469 | rar_num = E1000_RAR_ENTRIES; |
4470 | |||
4471 | /* Reserve a spot for the Locally Administered Address to work around | ||
4472 | * an 82571 issue in which a reset on one port will reload the MAC on | ||
4473 | * the other port. */ | ||
4474 | if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE)) | ||
4475 | rar_num -= 1; | ||
4388 | /* Zero out the other 15 receive addresses. */ | 4476 | /* Zero out the other 15 receive addresses. */ |
4389 | DEBUGOUT("Clearing RAR[1-15]\n"); | 4477 | DEBUGOUT("Clearing RAR[1-15]\n"); |
4390 | for(i = 1; i < rar_num; i++) { | 4478 | for(i = 1; i < rar_num; i++) { |
@@ -4427,6 +4515,12 @@ e1000_mc_addr_list_update(struct e1000_hw *hw, | |||
4427 | /* Clear RAR[1-15] */ | 4515 | /* Clear RAR[1-15] */ |
4428 | DEBUGOUT(" Clearing RAR[1-15]\n"); | 4516 | DEBUGOUT(" Clearing RAR[1-15]\n"); |
4429 | num_rar_entry = E1000_RAR_ENTRIES; | 4517 | num_rar_entry = E1000_RAR_ENTRIES; |
4518 | /* Reserve a spot for the Locally Administered Address to work around | ||
4519 | * an 82571 issue in which a reset on one port will reload the MAC on | ||
4520 | * the other port. */ | ||
4521 | if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE)) | ||
4522 | num_rar_entry -= 1; | ||
4523 | |||
4430 | for(i = rar_used_count; i < num_rar_entry; i++) { | 4524 | for(i = rar_used_count; i < num_rar_entry; i++) { |
4431 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); | 4525 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); |
4432 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); | 4526 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); |
@@ -4984,7 +5078,6 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw) | |||
4984 | temp = E1000_READ_REG(hw, ICTXQEC); | 5078 | temp = E1000_READ_REG(hw, ICTXQEC); |
4985 | temp = E1000_READ_REG(hw, ICTXQMTC); | 5079 | temp = E1000_READ_REG(hw, ICTXQMTC); |
4986 | temp = E1000_READ_REG(hw, ICRXDMTC); | 5080 | temp = E1000_READ_REG(hw, ICRXDMTC); |
4987 | |||
4988 | } | 5081 | } |
4989 | 5082 | ||
4990 | /****************************************************************************** | 5083 | /****************************************************************************** |
@@ -5151,6 +5244,8 @@ e1000_get_bus_info(struct e1000_hw *hw) | |||
5151 | hw->bus_speed = e1000_bus_speed_unknown; | 5244 | hw->bus_speed = e1000_bus_speed_unknown; |
5152 | hw->bus_width = e1000_bus_width_unknown; | 5245 | hw->bus_width = e1000_bus_width_unknown; |
5153 | break; | 5246 | break; |
5247 | case e1000_82571: | ||
5248 | case e1000_82572: | ||
5154 | case e1000_82573: | 5249 | case e1000_82573: |
5155 | hw->bus_type = e1000_bus_type_pci_express; | 5250 | hw->bus_type = e1000_bus_type_pci_express; |
5156 | hw->bus_speed = e1000_bus_speed_2500; | 5251 | hw->bus_speed = e1000_bus_speed_2500; |
@@ -5250,6 +5345,7 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
5250 | int32_t ret_val; | 5345 | int32_t ret_val; |
5251 | uint16_t agc_value = 0; | 5346 | uint16_t agc_value = 0; |
5252 | uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE; | 5347 | uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE; |
5348 | uint16_t max_agc = 0; | ||
5253 | uint16_t i, phy_data; | 5349 | uint16_t i, phy_data; |
5254 | uint16_t cable_length; | 5350 | uint16_t cable_length; |
5255 | 5351 | ||
@@ -5338,6 +5434,40 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
5338 | IGP01E1000_AGC_RANGE) : 0; | 5434 | IGP01E1000_AGC_RANGE) : 0; |
5339 | *max_length = e1000_igp_cable_length_table[agc_value] + | 5435 | *max_length = e1000_igp_cable_length_table[agc_value] + |
5340 | IGP01E1000_AGC_RANGE; | 5436 | IGP01E1000_AGC_RANGE; |
5437 | } else if (hw->phy_type == e1000_phy_igp_2) { | ||
5438 | uint16_t agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] = | ||
5439 | {IGP02E1000_PHY_AGC_A, | ||
5440 | IGP02E1000_PHY_AGC_B, | ||
5441 | IGP02E1000_PHY_AGC_C, | ||
5442 | IGP02E1000_PHY_AGC_D}; | ||
5443 | /* Read the AGC registers for all channels */ | ||
5444 | for (i = 0; i < IGP02E1000_PHY_CHANNEL_NUM; i++) { | ||
5445 | ret_val = e1000_read_phy_reg(hw, agc_reg_array[i], &phy_data); | ||
5446 | if (ret_val) | ||
5447 | return ret_val; | ||
5448 | |||
5449 | /* Getting bits 15:9, which represent the combination of course and | ||
5450 | * fine gain values. The result is a number that can be put into | ||
5451 | * the lookup table to obtain the approximate cable length. */ | ||
5452 | cur_agc = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) & | ||
5453 | IGP02E1000_AGC_LENGTH_MASK; | ||
5454 | |||
5455 | /* Remove min & max AGC values from calculation. */ | ||
5456 | if (e1000_igp_2_cable_length_table[min_agc] > e1000_igp_2_cable_length_table[cur_agc]) | ||
5457 | min_agc = cur_agc; | ||
5458 | if (e1000_igp_2_cable_length_table[max_agc] < e1000_igp_2_cable_length_table[cur_agc]) | ||
5459 | max_agc = cur_agc; | ||
5460 | |||
5461 | agc_value += e1000_igp_2_cable_length_table[cur_agc]; | ||
5462 | } | ||
5463 | |||
5464 | agc_value -= (e1000_igp_2_cable_length_table[min_agc] + e1000_igp_2_cable_length_table[max_agc]); | ||
5465 | agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2); | ||
5466 | |||
5467 | /* Calculate cable length with the error range of +/- 10 meters. */ | ||
5468 | *min_length = ((agc_value - IGP02E1000_AGC_RANGE) > 0) ? | ||
5469 | (agc_value - IGP02E1000_AGC_RANGE) : 0; | ||
5470 | *max_length = agc_value + IGP02E1000_AGC_RANGE; | ||
5341 | } | 5471 | } |
5342 | 5472 | ||
5343 | return E1000_SUCCESS; | 5473 | return E1000_SUCCESS; |
@@ -6465,6 +6595,8 @@ e1000_get_auto_rd_done(struct e1000_hw *hw) | |||
6465 | default: | 6595 | default: |
6466 | msec_delay(5); | 6596 | msec_delay(5); |
6467 | break; | 6597 | break; |
6598 | case e1000_82571: | ||
6599 | case e1000_82572: | ||
6468 | case e1000_82573: | 6600 | case e1000_82573: |
6469 | while(timeout) { | 6601 | while(timeout) { |
6470 | if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) break; | 6602 | if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) break; |
@@ -6494,10 +6626,31 @@ e1000_get_auto_rd_done(struct e1000_hw *hw) | |||
6494 | int32_t | 6626 | int32_t |
6495 | e1000_get_phy_cfg_done(struct e1000_hw *hw) | 6627 | e1000_get_phy_cfg_done(struct e1000_hw *hw) |
6496 | { | 6628 | { |
6629 | int32_t timeout = PHY_CFG_TIMEOUT; | ||
6630 | uint32_t cfg_mask = E1000_EEPROM_CFG_DONE; | ||
6631 | |||
6497 | DEBUGFUNC("e1000_get_phy_cfg_done"); | 6632 | DEBUGFUNC("e1000_get_phy_cfg_done"); |
6498 | 6633 | ||
6499 | /* Simply wait for 10ms */ | 6634 | switch (hw->mac_type) { |
6500 | msec_delay(10); | 6635 | default: |
6636 | msec_delay(10); | ||
6637 | break; | ||
6638 | case e1000_82571: | ||
6639 | case e1000_82572: | ||
6640 | while (timeout) { | ||
6641 | if (E1000_READ_REG(hw, EEMNGCTL) & cfg_mask) | ||
6642 | break; | ||
6643 | else | ||
6644 | msec_delay(1); | ||
6645 | timeout--; | ||
6646 | } | ||
6647 | |||
6648 | if (!timeout) { | ||
6649 | DEBUGOUT("MNG configuration cycle has not completed.\n"); | ||
6650 | return -E1000_ERR_RESET; | ||
6651 | } | ||
6652 | break; | ||
6653 | } | ||
6501 | 6654 | ||
6502 | return E1000_SUCCESS; | 6655 | return E1000_SUCCESS; |
6503 | } | 6656 | } |
@@ -6569,8 +6722,7 @@ e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw) | |||
6569 | return; | 6722 | return; |
6570 | 6723 | ||
6571 | swsm = E1000_READ_REG(hw, SWSM); | 6724 | swsm = E1000_READ_REG(hw, SWSM); |
6572 | /* Release both semaphores. */ | 6725 | swsm &= ~(E1000_SWSM_SWESMBI); |
6573 | swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); | ||
6574 | E1000_WRITE_REG(hw, SWSM, swsm); | 6726 | E1000_WRITE_REG(hw, SWSM, swsm); |
6575 | } | 6727 | } |
6576 | 6728 | ||
@@ -6606,6 +6758,8 @@ e1000_arc_subsystem_valid(struct e1000_hw *hw) | |||
6606 | * if this is the case. We read FWSM to determine the manageability mode. | 6758 | * if this is the case. We read FWSM to determine the manageability mode. |
6607 | */ | 6759 | */ |
6608 | switch (hw->mac_type) { | 6760 | switch (hw->mac_type) { |
6761 | case e1000_82571: | ||
6762 | case e1000_82572: | ||
6609 | case e1000_82573: | 6763 | case e1000_82573: |
6610 | fwsm = E1000_READ_REG(hw, FWSM); | 6764 | fwsm = E1000_READ_REG(hw, FWSM); |
6611 | if((fwsm & E1000_FWSM_MODE_MASK) != 0) | 6765 | if((fwsm & E1000_FWSM_MODE_MASK) != 0) |
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index 51c2b3a18b6f..4f2c196dc314 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h | |||
@@ -57,6 +57,8 @@ typedef enum { | |||
57 | e1000_82541_rev_2, | 57 | e1000_82541_rev_2, |
58 | e1000_82547, | 58 | e1000_82547, |
59 | e1000_82547_rev_2, | 59 | e1000_82547_rev_2, |
60 | e1000_82571, | ||
61 | e1000_82572, | ||
60 | e1000_82573, | 62 | e1000_82573, |
61 | e1000_num_macs | 63 | e1000_num_macs |
62 | } e1000_mac_type; | 64 | } e1000_mac_type; |
@@ -478,10 +480,16 @@ uint8_t e1000_arc_subsystem_valid(struct e1000_hw *hw); | |||
478 | #define E1000_DEV_ID_82546GB_SERDES 0x107B | 480 | #define E1000_DEV_ID_82546GB_SERDES 0x107B |
479 | #define E1000_DEV_ID_82546GB_PCIE 0x108A | 481 | #define E1000_DEV_ID_82546GB_PCIE 0x108A |
480 | #define E1000_DEV_ID_82547EI 0x1019 | 482 | #define E1000_DEV_ID_82547EI 0x1019 |
483 | #define E1000_DEV_ID_82571EB_COPPER 0x105E | ||
484 | #define E1000_DEV_ID_82571EB_FIBER 0x105F | ||
485 | #define E1000_DEV_ID_82571EB_SERDES 0x1060 | ||
486 | #define E1000_DEV_ID_82572EI_COPPER 0x107D | ||
487 | #define E1000_DEV_ID_82572EI_FIBER 0x107E | ||
488 | #define E1000_DEV_ID_82572EI_SERDES 0x107F | ||
481 | #define E1000_DEV_ID_82573E 0x108B | 489 | #define E1000_DEV_ID_82573E 0x108B |
482 | #define E1000_DEV_ID_82573E_IAMT 0x108C | 490 | #define E1000_DEV_ID_82573E_IAMT 0x108C |
491 | #define E1000_DEV_ID_82573L 0x109A | ||
483 | 492 | ||
484 | #define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099 | ||
485 | 493 | ||
486 | #define NODE_ADDRESS_SIZE 6 | 494 | #define NODE_ADDRESS_SIZE 6 |
487 | #define ETH_LENGTH_OF_ADDRESS 6 | 495 | #define ETH_LENGTH_OF_ADDRESS 6 |
@@ -833,6 +841,8 @@ struct e1000_ffvt_entry { | |||
833 | #define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX | 841 | #define E1000_FFMT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX |
834 | #define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX | 842 | #define E1000_FFVT_SIZE E1000_FLEXIBLE_FILTER_SIZE_MAX |
835 | 843 | ||
844 | #define E1000_DISABLE_SERDES_LOOPBACK 0x0400 | ||
845 | |||
836 | /* Register Set. (82543, 82544) | 846 | /* Register Set. (82543, 82544) |
837 | * | 847 | * |
838 | * Registers are defined to be 32 bits and should be accessed as 32 bit values. | 848 | * Registers are defined to be 32 bits and should be accessed as 32 bit values. |
@@ -853,6 +863,7 @@ struct e1000_ffvt_entry { | |||
853 | #define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */ | 863 | #define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */ |
854 | #define E1000_FLA 0x0001C /* Flash Access - RW */ | 864 | #define E1000_FLA 0x0001C /* Flash Access - RW */ |
855 | #define E1000_MDIC 0x00020 /* MDI Control - RW */ | 865 | #define E1000_MDIC 0x00020 /* MDI Control - RW */ |
866 | #define E1000_SCTL 0x00024 /* SerDes Control - RW */ | ||
856 | #define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ | 867 | #define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ |
857 | #define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ | 868 | #define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ |
858 | #define E1000_FCT 0x00030 /* Flow Control Type - RW */ | 869 | #define E1000_FCT 0x00030 /* Flow Control Type - RW */ |
@@ -864,6 +875,12 @@ struct e1000_ffvt_entry { | |||
864 | #define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */ | 875 | #define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */ |
865 | #define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */ | 876 | #define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */ |
866 | #define E1000_RCTL 0x00100 /* RX Control - RW */ | 877 | #define E1000_RCTL 0x00100 /* RX Control - RW */ |
878 | #define E1000_RDTR1 0x02820 /* RX Delay Timer (1) - RW */ | ||
879 | #define E1000_RDBAL1 0x02900 /* RX Descriptor Base Address Low (1) - RW */ | ||
880 | #define E1000_RDBAH1 0x02904 /* RX Descriptor Base Address High (1) - RW */ | ||
881 | #define E1000_RDLEN1 0x02908 /* RX Descriptor Length (1) - RW */ | ||
882 | #define E1000_RDH1 0x02910 /* RX Descriptor Head (1) - RW */ | ||
883 | #define E1000_RDT1 0x02918 /* RX Descriptor Tail (1) - RW */ | ||
867 | #define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */ | 884 | #define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */ |
868 | #define E1000_TXCW 0x00178 /* TX Configuration Word - RW */ | 885 | #define E1000_TXCW 0x00178 /* TX Configuration Word - RW */ |
869 | #define E1000_RXCW 0x00180 /* RX Configuration Word - RO */ | 886 | #define E1000_RXCW 0x00180 /* RX Configuration Word - RO */ |
@@ -895,6 +912,12 @@ struct e1000_ffvt_entry { | |||
895 | #define E1000_RDH 0x02810 /* RX Descriptor Head - RW */ | 912 | #define E1000_RDH 0x02810 /* RX Descriptor Head - RW */ |
896 | #define E1000_RDT 0x02818 /* RX Descriptor Tail - RW */ | 913 | #define E1000_RDT 0x02818 /* RX Descriptor Tail - RW */ |
897 | #define E1000_RDTR 0x02820 /* RX Delay Timer - RW */ | 914 | #define E1000_RDTR 0x02820 /* RX Delay Timer - RW */ |
915 | #define E1000_RDBAL0 E1000_RDBAL /* RX Desc Base Address Low (0) - RW */ | ||
916 | #define E1000_RDBAH0 E1000_RDBAH /* RX Desc Base Address High (0) - RW */ | ||
917 | #define E1000_RDLEN0 E1000_RDLEN /* RX Desc Length (0) - RW */ | ||
918 | #define E1000_RDH0 E1000_RDH /* RX Desc Head (0) - RW */ | ||
919 | #define E1000_RDT0 E1000_RDT /* RX Desc Tail (0) - RW */ | ||
920 | #define E1000_RDTR0 E1000_RDTR /* RX Delay Timer (0) - RW */ | ||
898 | #define E1000_RXDCTL 0x02828 /* RX Descriptor Control - RW */ | 921 | #define E1000_RXDCTL 0x02828 /* RX Descriptor Control - RW */ |
899 | #define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */ | 922 | #define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */ |
900 | #define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */ | 923 | #define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */ |
@@ -980,15 +1003,15 @@ struct e1000_ffvt_entry { | |||
980 | #define E1000_BPTC 0x040F4 /* Broadcast Packets TX Count - R/clr */ | 1003 | #define E1000_BPTC 0x040F4 /* Broadcast Packets TX Count - R/clr */ |
981 | #define E1000_TSCTC 0x040F8 /* TCP Segmentation Context TX - R/clr */ | 1004 | #define E1000_TSCTC 0x040F8 /* TCP Segmentation Context TX - R/clr */ |
982 | #define E1000_TSCTFC 0x040FC /* TCP Segmentation Context TX Fail - R/clr */ | 1005 | #define E1000_TSCTFC 0x040FC /* TCP Segmentation Context TX Fail - R/clr */ |
983 | #define E1000_IAC 0x4100 /* Interrupt Assertion Count */ | 1006 | #define E1000_IAC 0x04100 /* Interrupt Assertion Count */ |
984 | #define E1000_ICRXPTC 0x4104 /* Interrupt Cause Rx Packet Timer Expire Count */ | 1007 | #define E1000_ICRXPTC 0x04104 /* Interrupt Cause Rx Packet Timer Expire Count */ |
985 | #define E1000_ICRXATC 0x4108 /* Interrupt Cause Rx Absolute Timer Expire Count */ | 1008 | #define E1000_ICRXATC 0x04108 /* Interrupt Cause Rx Absolute Timer Expire Count */ |
986 | #define E1000_ICTXPTC 0x410C /* Interrupt Cause Tx Packet Timer Expire Count */ | 1009 | #define E1000_ICTXPTC 0x0410C /* Interrupt Cause Tx Packet Timer Expire Count */ |
987 | #define E1000_ICTXATC 0x4110 /* Interrupt Cause Tx Absolute Timer Expire Count */ | 1010 | #define E1000_ICTXATC 0x04110 /* Interrupt Cause Tx Absolute Timer Expire Count */ |
988 | #define E1000_ICTXQEC 0x4118 /* Interrupt Cause Tx Queue Empty Count */ | 1011 | #define E1000_ICTXQEC 0x04118 /* Interrupt Cause Tx Queue Empty Count */ |
989 | #define E1000_ICTXQMTC 0x411C /* Interrupt Cause Tx Queue Minimum Threshold Count */ | 1012 | #define E1000_ICTXQMTC 0x0411C /* Interrupt Cause Tx Queue Minimum Threshold Count */ |
990 | #define E1000_ICRXDMTC 0x4120 /* Interrupt Cause Rx Descriptor Minimum Threshold Count */ | 1013 | #define E1000_ICRXDMTC 0x04120 /* Interrupt Cause Rx Descriptor Minimum Threshold Count */ |
991 | #define E1000_ICRXOC 0x4124 /* Interrupt Cause Receiver Overrun Count */ | 1014 | #define E1000_ICRXOC 0x04124 /* Interrupt Cause Receiver Overrun Count */ |
992 | #define E1000_RXCSUM 0x05000 /* RX Checksum Control - RW */ | 1015 | #define E1000_RXCSUM 0x05000 /* RX Checksum Control - RW */ |
993 | #define E1000_RFCTL 0x05008 /* Receive Filter Control*/ | 1016 | #define E1000_RFCTL 0x05008 /* Receive Filter Control*/ |
994 | #define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ | 1017 | #define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ |
@@ -1018,6 +1041,14 @@ struct e1000_ffvt_entry { | |||
1018 | #define E1000_FWSM 0x05B54 /* FW Semaphore */ | 1041 | #define E1000_FWSM 0x05B54 /* FW Semaphore */ |
1019 | #define E1000_FFLT_DBG 0x05F04 /* Debug Register */ | 1042 | #define E1000_FFLT_DBG 0x05F04 /* Debug Register */ |
1020 | #define E1000_HICR 0x08F00 /* Host Inteface Control */ | 1043 | #define E1000_HICR 0x08F00 /* Host Inteface Control */ |
1044 | |||
1045 | /* RSS registers */ | ||
1046 | #define E1000_CPUVEC 0x02C10 /* CPU Vector Register - RW */ | ||
1047 | #define E1000_MRQC 0x05818 /* Multiple Receive Control - RW */ | ||
1048 | #define E1000_RETA 0x05C00 /* Redirection Table - RW Array */ | ||
1049 | #define E1000_RSSRK 0x05C80 /* RSS Random Key - RW Array */ | ||
1050 | #define E1000_RSSIM 0x05864 /* RSS Interrupt Mask */ | ||
1051 | #define E1000_RSSIR 0x05868 /* RSS Interrupt Request */ | ||
1021 | /* Register Set (82542) | 1052 | /* Register Set (82542) |
1022 | * | 1053 | * |
1023 | * Some of the 82542 registers are located at different offsets than they are | 1054 | * Some of the 82542 registers are located at different offsets than they are |
@@ -1032,6 +1063,7 @@ struct e1000_ffvt_entry { | |||
1032 | #define E1000_82542_CTRL_EXT E1000_CTRL_EXT | 1063 | #define E1000_82542_CTRL_EXT E1000_CTRL_EXT |
1033 | #define E1000_82542_FLA E1000_FLA | 1064 | #define E1000_82542_FLA E1000_FLA |
1034 | #define E1000_82542_MDIC E1000_MDIC | 1065 | #define E1000_82542_MDIC E1000_MDIC |
1066 | #define E1000_82542_SCTL E1000_SCTL | ||
1035 | #define E1000_82542_FCAL E1000_FCAL | 1067 | #define E1000_82542_FCAL E1000_FCAL |
1036 | #define E1000_82542_FCAH E1000_FCAH | 1068 | #define E1000_82542_FCAH E1000_FCAH |
1037 | #define E1000_82542_FCT E1000_FCT | 1069 | #define E1000_82542_FCT E1000_FCT |
@@ -1049,6 +1081,18 @@ struct e1000_ffvt_entry { | |||
1049 | #define E1000_82542_RDLEN 0x00118 | 1081 | #define E1000_82542_RDLEN 0x00118 |
1050 | #define E1000_82542_RDH 0x00120 | 1082 | #define E1000_82542_RDH 0x00120 |
1051 | #define E1000_82542_RDT 0x00128 | 1083 | #define E1000_82542_RDT 0x00128 |
1084 | #define E1000_82542_RDTR0 E1000_82542_RDTR | ||
1085 | #define E1000_82542_RDBAL0 E1000_82542_RDBAL | ||
1086 | #define E1000_82542_RDBAH0 E1000_82542_RDBAH | ||
1087 | #define E1000_82542_RDLEN0 E1000_82542_RDLEN | ||
1088 | #define E1000_82542_RDH0 E1000_82542_RDH | ||
1089 | #define E1000_82542_RDT0 E1000_82542_RDT | ||
1090 | #define E1000_82542_RDTR1 0x00130 | ||
1091 | #define E1000_82542_RDBAL1 0x00138 | ||
1092 | #define E1000_82542_RDBAH1 0x0013C | ||
1093 | #define E1000_82542_RDLEN1 0x00140 | ||
1094 | #define E1000_82542_RDH1 0x00148 | ||
1095 | #define E1000_82542_RDT1 0x00150 | ||
1052 | #define E1000_82542_FCRTH 0x00160 | 1096 | #define E1000_82542_FCRTH 0x00160 |
1053 | #define E1000_82542_FCRTL 0x00168 | 1097 | #define E1000_82542_FCRTL 0x00168 |
1054 | #define E1000_82542_FCTTV E1000_FCTTV | 1098 | #define E1000_82542_FCTTV E1000_FCTTV |
@@ -1197,6 +1241,13 @@ struct e1000_ffvt_entry { | |||
1197 | #define E1000_82542_ICRXOC E1000_ICRXOC | 1241 | #define E1000_82542_ICRXOC E1000_ICRXOC |
1198 | #define E1000_82542_HICR E1000_HICR | 1242 | #define E1000_82542_HICR E1000_HICR |
1199 | 1243 | ||
1244 | #define E1000_82542_CPUVEC E1000_CPUVEC | ||
1245 | #define E1000_82542_MRQC E1000_MRQC | ||
1246 | #define E1000_82542_RETA E1000_RETA | ||
1247 | #define E1000_82542_RSSRK E1000_RSSRK | ||
1248 | #define E1000_82542_RSSIM E1000_RSSIM | ||
1249 | #define E1000_82542_RSSIR E1000_RSSIR | ||
1250 | |||
1200 | /* Statistics counters collected by the MAC */ | 1251 | /* Statistics counters collected by the MAC */ |
1201 | struct e1000_hw_stats { | 1252 | struct e1000_hw_stats { |
1202 | uint64_t crcerrs; | 1253 | uint64_t crcerrs; |
@@ -1336,6 +1387,7 @@ struct e1000_hw { | |||
1336 | boolean_t serdes_link_down; | 1387 | boolean_t serdes_link_down; |
1337 | boolean_t tbi_compatibility_en; | 1388 | boolean_t tbi_compatibility_en; |
1338 | boolean_t tbi_compatibility_on; | 1389 | boolean_t tbi_compatibility_on; |
1390 | boolean_t laa_is_present; | ||
1339 | boolean_t phy_reset_disable; | 1391 | boolean_t phy_reset_disable; |
1340 | boolean_t fc_send_xon; | 1392 | boolean_t fc_send_xon; |
1341 | boolean_t fc_strict_ieee; | 1393 | boolean_t fc_strict_ieee; |
@@ -1374,6 +1426,7 @@ struct e1000_hw { | |||
1374 | #define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */ | 1426 | #define E1000_CTRL_BEM32 0x00000400 /* Big Endian 32 mode */ |
1375 | #define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ | 1427 | #define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ |
1376 | #define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ | 1428 | #define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ |
1429 | #define E1000_CTRL_D_UD_EN 0x00002000 /* Dock/Undock enable */ | ||
1377 | #define E1000_CTRL_D_UD_POLARITY 0x00004000 /* Defined polarity of Dock/Undock indication in SDP[0] */ | 1430 | #define E1000_CTRL_D_UD_POLARITY 0x00004000 /* Defined polarity of Dock/Undock indication in SDP[0] */ |
1378 | #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ | 1431 | #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ |
1379 | #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ | 1432 | #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ |
@@ -1491,6 +1544,8 @@ struct e1000_hw { | |||
1491 | #define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 | 1544 | #define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 |
1492 | #define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 | 1545 | #define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 |
1493 | #define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 | 1546 | #define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 |
1547 | #define E1000_CTRL_EXT_CANC 0x04000000 /* Interrupt delay cancellation */ | ||
1548 | #define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ | ||
1494 | #define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */ | 1549 | #define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */ |
1495 | #define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */ | 1550 | #define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */ |
1496 | 1551 | ||
@@ -1524,6 +1579,7 @@ struct e1000_hw { | |||
1524 | #define E1000_LEDCTL_LED2_BLINK 0x00800000 | 1579 | #define E1000_LEDCTL_LED2_BLINK 0x00800000 |
1525 | #define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000 | 1580 | #define E1000_LEDCTL_LED3_MODE_MASK 0x0F000000 |
1526 | #define E1000_LEDCTL_LED3_MODE_SHIFT 24 | 1581 | #define E1000_LEDCTL_LED3_MODE_SHIFT 24 |
1582 | #define E1000_LEDCTL_LED3_BLINK_RATE 0x20000000 | ||
1527 | #define E1000_LEDCTL_LED3_IVRT 0x40000000 | 1583 | #define E1000_LEDCTL_LED3_IVRT 0x40000000 |
1528 | #define E1000_LEDCTL_LED3_BLINK 0x80000000 | 1584 | #define E1000_LEDCTL_LED3_BLINK 0x80000000 |
1529 | 1585 | ||
@@ -1784,6 +1840,16 @@ struct e1000_hw { | |||
1784 | #define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ | 1840 | #define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ |
1785 | #define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ | 1841 | #define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ |
1786 | 1842 | ||
1843 | /* Multiple Receive Queue Control */ | ||
1844 | #define E1000_MRQC_ENABLE_MASK 0x00000003 | ||
1845 | #define E1000_MRQC_ENABLE_RSS_2Q 0x00000001 | ||
1846 | #define E1000_MRQC_ENABLE_RSS_INT 0x00000004 | ||
1847 | #define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000 | ||
1848 | #define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 | ||
1849 | #define E1000_MRQC_RSS_FIELD_IPV4 0x00020000 | ||
1850 | #define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00040000 | ||
1851 | #define E1000_MRQC_RSS_FIELD_IPV6_EX 0x00080000 | ||
1852 | #define E1000_MRQC_RSS_FIELD_IPV6 0x00100000 | ||
1787 | 1853 | ||
1788 | /* Definitions for power management and wakeup registers */ | 1854 | /* Definitions for power management and wakeup registers */ |
1789 | /* Wake Up Control */ | 1855 | /* Wake Up Control */ |
@@ -1928,6 +1994,7 @@ struct e1000_host_command_info { | |||
1928 | #define E1000_MDALIGN 4096 | 1994 | #define E1000_MDALIGN 4096 |
1929 | 1995 | ||
1930 | #define E1000_GCR_BEM32 0x00400000 | 1996 | #define E1000_GCR_BEM32 0x00400000 |
1997 | #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 | ||
1931 | /* Function Active and Power State to MNG */ | 1998 | /* Function Active and Power State to MNG */ |
1932 | #define E1000_FACTPS_FUNC0_POWER_STATE_MASK 0x00000003 | 1999 | #define E1000_FACTPS_FUNC0_POWER_STATE_MASK 0x00000003 |
1933 | #define E1000_FACTPS_LAN0_VALID 0x00000004 | 2000 | #define E1000_FACTPS_LAN0_VALID 0x00000004 |
@@ -1980,6 +2047,7 @@ struct e1000_host_command_info { | |||
1980 | /* EEPROM Word Offsets */ | 2047 | /* EEPROM Word Offsets */ |
1981 | #define EEPROM_COMPAT 0x0003 | 2048 | #define EEPROM_COMPAT 0x0003 |
1982 | #define EEPROM_ID_LED_SETTINGS 0x0004 | 2049 | #define EEPROM_ID_LED_SETTINGS 0x0004 |
2050 | #define EEPROM_VERSION 0x0005 | ||
1983 | #define EEPROM_SERDES_AMPLITUDE 0x0006 /* For SERDES output amplitude adjustment. */ | 2051 | #define EEPROM_SERDES_AMPLITUDE 0x0006 /* For SERDES output amplitude adjustment. */ |
1984 | #define EEPROM_PHY_CLASS_WORD 0x0007 | 2052 | #define EEPROM_PHY_CLASS_WORD 0x0007 |
1985 | #define EEPROM_INIT_CONTROL1_REG 0x000A | 2053 | #define EEPROM_INIT_CONTROL1_REG 0x000A |
@@ -1990,6 +2058,8 @@ struct e1000_host_command_info { | |||
1990 | #define EEPROM_FLASH_VERSION 0x0032 | 2058 | #define EEPROM_FLASH_VERSION 0x0032 |
1991 | #define EEPROM_CHECKSUM_REG 0x003F | 2059 | #define EEPROM_CHECKSUM_REG 0x003F |
1992 | 2060 | ||
2061 | #define E1000_EEPROM_CFG_DONE 0x00040000 /* MNG config cycle done */ | ||
2062 | |||
1993 | /* Word definitions for ID LED Settings */ | 2063 | /* Word definitions for ID LED Settings */ |
1994 | #define ID_LED_RESERVED_0000 0x0000 | 2064 | #define ID_LED_RESERVED_0000 0x0000 |
1995 | #define ID_LED_RESERVED_FFFF 0xFFFF | 2065 | #define ID_LED_RESERVED_FFFF 0xFFFF |
@@ -2108,6 +2178,8 @@ struct e1000_host_command_info { | |||
2108 | #define E1000_PBA_22K 0x0016 | 2178 | #define E1000_PBA_22K 0x0016 |
2109 | #define E1000_PBA_24K 0x0018 | 2179 | #define E1000_PBA_24K 0x0018 |
2110 | #define E1000_PBA_30K 0x001E | 2180 | #define E1000_PBA_30K 0x001E |
2181 | #define E1000_PBA_32K 0x0020 | ||
2182 | #define E1000_PBA_38K 0x0026 | ||
2111 | #define E1000_PBA_40K 0x0028 | 2183 | #define E1000_PBA_40K 0x0028 |
2112 | #define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */ | 2184 | #define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */ |
2113 | 2185 | ||
@@ -2592,11 +2664,11 @@ struct e1000_host_command_info { | |||
2592 | 2664 | ||
2593 | /* 7 bits (3 Coarse + 4 Fine) --> 128 optional values */ | 2665 | /* 7 bits (3 Coarse + 4 Fine) --> 128 optional values */ |
2594 | #define IGP01E1000_AGC_LENGTH_TABLE_SIZE 128 | 2666 | #define IGP01E1000_AGC_LENGTH_TABLE_SIZE 128 |
2595 | #define IGP02E1000_AGC_LENGTH_TABLE_SIZE 128 | 2667 | #define IGP02E1000_AGC_LENGTH_TABLE_SIZE 113 |
2596 | 2668 | ||
2597 | /* The precision error of the cable length is +/- 10 meters */ | 2669 | /* The precision error of the cable length is +/- 10 meters */ |
2598 | #define IGP01E1000_AGC_RANGE 10 | 2670 | #define IGP01E1000_AGC_RANGE 10 |
2599 | #define IGP02E1000_AGC_RANGE 10 | 2671 | #define IGP02E1000_AGC_RANGE 15 |
2600 | 2672 | ||
2601 | /* IGP01E1000 PCS Initialization register */ | 2673 | /* IGP01E1000 PCS Initialization register */ |
2602 | /* bits 3:6 in the PCS registers stores the channels polarity */ | 2674 | /* bits 3:6 in the PCS registers stores the channels polarity */ |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index ee687c902a20..6b72f6acdd54 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -43,7 +43,7 @@ char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | |||
43 | #else | 43 | #else |
44 | #define DRIVERNAPI "-NAPI" | 44 | #define DRIVERNAPI "-NAPI" |
45 | #endif | 45 | #endif |
46 | #define DRV_VERSION "6.0.60-k2"DRIVERNAPI | 46 | #define DRV_VERSION "6.1.16-k2"DRIVERNAPI |
47 | char e1000_driver_version[] = DRV_VERSION; | 47 | char e1000_driver_version[] = DRV_VERSION; |
48 | char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation."; | 48 | char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation."; |
49 | 49 | ||
@@ -80,6 +80,9 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
80 | INTEL_E1000_ETHERNET_DEVICE(0x1026), | 80 | INTEL_E1000_ETHERNET_DEVICE(0x1026), |
81 | INTEL_E1000_ETHERNET_DEVICE(0x1027), | 81 | INTEL_E1000_ETHERNET_DEVICE(0x1027), |
82 | INTEL_E1000_ETHERNET_DEVICE(0x1028), | 82 | INTEL_E1000_ETHERNET_DEVICE(0x1028), |
83 | INTEL_E1000_ETHERNET_DEVICE(0x105E), | ||
84 | INTEL_E1000_ETHERNET_DEVICE(0x105F), | ||
85 | INTEL_E1000_ETHERNET_DEVICE(0x1060), | ||
83 | INTEL_E1000_ETHERNET_DEVICE(0x1075), | 86 | INTEL_E1000_ETHERNET_DEVICE(0x1075), |
84 | INTEL_E1000_ETHERNET_DEVICE(0x1076), | 87 | INTEL_E1000_ETHERNET_DEVICE(0x1076), |
85 | INTEL_E1000_ETHERNET_DEVICE(0x1077), | 88 | INTEL_E1000_ETHERNET_DEVICE(0x1077), |
@@ -88,10 +91,13 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
88 | INTEL_E1000_ETHERNET_DEVICE(0x107A), | 91 | INTEL_E1000_ETHERNET_DEVICE(0x107A), |
89 | INTEL_E1000_ETHERNET_DEVICE(0x107B), | 92 | INTEL_E1000_ETHERNET_DEVICE(0x107B), |
90 | INTEL_E1000_ETHERNET_DEVICE(0x107C), | 93 | INTEL_E1000_ETHERNET_DEVICE(0x107C), |
94 | INTEL_E1000_ETHERNET_DEVICE(0x107D), | ||
95 | INTEL_E1000_ETHERNET_DEVICE(0x107E), | ||
96 | INTEL_E1000_ETHERNET_DEVICE(0x107F), | ||
91 | INTEL_E1000_ETHERNET_DEVICE(0x108A), | 97 | INTEL_E1000_ETHERNET_DEVICE(0x108A), |
92 | INTEL_E1000_ETHERNET_DEVICE(0x108B), | 98 | INTEL_E1000_ETHERNET_DEVICE(0x108B), |
93 | INTEL_E1000_ETHERNET_DEVICE(0x108C), | 99 | INTEL_E1000_ETHERNET_DEVICE(0x108C), |
94 | INTEL_E1000_ETHERNET_DEVICE(0x1099), | 100 | INTEL_E1000_ETHERNET_DEVICE(0x109A), |
95 | /* required last entry */ | 101 | /* required last entry */ |
96 | {0,} | 102 | {0,} |
97 | }; | 103 | }; |
@@ -102,10 +108,18 @@ int e1000_up(struct e1000_adapter *adapter); | |||
102 | void e1000_down(struct e1000_adapter *adapter); | 108 | void e1000_down(struct e1000_adapter *adapter); |
103 | void e1000_reset(struct e1000_adapter *adapter); | 109 | void e1000_reset(struct e1000_adapter *adapter); |
104 | int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx); | 110 | int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx); |
105 | int e1000_setup_tx_resources(struct e1000_adapter *adapter); | 111 | int e1000_setup_all_tx_resources(struct e1000_adapter *adapter); |
106 | int e1000_setup_rx_resources(struct e1000_adapter *adapter); | 112 | int e1000_setup_all_rx_resources(struct e1000_adapter *adapter); |
107 | void e1000_free_tx_resources(struct e1000_adapter *adapter); | 113 | void e1000_free_all_tx_resources(struct e1000_adapter *adapter); |
108 | void e1000_free_rx_resources(struct e1000_adapter *adapter); | 114 | void e1000_free_all_rx_resources(struct e1000_adapter *adapter); |
115 | int e1000_setup_tx_resources(struct e1000_adapter *adapter, | ||
116 | struct e1000_tx_ring *txdr); | ||
117 | int e1000_setup_rx_resources(struct e1000_adapter *adapter, | ||
118 | struct e1000_rx_ring *rxdr); | ||
119 | void e1000_free_tx_resources(struct e1000_adapter *adapter, | ||
120 | struct e1000_tx_ring *tx_ring); | ||
121 | void e1000_free_rx_resources(struct e1000_adapter *adapter, | ||
122 | struct e1000_rx_ring *rx_ring); | ||
109 | void e1000_update_stats(struct e1000_adapter *adapter); | 123 | void e1000_update_stats(struct e1000_adapter *adapter); |
110 | 124 | ||
111 | /* Local Function Prototypes */ | 125 | /* Local Function Prototypes */ |
@@ -114,14 +128,22 @@ static int e1000_init_module(void); | |||
114 | static void e1000_exit_module(void); | 128 | static void e1000_exit_module(void); |
115 | static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent); | 129 | static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent); |
116 | static void __devexit e1000_remove(struct pci_dev *pdev); | 130 | static void __devexit e1000_remove(struct pci_dev *pdev); |
131 | static int e1000_alloc_queues(struct e1000_adapter *adapter); | ||
132 | #ifdef CONFIG_E1000_MQ | ||
133 | static void e1000_setup_queue_mapping(struct e1000_adapter *adapter); | ||
134 | #endif | ||
117 | static int e1000_sw_init(struct e1000_adapter *adapter); | 135 | static int e1000_sw_init(struct e1000_adapter *adapter); |
118 | static int e1000_open(struct net_device *netdev); | 136 | static int e1000_open(struct net_device *netdev); |
119 | static int e1000_close(struct net_device *netdev); | 137 | static int e1000_close(struct net_device *netdev); |
120 | static void e1000_configure_tx(struct e1000_adapter *adapter); | 138 | static void e1000_configure_tx(struct e1000_adapter *adapter); |
121 | static void e1000_configure_rx(struct e1000_adapter *adapter); | 139 | static void e1000_configure_rx(struct e1000_adapter *adapter); |
122 | static void e1000_setup_rctl(struct e1000_adapter *adapter); | 140 | static void e1000_setup_rctl(struct e1000_adapter *adapter); |
123 | static void e1000_clean_tx_ring(struct e1000_adapter *adapter); | 141 | static void e1000_clean_all_tx_rings(struct e1000_adapter *adapter); |
124 | static void e1000_clean_rx_ring(struct e1000_adapter *adapter); | 142 | static void e1000_clean_all_rx_rings(struct e1000_adapter *adapter); |
143 | static void e1000_clean_tx_ring(struct e1000_adapter *adapter, | ||
144 | struct e1000_tx_ring *tx_ring); | ||
145 | static void e1000_clean_rx_ring(struct e1000_adapter *adapter, | ||
146 | struct e1000_rx_ring *rx_ring); | ||
125 | static void e1000_set_multi(struct net_device *netdev); | 147 | static void e1000_set_multi(struct net_device *netdev); |
126 | static void e1000_update_phy_info(unsigned long data); | 148 | static void e1000_update_phy_info(unsigned long data); |
127 | static void e1000_watchdog(unsigned long data); | 149 | static void e1000_watchdog(unsigned long data); |
@@ -132,19 +154,26 @@ static struct net_device_stats * e1000_get_stats(struct net_device *netdev); | |||
132 | static int e1000_change_mtu(struct net_device *netdev, int new_mtu); | 154 | static int e1000_change_mtu(struct net_device *netdev, int new_mtu); |
133 | static int e1000_set_mac(struct net_device *netdev, void *p); | 155 | static int e1000_set_mac(struct net_device *netdev, void *p); |
134 | static irqreturn_t e1000_intr(int irq, void *data, struct pt_regs *regs); | 156 | static irqreturn_t e1000_intr(int irq, void *data, struct pt_regs *regs); |
135 | static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter); | 157 | static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter, |
158 | struct e1000_tx_ring *tx_ring); | ||
136 | #ifdef CONFIG_E1000_NAPI | 159 | #ifdef CONFIG_E1000_NAPI |
137 | static int e1000_clean(struct net_device *netdev, int *budget); | 160 | static int e1000_clean(struct net_device *poll_dev, int *budget); |
138 | static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter, | 161 | static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter, |
162 | struct e1000_rx_ring *rx_ring, | ||
139 | int *work_done, int work_to_do); | 163 | int *work_done, int work_to_do); |
140 | static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | 164 | static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, |
165 | struct e1000_rx_ring *rx_ring, | ||
141 | int *work_done, int work_to_do); | 166 | int *work_done, int work_to_do); |
142 | #else | 167 | #else |
143 | static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter); | 168 | static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter, |
144 | static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter); | 169 | struct e1000_rx_ring *rx_ring); |
170 | static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | ||
171 | struct e1000_rx_ring *rx_ring); | ||
145 | #endif | 172 | #endif |
146 | static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter); | 173 | static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, |
147 | static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter); | 174 | struct e1000_rx_ring *rx_ring); |
175 | static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, | ||
176 | struct e1000_rx_ring *rx_ring); | ||
148 | static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); | 177 | static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); |
149 | static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, | 178 | static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, |
150 | int cmd); | 179 | int cmd); |
@@ -172,6 +201,11 @@ static int e1000_resume(struct pci_dev *pdev); | |||
172 | static void e1000_netpoll (struct net_device *netdev); | 201 | static void e1000_netpoll (struct net_device *netdev); |
173 | #endif | 202 | #endif |
174 | 203 | ||
204 | #ifdef CONFIG_E1000_MQ | ||
205 | /* for multiple Rx queues */ | ||
206 | void e1000_rx_schedule(void *data); | ||
207 | #endif | ||
208 | |||
175 | /* Exported from other modules */ | 209 | /* Exported from other modules */ |
176 | 210 | ||
177 | extern void e1000_check_options(struct e1000_adapter *adapter); | 211 | extern void e1000_check_options(struct e1000_adapter *adapter); |
@@ -289,7 +323,7 @@ int | |||
289 | e1000_up(struct e1000_adapter *adapter) | 323 | e1000_up(struct e1000_adapter *adapter) |
290 | { | 324 | { |
291 | struct net_device *netdev = adapter->netdev; | 325 | struct net_device *netdev = adapter->netdev; |
292 | int err; | 326 | int i, err; |
293 | 327 | ||
294 | /* hardware has been reset, we need to reload some things */ | 328 | /* hardware has been reset, we need to reload some things */ |
295 | 329 | ||
@@ -308,7 +342,8 @@ e1000_up(struct e1000_adapter *adapter) | |||
308 | e1000_configure_tx(adapter); | 342 | e1000_configure_tx(adapter); |
309 | e1000_setup_rctl(adapter); | 343 | e1000_setup_rctl(adapter); |
310 | e1000_configure_rx(adapter); | 344 | e1000_configure_rx(adapter); |
311 | adapter->alloc_rx_buf(adapter); | 345 | for (i = 0; i < adapter->num_queues; i++) |
346 | adapter->alloc_rx_buf(adapter, &adapter->rx_ring[i]); | ||
312 | 347 | ||
313 | #ifdef CONFIG_PCI_MSI | 348 | #ifdef CONFIG_PCI_MSI |
314 | if(adapter->hw.mac_type > e1000_82547_rev_2) { | 349 | if(adapter->hw.mac_type > e1000_82547_rev_2) { |
@@ -344,6 +379,9 @@ e1000_down(struct e1000_adapter *adapter) | |||
344 | struct net_device *netdev = adapter->netdev; | 379 | struct net_device *netdev = adapter->netdev; |
345 | 380 | ||
346 | e1000_irq_disable(adapter); | 381 | e1000_irq_disable(adapter); |
382 | #ifdef CONFIG_E1000_MQ | ||
383 | while (atomic_read(&adapter->rx_sched_call_data.count) != 0); | ||
384 | #endif | ||
347 | free_irq(adapter->pdev->irq, netdev); | 385 | free_irq(adapter->pdev->irq, netdev); |
348 | #ifdef CONFIG_PCI_MSI | 386 | #ifdef CONFIG_PCI_MSI |
349 | if(adapter->hw.mac_type > e1000_82547_rev_2 && | 387 | if(adapter->hw.mac_type > e1000_82547_rev_2 && |
@@ -363,11 +401,10 @@ e1000_down(struct e1000_adapter *adapter) | |||
363 | netif_stop_queue(netdev); | 401 | netif_stop_queue(netdev); |
364 | 402 | ||
365 | e1000_reset(adapter); | 403 | e1000_reset(adapter); |
366 | e1000_clean_tx_ring(adapter); | 404 | e1000_clean_all_tx_rings(adapter); |
367 | e1000_clean_rx_ring(adapter); | 405 | e1000_clean_all_rx_rings(adapter); |
368 | 406 | ||
369 | /* If WoL is not enabled | 407 | /* If WoL is not enabled and management mode is not IAMT |
370 | * and management mode is not IAMT | ||
371 | * Power down the PHY so no link is implied when interface is down */ | 408 | * Power down the PHY so no link is implied when interface is down */ |
372 | if(!adapter->wol && adapter->hw.mac_type >= e1000_82540 && | 409 | if(!adapter->wol && adapter->hw.mac_type >= e1000_82540 && |
373 | adapter->hw.media_type == e1000_media_type_copper && | 410 | adapter->hw.media_type == e1000_media_type_copper && |
@@ -398,6 +435,10 @@ e1000_reset(struct e1000_adapter *adapter) | |||
398 | case e1000_82547_rev_2: | 435 | case e1000_82547_rev_2: |
399 | pba = E1000_PBA_30K; | 436 | pba = E1000_PBA_30K; |
400 | break; | 437 | break; |
438 | case e1000_82571: | ||
439 | case e1000_82572: | ||
440 | pba = E1000_PBA_38K; | ||
441 | break; | ||
401 | case e1000_82573: | 442 | case e1000_82573: |
402 | pba = E1000_PBA_12K; | 443 | pba = E1000_PBA_12K; |
403 | break; | 444 | break; |
@@ -475,6 +516,7 @@ e1000_probe(struct pci_dev *pdev, | |||
475 | struct net_device *netdev; | 516 | struct net_device *netdev; |
476 | struct e1000_adapter *adapter; | 517 | struct e1000_adapter *adapter; |
477 | unsigned long mmio_start, mmio_len; | 518 | unsigned long mmio_start, mmio_len; |
519 | uint32_t ctrl_ext; | ||
478 | uint32_t swsm; | 520 | uint32_t swsm; |
479 | 521 | ||
480 | static int cards_found = 0; | 522 | static int cards_found = 0; |
@@ -614,8 +656,9 @@ e1000_probe(struct pci_dev *pdev, | |||
614 | if(e1000_read_mac_addr(&adapter->hw)) | 656 | if(e1000_read_mac_addr(&adapter->hw)) |
615 | DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); | 657 | DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); |
616 | memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); | 658 | memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); |
659 | memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len); | ||
617 | 660 | ||
618 | if(!is_valid_ether_addr(netdev->dev_addr)) { | 661 | if(!is_valid_ether_addr(netdev->perm_addr)) { |
619 | DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); | 662 | DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); |
620 | err = -EIO; | 663 | err = -EIO; |
621 | goto err_eeprom; | 664 | goto err_eeprom; |
@@ -687,6 +730,12 @@ e1000_probe(struct pci_dev *pdev, | |||
687 | 730 | ||
688 | /* Let firmware know the driver has taken over */ | 731 | /* Let firmware know the driver has taken over */ |
689 | switch(adapter->hw.mac_type) { | 732 | switch(adapter->hw.mac_type) { |
733 | case e1000_82571: | ||
734 | case e1000_82572: | ||
735 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
736 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
737 | ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); | ||
738 | break; | ||
690 | case e1000_82573: | 739 | case e1000_82573: |
691 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 740 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
692 | E1000_WRITE_REG(&adapter->hw, SWSM, | 741 | E1000_WRITE_REG(&adapter->hw, SWSM, |
@@ -731,7 +780,11 @@ e1000_remove(struct pci_dev *pdev) | |||
731 | { | 780 | { |
732 | struct net_device *netdev = pci_get_drvdata(pdev); | 781 | struct net_device *netdev = pci_get_drvdata(pdev); |
733 | struct e1000_adapter *adapter = netdev_priv(netdev); | 782 | struct e1000_adapter *adapter = netdev_priv(netdev); |
783 | uint32_t ctrl_ext; | ||
734 | uint32_t manc, swsm; | 784 | uint32_t manc, swsm; |
785 | #ifdef CONFIG_E1000_NAPI | ||
786 | int i; | ||
787 | #endif | ||
735 | 788 | ||
736 | flush_scheduled_work(); | 789 | flush_scheduled_work(); |
737 | 790 | ||
@@ -745,6 +798,12 @@ e1000_remove(struct pci_dev *pdev) | |||
745 | } | 798 | } |
746 | 799 | ||
747 | switch(adapter->hw.mac_type) { | 800 | switch(adapter->hw.mac_type) { |
801 | case e1000_82571: | ||
802 | case e1000_82572: | ||
803 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
804 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
805 | ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); | ||
806 | break; | ||
748 | case e1000_82573: | 807 | case e1000_82573: |
749 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 808 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
750 | E1000_WRITE_REG(&adapter->hw, SWSM, | 809 | E1000_WRITE_REG(&adapter->hw, SWSM, |
@@ -756,13 +815,27 @@ e1000_remove(struct pci_dev *pdev) | |||
756 | } | 815 | } |
757 | 816 | ||
758 | unregister_netdev(netdev); | 817 | unregister_netdev(netdev); |
818 | #ifdef CONFIG_E1000_NAPI | ||
819 | for (i = 0; i < adapter->num_queues; i++) | ||
820 | __dev_put(&adapter->polling_netdev[i]); | ||
821 | #endif | ||
759 | 822 | ||
760 | if(!e1000_check_phy_reset_block(&adapter->hw)) | 823 | if(!e1000_check_phy_reset_block(&adapter->hw)) |
761 | e1000_phy_hw_reset(&adapter->hw); | 824 | e1000_phy_hw_reset(&adapter->hw); |
762 | 825 | ||
826 | kfree(adapter->tx_ring); | ||
827 | kfree(adapter->rx_ring); | ||
828 | #ifdef CONFIG_E1000_NAPI | ||
829 | kfree(adapter->polling_netdev); | ||
830 | #endif | ||
831 | |||
763 | iounmap(adapter->hw.hw_addr); | 832 | iounmap(adapter->hw.hw_addr); |
764 | pci_release_regions(pdev); | 833 | pci_release_regions(pdev); |
765 | 834 | ||
835 | #ifdef CONFIG_E1000_MQ | ||
836 | free_percpu(adapter->cpu_netdev); | ||
837 | free_percpu(adapter->cpu_tx_ring); | ||
838 | #endif | ||
766 | free_netdev(netdev); | 839 | free_netdev(netdev); |
767 | 840 | ||
768 | pci_disable_device(pdev); | 841 | pci_disable_device(pdev); |
@@ -783,6 +856,9 @@ e1000_sw_init(struct e1000_adapter *adapter) | |||
783 | struct e1000_hw *hw = &adapter->hw; | 856 | struct e1000_hw *hw = &adapter->hw; |
784 | struct net_device *netdev = adapter->netdev; | 857 | struct net_device *netdev = adapter->netdev; |
785 | struct pci_dev *pdev = adapter->pdev; | 858 | struct pci_dev *pdev = adapter->pdev; |
859 | #ifdef CONFIG_E1000_NAPI | ||
860 | int i; | ||
861 | #endif | ||
786 | 862 | ||
787 | /* PCI config space info */ | 863 | /* PCI config space info */ |
788 | 864 | ||
@@ -840,14 +916,123 @@ e1000_sw_init(struct e1000_adapter *adapter) | |||
840 | hw->master_slave = E1000_MASTER_SLAVE; | 916 | hw->master_slave = E1000_MASTER_SLAVE; |
841 | } | 917 | } |
842 | 918 | ||
919 | #ifdef CONFIG_E1000_MQ | ||
920 | /* Number of supported queues */ | ||
921 | switch (hw->mac_type) { | ||
922 | case e1000_82571: | ||
923 | case e1000_82572: | ||
924 | adapter->num_queues = 2; | ||
925 | break; | ||
926 | default: | ||
927 | adapter->num_queues = 1; | ||
928 | break; | ||
929 | } | ||
930 | adapter->num_queues = min(adapter->num_queues, num_online_cpus()); | ||
931 | #else | ||
932 | adapter->num_queues = 1; | ||
933 | #endif | ||
934 | |||
935 | if (e1000_alloc_queues(adapter)) { | ||
936 | DPRINTK(PROBE, ERR, "Unable to allocate memory for queues\n"); | ||
937 | return -ENOMEM; | ||
938 | } | ||
939 | |||
940 | #ifdef CONFIG_E1000_NAPI | ||
941 | for (i = 0; i < adapter->num_queues; i++) { | ||
942 | adapter->polling_netdev[i].priv = adapter; | ||
943 | adapter->polling_netdev[i].poll = &e1000_clean; | ||
944 | adapter->polling_netdev[i].weight = 64; | ||
945 | dev_hold(&adapter->polling_netdev[i]); | ||
946 | set_bit(__LINK_STATE_START, &adapter->polling_netdev[i].state); | ||
947 | } | ||
948 | #endif | ||
949 | |||
950 | #ifdef CONFIG_E1000_MQ | ||
951 | e1000_setup_queue_mapping(adapter); | ||
952 | #endif | ||
953 | |||
843 | atomic_set(&adapter->irq_sem, 1); | 954 | atomic_set(&adapter->irq_sem, 1); |
844 | spin_lock_init(&adapter->stats_lock); | 955 | spin_lock_init(&adapter->stats_lock); |
845 | spin_lock_init(&adapter->tx_lock); | ||
846 | 956 | ||
847 | return 0; | 957 | return 0; |
848 | } | 958 | } |
849 | 959 | ||
850 | /** | 960 | /** |
961 | * e1000_alloc_queues - Allocate memory for all rings | ||
962 | * @adapter: board private structure to initialize | ||
963 | * | ||
964 | * We allocate one ring per queue at run-time since we don't know the | ||
965 | * number of queues at compile-time. The polling_netdev array is | ||
966 | * intended for Multiqueue, but should work fine with a single queue. | ||
967 | **/ | ||
968 | |||
969 | static int __devinit | ||
970 | e1000_alloc_queues(struct e1000_adapter *adapter) | ||
971 | { | ||
972 | int size; | ||
973 | |||
974 | size = sizeof(struct e1000_tx_ring) * adapter->num_queues; | ||
975 | adapter->tx_ring = kmalloc(size, GFP_KERNEL); | ||
976 | if (!adapter->tx_ring) | ||
977 | return -ENOMEM; | ||
978 | memset(adapter->tx_ring, 0, size); | ||
979 | |||
980 | size = sizeof(struct e1000_rx_ring) * adapter->num_queues; | ||
981 | adapter->rx_ring = kmalloc(size, GFP_KERNEL); | ||
982 | if (!adapter->rx_ring) { | ||
983 | kfree(adapter->tx_ring); | ||
984 | return -ENOMEM; | ||
985 | } | ||
986 | memset(adapter->rx_ring, 0, size); | ||
987 | |||
988 | #ifdef CONFIG_E1000_NAPI | ||
989 | size = sizeof(struct net_device) * adapter->num_queues; | ||
990 | adapter->polling_netdev = kmalloc(size, GFP_KERNEL); | ||
991 | if (!adapter->polling_netdev) { | ||
992 | kfree(adapter->tx_ring); | ||
993 | kfree(adapter->rx_ring); | ||
994 | return -ENOMEM; | ||
995 | } | ||
996 | memset(adapter->polling_netdev, 0, size); | ||
997 | #endif | ||
998 | |||
999 | return E1000_SUCCESS; | ||
1000 | } | ||
1001 | |||
1002 | #ifdef CONFIG_E1000_MQ | ||
1003 | static void __devinit | ||
1004 | e1000_setup_queue_mapping(struct e1000_adapter *adapter) | ||
1005 | { | ||
1006 | int i, cpu; | ||
1007 | |||
1008 | adapter->rx_sched_call_data.func = e1000_rx_schedule; | ||
1009 | adapter->rx_sched_call_data.info = adapter->netdev; | ||
1010 | cpus_clear(adapter->rx_sched_call_data.cpumask); | ||
1011 | |||
1012 | adapter->cpu_netdev = alloc_percpu(struct net_device *); | ||
1013 | adapter->cpu_tx_ring = alloc_percpu(struct e1000_tx_ring *); | ||
1014 | |||
1015 | lock_cpu_hotplug(); | ||
1016 | i = 0; | ||
1017 | for_each_online_cpu(cpu) { | ||
1018 | *per_cpu_ptr(adapter->cpu_tx_ring, cpu) = &adapter->tx_ring[i % adapter->num_queues]; | ||
1019 | /* This is incomplete because we'd like to assign separate | ||
1020 | * physical cpus to these netdev polling structures and | ||
1021 | * avoid saturating a subset of cpus. | ||
1022 | */ | ||
1023 | if (i < adapter->num_queues) { | ||
1024 | *per_cpu_ptr(adapter->cpu_netdev, cpu) = &adapter->polling_netdev[i]; | ||
1025 | adapter->cpu_for_queue[i] = cpu; | ||
1026 | } else | ||
1027 | *per_cpu_ptr(adapter->cpu_netdev, cpu) = NULL; | ||
1028 | |||
1029 | i++; | ||
1030 | } | ||
1031 | unlock_cpu_hotplug(); | ||
1032 | } | ||
1033 | #endif | ||
1034 | |||
1035 | /** | ||
851 | * e1000_open - Called when a network interface is made active | 1036 | * e1000_open - Called when a network interface is made active |
852 | * @netdev: network interface device structure | 1037 | * @netdev: network interface device structure |
853 | * | 1038 | * |
@@ -868,12 +1053,12 @@ e1000_open(struct net_device *netdev) | |||
868 | 1053 | ||
869 | /* allocate transmit descriptors */ | 1054 | /* allocate transmit descriptors */ |
870 | 1055 | ||
871 | if((err = e1000_setup_tx_resources(adapter))) | 1056 | if ((err = e1000_setup_all_tx_resources(adapter))) |
872 | goto err_setup_tx; | 1057 | goto err_setup_tx; |
873 | 1058 | ||
874 | /* allocate receive descriptors */ | 1059 | /* allocate receive descriptors */ |
875 | 1060 | ||
876 | if((err = e1000_setup_rx_resources(adapter))) | 1061 | if ((err = e1000_setup_all_rx_resources(adapter))) |
877 | goto err_setup_rx; | 1062 | goto err_setup_rx; |
878 | 1063 | ||
879 | if((err = e1000_up(adapter))) | 1064 | if((err = e1000_up(adapter))) |
@@ -887,9 +1072,9 @@ e1000_open(struct net_device *netdev) | |||
887 | return E1000_SUCCESS; | 1072 | return E1000_SUCCESS; |
888 | 1073 | ||
889 | err_up: | 1074 | err_up: |
890 | e1000_free_rx_resources(adapter); | 1075 | e1000_free_all_rx_resources(adapter); |
891 | err_setup_rx: | 1076 | err_setup_rx: |
892 | e1000_free_tx_resources(adapter); | 1077 | e1000_free_all_tx_resources(adapter); |
893 | err_setup_tx: | 1078 | err_setup_tx: |
894 | e1000_reset(adapter); | 1079 | e1000_reset(adapter); |
895 | 1080 | ||
@@ -915,8 +1100,8 @@ e1000_close(struct net_device *netdev) | |||
915 | 1100 | ||
916 | e1000_down(adapter); | 1101 | e1000_down(adapter); |
917 | 1102 | ||
918 | e1000_free_tx_resources(adapter); | 1103 | e1000_free_all_tx_resources(adapter); |
919 | e1000_free_rx_resources(adapter); | 1104 | e1000_free_all_rx_resources(adapter); |
920 | 1105 | ||
921 | if((adapter->hw.mng_cookie.status & | 1106 | if((adapter->hw.mng_cookie.status & |
922 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { | 1107 | E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { |
@@ -951,14 +1136,15 @@ e1000_check_64k_bound(struct e1000_adapter *adapter, | |||
951 | /** | 1136 | /** |
952 | * e1000_setup_tx_resources - allocate Tx resources (Descriptors) | 1137 | * e1000_setup_tx_resources - allocate Tx resources (Descriptors) |
953 | * @adapter: board private structure | 1138 | * @adapter: board private structure |
1139 | * @txdr: tx descriptor ring (for a specific queue) to setup | ||
954 | * | 1140 | * |
955 | * Return 0 on success, negative on failure | 1141 | * Return 0 on success, negative on failure |
956 | **/ | 1142 | **/ |
957 | 1143 | ||
958 | int | 1144 | int |
959 | e1000_setup_tx_resources(struct e1000_adapter *adapter) | 1145 | e1000_setup_tx_resources(struct e1000_adapter *adapter, |
1146 | struct e1000_tx_ring *txdr) | ||
960 | { | 1147 | { |
961 | struct e1000_desc_ring *txdr = &adapter->tx_ring; | ||
962 | struct pci_dev *pdev = adapter->pdev; | 1148 | struct pci_dev *pdev = adapter->pdev; |
963 | int size; | 1149 | int size; |
964 | 1150 | ||
@@ -970,6 +1156,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter) | |||
970 | return -ENOMEM; | 1156 | return -ENOMEM; |
971 | } | 1157 | } |
972 | memset(txdr->buffer_info, 0, size); | 1158 | memset(txdr->buffer_info, 0, size); |
1159 | memset(&txdr->previous_buffer_info, 0, sizeof(struct e1000_buffer)); | ||
973 | 1160 | ||
974 | /* round up to nearest 4K */ | 1161 | /* round up to nearest 4K */ |
975 | 1162 | ||
@@ -1018,11 +1205,41 @@ setup_tx_desc_die: | |||
1018 | 1205 | ||
1019 | txdr->next_to_use = 0; | 1206 | txdr->next_to_use = 0; |
1020 | txdr->next_to_clean = 0; | 1207 | txdr->next_to_clean = 0; |
1208 | spin_lock_init(&txdr->tx_lock); | ||
1021 | 1209 | ||
1022 | return 0; | 1210 | return 0; |
1023 | } | 1211 | } |
1024 | 1212 | ||
1025 | /** | 1213 | /** |
1214 | * e1000_setup_all_tx_resources - wrapper to allocate Tx resources | ||
1215 | * (Descriptors) for all queues | ||
1216 | * @adapter: board private structure | ||
1217 | * | ||
1218 | * If this function returns with an error, then it's possible one or | ||
1219 | * more of the rings is populated (while the rest are not). It is the | ||
1220 | * callers duty to clean those orphaned rings. | ||
1221 | * | ||
1222 | * Return 0 on success, negative on failure | ||
1223 | **/ | ||
1224 | |||
1225 | int | ||
1226 | e1000_setup_all_tx_resources(struct e1000_adapter *adapter) | ||
1227 | { | ||
1228 | int i, err = 0; | ||
1229 | |||
1230 | for (i = 0; i < adapter->num_queues; i++) { | ||
1231 | err = e1000_setup_tx_resources(adapter, &adapter->tx_ring[i]); | ||
1232 | if (err) { | ||
1233 | DPRINTK(PROBE, ERR, | ||
1234 | "Allocation for Tx Queue %u failed\n", i); | ||
1235 | break; | ||
1236 | } | ||
1237 | } | ||
1238 | |||
1239 | return err; | ||
1240 | } | ||
1241 | |||
1242 | /** | ||
1026 | * e1000_configure_tx - Configure 8254x Transmit Unit after Reset | 1243 | * e1000_configure_tx - Configure 8254x Transmit Unit after Reset |
1027 | * @adapter: board private structure | 1244 | * @adapter: board private structure |
1028 | * | 1245 | * |
@@ -1032,23 +1249,43 @@ setup_tx_desc_die: | |||
1032 | static void | 1249 | static void |
1033 | e1000_configure_tx(struct e1000_adapter *adapter) | 1250 | e1000_configure_tx(struct e1000_adapter *adapter) |
1034 | { | 1251 | { |
1035 | uint64_t tdba = adapter->tx_ring.dma; | 1252 | uint64_t tdba; |
1036 | uint32_t tdlen = adapter->tx_ring.count * sizeof(struct e1000_tx_desc); | 1253 | struct e1000_hw *hw = &adapter->hw; |
1037 | uint32_t tctl, tipg; | 1254 | uint32_t tdlen, tctl, tipg, tarc; |
1038 | |||
1039 | E1000_WRITE_REG(&adapter->hw, TDBAL, (tdba & 0x00000000ffffffffULL)); | ||
1040 | E1000_WRITE_REG(&adapter->hw, TDBAH, (tdba >> 32)); | ||
1041 | |||
1042 | E1000_WRITE_REG(&adapter->hw, TDLEN, tdlen); | ||
1043 | 1255 | ||
1044 | /* Setup the HW Tx Head and Tail descriptor pointers */ | 1256 | /* Setup the HW Tx Head and Tail descriptor pointers */ |
1045 | 1257 | ||
1046 | E1000_WRITE_REG(&adapter->hw, TDH, 0); | 1258 | switch (adapter->num_queues) { |
1047 | E1000_WRITE_REG(&adapter->hw, TDT, 0); | 1259 | case 2: |
1260 | tdba = adapter->tx_ring[1].dma; | ||
1261 | tdlen = adapter->tx_ring[1].count * | ||
1262 | sizeof(struct e1000_tx_desc); | ||
1263 | E1000_WRITE_REG(hw, TDBAL1, (tdba & 0x00000000ffffffffULL)); | ||
1264 | E1000_WRITE_REG(hw, TDBAH1, (tdba >> 32)); | ||
1265 | E1000_WRITE_REG(hw, TDLEN1, tdlen); | ||
1266 | E1000_WRITE_REG(hw, TDH1, 0); | ||
1267 | E1000_WRITE_REG(hw, TDT1, 0); | ||
1268 | adapter->tx_ring[1].tdh = E1000_TDH1; | ||
1269 | adapter->tx_ring[1].tdt = E1000_TDT1; | ||
1270 | /* Fall Through */ | ||
1271 | case 1: | ||
1272 | default: | ||
1273 | tdba = adapter->tx_ring[0].dma; | ||
1274 | tdlen = adapter->tx_ring[0].count * | ||
1275 | sizeof(struct e1000_tx_desc); | ||
1276 | E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL)); | ||
1277 | E1000_WRITE_REG(hw, TDBAH, (tdba >> 32)); | ||
1278 | E1000_WRITE_REG(hw, TDLEN, tdlen); | ||
1279 | E1000_WRITE_REG(hw, TDH, 0); | ||
1280 | E1000_WRITE_REG(hw, TDT, 0); | ||
1281 | adapter->tx_ring[0].tdh = E1000_TDH; | ||
1282 | adapter->tx_ring[0].tdt = E1000_TDT; | ||
1283 | break; | ||
1284 | } | ||
1048 | 1285 | ||
1049 | /* Set the default values for the Tx Inter Packet Gap timer */ | 1286 | /* Set the default values for the Tx Inter Packet Gap timer */ |
1050 | 1287 | ||
1051 | switch (adapter->hw.mac_type) { | 1288 | switch (hw->mac_type) { |
1052 | case e1000_82542_rev2_0: | 1289 | case e1000_82542_rev2_0: |
1053 | case e1000_82542_rev2_1: | 1290 | case e1000_82542_rev2_1: |
1054 | tipg = DEFAULT_82542_TIPG_IPGT; | 1291 | tipg = DEFAULT_82542_TIPG_IPGT; |
@@ -1056,67 +1293,81 @@ e1000_configure_tx(struct e1000_adapter *adapter) | |||
1056 | tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; | 1293 | tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; |
1057 | break; | 1294 | break; |
1058 | default: | 1295 | default: |
1059 | if(adapter->hw.media_type == e1000_media_type_fiber || | 1296 | if (hw->media_type == e1000_media_type_fiber || |
1060 | adapter->hw.media_type == e1000_media_type_internal_serdes) | 1297 | hw->media_type == e1000_media_type_internal_serdes) |
1061 | tipg = DEFAULT_82543_TIPG_IPGT_FIBER; | 1298 | tipg = DEFAULT_82543_TIPG_IPGT_FIBER; |
1062 | else | 1299 | else |
1063 | tipg = DEFAULT_82543_TIPG_IPGT_COPPER; | 1300 | tipg = DEFAULT_82543_TIPG_IPGT_COPPER; |
1064 | tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; | 1301 | tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; |
1065 | tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; | 1302 | tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; |
1066 | } | 1303 | } |
1067 | E1000_WRITE_REG(&adapter->hw, TIPG, tipg); | 1304 | E1000_WRITE_REG(hw, TIPG, tipg); |
1068 | 1305 | ||
1069 | /* Set the Tx Interrupt Delay register */ | 1306 | /* Set the Tx Interrupt Delay register */ |
1070 | 1307 | ||
1071 | E1000_WRITE_REG(&adapter->hw, TIDV, adapter->tx_int_delay); | 1308 | E1000_WRITE_REG(hw, TIDV, adapter->tx_int_delay); |
1072 | if(adapter->hw.mac_type >= e1000_82540) | 1309 | if (hw->mac_type >= e1000_82540) |
1073 | E1000_WRITE_REG(&adapter->hw, TADV, adapter->tx_abs_int_delay); | 1310 | E1000_WRITE_REG(hw, TADV, adapter->tx_abs_int_delay); |
1074 | 1311 | ||
1075 | /* Program the Transmit Control Register */ | 1312 | /* Program the Transmit Control Register */ |
1076 | 1313 | ||
1077 | tctl = E1000_READ_REG(&adapter->hw, TCTL); | 1314 | tctl = E1000_READ_REG(hw, TCTL); |
1078 | 1315 | ||
1079 | tctl &= ~E1000_TCTL_CT; | 1316 | tctl &= ~E1000_TCTL_CT; |
1080 | tctl |= E1000_TCTL_EN | E1000_TCTL_PSP | | 1317 | tctl |= E1000_TCTL_EN | E1000_TCTL_PSP | E1000_TCTL_RTLC | |
1081 | (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); | 1318 | (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); |
1082 | 1319 | ||
1083 | E1000_WRITE_REG(&adapter->hw, TCTL, tctl); | 1320 | E1000_WRITE_REG(hw, TCTL, tctl); |
1084 | 1321 | ||
1085 | e1000_config_collision_dist(&adapter->hw); | 1322 | if (hw->mac_type == e1000_82571 || hw->mac_type == e1000_82572) { |
1323 | tarc = E1000_READ_REG(hw, TARC0); | ||
1324 | tarc |= ((1 << 25) | (1 << 21)); | ||
1325 | E1000_WRITE_REG(hw, TARC0, tarc); | ||
1326 | tarc = E1000_READ_REG(hw, TARC1); | ||
1327 | tarc |= (1 << 25); | ||
1328 | if (tctl & E1000_TCTL_MULR) | ||
1329 | tarc &= ~(1 << 28); | ||
1330 | else | ||
1331 | tarc |= (1 << 28); | ||
1332 | E1000_WRITE_REG(hw, TARC1, tarc); | ||
1333 | } | ||
1334 | |||
1335 | e1000_config_collision_dist(hw); | ||
1086 | 1336 | ||
1087 | /* Setup Transmit Descriptor Settings for eop descriptor */ | 1337 | /* Setup Transmit Descriptor Settings for eop descriptor */ |
1088 | adapter->txd_cmd = E1000_TXD_CMD_IDE | E1000_TXD_CMD_EOP | | 1338 | adapter->txd_cmd = E1000_TXD_CMD_IDE | E1000_TXD_CMD_EOP | |
1089 | E1000_TXD_CMD_IFCS; | 1339 | E1000_TXD_CMD_IFCS; |
1090 | 1340 | ||
1091 | if(adapter->hw.mac_type < e1000_82543) | 1341 | if (hw->mac_type < e1000_82543) |
1092 | adapter->txd_cmd |= E1000_TXD_CMD_RPS; | 1342 | adapter->txd_cmd |= E1000_TXD_CMD_RPS; |
1093 | else | 1343 | else |
1094 | adapter->txd_cmd |= E1000_TXD_CMD_RS; | 1344 | adapter->txd_cmd |= E1000_TXD_CMD_RS; |
1095 | 1345 | ||
1096 | /* Cache if we're 82544 running in PCI-X because we'll | 1346 | /* Cache if we're 82544 running in PCI-X because we'll |
1097 | * need this to apply a workaround later in the send path. */ | 1347 | * need this to apply a workaround later in the send path. */ |
1098 | if(adapter->hw.mac_type == e1000_82544 && | 1348 | if (hw->mac_type == e1000_82544 && |
1099 | adapter->hw.bus_type == e1000_bus_type_pcix) | 1349 | hw->bus_type == e1000_bus_type_pcix) |
1100 | adapter->pcix_82544 = 1; | 1350 | adapter->pcix_82544 = 1; |
1101 | } | 1351 | } |
1102 | 1352 | ||
1103 | /** | 1353 | /** |
1104 | * e1000_setup_rx_resources - allocate Rx resources (Descriptors) | 1354 | * e1000_setup_rx_resources - allocate Rx resources (Descriptors) |
1105 | * @adapter: board private structure | 1355 | * @adapter: board private structure |
1356 | * @rxdr: rx descriptor ring (for a specific queue) to setup | ||
1106 | * | 1357 | * |
1107 | * Returns 0 on success, negative on failure | 1358 | * Returns 0 on success, negative on failure |
1108 | **/ | 1359 | **/ |
1109 | 1360 | ||
1110 | int | 1361 | int |
1111 | e1000_setup_rx_resources(struct e1000_adapter *adapter) | 1362 | e1000_setup_rx_resources(struct e1000_adapter *adapter, |
1363 | struct e1000_rx_ring *rxdr) | ||
1112 | { | 1364 | { |
1113 | struct e1000_desc_ring *rxdr = &adapter->rx_ring; | ||
1114 | struct pci_dev *pdev = adapter->pdev; | 1365 | struct pci_dev *pdev = adapter->pdev; |
1115 | int size, desc_len; | 1366 | int size, desc_len; |
1116 | 1367 | ||
1117 | size = sizeof(struct e1000_buffer) * rxdr->count; | 1368 | size = sizeof(struct e1000_buffer) * rxdr->count; |
1118 | rxdr->buffer_info = vmalloc(size); | 1369 | rxdr->buffer_info = vmalloc(size); |
1119 | if(!rxdr->buffer_info) { | 1370 | if (!rxdr->buffer_info) { |
1120 | DPRINTK(PROBE, ERR, | 1371 | DPRINTK(PROBE, ERR, |
1121 | "Unable to allocate memory for the receive descriptor ring\n"); | 1372 | "Unable to allocate memory for the receive descriptor ring\n"); |
1122 | return -ENOMEM; | 1373 | return -ENOMEM; |
@@ -1156,13 +1407,13 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter) | |||
1156 | 1407 | ||
1157 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); | 1408 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); |
1158 | 1409 | ||
1159 | if(!rxdr->desc) { | 1410 | if (!rxdr->desc) { |
1411 | DPRINTK(PROBE, ERR, | ||
1412 | "Unable to allocate memory for the receive descriptor ring\n"); | ||
1160 | setup_rx_desc_die: | 1413 | setup_rx_desc_die: |
1161 | vfree(rxdr->buffer_info); | 1414 | vfree(rxdr->buffer_info); |
1162 | kfree(rxdr->ps_page); | 1415 | kfree(rxdr->ps_page); |
1163 | kfree(rxdr->ps_page_dma); | 1416 | kfree(rxdr->ps_page_dma); |
1164 | DPRINTK(PROBE, ERR, | ||
1165 | "Unable to allocate memory for the receive descriptor ring\n"); | ||
1166 | return -ENOMEM; | 1417 | return -ENOMEM; |
1167 | } | 1418 | } |
1168 | 1419 | ||
@@ -1174,9 +1425,12 @@ setup_rx_desc_die: | |||
1174 | "at %p\n", rxdr->size, rxdr->desc); | 1425 | "at %p\n", rxdr->size, rxdr->desc); |
1175 | /* Try again, without freeing the previous */ | 1426 | /* Try again, without freeing the previous */ |
1176 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); | 1427 | rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); |
1177 | if(!rxdr->desc) { | ||
1178 | /* Failed allocation, critical failure */ | 1428 | /* Failed allocation, critical failure */ |
1429 | if (!rxdr->desc) { | ||
1179 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); | 1430 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); |
1431 | DPRINTK(PROBE, ERR, | ||
1432 | "Unable to allocate memory " | ||
1433 | "for the receive descriptor ring\n"); | ||
1180 | goto setup_rx_desc_die; | 1434 | goto setup_rx_desc_die; |
1181 | } | 1435 | } |
1182 | 1436 | ||
@@ -1188,10 +1442,7 @@ setup_rx_desc_die: | |||
1188 | DPRINTK(PROBE, ERR, | 1442 | DPRINTK(PROBE, ERR, |
1189 | "Unable to allocate aligned memory " | 1443 | "Unable to allocate aligned memory " |
1190 | "for the receive descriptor ring\n"); | 1444 | "for the receive descriptor ring\n"); |
1191 | vfree(rxdr->buffer_info); | 1445 | goto setup_rx_desc_die; |
1192 | kfree(rxdr->ps_page); | ||
1193 | kfree(rxdr->ps_page_dma); | ||
1194 | return -ENOMEM; | ||
1195 | } else { | 1446 | } else { |
1196 | /* Free old allocation, new allocation was successful */ | 1447 | /* Free old allocation, new allocation was successful */ |
1197 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); | 1448 | pci_free_consistent(pdev, rxdr->size, olddesc, olddma); |
@@ -1206,15 +1457,48 @@ setup_rx_desc_die: | |||
1206 | } | 1457 | } |
1207 | 1458 | ||
1208 | /** | 1459 | /** |
1460 | * e1000_setup_all_rx_resources - wrapper to allocate Rx resources | ||
1461 | * (Descriptors) for all queues | ||
1462 | * @adapter: board private structure | ||
1463 | * | ||
1464 | * If this function returns with an error, then it's possible one or | ||
1465 | * more of the rings is populated (while the rest are not). It is the | ||
1466 | * callers duty to clean those orphaned rings. | ||
1467 | * | ||
1468 | * Return 0 on success, negative on failure | ||
1469 | **/ | ||
1470 | |||
1471 | int | ||
1472 | e1000_setup_all_rx_resources(struct e1000_adapter *adapter) | ||
1473 | { | ||
1474 | int i, err = 0; | ||
1475 | |||
1476 | for (i = 0; i < adapter->num_queues; i++) { | ||
1477 | err = e1000_setup_rx_resources(adapter, &adapter->rx_ring[i]); | ||
1478 | if (err) { | ||
1479 | DPRINTK(PROBE, ERR, | ||
1480 | "Allocation for Rx Queue %u failed\n", i); | ||
1481 | break; | ||
1482 | } | ||
1483 | } | ||
1484 | |||
1485 | return err; | ||
1486 | } | ||
1487 | |||
1488 | /** | ||
1209 | * e1000_setup_rctl - configure the receive control registers | 1489 | * e1000_setup_rctl - configure the receive control registers |
1210 | * @adapter: Board private structure | 1490 | * @adapter: Board private structure |
1211 | **/ | 1491 | **/ |
1212 | 1492 | #define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \ | |
1493 | (((S) & (PAGE_SIZE - 1)) ? 1 : 0)) | ||
1213 | static void | 1494 | static void |
1214 | e1000_setup_rctl(struct e1000_adapter *adapter) | 1495 | e1000_setup_rctl(struct e1000_adapter *adapter) |
1215 | { | 1496 | { |
1216 | uint32_t rctl, rfctl; | 1497 | uint32_t rctl, rfctl; |
1217 | uint32_t psrctl = 0; | 1498 | uint32_t psrctl = 0; |
1499 | #ifdef CONFIG_E1000_PACKET_SPLIT | ||
1500 | uint32_t pages = 0; | ||
1501 | #endif | ||
1218 | 1502 | ||
1219 | rctl = E1000_READ_REG(&adapter->hw, RCTL); | 1503 | rctl = E1000_READ_REG(&adapter->hw, RCTL); |
1220 | 1504 | ||
@@ -1235,7 +1519,7 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1235 | rctl |= E1000_RCTL_LPE; | 1519 | rctl |= E1000_RCTL_LPE; |
1236 | 1520 | ||
1237 | /* Setup buffer sizes */ | 1521 | /* Setup buffer sizes */ |
1238 | if(adapter->hw.mac_type == e1000_82573) { | 1522 | if(adapter->hw.mac_type >= e1000_82571) { |
1239 | /* We can now specify buffers in 1K increments. | 1523 | /* We can now specify buffers in 1K increments. |
1240 | * BSIZE and BSEX are ignored in this case. */ | 1524 | * BSIZE and BSEX are ignored in this case. */ |
1241 | rctl |= adapter->rx_buffer_len << 0x11; | 1525 | rctl |= adapter->rx_buffer_len << 0x11; |
@@ -1268,11 +1552,14 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1268 | * followed by the page buffers. Therefore, skb->data is | 1552 | * followed by the page buffers. Therefore, skb->data is |
1269 | * sized to hold the largest protocol header. | 1553 | * sized to hold the largest protocol header. |
1270 | */ | 1554 | */ |
1271 | adapter->rx_ps = (adapter->hw.mac_type > e1000_82547_rev_2) | 1555 | pages = PAGE_USE_COUNT(adapter->netdev->mtu); |
1272 | && (adapter->netdev->mtu | 1556 | if ((adapter->hw.mac_type > e1000_82547_rev_2) && (pages <= 3) && |
1273 | < ((3 * PAGE_SIZE) + adapter->rx_ps_bsize0)); | 1557 | PAGE_SIZE <= 16384) |
1558 | adapter->rx_ps_pages = pages; | ||
1559 | else | ||
1560 | adapter->rx_ps_pages = 0; | ||
1274 | #endif | 1561 | #endif |
1275 | if(adapter->rx_ps) { | 1562 | if (adapter->rx_ps_pages) { |
1276 | /* Configure extra packet-split registers */ | 1563 | /* Configure extra packet-split registers */ |
1277 | rfctl = E1000_READ_REG(&adapter->hw, RFCTL); | 1564 | rfctl = E1000_READ_REG(&adapter->hw, RFCTL); |
1278 | rfctl |= E1000_RFCTL_EXTEN; | 1565 | rfctl |= E1000_RFCTL_EXTEN; |
@@ -1284,12 +1571,19 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1284 | 1571 | ||
1285 | psrctl |= adapter->rx_ps_bsize0 >> | 1572 | psrctl |= adapter->rx_ps_bsize0 >> |
1286 | E1000_PSRCTL_BSIZE0_SHIFT; | 1573 | E1000_PSRCTL_BSIZE0_SHIFT; |
1287 | psrctl |= PAGE_SIZE >> | 1574 | |
1288 | E1000_PSRCTL_BSIZE1_SHIFT; | 1575 | switch (adapter->rx_ps_pages) { |
1289 | psrctl |= PAGE_SIZE << | 1576 | case 3: |
1290 | E1000_PSRCTL_BSIZE2_SHIFT; | 1577 | psrctl |= PAGE_SIZE << |
1291 | psrctl |= PAGE_SIZE << | 1578 | E1000_PSRCTL_BSIZE3_SHIFT; |
1292 | E1000_PSRCTL_BSIZE3_SHIFT; | 1579 | case 2: |
1580 | psrctl |= PAGE_SIZE << | ||
1581 | E1000_PSRCTL_BSIZE2_SHIFT; | ||
1582 | case 1: | ||
1583 | psrctl |= PAGE_SIZE >> | ||
1584 | E1000_PSRCTL_BSIZE1_SHIFT; | ||
1585 | break; | ||
1586 | } | ||
1293 | 1587 | ||
1294 | E1000_WRITE_REG(&adapter->hw, PSRCTL, psrctl); | 1588 | E1000_WRITE_REG(&adapter->hw, PSRCTL, psrctl); |
1295 | } | 1589 | } |
@@ -1307,91 +1601,181 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1307 | static void | 1601 | static void |
1308 | e1000_configure_rx(struct e1000_adapter *adapter) | 1602 | e1000_configure_rx(struct e1000_adapter *adapter) |
1309 | { | 1603 | { |
1310 | uint64_t rdba = adapter->rx_ring.dma; | 1604 | uint64_t rdba; |
1311 | uint32_t rdlen, rctl, rxcsum; | 1605 | struct e1000_hw *hw = &adapter->hw; |
1606 | uint32_t rdlen, rctl, rxcsum, ctrl_ext; | ||
1607 | #ifdef CONFIG_E1000_MQ | ||
1608 | uint32_t reta, mrqc; | ||
1609 | int i; | ||
1610 | #endif | ||
1312 | 1611 | ||
1313 | if(adapter->rx_ps) { | 1612 | if (adapter->rx_ps_pages) { |
1314 | rdlen = adapter->rx_ring.count * | 1613 | rdlen = adapter->rx_ring[0].count * |
1315 | sizeof(union e1000_rx_desc_packet_split); | 1614 | sizeof(union e1000_rx_desc_packet_split); |
1316 | adapter->clean_rx = e1000_clean_rx_irq_ps; | 1615 | adapter->clean_rx = e1000_clean_rx_irq_ps; |
1317 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; | 1616 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; |
1318 | } else { | 1617 | } else { |
1319 | rdlen = adapter->rx_ring.count * sizeof(struct e1000_rx_desc); | 1618 | rdlen = adapter->rx_ring[0].count * |
1619 | sizeof(struct e1000_rx_desc); | ||
1320 | adapter->clean_rx = e1000_clean_rx_irq; | 1620 | adapter->clean_rx = e1000_clean_rx_irq; |
1321 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers; | 1621 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers; |
1322 | } | 1622 | } |
1323 | 1623 | ||
1324 | /* disable receives while setting up the descriptors */ | 1624 | /* disable receives while setting up the descriptors */ |
1325 | rctl = E1000_READ_REG(&adapter->hw, RCTL); | 1625 | rctl = E1000_READ_REG(hw, RCTL); |
1326 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl & ~E1000_RCTL_EN); | 1626 | E1000_WRITE_REG(hw, RCTL, rctl & ~E1000_RCTL_EN); |
1327 | 1627 | ||
1328 | /* set the Receive Delay Timer Register */ | 1628 | /* set the Receive Delay Timer Register */ |
1329 | E1000_WRITE_REG(&adapter->hw, RDTR, adapter->rx_int_delay); | 1629 | E1000_WRITE_REG(hw, RDTR, adapter->rx_int_delay); |
1330 | 1630 | ||
1331 | if(adapter->hw.mac_type >= e1000_82540) { | 1631 | if (hw->mac_type >= e1000_82540) { |
1332 | E1000_WRITE_REG(&adapter->hw, RADV, adapter->rx_abs_int_delay); | 1632 | E1000_WRITE_REG(hw, RADV, adapter->rx_abs_int_delay); |
1333 | if(adapter->itr > 1) | 1633 | if(adapter->itr > 1) |
1334 | E1000_WRITE_REG(&adapter->hw, ITR, | 1634 | E1000_WRITE_REG(hw, ITR, |
1335 | 1000000000 / (adapter->itr * 256)); | 1635 | 1000000000 / (adapter->itr * 256)); |
1336 | } | 1636 | } |
1337 | 1637 | ||
1338 | /* Setup the Base and Length of the Rx Descriptor Ring */ | 1638 | if (hw->mac_type >= e1000_82571) { |
1339 | E1000_WRITE_REG(&adapter->hw, RDBAL, (rdba & 0x00000000ffffffffULL)); | 1639 | /* Reset delay timers after every interrupt */ |
1340 | E1000_WRITE_REG(&adapter->hw, RDBAH, (rdba >> 32)); | 1640 | ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
1641 | ctrl_ext |= E1000_CTRL_EXT_CANC; | ||
1642 | E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); | ||
1643 | E1000_WRITE_FLUSH(hw); | ||
1644 | } | ||
1645 | |||
1646 | /* Setup the HW Rx Head and Tail Descriptor Pointers and | ||
1647 | * the Base and Length of the Rx Descriptor Ring */ | ||
1648 | switch (adapter->num_queues) { | ||
1649 | #ifdef CONFIG_E1000_MQ | ||
1650 | case 2: | ||
1651 | rdba = adapter->rx_ring[1].dma; | ||
1652 | E1000_WRITE_REG(hw, RDBAL1, (rdba & 0x00000000ffffffffULL)); | ||
1653 | E1000_WRITE_REG(hw, RDBAH1, (rdba >> 32)); | ||
1654 | E1000_WRITE_REG(hw, RDLEN1, rdlen); | ||
1655 | E1000_WRITE_REG(hw, RDH1, 0); | ||
1656 | E1000_WRITE_REG(hw, RDT1, 0); | ||
1657 | adapter->rx_ring[1].rdh = E1000_RDH1; | ||
1658 | adapter->rx_ring[1].rdt = E1000_RDT1; | ||
1659 | /* Fall Through */ | ||
1660 | #endif | ||
1661 | case 1: | ||
1662 | default: | ||
1663 | rdba = adapter->rx_ring[0].dma; | ||
1664 | E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL)); | ||
1665 | E1000_WRITE_REG(hw, RDBAH, (rdba >> 32)); | ||
1666 | E1000_WRITE_REG(hw, RDLEN, rdlen); | ||
1667 | E1000_WRITE_REG(hw, RDH, 0); | ||
1668 | E1000_WRITE_REG(hw, RDT, 0); | ||
1669 | adapter->rx_ring[0].rdh = E1000_RDH; | ||
1670 | adapter->rx_ring[0].rdt = E1000_RDT; | ||
1671 | break; | ||
1672 | } | ||
1673 | |||
1674 | #ifdef CONFIG_E1000_MQ | ||
1675 | if (adapter->num_queues > 1) { | ||
1676 | uint32_t random[10]; | ||
1677 | |||
1678 | get_random_bytes(&random[0], 40); | ||
1679 | |||
1680 | if (hw->mac_type <= e1000_82572) { | ||
1681 | E1000_WRITE_REG(hw, RSSIR, 0); | ||
1682 | E1000_WRITE_REG(hw, RSSIM, 0); | ||
1683 | } | ||
1684 | |||
1685 | switch (adapter->num_queues) { | ||
1686 | case 2: | ||
1687 | default: | ||
1688 | reta = 0x00800080; | ||
1689 | mrqc = E1000_MRQC_ENABLE_RSS_2Q; | ||
1690 | break; | ||
1691 | } | ||
1692 | |||
1693 | /* Fill out redirection table */ | ||
1694 | for (i = 0; i < 32; i++) | ||
1695 | E1000_WRITE_REG_ARRAY(hw, RETA, i, reta); | ||
1696 | /* Fill out hash function seeds */ | ||
1697 | for (i = 0; i < 10; i++) | ||
1698 | E1000_WRITE_REG_ARRAY(hw, RSSRK, i, random[i]); | ||
1699 | |||
1700 | mrqc |= (E1000_MRQC_RSS_FIELD_IPV4 | | ||
1701 | E1000_MRQC_RSS_FIELD_IPV4_TCP); | ||
1702 | E1000_WRITE_REG(hw, MRQC, mrqc); | ||
1703 | } | ||
1341 | 1704 | ||
1342 | E1000_WRITE_REG(&adapter->hw, RDLEN, rdlen); | 1705 | /* Multiqueue and packet checksumming are mutually exclusive. */ |
1706 | if (hw->mac_type >= e1000_82571) { | ||
1707 | rxcsum = E1000_READ_REG(hw, RXCSUM); | ||
1708 | rxcsum |= E1000_RXCSUM_PCSD; | ||
1709 | E1000_WRITE_REG(hw, RXCSUM, rxcsum); | ||
1710 | } | ||
1343 | 1711 | ||
1344 | /* Setup the HW Rx Head and Tail Descriptor Pointers */ | 1712 | #else |
1345 | E1000_WRITE_REG(&adapter->hw, RDH, 0); | ||
1346 | E1000_WRITE_REG(&adapter->hw, RDT, 0); | ||
1347 | 1713 | ||
1348 | /* Enable 82543 Receive Checksum Offload for TCP and UDP */ | 1714 | /* Enable 82543 Receive Checksum Offload for TCP and UDP */ |
1349 | if(adapter->hw.mac_type >= e1000_82543) { | 1715 | if (hw->mac_type >= e1000_82543) { |
1350 | rxcsum = E1000_READ_REG(&adapter->hw, RXCSUM); | 1716 | rxcsum = E1000_READ_REG(hw, RXCSUM); |
1351 | if(adapter->rx_csum == TRUE) { | 1717 | if(adapter->rx_csum == TRUE) { |
1352 | rxcsum |= E1000_RXCSUM_TUOFL; | 1718 | rxcsum |= E1000_RXCSUM_TUOFL; |
1353 | 1719 | ||
1354 | /* Enable 82573 IPv4 payload checksum for UDP fragments | 1720 | /* Enable 82571 IPv4 payload checksum for UDP fragments |
1355 | * Must be used in conjunction with packet-split. */ | 1721 | * Must be used in conjunction with packet-split. */ |
1356 | if((adapter->hw.mac_type > e1000_82547_rev_2) && | 1722 | if ((hw->mac_type >= e1000_82571) && |
1357 | (adapter->rx_ps)) { | 1723 | (adapter->rx_ps_pages)) { |
1358 | rxcsum |= E1000_RXCSUM_IPPCSE; | 1724 | rxcsum |= E1000_RXCSUM_IPPCSE; |
1359 | } | 1725 | } |
1360 | } else { | 1726 | } else { |
1361 | rxcsum &= ~E1000_RXCSUM_TUOFL; | 1727 | rxcsum &= ~E1000_RXCSUM_TUOFL; |
1362 | /* don't need to clear IPPCSE as it defaults to 0 */ | 1728 | /* don't need to clear IPPCSE as it defaults to 0 */ |
1363 | } | 1729 | } |
1364 | E1000_WRITE_REG(&adapter->hw, RXCSUM, rxcsum); | 1730 | E1000_WRITE_REG(hw, RXCSUM, rxcsum); |
1365 | } | 1731 | } |
1732 | #endif /* CONFIG_E1000_MQ */ | ||
1366 | 1733 | ||
1367 | if (adapter->hw.mac_type == e1000_82573) | 1734 | if (hw->mac_type == e1000_82573) |
1368 | E1000_WRITE_REG(&adapter->hw, ERT, 0x0100); | 1735 | E1000_WRITE_REG(hw, ERT, 0x0100); |
1369 | 1736 | ||
1370 | /* Enable Receives */ | 1737 | /* Enable Receives */ |
1371 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl); | 1738 | E1000_WRITE_REG(hw, RCTL, rctl); |
1372 | } | 1739 | } |
1373 | 1740 | ||
1374 | /** | 1741 | /** |
1375 | * e1000_free_tx_resources - Free Tx Resources | 1742 | * e1000_free_tx_resources - Free Tx Resources per Queue |
1376 | * @adapter: board private structure | 1743 | * @adapter: board private structure |
1744 | * @tx_ring: Tx descriptor ring for a specific queue | ||
1377 | * | 1745 | * |
1378 | * Free all transmit software resources | 1746 | * Free all transmit software resources |
1379 | **/ | 1747 | **/ |
1380 | 1748 | ||
1381 | void | 1749 | void |
1382 | e1000_free_tx_resources(struct e1000_adapter *adapter) | 1750 | e1000_free_tx_resources(struct e1000_adapter *adapter, |
1751 | struct e1000_tx_ring *tx_ring) | ||
1383 | { | 1752 | { |
1384 | struct pci_dev *pdev = adapter->pdev; | 1753 | struct pci_dev *pdev = adapter->pdev; |
1385 | 1754 | ||
1386 | e1000_clean_tx_ring(adapter); | 1755 | e1000_clean_tx_ring(adapter, tx_ring); |
1756 | |||
1757 | vfree(tx_ring->buffer_info); | ||
1758 | tx_ring->buffer_info = NULL; | ||
1387 | 1759 | ||
1388 | vfree(adapter->tx_ring.buffer_info); | 1760 | pci_free_consistent(pdev, tx_ring->size, tx_ring->desc, tx_ring->dma); |
1389 | adapter->tx_ring.buffer_info = NULL; | 1761 | |
1762 | tx_ring->desc = NULL; | ||
1763 | } | ||
1390 | 1764 | ||
1391 | pci_free_consistent(pdev, adapter->tx_ring.size, | 1765 | /** |
1392 | adapter->tx_ring.desc, adapter->tx_ring.dma); | 1766 | * e1000_free_all_tx_resources - Free Tx Resources for All Queues |
1767 | * @adapter: board private structure | ||
1768 | * | ||
1769 | * Free all transmit software resources | ||
1770 | **/ | ||
1771 | |||
1772 | void | ||
1773 | e1000_free_all_tx_resources(struct e1000_adapter *adapter) | ||
1774 | { | ||
1775 | int i; | ||
1393 | 1776 | ||
1394 | adapter->tx_ring.desc = NULL; | 1777 | for (i = 0; i < adapter->num_queues; i++) |
1778 | e1000_free_tx_resources(adapter, &adapter->tx_ring[i]); | ||
1395 | } | 1779 | } |
1396 | 1780 | ||
1397 | static inline void | 1781 | static inline void |
@@ -1414,21 +1798,22 @@ e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, | |||
1414 | /** | 1798 | /** |
1415 | * e1000_clean_tx_ring - Free Tx Buffers | 1799 | * e1000_clean_tx_ring - Free Tx Buffers |
1416 | * @adapter: board private structure | 1800 | * @adapter: board private structure |
1801 | * @tx_ring: ring to be cleaned | ||
1417 | **/ | 1802 | **/ |
1418 | 1803 | ||
1419 | static void | 1804 | static void |
1420 | e1000_clean_tx_ring(struct e1000_adapter *adapter) | 1805 | e1000_clean_tx_ring(struct e1000_adapter *adapter, |
1806 | struct e1000_tx_ring *tx_ring) | ||
1421 | { | 1807 | { |
1422 | struct e1000_desc_ring *tx_ring = &adapter->tx_ring; | ||
1423 | struct e1000_buffer *buffer_info; | 1808 | struct e1000_buffer *buffer_info; |
1424 | unsigned long size; | 1809 | unsigned long size; |
1425 | unsigned int i; | 1810 | unsigned int i; |
1426 | 1811 | ||
1427 | /* Free all the Tx ring sk_buffs */ | 1812 | /* Free all the Tx ring sk_buffs */ |
1428 | 1813 | ||
1429 | if (likely(adapter->previous_buffer_info.skb != NULL)) { | 1814 | if (likely(tx_ring->previous_buffer_info.skb != NULL)) { |
1430 | e1000_unmap_and_free_tx_resource(adapter, | 1815 | e1000_unmap_and_free_tx_resource(adapter, |
1431 | &adapter->previous_buffer_info); | 1816 | &tx_ring->previous_buffer_info); |
1432 | } | 1817 | } |
1433 | 1818 | ||
1434 | for(i = 0; i < tx_ring->count; i++) { | 1819 | for(i = 0; i < tx_ring->count; i++) { |
@@ -1446,24 +1831,39 @@ e1000_clean_tx_ring(struct e1000_adapter *adapter) | |||
1446 | tx_ring->next_to_use = 0; | 1831 | tx_ring->next_to_use = 0; |
1447 | tx_ring->next_to_clean = 0; | 1832 | tx_ring->next_to_clean = 0; |
1448 | 1833 | ||
1449 | E1000_WRITE_REG(&adapter->hw, TDH, 0); | 1834 | writel(0, adapter->hw.hw_addr + tx_ring->tdh); |
1450 | E1000_WRITE_REG(&adapter->hw, TDT, 0); | 1835 | writel(0, adapter->hw.hw_addr + tx_ring->tdt); |
1836 | } | ||
1837 | |||
1838 | /** | ||
1839 | * e1000_clean_all_tx_rings - Free Tx Buffers for all queues | ||
1840 | * @adapter: board private structure | ||
1841 | **/ | ||
1842 | |||
1843 | static void | ||
1844 | e1000_clean_all_tx_rings(struct e1000_adapter *adapter) | ||
1845 | { | ||
1846 | int i; | ||
1847 | |||
1848 | for (i = 0; i < adapter->num_queues; i++) | ||
1849 | e1000_clean_tx_ring(adapter, &adapter->tx_ring[i]); | ||
1451 | } | 1850 | } |
1452 | 1851 | ||
1453 | /** | 1852 | /** |
1454 | * e1000_free_rx_resources - Free Rx Resources | 1853 | * e1000_free_rx_resources - Free Rx Resources |
1455 | * @adapter: board private structure | 1854 | * @adapter: board private structure |
1855 | * @rx_ring: ring to clean the resources from | ||
1456 | * | 1856 | * |
1457 | * Free all receive software resources | 1857 | * Free all receive software resources |
1458 | **/ | 1858 | **/ |
1459 | 1859 | ||
1460 | void | 1860 | void |
1461 | e1000_free_rx_resources(struct e1000_adapter *adapter) | 1861 | e1000_free_rx_resources(struct e1000_adapter *adapter, |
1862 | struct e1000_rx_ring *rx_ring) | ||
1462 | { | 1863 | { |
1463 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
1464 | struct pci_dev *pdev = adapter->pdev; | 1864 | struct pci_dev *pdev = adapter->pdev; |
1465 | 1865 | ||
1466 | e1000_clean_rx_ring(adapter); | 1866 | e1000_clean_rx_ring(adapter, rx_ring); |
1467 | 1867 | ||
1468 | vfree(rx_ring->buffer_info); | 1868 | vfree(rx_ring->buffer_info); |
1469 | rx_ring->buffer_info = NULL; | 1869 | rx_ring->buffer_info = NULL; |
@@ -1478,14 +1878,31 @@ e1000_free_rx_resources(struct e1000_adapter *adapter) | |||
1478 | } | 1878 | } |
1479 | 1879 | ||
1480 | /** | 1880 | /** |
1481 | * e1000_clean_rx_ring - Free Rx Buffers | 1881 | * e1000_free_all_rx_resources - Free Rx Resources for All Queues |
1882 | * @adapter: board private structure | ||
1883 | * | ||
1884 | * Free all receive software resources | ||
1885 | **/ | ||
1886 | |||
1887 | void | ||
1888 | e1000_free_all_rx_resources(struct e1000_adapter *adapter) | ||
1889 | { | ||
1890 | int i; | ||
1891 | |||
1892 | for (i = 0; i < adapter->num_queues; i++) | ||
1893 | e1000_free_rx_resources(adapter, &adapter->rx_ring[i]); | ||
1894 | } | ||
1895 | |||
1896 | /** | ||
1897 | * e1000_clean_rx_ring - Free Rx Buffers per Queue | ||
1482 | * @adapter: board private structure | 1898 | * @adapter: board private structure |
1899 | * @rx_ring: ring to free buffers from | ||
1483 | **/ | 1900 | **/ |
1484 | 1901 | ||
1485 | static void | 1902 | static void |
1486 | e1000_clean_rx_ring(struct e1000_adapter *adapter) | 1903 | e1000_clean_rx_ring(struct e1000_adapter *adapter, |
1904 | struct e1000_rx_ring *rx_ring) | ||
1487 | { | 1905 | { |
1488 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
1489 | struct e1000_buffer *buffer_info; | 1906 | struct e1000_buffer *buffer_info; |
1490 | struct e1000_ps_page *ps_page; | 1907 | struct e1000_ps_page *ps_page; |
1491 | struct e1000_ps_page_dma *ps_page_dma; | 1908 | struct e1000_ps_page_dma *ps_page_dma; |
@@ -1508,7 +1925,7 @@ e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1508 | dev_kfree_skb(buffer_info->skb); | 1925 | dev_kfree_skb(buffer_info->skb); |
1509 | buffer_info->skb = NULL; | 1926 | buffer_info->skb = NULL; |
1510 | 1927 | ||
1511 | for(j = 0; j < PS_PAGE_BUFFERS; j++) { | 1928 | for(j = 0; j < adapter->rx_ps_pages; j++) { |
1512 | if(!ps_page->ps_page[j]) break; | 1929 | if(!ps_page->ps_page[j]) break; |
1513 | pci_unmap_single(pdev, | 1930 | pci_unmap_single(pdev, |
1514 | ps_page_dma->ps_page_dma[j], | 1931 | ps_page_dma->ps_page_dma[j], |
@@ -1534,8 +1951,22 @@ e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
1534 | rx_ring->next_to_clean = 0; | 1951 | rx_ring->next_to_clean = 0; |
1535 | rx_ring->next_to_use = 0; | 1952 | rx_ring->next_to_use = 0; |
1536 | 1953 | ||
1537 | E1000_WRITE_REG(&adapter->hw, RDH, 0); | 1954 | writel(0, adapter->hw.hw_addr + rx_ring->rdh); |
1538 | E1000_WRITE_REG(&adapter->hw, RDT, 0); | 1955 | writel(0, adapter->hw.hw_addr + rx_ring->rdt); |
1956 | } | ||
1957 | |||
1958 | /** | ||
1959 | * e1000_clean_all_rx_rings - Free Rx Buffers for all queues | ||
1960 | * @adapter: board private structure | ||
1961 | **/ | ||
1962 | |||
1963 | static void | ||
1964 | e1000_clean_all_rx_rings(struct e1000_adapter *adapter) | ||
1965 | { | ||
1966 | int i; | ||
1967 | |||
1968 | for (i = 0; i < adapter->num_queues; i++) | ||
1969 | e1000_clean_rx_ring(adapter, &adapter->rx_ring[i]); | ||
1539 | } | 1970 | } |
1540 | 1971 | ||
1541 | /* The 82542 2.0 (revision 2) needs to have the receive unit in reset | 1972 | /* The 82542 2.0 (revision 2) needs to have the receive unit in reset |
@@ -1556,7 +1987,7 @@ e1000_enter_82542_rst(struct e1000_adapter *adapter) | |||
1556 | mdelay(5); | 1987 | mdelay(5); |
1557 | 1988 | ||
1558 | if(netif_running(netdev)) | 1989 | if(netif_running(netdev)) |
1559 | e1000_clean_rx_ring(adapter); | 1990 | e1000_clean_all_rx_rings(adapter); |
1560 | } | 1991 | } |
1561 | 1992 | ||
1562 | static void | 1993 | static void |
@@ -1576,7 +2007,7 @@ e1000_leave_82542_rst(struct e1000_adapter *adapter) | |||
1576 | 2007 | ||
1577 | if(netif_running(netdev)) { | 2008 | if(netif_running(netdev)) { |
1578 | e1000_configure_rx(adapter); | 2009 | e1000_configure_rx(adapter); |
1579 | e1000_alloc_rx_buffers(adapter); | 2010 | e1000_alloc_rx_buffers(adapter, &adapter->rx_ring[0]); |
1580 | } | 2011 | } |
1581 | } | 2012 | } |
1582 | 2013 | ||
@@ -1607,6 +2038,22 @@ e1000_set_mac(struct net_device *netdev, void *p) | |||
1607 | 2038 | ||
1608 | e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0); | 2039 | e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0); |
1609 | 2040 | ||
2041 | /* With 82571 controllers, LAA may be overwritten (with the default) | ||
2042 | * due to controller reset from the other port. */ | ||
2043 | if (adapter->hw.mac_type == e1000_82571) { | ||
2044 | /* activate the work around */ | ||
2045 | adapter->hw.laa_is_present = 1; | ||
2046 | |||
2047 | /* Hold a copy of the LAA in RAR[14] This is done so that | ||
2048 | * between the time RAR[0] gets clobbered and the time it | ||
2049 | * gets fixed (in e1000_watchdog), the actual LAA is in one | ||
2050 | * of the RARs and no incoming packets directed to this port | ||
2051 | * are dropped. Eventaully the LAA will be in RAR[0] and | ||
2052 | * RAR[14] */ | ||
2053 | e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, | ||
2054 | E1000_RAR_ENTRIES - 1); | ||
2055 | } | ||
2056 | |||
1610 | if(adapter->hw.mac_type == e1000_82542_rev2_0) | 2057 | if(adapter->hw.mac_type == e1000_82542_rev2_0) |
1611 | e1000_leave_82542_rst(adapter); | 2058 | e1000_leave_82542_rst(adapter); |
1612 | 2059 | ||
@@ -1629,12 +2076,13 @@ e1000_set_multi(struct net_device *netdev) | |||
1629 | struct e1000_adapter *adapter = netdev_priv(netdev); | 2076 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1630 | struct e1000_hw *hw = &adapter->hw; | 2077 | struct e1000_hw *hw = &adapter->hw; |
1631 | struct dev_mc_list *mc_ptr; | 2078 | struct dev_mc_list *mc_ptr; |
1632 | unsigned long flags; | ||
1633 | uint32_t rctl; | 2079 | uint32_t rctl; |
1634 | uint32_t hash_value; | 2080 | uint32_t hash_value; |
1635 | int i; | 2081 | int i, rar_entries = E1000_RAR_ENTRIES; |
1636 | 2082 | ||
1637 | spin_lock_irqsave(&adapter->tx_lock, flags); | 2083 | /* reserve RAR[14] for LAA over-write work-around */ |
2084 | if (adapter->hw.mac_type == e1000_82571) | ||
2085 | rar_entries--; | ||
1638 | 2086 | ||
1639 | /* Check for Promiscuous and All Multicast modes */ | 2087 | /* Check for Promiscuous and All Multicast modes */ |
1640 | 2088 | ||
@@ -1659,11 +2107,12 @@ e1000_set_multi(struct net_device *netdev) | |||
1659 | /* load the first 14 multicast address into the exact filters 1-14 | 2107 | /* load the first 14 multicast address into the exact filters 1-14 |
1660 | * RAR 0 is used for the station MAC adddress | 2108 | * RAR 0 is used for the station MAC adddress |
1661 | * if there are not 14 addresses, go ahead and clear the filters | 2109 | * if there are not 14 addresses, go ahead and clear the filters |
2110 | * -- with 82571 controllers only 0-13 entries are filled here | ||
1662 | */ | 2111 | */ |
1663 | mc_ptr = netdev->mc_list; | 2112 | mc_ptr = netdev->mc_list; |
1664 | 2113 | ||
1665 | for(i = 1; i < E1000_RAR_ENTRIES; i++) { | 2114 | for(i = 1; i < rar_entries; i++) { |
1666 | if(mc_ptr) { | 2115 | if (mc_ptr) { |
1667 | e1000_rar_set(hw, mc_ptr->dmi_addr, i); | 2116 | e1000_rar_set(hw, mc_ptr->dmi_addr, i); |
1668 | mc_ptr = mc_ptr->next; | 2117 | mc_ptr = mc_ptr->next; |
1669 | } else { | 2118 | } else { |
@@ -1686,8 +2135,6 @@ e1000_set_multi(struct net_device *netdev) | |||
1686 | 2135 | ||
1687 | if(hw->mac_type == e1000_82542_rev2_0) | 2136 | if(hw->mac_type == e1000_82542_rev2_0) |
1688 | e1000_leave_82542_rst(adapter); | 2137 | e1000_leave_82542_rst(adapter); |
1689 | |||
1690 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | ||
1691 | } | 2138 | } |
1692 | 2139 | ||
1693 | /* Need to wait a few seconds after link up to get diagnostic information from | 2140 | /* Need to wait a few seconds after link up to get diagnostic information from |
@@ -1759,7 +2206,7 @@ static void | |||
1759 | e1000_watchdog_task(struct e1000_adapter *adapter) | 2206 | e1000_watchdog_task(struct e1000_adapter *adapter) |
1760 | { | 2207 | { |
1761 | struct net_device *netdev = adapter->netdev; | 2208 | struct net_device *netdev = adapter->netdev; |
1762 | struct e1000_desc_ring *txdr = &adapter->tx_ring; | 2209 | struct e1000_tx_ring *txdr = &adapter->tx_ring[0]; |
1763 | uint32_t link; | 2210 | uint32_t link; |
1764 | 2211 | ||
1765 | e1000_check_for_link(&adapter->hw); | 2212 | e1000_check_for_link(&adapter->hw); |
@@ -1818,8 +2265,8 @@ e1000_watchdog_task(struct e1000_adapter *adapter) | |||
1818 | 2265 | ||
1819 | e1000_update_adaptive(&adapter->hw); | 2266 | e1000_update_adaptive(&adapter->hw); |
1820 | 2267 | ||
1821 | if(!netif_carrier_ok(netdev)) { | 2268 | if (adapter->num_queues == 1 && !netif_carrier_ok(netdev)) { |
1822 | if(E1000_DESC_UNUSED(txdr) + 1 < txdr->count) { | 2269 | if (E1000_DESC_UNUSED(txdr) + 1 < txdr->count) { |
1823 | /* We've lost link, so the controller stops DMA, | 2270 | /* We've lost link, so the controller stops DMA, |
1824 | * but we've got queued Tx work that's never going | 2271 | * but we've got queued Tx work that's never going |
1825 | * to get done, so reset controller to flush Tx. | 2272 | * to get done, so reset controller to flush Tx. |
@@ -1847,6 +2294,11 @@ e1000_watchdog_task(struct e1000_adapter *adapter) | |||
1847 | /* Force detection of hung controller every watchdog period */ | 2294 | /* Force detection of hung controller every watchdog period */ |
1848 | adapter->detect_tx_hung = TRUE; | 2295 | adapter->detect_tx_hung = TRUE; |
1849 | 2296 | ||
2297 | /* With 82571 controllers, LAA may be overwritten due to controller | ||
2298 | * reset from the other port. Set the appropriate LAA in RAR[0] */ | ||
2299 | if (adapter->hw.mac_type == e1000_82571 && adapter->hw.laa_is_present) | ||
2300 | e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0); | ||
2301 | |||
1850 | /* Reset the timer */ | 2302 | /* Reset the timer */ |
1851 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | 2303 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); |
1852 | } | 2304 | } |
@@ -1859,7 +2311,8 @@ e1000_watchdog_task(struct e1000_adapter *adapter) | |||
1859 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 | 2311 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 |
1860 | 2312 | ||
1861 | static inline int | 2313 | static inline int |
1862 | e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb) | 2314 | e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
2315 | struct sk_buff *skb) | ||
1863 | { | 2316 | { |
1864 | #ifdef NETIF_F_TSO | 2317 | #ifdef NETIF_F_TSO |
1865 | struct e1000_context_desc *context_desc; | 2318 | struct e1000_context_desc *context_desc; |
@@ -1910,8 +2363,8 @@ e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1910 | cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | | 2363 | cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | |
1911 | E1000_TXD_CMD_TCP | (skb->len - (hdr_len))); | 2364 | E1000_TXD_CMD_TCP | (skb->len - (hdr_len))); |
1912 | 2365 | ||
1913 | i = adapter->tx_ring.next_to_use; | 2366 | i = tx_ring->next_to_use; |
1914 | context_desc = E1000_CONTEXT_DESC(adapter->tx_ring, i); | 2367 | context_desc = E1000_CONTEXT_DESC(*tx_ring, i); |
1915 | 2368 | ||
1916 | context_desc->lower_setup.ip_fields.ipcss = ipcss; | 2369 | context_desc->lower_setup.ip_fields.ipcss = ipcss; |
1917 | context_desc->lower_setup.ip_fields.ipcso = ipcso; | 2370 | context_desc->lower_setup.ip_fields.ipcso = ipcso; |
@@ -1923,8 +2376,8 @@ e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1923 | context_desc->tcp_seg_setup.fields.hdr_len = hdr_len; | 2376 | context_desc->tcp_seg_setup.fields.hdr_len = hdr_len; |
1924 | context_desc->cmd_and_length = cpu_to_le32(cmd_length); | 2377 | context_desc->cmd_and_length = cpu_to_le32(cmd_length); |
1925 | 2378 | ||
1926 | if(++i == adapter->tx_ring.count) i = 0; | 2379 | if (++i == tx_ring->count) i = 0; |
1927 | adapter->tx_ring.next_to_use = i; | 2380 | tx_ring->next_to_use = i; |
1928 | 2381 | ||
1929 | return 1; | 2382 | return 1; |
1930 | } | 2383 | } |
@@ -1934,7 +2387,8 @@ e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1934 | } | 2387 | } |
1935 | 2388 | ||
1936 | static inline boolean_t | 2389 | static inline boolean_t |
1937 | e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb) | 2390 | e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
2391 | struct sk_buff *skb) | ||
1938 | { | 2392 | { |
1939 | struct e1000_context_desc *context_desc; | 2393 | struct e1000_context_desc *context_desc; |
1940 | unsigned int i; | 2394 | unsigned int i; |
@@ -1943,8 +2397,8 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1943 | if(likely(skb->ip_summed == CHECKSUM_HW)) { | 2397 | if(likely(skb->ip_summed == CHECKSUM_HW)) { |
1944 | css = skb->h.raw - skb->data; | 2398 | css = skb->h.raw - skb->data; |
1945 | 2399 | ||
1946 | i = adapter->tx_ring.next_to_use; | 2400 | i = tx_ring->next_to_use; |
1947 | context_desc = E1000_CONTEXT_DESC(adapter->tx_ring, i); | 2401 | context_desc = E1000_CONTEXT_DESC(*tx_ring, i); |
1948 | 2402 | ||
1949 | context_desc->upper_setup.tcp_fields.tucss = css; | 2403 | context_desc->upper_setup.tcp_fields.tucss = css; |
1950 | context_desc->upper_setup.tcp_fields.tucso = css + skb->csum; | 2404 | context_desc->upper_setup.tcp_fields.tucso = css + skb->csum; |
@@ -1952,8 +2406,8 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1952 | context_desc->tcp_seg_setup.data = 0; | 2406 | context_desc->tcp_seg_setup.data = 0; |
1953 | context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT); | 2407 | context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT); |
1954 | 2408 | ||
1955 | if(unlikely(++i == adapter->tx_ring.count)) i = 0; | 2409 | if (unlikely(++i == tx_ring->count)) i = 0; |
1956 | adapter->tx_ring.next_to_use = i; | 2410 | tx_ring->next_to_use = i; |
1957 | 2411 | ||
1958 | return TRUE; | 2412 | return TRUE; |
1959 | } | 2413 | } |
@@ -1965,11 +2419,10 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb) | |||
1965 | #define E1000_MAX_DATA_PER_TXD (1<<E1000_MAX_TXD_PWR) | 2419 | #define E1000_MAX_DATA_PER_TXD (1<<E1000_MAX_TXD_PWR) |
1966 | 2420 | ||
1967 | static inline int | 2421 | static inline int |
1968 | e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb, | 2422 | e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
1969 | unsigned int first, unsigned int max_per_txd, | 2423 | struct sk_buff *skb, unsigned int first, unsigned int max_per_txd, |
1970 | unsigned int nr_frags, unsigned int mss) | 2424 | unsigned int nr_frags, unsigned int mss) |
1971 | { | 2425 | { |
1972 | struct e1000_desc_ring *tx_ring = &adapter->tx_ring; | ||
1973 | struct e1000_buffer *buffer_info; | 2426 | struct e1000_buffer *buffer_info; |
1974 | unsigned int len = skb->len; | 2427 | unsigned int len = skb->len; |
1975 | unsigned int offset = 0, size, count = 0, i; | 2428 | unsigned int offset = 0, size, count = 0, i; |
@@ -2065,9 +2518,9 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb, | |||
2065 | } | 2518 | } |
2066 | 2519 | ||
2067 | static inline void | 2520 | static inline void |
2068 | e1000_tx_queue(struct e1000_adapter *adapter, int count, int tx_flags) | 2521 | e1000_tx_queue(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, |
2522 | int tx_flags, int count) | ||
2069 | { | 2523 | { |
2070 | struct e1000_desc_ring *tx_ring = &adapter->tx_ring; | ||
2071 | struct e1000_tx_desc *tx_desc = NULL; | 2524 | struct e1000_tx_desc *tx_desc = NULL; |
2072 | struct e1000_buffer *buffer_info; | 2525 | struct e1000_buffer *buffer_info; |
2073 | uint32_t txd_upper = 0, txd_lower = E1000_TXD_CMD_IFCS; | 2526 | uint32_t txd_upper = 0, txd_lower = E1000_TXD_CMD_IFCS; |
@@ -2113,7 +2566,7 @@ e1000_tx_queue(struct e1000_adapter *adapter, int count, int tx_flags) | |||
2113 | wmb(); | 2566 | wmb(); |
2114 | 2567 | ||
2115 | tx_ring->next_to_use = i; | 2568 | tx_ring->next_to_use = i; |
2116 | E1000_WRITE_REG(&adapter->hw, TDT, i); | 2569 | writel(i, adapter->hw.hw_addr + tx_ring->tdt); |
2117 | } | 2570 | } |
2118 | 2571 | ||
2119 | /** | 2572 | /** |
@@ -2206,6 +2659,7 @@ static int | |||
2206 | e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | 2659 | e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
2207 | { | 2660 | { |
2208 | struct e1000_adapter *adapter = netdev_priv(netdev); | 2661 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2662 | struct e1000_tx_ring *tx_ring; | ||
2209 | unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD; | 2663 | unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD; |
2210 | unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; | 2664 | unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; |
2211 | unsigned int tx_flags = 0; | 2665 | unsigned int tx_flags = 0; |
@@ -2218,7 +2672,13 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2218 | unsigned int f; | 2672 | unsigned int f; |
2219 | len -= skb->data_len; | 2673 | len -= skb->data_len; |
2220 | 2674 | ||
2221 | if(unlikely(skb->len <= 0)) { | 2675 | #ifdef CONFIG_E1000_MQ |
2676 | tx_ring = *per_cpu_ptr(adapter->cpu_tx_ring, smp_processor_id()); | ||
2677 | #else | ||
2678 | tx_ring = adapter->tx_ring; | ||
2679 | #endif | ||
2680 | |||
2681 | if (unlikely(skb->len <= 0)) { | ||
2222 | dev_kfree_skb_any(skb); | 2682 | dev_kfree_skb_any(skb); |
2223 | return NETDEV_TX_OK; | 2683 | return NETDEV_TX_OK; |
2224 | } | 2684 | } |
@@ -2262,21 +2722,42 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2262 | if(adapter->pcix_82544) | 2722 | if(adapter->pcix_82544) |
2263 | count += nr_frags; | 2723 | count += nr_frags; |
2264 | 2724 | ||
2265 | local_irq_save(flags); | 2725 | #ifdef NETIF_F_TSO |
2266 | if (!spin_trylock(&adapter->tx_lock)) { | 2726 | /* TSO Workaround for 82571/2 Controllers -- if skb->data |
2267 | /* Collision - tell upper layer to requeue */ | 2727 | * points to just header, pull a few bytes of payload from |
2268 | local_irq_restore(flags); | 2728 | * frags into skb->data */ |
2269 | return NETDEV_TX_LOCKED; | 2729 | if (skb_shinfo(skb)->tso_size) { |
2270 | } | 2730 | uint8_t hdr_len; |
2731 | hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); | ||
2732 | if (skb->data_len && (hdr_len < (skb->len - skb->data_len)) && | ||
2733 | (adapter->hw.mac_type == e1000_82571 || | ||
2734 | adapter->hw.mac_type == e1000_82572)) { | ||
2735 | unsigned int pull_size; | ||
2736 | pull_size = min((unsigned int)4, skb->data_len); | ||
2737 | if (!__pskb_pull_tail(skb, pull_size)) { | ||
2738 | printk(KERN_ERR "__pskb_pull_tail failed.\n"); | ||
2739 | dev_kfree_skb_any(skb); | ||
2740 | return -EFAULT; | ||
2741 | } | ||
2742 | } | ||
2743 | } | ||
2744 | #endif | ||
2745 | |||
2271 | if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) ) | 2746 | if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) ) |
2272 | e1000_transfer_dhcp_info(adapter, skb); | 2747 | e1000_transfer_dhcp_info(adapter, skb); |
2273 | 2748 | ||
2749 | local_irq_save(flags); | ||
2750 | if (!spin_trylock(&tx_ring->tx_lock)) { | ||
2751 | /* Collision - tell upper layer to requeue */ | ||
2752 | local_irq_restore(flags); | ||
2753 | return NETDEV_TX_LOCKED; | ||
2754 | } | ||
2274 | 2755 | ||
2275 | /* need: count + 2 desc gap to keep tail from touching | 2756 | /* need: count + 2 desc gap to keep tail from touching |
2276 | * head, otherwise try next time */ | 2757 | * head, otherwise try next time */ |
2277 | if(unlikely(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2)) { | 2758 | if (unlikely(E1000_DESC_UNUSED(tx_ring) < count + 2)) { |
2278 | netif_stop_queue(netdev); | 2759 | netif_stop_queue(netdev); |
2279 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | 2760 | spin_unlock_irqrestore(&tx_ring->tx_lock, flags); |
2280 | return NETDEV_TX_BUSY; | 2761 | return NETDEV_TX_BUSY; |
2281 | } | 2762 | } |
2282 | 2763 | ||
@@ -2284,7 +2765,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2284 | if(unlikely(e1000_82547_fifo_workaround(adapter, skb))) { | 2765 | if(unlikely(e1000_82547_fifo_workaround(adapter, skb))) { |
2285 | netif_stop_queue(netdev); | 2766 | netif_stop_queue(netdev); |
2286 | mod_timer(&adapter->tx_fifo_stall_timer, jiffies); | 2767 | mod_timer(&adapter->tx_fifo_stall_timer, jiffies); |
2287 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | 2768 | spin_unlock_irqrestore(&tx_ring->tx_lock, flags); |
2288 | return NETDEV_TX_BUSY; | 2769 | return NETDEV_TX_BUSY; |
2289 | } | 2770 | } |
2290 | } | 2771 | } |
@@ -2294,37 +2775,37 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2294 | tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT); | 2775 | tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT); |
2295 | } | 2776 | } |
2296 | 2777 | ||
2297 | first = adapter->tx_ring.next_to_use; | 2778 | first = tx_ring->next_to_use; |
2298 | 2779 | ||
2299 | tso = e1000_tso(adapter, skb); | 2780 | tso = e1000_tso(adapter, tx_ring, skb); |
2300 | if (tso < 0) { | 2781 | if (tso < 0) { |
2301 | dev_kfree_skb_any(skb); | 2782 | dev_kfree_skb_any(skb); |
2302 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | 2783 | spin_unlock_irqrestore(&tx_ring->tx_lock, flags); |
2303 | return NETDEV_TX_OK; | 2784 | return NETDEV_TX_OK; |
2304 | } | 2785 | } |
2305 | 2786 | ||
2306 | if (likely(tso)) | 2787 | if (likely(tso)) |
2307 | tx_flags |= E1000_TX_FLAGS_TSO; | 2788 | tx_flags |= E1000_TX_FLAGS_TSO; |
2308 | else if(likely(e1000_tx_csum(adapter, skb))) | 2789 | else if (likely(e1000_tx_csum(adapter, tx_ring, skb))) |
2309 | tx_flags |= E1000_TX_FLAGS_CSUM; | 2790 | tx_flags |= E1000_TX_FLAGS_CSUM; |
2310 | 2791 | ||
2311 | /* Old method was to assume IPv4 packet by default if TSO was enabled. | 2792 | /* Old method was to assume IPv4 packet by default if TSO was enabled. |
2312 | * 82573 hardware supports TSO capabilities for IPv6 as well... | 2793 | * 82571 hardware supports TSO capabilities for IPv6 as well... |
2313 | * no longer assume, we must. */ | 2794 | * no longer assume, we must. */ |
2314 | if(likely(skb->protocol == ntohs(ETH_P_IP))) | 2795 | if (likely(skb->protocol == ntohs(ETH_P_IP))) |
2315 | tx_flags |= E1000_TX_FLAGS_IPV4; | 2796 | tx_flags |= E1000_TX_FLAGS_IPV4; |
2316 | 2797 | ||
2317 | e1000_tx_queue(adapter, | 2798 | e1000_tx_queue(adapter, tx_ring, tx_flags, |
2318 | e1000_tx_map(adapter, skb, first, max_per_txd, nr_frags, mss), | 2799 | e1000_tx_map(adapter, tx_ring, skb, first, |
2319 | tx_flags); | 2800 | max_per_txd, nr_frags, mss)); |
2320 | 2801 | ||
2321 | netdev->trans_start = jiffies; | 2802 | netdev->trans_start = jiffies; |
2322 | 2803 | ||
2323 | /* Make sure there is space in the ring for the next send. */ | 2804 | /* Make sure there is space in the ring for the next send. */ |
2324 | if(unlikely(E1000_DESC_UNUSED(&adapter->tx_ring) < MAX_SKB_FRAGS + 2)) | 2805 | if (unlikely(E1000_DESC_UNUSED(tx_ring) < MAX_SKB_FRAGS + 2)) |
2325 | netif_stop_queue(netdev); | 2806 | netif_stop_queue(netdev); |
2326 | 2807 | ||
2327 | spin_unlock_irqrestore(&adapter->tx_lock, flags); | 2808 | spin_unlock_irqrestore(&tx_ring->tx_lock, flags); |
2328 | return NETDEV_TX_OK; | 2809 | return NETDEV_TX_OK; |
2329 | } | 2810 | } |
2330 | 2811 | ||
@@ -2388,9 +2869,18 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
2388 | return -EINVAL; | 2869 | return -EINVAL; |
2389 | } | 2870 | } |
2390 | 2871 | ||
2391 | #define MAX_STD_JUMBO_FRAME_SIZE 9216 | 2872 | #define MAX_STD_JUMBO_FRAME_SIZE 9234 |
2392 | /* might want this to be bigger enum check... */ | 2873 | /* might want this to be bigger enum check... */ |
2393 | if (adapter->hw.mac_type == e1000_82573 && | 2874 | /* 82571 controllers limit jumbo frame size to 10500 bytes */ |
2875 | if ((adapter->hw.mac_type == e1000_82571 || | ||
2876 | adapter->hw.mac_type == e1000_82572) && | ||
2877 | max_frame > MAX_STD_JUMBO_FRAME_SIZE) { | ||
2878 | DPRINTK(PROBE, ERR, "MTU > 9216 bytes not supported " | ||
2879 | "on 82571 and 82572 controllers.\n"); | ||
2880 | return -EINVAL; | ||
2881 | } | ||
2882 | |||
2883 | if(adapter->hw.mac_type == e1000_82573 && | ||
2394 | max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { | 2884 | max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { |
2395 | DPRINTK(PROBE, ERR, "Jumbo Frames not supported " | 2885 | DPRINTK(PROBE, ERR, "Jumbo Frames not supported " |
2396 | "on 82573\n"); | 2886 | "on 82573\n"); |
@@ -2578,6 +3068,29 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
2578 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | 3068 | spin_unlock_irqrestore(&adapter->stats_lock, flags); |
2579 | } | 3069 | } |
2580 | 3070 | ||
3071 | #ifdef CONFIG_E1000_MQ | ||
3072 | void | ||
3073 | e1000_rx_schedule(void *data) | ||
3074 | { | ||
3075 | struct net_device *poll_dev, *netdev = data; | ||
3076 | struct e1000_adapter *adapter = netdev->priv; | ||
3077 | int this_cpu = get_cpu(); | ||
3078 | |||
3079 | poll_dev = *per_cpu_ptr(adapter->cpu_netdev, this_cpu); | ||
3080 | if (poll_dev == NULL) { | ||
3081 | put_cpu(); | ||
3082 | return; | ||
3083 | } | ||
3084 | |||
3085 | if (likely(netif_rx_schedule_prep(poll_dev))) | ||
3086 | __netif_rx_schedule(poll_dev); | ||
3087 | else | ||
3088 | e1000_irq_enable(adapter); | ||
3089 | |||
3090 | put_cpu(); | ||
3091 | } | ||
3092 | #endif | ||
3093 | |||
2581 | /** | 3094 | /** |
2582 | * e1000_intr - Interrupt Handler | 3095 | * e1000_intr - Interrupt Handler |
2583 | * @irq: interrupt number | 3096 | * @irq: interrupt number |
@@ -2592,8 +3105,8 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) | |||
2592 | struct e1000_adapter *adapter = netdev_priv(netdev); | 3105 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2593 | struct e1000_hw *hw = &adapter->hw; | 3106 | struct e1000_hw *hw = &adapter->hw; |
2594 | uint32_t icr = E1000_READ_REG(hw, ICR); | 3107 | uint32_t icr = E1000_READ_REG(hw, ICR); |
2595 | #ifndef CONFIG_E1000_NAPI | 3108 | #if defined(CONFIG_E1000_NAPI) && defined(CONFIG_E1000_MQ) || !defined(CONFIG_E1000_NAPI) |
2596 | unsigned int i; | 3109 | int i; |
2597 | #endif | 3110 | #endif |
2598 | 3111 | ||
2599 | if(unlikely(!icr)) | 3112 | if(unlikely(!icr)) |
@@ -2605,17 +3118,31 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) | |||
2605 | } | 3118 | } |
2606 | 3119 | ||
2607 | #ifdef CONFIG_E1000_NAPI | 3120 | #ifdef CONFIG_E1000_NAPI |
2608 | if(likely(netif_rx_schedule_prep(netdev))) { | 3121 | atomic_inc(&adapter->irq_sem); |
2609 | 3122 | E1000_WRITE_REG(hw, IMC, ~0); | |
2610 | /* Disable interrupts and register for poll. The flush | 3123 | E1000_WRITE_FLUSH(hw); |
2611 | of the posted write is intentionally left out. | 3124 | #ifdef CONFIG_E1000_MQ |
2612 | */ | 3125 | if (atomic_read(&adapter->rx_sched_call_data.count) == 0) { |
2613 | 3126 | cpu_set(adapter->cpu_for_queue[0], | |
2614 | atomic_inc(&adapter->irq_sem); | 3127 | adapter->rx_sched_call_data.cpumask); |
2615 | E1000_WRITE_REG(hw, IMC, ~0); | 3128 | for (i = 1; i < adapter->num_queues; i++) { |
2616 | __netif_rx_schedule(netdev); | 3129 | cpu_set(adapter->cpu_for_queue[i], |
3130 | adapter->rx_sched_call_data.cpumask); | ||
3131 | atomic_inc(&adapter->irq_sem); | ||
3132 | } | ||
3133 | atomic_set(&adapter->rx_sched_call_data.count, i); | ||
3134 | smp_call_async_mask(&adapter->rx_sched_call_data); | ||
3135 | } else { | ||
3136 | printk("call_data.count == %u\n", atomic_read(&adapter->rx_sched_call_data.count)); | ||
2617 | } | 3137 | } |
2618 | #else | 3138 | #else /* if !CONFIG_E1000_MQ */ |
3139 | if (likely(netif_rx_schedule_prep(&adapter->polling_netdev[0]))) | ||
3140 | __netif_rx_schedule(&adapter->polling_netdev[0]); | ||
3141 | else | ||
3142 | e1000_irq_enable(adapter); | ||
3143 | #endif /* CONFIG_E1000_MQ */ | ||
3144 | |||
3145 | #else /* if !CONFIG_E1000_NAPI */ | ||
2619 | /* Writing IMC and IMS is needed for 82547. | 3146 | /* Writing IMC and IMS is needed for 82547. |
2620 | Due to Hub Link bus being occupied, an interrupt | 3147 | Due to Hub Link bus being occupied, an interrupt |
2621 | de-assertion message is not able to be sent. | 3148 | de-assertion message is not able to be sent. |
@@ -2632,13 +3159,14 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) | |||
2632 | } | 3159 | } |
2633 | 3160 | ||
2634 | for(i = 0; i < E1000_MAX_INTR; i++) | 3161 | for(i = 0; i < E1000_MAX_INTR; i++) |
2635 | if(unlikely(!adapter->clean_rx(adapter) & | 3162 | if(unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
2636 | !e1000_clean_tx_irq(adapter))) | 3163 | !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
2637 | break; | 3164 | break; |
2638 | 3165 | ||
2639 | if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) | 3166 | if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) |
2640 | e1000_irq_enable(adapter); | 3167 | e1000_irq_enable(adapter); |
2641 | #endif | 3168 | |
3169 | #endif /* CONFIG_E1000_NAPI */ | ||
2642 | 3170 | ||
2643 | return IRQ_HANDLED; | 3171 | return IRQ_HANDLED; |
2644 | } | 3172 | } |
@@ -2650,22 +3178,37 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) | |||
2650 | **/ | 3178 | **/ |
2651 | 3179 | ||
2652 | static int | 3180 | static int |
2653 | e1000_clean(struct net_device *netdev, int *budget) | 3181 | e1000_clean(struct net_device *poll_dev, int *budget) |
2654 | { | 3182 | { |
2655 | struct e1000_adapter *adapter = netdev_priv(netdev); | 3183 | struct e1000_adapter *adapter; |
2656 | int work_to_do = min(*budget, netdev->quota); | 3184 | int work_to_do = min(*budget, poll_dev->quota); |
2657 | int tx_cleaned; | 3185 | int tx_cleaned, i = 0, work_done = 0; |
2658 | int work_done = 0; | ||
2659 | 3186 | ||
2660 | tx_cleaned = e1000_clean_tx_irq(adapter); | 3187 | /* Must NOT use netdev_priv macro here. */ |
2661 | adapter->clean_rx(adapter, &work_done, work_to_do); | 3188 | adapter = poll_dev->priv; |
3189 | |||
3190 | /* Keep link state information with original netdev */ | ||
3191 | if (!netif_carrier_ok(adapter->netdev)) | ||
3192 | goto quit_polling; | ||
3193 | |||
3194 | while (poll_dev != &adapter->polling_netdev[i]) { | ||
3195 | i++; | ||
3196 | if (unlikely(i == adapter->num_queues)) | ||
3197 | BUG(); | ||
3198 | } | ||
3199 | |||
3200 | tx_cleaned = e1000_clean_tx_irq(adapter, &adapter->tx_ring[i]); | ||
3201 | adapter->clean_rx(adapter, &adapter->rx_ring[i], | ||
3202 | &work_done, work_to_do); | ||
2662 | 3203 | ||
2663 | *budget -= work_done; | 3204 | *budget -= work_done; |
2664 | netdev->quota -= work_done; | 3205 | poll_dev->quota -= work_done; |
2665 | 3206 | ||
2666 | if ((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { | ||
2667 | /* If no Tx and not enough Rx work done, exit the polling mode */ | 3207 | /* If no Tx and not enough Rx work done, exit the polling mode */ |
2668 | netif_rx_complete(netdev); | 3208 | if((!tx_cleaned && (work_done == 0)) || |
3209 | !netif_running(adapter->netdev)) { | ||
3210 | quit_polling: | ||
3211 | netif_rx_complete(poll_dev); | ||
2669 | e1000_irq_enable(adapter); | 3212 | e1000_irq_enable(adapter); |
2670 | return 0; | 3213 | return 0; |
2671 | } | 3214 | } |
@@ -2680,9 +3223,9 @@ e1000_clean(struct net_device *netdev, int *budget) | |||
2680 | **/ | 3223 | **/ |
2681 | 3224 | ||
2682 | static boolean_t | 3225 | static boolean_t |
2683 | e1000_clean_tx_irq(struct e1000_adapter *adapter) | 3226 | e1000_clean_tx_irq(struct e1000_adapter *adapter, |
3227 | struct e1000_tx_ring *tx_ring) | ||
2684 | { | 3228 | { |
2685 | struct e1000_desc_ring *tx_ring = &adapter->tx_ring; | ||
2686 | struct net_device *netdev = adapter->netdev; | 3229 | struct net_device *netdev = adapter->netdev; |
2687 | struct e1000_tx_desc *tx_desc, *eop_desc; | 3230 | struct e1000_tx_desc *tx_desc, *eop_desc; |
2688 | struct e1000_buffer *buffer_info; | 3231 | struct e1000_buffer *buffer_info; |
@@ -2693,12 +3236,12 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2693 | eop = tx_ring->buffer_info[i].next_to_watch; | 3236 | eop = tx_ring->buffer_info[i].next_to_watch; |
2694 | eop_desc = E1000_TX_DESC(*tx_ring, eop); | 3237 | eop_desc = E1000_TX_DESC(*tx_ring, eop); |
2695 | 3238 | ||
2696 | while(eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) { | 3239 | while (eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) { |
2697 | /* Premature writeback of Tx descriptors clear (free buffers | 3240 | /* Premature writeback of Tx descriptors clear (free buffers |
2698 | * and unmap pci_mapping) previous_buffer_info */ | 3241 | * and unmap pci_mapping) previous_buffer_info */ |
2699 | if (likely(adapter->previous_buffer_info.skb != NULL)) { | 3242 | if (likely(tx_ring->previous_buffer_info.skb != NULL)) { |
2700 | e1000_unmap_and_free_tx_resource(adapter, | 3243 | e1000_unmap_and_free_tx_resource(adapter, |
2701 | &adapter->previous_buffer_info); | 3244 | &tx_ring->previous_buffer_info); |
2702 | } | 3245 | } |
2703 | 3246 | ||
2704 | for(cleaned = FALSE; !cleaned; ) { | 3247 | for(cleaned = FALSE; !cleaned; ) { |
@@ -2714,7 +3257,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2714 | #ifdef NETIF_F_TSO | 3257 | #ifdef NETIF_F_TSO |
2715 | } else { | 3258 | } else { |
2716 | if (cleaned) { | 3259 | if (cleaned) { |
2717 | memcpy(&adapter->previous_buffer_info, | 3260 | memcpy(&tx_ring->previous_buffer_info, |
2718 | buffer_info, | 3261 | buffer_info, |
2719 | sizeof(struct e1000_buffer)); | 3262 | sizeof(struct e1000_buffer)); |
2720 | memset(buffer_info, 0, | 3263 | memset(buffer_info, 0, |
@@ -2732,6 +3275,8 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2732 | 3275 | ||
2733 | if(unlikely(++i == tx_ring->count)) i = 0; | 3276 | if(unlikely(++i == tx_ring->count)) i = 0; |
2734 | } | 3277 | } |
3278 | |||
3279 | tx_ring->pkt++; | ||
2735 | 3280 | ||
2736 | eop = tx_ring->buffer_info[i].next_to_watch; | 3281 | eop = tx_ring->buffer_info[i].next_to_watch; |
2737 | eop_desc = E1000_TX_DESC(*tx_ring, eop); | 3282 | eop_desc = E1000_TX_DESC(*tx_ring, eop); |
@@ -2739,15 +3284,15 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2739 | 3284 | ||
2740 | tx_ring->next_to_clean = i; | 3285 | tx_ring->next_to_clean = i; |
2741 | 3286 | ||
2742 | spin_lock(&adapter->tx_lock); | 3287 | spin_lock(&tx_ring->tx_lock); |
2743 | 3288 | ||
2744 | if(unlikely(cleaned && netif_queue_stopped(netdev) && | 3289 | if(unlikely(cleaned && netif_queue_stopped(netdev) && |
2745 | netif_carrier_ok(netdev))) | 3290 | netif_carrier_ok(netdev))) |
2746 | netif_wake_queue(netdev); | 3291 | netif_wake_queue(netdev); |
2747 | 3292 | ||
2748 | spin_unlock(&adapter->tx_lock); | 3293 | spin_unlock(&tx_ring->tx_lock); |
2749 | if(adapter->detect_tx_hung) { | ||
2750 | 3294 | ||
3295 | if (adapter->detect_tx_hung) { | ||
2751 | /* Detect a transmit hang in hardware, this serializes the | 3296 | /* Detect a transmit hang in hardware, this serializes the |
2752 | * check with the clearing of time_stamp and movement of i */ | 3297 | * check with the clearing of time_stamp and movement of i */ |
2753 | adapter->detect_tx_hung = FALSE; | 3298 | adapter->detect_tx_hung = FALSE; |
@@ -2771,8 +3316,8 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2771 | " next_to_watch <%x>\n" | 3316 | " next_to_watch <%x>\n" |
2772 | " jiffies <%lx>\n" | 3317 | " jiffies <%lx>\n" |
2773 | " next_to_watch.status <%x>\n", | 3318 | " next_to_watch.status <%x>\n", |
2774 | E1000_READ_REG(&adapter->hw, TDH), | 3319 | readl(adapter->hw.hw_addr + tx_ring->tdh), |
2775 | E1000_READ_REG(&adapter->hw, TDT), | 3320 | readl(adapter->hw.hw_addr + tx_ring->tdt), |
2776 | tx_ring->next_to_use, | 3321 | tx_ring->next_to_use, |
2777 | i, | 3322 | i, |
2778 | (unsigned long long)tx_ring->buffer_info[i].dma, | 3323 | (unsigned long long)tx_ring->buffer_info[i].dma, |
@@ -2784,12 +3329,10 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
2784 | } | 3329 | } |
2785 | } | 3330 | } |
2786 | #ifdef NETIF_F_TSO | 3331 | #ifdef NETIF_F_TSO |
2787 | 3332 | if (unlikely(!(eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && | |
2788 | if( unlikely(!(eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && | 3333 | time_after(jiffies, tx_ring->previous_buffer_info.time_stamp + HZ))) |
2789 | time_after(jiffies, adapter->previous_buffer_info.time_stamp + HZ))) | ||
2790 | e1000_unmap_and_free_tx_resource( | 3334 | e1000_unmap_and_free_tx_resource( |
2791 | adapter, &adapter->previous_buffer_info); | 3335 | adapter, &tx_ring->previous_buffer_info); |
2792 | |||
2793 | #endif | 3336 | #endif |
2794 | return cleaned; | 3337 | return cleaned; |
2795 | } | 3338 | } |
@@ -2852,13 +3395,14 @@ e1000_rx_checksum(struct e1000_adapter *adapter, | |||
2852 | 3395 | ||
2853 | static boolean_t | 3396 | static boolean_t |
2854 | #ifdef CONFIG_E1000_NAPI | 3397 | #ifdef CONFIG_E1000_NAPI |
2855 | e1000_clean_rx_irq(struct e1000_adapter *adapter, int *work_done, | 3398 | e1000_clean_rx_irq(struct e1000_adapter *adapter, |
2856 | int work_to_do) | 3399 | struct e1000_rx_ring *rx_ring, |
3400 | int *work_done, int work_to_do) | ||
2857 | #else | 3401 | #else |
2858 | e1000_clean_rx_irq(struct e1000_adapter *adapter) | 3402 | e1000_clean_rx_irq(struct e1000_adapter *adapter, |
3403 | struct e1000_rx_ring *rx_ring) | ||
2859 | #endif | 3404 | #endif |
2860 | { | 3405 | { |
2861 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
2862 | struct net_device *netdev = adapter->netdev; | 3406 | struct net_device *netdev = adapter->netdev; |
2863 | struct pci_dev *pdev = adapter->pdev; | 3407 | struct pci_dev *pdev = adapter->pdev; |
2864 | struct e1000_rx_desc *rx_desc; | 3408 | struct e1000_rx_desc *rx_desc; |
@@ -2944,6 +3488,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter) | |||
2944 | } | 3488 | } |
2945 | #endif /* CONFIG_E1000_NAPI */ | 3489 | #endif /* CONFIG_E1000_NAPI */ |
2946 | netdev->last_rx = jiffies; | 3490 | netdev->last_rx = jiffies; |
3491 | rx_ring->pkt++; | ||
2947 | 3492 | ||
2948 | next_desc: | 3493 | next_desc: |
2949 | rx_desc->status = 0; | 3494 | rx_desc->status = 0; |
@@ -2953,7 +3498,7 @@ next_desc: | |||
2953 | rx_desc = E1000_RX_DESC(*rx_ring, i); | 3498 | rx_desc = E1000_RX_DESC(*rx_ring, i); |
2954 | } | 3499 | } |
2955 | rx_ring->next_to_clean = i; | 3500 | rx_ring->next_to_clean = i; |
2956 | adapter->alloc_rx_buf(adapter); | 3501 | adapter->alloc_rx_buf(adapter, rx_ring); |
2957 | 3502 | ||
2958 | return cleaned; | 3503 | return cleaned; |
2959 | } | 3504 | } |
@@ -2965,13 +3510,14 @@ next_desc: | |||
2965 | 3510 | ||
2966 | static boolean_t | 3511 | static boolean_t |
2967 | #ifdef CONFIG_E1000_NAPI | 3512 | #ifdef CONFIG_E1000_NAPI |
2968 | e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, int *work_done, | 3513 | e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, |
2969 | int work_to_do) | 3514 | struct e1000_rx_ring *rx_ring, |
3515 | int *work_done, int work_to_do) | ||
2970 | #else | 3516 | #else |
2971 | e1000_clean_rx_irq_ps(struct e1000_adapter *adapter) | 3517 | e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, |
3518 | struct e1000_rx_ring *rx_ring) | ||
2972 | #endif | 3519 | #endif |
2973 | { | 3520 | { |
2974 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
2975 | union e1000_rx_desc_packet_split *rx_desc; | 3521 | union e1000_rx_desc_packet_split *rx_desc; |
2976 | struct net_device *netdev = adapter->netdev; | 3522 | struct net_device *netdev = adapter->netdev; |
2977 | struct pci_dev *pdev = adapter->pdev; | 3523 | struct pci_dev *pdev = adapter->pdev; |
@@ -3027,7 +3573,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter) | |||
3027 | /* Good Receive */ | 3573 | /* Good Receive */ |
3028 | skb_put(skb, length); | 3574 | skb_put(skb, length); |
3029 | 3575 | ||
3030 | for(j = 0; j < PS_PAGE_BUFFERS; j++) { | 3576 | for(j = 0; j < adapter->rx_ps_pages; j++) { |
3031 | if(!(length = le16_to_cpu(rx_desc->wb.upper.length[j]))) | 3577 | if(!(length = le16_to_cpu(rx_desc->wb.upper.length[j]))) |
3032 | break; | 3578 | break; |
3033 | 3579 | ||
@@ -3048,11 +3594,13 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter) | |||
3048 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); | 3594 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); |
3049 | skb->protocol = eth_type_trans(skb, netdev); | 3595 | skb->protocol = eth_type_trans(skb, netdev); |
3050 | 3596 | ||
3051 | #ifdef HAVE_RX_ZERO_COPY | ||
3052 | if(likely(rx_desc->wb.upper.header_status & | 3597 | if(likely(rx_desc->wb.upper.header_status & |
3053 | E1000_RXDPS_HDRSTAT_HDRSP)) | 3598 | E1000_RXDPS_HDRSTAT_HDRSP)) { |
3599 | adapter->rx_hdr_split++; | ||
3600 | #ifdef HAVE_RX_ZERO_COPY | ||
3054 | skb_shinfo(skb)->zero_copy = TRUE; | 3601 | skb_shinfo(skb)->zero_copy = TRUE; |
3055 | #endif | 3602 | #endif |
3603 | } | ||
3056 | #ifdef CONFIG_E1000_NAPI | 3604 | #ifdef CONFIG_E1000_NAPI |
3057 | if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { | 3605 | if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { |
3058 | vlan_hwaccel_receive_skb(skb, adapter->vlgrp, | 3606 | vlan_hwaccel_receive_skb(skb, adapter->vlgrp, |
@@ -3071,6 +3619,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter) | |||
3071 | } | 3619 | } |
3072 | #endif /* CONFIG_E1000_NAPI */ | 3620 | #endif /* CONFIG_E1000_NAPI */ |
3073 | netdev->last_rx = jiffies; | 3621 | netdev->last_rx = jiffies; |
3622 | rx_ring->pkt++; | ||
3074 | 3623 | ||
3075 | next_desc: | 3624 | next_desc: |
3076 | rx_desc->wb.middle.status_error &= ~0xFF; | 3625 | rx_desc->wb.middle.status_error &= ~0xFF; |
@@ -3081,7 +3630,7 @@ next_desc: | |||
3081 | staterr = le32_to_cpu(rx_desc->wb.middle.status_error); | 3630 | staterr = le32_to_cpu(rx_desc->wb.middle.status_error); |
3082 | } | 3631 | } |
3083 | rx_ring->next_to_clean = i; | 3632 | rx_ring->next_to_clean = i; |
3084 | adapter->alloc_rx_buf(adapter); | 3633 | adapter->alloc_rx_buf(adapter, rx_ring); |
3085 | 3634 | ||
3086 | return cleaned; | 3635 | return cleaned; |
3087 | } | 3636 | } |
@@ -3092,9 +3641,9 @@ next_desc: | |||
3092 | **/ | 3641 | **/ |
3093 | 3642 | ||
3094 | static void | 3643 | static void |
3095 | e1000_alloc_rx_buffers(struct e1000_adapter *adapter) | 3644 | e1000_alloc_rx_buffers(struct e1000_adapter *adapter, |
3645 | struct e1000_rx_ring *rx_ring) | ||
3096 | { | 3646 | { |
3097 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
3098 | struct net_device *netdev = adapter->netdev; | 3647 | struct net_device *netdev = adapter->netdev; |
3099 | struct pci_dev *pdev = adapter->pdev; | 3648 | struct pci_dev *pdev = adapter->pdev; |
3100 | struct e1000_rx_desc *rx_desc; | 3649 | struct e1000_rx_desc *rx_desc; |
@@ -3178,7 +3727,7 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter) | |||
3178 | * applicable for weak-ordered memory model archs, | 3727 | * applicable for weak-ordered memory model archs, |
3179 | * such as IA-64). */ | 3728 | * such as IA-64). */ |
3180 | wmb(); | 3729 | wmb(); |
3181 | E1000_WRITE_REG(&adapter->hw, RDT, i); | 3730 | writel(i, adapter->hw.hw_addr + rx_ring->rdt); |
3182 | } | 3731 | } |
3183 | 3732 | ||
3184 | if(unlikely(++i == rx_ring->count)) i = 0; | 3733 | if(unlikely(++i == rx_ring->count)) i = 0; |
@@ -3194,9 +3743,9 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter) | |||
3194 | **/ | 3743 | **/ |
3195 | 3744 | ||
3196 | static void | 3745 | static void |
3197 | e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter) | 3746 | e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, |
3747 | struct e1000_rx_ring *rx_ring) | ||
3198 | { | 3748 | { |
3199 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | ||
3200 | struct net_device *netdev = adapter->netdev; | 3749 | struct net_device *netdev = adapter->netdev; |
3201 | struct pci_dev *pdev = adapter->pdev; | 3750 | struct pci_dev *pdev = adapter->pdev; |
3202 | union e1000_rx_desc_packet_split *rx_desc; | 3751 | union e1000_rx_desc_packet_split *rx_desc; |
@@ -3215,22 +3764,26 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter) | |||
3215 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); | 3764 | rx_desc = E1000_RX_DESC_PS(*rx_ring, i); |
3216 | 3765 | ||
3217 | for(j = 0; j < PS_PAGE_BUFFERS; j++) { | 3766 | for(j = 0; j < PS_PAGE_BUFFERS; j++) { |
3218 | if(unlikely(!ps_page->ps_page[j])) { | 3767 | if (j < adapter->rx_ps_pages) { |
3219 | ps_page->ps_page[j] = | 3768 | if (likely(!ps_page->ps_page[j])) { |
3220 | alloc_page(GFP_ATOMIC); | 3769 | ps_page->ps_page[j] = |
3221 | if(unlikely(!ps_page->ps_page[j])) | 3770 | alloc_page(GFP_ATOMIC); |
3222 | goto no_buffers; | 3771 | if (unlikely(!ps_page->ps_page[j])) |
3223 | ps_page_dma->ps_page_dma[j] = | 3772 | goto no_buffers; |
3224 | pci_map_page(pdev, | 3773 | ps_page_dma->ps_page_dma[j] = |
3225 | ps_page->ps_page[j], | 3774 | pci_map_page(pdev, |
3226 | 0, PAGE_SIZE, | 3775 | ps_page->ps_page[j], |
3227 | PCI_DMA_FROMDEVICE); | 3776 | 0, PAGE_SIZE, |
3228 | } | 3777 | PCI_DMA_FROMDEVICE); |
3229 | /* Refresh the desc even if buffer_addrs didn't | 3778 | } |
3230 | * change because each write-back erases this info. | 3779 | /* Refresh the desc even if buffer_addrs didn't |
3231 | */ | 3780 | * change because each write-back erases |
3232 | rx_desc->read.buffer_addr[j+1] = | 3781 | * this info. |
3233 | cpu_to_le64(ps_page_dma->ps_page_dma[j]); | 3782 | */ |
3783 | rx_desc->read.buffer_addr[j+1] = | ||
3784 | cpu_to_le64(ps_page_dma->ps_page_dma[j]); | ||
3785 | } else | ||
3786 | rx_desc->read.buffer_addr[j+1] = ~0; | ||
3234 | } | 3787 | } |
3235 | 3788 | ||
3236 | skb = dev_alloc_skb(adapter->rx_ps_bsize0 + NET_IP_ALIGN); | 3789 | skb = dev_alloc_skb(adapter->rx_ps_bsize0 + NET_IP_ALIGN); |
@@ -3264,7 +3817,7 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter) | |||
3264 | * descriptors are 32 bytes...so we increment tail | 3817 | * descriptors are 32 bytes...so we increment tail |
3265 | * twice as much. | 3818 | * twice as much. |
3266 | */ | 3819 | */ |
3267 | E1000_WRITE_REG(&adapter->hw, RDT, i<<1); | 3820 | writel(i<<1, adapter->hw.hw_addr + rx_ring->rdt); |
3268 | } | 3821 | } |
3269 | 3822 | ||
3270 | if(unlikely(++i == rx_ring->count)) i = 0; | 3823 | if(unlikely(++i == rx_ring->count)) i = 0; |
@@ -3715,6 +4268,12 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3715 | } | 4268 | } |
3716 | 4269 | ||
3717 | switch(adapter->hw.mac_type) { | 4270 | switch(adapter->hw.mac_type) { |
4271 | case e1000_82571: | ||
4272 | case e1000_82572: | ||
4273 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
4274 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
4275 | ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); | ||
4276 | break; | ||
3718 | case e1000_82573: | 4277 | case e1000_82573: |
3719 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 4278 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
3720 | E1000_WRITE_REG(&adapter->hw, SWSM, | 4279 | E1000_WRITE_REG(&adapter->hw, SWSM, |
@@ -3737,6 +4296,7 @@ e1000_resume(struct pci_dev *pdev) | |||
3737 | struct net_device *netdev = pci_get_drvdata(pdev); | 4296 | struct net_device *netdev = pci_get_drvdata(pdev); |
3738 | struct e1000_adapter *adapter = netdev_priv(netdev); | 4297 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3739 | uint32_t manc, ret_val, swsm; | 4298 | uint32_t manc, ret_val, swsm; |
4299 | uint32_t ctrl_ext; | ||
3740 | 4300 | ||
3741 | pci_set_power_state(pdev, PCI_D0); | 4301 | pci_set_power_state(pdev, PCI_D0); |
3742 | pci_restore_state(pdev); | 4302 | pci_restore_state(pdev); |
@@ -3762,6 +4322,12 @@ e1000_resume(struct pci_dev *pdev) | |||
3762 | } | 4322 | } |
3763 | 4323 | ||
3764 | switch(adapter->hw.mac_type) { | 4324 | switch(adapter->hw.mac_type) { |
4325 | case e1000_82571: | ||
4326 | case e1000_82572: | ||
4327 | ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
4328 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
4329 | ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); | ||
4330 | break; | ||
3765 | case e1000_82573: | 4331 | case e1000_82573: |
3766 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 4332 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
3767 | E1000_WRITE_REG(&adapter->hw, SWSM, | 4333 | E1000_WRITE_REG(&adapter->hw, SWSM, |
@@ -3786,7 +4352,7 @@ e1000_netpoll(struct net_device *netdev) | |||
3786 | struct e1000_adapter *adapter = netdev_priv(netdev); | 4352 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3787 | disable_irq(adapter->pdev->irq); | 4353 | disable_irq(adapter->pdev->irq); |
3788 | e1000_intr(adapter->pdev->irq, netdev, NULL); | 4354 | e1000_intr(adapter->pdev->irq, netdev, NULL); |
3789 | e1000_clean_tx_irq(adapter); | 4355 | e1000_clean_tx_irq(adapter, adapter->tx_ring); |
3790 | enable_irq(adapter->pdev->irq); | 4356 | enable_irq(adapter->pdev->irq); |
3791 | } | 4357 | } |
3792 | #endif | 4358 | #endif |
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index 676247f9f1cc..38695d5b4637 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c | |||
@@ -306,7 +306,8 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
306 | .def = E1000_DEFAULT_TXD, | 306 | .def = E1000_DEFAULT_TXD, |
307 | .arg = { .r = { .min = E1000_MIN_TXD }} | 307 | .arg = { .r = { .min = E1000_MIN_TXD }} |
308 | }; | 308 | }; |
309 | struct e1000_desc_ring *tx_ring = &adapter->tx_ring; | 309 | struct e1000_tx_ring *tx_ring = adapter->tx_ring; |
310 | int i; | ||
310 | e1000_mac_type mac_type = adapter->hw.mac_type; | 311 | e1000_mac_type mac_type = adapter->hw.mac_type; |
311 | opt.arg.r.max = mac_type < e1000_82544 ? | 312 | opt.arg.r.max = mac_type < e1000_82544 ? |
312 | E1000_MAX_TXD : E1000_MAX_82544_TXD; | 313 | E1000_MAX_TXD : E1000_MAX_82544_TXD; |
@@ -319,6 +320,8 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
319 | } else { | 320 | } else { |
320 | tx_ring->count = opt.def; | 321 | tx_ring->count = opt.def; |
321 | } | 322 | } |
323 | for (i = 0; i < adapter->num_queues; i++) | ||
324 | tx_ring[i].count = tx_ring->count; | ||
322 | } | 325 | } |
323 | { /* Receive Descriptor Count */ | 326 | { /* Receive Descriptor Count */ |
324 | struct e1000_option opt = { | 327 | struct e1000_option opt = { |
@@ -329,7 +332,8 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
329 | .def = E1000_DEFAULT_RXD, | 332 | .def = E1000_DEFAULT_RXD, |
330 | .arg = { .r = { .min = E1000_MIN_RXD }} | 333 | .arg = { .r = { .min = E1000_MIN_RXD }} |
331 | }; | 334 | }; |
332 | struct e1000_desc_ring *rx_ring = &adapter->rx_ring; | 335 | struct e1000_rx_ring *rx_ring = adapter->rx_ring; |
336 | int i; | ||
333 | e1000_mac_type mac_type = adapter->hw.mac_type; | 337 | e1000_mac_type mac_type = adapter->hw.mac_type; |
334 | opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : | 338 | opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : |
335 | E1000_MAX_82544_RXD; | 339 | E1000_MAX_82544_RXD; |
@@ -342,6 +346,8 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
342 | } else { | 346 | } else { |
343 | rx_ring->count = opt.def; | 347 | rx_ring->count = opt.def; |
344 | } | 348 | } |
349 | for (i = 0; i < adapter->num_queues; i++) | ||
350 | rx_ring[i].count = rx_ring->count; | ||
345 | } | 351 | } |
346 | { /* Checksum Offload Enable/Disable */ | 352 | { /* Checksum Offload Enable/Disable */ |
347 | struct e1000_option opt = { | 353 | struct e1000_option opt = { |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index 87f522738bfc..f119ec4e89ea 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -1334,7 +1334,7 @@ static void epic_rx_err(struct net_device *dev, struct epic_private *ep) | |||
1334 | static int epic_poll(struct net_device *dev, int *budget) | 1334 | static int epic_poll(struct net_device *dev, int *budget) |
1335 | { | 1335 | { |
1336 | struct epic_private *ep = dev->priv; | 1336 | struct epic_private *ep = dev->priv; |
1337 | int work_done, orig_budget; | 1337 | int work_done = 0, orig_budget; |
1338 | long ioaddr = dev->base_addr; | 1338 | long ioaddr = dev->base_addr; |
1339 | 1339 | ||
1340 | orig_budget = (*budget > dev->quota) ? dev->quota : *budget; | 1340 | orig_budget = (*budget > dev->quota) ? dev->quota : *budget; |
@@ -1343,7 +1343,7 @@ rx_action: | |||
1343 | 1343 | ||
1344 | epic_tx(dev, ep); | 1344 | epic_tx(dev, ep); |
1345 | 1345 | ||
1346 | work_done = epic_rx(dev, *budget); | 1346 | work_done += epic_rx(dev, *budget); |
1347 | 1347 | ||
1348 | epic_rx_err(dev, ep); | 1348 | epic_rx_err(dev, ep); |
1349 | 1349 | ||
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index d6eefdb71c17..22aec6ed80f5 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -95,6 +95,8 @@ | |||
95 | * of nv_remove | 95 | * of nv_remove |
96 | * 0.42: 06 Aug 2005: Fix lack of link speed initialization | 96 | * 0.42: 06 Aug 2005: Fix lack of link speed initialization |
97 | * in the second (and later) nv_open call | 97 | * in the second (and later) nv_open call |
98 | * 0.43: 10 Aug 2005: Add support for tx checksum. | ||
99 | * 0.44: 20 Aug 2005: Add support for scatter gather and segmentation. | ||
98 | * | 100 | * |
99 | * Known bugs: | 101 | * Known bugs: |
100 | * We suspect that on some hardware no TX done interrupts are generated. | 102 | * We suspect that on some hardware no TX done interrupts are generated. |
@@ -106,7 +108,7 @@ | |||
106 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few | 108 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few |
107 | * superfluous timer interrupts from the nic. | 109 | * superfluous timer interrupts from the nic. |
108 | */ | 110 | */ |
109 | #define FORCEDETH_VERSION "0.41" | 111 | #define FORCEDETH_VERSION "0.44" |
110 | #define DRV_NAME "forcedeth" | 112 | #define DRV_NAME "forcedeth" |
111 | 113 | ||
112 | #include <linux/module.h> | 114 | #include <linux/module.h> |
@@ -145,6 +147,7 @@ | |||
145 | #define DEV_NEED_LINKTIMER 0x0002 /* poll link settings. Relies on the timer irq */ | 147 | #define DEV_NEED_LINKTIMER 0x0002 /* poll link settings. Relies on the timer irq */ |
146 | #define DEV_HAS_LARGEDESC 0x0004 /* device supports jumbo frames and needs packet format 2 */ | 148 | #define DEV_HAS_LARGEDESC 0x0004 /* device supports jumbo frames and needs packet format 2 */ |
147 | #define DEV_HAS_HIGH_DMA 0x0008 /* device supports 64bit dma */ | 149 | #define DEV_HAS_HIGH_DMA 0x0008 /* device supports 64bit dma */ |
150 | #define DEV_HAS_CHECKSUM 0x0010 /* device supports tx and rx checksum offloads */ | ||
148 | 151 | ||
149 | enum { | 152 | enum { |
150 | NvRegIrqStatus = 0x000, | 153 | NvRegIrqStatus = 0x000, |
@@ -241,6 +244,9 @@ enum { | |||
241 | #define NVREG_TXRXCTL_IDLE 0x0008 | 244 | #define NVREG_TXRXCTL_IDLE 0x0008 |
242 | #define NVREG_TXRXCTL_RESET 0x0010 | 245 | #define NVREG_TXRXCTL_RESET 0x0010 |
243 | #define NVREG_TXRXCTL_RXCHECK 0x0400 | 246 | #define NVREG_TXRXCTL_RXCHECK 0x0400 |
247 | #define NVREG_TXRXCTL_DESC_1 0 | ||
248 | #define NVREG_TXRXCTL_DESC_2 0x02100 | ||
249 | #define NVREG_TXRXCTL_DESC_3 0x02200 | ||
244 | NvRegMIIStatus = 0x180, | 250 | NvRegMIIStatus = 0x180, |
245 | #define NVREG_MIISTAT_ERROR 0x0001 | 251 | #define NVREG_MIISTAT_ERROR 0x0001 |
246 | #define NVREG_MIISTAT_LINKCHANGE 0x0008 | 252 | #define NVREG_MIISTAT_LINKCHANGE 0x0008 |
@@ -335,6 +341,10 @@ typedef union _ring_type { | |||
335 | /* error and valid are the same for both */ | 341 | /* error and valid are the same for both */ |
336 | #define NV_TX2_ERROR (1<<30) | 342 | #define NV_TX2_ERROR (1<<30) |
337 | #define NV_TX2_VALID (1<<31) | 343 | #define NV_TX2_VALID (1<<31) |
344 | #define NV_TX2_TSO (1<<28) | ||
345 | #define NV_TX2_TSO_SHIFT 14 | ||
346 | #define NV_TX2_CHECKSUM_L3 (1<<27) | ||
347 | #define NV_TX2_CHECKSUM_L4 (1<<26) | ||
338 | 348 | ||
339 | #define NV_RX_DESCRIPTORVALID (1<<16) | 349 | #define NV_RX_DESCRIPTORVALID (1<<16) |
340 | #define NV_RX_MISSEDFRAME (1<<17) | 350 | #define NV_RX_MISSEDFRAME (1<<17) |
@@ -417,14 +427,14 @@ typedef union _ring_type { | |||
417 | 427 | ||
418 | /* | 428 | /* |
419 | * desc_ver values: | 429 | * desc_ver values: |
420 | * This field has two purposes: | 430 | * The nic supports three different descriptor types: |
421 | * - Newer nics uses a different ring layout. The layout is selected by | 431 | * - DESC_VER_1: Original |
422 | * comparing np->desc_ver with DESC_VER_xy. | 432 | * - DESC_VER_2: support for jumbo frames. |
423 | * - It contains bits that are forced on when writing to NvRegTxRxControl. | 433 | * - DESC_VER_3: 64-bit format. |
424 | */ | 434 | */ |
425 | #define DESC_VER_1 0x0 | 435 | #define DESC_VER_1 1 |
426 | #define DESC_VER_2 (0x02100|NVREG_TXRXCTL_RXCHECK) | 436 | #define DESC_VER_2 2 |
427 | #define DESC_VER_3 (0x02200|NVREG_TXRXCTL_RXCHECK) | 437 | #define DESC_VER_3 3 |
428 | 438 | ||
429 | /* PHY defines */ | 439 | /* PHY defines */ |
430 | #define PHY_OUI_MARVELL 0x5043 | 440 | #define PHY_OUI_MARVELL 0x5043 |
@@ -491,6 +501,7 @@ struct fe_priv { | |||
491 | u32 orig_mac[2]; | 501 | u32 orig_mac[2]; |
492 | u32 irqmask; | 502 | u32 irqmask; |
493 | u32 desc_ver; | 503 | u32 desc_ver; |
504 | u32 txrxctl_bits; | ||
494 | 505 | ||
495 | void __iomem *base; | 506 | void __iomem *base; |
496 | 507 | ||
@@ -534,7 +545,7 @@ static inline struct fe_priv *get_nvpriv(struct net_device *dev) | |||
534 | 545 | ||
535 | static inline u8 __iomem *get_hwbase(struct net_device *dev) | 546 | static inline u8 __iomem *get_hwbase(struct net_device *dev) |
536 | { | 547 | { |
537 | return get_nvpriv(dev)->base; | 548 | return ((struct fe_priv *)netdev_priv(dev))->base; |
538 | } | 549 | } |
539 | 550 | ||
540 | static inline void pci_push(u8 __iomem *base) | 551 | static inline void pci_push(u8 __iomem *base) |
@@ -623,7 +634,7 @@ static int mii_rw(struct net_device *dev, int addr, int miireg, int value) | |||
623 | 634 | ||
624 | static int phy_reset(struct net_device *dev) | 635 | static int phy_reset(struct net_device *dev) |
625 | { | 636 | { |
626 | struct fe_priv *np = get_nvpriv(dev); | 637 | struct fe_priv *np = netdev_priv(dev); |
627 | u32 miicontrol; | 638 | u32 miicontrol; |
628 | unsigned int tries = 0; | 639 | unsigned int tries = 0; |
629 | 640 | ||
@@ -726,7 +737,7 @@ static int phy_init(struct net_device *dev) | |||
726 | 737 | ||
727 | static void nv_start_rx(struct net_device *dev) | 738 | static void nv_start_rx(struct net_device *dev) |
728 | { | 739 | { |
729 | struct fe_priv *np = get_nvpriv(dev); | 740 | struct fe_priv *np = netdev_priv(dev); |
730 | u8 __iomem *base = get_hwbase(dev); | 741 | u8 __iomem *base = get_hwbase(dev); |
731 | 742 | ||
732 | dprintk(KERN_DEBUG "%s: nv_start_rx\n", dev->name); | 743 | dprintk(KERN_DEBUG "%s: nv_start_rx\n", dev->name); |
@@ -782,14 +793,14 @@ static void nv_stop_tx(struct net_device *dev) | |||
782 | 793 | ||
783 | static void nv_txrx_reset(struct net_device *dev) | 794 | static void nv_txrx_reset(struct net_device *dev) |
784 | { | 795 | { |
785 | struct fe_priv *np = get_nvpriv(dev); | 796 | struct fe_priv *np = netdev_priv(dev); |
786 | u8 __iomem *base = get_hwbase(dev); | 797 | u8 __iomem *base = get_hwbase(dev); |
787 | 798 | ||
788 | dprintk(KERN_DEBUG "%s: nv_txrx_reset\n", dev->name); | 799 | dprintk(KERN_DEBUG "%s: nv_txrx_reset\n", dev->name); |
789 | writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET | np->desc_ver, base + NvRegTxRxControl); | 800 | writel(NVREG_TXRXCTL_BIT2 | NVREG_TXRXCTL_RESET | np->txrxctl_bits, base + NvRegTxRxControl); |
790 | pci_push(base); | 801 | pci_push(base); |
791 | udelay(NV_TXRX_RESET_DELAY); | 802 | udelay(NV_TXRX_RESET_DELAY); |
792 | writel(NVREG_TXRXCTL_BIT2 | np->desc_ver, base + NvRegTxRxControl); | 803 | writel(NVREG_TXRXCTL_BIT2 | np->txrxctl_bits, base + NvRegTxRxControl); |
793 | pci_push(base); | 804 | pci_push(base); |
794 | } | 805 | } |
795 | 806 | ||
@@ -801,7 +812,7 @@ static void nv_txrx_reset(struct net_device *dev) | |||
801 | */ | 812 | */ |
802 | static struct net_device_stats *nv_get_stats(struct net_device *dev) | 813 | static struct net_device_stats *nv_get_stats(struct net_device *dev) |
803 | { | 814 | { |
804 | struct fe_priv *np = get_nvpriv(dev); | 815 | struct fe_priv *np = netdev_priv(dev); |
805 | 816 | ||
806 | /* It seems that the nic always generates interrupts and doesn't | 817 | /* It seems that the nic always generates interrupts and doesn't |
807 | * accumulate errors internally. Thus the current values in np->stats | 818 | * accumulate errors internally. Thus the current values in np->stats |
@@ -817,7 +828,7 @@ static struct net_device_stats *nv_get_stats(struct net_device *dev) | |||
817 | */ | 828 | */ |
818 | static int nv_alloc_rx(struct net_device *dev) | 829 | static int nv_alloc_rx(struct net_device *dev) |
819 | { | 830 | { |
820 | struct fe_priv *np = get_nvpriv(dev); | 831 | struct fe_priv *np = netdev_priv(dev); |
821 | unsigned int refill_rx = np->refill_rx; | 832 | unsigned int refill_rx = np->refill_rx; |
822 | int nr; | 833 | int nr; |
823 | 834 | ||
@@ -861,7 +872,7 @@ static int nv_alloc_rx(struct net_device *dev) | |||
861 | static void nv_do_rx_refill(unsigned long data) | 872 | static void nv_do_rx_refill(unsigned long data) |
862 | { | 873 | { |
863 | struct net_device *dev = (struct net_device *) data; | 874 | struct net_device *dev = (struct net_device *) data; |
864 | struct fe_priv *np = get_nvpriv(dev); | 875 | struct fe_priv *np = netdev_priv(dev); |
865 | 876 | ||
866 | disable_irq(dev->irq); | 877 | disable_irq(dev->irq); |
867 | if (nv_alloc_rx(dev)) { | 878 | if (nv_alloc_rx(dev)) { |
@@ -875,7 +886,7 @@ static void nv_do_rx_refill(unsigned long data) | |||
875 | 886 | ||
876 | static void nv_init_rx(struct net_device *dev) | 887 | static void nv_init_rx(struct net_device *dev) |
877 | { | 888 | { |
878 | struct fe_priv *np = get_nvpriv(dev); | 889 | struct fe_priv *np = netdev_priv(dev); |
879 | int i; | 890 | int i; |
880 | 891 | ||
881 | np->cur_rx = RX_RING; | 892 | np->cur_rx = RX_RING; |
@@ -889,15 +900,17 @@ static void nv_init_rx(struct net_device *dev) | |||
889 | 900 | ||
890 | static void nv_init_tx(struct net_device *dev) | 901 | static void nv_init_tx(struct net_device *dev) |
891 | { | 902 | { |
892 | struct fe_priv *np = get_nvpriv(dev); | 903 | struct fe_priv *np = netdev_priv(dev); |
893 | int i; | 904 | int i; |
894 | 905 | ||
895 | np->next_tx = np->nic_tx = 0; | 906 | np->next_tx = np->nic_tx = 0; |
896 | for (i = 0; i < TX_RING; i++) | 907 | for (i = 0; i < TX_RING; i++) { |
897 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | 908 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
898 | np->tx_ring.orig[i].FlagLen = 0; | 909 | np->tx_ring.orig[i].FlagLen = 0; |
899 | else | 910 | else |
900 | np->tx_ring.ex[i].FlagLen = 0; | 911 | np->tx_ring.ex[i].FlagLen = 0; |
912 | np->tx_skbuff[i] = NULL; | ||
913 | } | ||
901 | } | 914 | } |
902 | 915 | ||
903 | static int nv_init_ring(struct net_device *dev) | 916 | static int nv_init_ring(struct net_device *dev) |
@@ -907,21 +920,44 @@ static int nv_init_ring(struct net_device *dev) | |||
907 | return nv_alloc_rx(dev); | 920 | return nv_alloc_rx(dev); |
908 | } | 921 | } |
909 | 922 | ||
923 | static void nv_release_txskb(struct net_device *dev, unsigned int skbnr) | ||
924 | { | ||
925 | struct fe_priv *np = netdev_priv(dev); | ||
926 | struct sk_buff *skb = np->tx_skbuff[skbnr]; | ||
927 | unsigned int j, entry, fragments; | ||
928 | |||
929 | dprintk(KERN_INFO "%s: nv_release_txskb for skbnr %d, skb %p\n", | ||
930 | dev->name, skbnr, np->tx_skbuff[skbnr]); | ||
931 | |||
932 | entry = skbnr; | ||
933 | if ((fragments = skb_shinfo(skb)->nr_frags) != 0) { | ||
934 | for (j = fragments; j >= 1; j--) { | ||
935 | skb_frag_t *frag = &skb_shinfo(skb)->frags[j-1]; | ||
936 | pci_unmap_page(np->pci_dev, np->tx_dma[entry], | ||
937 | frag->size, | ||
938 | PCI_DMA_TODEVICE); | ||
939 | entry = (entry - 1) % TX_RING; | ||
940 | } | ||
941 | } | ||
942 | pci_unmap_single(np->pci_dev, np->tx_dma[entry], | ||
943 | skb->len - skb->data_len, | ||
944 | PCI_DMA_TODEVICE); | ||
945 | dev_kfree_skb_irq(skb); | ||
946 | np->tx_skbuff[skbnr] = NULL; | ||
947 | } | ||
948 | |||
910 | static void nv_drain_tx(struct net_device *dev) | 949 | static void nv_drain_tx(struct net_device *dev) |
911 | { | 950 | { |
912 | struct fe_priv *np = get_nvpriv(dev); | 951 | struct fe_priv *np = netdev_priv(dev); |
913 | int i; | 952 | unsigned int i; |
953 | |||
914 | for (i = 0; i < TX_RING; i++) { | 954 | for (i = 0; i < TX_RING; i++) { |
915 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | 955 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
916 | np->tx_ring.orig[i].FlagLen = 0; | 956 | np->tx_ring.orig[i].FlagLen = 0; |
917 | else | 957 | else |
918 | np->tx_ring.ex[i].FlagLen = 0; | 958 | np->tx_ring.ex[i].FlagLen = 0; |
919 | if (np->tx_skbuff[i]) { | 959 | if (np->tx_skbuff[i]) { |
920 | pci_unmap_single(np->pci_dev, np->tx_dma[i], | 960 | nv_release_txskb(dev, i); |
921 | np->tx_skbuff[i]->len, | ||
922 | PCI_DMA_TODEVICE); | ||
923 | dev_kfree_skb(np->tx_skbuff[i]); | ||
924 | np->tx_skbuff[i] = NULL; | ||
925 | np->stats.tx_dropped++; | 961 | np->stats.tx_dropped++; |
926 | } | 962 | } |
927 | } | 963 | } |
@@ -929,7 +965,7 @@ static void nv_drain_tx(struct net_device *dev) | |||
929 | 965 | ||
930 | static void nv_drain_rx(struct net_device *dev) | 966 | static void nv_drain_rx(struct net_device *dev) |
931 | { | 967 | { |
932 | struct fe_priv *np = get_nvpriv(dev); | 968 | struct fe_priv *np = netdev_priv(dev); |
933 | int i; | 969 | int i; |
934 | for (i = 0; i < RX_RING; i++) { | 970 | for (i = 0; i < RX_RING; i++) { |
935 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | 971 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
@@ -959,28 +995,69 @@ static void drain_ring(struct net_device *dev) | |||
959 | */ | 995 | */ |
960 | static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | 996 | static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) |
961 | { | 997 | { |
962 | struct fe_priv *np = get_nvpriv(dev); | 998 | struct fe_priv *np = netdev_priv(dev); |
963 | int nr = np->next_tx % TX_RING; | 999 | u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); |
1000 | unsigned int fragments = skb_shinfo(skb)->nr_frags; | ||
1001 | unsigned int nr = (np->next_tx + fragments) % TX_RING; | ||
1002 | unsigned int i; | ||
1003 | |||
1004 | spin_lock_irq(&np->lock); | ||
1005 | |||
1006 | if ((np->next_tx - np->nic_tx + fragments) > TX_LIMIT_STOP) { | ||
1007 | spin_unlock_irq(&np->lock); | ||
1008 | netif_stop_queue(dev); | ||
1009 | return NETDEV_TX_BUSY; | ||
1010 | } | ||
964 | 1011 | ||
965 | np->tx_skbuff[nr] = skb; | 1012 | np->tx_skbuff[nr] = skb; |
966 | np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data,skb->len, | 1013 | |
967 | PCI_DMA_TODEVICE); | 1014 | if (fragments) { |
1015 | dprintk(KERN_DEBUG "%s: nv_start_xmit: buffer contains %d fragments\n", dev->name, fragments); | ||
1016 | /* setup descriptors in reverse order */ | ||
1017 | for (i = fragments; i >= 1; i--) { | ||
1018 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i-1]; | ||
1019 | np->tx_dma[nr] = pci_map_page(np->pci_dev, frag->page, frag->page_offset, frag->size, | ||
1020 | PCI_DMA_TODEVICE); | ||
968 | 1021 | ||
969 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | 1022 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1023 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); | ||
1024 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32( (frag->size-1) | np->tx_flags | tx_flags_extra); | ||
1025 | } else { | ||
1026 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; | ||
1027 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; | ||
1028 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32( (frag->size-1) | np->tx_flags | tx_flags_extra); | ||
1029 | } | ||
1030 | |||
1031 | nr = (nr - 1) % TX_RING; | ||
1032 | |||
1033 | if (np->desc_ver == DESC_VER_1) | ||
1034 | tx_flags_extra &= ~NV_TX_LASTPACKET; | ||
1035 | else | ||
1036 | tx_flags_extra &= ~NV_TX2_LASTPACKET; | ||
1037 | } | ||
1038 | } | ||
1039 | |||
1040 | #ifdef NETIF_F_TSO | ||
1041 | if (skb_shinfo(skb)->tso_size) | ||
1042 | tx_flags_extra |= NV_TX2_TSO | (skb_shinfo(skb)->tso_size << NV_TX2_TSO_SHIFT); | ||
1043 | else | ||
1044 | #endif | ||
1045 | tx_flags_extra |= (skb->ip_summed == CHECKSUM_HW ? (NV_TX2_CHECKSUM_L3|NV_TX2_CHECKSUM_L4) : 0); | ||
1046 | |||
1047 | np->tx_dma[nr] = pci_map_single(np->pci_dev, skb->data, skb->len-skb->data_len, | ||
1048 | PCI_DMA_TODEVICE); | ||
1049 | |||
1050 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | ||
970 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); | 1051 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); |
971 | else { | 1052 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32( (skb->len-skb->data_len-1) | np->tx_flags | tx_flags_extra); |
1053 | } else { | ||
972 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; | 1054 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; |
973 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; | 1055 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; |
974 | } | 1056 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32( (skb->len-skb->data_len-1) | np->tx_flags | tx_flags_extra); |
1057 | } | ||
975 | 1058 | ||
976 | spin_lock_irq(&np->lock); | 1059 | dprintk(KERN_DEBUG "%s: nv_start_xmit: packet packet %d queued for transmission. tx_flags_extra: %x\n", |
977 | wmb(); | 1060 | dev->name, np->next_tx, tx_flags_extra); |
978 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | ||
979 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32( (skb->len-1) | np->tx_flags ); | ||
980 | else | ||
981 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32( (skb->len-1) | np->tx_flags ); | ||
982 | dprintk(KERN_DEBUG "%s: nv_start_xmit: packet packet %d queued for transmission.\n", | ||
983 | dev->name, np->next_tx); | ||
984 | { | 1061 | { |
985 | int j; | 1062 | int j; |
986 | for (j=0; j<64; j++) { | 1063 | for (j=0; j<64; j++) { |
@@ -991,15 +1068,13 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
991 | dprintk("\n"); | 1068 | dprintk("\n"); |
992 | } | 1069 | } |
993 | 1070 | ||
994 | np->next_tx++; | 1071 | np->next_tx += 1 + fragments; |
995 | 1072 | ||
996 | dev->trans_start = jiffies; | 1073 | dev->trans_start = jiffies; |
997 | if (np->next_tx - np->nic_tx >= TX_LIMIT_STOP) | ||
998 | netif_stop_queue(dev); | ||
999 | spin_unlock_irq(&np->lock); | 1074 | spin_unlock_irq(&np->lock); |
1000 | writel(NVREG_TXRXCTL_KICK|np->desc_ver, get_hwbase(dev) + NvRegTxRxControl); | 1075 | writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
1001 | pci_push(get_hwbase(dev)); | 1076 | pci_push(get_hwbase(dev)); |
1002 | return 0; | 1077 | return NETDEV_TX_OK; |
1003 | } | 1078 | } |
1004 | 1079 | ||
1005 | /* | 1080 | /* |
@@ -1009,9 +1084,10 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1009 | */ | 1084 | */ |
1010 | static void nv_tx_done(struct net_device *dev) | 1085 | static void nv_tx_done(struct net_device *dev) |
1011 | { | 1086 | { |
1012 | struct fe_priv *np = get_nvpriv(dev); | 1087 | struct fe_priv *np = netdev_priv(dev); |
1013 | u32 Flags; | 1088 | u32 Flags; |
1014 | int i; | 1089 | unsigned int i; |
1090 | struct sk_buff *skb; | ||
1015 | 1091 | ||
1016 | while (np->nic_tx != np->next_tx) { | 1092 | while (np->nic_tx != np->next_tx) { |
1017 | i = np->nic_tx % TX_RING; | 1093 | i = np->nic_tx % TX_RING; |
@@ -1026,35 +1102,38 @@ static void nv_tx_done(struct net_device *dev) | |||
1026 | if (Flags & NV_TX_VALID) | 1102 | if (Flags & NV_TX_VALID) |
1027 | break; | 1103 | break; |
1028 | if (np->desc_ver == DESC_VER_1) { | 1104 | if (np->desc_ver == DESC_VER_1) { |
1029 | if (Flags & (NV_TX_RETRYERROR|NV_TX_CARRIERLOST|NV_TX_LATECOLLISION| | 1105 | if (Flags & NV_TX_LASTPACKET) { |
1030 | NV_TX_UNDERFLOW|NV_TX_ERROR)) { | 1106 | skb = np->tx_skbuff[i]; |
1031 | if (Flags & NV_TX_UNDERFLOW) | 1107 | if (Flags & (NV_TX_RETRYERROR|NV_TX_CARRIERLOST|NV_TX_LATECOLLISION| |
1032 | np->stats.tx_fifo_errors++; | 1108 | NV_TX_UNDERFLOW|NV_TX_ERROR)) { |
1033 | if (Flags & NV_TX_CARRIERLOST) | 1109 | if (Flags & NV_TX_UNDERFLOW) |
1034 | np->stats.tx_carrier_errors++; | 1110 | np->stats.tx_fifo_errors++; |
1035 | np->stats.tx_errors++; | 1111 | if (Flags & NV_TX_CARRIERLOST) |
1036 | } else { | 1112 | np->stats.tx_carrier_errors++; |
1037 | np->stats.tx_packets++; | 1113 | np->stats.tx_errors++; |
1038 | np->stats.tx_bytes += np->tx_skbuff[i]->len; | 1114 | } else { |
1115 | np->stats.tx_packets++; | ||
1116 | np->stats.tx_bytes += skb->len; | ||
1117 | } | ||
1118 | nv_release_txskb(dev, i); | ||
1039 | } | 1119 | } |
1040 | } else { | 1120 | } else { |
1041 | if (Flags & (NV_TX2_RETRYERROR|NV_TX2_CARRIERLOST|NV_TX2_LATECOLLISION| | 1121 | if (Flags & NV_TX2_LASTPACKET) { |
1042 | NV_TX2_UNDERFLOW|NV_TX2_ERROR)) { | 1122 | skb = np->tx_skbuff[i]; |
1043 | if (Flags & NV_TX2_UNDERFLOW) | 1123 | if (Flags & (NV_TX2_RETRYERROR|NV_TX2_CARRIERLOST|NV_TX2_LATECOLLISION| |
1044 | np->stats.tx_fifo_errors++; | 1124 | NV_TX2_UNDERFLOW|NV_TX2_ERROR)) { |
1045 | if (Flags & NV_TX2_CARRIERLOST) | 1125 | if (Flags & NV_TX2_UNDERFLOW) |
1046 | np->stats.tx_carrier_errors++; | 1126 | np->stats.tx_fifo_errors++; |
1047 | np->stats.tx_errors++; | 1127 | if (Flags & NV_TX2_CARRIERLOST) |
1048 | } else { | 1128 | np->stats.tx_carrier_errors++; |
1049 | np->stats.tx_packets++; | 1129 | np->stats.tx_errors++; |
1050 | np->stats.tx_bytes += np->tx_skbuff[i]->len; | 1130 | } else { |
1131 | np->stats.tx_packets++; | ||
1132 | np->stats.tx_bytes += skb->len; | ||
1133 | } | ||
1134 | nv_release_txskb(dev, i); | ||
1051 | } | 1135 | } |
1052 | } | 1136 | } |
1053 | pci_unmap_single(np->pci_dev, np->tx_dma[i], | ||
1054 | np->tx_skbuff[i]->len, | ||
1055 | PCI_DMA_TODEVICE); | ||
1056 | dev_kfree_skb_irq(np->tx_skbuff[i]); | ||
1057 | np->tx_skbuff[i] = NULL; | ||
1058 | np->nic_tx++; | 1137 | np->nic_tx++; |
1059 | } | 1138 | } |
1060 | if (np->next_tx - np->nic_tx < TX_LIMIT_START) | 1139 | if (np->next_tx - np->nic_tx < TX_LIMIT_START) |
@@ -1067,7 +1146,7 @@ static void nv_tx_done(struct net_device *dev) | |||
1067 | */ | 1146 | */ |
1068 | static void nv_tx_timeout(struct net_device *dev) | 1147 | static void nv_tx_timeout(struct net_device *dev) |
1069 | { | 1148 | { |
1070 | struct fe_priv *np = get_nvpriv(dev); | 1149 | struct fe_priv *np = netdev_priv(dev); |
1071 | u8 __iomem *base = get_hwbase(dev); | 1150 | u8 __iomem *base = get_hwbase(dev); |
1072 | 1151 | ||
1073 | printk(KERN_INFO "%s: Got tx_timeout. irq: %08x\n", dev->name, | 1152 | printk(KERN_INFO "%s: Got tx_timeout. irq: %08x\n", dev->name, |
@@ -1200,7 +1279,7 @@ static int nv_getlen(struct net_device *dev, void *packet, int datalen) | |||
1200 | 1279 | ||
1201 | static void nv_rx_process(struct net_device *dev) | 1280 | static void nv_rx_process(struct net_device *dev) |
1202 | { | 1281 | { |
1203 | struct fe_priv *np = get_nvpriv(dev); | 1282 | struct fe_priv *np = netdev_priv(dev); |
1204 | u32 Flags; | 1283 | u32 Flags; |
1205 | 1284 | ||
1206 | for (;;) { | 1285 | for (;;) { |
@@ -1355,7 +1434,7 @@ static void set_bufsize(struct net_device *dev) | |||
1355 | */ | 1434 | */ |
1356 | static int nv_change_mtu(struct net_device *dev, int new_mtu) | 1435 | static int nv_change_mtu(struct net_device *dev, int new_mtu) |
1357 | { | 1436 | { |
1358 | struct fe_priv *np = get_nvpriv(dev); | 1437 | struct fe_priv *np = netdev_priv(dev); |
1359 | int old_mtu; | 1438 | int old_mtu; |
1360 | 1439 | ||
1361 | if (new_mtu < 64 || new_mtu > np->pkt_limit) | 1440 | if (new_mtu < 64 || new_mtu > np->pkt_limit) |
@@ -1408,7 +1487,7 @@ static int nv_change_mtu(struct net_device *dev, int new_mtu) | |||
1408 | writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT), | 1487 | writel( ((RX_RING-1) << NVREG_RINGSZ_RXSHIFT) + ((TX_RING-1) << NVREG_RINGSZ_TXSHIFT), |
1409 | base + NvRegRingSizes); | 1488 | base + NvRegRingSizes); |
1410 | pci_push(base); | 1489 | pci_push(base); |
1411 | writel(NVREG_TXRXCTL_KICK|np->desc_ver, get_hwbase(dev) + NvRegTxRxControl); | 1490 | writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
1412 | pci_push(base); | 1491 | pci_push(base); |
1413 | 1492 | ||
1414 | /* restart rx engine */ | 1493 | /* restart rx engine */ |
@@ -1440,7 +1519,7 @@ static void nv_copy_mac_to_hw(struct net_device *dev) | |||
1440 | */ | 1519 | */ |
1441 | static int nv_set_mac_address(struct net_device *dev, void *addr) | 1520 | static int nv_set_mac_address(struct net_device *dev, void *addr) |
1442 | { | 1521 | { |
1443 | struct fe_priv *np = get_nvpriv(dev); | 1522 | struct fe_priv *np = netdev_priv(dev); |
1444 | struct sockaddr *macaddr = (struct sockaddr*)addr; | 1523 | struct sockaddr *macaddr = (struct sockaddr*)addr; |
1445 | 1524 | ||
1446 | if(!is_valid_ether_addr(macaddr->sa_data)) | 1525 | if(!is_valid_ether_addr(macaddr->sa_data)) |
@@ -1475,7 +1554,7 @@ static int nv_set_mac_address(struct net_device *dev, void *addr) | |||
1475 | */ | 1554 | */ |
1476 | static void nv_set_multicast(struct net_device *dev) | 1555 | static void nv_set_multicast(struct net_device *dev) |
1477 | { | 1556 | { |
1478 | struct fe_priv *np = get_nvpriv(dev); | 1557 | struct fe_priv *np = netdev_priv(dev); |
1479 | u8 __iomem *base = get_hwbase(dev); | 1558 | u8 __iomem *base = get_hwbase(dev); |
1480 | u32 addr[2]; | 1559 | u32 addr[2]; |
1481 | u32 mask[2]; | 1560 | u32 mask[2]; |
@@ -1535,7 +1614,7 @@ static void nv_set_multicast(struct net_device *dev) | |||
1535 | 1614 | ||
1536 | static int nv_update_linkspeed(struct net_device *dev) | 1615 | static int nv_update_linkspeed(struct net_device *dev) |
1537 | { | 1616 | { |
1538 | struct fe_priv *np = get_nvpriv(dev); | 1617 | struct fe_priv *np = netdev_priv(dev); |
1539 | u8 __iomem *base = get_hwbase(dev); | 1618 | u8 __iomem *base = get_hwbase(dev); |
1540 | int adv, lpa; | 1619 | int adv, lpa; |
1541 | int newls = np->linkspeed; | 1620 | int newls = np->linkspeed; |
@@ -1705,7 +1784,7 @@ static void nv_link_irq(struct net_device *dev) | |||
1705 | static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) | 1784 | static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) |
1706 | { | 1785 | { |
1707 | struct net_device *dev = (struct net_device *) data; | 1786 | struct net_device *dev = (struct net_device *) data; |
1708 | struct fe_priv *np = get_nvpriv(dev); | 1787 | struct fe_priv *np = netdev_priv(dev); |
1709 | u8 __iomem *base = get_hwbase(dev); | 1788 | u8 __iomem *base = get_hwbase(dev); |
1710 | u32 events; | 1789 | u32 events; |
1711 | int i; | 1790 | int i; |
@@ -1777,7 +1856,7 @@ static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) | |||
1777 | static void nv_do_nic_poll(unsigned long data) | 1856 | static void nv_do_nic_poll(unsigned long data) |
1778 | { | 1857 | { |
1779 | struct net_device *dev = (struct net_device *) data; | 1858 | struct net_device *dev = (struct net_device *) data; |
1780 | struct fe_priv *np = get_nvpriv(dev); | 1859 | struct fe_priv *np = netdev_priv(dev); |
1781 | u8 __iomem *base = get_hwbase(dev); | 1860 | u8 __iomem *base = get_hwbase(dev); |
1782 | 1861 | ||
1783 | disable_irq(dev->irq); | 1862 | disable_irq(dev->irq); |
@@ -1801,7 +1880,7 @@ static void nv_poll_controller(struct net_device *dev) | |||
1801 | 1880 | ||
1802 | static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1881 | static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1803 | { | 1882 | { |
1804 | struct fe_priv *np = get_nvpriv(dev); | 1883 | struct fe_priv *np = netdev_priv(dev); |
1805 | strcpy(info->driver, "forcedeth"); | 1884 | strcpy(info->driver, "forcedeth"); |
1806 | strcpy(info->version, FORCEDETH_VERSION); | 1885 | strcpy(info->version, FORCEDETH_VERSION); |
1807 | strcpy(info->bus_info, pci_name(np->pci_dev)); | 1886 | strcpy(info->bus_info, pci_name(np->pci_dev)); |
@@ -1809,7 +1888,7 @@ static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
1809 | 1888 | ||
1810 | static void nv_get_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) | 1889 | static void nv_get_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) |
1811 | { | 1890 | { |
1812 | struct fe_priv *np = get_nvpriv(dev); | 1891 | struct fe_priv *np = netdev_priv(dev); |
1813 | wolinfo->supported = WAKE_MAGIC; | 1892 | wolinfo->supported = WAKE_MAGIC; |
1814 | 1893 | ||
1815 | spin_lock_irq(&np->lock); | 1894 | spin_lock_irq(&np->lock); |
@@ -1820,7 +1899,7 @@ static void nv_get_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) | |||
1820 | 1899 | ||
1821 | static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) | 1900 | static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo) |
1822 | { | 1901 | { |
1823 | struct fe_priv *np = get_nvpriv(dev); | 1902 | struct fe_priv *np = netdev_priv(dev); |
1824 | u8 __iomem *base = get_hwbase(dev); | 1903 | u8 __iomem *base = get_hwbase(dev); |
1825 | 1904 | ||
1826 | spin_lock_irq(&np->lock); | 1905 | spin_lock_irq(&np->lock); |
@@ -2021,7 +2100,7 @@ static int nv_get_regs_len(struct net_device *dev) | |||
2021 | 2100 | ||
2022 | static void nv_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *buf) | 2101 | static void nv_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *buf) |
2023 | { | 2102 | { |
2024 | struct fe_priv *np = get_nvpriv(dev); | 2103 | struct fe_priv *np = netdev_priv(dev); |
2025 | u8 __iomem *base = get_hwbase(dev); | 2104 | u8 __iomem *base = get_hwbase(dev); |
2026 | u32 *rbuf = buf; | 2105 | u32 *rbuf = buf; |
2027 | int i; | 2106 | int i; |
@@ -2035,7 +2114,7 @@ static void nv_get_regs(struct net_device *dev, struct ethtool_regs *regs, void | |||
2035 | 2114 | ||
2036 | static int nv_nway_reset(struct net_device *dev) | 2115 | static int nv_nway_reset(struct net_device *dev) |
2037 | { | 2116 | { |
2038 | struct fe_priv *np = get_nvpriv(dev); | 2117 | struct fe_priv *np = netdev_priv(dev); |
2039 | int ret; | 2118 | int ret; |
2040 | 2119 | ||
2041 | spin_lock_irq(&np->lock); | 2120 | spin_lock_irq(&np->lock); |
@@ -2065,11 +2144,12 @@ static struct ethtool_ops ops = { | |||
2065 | .get_regs_len = nv_get_regs_len, | 2144 | .get_regs_len = nv_get_regs_len, |
2066 | .get_regs = nv_get_regs, | 2145 | .get_regs = nv_get_regs, |
2067 | .nway_reset = nv_nway_reset, | 2146 | .nway_reset = nv_nway_reset, |
2147 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
2068 | }; | 2148 | }; |
2069 | 2149 | ||
2070 | static int nv_open(struct net_device *dev) | 2150 | static int nv_open(struct net_device *dev) |
2071 | { | 2151 | { |
2072 | struct fe_priv *np = get_nvpriv(dev); | 2152 | struct fe_priv *np = netdev_priv(dev); |
2073 | u8 __iomem *base = get_hwbase(dev); | 2153 | u8 __iomem *base = get_hwbase(dev); |
2074 | int ret, oom, i; | 2154 | int ret, oom, i; |
2075 | 2155 | ||
@@ -2114,9 +2194,9 @@ static int nv_open(struct net_device *dev) | |||
2114 | /* 5) continue setup */ | 2194 | /* 5) continue setup */ |
2115 | writel(np->linkspeed, base + NvRegLinkSpeed); | 2195 | writel(np->linkspeed, base + NvRegLinkSpeed); |
2116 | writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3); | 2196 | writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3); |
2117 | writel(np->desc_ver, base + NvRegTxRxControl); | 2197 | writel(np->txrxctl_bits, base + NvRegTxRxControl); |
2118 | pci_push(base); | 2198 | pci_push(base); |
2119 | writel(NVREG_TXRXCTL_BIT1|np->desc_ver, base + NvRegTxRxControl); | 2199 | writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl); |
2120 | reg_delay(dev, NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31, | 2200 | reg_delay(dev, NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31, |
2121 | NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX, | 2201 | NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX, |
2122 | KERN_INFO "open: SetupReg5, Bit 31 remained off\n"); | 2202 | KERN_INFO "open: SetupReg5, Bit 31 remained off\n"); |
@@ -2205,7 +2285,7 @@ out_drain: | |||
2205 | 2285 | ||
2206 | static int nv_close(struct net_device *dev) | 2286 | static int nv_close(struct net_device *dev) |
2207 | { | 2287 | { |
2208 | struct fe_priv *np = get_nvpriv(dev); | 2288 | struct fe_priv *np = netdev_priv(dev); |
2209 | u8 __iomem *base; | 2289 | u8 __iomem *base; |
2210 | 2290 | ||
2211 | spin_lock_irq(&np->lock); | 2291 | spin_lock_irq(&np->lock); |
@@ -2261,7 +2341,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2261 | if (!dev) | 2341 | if (!dev) |
2262 | goto out; | 2342 | goto out; |
2263 | 2343 | ||
2264 | np = get_nvpriv(dev); | 2344 | np = netdev_priv(dev); |
2265 | np->pci_dev = pci_dev; | 2345 | np->pci_dev = pci_dev; |
2266 | spin_lock_init(&np->lock); | 2346 | spin_lock_init(&np->lock); |
2267 | SET_MODULE_OWNER(dev); | 2347 | SET_MODULE_OWNER(dev); |
@@ -2313,19 +2393,32 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2313 | if (pci_set_dma_mask(pci_dev, 0x0000007fffffffffULL)) { | 2393 | if (pci_set_dma_mask(pci_dev, 0x0000007fffffffffULL)) { |
2314 | printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n", | 2394 | printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n", |
2315 | pci_name(pci_dev)); | 2395 | pci_name(pci_dev)); |
2396 | } else { | ||
2397 | dev->features |= NETIF_F_HIGHDMA; | ||
2316 | } | 2398 | } |
2399 | np->txrxctl_bits = NVREG_TXRXCTL_DESC_3; | ||
2317 | } else if (id->driver_data & DEV_HAS_LARGEDESC) { | 2400 | } else if (id->driver_data & DEV_HAS_LARGEDESC) { |
2318 | /* packet format 2: supports jumbo frames */ | 2401 | /* packet format 2: supports jumbo frames */ |
2319 | np->desc_ver = DESC_VER_2; | 2402 | np->desc_ver = DESC_VER_2; |
2403 | np->txrxctl_bits = NVREG_TXRXCTL_DESC_2; | ||
2320 | } else { | 2404 | } else { |
2321 | /* original packet format */ | 2405 | /* original packet format */ |
2322 | np->desc_ver = DESC_VER_1; | 2406 | np->desc_ver = DESC_VER_1; |
2407 | np->txrxctl_bits = NVREG_TXRXCTL_DESC_1; | ||
2323 | } | 2408 | } |
2324 | 2409 | ||
2325 | np->pkt_limit = NV_PKTLIMIT_1; | 2410 | np->pkt_limit = NV_PKTLIMIT_1; |
2326 | if (id->driver_data & DEV_HAS_LARGEDESC) | 2411 | if (id->driver_data & DEV_HAS_LARGEDESC) |
2327 | np->pkt_limit = NV_PKTLIMIT_2; | 2412 | np->pkt_limit = NV_PKTLIMIT_2; |
2328 | 2413 | ||
2414 | if (id->driver_data & DEV_HAS_CHECKSUM) { | ||
2415 | np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; | ||
2416 | dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; | ||
2417 | #ifdef NETIF_F_TSO | ||
2418 | dev->features |= NETIF_F_TSO; | ||
2419 | #endif | ||
2420 | } | ||
2421 | |||
2329 | err = -ENOMEM; | 2422 | err = -ENOMEM; |
2330 | np->base = ioremap(addr, NV_PCI_REGSZ); | 2423 | np->base = ioremap(addr, NV_PCI_REGSZ); |
2331 | if (!np->base) | 2424 | if (!np->base) |
@@ -2377,8 +2470,9 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2377 | dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; | 2470 | dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; |
2378 | dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; | 2471 | dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; |
2379 | dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; | 2472 | dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; |
2473 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
2380 | 2474 | ||
2381 | if (!is_valid_ether_addr(dev->dev_addr)) { | 2475 | if (!is_valid_ether_addr(dev->perm_addr)) { |
2382 | /* | 2476 | /* |
2383 | * Bad mac address. At least one bios sets the mac address | 2477 | * Bad mac address. At least one bios sets the mac address |
2384 | * to 01:23:45:67:89:ab | 2478 | * to 01:23:45:67:89:ab |
@@ -2403,9 +2497,9 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
2403 | np->wolenabled = 0; | 2497 | np->wolenabled = 0; |
2404 | 2498 | ||
2405 | if (np->desc_ver == DESC_VER_1) { | 2499 | if (np->desc_ver == DESC_VER_1) { |
2406 | np->tx_flags = NV_TX_LASTPACKET|NV_TX_VALID; | 2500 | np->tx_flags = NV_TX_VALID; |
2407 | } else { | 2501 | } else { |
2408 | np->tx_flags = NV_TX2_LASTPACKET|NV_TX2_VALID; | 2502 | np->tx_flags = NV_TX2_VALID; |
2409 | } | 2503 | } |
2410 | np->irqmask = NVREG_IRQMASK_WANTED; | 2504 | np->irqmask = NVREG_IRQMASK_WANTED; |
2411 | if (id->driver_data & DEV_NEED_TIMERIRQ) | 2505 | if (id->driver_data & DEV_NEED_TIMERIRQ) |
@@ -2494,7 +2588,7 @@ out: | |||
2494 | static void __devexit nv_remove(struct pci_dev *pci_dev) | 2588 | static void __devexit nv_remove(struct pci_dev *pci_dev) |
2495 | { | 2589 | { |
2496 | struct net_device *dev = pci_get_drvdata(pci_dev); | 2590 | struct net_device *dev = pci_get_drvdata(pci_dev); |
2497 | struct fe_priv *np = get_nvpriv(dev); | 2591 | struct fe_priv *np = netdev_priv(dev); |
2498 | 2592 | ||
2499 | unregister_netdev(dev); | 2593 | unregister_netdev(dev); |
2500 | 2594 | ||
@@ -2525,35 +2619,35 @@ static struct pci_device_id pci_tbl[] = { | |||
2525 | }, | 2619 | }, |
2526 | { /* nForce3 Ethernet Controller */ | 2620 | { /* nForce3 Ethernet Controller */ |
2527 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_4), | 2621 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_4), |
2528 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC, | 2622 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
2529 | }, | 2623 | }, |
2530 | { /* nForce3 Ethernet Controller */ | 2624 | { /* nForce3 Ethernet Controller */ |
2531 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_5), | 2625 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_5), |
2532 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC, | 2626 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
2533 | }, | 2627 | }, |
2534 | { /* nForce3 Ethernet Controller */ | 2628 | { /* nForce3 Ethernet Controller */ |
2535 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_6), | 2629 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_6), |
2536 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC, | 2630 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
2537 | }, | 2631 | }, |
2538 | { /* nForce3 Ethernet Controller */ | 2632 | { /* nForce3 Ethernet Controller */ |
2539 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_7), | 2633 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_7), |
2540 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC, | 2634 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM, |
2541 | }, | 2635 | }, |
2542 | { /* CK804 Ethernet Controller */ | 2636 | { /* CK804 Ethernet Controller */ |
2543 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8), | 2637 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8), |
2544 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, | 2638 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
2545 | }, | 2639 | }, |
2546 | { /* CK804 Ethernet Controller */ | 2640 | { /* CK804 Ethernet Controller */ |
2547 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9), | 2641 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9), |
2548 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, | 2642 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
2549 | }, | 2643 | }, |
2550 | { /* MCP04 Ethernet Controller */ | 2644 | { /* MCP04 Ethernet Controller */ |
2551 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10), | 2645 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10), |
2552 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, | 2646 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
2553 | }, | 2647 | }, |
2554 | { /* MCP04 Ethernet Controller */ | 2648 | { /* MCP04 Ethernet Controller */ |
2555 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11), | 2649 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11), |
2556 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, | 2650 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
2557 | }, | 2651 | }, |
2558 | { /* MCP51 Ethernet Controller */ | 2652 | { /* MCP51 Ethernet Controller */ |
2559 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), | 2653 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), |
@@ -2565,11 +2659,11 @@ static struct pci_device_id pci_tbl[] = { | |||
2565 | }, | 2659 | }, |
2566 | { /* MCP55 Ethernet Controller */ | 2660 | { /* MCP55 Ethernet Controller */ |
2567 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), | 2661 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), |
2568 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, | 2662 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
2569 | }, | 2663 | }, |
2570 | { /* MCP55 Ethernet Controller */ | 2664 | { /* MCP55 Ethernet Controller */ |
2571 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), | 2665 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), |
2572 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA, | 2666 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA, |
2573 | }, | 2667 | }, |
2574 | {0,}, | 2668 | {0,}, |
2575 | }; | 2669 | }; |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 6518334b9280..ae5a2ed3b264 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -29,12 +29,7 @@ | |||
29 | * define the configuration needed by the board are defined in a | 29 | * define the configuration needed by the board are defined in a |
30 | * board structure in arch/ppc/platforms (though I do not | 30 | * board structure in arch/ppc/platforms (though I do not |
31 | * discount the possibility that other architectures could one | 31 | * discount the possibility that other architectures could one |
32 | * day be supported. One assumption the driver currently makes | 32 | * day be supported. |
33 | * is that the PHY is configured in such a way to advertise all | ||
34 | * capabilities. This is a sensible default, and on certain | ||
35 | * PHYs, changing this default encounters substantial errata | ||
36 | * issues. Future versions may remove this requirement, but for | ||
37 | * now, it is best for the firmware to ensure this is the case. | ||
38 | * | 33 | * |
39 | * The Gianfar Ethernet Controller uses a ring of buffer | 34 | * The Gianfar Ethernet Controller uses a ring of buffer |
40 | * descriptors. The beginning is indicated by a register | 35 | * descriptors. The beginning is indicated by a register |
@@ -47,7 +42,7 @@ | |||
47 | * corresponding bit in the IMASK register is also set (if | 42 | * corresponding bit in the IMASK register is also set (if |
48 | * interrupt coalescing is active, then the interrupt may not | 43 | * interrupt coalescing is active, then the interrupt may not |
49 | * happen immediately, but will wait until either a set number | 44 | * happen immediately, but will wait until either a set number |
50 | * of frames or amount of time have passed.). In NAPI, the | 45 | * of frames or amount of time have passed). In NAPI, the |
51 | * interrupt handler will signal there is work to be done, and | 46 | * interrupt handler will signal there is work to be done, and |
52 | * exit. Without NAPI, the packet(s) will be handled | 47 | * exit. Without NAPI, the packet(s) will be handled |
53 | * immediately. Both methods will start at the last known empty | 48 | * immediately. Both methods will start at the last known empty |
@@ -75,6 +70,7 @@ | |||
75 | #include <linux/sched.h> | 70 | #include <linux/sched.h> |
76 | #include <linux/string.h> | 71 | #include <linux/string.h> |
77 | #include <linux/errno.h> | 72 | #include <linux/errno.h> |
73 | #include <linux/unistd.h> | ||
78 | #include <linux/slab.h> | 74 | #include <linux/slab.h> |
79 | #include <linux/interrupt.h> | 75 | #include <linux/interrupt.h> |
80 | #include <linux/init.h> | 76 | #include <linux/init.h> |
@@ -97,9 +93,11 @@ | |||
97 | #include <linux/version.h> | 93 | #include <linux/version.h> |
98 | #include <linux/dma-mapping.h> | 94 | #include <linux/dma-mapping.h> |
99 | #include <linux/crc32.h> | 95 | #include <linux/crc32.h> |
96 | #include <linux/mii.h> | ||
97 | #include <linux/phy.h> | ||
100 | 98 | ||
101 | #include "gianfar.h" | 99 | #include "gianfar.h" |
102 | #include "gianfar_phy.h" | 100 | #include "gianfar_mii.h" |
103 | 101 | ||
104 | #define TX_TIMEOUT (1*HZ) | 102 | #define TX_TIMEOUT (1*HZ) |
105 | #define SKB_ALLOC_TIMEOUT 1000000 | 103 | #define SKB_ALLOC_TIMEOUT 1000000 |
@@ -113,9 +111,8 @@ | |||
113 | #endif | 111 | #endif |
114 | 112 | ||
115 | const char gfar_driver_name[] = "Gianfar Ethernet"; | 113 | const char gfar_driver_name[] = "Gianfar Ethernet"; |
116 | const char gfar_driver_version[] = "1.1"; | 114 | const char gfar_driver_version[] = "1.2"; |
117 | 115 | ||
118 | int startup_gfar(struct net_device *dev); | ||
119 | static int gfar_enet_open(struct net_device *dev); | 116 | static int gfar_enet_open(struct net_device *dev); |
120 | static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev); | 117 | static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev); |
121 | static void gfar_timeout(struct net_device *dev); | 118 | static void gfar_timeout(struct net_device *dev); |
@@ -126,17 +123,13 @@ static int gfar_set_mac_address(struct net_device *dev); | |||
126 | static int gfar_change_mtu(struct net_device *dev, int new_mtu); | 123 | static int gfar_change_mtu(struct net_device *dev, int new_mtu); |
127 | static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs); | 124 | static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs); |
128 | static irqreturn_t gfar_transmit(int irq, void *dev_id, struct pt_regs *regs); | 125 | static irqreturn_t gfar_transmit(int irq, void *dev_id, struct pt_regs *regs); |
129 | static irqreturn_t gfar_receive(int irq, void *dev_id, struct pt_regs *regs); | ||
130 | static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs); | 126 | static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs); |
131 | static irqreturn_t phy_interrupt(int irq, void *dev_id, struct pt_regs *regs); | ||
132 | static void gfar_phy_change(void *data); | ||
133 | static void gfar_phy_timer(unsigned long data); | ||
134 | static void adjust_link(struct net_device *dev); | 127 | static void adjust_link(struct net_device *dev); |
135 | static void init_registers(struct net_device *dev); | 128 | static void init_registers(struct net_device *dev); |
136 | static int init_phy(struct net_device *dev); | 129 | static int init_phy(struct net_device *dev); |
137 | static int gfar_probe(struct device *device); | 130 | static int gfar_probe(struct device *device); |
138 | static int gfar_remove(struct device *device); | 131 | static int gfar_remove(struct device *device); |
139 | void free_skb_resources(struct gfar_private *priv); | 132 | static void free_skb_resources(struct gfar_private *priv); |
140 | static void gfar_set_multi(struct net_device *dev); | 133 | static void gfar_set_multi(struct net_device *dev); |
141 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); | 134 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); |
142 | #ifdef CONFIG_GFAR_NAPI | 135 | #ifdef CONFIG_GFAR_NAPI |
@@ -144,7 +137,6 @@ static int gfar_poll(struct net_device *dev, int *budget); | |||
144 | #endif | 137 | #endif |
145 | int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); | 138 | int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); |
146 | static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length); | 139 | static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length); |
147 | static void gfar_phy_startup_timer(unsigned long data); | ||
148 | static void gfar_vlan_rx_register(struct net_device *netdev, | 140 | static void gfar_vlan_rx_register(struct net_device *netdev, |
149 | struct vlan_group *grp); | 141 | struct vlan_group *grp); |
150 | static void gfar_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); | 142 | static void gfar_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); |
@@ -162,6 +154,9 @@ int gfar_uses_fcb(struct gfar_private *priv) | |||
162 | else | 154 | else |
163 | return 0; | 155 | return 0; |
164 | } | 156 | } |
157 | |||
158 | /* Set up the ethernet device structure, private data, | ||
159 | * and anything else we need before we start */ | ||
165 | static int gfar_probe(struct device *device) | 160 | static int gfar_probe(struct device *device) |
166 | { | 161 | { |
167 | u32 tempval; | 162 | u32 tempval; |
@@ -175,7 +170,7 @@ static int gfar_probe(struct device *device) | |||
175 | 170 | ||
176 | einfo = (struct gianfar_platform_data *) pdev->dev.platform_data; | 171 | einfo = (struct gianfar_platform_data *) pdev->dev.platform_data; |
177 | 172 | ||
178 | if (einfo == NULL) { | 173 | if (NULL == einfo) { |
179 | printk(KERN_ERR "gfar %d: Missing additional data!\n", | 174 | printk(KERN_ERR "gfar %d: Missing additional data!\n", |
180 | pdev->id); | 175 | pdev->id); |
181 | 176 | ||
@@ -185,7 +180,7 @@ static int gfar_probe(struct device *device) | |||
185 | /* Create an ethernet device instance */ | 180 | /* Create an ethernet device instance */ |
186 | dev = alloc_etherdev(sizeof (*priv)); | 181 | dev = alloc_etherdev(sizeof (*priv)); |
187 | 182 | ||
188 | if (dev == NULL) | 183 | if (NULL == dev) |
189 | return -ENOMEM; | 184 | return -ENOMEM; |
190 | 185 | ||
191 | priv = netdev_priv(dev); | 186 | priv = netdev_priv(dev); |
@@ -207,20 +202,11 @@ static int gfar_probe(struct device *device) | |||
207 | priv->regs = (struct gfar *) | 202 | priv->regs = (struct gfar *) |
208 | ioremap(r->start, sizeof (struct gfar)); | 203 | ioremap(r->start, sizeof (struct gfar)); |
209 | 204 | ||
210 | if (priv->regs == NULL) { | 205 | if (NULL == priv->regs) { |
211 | err = -ENOMEM; | 206 | err = -ENOMEM; |
212 | goto regs_fail; | 207 | goto regs_fail; |
213 | } | 208 | } |
214 | 209 | ||
215 | /* Set the PHY base address */ | ||
216 | priv->phyregs = (struct gfar *) | ||
217 | ioremap(einfo->phy_reg_addr, sizeof (struct gfar)); | ||
218 | |||
219 | if (priv->phyregs == NULL) { | ||
220 | err = -ENOMEM; | ||
221 | goto phy_regs_fail; | ||
222 | } | ||
223 | |||
224 | spin_lock_init(&priv->lock); | 210 | spin_lock_init(&priv->lock); |
225 | 211 | ||
226 | dev_set_drvdata(device, dev); | 212 | dev_set_drvdata(device, dev); |
@@ -386,12 +372,10 @@ static int gfar_probe(struct device *device) | |||
386 | return 0; | 372 | return 0; |
387 | 373 | ||
388 | register_fail: | 374 | register_fail: |
389 | iounmap((void *) priv->phyregs); | ||
390 | phy_regs_fail: | ||
391 | iounmap((void *) priv->regs); | 375 | iounmap((void *) priv->regs); |
392 | regs_fail: | 376 | regs_fail: |
393 | free_netdev(dev); | 377 | free_netdev(dev); |
394 | return -ENOMEM; | 378 | return err; |
395 | } | 379 | } |
396 | 380 | ||
397 | static int gfar_remove(struct device *device) | 381 | static int gfar_remove(struct device *device) |
@@ -402,108 +386,41 @@ static int gfar_remove(struct device *device) | |||
402 | dev_set_drvdata(device, NULL); | 386 | dev_set_drvdata(device, NULL); |
403 | 387 | ||
404 | iounmap((void *) priv->regs); | 388 | iounmap((void *) priv->regs); |
405 | iounmap((void *) priv->phyregs); | ||
406 | free_netdev(dev); | 389 | free_netdev(dev); |
407 | 390 | ||
408 | return 0; | 391 | return 0; |
409 | } | 392 | } |
410 | 393 | ||
411 | 394 | ||
412 | /* Configure the PHY for dev. | 395 | /* Initializes driver's PHY state, and attaches to the PHY. |
413 | * returns 0 if success. -1 if failure | 396 | * Returns 0 on success. |
414 | */ | 397 | */ |
415 | static int init_phy(struct net_device *dev) | 398 | static int init_phy(struct net_device *dev) |
416 | { | 399 | { |
417 | struct gfar_private *priv = netdev_priv(dev); | 400 | struct gfar_private *priv = netdev_priv(dev); |
418 | struct phy_info *curphy; | 401 | uint gigabit_support = |
419 | unsigned int timeout = PHY_INIT_TIMEOUT; | 402 | priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT ? |
420 | struct gfar *phyregs = priv->phyregs; | 403 | SUPPORTED_1000baseT_Full : 0; |
421 | struct gfar_mii_info *mii_info; | 404 | struct phy_device *phydev; |
422 | int err; | ||
423 | 405 | ||
424 | priv->oldlink = 0; | 406 | priv->oldlink = 0; |
425 | priv->oldspeed = 0; | 407 | priv->oldspeed = 0; |
426 | priv->oldduplex = -1; | 408 | priv->oldduplex = -1; |
427 | 409 | ||
428 | mii_info = kmalloc(sizeof(struct gfar_mii_info), | 410 | phydev = phy_connect(dev, priv->einfo->bus_id, &adjust_link, 0); |
429 | GFP_KERNEL); | ||
430 | |||
431 | if(NULL == mii_info) { | ||
432 | if (netif_msg_ifup(priv)) | ||
433 | printk(KERN_ERR "%s: Could not allocate mii_info\n", | ||
434 | dev->name); | ||
435 | return -ENOMEM; | ||
436 | } | ||
437 | |||
438 | mii_info->speed = SPEED_1000; | ||
439 | mii_info->duplex = DUPLEX_FULL; | ||
440 | mii_info->pause = 0; | ||
441 | mii_info->link = 1; | ||
442 | |||
443 | mii_info->advertising = (ADVERTISED_10baseT_Half | | ||
444 | ADVERTISED_10baseT_Full | | ||
445 | ADVERTISED_100baseT_Half | | ||
446 | ADVERTISED_100baseT_Full | | ||
447 | ADVERTISED_1000baseT_Full); | ||
448 | mii_info->autoneg = 1; | ||
449 | 411 | ||
450 | spin_lock_init(&mii_info->mdio_lock); | 412 | if (IS_ERR(phydev)) { |
451 | 413 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | |
452 | mii_info->mii_id = priv->einfo->phyid; | 414 | return PTR_ERR(phydev); |
453 | |||
454 | mii_info->dev = dev; | ||
455 | |||
456 | mii_info->mdio_read = &read_phy_reg; | ||
457 | mii_info->mdio_write = &write_phy_reg; | ||
458 | |||
459 | priv->mii_info = mii_info; | ||
460 | |||
461 | /* Reset the management interface */ | ||
462 | gfar_write(&phyregs->miimcfg, MIIMCFG_RESET); | ||
463 | |||
464 | /* Setup the MII Mgmt clock speed */ | ||
465 | gfar_write(&phyregs->miimcfg, MIIMCFG_INIT_VALUE); | ||
466 | |||
467 | /* Wait until the bus is free */ | ||
468 | while ((gfar_read(&phyregs->miimind) & MIIMIND_BUSY) && | ||
469 | timeout--) | ||
470 | cpu_relax(); | ||
471 | |||
472 | if(timeout <= 0) { | ||
473 | printk(KERN_ERR "%s: The MII Bus is stuck!\n", | ||
474 | dev->name); | ||
475 | err = -1; | ||
476 | goto bus_fail; | ||
477 | } | ||
478 | |||
479 | /* get info for this PHY */ | ||
480 | curphy = get_phy_info(priv->mii_info); | ||
481 | |||
482 | if (curphy == NULL) { | ||
483 | if (netif_msg_ifup(priv)) | ||
484 | printk(KERN_ERR "%s: No PHY found\n", dev->name); | ||
485 | err = -1; | ||
486 | goto no_phy; | ||
487 | } | 415 | } |
488 | 416 | ||
489 | mii_info->phyinfo = curphy; | 417 | /* Remove any features not supported by the controller */ |
418 | phydev->supported &= (GFAR_SUPPORTED | gigabit_support); | ||
419 | phydev->advertising = phydev->supported; | ||
490 | 420 | ||
491 | /* Run the commands which initialize the PHY */ | 421 | priv->phydev = phydev; |
492 | if(curphy->init) { | ||
493 | err = curphy->init(priv->mii_info); | ||
494 | |||
495 | if (err) | ||
496 | goto phy_init_fail; | ||
497 | } | ||
498 | 422 | ||
499 | return 0; | 423 | return 0; |
500 | |||
501 | phy_init_fail: | ||
502 | no_phy: | ||
503 | bus_fail: | ||
504 | kfree(mii_info); | ||
505 | |||
506 | return err; | ||
507 | } | 424 | } |
508 | 425 | ||
509 | static void init_registers(struct net_device *dev) | 426 | static void init_registers(struct net_device *dev) |
@@ -603,24 +520,13 @@ void stop_gfar(struct net_device *dev) | |||
603 | struct gfar *regs = priv->regs; | 520 | struct gfar *regs = priv->regs; |
604 | unsigned long flags; | 521 | unsigned long flags; |
605 | 522 | ||
523 | phy_stop(priv->phydev); | ||
524 | |||
606 | /* Lock it down */ | 525 | /* Lock it down */ |
607 | spin_lock_irqsave(&priv->lock, flags); | 526 | spin_lock_irqsave(&priv->lock, flags); |
608 | 527 | ||
609 | /* Tell the kernel the link is down */ | ||
610 | priv->mii_info->link = 0; | ||
611 | adjust_link(dev); | ||
612 | |||
613 | gfar_halt(dev); | 528 | gfar_halt(dev); |
614 | 529 | ||
615 | if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) { | ||
616 | /* Clear any pending interrupts */ | ||
617 | mii_clear_phy_interrupt(priv->mii_info); | ||
618 | |||
619 | /* Disable PHY Interrupts */ | ||
620 | mii_configure_phy_interrupt(priv->mii_info, | ||
621 | MII_INTERRUPT_DISABLED); | ||
622 | } | ||
623 | |||
624 | spin_unlock_irqrestore(&priv->lock, flags); | 530 | spin_unlock_irqrestore(&priv->lock, flags); |
625 | 531 | ||
626 | /* Free the IRQs */ | 532 | /* Free the IRQs */ |
@@ -629,13 +535,7 @@ void stop_gfar(struct net_device *dev) | |||
629 | free_irq(priv->interruptTransmit, dev); | 535 | free_irq(priv->interruptTransmit, dev); |
630 | free_irq(priv->interruptReceive, dev); | 536 | free_irq(priv->interruptReceive, dev); |
631 | } else { | 537 | } else { |
632 | free_irq(priv->interruptTransmit, dev); | 538 | free_irq(priv->interruptTransmit, dev); |
633 | } | ||
634 | |||
635 | if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) { | ||
636 | free_irq(priv->einfo->interruptPHY, dev); | ||
637 | } else { | ||
638 | del_timer_sync(&priv->phy_info_timer); | ||
639 | } | 539 | } |
640 | 540 | ||
641 | free_skb_resources(priv); | 541 | free_skb_resources(priv); |
@@ -649,7 +549,7 @@ void stop_gfar(struct net_device *dev) | |||
649 | 549 | ||
650 | /* If there are any tx skbs or rx skbs still around, free them. | 550 | /* If there are any tx skbs or rx skbs still around, free them. |
651 | * Then free tx_skbuff and rx_skbuff */ | 551 | * Then free tx_skbuff and rx_skbuff */ |
652 | void free_skb_resources(struct gfar_private *priv) | 552 | static void free_skb_resources(struct gfar_private *priv) |
653 | { | 553 | { |
654 | struct rxbd8 *rxbdp; | 554 | struct rxbd8 *rxbdp; |
655 | struct txbd8 *txbdp; | 555 | struct txbd8 *txbdp; |
@@ -770,7 +670,7 @@ int startup_gfar(struct net_device *dev) | |||
770 | (struct sk_buff **) kmalloc(sizeof (struct sk_buff *) * | 670 | (struct sk_buff **) kmalloc(sizeof (struct sk_buff *) * |
771 | priv->tx_ring_size, GFP_KERNEL); | 671 | priv->tx_ring_size, GFP_KERNEL); |
772 | 672 | ||
773 | if (priv->tx_skbuff == NULL) { | 673 | if (NULL == priv->tx_skbuff) { |
774 | if (netif_msg_ifup(priv)) | 674 | if (netif_msg_ifup(priv)) |
775 | printk(KERN_ERR "%s: Could not allocate tx_skbuff\n", | 675 | printk(KERN_ERR "%s: Could not allocate tx_skbuff\n", |
776 | dev->name); | 676 | dev->name); |
@@ -785,7 +685,7 @@ int startup_gfar(struct net_device *dev) | |||
785 | (struct sk_buff **) kmalloc(sizeof (struct sk_buff *) * | 685 | (struct sk_buff **) kmalloc(sizeof (struct sk_buff *) * |
786 | priv->rx_ring_size, GFP_KERNEL); | 686 | priv->rx_ring_size, GFP_KERNEL); |
787 | 687 | ||
788 | if (priv->rx_skbuff == NULL) { | 688 | if (NULL == priv->rx_skbuff) { |
789 | if (netif_msg_ifup(priv)) | 689 | if (netif_msg_ifup(priv)) |
790 | printk(KERN_ERR "%s: Could not allocate rx_skbuff\n", | 690 | printk(KERN_ERR "%s: Could not allocate rx_skbuff\n", |
791 | dev->name); | 691 | dev->name); |
@@ -879,13 +779,7 @@ int startup_gfar(struct net_device *dev) | |||
879 | } | 779 | } |
880 | } | 780 | } |
881 | 781 | ||
882 | /* Set up the PHY change work queue */ | 782 | phy_start(priv->phydev); |
883 | INIT_WORK(&priv->tq, gfar_phy_change, dev); | ||
884 | |||
885 | init_timer(&priv->phy_info_timer); | ||
886 | priv->phy_info_timer.function = &gfar_phy_startup_timer; | ||
887 | priv->phy_info_timer.data = (unsigned long) priv->mii_info; | ||
888 | mod_timer(&priv->phy_info_timer, jiffies + HZ); | ||
889 | 783 | ||
890 | /* Configure the coalescing support */ | 784 | /* Configure the coalescing support */ |
891 | if (priv->txcoalescing) | 785 | if (priv->txcoalescing) |
@@ -933,11 +827,6 @@ tx_skb_fail: | |||
933 | priv->tx_bd_base, | 827 | priv->tx_bd_base, |
934 | gfar_read(®s->tbase0)); | 828 | gfar_read(®s->tbase0)); |
935 | 829 | ||
936 | if (priv->mii_info->phyinfo->close) | ||
937 | priv->mii_info->phyinfo->close(priv->mii_info); | ||
938 | |||
939 | kfree(priv->mii_info); | ||
940 | |||
941 | return err; | 830 | return err; |
942 | } | 831 | } |
943 | 832 | ||
@@ -1035,7 +924,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1035 | txbdp->status &= TXBD_WRAP; | 924 | txbdp->status &= TXBD_WRAP; |
1036 | 925 | ||
1037 | /* Set up checksumming */ | 926 | /* Set up checksumming */ |
1038 | if ((dev->features & NETIF_F_IP_CSUM) | 927 | if ((dev->features & NETIF_F_IP_CSUM) |
1039 | && (CHECKSUM_HW == skb->ip_summed)) { | 928 | && (CHECKSUM_HW == skb->ip_summed)) { |
1040 | fcb = gfar_add_fcb(skb, txbdp); | 929 | fcb = gfar_add_fcb(skb, txbdp); |
1041 | gfar_tx_checksum(skb, fcb); | 930 | gfar_tx_checksum(skb, fcb); |
@@ -1103,11 +992,9 @@ static int gfar_close(struct net_device *dev) | |||
1103 | struct gfar_private *priv = netdev_priv(dev); | 992 | struct gfar_private *priv = netdev_priv(dev); |
1104 | stop_gfar(dev); | 993 | stop_gfar(dev); |
1105 | 994 | ||
1106 | /* Shutdown the PHY */ | 995 | /* Disconnect from the PHY */ |
1107 | if (priv->mii_info->phyinfo->close) | 996 | phy_disconnect(priv->phydev); |
1108 | priv->mii_info->phyinfo->close(priv->mii_info); | 997 | priv->phydev = NULL; |
1109 | |||
1110 | kfree(priv->mii_info); | ||
1111 | 998 | ||
1112 | netif_stop_queue(dev); | 999 | netif_stop_queue(dev); |
1113 | 1000 | ||
@@ -1343,7 +1230,7 @@ struct sk_buff * gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp) | |||
1343 | while ((!skb) && timeout--) | 1230 | while ((!skb) && timeout--) |
1344 | skb = dev_alloc_skb(priv->rx_buffer_size + RXBUF_ALIGNMENT); | 1231 | skb = dev_alloc_skb(priv->rx_buffer_size + RXBUF_ALIGNMENT); |
1345 | 1232 | ||
1346 | if (skb == NULL) | 1233 | if (NULL == skb) |
1347 | return NULL; | 1234 | return NULL; |
1348 | 1235 | ||
1349 | /* We need the data buffer to be aligned properly. We will reserve | 1236 | /* We need the data buffer to be aligned properly. We will reserve |
@@ -1490,7 +1377,7 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, | |||
1490 | struct gfar_private *priv = netdev_priv(dev); | 1377 | struct gfar_private *priv = netdev_priv(dev); |
1491 | struct rxfcb *fcb = NULL; | 1378 | struct rxfcb *fcb = NULL; |
1492 | 1379 | ||
1493 | if (skb == NULL) { | 1380 | if (NULL == skb) { |
1494 | if (netif_msg_rx_err(priv)) | 1381 | if (netif_msg_rx_err(priv)) |
1495 | printk(KERN_WARNING "%s: Missing skb!!.\n", dev->name); | 1382 | printk(KERN_WARNING "%s: Missing skb!!.\n", dev->name); |
1496 | priv->stats.rx_dropped++; | 1383 | priv->stats.rx_dropped++; |
@@ -1718,131 +1605,9 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1718 | return IRQ_HANDLED; | 1605 | return IRQ_HANDLED; |
1719 | } | 1606 | } |
1720 | 1607 | ||
1721 | static irqreturn_t phy_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
1722 | { | ||
1723 | struct net_device *dev = (struct net_device *) dev_id; | ||
1724 | struct gfar_private *priv = netdev_priv(dev); | ||
1725 | |||
1726 | /* Clear the interrupt */ | ||
1727 | mii_clear_phy_interrupt(priv->mii_info); | ||
1728 | |||
1729 | /* Disable PHY interrupts */ | ||
1730 | mii_configure_phy_interrupt(priv->mii_info, | ||
1731 | MII_INTERRUPT_DISABLED); | ||
1732 | |||
1733 | /* Schedule the phy change */ | ||
1734 | schedule_work(&priv->tq); | ||
1735 | |||
1736 | return IRQ_HANDLED; | ||
1737 | } | ||
1738 | |||
1739 | /* Scheduled by the phy_interrupt/timer to handle PHY changes */ | ||
1740 | static void gfar_phy_change(void *data) | ||
1741 | { | ||
1742 | struct net_device *dev = (struct net_device *) data; | ||
1743 | struct gfar_private *priv = netdev_priv(dev); | ||
1744 | int result = 0; | ||
1745 | |||
1746 | /* Delay to give the PHY a chance to change the | ||
1747 | * register state */ | ||
1748 | msleep(1); | ||
1749 | |||
1750 | /* Update the link, speed, duplex */ | ||
1751 | result = priv->mii_info->phyinfo->read_status(priv->mii_info); | ||
1752 | |||
1753 | /* Adjust the known status as long as the link | ||
1754 | * isn't still coming up */ | ||
1755 | if((0 == result) || (priv->mii_info->link == 0)) | ||
1756 | adjust_link(dev); | ||
1757 | |||
1758 | /* Reenable interrupts, if needed */ | ||
1759 | if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) | ||
1760 | mii_configure_phy_interrupt(priv->mii_info, | ||
1761 | MII_INTERRUPT_ENABLED); | ||
1762 | } | ||
1763 | |||
1764 | /* Called every so often on systems that don't interrupt | ||
1765 | * the core for PHY changes */ | ||
1766 | static void gfar_phy_timer(unsigned long data) | ||
1767 | { | ||
1768 | struct net_device *dev = (struct net_device *) data; | ||
1769 | struct gfar_private *priv = netdev_priv(dev); | ||
1770 | |||
1771 | schedule_work(&priv->tq); | ||
1772 | |||
1773 | mod_timer(&priv->phy_info_timer, jiffies + | ||
1774 | GFAR_PHY_CHANGE_TIME * HZ); | ||
1775 | } | ||
1776 | |||
1777 | /* Keep trying aneg for some time | ||
1778 | * If, after GFAR_AN_TIMEOUT seconds, it has not | ||
1779 | * finished, we switch to forced. | ||
1780 | * Either way, once the process has completed, we either | ||
1781 | * request the interrupt, or switch the timer over to | ||
1782 | * using gfar_phy_timer to check status */ | ||
1783 | static void gfar_phy_startup_timer(unsigned long data) | ||
1784 | { | ||
1785 | int result; | ||
1786 | static int secondary = GFAR_AN_TIMEOUT; | ||
1787 | struct gfar_mii_info *mii_info = (struct gfar_mii_info *)data; | ||
1788 | struct gfar_private *priv = netdev_priv(mii_info->dev); | ||
1789 | |||
1790 | /* Configure the Auto-negotiation */ | ||
1791 | result = mii_info->phyinfo->config_aneg(mii_info); | ||
1792 | |||
1793 | /* If autonegotiation failed to start, and | ||
1794 | * we haven't timed out, reset the timer, and return */ | ||
1795 | if (result && secondary--) { | ||
1796 | mod_timer(&priv->phy_info_timer, jiffies + HZ); | ||
1797 | return; | ||
1798 | } else if (result) { | ||
1799 | /* Couldn't start autonegotiation. | ||
1800 | * Try switching to forced */ | ||
1801 | mii_info->autoneg = 0; | ||
1802 | result = mii_info->phyinfo->config_aneg(mii_info); | ||
1803 | |||
1804 | /* Forcing failed! Give up */ | ||
1805 | if(result) { | ||
1806 | if (netif_msg_link(priv)) | ||
1807 | printk(KERN_ERR "%s: Forcing failed!\n", | ||
1808 | mii_info->dev->name); | ||
1809 | return; | ||
1810 | } | ||
1811 | } | ||
1812 | |||
1813 | /* Kill the timer so it can be restarted */ | ||
1814 | del_timer_sync(&priv->phy_info_timer); | ||
1815 | |||
1816 | /* Grab the PHY interrupt, if necessary/possible */ | ||
1817 | if (priv->einfo->board_flags & FSL_GIANFAR_BRD_HAS_PHY_INTR) { | ||
1818 | if (request_irq(priv->einfo->interruptPHY, | ||
1819 | phy_interrupt, | ||
1820 | SA_SHIRQ, | ||
1821 | "phy_interrupt", | ||
1822 | mii_info->dev) < 0) { | ||
1823 | if (netif_msg_intr(priv)) | ||
1824 | printk(KERN_ERR "%s: Can't get IRQ %d (PHY)\n", | ||
1825 | mii_info->dev->name, | ||
1826 | priv->einfo->interruptPHY); | ||
1827 | } else { | ||
1828 | mii_configure_phy_interrupt(priv->mii_info, | ||
1829 | MII_INTERRUPT_ENABLED); | ||
1830 | return; | ||
1831 | } | ||
1832 | } | ||
1833 | |||
1834 | /* Start the timer again, this time in order to | ||
1835 | * handle a change in status */ | ||
1836 | init_timer(&priv->phy_info_timer); | ||
1837 | priv->phy_info_timer.function = &gfar_phy_timer; | ||
1838 | priv->phy_info_timer.data = (unsigned long) mii_info->dev; | ||
1839 | mod_timer(&priv->phy_info_timer, jiffies + | ||
1840 | GFAR_PHY_CHANGE_TIME * HZ); | ||
1841 | } | ||
1842 | |||
1843 | /* Called every time the controller might need to be made | 1608 | /* Called every time the controller might need to be made |
1844 | * aware of new link state. The PHY code conveys this | 1609 | * aware of new link state. The PHY code conveys this |
1845 | * information through variables in the priv structure, and this | 1610 | * information through variables in the phydev structure, and this |
1846 | * function converts those variables into the appropriate | 1611 | * function converts those variables into the appropriate |
1847 | * register values, and can bring down the device if needed. | 1612 | * register values, and can bring down the device if needed. |
1848 | */ | 1613 | */ |
@@ -1850,84 +1615,68 @@ static void adjust_link(struct net_device *dev) | |||
1850 | { | 1615 | { |
1851 | struct gfar_private *priv = netdev_priv(dev); | 1616 | struct gfar_private *priv = netdev_priv(dev); |
1852 | struct gfar *regs = priv->regs; | 1617 | struct gfar *regs = priv->regs; |
1853 | u32 tempval; | 1618 | unsigned long flags; |
1854 | struct gfar_mii_info *mii_info = priv->mii_info; | 1619 | struct phy_device *phydev = priv->phydev; |
1620 | int new_state = 0; | ||
1621 | |||
1622 | spin_lock_irqsave(&priv->lock, flags); | ||
1623 | if (phydev->link) { | ||
1624 | u32 tempval = gfar_read(®s->maccfg2); | ||
1855 | 1625 | ||
1856 | if (mii_info->link) { | ||
1857 | /* Now we make sure that we can be in full duplex mode. | 1626 | /* Now we make sure that we can be in full duplex mode. |
1858 | * If not, we operate in half-duplex mode. */ | 1627 | * If not, we operate in half-duplex mode. */ |
1859 | if (mii_info->duplex != priv->oldduplex) { | 1628 | if (phydev->duplex != priv->oldduplex) { |
1860 | if (!(mii_info->duplex)) { | 1629 | new_state = 1; |
1861 | tempval = gfar_read(®s->maccfg2); | 1630 | if (!(phydev->duplex)) |
1862 | tempval &= ~(MACCFG2_FULL_DUPLEX); | 1631 | tempval &= ~(MACCFG2_FULL_DUPLEX); |
1863 | gfar_write(®s->maccfg2, tempval); | 1632 | else |
1864 | |||
1865 | if (netif_msg_link(priv)) | ||
1866 | printk(KERN_INFO "%s: Half Duplex\n", | ||
1867 | dev->name); | ||
1868 | } else { | ||
1869 | tempval = gfar_read(®s->maccfg2); | ||
1870 | tempval |= MACCFG2_FULL_DUPLEX; | 1633 | tempval |= MACCFG2_FULL_DUPLEX; |
1871 | gfar_write(®s->maccfg2, tempval); | ||
1872 | 1634 | ||
1873 | if (netif_msg_link(priv)) | 1635 | priv->oldduplex = phydev->duplex; |
1874 | printk(KERN_INFO "%s: Full Duplex\n", | ||
1875 | dev->name); | ||
1876 | } | ||
1877 | |||
1878 | priv->oldduplex = mii_info->duplex; | ||
1879 | } | 1636 | } |
1880 | 1637 | ||
1881 | if (mii_info->speed != priv->oldspeed) { | 1638 | if (phydev->speed != priv->oldspeed) { |
1882 | switch (mii_info->speed) { | 1639 | new_state = 1; |
1640 | switch (phydev->speed) { | ||
1883 | case 1000: | 1641 | case 1000: |
1884 | tempval = gfar_read(®s->maccfg2); | ||
1885 | tempval = | 1642 | tempval = |
1886 | ((tempval & ~(MACCFG2_IF)) | MACCFG2_GMII); | 1643 | ((tempval & ~(MACCFG2_IF)) | MACCFG2_GMII); |
1887 | gfar_write(®s->maccfg2, tempval); | ||
1888 | break; | 1644 | break; |
1889 | case 100: | 1645 | case 100: |
1890 | case 10: | 1646 | case 10: |
1891 | tempval = gfar_read(®s->maccfg2); | ||
1892 | tempval = | 1647 | tempval = |
1893 | ((tempval & ~(MACCFG2_IF)) | MACCFG2_MII); | 1648 | ((tempval & ~(MACCFG2_IF)) | MACCFG2_MII); |
1894 | gfar_write(®s->maccfg2, tempval); | ||
1895 | break; | 1649 | break; |
1896 | default: | 1650 | default: |
1897 | if (netif_msg_link(priv)) | 1651 | if (netif_msg_link(priv)) |
1898 | printk(KERN_WARNING | 1652 | printk(KERN_WARNING |
1899 | "%s: Ack! Speed (%d) is not 10/100/1000!\n", | 1653 | "%s: Ack! Speed (%d) is not 10/100/1000!\n", |
1900 | dev->name, mii_info->speed); | 1654 | dev->name, phydev->speed); |
1901 | break; | 1655 | break; |
1902 | } | 1656 | } |
1903 | 1657 | ||
1904 | if (netif_msg_link(priv)) | 1658 | priv->oldspeed = phydev->speed; |
1905 | printk(KERN_INFO "%s: Speed %dBT\n", dev->name, | ||
1906 | mii_info->speed); | ||
1907 | |||
1908 | priv->oldspeed = mii_info->speed; | ||
1909 | } | 1659 | } |
1910 | 1660 | ||
1661 | gfar_write(®s->maccfg2, tempval); | ||
1662 | |||
1911 | if (!priv->oldlink) { | 1663 | if (!priv->oldlink) { |
1912 | if (netif_msg_link(priv)) | 1664 | new_state = 1; |
1913 | printk(KERN_INFO "%s: Link is up\n", dev->name); | ||
1914 | priv->oldlink = 1; | 1665 | priv->oldlink = 1; |
1915 | netif_carrier_on(dev); | ||
1916 | netif_schedule(dev); | 1666 | netif_schedule(dev); |
1917 | } | 1667 | } |
1918 | } else { | 1668 | } else if (priv->oldlink) { |
1919 | if (priv->oldlink) { | 1669 | new_state = 1; |
1920 | if (netif_msg_link(priv)) | 1670 | priv->oldlink = 0; |
1921 | printk(KERN_INFO "%s: Link is down\n", | 1671 | priv->oldspeed = 0; |
1922 | dev->name); | 1672 | priv->oldduplex = -1; |
1923 | priv->oldlink = 0; | ||
1924 | priv->oldspeed = 0; | ||
1925 | priv->oldduplex = -1; | ||
1926 | netif_carrier_off(dev); | ||
1927 | } | ||
1928 | } | 1673 | } |
1929 | } | ||
1930 | 1674 | ||
1675 | if (new_state && netif_msg_link(priv)) | ||
1676 | phy_print_status(phydev); | ||
1677 | |||
1678 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1679 | } | ||
1931 | 1680 | ||
1932 | /* Update the hash table based on the current list of multicast | 1681 | /* Update the hash table based on the current list of multicast |
1933 | * addresses we subscribe to. Also, change the promiscuity of | 1682 | * addresses we subscribe to. Also, change the promiscuity of |
@@ -2122,12 +1871,23 @@ static struct device_driver gfar_driver = { | |||
2122 | 1871 | ||
2123 | static int __init gfar_init(void) | 1872 | static int __init gfar_init(void) |
2124 | { | 1873 | { |
2125 | return driver_register(&gfar_driver); | 1874 | int err = gfar_mdio_init(); |
1875 | |||
1876 | if (err) | ||
1877 | return err; | ||
1878 | |||
1879 | err = driver_register(&gfar_driver); | ||
1880 | |||
1881 | if (err) | ||
1882 | gfar_mdio_exit(); | ||
1883 | |||
1884 | return err; | ||
2126 | } | 1885 | } |
2127 | 1886 | ||
2128 | static void __exit gfar_exit(void) | 1887 | static void __exit gfar_exit(void) |
2129 | { | 1888 | { |
2130 | driver_unregister(&gfar_driver); | 1889 | driver_unregister(&gfar_driver); |
1890 | gfar_mdio_exit(); | ||
2131 | } | 1891 | } |
2132 | 1892 | ||
2133 | module_init(gfar_init); | 1893 | module_init(gfar_init); |
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index 28af087d9fbb..c77ca6c0d04a 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -17,7 +17,6 @@ | |||
17 | * | 17 | * |
18 | * Still left to do: | 18 | * Still left to do: |
19 | * -Add support for module parameters | 19 | * -Add support for module parameters |
20 | * -Add support for ethtool -s | ||
21 | * -Add patch for ethtool phys id | 20 | * -Add patch for ethtool phys id |
22 | */ | 21 | */ |
23 | #ifndef __GIANFAR_H | 22 | #ifndef __GIANFAR_H |
@@ -37,7 +36,8 @@ | |||
37 | #include <linux/skbuff.h> | 36 | #include <linux/skbuff.h> |
38 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
39 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
40 | #include <linux/fsl_devices.h> | 39 | #include <linux/mii.h> |
40 | #include <linux/phy.h> | ||
41 | 41 | ||
42 | #include <asm/io.h> | 42 | #include <asm/io.h> |
43 | #include <asm/irq.h> | 43 | #include <asm/irq.h> |
@@ -48,7 +48,8 @@ | |||
48 | #include <linux/workqueue.h> | 48 | #include <linux/workqueue.h> |
49 | #include <linux/ethtool.h> | 49 | #include <linux/ethtool.h> |
50 | #include <linux/netdevice.h> | 50 | #include <linux/netdevice.h> |
51 | #include "gianfar_phy.h" | 51 | #include <linux/fsl_devices.h> |
52 | #include "gianfar_mii.h" | ||
52 | 53 | ||
53 | /* The maximum number of packets to be handled in one call of gfar_poll */ | 54 | /* The maximum number of packets to be handled in one call of gfar_poll */ |
54 | #define GFAR_DEV_WEIGHT 64 | 55 | #define GFAR_DEV_WEIGHT 64 |
@@ -73,7 +74,7 @@ | |||
73 | #define PHY_INIT_TIMEOUT 100000 | 74 | #define PHY_INIT_TIMEOUT 100000 |
74 | #define GFAR_PHY_CHANGE_TIME 2 | 75 | #define GFAR_PHY_CHANGE_TIME 2 |
75 | 76 | ||
76 | #define DEVICE_NAME "%s: Gianfar Ethernet Controller Version 1.1, " | 77 | #define DEVICE_NAME "%s: Gianfar Ethernet Controller Version 1.2, " |
77 | #define DRV_NAME "gfar-enet" | 78 | #define DRV_NAME "gfar-enet" |
78 | extern const char gfar_driver_name[]; | 79 | extern const char gfar_driver_name[]; |
79 | extern const char gfar_driver_version[]; | 80 | extern const char gfar_driver_version[]; |
@@ -578,12 +579,7 @@ struct gfar { | |||
578 | u32 hafdup; /* 0x.50c - Half Duplex Register */ | 579 | u32 hafdup; /* 0x.50c - Half Duplex Register */ |
579 | u32 maxfrm; /* 0x.510 - Maximum Frame Length Register */ | 580 | u32 maxfrm; /* 0x.510 - Maximum Frame Length Register */ |
580 | u8 res18[12]; | 581 | u8 res18[12]; |
581 | u32 miimcfg; /* 0x.520 - MII Management Configuration Register */ | 582 | u8 gfar_mii_regs[24]; /* See gianfar_phy.h */ |
582 | u32 miimcom; /* 0x.524 - MII Management Command Register */ | ||
583 | u32 miimadd; /* 0x.528 - MII Management Address Register */ | ||
584 | u32 miimcon; /* 0x.52c - MII Management Control Register */ | ||
585 | u32 miimstat; /* 0x.530 - MII Management Status Register */ | ||
586 | u32 miimind; /* 0x.534 - MII Management Indicator Register */ | ||
587 | u8 res19[4]; | 583 | u8 res19[4]; |
588 | u32 ifstat; /* 0x.53c - Interface Status Register */ | 584 | u32 ifstat; /* 0x.53c - Interface Status Register */ |
589 | u32 macstnaddr1; /* 0x.540 - Station Address Part 1 Register */ | 585 | u32 macstnaddr1; /* 0x.540 - Station Address Part 1 Register */ |
@@ -688,9 +684,6 @@ struct gfar_private { | |||
688 | struct gfar *regs; /* Pointer to the GFAR memory mapped Registers */ | 684 | struct gfar *regs; /* Pointer to the GFAR memory mapped Registers */ |
689 | u32 *hash_regs[16]; | 685 | u32 *hash_regs[16]; |
690 | int hash_width; | 686 | int hash_width; |
691 | struct gfar *phyregs; | ||
692 | struct work_struct tq; | ||
693 | struct timer_list phy_info_timer; | ||
694 | struct net_device_stats stats; /* linux network statistics */ | 687 | struct net_device_stats stats; /* linux network statistics */ |
695 | struct gfar_extra_stats extra_stats; | 688 | struct gfar_extra_stats extra_stats; |
696 | spinlock_t lock; | 689 | spinlock_t lock; |
@@ -710,7 +703,8 @@ struct gfar_private { | |||
710 | unsigned int interruptError; | 703 | unsigned int interruptError; |
711 | struct gianfar_platform_data *einfo; | 704 | struct gianfar_platform_data *einfo; |
712 | 705 | ||
713 | struct gfar_mii_info *mii_info; | 706 | struct phy_device *phydev; |
707 | struct mii_bus *mii_bus; | ||
714 | int oldspeed; | 708 | int oldspeed; |
715 | int oldduplex; | 709 | int oldduplex; |
716 | int oldlink; | 710 | int oldlink; |
@@ -732,4 +726,12 @@ extern inline void gfar_write(volatile unsigned *addr, u32 val) | |||
732 | 726 | ||
733 | extern struct ethtool_ops *gfar_op_array[]; | 727 | extern struct ethtool_ops *gfar_op_array[]; |
734 | 728 | ||
729 | extern irqreturn_t gfar_receive(int irq, void *dev_id, struct pt_regs *regs); | ||
730 | extern int startup_gfar(struct net_device *dev); | ||
731 | extern void stop_gfar(struct net_device *dev); | ||
732 | extern void gfar_halt(struct net_device *dev); | ||
733 | extern void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev, | ||
734 | int enable, u32 regnum, u32 read); | ||
735 | void gfar_setup_stashing(struct net_device *dev); | ||
736 | |||
735 | #endif /* __GIANFAR_H */ | 737 | #endif /* __GIANFAR_H */ |
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index a451de629197..68e3578e7613 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c | |||
@@ -39,17 +39,18 @@ | |||
39 | #include <asm/types.h> | 39 | #include <asm/types.h> |
40 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
41 | #include <linux/ethtool.h> | 41 | #include <linux/ethtool.h> |
42 | #include <linux/mii.h> | ||
43 | #include <linux/phy.h> | ||
42 | 44 | ||
43 | #include "gianfar.h" | 45 | #include "gianfar.h" |
44 | 46 | ||
45 | #define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0)) | 47 | #define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0)) |
46 | 48 | ||
47 | extern int startup_gfar(struct net_device *dev); | ||
48 | extern void stop_gfar(struct net_device *dev); | ||
49 | extern void gfar_halt(struct net_device *dev); | ||
50 | extern void gfar_start(struct net_device *dev); | 49 | extern void gfar_start(struct net_device *dev); |
51 | extern int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); | 50 | extern int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); |
52 | 51 | ||
52 | #define GFAR_MAX_COAL_USECS 0xffff | ||
53 | #define GFAR_MAX_COAL_FRAMES 0xff | ||
53 | static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, | 54 | static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, |
54 | u64 * buf); | 55 | u64 * buf); |
55 | static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf); | 56 | static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf); |
@@ -182,38 +183,32 @@ static void gfar_gdrvinfo(struct net_device *dev, struct | |||
182 | drvinfo->eedump_len = 0; | 183 | drvinfo->eedump_len = 0; |
183 | } | 184 | } |
184 | 185 | ||
186 | |||
187 | static int gfar_ssettings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
188 | { | ||
189 | struct gfar_private *priv = netdev_priv(dev); | ||
190 | struct phy_device *phydev = priv->phydev; | ||
191 | |||
192 | if (NULL == phydev) | ||
193 | return -ENODEV; | ||
194 | |||
195 | return phy_ethtool_sset(phydev, cmd); | ||
196 | } | ||
197 | |||
198 | |||
185 | /* Return the current settings in the ethtool_cmd structure */ | 199 | /* Return the current settings in the ethtool_cmd structure */ |
186 | static int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd) | 200 | static int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd) |
187 | { | 201 | { |
188 | struct gfar_private *priv = netdev_priv(dev); | 202 | struct gfar_private *priv = netdev_priv(dev); |
189 | uint gigabit_support = | 203 | struct phy_device *phydev = priv->phydev; |
190 | priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT ? | 204 | |
191 | SUPPORTED_1000baseT_Full : 0; | 205 | if (NULL == phydev) |
192 | uint gigabit_advert = | 206 | return -ENODEV; |
193 | priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT ? | 207 | |
194 | ADVERTISED_1000baseT_Full: 0; | ||
195 | |||
196 | cmd->supported = (SUPPORTED_10baseT_Half | ||
197 | | SUPPORTED_100baseT_Half | ||
198 | | SUPPORTED_100baseT_Full | ||
199 | | gigabit_support | SUPPORTED_Autoneg); | ||
200 | |||
201 | /* For now, we always advertise everything */ | ||
202 | cmd->advertising = (ADVERTISED_10baseT_Half | ||
203 | | ADVERTISED_100baseT_Half | ||
204 | | ADVERTISED_100baseT_Full | ||
205 | | gigabit_advert | ADVERTISED_Autoneg); | ||
206 | |||
207 | cmd->speed = priv->mii_info->speed; | ||
208 | cmd->duplex = priv->mii_info->duplex; | ||
209 | cmd->port = PORT_MII; | ||
210 | cmd->phy_address = priv->mii_info->mii_id; | ||
211 | cmd->transceiver = XCVR_EXTERNAL; | ||
212 | cmd->autoneg = AUTONEG_ENABLE; | ||
213 | cmd->maxtxpkt = priv->txcount; | 208 | cmd->maxtxpkt = priv->txcount; |
214 | cmd->maxrxpkt = priv->rxcount; | 209 | cmd->maxrxpkt = priv->rxcount; |
215 | 210 | ||
216 | return 0; | 211 | return phy_ethtool_gset(phydev, cmd); |
217 | } | 212 | } |
218 | 213 | ||
219 | /* Return the length of the register structure */ | 214 | /* Return the length of the register structure */ |
@@ -241,14 +236,14 @@ static unsigned int gfar_usecs2ticks(struct gfar_private *priv, unsigned int use | |||
241 | unsigned int count; | 236 | unsigned int count; |
242 | 237 | ||
243 | /* The timer is different, depending on the interface speed */ | 238 | /* The timer is different, depending on the interface speed */ |
244 | switch (priv->mii_info->speed) { | 239 | switch (priv->phydev->speed) { |
245 | case 1000: | 240 | case SPEED_1000: |
246 | count = GFAR_GBIT_TIME; | 241 | count = GFAR_GBIT_TIME; |
247 | break; | 242 | break; |
248 | case 100: | 243 | case SPEED_100: |
249 | count = GFAR_100_TIME; | 244 | count = GFAR_100_TIME; |
250 | break; | 245 | break; |
251 | case 10: | 246 | case SPEED_10: |
252 | default: | 247 | default: |
253 | count = GFAR_10_TIME; | 248 | count = GFAR_10_TIME; |
254 | break; | 249 | break; |
@@ -265,14 +260,14 @@ static unsigned int gfar_ticks2usecs(struct gfar_private *priv, unsigned int tic | |||
265 | unsigned int count; | 260 | unsigned int count; |
266 | 261 | ||
267 | /* The timer is different, depending on the interface speed */ | 262 | /* The timer is different, depending on the interface speed */ |
268 | switch (priv->mii_info->speed) { | 263 | switch (priv->phydev->speed) { |
269 | case 1000: | 264 | case SPEED_1000: |
270 | count = GFAR_GBIT_TIME; | 265 | count = GFAR_GBIT_TIME; |
271 | break; | 266 | break; |
272 | case 100: | 267 | case SPEED_100: |
273 | count = GFAR_100_TIME; | 268 | count = GFAR_100_TIME; |
274 | break; | 269 | break; |
275 | case 10: | 270 | case SPEED_10: |
276 | default: | 271 | default: |
277 | count = GFAR_10_TIME; | 272 | count = GFAR_10_TIME; |
278 | break; | 273 | break; |
@@ -292,6 +287,9 @@ static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals | |||
292 | if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE)) | 287 | if (!(priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_COALESCE)) |
293 | return -EOPNOTSUPP; | 288 | return -EOPNOTSUPP; |
294 | 289 | ||
290 | if (NULL == priv->phydev) | ||
291 | return -ENODEV; | ||
292 | |||
295 | cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, priv->rxtime); | 293 | cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, priv->rxtime); |
296 | cvals->rx_max_coalesced_frames = priv->rxcount; | 294 | cvals->rx_max_coalesced_frames = priv->rxcount; |
297 | 295 | ||
@@ -348,6 +346,22 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals | |||
348 | else | 346 | else |
349 | priv->rxcoalescing = 1; | 347 | priv->rxcoalescing = 1; |
350 | 348 | ||
349 | if (NULL == priv->phydev) | ||
350 | return -ENODEV; | ||
351 | |||
352 | /* Check the bounds of the values */ | ||
353 | if (cvals->rx_coalesce_usecs > GFAR_MAX_COAL_USECS) { | ||
354 | pr_info("Coalescing is limited to %d microseconds\n", | ||
355 | GFAR_MAX_COAL_USECS); | ||
356 | return -EINVAL; | ||
357 | } | ||
358 | |||
359 | if (cvals->rx_max_coalesced_frames > GFAR_MAX_COAL_FRAMES) { | ||
360 | pr_info("Coalescing is limited to %d frames\n", | ||
361 | GFAR_MAX_COAL_FRAMES); | ||
362 | return -EINVAL; | ||
363 | } | ||
364 | |||
351 | priv->rxtime = gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs); | 365 | priv->rxtime = gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs); |
352 | priv->rxcount = cvals->rx_max_coalesced_frames; | 366 | priv->rxcount = cvals->rx_max_coalesced_frames; |
353 | 367 | ||
@@ -358,6 +372,19 @@ static int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals | |||
358 | else | 372 | else |
359 | priv->txcoalescing = 1; | 373 | priv->txcoalescing = 1; |
360 | 374 | ||
375 | /* Check the bounds of the values */ | ||
376 | if (cvals->tx_coalesce_usecs > GFAR_MAX_COAL_USECS) { | ||
377 | pr_info("Coalescing is limited to %d microseconds\n", | ||
378 | GFAR_MAX_COAL_USECS); | ||
379 | return -EINVAL; | ||
380 | } | ||
381 | |||
382 | if (cvals->tx_max_coalesced_frames > GFAR_MAX_COAL_FRAMES) { | ||
383 | pr_info("Coalescing is limited to %d frames\n", | ||
384 | GFAR_MAX_COAL_FRAMES); | ||
385 | return -EINVAL; | ||
386 | } | ||
387 | |||
361 | priv->txtime = gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs); | 388 | priv->txtime = gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs); |
362 | priv->txcount = cvals->tx_max_coalesced_frames; | 389 | priv->txcount = cvals->tx_max_coalesced_frames; |
363 | 390 | ||
@@ -536,6 +563,7 @@ static void gfar_set_msglevel(struct net_device *dev, uint32_t data) | |||
536 | 563 | ||
537 | struct ethtool_ops gfar_ethtool_ops = { | 564 | struct ethtool_ops gfar_ethtool_ops = { |
538 | .get_settings = gfar_gsettings, | 565 | .get_settings = gfar_gsettings, |
566 | .set_settings = gfar_ssettings, | ||
539 | .get_drvinfo = gfar_gdrvinfo, | 567 | .get_drvinfo = gfar_gdrvinfo, |
540 | .get_regs_len = gfar_reglen, | 568 | .get_regs_len = gfar_reglen, |
541 | .get_regs = gfar_get_regs, | 569 | .get_regs = gfar_get_regs, |
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c new file mode 100644 index 000000000000..1eca1dbca7f1 --- /dev/null +++ b/drivers/net/gianfar_mii.c | |||
@@ -0,0 +1,219 @@ | |||
1 | /* | ||
2 | * drivers/net/gianfar_mii.c | ||
3 | * | ||
4 | * Gianfar Ethernet Driver -- MIIM bus implementation | ||
5 | * Provides Bus interface for MIIM regs | ||
6 | * | ||
7 | * Author: Andy Fleming | ||
8 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) | ||
9 | * | ||
10 | * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #include <linux/config.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/string.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/unistd.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/netdevice.h> | ||
30 | #include <linux/etherdevice.h> | ||
31 | #include <linux/skbuff.h> | ||
32 | #include <linux/spinlock.h> | ||
33 | #include <linux/mm.h> | ||
34 | #include <linux/module.h> | ||
35 | #include <linux/version.h> | ||
36 | #include <asm/ocp.h> | ||
37 | #include <linux/crc32.h> | ||
38 | #include <linux/mii.h> | ||
39 | #include <linux/phy.h> | ||
40 | |||
41 | #include <asm/io.h> | ||
42 | #include <asm/irq.h> | ||
43 | #include <asm/uaccess.h> | ||
44 | |||
45 | #include "gianfar.h" | ||
46 | #include "gianfar_mii.h" | ||
47 | |||
48 | /* Write value to the PHY at mii_id at register regnum, | ||
49 | * on the bus, waiting until the write is done before returning. | ||
50 | * All PHY configuration is done through the TSEC1 MIIM regs */ | ||
51 | int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) | ||
52 | { | ||
53 | struct gfar_mii *regs = bus->priv; | ||
54 | |||
55 | /* Set the PHY address and the register address we want to write */ | ||
56 | gfar_write(®s->miimadd, (mii_id << 8) | regnum); | ||
57 | |||
58 | /* Write out the value we want */ | ||
59 | gfar_write(®s->miimcon, value); | ||
60 | |||
61 | /* Wait for the transaction to finish */ | ||
62 | while (gfar_read(®s->miimind) & MIIMIND_BUSY) | ||
63 | cpu_relax(); | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | /* Read the bus for PHY at addr mii_id, register regnum, and | ||
69 | * return the value. Clears miimcom first. All PHY | ||
70 | * configuration has to be done through the TSEC1 MIIM regs */ | ||
71 | int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) | ||
72 | { | ||
73 | struct gfar_mii *regs = bus->priv; | ||
74 | u16 value; | ||
75 | |||
76 | /* Set the PHY address and the register address we want to read */ | ||
77 | gfar_write(®s->miimadd, (mii_id << 8) | regnum); | ||
78 | |||
79 | /* Clear miimcom, and then initiate a read */ | ||
80 | gfar_write(®s->miimcom, 0); | ||
81 | gfar_write(®s->miimcom, MII_READ_COMMAND); | ||
82 | |||
83 | /* Wait for the transaction to finish */ | ||
84 | while (gfar_read(®s->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY)) | ||
85 | cpu_relax(); | ||
86 | |||
87 | /* Grab the value of the register from miimstat */ | ||
88 | value = gfar_read(®s->miimstat); | ||
89 | |||
90 | return value; | ||
91 | } | ||
92 | |||
93 | |||
94 | /* Reset the MIIM registers, and wait for the bus to free */ | ||
95 | int gfar_mdio_reset(struct mii_bus *bus) | ||
96 | { | ||
97 | struct gfar_mii *regs = bus->priv; | ||
98 | unsigned int timeout = PHY_INIT_TIMEOUT; | ||
99 | |||
100 | spin_lock_bh(&bus->mdio_lock); | ||
101 | |||
102 | /* Reset the management interface */ | ||
103 | gfar_write(®s->miimcfg, MIIMCFG_RESET); | ||
104 | |||
105 | /* Setup the MII Mgmt clock speed */ | ||
106 | gfar_write(®s->miimcfg, MIIMCFG_INIT_VALUE); | ||
107 | |||
108 | /* Wait until the bus is free */ | ||
109 | while ((gfar_read(®s->miimind) & MIIMIND_BUSY) && | ||
110 | timeout--) | ||
111 | cpu_relax(); | ||
112 | |||
113 | spin_unlock_bh(&bus->mdio_lock); | ||
114 | |||
115 | if(timeout <= 0) { | ||
116 | printk(KERN_ERR "%s: The MII Bus is stuck!\n", | ||
117 | bus->name); | ||
118 | return -EBUSY; | ||
119 | } | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | |||
125 | int gfar_mdio_probe(struct device *dev) | ||
126 | { | ||
127 | struct platform_device *pdev = to_platform_device(dev); | ||
128 | struct gianfar_mdio_data *pdata; | ||
129 | struct gfar_mii *regs; | ||
130 | struct mii_bus *new_bus; | ||
131 | int err = 0; | ||
132 | |||
133 | if (NULL == dev) | ||
134 | return -EINVAL; | ||
135 | |||
136 | new_bus = kmalloc(sizeof(struct mii_bus), GFP_KERNEL); | ||
137 | |||
138 | if (NULL == new_bus) | ||
139 | return -ENOMEM; | ||
140 | |||
141 | new_bus->name = "Gianfar MII Bus", | ||
142 | new_bus->read = &gfar_mdio_read, | ||
143 | new_bus->write = &gfar_mdio_write, | ||
144 | new_bus->reset = &gfar_mdio_reset, | ||
145 | new_bus->id = pdev->id; | ||
146 | |||
147 | pdata = (struct gianfar_mdio_data *)pdev->dev.platform_data; | ||
148 | |||
149 | if (NULL == pdata) { | ||
150 | printk(KERN_ERR "gfar mdio %d: Missing platform data!\n", pdev->id); | ||
151 | return -ENODEV; | ||
152 | } | ||
153 | |||
154 | /* Set the PHY base address */ | ||
155 | regs = (struct gfar_mii *) ioremap(pdata->paddr, | ||
156 | sizeof (struct gfar_mii)); | ||
157 | |||
158 | if (NULL == regs) { | ||
159 | err = -ENOMEM; | ||
160 | goto reg_map_fail; | ||
161 | } | ||
162 | |||
163 | new_bus->priv = regs; | ||
164 | |||
165 | new_bus->irq = pdata->irq; | ||
166 | |||
167 | new_bus->dev = dev; | ||
168 | dev_set_drvdata(dev, new_bus); | ||
169 | |||
170 | err = mdiobus_register(new_bus); | ||
171 | |||
172 | if (0 != err) { | ||
173 | printk (KERN_ERR "%s: Cannot register as MDIO bus\n", | ||
174 | new_bus->name); | ||
175 | goto bus_register_fail; | ||
176 | } | ||
177 | |||
178 | return 0; | ||
179 | |||
180 | bus_register_fail: | ||
181 | iounmap((void *) regs); | ||
182 | reg_map_fail: | ||
183 | kfree(new_bus); | ||
184 | |||
185 | return err; | ||
186 | } | ||
187 | |||
188 | |||
189 | int gfar_mdio_remove(struct device *dev) | ||
190 | { | ||
191 | struct mii_bus *bus = dev_get_drvdata(dev); | ||
192 | |||
193 | mdiobus_unregister(bus); | ||
194 | |||
195 | dev_set_drvdata(dev, NULL); | ||
196 | |||
197 | iounmap((void *) (&bus->priv)); | ||
198 | bus->priv = NULL; | ||
199 | kfree(bus); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static struct device_driver gianfar_mdio_driver = { | ||
205 | .name = "fsl-gianfar_mdio", | ||
206 | .bus = &platform_bus_type, | ||
207 | .probe = gfar_mdio_probe, | ||
208 | .remove = gfar_mdio_remove, | ||
209 | }; | ||
210 | |||
211 | int __init gfar_mdio_init(void) | ||
212 | { | ||
213 | return driver_register(&gianfar_mdio_driver); | ||
214 | } | ||
215 | |||
216 | void __exit gfar_mdio_exit(void) | ||
217 | { | ||
218 | driver_unregister(&gianfar_mdio_driver); | ||
219 | } | ||
diff --git a/drivers/net/gianfar_mii.h b/drivers/net/gianfar_mii.h new file mode 100644 index 000000000000..56e5665d5c9b --- /dev/null +++ b/drivers/net/gianfar_mii.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * drivers/net/gianfar_mii.h | ||
3 | * | ||
4 | * Gianfar Ethernet Driver -- MII Management Bus Implementation | ||
5 | * Driver for the MDIO bus controller in the Gianfar register space | ||
6 | * | ||
7 | * Author: Andy Fleming | ||
8 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) | ||
9 | * | ||
10 | * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | */ | ||
18 | #ifndef __GIANFAR_MII_H | ||
19 | #define __GIANFAR_MII_H | ||
20 | |||
21 | #define MIIMIND_BUSY 0x00000001 | ||
22 | #define MIIMIND_NOTVALID 0x00000004 | ||
23 | |||
24 | #define MII_READ_COMMAND 0x00000001 | ||
25 | |||
26 | #define GFAR_SUPPORTED (SUPPORTED_10baseT_Half \ | ||
27 | | SUPPORTED_100baseT_Half \ | ||
28 | | SUPPORTED_100baseT_Full \ | ||
29 | | SUPPORTED_Autoneg \ | ||
30 | | SUPPORTED_MII) | ||
31 | |||
32 | struct gfar_mii { | ||
33 | u32 miimcfg; /* 0x.520 - MII Management Config Register */ | ||
34 | u32 miimcom; /* 0x.524 - MII Management Command Register */ | ||
35 | u32 miimadd; /* 0x.528 - MII Management Address Register */ | ||
36 | u32 miimcon; /* 0x.52c - MII Management Control Register */ | ||
37 | u32 miimstat; /* 0x.530 - MII Management Status Register */ | ||
38 | u32 miimind; /* 0x.534 - MII Management Indicator Register */ | ||
39 | }; | ||
40 | |||
41 | int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum); | ||
42 | int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); | ||
43 | int __init gfar_mdio_init(void); | ||
44 | void __exit gfar_mdio_exit(void); | ||
45 | #endif /* GIANFAR_PHY_H */ | ||
diff --git a/drivers/net/gianfar_phy.c b/drivers/net/gianfar_phy.c deleted file mode 100644 index 7c965f268a82..000000000000 --- a/drivers/net/gianfar_phy.c +++ /dev/null | |||
@@ -1,661 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/net/gianfar_phy.c | ||
3 | * | ||
4 | * Gianfar Ethernet Driver -- PHY handling | ||
5 | * Driver for FEC on MPC8540 and TSEC on MPC8540/MPC8560 | ||
6 | * Based on 8260_io/fcc_enet.c | ||
7 | * | ||
8 | * Author: Andy Fleming | ||
9 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) | ||
10 | * | ||
11 | * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #include <linux/config.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/sched.h> | ||
23 | #include <linux/string.h> | ||
24 | #include <linux/errno.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/netdevice.h> | ||
30 | #include <linux/etherdevice.h> | ||
31 | #include <linux/skbuff.h> | ||
32 | #include <linux/spinlock.h> | ||
33 | #include <linux/mm.h> | ||
34 | |||
35 | #include <asm/io.h> | ||
36 | #include <asm/irq.h> | ||
37 | #include <asm/uaccess.h> | ||
38 | #include <linux/module.h> | ||
39 | #include <linux/version.h> | ||
40 | #include <linux/crc32.h> | ||
41 | #include <linux/mii.h> | ||
42 | |||
43 | #include "gianfar.h" | ||
44 | #include "gianfar_phy.h" | ||
45 | |||
46 | static void config_genmii_advert(struct gfar_mii_info *mii_info); | ||
47 | static void genmii_setup_forced(struct gfar_mii_info *mii_info); | ||
48 | static void genmii_restart_aneg(struct gfar_mii_info *mii_info); | ||
49 | static int gbit_config_aneg(struct gfar_mii_info *mii_info); | ||
50 | static int genmii_config_aneg(struct gfar_mii_info *mii_info); | ||
51 | static int genmii_update_link(struct gfar_mii_info *mii_info); | ||
52 | static int genmii_read_status(struct gfar_mii_info *mii_info); | ||
53 | u16 phy_read(struct gfar_mii_info *mii_info, u16 regnum); | ||
54 | void phy_write(struct gfar_mii_info *mii_info, u16 regnum, u16 val); | ||
55 | |||
56 | /* Write value to the PHY for this device to the register at regnum, */ | ||
57 | /* waiting until the write is done before it returns. All PHY */ | ||
58 | /* configuration has to be done through the TSEC1 MIIM regs */ | ||
59 | void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value) | ||
60 | { | ||
61 | struct gfar_private *priv = netdev_priv(dev); | ||
62 | struct gfar *regbase = priv->phyregs; | ||
63 | |||
64 | /* Set the PHY address and the register address we want to write */ | ||
65 | gfar_write(®base->miimadd, (mii_id << 8) | regnum); | ||
66 | |||
67 | /* Write out the value we want */ | ||
68 | gfar_write(®base->miimcon, value); | ||
69 | |||
70 | /* Wait for the transaction to finish */ | ||
71 | while (gfar_read(®base->miimind) & MIIMIND_BUSY) | ||
72 | cpu_relax(); | ||
73 | } | ||
74 | |||
75 | /* Reads from register regnum in the PHY for device dev, */ | ||
76 | /* returning the value. Clears miimcom first. All PHY */ | ||
77 | /* configuration has to be done through the TSEC1 MIIM regs */ | ||
78 | int read_phy_reg(struct net_device *dev, int mii_id, int regnum) | ||
79 | { | ||
80 | struct gfar_private *priv = netdev_priv(dev); | ||
81 | struct gfar *regbase = priv->phyregs; | ||
82 | u16 value; | ||
83 | |||
84 | /* Set the PHY address and the register address we want to read */ | ||
85 | gfar_write(®base->miimadd, (mii_id << 8) | regnum); | ||
86 | |||
87 | /* Clear miimcom, and then initiate a read */ | ||
88 | gfar_write(®base->miimcom, 0); | ||
89 | gfar_write(®base->miimcom, MII_READ_COMMAND); | ||
90 | |||
91 | /* Wait for the transaction to finish */ | ||
92 | while (gfar_read(®base->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY)) | ||
93 | cpu_relax(); | ||
94 | |||
95 | /* Grab the value of the register from miimstat */ | ||
96 | value = gfar_read(®base->miimstat); | ||
97 | |||
98 | return value; | ||
99 | } | ||
100 | |||
101 | void mii_clear_phy_interrupt(struct gfar_mii_info *mii_info) | ||
102 | { | ||
103 | if(mii_info->phyinfo->ack_interrupt) | ||
104 | mii_info->phyinfo->ack_interrupt(mii_info); | ||
105 | } | ||
106 | |||
107 | |||
108 | void mii_configure_phy_interrupt(struct gfar_mii_info *mii_info, u32 interrupts) | ||
109 | { | ||
110 | mii_info->interrupts = interrupts; | ||
111 | if(mii_info->phyinfo->config_intr) | ||
112 | mii_info->phyinfo->config_intr(mii_info); | ||
113 | } | ||
114 | |||
115 | |||
116 | /* Writes MII_ADVERTISE with the appropriate values, after | ||
117 | * sanitizing advertise to make sure only supported features | ||
118 | * are advertised | ||
119 | */ | ||
120 | static void config_genmii_advert(struct gfar_mii_info *mii_info) | ||
121 | { | ||
122 | u32 advertise; | ||
123 | u16 adv; | ||
124 | |||
125 | /* Only allow advertising what this PHY supports */ | ||
126 | mii_info->advertising &= mii_info->phyinfo->features; | ||
127 | advertise = mii_info->advertising; | ||
128 | |||
129 | /* Setup standard advertisement */ | ||
130 | adv = phy_read(mii_info, MII_ADVERTISE); | ||
131 | adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4); | ||
132 | if (advertise & ADVERTISED_10baseT_Half) | ||
133 | adv |= ADVERTISE_10HALF; | ||
134 | if (advertise & ADVERTISED_10baseT_Full) | ||
135 | adv |= ADVERTISE_10FULL; | ||
136 | if (advertise & ADVERTISED_100baseT_Half) | ||
137 | adv |= ADVERTISE_100HALF; | ||
138 | if (advertise & ADVERTISED_100baseT_Full) | ||
139 | adv |= ADVERTISE_100FULL; | ||
140 | phy_write(mii_info, MII_ADVERTISE, adv); | ||
141 | } | ||
142 | |||
143 | static void genmii_setup_forced(struct gfar_mii_info *mii_info) | ||
144 | { | ||
145 | u16 ctrl; | ||
146 | u32 features = mii_info->phyinfo->features; | ||
147 | |||
148 | ctrl = phy_read(mii_info, MII_BMCR); | ||
149 | |||
150 | ctrl &= ~(BMCR_FULLDPLX|BMCR_SPEED100|BMCR_SPEED1000|BMCR_ANENABLE); | ||
151 | ctrl |= BMCR_RESET; | ||
152 | |||
153 | switch(mii_info->speed) { | ||
154 | case SPEED_1000: | ||
155 | if(features & (SUPPORTED_1000baseT_Half | ||
156 | | SUPPORTED_1000baseT_Full)) { | ||
157 | ctrl |= BMCR_SPEED1000; | ||
158 | break; | ||
159 | } | ||
160 | mii_info->speed = SPEED_100; | ||
161 | case SPEED_100: | ||
162 | if (features & (SUPPORTED_100baseT_Half | ||
163 | | SUPPORTED_100baseT_Full)) { | ||
164 | ctrl |= BMCR_SPEED100; | ||
165 | break; | ||
166 | } | ||
167 | mii_info->speed = SPEED_10; | ||
168 | case SPEED_10: | ||
169 | if (features & (SUPPORTED_10baseT_Half | ||
170 | | SUPPORTED_10baseT_Full)) | ||
171 | break; | ||
172 | default: /* Unsupported speed! */ | ||
173 | printk(KERN_ERR "%s: Bad speed!\n", | ||
174 | mii_info->dev->name); | ||
175 | break; | ||
176 | } | ||
177 | |||
178 | phy_write(mii_info, MII_BMCR, ctrl); | ||
179 | } | ||
180 | |||
181 | |||
182 | /* Enable and Restart Autonegotiation */ | ||
183 | static void genmii_restart_aneg(struct gfar_mii_info *mii_info) | ||
184 | { | ||
185 | u16 ctl; | ||
186 | |||
187 | ctl = phy_read(mii_info, MII_BMCR); | ||
188 | ctl |= (BMCR_ANENABLE | BMCR_ANRESTART); | ||
189 | phy_write(mii_info, MII_BMCR, ctl); | ||
190 | } | ||
191 | |||
192 | |||
193 | static int gbit_config_aneg(struct gfar_mii_info *mii_info) | ||
194 | { | ||
195 | u16 adv; | ||
196 | u32 advertise; | ||
197 | |||
198 | if(mii_info->autoneg) { | ||
199 | /* Configure the ADVERTISE register */ | ||
200 | config_genmii_advert(mii_info); | ||
201 | advertise = mii_info->advertising; | ||
202 | |||
203 | adv = phy_read(mii_info, MII_1000BASETCONTROL); | ||
204 | adv &= ~(MII_1000BASETCONTROL_FULLDUPLEXCAP | | ||
205 | MII_1000BASETCONTROL_HALFDUPLEXCAP); | ||
206 | if (advertise & SUPPORTED_1000baseT_Half) | ||
207 | adv |= MII_1000BASETCONTROL_HALFDUPLEXCAP; | ||
208 | if (advertise & SUPPORTED_1000baseT_Full) | ||
209 | adv |= MII_1000BASETCONTROL_FULLDUPLEXCAP; | ||
210 | phy_write(mii_info, MII_1000BASETCONTROL, adv); | ||
211 | |||
212 | /* Start/Restart aneg */ | ||
213 | genmii_restart_aneg(mii_info); | ||
214 | } else | ||
215 | genmii_setup_forced(mii_info); | ||
216 | |||
217 | return 0; | ||
218 | } | ||
219 | |||
220 | static int marvell_config_aneg(struct gfar_mii_info *mii_info) | ||
221 | { | ||
222 | /* The Marvell PHY has an errata which requires | ||
223 | * that certain registers get written in order | ||
224 | * to restart autonegotiation */ | ||
225 | phy_write(mii_info, MII_BMCR, BMCR_RESET); | ||
226 | |||
227 | phy_write(mii_info, 0x1d, 0x1f); | ||
228 | phy_write(mii_info, 0x1e, 0x200c); | ||
229 | phy_write(mii_info, 0x1d, 0x5); | ||
230 | phy_write(mii_info, 0x1e, 0); | ||
231 | phy_write(mii_info, 0x1e, 0x100); | ||
232 | |||
233 | gbit_config_aneg(mii_info); | ||
234 | |||
235 | return 0; | ||
236 | } | ||
237 | static int genmii_config_aneg(struct gfar_mii_info *mii_info) | ||
238 | { | ||
239 | if (mii_info->autoneg) { | ||
240 | config_genmii_advert(mii_info); | ||
241 | genmii_restart_aneg(mii_info); | ||
242 | } else | ||
243 | genmii_setup_forced(mii_info); | ||
244 | |||
245 | return 0; | ||
246 | } | ||
247 | |||
248 | |||
249 | static int genmii_update_link(struct gfar_mii_info *mii_info) | ||
250 | { | ||
251 | u16 status; | ||
252 | |||
253 | /* Do a fake read */ | ||
254 | phy_read(mii_info, MII_BMSR); | ||
255 | |||
256 | /* Read link and autonegotiation status */ | ||
257 | status = phy_read(mii_info, MII_BMSR); | ||
258 | if ((status & BMSR_LSTATUS) == 0) | ||
259 | mii_info->link = 0; | ||
260 | else | ||
261 | mii_info->link = 1; | ||
262 | |||
263 | /* If we are autonegotiating, and not done, | ||
264 | * return an error */ | ||
265 | if (mii_info->autoneg && !(status & BMSR_ANEGCOMPLETE)) | ||
266 | return -EAGAIN; | ||
267 | |||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | static int genmii_read_status(struct gfar_mii_info *mii_info) | ||
272 | { | ||
273 | u16 status; | ||
274 | int err; | ||
275 | |||
276 | /* Update the link, but return if there | ||
277 | * was an error */ | ||
278 | err = genmii_update_link(mii_info); | ||
279 | if (err) | ||
280 | return err; | ||
281 | |||
282 | if (mii_info->autoneg) { | ||
283 | status = phy_read(mii_info, MII_LPA); | ||
284 | |||
285 | if (status & (LPA_10FULL | LPA_100FULL)) | ||
286 | mii_info->duplex = DUPLEX_FULL; | ||
287 | else | ||
288 | mii_info->duplex = DUPLEX_HALF; | ||
289 | if (status & (LPA_100FULL | LPA_100HALF)) | ||
290 | mii_info->speed = SPEED_100; | ||
291 | else | ||
292 | mii_info->speed = SPEED_10; | ||
293 | mii_info->pause = 0; | ||
294 | } | ||
295 | /* On non-aneg, we assume what we put in BMCR is the speed, | ||
296 | * though magic-aneg shouldn't prevent this case from occurring | ||
297 | */ | ||
298 | |||
299 | return 0; | ||
300 | } | ||
301 | static int marvell_read_status(struct gfar_mii_info *mii_info) | ||
302 | { | ||
303 | u16 status; | ||
304 | int err; | ||
305 | |||
306 | /* Update the link, but return if there | ||
307 | * was an error */ | ||
308 | err = genmii_update_link(mii_info); | ||
309 | if (err) | ||
310 | return err; | ||
311 | |||
312 | /* If the link is up, read the speed and duplex */ | ||
313 | /* If we aren't autonegotiating, assume speeds | ||
314 | * are as set */ | ||
315 | if (mii_info->autoneg && mii_info->link) { | ||
316 | int speed; | ||
317 | status = phy_read(mii_info, MII_M1011_PHY_SPEC_STATUS); | ||
318 | |||
319 | #if 0 | ||
320 | /* If speed and duplex aren't resolved, | ||
321 | * return an error. Isn't this handled | ||
322 | * by checking aneg? | ||
323 | */ | ||
324 | if ((status & MII_M1011_PHY_SPEC_STATUS_RESOLVED) == 0) | ||
325 | return -EAGAIN; | ||
326 | #endif | ||
327 | |||
328 | /* Get the duplexity */ | ||
329 | if (status & MII_M1011_PHY_SPEC_STATUS_FULLDUPLEX) | ||
330 | mii_info->duplex = DUPLEX_FULL; | ||
331 | else | ||
332 | mii_info->duplex = DUPLEX_HALF; | ||
333 | |||
334 | /* Get the speed */ | ||
335 | speed = status & MII_M1011_PHY_SPEC_STATUS_SPD_MASK; | ||
336 | switch(speed) { | ||
337 | case MII_M1011_PHY_SPEC_STATUS_1000: | ||
338 | mii_info->speed = SPEED_1000; | ||
339 | break; | ||
340 | case MII_M1011_PHY_SPEC_STATUS_100: | ||
341 | mii_info->speed = SPEED_100; | ||
342 | break; | ||
343 | default: | ||
344 | mii_info->speed = SPEED_10; | ||
345 | break; | ||
346 | } | ||
347 | mii_info->pause = 0; | ||
348 | } | ||
349 | |||
350 | return 0; | ||
351 | } | ||
352 | |||
353 | |||
354 | static int cis820x_read_status(struct gfar_mii_info *mii_info) | ||
355 | { | ||
356 | u16 status; | ||
357 | int err; | ||
358 | |||
359 | /* Update the link, but return if there | ||
360 | * was an error */ | ||
361 | err = genmii_update_link(mii_info); | ||
362 | if (err) | ||
363 | return err; | ||
364 | |||
365 | /* If the link is up, read the speed and duplex */ | ||
366 | /* If we aren't autonegotiating, assume speeds | ||
367 | * are as set */ | ||
368 | if (mii_info->autoneg && mii_info->link) { | ||
369 | int speed; | ||
370 | |||
371 | status = phy_read(mii_info, MII_CIS8201_AUX_CONSTAT); | ||
372 | if (status & MII_CIS8201_AUXCONSTAT_DUPLEX) | ||
373 | mii_info->duplex = DUPLEX_FULL; | ||
374 | else | ||
375 | mii_info->duplex = DUPLEX_HALF; | ||
376 | |||
377 | speed = status & MII_CIS8201_AUXCONSTAT_SPEED; | ||
378 | |||
379 | switch (speed) { | ||
380 | case MII_CIS8201_AUXCONSTAT_GBIT: | ||
381 | mii_info->speed = SPEED_1000; | ||
382 | break; | ||
383 | case MII_CIS8201_AUXCONSTAT_100: | ||
384 | mii_info->speed = SPEED_100; | ||
385 | break; | ||
386 | default: | ||
387 | mii_info->speed = SPEED_10; | ||
388 | break; | ||
389 | } | ||
390 | } | ||
391 | |||
392 | return 0; | ||
393 | } | ||
394 | |||
395 | static int marvell_ack_interrupt(struct gfar_mii_info *mii_info) | ||
396 | { | ||
397 | /* Clear the interrupts by reading the reg */ | ||
398 | phy_read(mii_info, MII_M1011_IEVENT); | ||
399 | |||
400 | return 0; | ||
401 | } | ||
402 | |||
403 | static int marvell_config_intr(struct gfar_mii_info *mii_info) | ||
404 | { | ||
405 | if(mii_info->interrupts == MII_INTERRUPT_ENABLED) | ||
406 | phy_write(mii_info, MII_M1011_IMASK, MII_M1011_IMASK_INIT); | ||
407 | else | ||
408 | phy_write(mii_info, MII_M1011_IMASK, MII_M1011_IMASK_CLEAR); | ||
409 | |||
410 | return 0; | ||
411 | } | ||
412 | |||
413 | static int cis820x_init(struct gfar_mii_info *mii_info) | ||
414 | { | ||
415 | phy_write(mii_info, MII_CIS8201_AUX_CONSTAT, | ||
416 | MII_CIS8201_AUXCONSTAT_INIT); | ||
417 | phy_write(mii_info, MII_CIS8201_EXT_CON1, | ||
418 | MII_CIS8201_EXTCON1_INIT); | ||
419 | |||
420 | return 0; | ||
421 | } | ||
422 | |||
423 | static int cis820x_ack_interrupt(struct gfar_mii_info *mii_info) | ||
424 | { | ||
425 | phy_read(mii_info, MII_CIS8201_ISTAT); | ||
426 | |||
427 | return 0; | ||
428 | } | ||
429 | |||
430 | static int cis820x_config_intr(struct gfar_mii_info *mii_info) | ||
431 | { | ||
432 | if(mii_info->interrupts == MII_INTERRUPT_ENABLED) | ||
433 | phy_write(mii_info, MII_CIS8201_IMASK, MII_CIS8201_IMASK_MASK); | ||
434 | else | ||
435 | phy_write(mii_info, MII_CIS8201_IMASK, 0); | ||
436 | |||
437 | return 0; | ||
438 | } | ||
439 | |||
440 | #define DM9161_DELAY 10 | ||
441 | |||
442 | static int dm9161_read_status(struct gfar_mii_info *mii_info) | ||
443 | { | ||
444 | u16 status; | ||
445 | int err; | ||
446 | |||
447 | /* Update the link, but return if there | ||
448 | * was an error */ | ||
449 | err = genmii_update_link(mii_info); | ||
450 | if (err) | ||
451 | return err; | ||
452 | |||
453 | /* If the link is up, read the speed and duplex */ | ||
454 | /* If we aren't autonegotiating, assume speeds | ||
455 | * are as set */ | ||
456 | if (mii_info->autoneg && mii_info->link) { | ||
457 | status = phy_read(mii_info, MII_DM9161_SCSR); | ||
458 | if (status & (MII_DM9161_SCSR_100F | MII_DM9161_SCSR_100H)) | ||
459 | mii_info->speed = SPEED_100; | ||
460 | else | ||
461 | mii_info->speed = SPEED_10; | ||
462 | |||
463 | if (status & (MII_DM9161_SCSR_100F | MII_DM9161_SCSR_10F)) | ||
464 | mii_info->duplex = DUPLEX_FULL; | ||
465 | else | ||
466 | mii_info->duplex = DUPLEX_HALF; | ||
467 | } | ||
468 | |||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | |||
473 | static int dm9161_config_aneg(struct gfar_mii_info *mii_info) | ||
474 | { | ||
475 | struct dm9161_private *priv = mii_info->priv; | ||
476 | |||
477 | if(0 == priv->resetdone) | ||
478 | return -EAGAIN; | ||
479 | |||
480 | return 0; | ||
481 | } | ||
482 | |||
483 | static void dm9161_timer(unsigned long data) | ||
484 | { | ||
485 | struct gfar_mii_info *mii_info = (struct gfar_mii_info *)data; | ||
486 | struct dm9161_private *priv = mii_info->priv; | ||
487 | u16 status = phy_read(mii_info, MII_BMSR); | ||
488 | |||
489 | if (status & BMSR_ANEGCOMPLETE) { | ||
490 | priv->resetdone = 1; | ||
491 | } else | ||
492 | mod_timer(&priv->timer, jiffies + DM9161_DELAY * HZ); | ||
493 | } | ||
494 | |||
495 | static int dm9161_init(struct gfar_mii_info *mii_info) | ||
496 | { | ||
497 | struct dm9161_private *priv; | ||
498 | |||
499 | /* Allocate the private data structure */ | ||
500 | priv = kmalloc(sizeof(struct dm9161_private), GFP_KERNEL); | ||
501 | |||
502 | if (NULL == priv) | ||
503 | return -ENOMEM; | ||
504 | |||
505 | mii_info->priv = priv; | ||
506 | |||
507 | /* Reset is not done yet */ | ||
508 | priv->resetdone = 0; | ||
509 | |||
510 | /* Isolate the PHY */ | ||
511 | phy_write(mii_info, MII_BMCR, BMCR_ISOLATE); | ||
512 | |||
513 | /* Do not bypass the scrambler/descrambler */ | ||
514 | phy_write(mii_info, MII_DM9161_SCR, MII_DM9161_SCR_INIT); | ||
515 | |||
516 | /* Clear 10BTCSR to default */ | ||
517 | phy_write(mii_info, MII_DM9161_10BTCSR, MII_DM9161_10BTCSR_INIT); | ||
518 | |||
519 | /* Reconnect the PHY, and enable Autonegotiation */ | ||
520 | phy_write(mii_info, MII_BMCR, BMCR_ANENABLE); | ||
521 | |||
522 | /* Start a timer for DM9161_DELAY seconds to wait | ||
523 | * for the PHY to be ready */ | ||
524 | init_timer(&priv->timer); | ||
525 | priv->timer.function = &dm9161_timer; | ||
526 | priv->timer.data = (unsigned long) mii_info; | ||
527 | mod_timer(&priv->timer, jiffies + DM9161_DELAY * HZ); | ||
528 | |||
529 | return 0; | ||
530 | } | ||
531 | |||
532 | static void dm9161_close(struct gfar_mii_info *mii_info) | ||
533 | { | ||
534 | struct dm9161_private *priv = mii_info->priv; | ||
535 | |||
536 | del_timer_sync(&priv->timer); | ||
537 | kfree(priv); | ||
538 | } | ||
539 | |||
540 | #if 0 | ||
541 | static int dm9161_ack_interrupt(struct gfar_mii_info *mii_info) | ||
542 | { | ||
543 | phy_read(mii_info, MII_DM9161_INTR); | ||
544 | |||
545 | return 0; | ||
546 | } | ||
547 | #endif | ||
548 | |||
549 | /* Cicada 820x */ | ||
550 | static struct phy_info phy_info_cis820x = { | ||
551 | 0x000fc440, | ||
552 | "Cicada Cis8204", | ||
553 | 0x000fffc0, | ||
554 | .features = MII_GBIT_FEATURES, | ||
555 | .init = &cis820x_init, | ||
556 | .config_aneg = &gbit_config_aneg, | ||
557 | .read_status = &cis820x_read_status, | ||
558 | .ack_interrupt = &cis820x_ack_interrupt, | ||
559 | .config_intr = &cis820x_config_intr, | ||
560 | }; | ||
561 | |||
562 | static struct phy_info phy_info_dm9161 = { | ||
563 | .phy_id = 0x0181b880, | ||
564 | .name = "Davicom DM9161E", | ||
565 | .phy_id_mask = 0x0ffffff0, | ||
566 | .init = dm9161_init, | ||
567 | .config_aneg = dm9161_config_aneg, | ||
568 | .read_status = dm9161_read_status, | ||
569 | .close = dm9161_close, | ||
570 | }; | ||
571 | |||
572 | static struct phy_info phy_info_marvell = { | ||
573 | .phy_id = 0x01410c00, | ||
574 | .phy_id_mask = 0xffffff00, | ||
575 | .name = "Marvell 88E1101/88E1111", | ||
576 | .features = MII_GBIT_FEATURES, | ||
577 | .config_aneg = &marvell_config_aneg, | ||
578 | .read_status = &marvell_read_status, | ||
579 | .ack_interrupt = &marvell_ack_interrupt, | ||
580 | .config_intr = &marvell_config_intr, | ||
581 | }; | ||
582 | |||
583 | static struct phy_info phy_info_genmii= { | ||
584 | .phy_id = 0x00000000, | ||
585 | .phy_id_mask = 0x00000000, | ||
586 | .name = "Generic MII", | ||
587 | .features = MII_BASIC_FEATURES, | ||
588 | .config_aneg = genmii_config_aneg, | ||
589 | .read_status = genmii_read_status, | ||
590 | }; | ||
591 | |||
592 | static struct phy_info *phy_info[] = { | ||
593 | &phy_info_cis820x, | ||
594 | &phy_info_marvell, | ||
595 | &phy_info_dm9161, | ||
596 | &phy_info_genmii, | ||
597 | NULL | ||
598 | }; | ||
599 | |||
600 | u16 phy_read(struct gfar_mii_info *mii_info, u16 regnum) | ||
601 | { | ||
602 | u16 retval; | ||
603 | unsigned long flags; | ||
604 | |||
605 | spin_lock_irqsave(&mii_info->mdio_lock, flags); | ||
606 | retval = mii_info->mdio_read(mii_info->dev, mii_info->mii_id, regnum); | ||
607 | spin_unlock_irqrestore(&mii_info->mdio_lock, flags); | ||
608 | |||
609 | return retval; | ||
610 | } | ||
611 | |||
612 | void phy_write(struct gfar_mii_info *mii_info, u16 regnum, u16 val) | ||
613 | { | ||
614 | unsigned long flags; | ||
615 | |||
616 | spin_lock_irqsave(&mii_info->mdio_lock, flags); | ||
617 | mii_info->mdio_write(mii_info->dev, | ||
618 | mii_info->mii_id, | ||
619 | regnum, val); | ||
620 | spin_unlock_irqrestore(&mii_info->mdio_lock, flags); | ||
621 | } | ||
622 | |||
623 | /* Use the PHY ID registers to determine what type of PHY is attached | ||
624 | * to device dev. return a struct phy_info structure describing that PHY | ||
625 | */ | ||
626 | struct phy_info * get_phy_info(struct gfar_mii_info *mii_info) | ||
627 | { | ||
628 | u16 phy_reg; | ||
629 | u32 phy_ID; | ||
630 | int i; | ||
631 | struct phy_info *theInfo = NULL; | ||
632 | struct net_device *dev = mii_info->dev; | ||
633 | |||
634 | /* Grab the bits from PHYIR1, and put them in the upper half */ | ||
635 | phy_reg = phy_read(mii_info, MII_PHYSID1); | ||
636 | phy_ID = (phy_reg & 0xffff) << 16; | ||
637 | |||
638 | /* Grab the bits from PHYIR2, and put them in the lower half */ | ||
639 | phy_reg = phy_read(mii_info, MII_PHYSID2); | ||
640 | phy_ID |= (phy_reg & 0xffff); | ||
641 | |||
642 | /* loop through all the known PHY types, and find one that */ | ||
643 | /* matches the ID we read from the PHY. */ | ||
644 | for (i = 0; phy_info[i]; i++) | ||
645 | if (phy_info[i]->phy_id == | ||
646 | (phy_ID & phy_info[i]->phy_id_mask)) { | ||
647 | theInfo = phy_info[i]; | ||
648 | break; | ||
649 | } | ||
650 | |||
651 | /* This shouldn't happen, as we have generic PHY support */ | ||
652 | if (theInfo == NULL) { | ||
653 | printk("%s: PHY id %x is not supported!\n", dev->name, phy_ID); | ||
654 | return NULL; | ||
655 | } else { | ||
656 | printk("%s: PHY is %s (%x)\n", dev->name, theInfo->name, | ||
657 | phy_ID); | ||
658 | } | ||
659 | |||
660 | return theInfo; | ||
661 | } | ||
diff --git a/drivers/net/gianfar_phy.h b/drivers/net/gianfar_phy.h deleted file mode 100644 index 1e9b3abf1e6d..000000000000 --- a/drivers/net/gianfar_phy.h +++ /dev/null | |||
@@ -1,213 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/net/gianfar_phy.h | ||
3 | * | ||
4 | * Gianfar Ethernet Driver -- PHY handling | ||
5 | * Driver for FEC on MPC8540 and TSEC on MPC8540/MPC8560 | ||
6 | * Based on 8260_io/fcc_enet.c | ||
7 | * | ||
8 | * Author: Andy Fleming | ||
9 | * Maintainer: Kumar Gala (kumar.gala@freescale.com) | ||
10 | * | ||
11 | * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | * | ||
18 | */ | ||
19 | #ifndef __GIANFAR_PHY_H | ||
20 | #define __GIANFAR_PHY_H | ||
21 | |||
22 | #define MII_end ((u32)-2) | ||
23 | #define MII_read ((u32)-1) | ||
24 | |||
25 | #define MIIMIND_BUSY 0x00000001 | ||
26 | #define MIIMIND_NOTVALID 0x00000004 | ||
27 | |||
28 | #define GFAR_AN_TIMEOUT 2000 | ||
29 | |||
30 | /* 1000BT control (Marvell & BCM54xx at least) */ | ||
31 | #define MII_1000BASETCONTROL 0x09 | ||
32 | #define MII_1000BASETCONTROL_FULLDUPLEXCAP 0x0200 | ||
33 | #define MII_1000BASETCONTROL_HALFDUPLEXCAP 0x0100 | ||
34 | |||
35 | /* Cicada Extended Control Register 1 */ | ||
36 | #define MII_CIS8201_EXT_CON1 0x17 | ||
37 | #define MII_CIS8201_EXTCON1_INIT 0x0000 | ||
38 | |||
39 | /* Cicada Interrupt Mask Register */ | ||
40 | #define MII_CIS8201_IMASK 0x19 | ||
41 | #define MII_CIS8201_IMASK_IEN 0x8000 | ||
42 | #define MII_CIS8201_IMASK_SPEED 0x4000 | ||
43 | #define MII_CIS8201_IMASK_LINK 0x2000 | ||
44 | #define MII_CIS8201_IMASK_DUPLEX 0x1000 | ||
45 | #define MII_CIS8201_IMASK_MASK 0xf000 | ||
46 | |||
47 | /* Cicada Interrupt Status Register */ | ||
48 | #define MII_CIS8201_ISTAT 0x1a | ||
49 | #define MII_CIS8201_ISTAT_STATUS 0x8000 | ||
50 | #define MII_CIS8201_ISTAT_SPEED 0x4000 | ||
51 | #define MII_CIS8201_ISTAT_LINK 0x2000 | ||
52 | #define MII_CIS8201_ISTAT_DUPLEX 0x1000 | ||
53 | |||
54 | /* Cicada Auxiliary Control/Status Register */ | ||
55 | #define MII_CIS8201_AUX_CONSTAT 0x1c | ||
56 | #define MII_CIS8201_AUXCONSTAT_INIT 0x0004 | ||
57 | #define MII_CIS8201_AUXCONSTAT_DUPLEX 0x0020 | ||
58 | #define MII_CIS8201_AUXCONSTAT_SPEED 0x0018 | ||
59 | #define MII_CIS8201_AUXCONSTAT_GBIT 0x0010 | ||
60 | #define MII_CIS8201_AUXCONSTAT_100 0x0008 | ||
61 | |||
62 | /* 88E1011 PHY Status Register */ | ||
63 | #define MII_M1011_PHY_SPEC_STATUS 0x11 | ||
64 | #define MII_M1011_PHY_SPEC_STATUS_1000 0x8000 | ||
65 | #define MII_M1011_PHY_SPEC_STATUS_100 0x4000 | ||
66 | #define MII_M1011_PHY_SPEC_STATUS_SPD_MASK 0xc000 | ||
67 | #define MII_M1011_PHY_SPEC_STATUS_FULLDUPLEX 0x2000 | ||
68 | #define MII_M1011_PHY_SPEC_STATUS_RESOLVED 0x0800 | ||
69 | #define MII_M1011_PHY_SPEC_STATUS_LINK 0x0400 | ||
70 | |||
71 | #define MII_M1011_IEVENT 0x13 | ||
72 | #define MII_M1011_IEVENT_CLEAR 0x0000 | ||
73 | |||
74 | #define MII_M1011_IMASK 0x12 | ||
75 | #define MII_M1011_IMASK_INIT 0x6400 | ||
76 | #define MII_M1011_IMASK_CLEAR 0x0000 | ||
77 | |||
78 | #define MII_DM9161_SCR 0x10 | ||
79 | #define MII_DM9161_SCR_INIT 0x0610 | ||
80 | |||
81 | /* DM9161 Specified Configuration and Status Register */ | ||
82 | #define MII_DM9161_SCSR 0x11 | ||
83 | #define MII_DM9161_SCSR_100F 0x8000 | ||
84 | #define MII_DM9161_SCSR_100H 0x4000 | ||
85 | #define MII_DM9161_SCSR_10F 0x2000 | ||
86 | #define MII_DM9161_SCSR_10H 0x1000 | ||
87 | |||
88 | /* DM9161 Interrupt Register */ | ||
89 | #define MII_DM9161_INTR 0x15 | ||
90 | #define MII_DM9161_INTR_PEND 0x8000 | ||
91 | #define MII_DM9161_INTR_DPLX_MASK 0x0800 | ||
92 | #define MII_DM9161_INTR_SPD_MASK 0x0400 | ||
93 | #define MII_DM9161_INTR_LINK_MASK 0x0200 | ||
94 | #define MII_DM9161_INTR_MASK 0x0100 | ||
95 | #define MII_DM9161_INTR_DPLX_CHANGE 0x0010 | ||
96 | #define MII_DM9161_INTR_SPD_CHANGE 0x0008 | ||
97 | #define MII_DM9161_INTR_LINK_CHANGE 0x0004 | ||
98 | #define MII_DM9161_INTR_INIT 0x0000 | ||
99 | #define MII_DM9161_INTR_STOP \ | ||
100 | (MII_DM9161_INTR_DPLX_MASK | MII_DM9161_INTR_SPD_MASK \ | ||
101 | | MII_DM9161_INTR_LINK_MASK | MII_DM9161_INTR_MASK) | ||
102 | |||
103 | /* DM9161 10BT Configuration/Status */ | ||
104 | #define MII_DM9161_10BTCSR 0x12 | ||
105 | #define MII_DM9161_10BTCSR_INIT 0x7800 | ||
106 | |||
107 | #define MII_BASIC_FEATURES (SUPPORTED_10baseT_Half | \ | ||
108 | SUPPORTED_10baseT_Full | \ | ||
109 | SUPPORTED_100baseT_Half | \ | ||
110 | SUPPORTED_100baseT_Full | \ | ||
111 | SUPPORTED_Autoneg | \ | ||
112 | SUPPORTED_TP | \ | ||
113 | SUPPORTED_MII) | ||
114 | |||
115 | #define MII_GBIT_FEATURES (MII_BASIC_FEATURES | \ | ||
116 | SUPPORTED_1000baseT_Half | \ | ||
117 | SUPPORTED_1000baseT_Full) | ||
118 | |||
119 | #define MII_READ_COMMAND 0x00000001 | ||
120 | |||
121 | #define MII_INTERRUPT_DISABLED 0x0 | ||
122 | #define MII_INTERRUPT_ENABLED 0x1 | ||
123 | /* Taken from mii_if_info and sungem_phy.h */ | ||
124 | struct gfar_mii_info { | ||
125 | /* Information about the PHY type */ | ||
126 | /* And management functions */ | ||
127 | struct phy_info *phyinfo; | ||
128 | |||
129 | /* forced speed & duplex (no autoneg) | ||
130 | * partner speed & duplex & pause (autoneg) | ||
131 | */ | ||
132 | int speed; | ||
133 | int duplex; | ||
134 | int pause; | ||
135 | |||
136 | /* The most recently read link state */ | ||
137 | int link; | ||
138 | |||
139 | /* Enabled Interrupts */ | ||
140 | u32 interrupts; | ||
141 | |||
142 | u32 advertising; | ||
143 | int autoneg; | ||
144 | int mii_id; | ||
145 | |||
146 | /* private data pointer */ | ||
147 | /* For use by PHYs to maintain extra state */ | ||
148 | void *priv; | ||
149 | |||
150 | /* Provided by host chip */ | ||
151 | struct net_device *dev; | ||
152 | |||
153 | /* A lock to ensure that only one thing can read/write | ||
154 | * the MDIO bus at a time */ | ||
155 | spinlock_t mdio_lock; | ||
156 | |||
157 | /* Provided by ethernet driver */ | ||
158 | int (*mdio_read) (struct net_device *dev, int mii_id, int reg); | ||
159 | void (*mdio_write) (struct net_device *dev, int mii_id, int reg, int val); | ||
160 | }; | ||
161 | |||
162 | /* struct phy_info: a structure which defines attributes for a PHY | ||
163 | * | ||
164 | * id will contain a number which represents the PHY. During | ||
165 | * startup, the driver will poll the PHY to find out what its | ||
166 | * UID--as defined by registers 2 and 3--is. The 32-bit result | ||
167 | * gotten from the PHY will be ANDed with phy_id_mask to | ||
168 | * discard any bits which may change based on revision numbers | ||
169 | * unimportant to functionality | ||
170 | * | ||
171 | * There are 6 commands which take a gfar_mii_info structure. | ||
172 | * Each PHY must declare config_aneg, and read_status. | ||
173 | */ | ||
174 | struct phy_info { | ||
175 | u32 phy_id; | ||
176 | char *name; | ||
177 | unsigned int phy_id_mask; | ||
178 | u32 features; | ||
179 | |||
180 | /* Called to initialize the PHY */ | ||
181 | int (*init)(struct gfar_mii_info *mii_info); | ||
182 | |||
183 | /* Called to suspend the PHY for power */ | ||
184 | int (*suspend)(struct gfar_mii_info *mii_info); | ||
185 | |||
186 | /* Reconfigures autonegotiation (or disables it) */ | ||
187 | int (*config_aneg)(struct gfar_mii_info *mii_info); | ||
188 | |||
189 | /* Determines the negotiated speed and duplex */ | ||
190 | int (*read_status)(struct gfar_mii_info *mii_info); | ||
191 | |||
192 | /* Clears any pending interrupts */ | ||
193 | int (*ack_interrupt)(struct gfar_mii_info *mii_info); | ||
194 | |||
195 | /* Enables or disables interrupts */ | ||
196 | int (*config_intr)(struct gfar_mii_info *mii_info); | ||
197 | |||
198 | /* Clears up any memory if needed */ | ||
199 | void (*close)(struct gfar_mii_info *mii_info); | ||
200 | }; | ||
201 | |||
202 | struct phy_info *get_phy_info(struct gfar_mii_info *mii_info); | ||
203 | int read_phy_reg(struct net_device *dev, int mii_id, int regnum); | ||
204 | void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value); | ||
205 | void mii_clear_phy_interrupt(struct gfar_mii_info *mii_info); | ||
206 | void mii_configure_phy_interrupt(struct gfar_mii_info *mii_info, u32 interrupts); | ||
207 | |||
208 | struct dm9161_private { | ||
209 | struct timer_list timer; | ||
210 | int resetdone; | ||
211 | }; | ||
212 | |||
213 | #endif /* GIANFAR_PHY_H */ | ||
diff --git a/drivers/net/hamradio/Kconfig b/drivers/net/hamradio/Kconfig index de087cd609d9..896aa02000d7 100644 --- a/drivers/net/hamradio/Kconfig +++ b/drivers/net/hamradio/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config MKISS | 1 | config MKISS |
2 | tristate "Serial port KISS driver" | 2 | tristate "Serial port KISS driver" |
3 | depends on AX25 | 3 | depends on AX25 |
4 | select CRC16 | ||
4 | ---help--- | 5 | ---help--- |
5 | KISS is a protocol used for the exchange of data between a computer | 6 | KISS is a protocol used for the exchange of data between a computer |
6 | and a Terminal Node Controller (a small embedded system commonly | 7 | and a Terminal Node Controller (a small embedded system commonly |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index 1756f0ed54cc..cb43a9d28774 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -144,7 +144,7 @@ static inline struct net_device *bpq_get_ax25_dev(struct net_device *dev) | |||
144 | { | 144 | { |
145 | struct bpqdev *bpq; | 145 | struct bpqdev *bpq; |
146 | 146 | ||
147 | list_for_each_entry(bpq, &bpq_devices, bpq_list) { | 147 | list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list) { |
148 | if (bpq->ethdev == dev) | 148 | if (bpq->ethdev == dev) |
149 | return bpq->axdev; | 149 | return bpq->axdev; |
150 | } | 150 | } |
@@ -399,7 +399,7 @@ static void *bpq_seq_start(struct seq_file *seq, loff_t *pos) | |||
399 | if (*pos == 0) | 399 | if (*pos == 0) |
400 | return SEQ_START_TOKEN; | 400 | return SEQ_START_TOKEN; |
401 | 401 | ||
402 | list_for_each_entry(bpqdev, &bpq_devices, bpq_list) { | 402 | list_for_each_entry_rcu(bpqdev, &bpq_devices, bpq_list) { |
403 | if (i == *pos) | 403 | if (i == *pos) |
404 | return bpqdev; | 404 | return bpqdev; |
405 | } | 405 | } |
@@ -418,7 +418,7 @@ static void *bpq_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
418 | p = ((struct bpqdev *)v)->bpq_list.next; | 418 | p = ((struct bpqdev *)v)->bpq_list.next; |
419 | 419 | ||
420 | return (p == &bpq_devices) ? NULL | 420 | return (p == &bpq_devices) ? NULL |
421 | : list_entry(p, struct bpqdev, bpq_list); | 421 | : rcu_dereference(list_entry(p, struct bpqdev, bpq_list)); |
422 | } | 422 | } |
423 | 423 | ||
424 | static void bpq_seq_stop(struct seq_file *seq, void *v) | 424 | static void bpq_seq_stop(struct seq_file *seq, void *v) |
@@ -561,8 +561,6 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi | |||
561 | if (!dev_is_ethdev(dev)) | 561 | if (!dev_is_ethdev(dev)) |
562 | return NOTIFY_DONE; | 562 | return NOTIFY_DONE; |
563 | 563 | ||
564 | rcu_read_lock(); | ||
565 | |||
566 | switch (event) { | 564 | switch (event) { |
567 | case NETDEV_UP: /* new ethernet device -> new BPQ interface */ | 565 | case NETDEV_UP: /* new ethernet device -> new BPQ interface */ |
568 | if (bpq_get_ax25_dev(dev) == NULL) | 566 | if (bpq_get_ax25_dev(dev) == NULL) |
@@ -581,7 +579,6 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi | |||
581 | default: | 579 | default: |
582 | break; | 580 | break; |
583 | } | 581 | } |
584 | rcu_read_unlock(); | ||
585 | 582 | ||
586 | return NOTIFY_DONE; | 583 | return NOTIFY_DONE; |
587 | } | 584 | } |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index d9fe64b46f4b..85d6dc005be0 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -14,13 +14,14 @@ | |||
14 | * | 14 | * |
15 | * Copyright (C) Hans Alblas PE1AYX <hans@esrac.ele.tue.nl> | 15 | * Copyright (C) Hans Alblas PE1AYX <hans@esrac.ele.tue.nl> |
16 | * Copyright (C) 2004, 05 Ralf Baechle DL5RB <ralf@linux-mips.org> | 16 | * Copyright (C) 2004, 05 Ralf Baechle DL5RB <ralf@linux-mips.org> |
17 | * Copyright (C) 2004, 05 Thomas Osterried DL9SAU <thomas@x-berg.in-berlin.de> | ||
17 | */ | 18 | */ |
18 | |||
19 | #include <linux/config.h> | 19 | #include <linux/config.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <asm/system.h> | 21 | #include <asm/system.h> |
22 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
24 | #include <linux/crc16.h> | ||
24 | #include <linux/string.h> | 25 | #include <linux/string.h> |
25 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
26 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
@@ -39,11 +40,6 @@ | |||
39 | 40 | ||
40 | #include <net/ax25.h> | 41 | #include <net/ax25.h> |
41 | 42 | ||
42 | #ifdef CONFIG_INET | ||
43 | #include <linux/ip.h> | ||
44 | #include <linux/tcp.h> | ||
45 | #endif | ||
46 | |||
47 | #define AX_MTU 236 | 43 | #define AX_MTU 236 |
48 | 44 | ||
49 | /* SLIP/KISS protocol characters. */ | 45 | /* SLIP/KISS protocol characters. */ |
@@ -80,9 +76,13 @@ struct mkiss { | |||
80 | 76 | ||
81 | int mode; | 77 | int mode; |
82 | int crcmode; /* MW: for FlexNet, SMACK etc. */ | 78 | int crcmode; /* MW: for FlexNet, SMACK etc. */ |
83 | #define CRC_MODE_NONE 0 | 79 | int crcauto; /* CRC auto mode */ |
84 | #define CRC_MODE_FLEX 1 | 80 | |
85 | #define CRC_MODE_SMACK 2 | 81 | #define CRC_MODE_NONE 0 |
82 | #define CRC_MODE_FLEX 1 | ||
83 | #define CRC_MODE_SMACK 2 | ||
84 | #define CRC_MODE_FLEX_TEST 3 | ||
85 | #define CRC_MODE_SMACK_TEST 4 | ||
86 | 86 | ||
87 | atomic_t refcnt; | 87 | atomic_t refcnt; |
88 | struct semaphore dead_sem; | 88 | struct semaphore dead_sem; |
@@ -151,6 +151,21 @@ static int check_crc_flex(unsigned char *cp, int size) | |||
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
153 | 153 | ||
154 | static int check_crc_16(unsigned char *cp, int size) | ||
155 | { | ||
156 | unsigned short crc = 0x0000; | ||
157 | |||
158 | if (size < 3) | ||
159 | return -1; | ||
160 | |||
161 | crc = crc16(0, cp, size); | ||
162 | |||
163 | if (crc != 0x0000) | ||
164 | return -1; | ||
165 | |||
166 | return 0; | ||
167 | } | ||
168 | |||
154 | /* | 169 | /* |
155 | * Standard encapsulation | 170 | * Standard encapsulation |
156 | */ | 171 | */ |
@@ -237,19 +252,42 @@ static void ax_bump(struct mkiss *ax) | |||
237 | 252 | ||
238 | spin_lock_bh(&ax->buflock); | 253 | spin_lock_bh(&ax->buflock); |
239 | if (ax->rbuff[0] > 0x0f) { | 254 | if (ax->rbuff[0] > 0x0f) { |
240 | if (ax->rbuff[0] & 0x20) { | 255 | if (ax->rbuff[0] & 0x80) { |
241 | ax->crcmode = CRC_MODE_FLEX; | 256 | if (check_crc_16(ax->rbuff, ax->rcount) < 0) { |
257 | ax->stats.rx_errors++; | ||
258 | spin_unlock_bh(&ax->buflock); | ||
259 | |||
260 | return; | ||
261 | } | ||
262 | if (ax->crcmode != CRC_MODE_SMACK && ax->crcauto) { | ||
263 | printk(KERN_INFO | ||
264 | "mkiss: %s: Switchting to crc-smack\n", | ||
265 | ax->dev->name); | ||
266 | ax->crcmode = CRC_MODE_SMACK; | ||
267 | } | ||
268 | ax->rcount -= 2; | ||
269 | *ax->rbuff &= ~0x80; | ||
270 | } else if (ax->rbuff[0] & 0x20) { | ||
242 | if (check_crc_flex(ax->rbuff, ax->rcount) < 0) { | 271 | if (check_crc_flex(ax->rbuff, ax->rcount) < 0) { |
243 | ax->stats.rx_errors++; | 272 | ax->stats.rx_errors++; |
273 | spin_unlock_bh(&ax->buflock); | ||
244 | return; | 274 | return; |
245 | } | 275 | } |
276 | if (ax->crcmode != CRC_MODE_FLEX && ax->crcauto) { | ||
277 | printk(KERN_INFO | ||
278 | "mkiss: %s: Switchting to crc-flexnet\n", | ||
279 | ax->dev->name); | ||
280 | ax->crcmode = CRC_MODE_FLEX; | ||
281 | } | ||
246 | ax->rcount -= 2; | 282 | ax->rcount -= 2; |
247 | /* dl9sau bugfix: the trailling two bytes flexnet crc | 283 | |
248 | * will not be passed to the kernel. thus we have | 284 | /* |
249 | * to correct the kissparm signature, because it | 285 | * dl9sau bugfix: the trailling two bytes flexnet crc |
250 | * indicates a crc but there's none | 286 | * will not be passed to the kernel. thus we have to |
287 | * correct the kissparm signature, because it indicates | ||
288 | * a crc but there's none | ||
251 | */ | 289 | */ |
252 | *ax->rbuff &= ~0x20; | 290 | *ax->rbuff &= ~0x20; |
253 | } | 291 | } |
254 | } | 292 | } |
255 | spin_unlock_bh(&ax->buflock); | 293 | spin_unlock_bh(&ax->buflock); |
@@ -417,20 +455,69 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) | |||
417 | p = icp; | 455 | p = icp; |
418 | 456 | ||
419 | spin_lock_bh(&ax->buflock); | 457 | spin_lock_bh(&ax->buflock); |
420 | switch (ax->crcmode) { | 458 | if ((*p & 0x0f) != 0) { |
421 | unsigned short crc; | 459 | /* Configuration Command (kissparms(1). |
460 | * Protocol spec says: never append CRC. | ||
461 | * This fixes a very old bug in the linux | ||
462 | * kiss driver. -- dl9sau */ | ||
463 | switch (*p & 0xff) { | ||
464 | case 0x85: | ||
465 | /* command from userspace especially for us, | ||
466 | * not for delivery to the tnc */ | ||
467 | if (len > 1) { | ||
468 | int cmd = (p[1] & 0xff); | ||
469 | switch(cmd) { | ||
470 | case 3: | ||
471 | ax->crcmode = CRC_MODE_SMACK; | ||
472 | break; | ||
473 | case 2: | ||
474 | ax->crcmode = CRC_MODE_FLEX; | ||
475 | break; | ||
476 | case 1: | ||
477 | ax->crcmode = CRC_MODE_NONE; | ||
478 | break; | ||
479 | case 0: | ||
480 | default: | ||
481 | ax->crcmode = CRC_MODE_SMACK_TEST; | ||
482 | cmd = 0; | ||
483 | } | ||
484 | ax->crcauto = (cmd ? 0 : 1); | ||
485 | printk(KERN_INFO "mkiss: %s: crc mode %s %d\n", ax->dev->name, (len) ? "set to" : "is", cmd); | ||
486 | } | ||
487 | spin_unlock_bh(&ax->buflock); | ||
488 | netif_start_queue(dev); | ||
422 | 489 | ||
423 | case CRC_MODE_FLEX: | 490 | return; |
424 | *p |= 0x20; | 491 | default: |
425 | crc = calc_crc_flex(p, len); | 492 | count = kiss_esc(p, (unsigned char *)ax->xbuff, len); |
426 | count = kiss_esc_crc(p, (unsigned char *)ax->xbuff, crc, len+2); | 493 | } |
427 | break; | 494 | } else { |
495 | unsigned short crc; | ||
496 | switch (ax->crcmode) { | ||
497 | case CRC_MODE_SMACK_TEST: | ||
498 | ax->crcmode = CRC_MODE_FLEX_TEST; | ||
499 | printk(KERN_INFO "mkiss: %s: Trying crc-smack\n", ax->dev->name); | ||
500 | // fall through | ||
501 | case CRC_MODE_SMACK: | ||
502 | *p |= 0x80; | ||
503 | crc = swab16(crc16(0, p, len)); | ||
504 | count = kiss_esc_crc(p, (unsigned char *)ax->xbuff, crc, len+2); | ||
505 | break; | ||
506 | case CRC_MODE_FLEX_TEST: | ||
507 | ax->crcmode = CRC_MODE_NONE; | ||
508 | printk(KERN_INFO "mkiss: %s: Trying crc-flexnet\n", ax->dev->name); | ||
509 | // fall through | ||
510 | case CRC_MODE_FLEX: | ||
511 | *p |= 0x20; | ||
512 | crc = calc_crc_flex(p, len); | ||
513 | count = kiss_esc_crc(p, (unsigned char *)ax->xbuff, crc, len+2); | ||
514 | break; | ||
515 | |||
516 | default: | ||
517 | count = kiss_esc(p, (unsigned char *)ax->xbuff, len); | ||
518 | } | ||
519 | } | ||
428 | 520 | ||
429 | default: | ||
430 | count = kiss_esc(p, (unsigned char *)ax->xbuff, len); | ||
431 | break; | ||
432 | } | ||
433 | |||
434 | set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags); | 521 | set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags); |
435 | actual = ax->tty->driver->write(ax->tty, ax->xbuff, count); | 522 | actual = ax->tty->driver->write(ax->tty, ax->xbuff, count); |
436 | ax->stats.tx_packets++; | 523 | ax->stats.tx_packets++; |
@@ -439,8 +526,6 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) | |||
439 | ax->dev->trans_start = jiffies; | 526 | ax->dev->trans_start = jiffies; |
440 | ax->xleft = count - actual; | 527 | ax->xleft = count - actual; |
441 | ax->xhead = ax->xbuff + actual; | 528 | ax->xhead = ax->xbuff + actual; |
442 | |||
443 | spin_unlock_bh(&ax->buflock); | ||
444 | } | 529 | } |
445 | 530 | ||
446 | /* Encapsulate an AX.25 packet and kick it into a TTY queue. */ | 531 | /* Encapsulate an AX.25 packet and kick it into a TTY queue. */ |
@@ -622,7 +707,7 @@ static void ax_setup(struct net_device *dev) | |||
622 | * best way to fix this is to use a rwlock in the tty struct, but for now we | 707 | * best way to fix this is to use a rwlock in the tty struct, but for now we |
623 | * use a single global rwlock for all ttys in ppp line discipline. | 708 | * use a single global rwlock for all ttys in ppp line discipline. |
624 | */ | 709 | */ |
625 | static rwlock_t disc_data_lock = RW_LOCK_UNLOCKED; | 710 | static DEFINE_RWLOCK(disc_data_lock); |
626 | 711 | ||
627 | static struct mkiss *mkiss_get(struct tty_struct *tty) | 712 | static struct mkiss *mkiss_get(struct tty_struct *tty) |
628 | { | 713 | { |
@@ -643,6 +728,8 @@ static void mkiss_put(struct mkiss *ax) | |||
643 | up(&ax->dead_sem); | 728 | up(&ax->dead_sem); |
644 | } | 729 | } |
645 | 730 | ||
731 | static int crc_force = 0; /* Can be overridden with insmod */ | ||
732 | |||
646 | static int mkiss_open(struct tty_struct *tty) | 733 | static int mkiss_open(struct tty_struct *tty) |
647 | { | 734 | { |
648 | struct net_device *dev; | 735 | struct net_device *dev; |
@@ -682,6 +769,33 @@ static int mkiss_open(struct tty_struct *tty) | |||
682 | if (register_netdev(dev)) | 769 | if (register_netdev(dev)) |
683 | goto out_free_buffers; | 770 | goto out_free_buffers; |
684 | 771 | ||
772 | /* after register_netdev() - because else printk smashes the kernel */ | ||
773 | switch (crc_force) { | ||
774 | case 3: | ||
775 | ax->crcmode = CRC_MODE_SMACK; | ||
776 | printk(KERN_INFO "mkiss: %s: crc mode smack forced.\n", | ||
777 | ax->dev->name); | ||
778 | break; | ||
779 | case 2: | ||
780 | ax->crcmode = CRC_MODE_FLEX; | ||
781 | printk(KERN_INFO "mkiss: %s: crc mode flexnet forced.\n", | ||
782 | ax->dev->name); | ||
783 | break; | ||
784 | case 1: | ||
785 | ax->crcmode = CRC_MODE_NONE; | ||
786 | printk(KERN_INFO "mkiss: %s: crc mode disabled.\n", | ||
787 | ax->dev->name); | ||
788 | break; | ||
789 | case 0: | ||
790 | /* fall through */ | ||
791 | default: | ||
792 | crc_force = 0; | ||
793 | printk(KERN_INFO "mkiss: %s: crc mode is auto.\n", | ||
794 | ax->dev->name); | ||
795 | ax->crcmode = CRC_MODE_SMACK_TEST; | ||
796 | } | ||
797 | ax->crcauto = (crc_force ? 0 : 1); | ||
798 | |||
685 | netif_start_queue(dev); | 799 | netif_start_queue(dev); |
686 | 800 | ||
687 | /* Done. We have linked the TTY line to a channel. */ | 801 | /* Done. We have linked the TTY line to a channel. */ |
@@ -765,7 +879,6 @@ static int mkiss_ioctl(struct tty_struct *tty, struct file *file, | |||
765 | 879 | ||
766 | case SIOCSIFHWADDR: { | 880 | case SIOCSIFHWADDR: { |
767 | char addr[AX25_ADDR_LEN]; | 881 | char addr[AX25_ADDR_LEN]; |
768 | printk(KERN_INFO "In SIOCSIFHWADDR"); | ||
769 | 882 | ||
770 | if (copy_from_user(&addr, | 883 | if (copy_from_user(&addr, |
771 | (void __user *) arg, AX25_ADDR_LEN)) { | 884 | (void __user *) arg, AX25_ADDR_LEN)) { |
@@ -864,6 +977,7 @@ out: | |||
864 | } | 977 | } |
865 | 978 | ||
866 | static struct tty_ldisc ax_ldisc = { | 979 | static struct tty_ldisc ax_ldisc = { |
980 | .owner = THIS_MODULE, | ||
867 | .magic = TTY_LDISC_MAGIC, | 981 | .magic = TTY_LDISC_MAGIC, |
868 | .name = "mkiss", | 982 | .name = "mkiss", |
869 | .open = mkiss_open, | 983 | .open = mkiss_open, |
@@ -904,6 +1018,8 @@ static void __exit mkiss_exit_driver(void) | |||
904 | 1018 | ||
905 | MODULE_AUTHOR("Ralf Baechle DL5RB <ralf@linux-mips.org>"); | 1019 | MODULE_AUTHOR("Ralf Baechle DL5RB <ralf@linux-mips.org>"); |
906 | MODULE_DESCRIPTION("KISS driver for AX.25 over TTYs"); | 1020 | MODULE_DESCRIPTION("KISS driver for AX.25 over TTYs"); |
1021 | MODULE_PARM(crc_force, "i"); | ||
1022 | MODULE_PARM_DESC(crc_force, "crc [0 = auto | 1 = none | 2 = flexnet | 3 = smack]"); | ||
907 | MODULE_LICENSE("GPL"); | 1023 | MODULE_LICENSE("GPL"); |
908 | MODULE_ALIAS_LDISC(N_AX25); | 1024 | MODULE_ALIAS_LDISC(N_AX25); |
909 | 1025 | ||
diff --git a/drivers/net/hamradio/mkiss.h b/drivers/net/hamradio/mkiss.h deleted file mode 100644 index 4ab700478598..000000000000 --- a/drivers/net/hamradio/mkiss.h +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | /**************************************************************************** | ||
2 | * Defines for the Multi-KISS driver. | ||
3 | ****************************************************************************/ | ||
4 | |||
5 | #define AX25_MAXDEV 16 /* MAX number of AX25 channels; | ||
6 | This can be overridden with | ||
7 | insmod -oax25_maxdev=nnn */ | ||
8 | #define AX_MTU 236 | ||
9 | |||
10 | /* SLIP/KISS protocol characters. */ | ||
11 | #define END 0300 /* indicates end of frame */ | ||
12 | #define ESC 0333 /* indicates byte stuffing */ | ||
13 | #define ESC_END 0334 /* ESC ESC_END means END 'data' */ | ||
14 | #define ESC_ESC 0335 /* ESC ESC_ESC means ESC 'data' */ | ||
15 | |||
16 | struct ax_disp { | ||
17 | int magic; | ||
18 | |||
19 | /* Various fields. */ | ||
20 | struct tty_struct *tty; /* ptr to TTY structure */ | ||
21 | struct net_device *dev; /* easy for intr handling */ | ||
22 | |||
23 | /* These are pointers to the malloc()ed frame buffers. */ | ||
24 | unsigned char *rbuff; /* receiver buffer */ | ||
25 | int rcount; /* received chars counter */ | ||
26 | unsigned char *xbuff; /* transmitter buffer */ | ||
27 | unsigned char *xhead; /* pointer to next byte to XMIT */ | ||
28 | int xleft; /* bytes left in XMIT queue */ | ||
29 | |||
30 | /* SLIP interface statistics. */ | ||
31 | unsigned long rx_packets; /* inbound frames counter */ | ||
32 | unsigned long tx_packets; /* outbound frames counter */ | ||
33 | unsigned long rx_bytes; /* inbound bytes counter */ | ||
34 | unsigned long tx_bytes; /* outbound bytes counter */ | ||
35 | unsigned long rx_errors; /* Parity, etc. errors */ | ||
36 | unsigned long tx_errors; /* Planned stuff */ | ||
37 | unsigned long rx_dropped; /* No memory for skb */ | ||
38 | unsigned long tx_dropped; /* When MTU change */ | ||
39 | unsigned long rx_over_errors; /* Frame bigger then SLIP buf. */ | ||
40 | |||
41 | /* Detailed SLIP statistics. */ | ||
42 | int mtu; /* Our mtu (to spot changes!) */ | ||
43 | int buffsize; /* Max buffers sizes */ | ||
44 | |||
45 | |||
46 | unsigned long flags; /* Flag values/ mode etc */ | ||
47 | /* long req'd: used by set_bit --RR */ | ||
48 | #define AXF_INUSE 0 /* Channel in use */ | ||
49 | #define AXF_ESCAPE 1 /* ESC received */ | ||
50 | #define AXF_ERROR 2 /* Parity, etc. error */ | ||
51 | #define AXF_KEEPTEST 3 /* Keepalive test flag */ | ||
52 | #define AXF_OUTWAIT 4 /* is outpacket was flag */ | ||
53 | |||
54 | int mode; | ||
55 | int crcmode; /* MW: for FlexNet, SMACK etc. */ | ||
56 | #define CRC_MODE_NONE 0 | ||
57 | #define CRC_MODE_FLEX 1 | ||
58 | #define CRC_MODE_SMACK 2 | ||
59 | spinlock_t buflock; /* lock for rbuf and xbuf */ | ||
60 | }; | ||
61 | |||
62 | #define AX25_MAGIC 0x5316 | ||
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index cf0ac6fda1a1..b71fab6e34f4 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -2517,10 +2517,8 @@ static int hp100_down_vg_link(struct net_device *dev) | |||
2517 | do { | 2517 | do { |
2518 | if (hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST) | 2518 | if (hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST) |
2519 | break; | 2519 | break; |
2520 | if (!in_interrupt()) { | 2520 | if (!in_interrupt()) |
2521 | set_current_state(TASK_INTERRUPTIBLE); | 2521 | schedule_timeout_interruptible(1); |
2522 | schedule_timeout(1); | ||
2523 | } | ||
2524 | } while (time_after(time, jiffies)); | 2522 | } while (time_after(time, jiffies)); |
2525 | 2523 | ||
2526 | if (time_after_eq(jiffies, time)) /* no signal->no logout */ | 2524 | if (time_after_eq(jiffies, time)) /* no signal->no logout */ |
@@ -2536,10 +2534,8 @@ static int hp100_down_vg_link(struct net_device *dev) | |||
2536 | do { | 2534 | do { |
2537 | if (!(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST)) | 2535 | if (!(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST)) |
2538 | break; | 2536 | break; |
2539 | if (!in_interrupt()) { | 2537 | if (!in_interrupt()) |
2540 | set_current_state(TASK_INTERRUPTIBLE); | 2538 | schedule_timeout_interruptible(1); |
2541 | schedule_timeout(1); | ||
2542 | } | ||
2543 | } while (time_after(time, jiffies)); | 2539 | } while (time_after(time, jiffies)); |
2544 | 2540 | ||
2545 | #ifdef HP100_DEBUG | 2541 | #ifdef HP100_DEBUG |
@@ -2577,10 +2573,8 @@ static int hp100_down_vg_link(struct net_device *dev) | |||
2577 | do { | 2573 | do { |
2578 | if (!(hp100_inb(MAC_CFG_4) & HP100_MAC_SEL_ST)) | 2574 | if (!(hp100_inb(MAC_CFG_4) & HP100_MAC_SEL_ST)) |
2579 | break; | 2575 | break; |
2580 | if (!in_interrupt()) { | 2576 | if (!in_interrupt()) |
2581 | set_current_state(TASK_INTERRUPTIBLE); | 2577 | schedule_timeout_interruptible(1); |
2582 | schedule_timeout(1); | ||
2583 | } | ||
2584 | } while (time_after(time, jiffies)); | 2578 | } while (time_after(time, jiffies)); |
2585 | 2579 | ||
2586 | hp100_orb(HP100_AUTO_MODE, MAC_CFG_3); /* Autosel back on */ | 2580 | hp100_orb(HP100_AUTO_MODE, MAC_CFG_3); /* Autosel back on */ |
@@ -2591,10 +2585,8 @@ static int hp100_down_vg_link(struct net_device *dev) | |||
2591 | do { | 2585 | do { |
2592 | if ((hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST) == 0) | 2586 | if ((hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST) == 0) |
2593 | break; | 2587 | break; |
2594 | if (!in_interrupt()) { | 2588 | if (!in_interrupt()) |
2595 | set_current_state(TASK_INTERRUPTIBLE); | 2589 | schedule_timeout_interruptible(1); |
2596 | schedule_timeout(1); | ||
2597 | } | ||
2598 | } while (time_after(time, jiffies)); | 2590 | } while (time_after(time, jiffies)); |
2599 | 2591 | ||
2600 | if (time_before_eq(time, jiffies)) { | 2592 | if (time_before_eq(time, jiffies)) { |
@@ -2606,10 +2598,8 @@ static int hp100_down_vg_link(struct net_device *dev) | |||
2606 | 2598 | ||
2607 | time = jiffies + (2 * HZ); /* This seems to take a while.... */ | 2599 | time = jiffies + (2 * HZ); /* This seems to take a while.... */ |
2608 | do { | 2600 | do { |
2609 | if (!in_interrupt()) { | 2601 | if (!in_interrupt()) |
2610 | set_current_state(TASK_INTERRUPTIBLE); | 2602 | schedule_timeout_interruptible(1); |
2611 | schedule_timeout(1); | ||
2612 | } | ||
2613 | } while (time_after(time, jiffies)); | 2603 | } while (time_after(time, jiffies)); |
2614 | 2604 | ||
2615 | return 0; | 2605 | return 0; |
@@ -2659,10 +2649,8 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin) | |||
2659 | do { | 2649 | do { |
2660 | if (~(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST)) | 2650 | if (~(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST)) |
2661 | break; | 2651 | break; |
2662 | if (!in_interrupt()) { | 2652 | if (!in_interrupt()) |
2663 | set_current_state(TASK_INTERRUPTIBLE); | 2653 | schedule_timeout_interruptible(1); |
2664 | schedule_timeout(1); | ||
2665 | } | ||
2666 | } while (time_after(time, jiffies)); | 2654 | } while (time_after(time, jiffies)); |
2667 | 2655 | ||
2668 | /* Start an addressed training and optionally request promiscuous port */ | 2656 | /* Start an addressed training and optionally request promiscuous port */ |
@@ -2697,10 +2685,8 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin) | |||
2697 | do { | 2685 | do { |
2698 | if (hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST) | 2686 | if (hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST) |
2699 | break; | 2687 | break; |
2700 | if (!in_interrupt()) { | 2688 | if (!in_interrupt()) |
2701 | set_current_state(TASK_INTERRUPTIBLE); | 2689 | schedule_timeout_interruptible(1); |
2702 | schedule_timeout(1); | ||
2703 | } | ||
2704 | } while (time_before(jiffies, time)); | 2690 | } while (time_before(jiffies, time)); |
2705 | 2691 | ||
2706 | if (time_after_eq(jiffies, time)) { | 2692 | if (time_after_eq(jiffies, time)) { |
@@ -2723,10 +2709,8 @@ static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin) | |||
2723 | #endif | 2709 | #endif |
2724 | break; | 2710 | break; |
2725 | } | 2711 | } |
2726 | if (!in_interrupt()) { | 2712 | if (!in_interrupt()) |
2727 | set_current_state(TASK_INTERRUPTIBLE); | 2713 | schedule_timeout_interruptible(1); |
2728 | schedule_timeout(1); | ||
2729 | } | ||
2730 | } while (time_after(time, jiffies)); | 2714 | } while (time_after(time, jiffies)); |
2731 | } | 2715 | } |
2732 | 2716 | ||
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index 15f207323d97..3961a754e920 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c | |||
@@ -678,10 +678,9 @@ static void turnaround_delay(const struct stir_cb *stir, long us) | |||
678 | return; | 678 | return; |
679 | 679 | ||
680 | ticks = us / (1000000 / HZ); | 680 | ticks = us / (1000000 / HZ); |
681 | if (ticks > 0) { | 681 | if (ticks > 0) |
682 | current->state = TASK_INTERRUPTIBLE; | 682 | schedule_timeout_interruptible(1 + ticks); |
683 | schedule_timeout(1 + ticks); | 683 | else |
684 | } else | ||
685 | udelay(us); | 684 | udelay(us); |
686 | } | 685 | } |
687 | 686 | ||
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c index 9d026ed77ddd..04e47189d830 100644 --- a/drivers/net/ixgb/ixgb_ethtool.c +++ b/drivers/net/ixgb/ixgb_ethtool.c | |||
@@ -645,11 +645,10 @@ ixgb_phys_id(struct net_device *netdev, uint32_t data) | |||
645 | 645 | ||
646 | mod_timer(&adapter->blink_timer, jiffies); | 646 | mod_timer(&adapter->blink_timer, jiffies); |
647 | 647 | ||
648 | set_current_state(TASK_INTERRUPTIBLE); | 648 | if (data) |
649 | if(data) | 649 | schedule_timeout_interruptible(data * HZ); |
650 | schedule_timeout(data * HZ); | ||
651 | else | 650 | else |
652 | schedule_timeout(MAX_SCHEDULE_TIMEOUT); | 651 | schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT); |
653 | 652 | ||
654 | del_timer_sync(&adapter->blink_timer); | 653 | del_timer_sync(&adapter->blink_timer); |
655 | ixgb_led_off(&adapter->hw); | 654 | ixgb_led_off(&adapter->hw); |
@@ -723,6 +722,7 @@ struct ethtool_ops ixgb_ethtool_ops = { | |||
723 | .phys_id = ixgb_phys_id, | 722 | .phys_id = ixgb_phys_id, |
724 | .get_stats_count = ixgb_get_stats_count, | 723 | .get_stats_count = ixgb_get_stats_count, |
725 | .get_ethtool_stats = ixgb_get_ethtool_stats, | 724 | .get_ethtool_stats = ixgb_get_ethtool_stats, |
725 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
726 | }; | 726 | }; |
727 | 727 | ||
728 | void ixgb_set_ethtool_ops(struct net_device *netdev) | 728 | void ixgb_set_ethtool_ops(struct net_device *netdev) |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 89d6d69be382..176680cb153e 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -460,8 +460,9 @@ ixgb_probe(struct pci_dev *pdev, | |||
460 | } | 460 | } |
461 | 461 | ||
462 | ixgb_get_ee_mac_addr(&adapter->hw, netdev->dev_addr); | 462 | ixgb_get_ee_mac_addr(&adapter->hw, netdev->dev_addr); |
463 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); | ||
463 | 464 | ||
464 | if(!is_valid_ether_addr(netdev->dev_addr)) { | 465 | if(!is_valid_ether_addr(netdev->perm_addr)) { |
465 | err = -EIO; | 466 | err = -EIO; |
466 | goto err_eeprom; | 467 | goto err_eeprom; |
467 | } | 468 | } |
diff --git a/drivers/net/lance.c b/drivers/net/lance.c index b4929beb33b2..1d75ca0bb939 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c | |||
@@ -298,7 +298,7 @@ enum {OLD_LANCE = 0, PCNET_ISA=1, PCNET_ISAP=2, PCNET_PCI=3, PCNET_VLB=4, PCNET_ | |||
298 | static unsigned char lance_need_isa_bounce_buffers = 1; | 298 | static unsigned char lance_need_isa_bounce_buffers = 1; |
299 | 299 | ||
300 | static int lance_open(struct net_device *dev); | 300 | static int lance_open(struct net_device *dev); |
301 | static void lance_init_ring(struct net_device *dev, int mode); | 301 | static void lance_init_ring(struct net_device *dev, gfp_t mode); |
302 | static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev); | 302 | static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev); |
303 | static int lance_rx(struct net_device *dev); | 303 | static int lance_rx(struct net_device *dev); |
304 | static irqreturn_t lance_interrupt(int irq, void *dev_id, struct pt_regs *regs); | 304 | static irqreturn_t lance_interrupt(int irq, void *dev_id, struct pt_regs *regs); |
@@ -846,7 +846,7 @@ lance_purge_ring(struct net_device *dev) | |||
846 | 846 | ||
847 | /* Initialize the LANCE Rx and Tx rings. */ | 847 | /* Initialize the LANCE Rx and Tx rings. */ |
848 | static void | 848 | static void |
849 | lance_init_ring(struct net_device *dev, int gfp) | 849 | lance_init_ring(struct net_device *dev, gfp_t gfp) |
850 | { | 850 | { |
851 | struct lance_private *lp = dev->priv; | 851 | struct lance_private *lp = dev->priv; |
852 | int i; | 852 | int i; |
diff --git a/drivers/net/lne390.c b/drivers/net/lne390.c index 27f0d8ac4c40..309d254842cf 100644 --- a/drivers/net/lne390.c +++ b/drivers/net/lne390.c | |||
@@ -298,7 +298,7 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr) | |||
298 | return 0; | 298 | return 0; |
299 | unmap: | 299 | unmap: |
300 | if (ei_status.reg0) | 300 | if (ei_status.reg0) |
301 | iounmap((void *)dev->mem_start); | 301 | iounmap(ei_status.mem); |
302 | cleanup: | 302 | cleanup: |
303 | free_irq(dev->irq, dev); | 303 | free_irq(dev->irq, dev); |
304 | return ret; | 304 | return ret; |
diff --git a/drivers/net/mii.c b/drivers/net/mii.c index c33cb3dc942b..e42aa797f08b 100644 --- a/drivers/net/mii.c +++ b/drivers/net/mii.c | |||
@@ -207,6 +207,20 @@ int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd) | |||
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
209 | 209 | ||
210 | int mii_check_gmii_support(struct mii_if_info *mii) | ||
211 | { | ||
212 | int reg; | ||
213 | |||
214 | reg = mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR); | ||
215 | if (reg & BMSR_ESTATEN) { | ||
216 | reg = mii->mdio_read(mii->dev, mii->phy_id, MII_ESTATUS); | ||
217 | if (reg & (ESTATUS_1000_TFULL | ESTATUS_1000_THALF)) | ||
218 | return 1; | ||
219 | } | ||
220 | |||
221 | return 0; | ||
222 | } | ||
223 | |||
210 | int mii_link_ok (struct mii_if_info *mii) | 224 | int mii_link_ok (struct mii_if_info *mii) |
211 | { | 225 | { |
212 | /* first, a dummy read, needed to latch some MII phys */ | 226 | /* first, a dummy read, needed to latch some MII phys */ |
@@ -394,5 +408,6 @@ EXPORT_SYMBOL(mii_ethtool_gset); | |||
394 | EXPORT_SYMBOL(mii_ethtool_sset); | 408 | EXPORT_SYMBOL(mii_ethtool_sset); |
395 | EXPORT_SYMBOL(mii_check_link); | 409 | EXPORT_SYMBOL(mii_check_link); |
396 | EXPORT_SYMBOL(mii_check_media); | 410 | EXPORT_SYMBOL(mii_check_media); |
411 | EXPORT_SYMBOL(mii_check_gmii_support); | ||
397 | EXPORT_SYMBOL(generic_mii_ioctl); | 412 | EXPORT_SYMBOL(generic_mii_ioctl); |
398 | 413 | ||
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c new file mode 100644 index 000000000000..f79f7ee72ab8 --- /dev/null +++ b/drivers/net/mipsnet.c | |||
@@ -0,0 +1,371 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | */ | ||
6 | |||
7 | #define DEBUG | ||
8 | |||
9 | #include <linux/init.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/netdevice.h> | ||
13 | #include <linux/sched.h> | ||
14 | #include <linux/etherdevice.h> | ||
15 | #include <linux/netdevice.h> | ||
16 | #include <asm/io.h> | ||
17 | #include <asm/mips-boards/simint.h> | ||
18 | |||
19 | #include "mipsnet.h" /* actual device IO mapping */ | ||
20 | |||
21 | #define MIPSNET_VERSION "2005-06-20" | ||
22 | |||
23 | #define mipsnet_reg_address(dev, field) (dev->base_addr + field_offset(field)) | ||
24 | |||
25 | struct mipsnet_priv { | ||
26 | struct net_device_stats stats; | ||
27 | }; | ||
28 | |||
29 | static struct platform_device *mips_plat_dev; | ||
30 | |||
31 | static char mipsnet_string[] = "mipsnet"; | ||
32 | |||
33 | /* | ||
34 | * Copy data from the MIPSNET rx data port | ||
35 | */ | ||
36 | static int ioiocpy_frommipsnet(struct net_device *dev, unsigned char *kdata, | ||
37 | int len) | ||
38 | { | ||
39 | uint32_t available_len = inl(mipsnet_reg_address(dev, rxDataCount)); | ||
40 | if (available_len < len) | ||
41 | return -EFAULT; | ||
42 | |||
43 | for (; len > 0; len--, kdata++) { | ||
44 | *kdata = inb(mipsnet_reg_address(dev, rxDataBuffer)); | ||
45 | } | ||
46 | |||
47 | return inl(mipsnet_reg_address(dev, rxDataCount)); | ||
48 | } | ||
49 | |||
50 | static inline ssize_t mipsnet_put_todevice(struct net_device *dev, | ||
51 | struct sk_buff *skb) | ||
52 | { | ||
53 | int count_to_go = skb->len; | ||
54 | char *buf_ptr = skb->data; | ||
55 | struct mipsnet_priv *mp = netdev_priv(dev); | ||
56 | |||
57 | pr_debug("%s: %s(): telling MIPSNET txDataCount(%d)\n", | ||
58 | dev->name, __FUNCTION__, skb->len); | ||
59 | |||
60 | outl(skb->len, mipsnet_reg_address(dev, txDataCount)); | ||
61 | |||
62 | pr_debug("%s: %s(): sending data to MIPSNET txDataBuffer(%d)\n", | ||
63 | dev->name, __FUNCTION__, skb->len); | ||
64 | |||
65 | for (; count_to_go; buf_ptr++, count_to_go--) { | ||
66 | outb(*buf_ptr, mipsnet_reg_address(dev, txDataBuffer)); | ||
67 | } | ||
68 | |||
69 | mp->stats.tx_packets++; | ||
70 | mp->stats.tx_bytes += skb->len; | ||
71 | |||
72 | return skb->len; | ||
73 | } | ||
74 | |||
75 | static int mipsnet_xmit(struct sk_buff *skb, struct net_device *dev) | ||
76 | { | ||
77 | pr_debug("%s:%s(): transmitting %d bytes\n", | ||
78 | dev->name, __FUNCTION__, skb->len); | ||
79 | |||
80 | /* Only one packet at a time. Once TXDONE interrupt is serviced, the | ||
81 | * queue will be restarted. | ||
82 | */ | ||
83 | netif_stop_queue(dev); | ||
84 | mipsnet_put_todevice(dev, skb); | ||
85 | |||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static inline ssize_t mipsnet_get_fromdev(struct net_device *dev, size_t count) | ||
90 | { | ||
91 | struct sk_buff *skb; | ||
92 | size_t len = count; | ||
93 | struct mipsnet_priv *mp = netdev_priv(dev); | ||
94 | |||
95 | if (!(skb = alloc_skb(len + 2, GFP_KERNEL))) { | ||
96 | mp->stats.rx_dropped++; | ||
97 | return -ENOMEM; | ||
98 | } | ||
99 | |||
100 | skb_reserve(skb, 2); | ||
101 | if (ioiocpy_frommipsnet(dev, skb_put(skb, len), len)) | ||
102 | return -EFAULT; | ||
103 | |||
104 | skb->dev = dev; | ||
105 | skb->protocol = eth_type_trans(skb, dev); | ||
106 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
107 | |||
108 | pr_debug("%s:%s(): pushing RXed data to kernel\n", | ||
109 | dev->name, __FUNCTION__); | ||
110 | netif_rx(skb); | ||
111 | |||
112 | mp->stats.rx_packets++; | ||
113 | mp->stats.rx_bytes += len; | ||
114 | |||
115 | return count; | ||
116 | } | ||
117 | |||
118 | static irqreturn_t | ||
119 | mipsnet_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
120 | { | ||
121 | struct net_device *dev = dev_id; | ||
122 | |||
123 | irqreturn_t retval = IRQ_NONE; | ||
124 | uint64_t interruptFlags; | ||
125 | |||
126 | if (irq == dev->irq) { | ||
127 | pr_debug("%s:%s(): irq %d for device\n", | ||
128 | dev->name, __FUNCTION__, irq); | ||
129 | |||
130 | retval = IRQ_HANDLED; | ||
131 | |||
132 | interruptFlags = | ||
133 | inl(mipsnet_reg_address(dev, interruptControl)); | ||
134 | pr_debug("%s:%s(): intCtl=0x%016llx\n", dev->name, | ||
135 | __FUNCTION__, interruptFlags); | ||
136 | |||
137 | if (interruptFlags & MIPSNET_INTCTL_TXDONE) { | ||
138 | pr_debug("%s:%s(): got TXDone\n", | ||
139 | dev->name, __FUNCTION__); | ||
140 | outl(MIPSNET_INTCTL_TXDONE, | ||
141 | mipsnet_reg_address(dev, interruptControl)); | ||
142 | // only one packet at a time, we are done. | ||
143 | netif_wake_queue(dev); | ||
144 | } else if (interruptFlags & MIPSNET_INTCTL_RXDONE) { | ||
145 | pr_debug("%s:%s(): got RX data\n", | ||
146 | dev->name, __FUNCTION__); | ||
147 | mipsnet_get_fromdev(dev, | ||
148 | inl(mipsnet_reg_address(dev, rxDataCount))); | ||
149 | pr_debug("%s:%s(): clearing RX int\n", | ||
150 | dev->name, __FUNCTION__); | ||
151 | outl(MIPSNET_INTCTL_RXDONE, | ||
152 | mipsnet_reg_address(dev, interruptControl)); | ||
153 | |||
154 | } else if (interruptFlags & MIPSNET_INTCTL_TESTBIT) { | ||
155 | pr_debug("%s:%s(): got test interrupt\n", | ||
156 | dev->name, __FUNCTION__); | ||
157 | // TESTBIT is cleared on read. | ||
158 | // And takes effect after a write with 0 | ||
159 | outl(0, mipsnet_reg_address(dev, interruptControl)); | ||
160 | } else { | ||
161 | pr_debug("%s:%s(): no valid fags 0x%016llx\n", | ||
162 | dev->name, __FUNCTION__, interruptFlags); | ||
163 | // Maybe shared IRQ, just ignore, no clearing. | ||
164 | retval = IRQ_NONE; | ||
165 | } | ||
166 | |||
167 | } else { | ||
168 | printk(KERN_INFO "%s: %s(): irq %d for unknown device\n", | ||
169 | dev->name, __FUNCTION__, irq); | ||
170 | retval = IRQ_NONE; | ||
171 | } | ||
172 | return retval; | ||
173 | } //mipsnet_interrupt() | ||
174 | |||
175 | static int mipsnet_open(struct net_device *dev) | ||
176 | { | ||
177 | int err; | ||
178 | pr_debug("%s: mipsnet_open\n", dev->name); | ||
179 | |||
180 | err = request_irq(dev->irq, &mipsnet_interrupt, | ||
181 | SA_SHIRQ, dev->name, (void *) dev); | ||
182 | |||
183 | if (err) { | ||
184 | pr_debug("%s: %s(): can't get irq %d\n", | ||
185 | dev->name, __FUNCTION__, dev->irq); | ||
186 | release_region(dev->base_addr, MIPSNET_IO_EXTENT); | ||
187 | return err; | ||
188 | } | ||
189 | |||
190 | pr_debug("%s: %s(): got IO region at 0x%04lx and irq %d for dev.\n", | ||
191 | dev->name, __FUNCTION__, dev->base_addr, dev->irq); | ||
192 | |||
193 | |||
194 | netif_start_queue(dev); | ||
195 | |||
196 | // test interrupt handler | ||
197 | outl(MIPSNET_INTCTL_TESTBIT, | ||
198 | mipsnet_reg_address(dev, interruptControl)); | ||
199 | |||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static int mipsnet_close(struct net_device *dev) | ||
205 | { | ||
206 | pr_debug("%s: %s()\n", dev->name, __FUNCTION__); | ||
207 | netif_stop_queue(dev); | ||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | static struct net_device_stats *mipsnet_get_stats(struct net_device *dev) | ||
212 | { | ||
213 | struct mipsnet_priv *mp = netdev_priv(dev); | ||
214 | |||
215 | return &mp->stats; | ||
216 | } | ||
217 | |||
218 | static void mipsnet_set_mclist(struct net_device *dev) | ||
219 | { | ||
220 | // we don't do anything | ||
221 | return; | ||
222 | } | ||
223 | |||
224 | static int __init mipsnet_probe(struct device *dev) | ||
225 | { | ||
226 | struct net_device *netdev; | ||
227 | int err; | ||
228 | |||
229 | netdev = alloc_etherdev(sizeof(struct mipsnet_priv)); | ||
230 | if (!netdev) { | ||
231 | err = -ENOMEM; | ||
232 | goto out; | ||
233 | } | ||
234 | |||
235 | dev_set_drvdata(dev, netdev); | ||
236 | |||
237 | netdev->open = mipsnet_open; | ||
238 | netdev->stop = mipsnet_close; | ||
239 | netdev->hard_start_xmit = mipsnet_xmit; | ||
240 | netdev->get_stats = mipsnet_get_stats; | ||
241 | netdev->set_multicast_list = mipsnet_set_mclist; | ||
242 | |||
243 | /* | ||
244 | * TODO: probe for these or load them from PARAM | ||
245 | */ | ||
246 | netdev->base_addr = 0x4200; | ||
247 | netdev->irq = MIPSCPU_INT_BASE + MIPSCPU_INT_MB0 + | ||
248 | inl(mipsnet_reg_address(netdev, interruptInfo)); | ||
249 | |||
250 | // Get the io region now, get irq on open() | ||
251 | if (!request_region(netdev->base_addr, MIPSNET_IO_EXTENT, "mipsnet")) { | ||
252 | pr_debug("%s: %s(): IO region {start: 0x%04lux, len: %d} " | ||
253 | "for dev is not availble.\n", netdev->name, | ||
254 | __FUNCTION__, netdev->base_addr, MIPSNET_IO_EXTENT); | ||
255 | err = -EBUSY; | ||
256 | goto out_free_netdev; | ||
257 | } | ||
258 | |||
259 | /* | ||
260 | * Lacking any better mechanism to allocate a MAC address we use a | ||
261 | * random one ... | ||
262 | */ | ||
263 | random_ether_addr(netdev->dev_addr); | ||
264 | |||
265 | err = register_netdev(netdev); | ||
266 | if (err) { | ||
267 | printk(KERN_ERR "MIPSNet: failed to register netdev.\n"); | ||
268 | goto out_free_region; | ||
269 | } | ||
270 | |||
271 | return 0; | ||
272 | |||
273 | out_free_region: | ||
274 | release_region(netdev->base_addr, MIPSNET_IO_EXTENT); | ||
275 | |||
276 | out_free_netdev: | ||
277 | free_netdev(netdev); | ||
278 | |||
279 | out: | ||
280 | return err; | ||
281 | } | ||
282 | |||
283 | static int __devexit mipsnet_device_remove(struct device *device) | ||
284 | { | ||
285 | struct net_device *dev = dev_get_drvdata(device); | ||
286 | |||
287 | unregister_netdev(dev); | ||
288 | release_region(dev->base_addr, MIPSNET_IO_EXTENT); | ||
289 | free_netdev(dev); | ||
290 | dev_set_drvdata(device, NULL); | ||
291 | |||
292 | return 0; | ||
293 | } | ||
294 | |||
295 | static struct device_driver mipsnet_driver = { | ||
296 | .name = mipsnet_string, | ||
297 | .bus = &platform_bus_type, | ||
298 | .probe = mipsnet_probe, | ||
299 | .remove = __devexit_p(mipsnet_device_remove), | ||
300 | }; | ||
301 | |||
302 | static void mipsnet_platform_release(struct device *device) | ||
303 | { | ||
304 | struct platform_device *pldev; | ||
305 | |||
306 | /* free device */ | ||
307 | pldev = to_platform_device(device); | ||
308 | kfree(pldev); | ||
309 | } | ||
310 | |||
311 | static int __init mipsnet_init_module(void) | ||
312 | { | ||
313 | struct platform_device *pldev; | ||
314 | int err; | ||
315 | |||
316 | printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. " | ||
317 | "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION); | ||
318 | |||
319 | if (driver_register(&mipsnet_driver)) { | ||
320 | printk(KERN_ERR "Driver registration failed\n"); | ||
321 | err = -ENODEV; | ||
322 | goto out; | ||
323 | } | ||
324 | |||
325 | if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL))) { | ||
326 | err = -ENOMEM; | ||
327 | goto out_unregister_driver; | ||
328 | } | ||
329 | |||
330 | memset (pldev, 0, sizeof (*pldev)); | ||
331 | pldev->name = mipsnet_string; | ||
332 | pldev->id = 0; | ||
333 | pldev->dev.release = mipsnet_platform_release; | ||
334 | |||
335 | if (platform_device_register(pldev)) { | ||
336 | err = -ENODEV; | ||
337 | goto out_free_pldev; | ||
338 | } | ||
339 | |||
340 | if (!pldev->dev.driver) { | ||
341 | /* | ||
342 | * The driver was not bound to this device, there was | ||
343 | * no hardware at this address. Unregister it, as the | ||
344 | * release fuction will take care of freeing the | ||
345 | * allocated structure | ||
346 | */ | ||
347 | platform_device_unregister (pldev); | ||
348 | } | ||
349 | |||
350 | mips_plat_dev = pldev; | ||
351 | |||
352 | return 0; | ||
353 | |||
354 | out_free_pldev: | ||
355 | kfree(pldev); | ||
356 | |||
357 | out_unregister_driver: | ||
358 | driver_unregister(&mipsnet_driver); | ||
359 | out: | ||
360 | return err; | ||
361 | } | ||
362 | |||
363 | static void __exit mipsnet_exit_module(void) | ||
364 | { | ||
365 | pr_debug("MIPSNet Ethernet driver exiting\n"); | ||
366 | |||
367 | driver_unregister(&mipsnet_driver); | ||
368 | } | ||
369 | |||
370 | module_init(mipsnet_init_module); | ||
371 | module_exit(mipsnet_exit_module); | ||
diff --git a/drivers/net/mipsnet.h b/drivers/net/mipsnet.h new file mode 100644 index 000000000000..878535953cb1 --- /dev/null +++ b/drivers/net/mipsnet.h | |||
@@ -0,0 +1,127 @@ | |||
1 | // | ||
2 | // <COPYRIGHT CLASS="1B" YEAR="2005"> | ||
3 | // Unpublished work (c) MIPS Technologies, Inc. All rights reserved. | ||
4 | // Unpublished rights reserved under the copyright laws of the U.S.A. and | ||
5 | // other countries. | ||
6 | // | ||
7 | // PROPRIETARY / SECRET CONFIDENTIAL INFORMATION OF MIPS TECHNOLOGIES, INC. | ||
8 | // FOR INTERNAL USE ONLY. | ||
9 | // | ||
10 | // Under no circumstances (contract or otherwise) may this information be | ||
11 | // disclosed to, or copied, modified or used by anyone other than employees | ||
12 | // or contractors of MIPS Technologies having a need to know. | ||
13 | // </COPYRIGHT> | ||
14 | // | ||
15 | //++ | ||
16 | // File: MIPS_Net.h | ||
17 | // | ||
18 | // Description: | ||
19 | // The definition of the emulated MIPSNET device's interface. | ||
20 | // | ||
21 | // Notes: This include file needs to work from a Linux device drivers. | ||
22 | // | ||
23 | //-- | ||
24 | // | ||
25 | |||
26 | #ifndef __MIPSNET_H | ||
27 | #define __MIPSNET_H | ||
28 | |||
29 | /* | ||
30 | * Id of this Net device, as seen by the core. | ||
31 | */ | ||
32 | #define MIPS_NET_DEV_ID ((uint64_t) \ | ||
33 | ((uint64_t)'M'<< 0)| \ | ||
34 | ((uint64_t)'I'<< 8)| \ | ||
35 | ((uint64_t)'P'<<16)| \ | ||
36 | ((uint64_t)'S'<<24)| \ | ||
37 | ((uint64_t)'N'<<32)| \ | ||
38 | ((uint64_t)'E'<<40)| \ | ||
39 | ((uint64_t)'T'<<48)| \ | ||
40 | ((uint64_t)'0'<<56)) | ||
41 | |||
42 | /* | ||
43 | * Net status/control block as seen by sw in the core. | ||
44 | * (Why not use bit fields? can't be bothered with cross-platform struct | ||
45 | * packing.) | ||
46 | */ | ||
47 | typedef struct _net_control_block { | ||
48 | /// dev info for probing | ||
49 | /// reads as MIPSNET%d where %d is some form of version | ||
50 | uint64_t devId; /*0x00 */ | ||
51 | |||
52 | /* | ||
53 | * read only busy flag. | ||
54 | * Set and cleared by the Net Device to indicate that an rx or a tx | ||
55 | * is in progress. | ||
56 | */ | ||
57 | uint32_t busy; /*0x08 */ | ||
58 | |||
59 | /* | ||
60 | * Set by the Net Device. | ||
61 | * The device will set it once data has been received. | ||
62 | * The value is the number of bytes that should be read from | ||
63 | * rxDataBuffer. The value will decrease till 0 until all the data | ||
64 | * from rxDataBuffer has been read. | ||
65 | */ | ||
66 | uint32_t rxDataCount; /*0x0c */ | ||
67 | #define MIPSNET_MAX_RXTX_DATACOUNT (1<<16) | ||
68 | |||
69 | /* | ||
70 | * Settable from the MIPS core, cleared by the Net Device. | ||
71 | * The core should set the number of bytes it wants to send, | ||
72 | * then it should write those bytes of data to txDataBuffer. | ||
73 | * The device will clear txDataCount has been processed (not necessarily sent). | ||
74 | */ | ||
75 | uint32_t txDataCount; /*0x10 */ | ||
76 | |||
77 | /* | ||
78 | * Interrupt control | ||
79 | * | ||
80 | * Used to clear the interrupted generated by this dev. | ||
81 | * Write a 1 to clear the interrupt. (except bit31). | ||
82 | * | ||
83 | * Bit0 is set if it was a tx-done interrupt. | ||
84 | * Bit1 is set when new rx-data is available. | ||
85 | * Until this bit is cleared there will be no other RXs. | ||
86 | * | ||
87 | * Bit31 is used for testing, it clears after a read. | ||
88 | * Writing 1 to this bit will cause an interrupt to be generated. | ||
89 | * To clear the test interrupt, write 0 to this register. | ||
90 | */ | ||
91 | uint32_t interruptControl; /*0x14 */ | ||
92 | #define MIPSNET_INTCTL_TXDONE ((uint32_t)(1<< 0)) | ||
93 | #define MIPSNET_INTCTL_RXDONE ((uint32_t)(1<< 1)) | ||
94 | #define MIPSNET_INTCTL_TESTBIT ((uint32_t)(1<<31)) | ||
95 | #define MIPSNET_INTCTL_ALLSOURCES (MIPSNET_INTCTL_TXDONE|MIPSNET_INTCTL_RXDONE|MIPSNET_INTCTL_TESTBIT) | ||
96 | |||
97 | /* | ||
98 | * Readonly core-specific interrupt info for the device to signal the core. | ||
99 | * The meaning of the contents of this field might change. | ||
100 | */ | ||
101 | /*###\todo: the whole memIntf interrupt scheme is messy: the device should have | ||
102 | * no control what so ever of what VPE/register set is being used. | ||
103 | * The MemIntf should only expose interrupt lines, and something in the | ||
104 | * config should be responsible for the line<->core/vpe bindings. | ||
105 | */ | ||
106 | uint32_t interruptInfo; /*0x18 */ | ||
107 | |||
108 | /* | ||
109 | * This is where the received data is read out. | ||
110 | * There is more data to read until rxDataReady is 0. | ||
111 | * Only 1 byte at this regs offset is used. | ||
112 | */ | ||
113 | uint32_t rxDataBuffer; /*0x1c */ | ||
114 | |||
115 | /* | ||
116 | * This is where the data to transmit is written. | ||
117 | * Data should be written for the amount specified in the txDataCount register. | ||
118 | * Only 1 byte at this regs offset is used. | ||
119 | */ | ||
120 | uint32_t txDataBuffer; /*0x20 */ | ||
121 | } MIPS_T_NetControl; | ||
122 | |||
123 | #define MIPSNET_IO_EXTENT 0x40 /* being generous */ | ||
124 | |||
125 | #define field_offset(field) ((int)&((MIPS_T_NetControl*)(0))->field) | ||
126 | |||
127 | #endif /* __MIPSNET_H */ | ||
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c index f0996ce5c268..6c86dca62e2a 100644 --- a/drivers/net/myri_sbus.c +++ b/drivers/net/myri_sbus.c | |||
@@ -277,7 +277,7 @@ static void myri_init_rings(struct myri_eth *mp, int from_irq) | |||
277 | struct recvq __iomem *rq = mp->rq; | 277 | struct recvq __iomem *rq = mp->rq; |
278 | struct myri_rxd __iomem *rxd = &rq->myri_rxd[0]; | 278 | struct myri_rxd __iomem *rxd = &rq->myri_rxd[0]; |
279 | struct net_device *dev = mp->dev; | 279 | struct net_device *dev = mp->dev; |
280 | int gfp_flags = GFP_KERNEL; | 280 | gfp_t gfp_flags = GFP_KERNEL; |
281 | int i; | 281 | int i; |
282 | 282 | ||
283 | if (from_irq || in_interrupt()) | 283 | if (from_irq || in_interrupt()) |
diff --git a/drivers/net/myri_sbus.h b/drivers/net/myri_sbus.h index 9391e55a5e92..47722f708a41 100644 --- a/drivers/net/myri_sbus.h +++ b/drivers/net/myri_sbus.h | |||
@@ -296,7 +296,7 @@ struct myri_eth { | |||
296 | /* We use this to acquire receive skb's that we can DMA directly into. */ | 296 | /* We use this to acquire receive skb's that we can DMA directly into. */ |
297 | #define ALIGNED_RX_SKB_ADDR(addr) \ | 297 | #define ALIGNED_RX_SKB_ADDR(addr) \ |
298 | ((((unsigned long)(addr) + (64 - 1)) & ~(64 - 1)) - (unsigned long)(addr)) | 298 | ((((unsigned long)(addr) + (64 - 1)) & ~(64 - 1)) - (unsigned long)(addr)) |
299 | static inline struct sk_buff *myri_alloc_skb(unsigned int length, int gfp_flags) | 299 | static inline struct sk_buff *myri_alloc_skb(unsigned int length, gfp_t gfp_flags) |
300 | { | 300 | { |
301 | struct sk_buff *skb; | 301 | struct sk_buff *skb; |
302 | 302 | ||
diff --git a/drivers/net/ne.c b/drivers/net/ne.c index d209a1556b2e..0de8fdd2aa86 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c | |||
@@ -54,6 +54,10 @@ static const char version2[] = | |||
54 | #include <asm/system.h> | 54 | #include <asm/system.h> |
55 | #include <asm/io.h> | 55 | #include <asm/io.h> |
56 | 56 | ||
57 | #if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) | ||
58 | #include <asm/tx4938/rbtx4938.h> | ||
59 | #endif | ||
60 | |||
57 | #include "8390.h" | 61 | #include "8390.h" |
58 | 62 | ||
59 | #define DRV_NAME "ne" | 63 | #define DRV_NAME "ne" |
@@ -111,6 +115,9 @@ bad_clone_list[] __initdata = { | |||
111 | {"E-LAN100", "E-LAN200", {0x00, 0x00, 0x5d}}, /* Broken ne1000 clones */ | 115 | {"E-LAN100", "E-LAN200", {0x00, 0x00, 0x5d}}, /* Broken ne1000 clones */ |
112 | {"PCM-4823", "PCM-4823", {0x00, 0xc0, 0x6c}}, /* Broken Advantech MoBo */ | 116 | {"PCM-4823", "PCM-4823", {0x00, 0xc0, 0x6c}}, /* Broken Advantech MoBo */ |
113 | {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */ | 117 | {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */ |
118 | #if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) | ||
119 | {"RBHMA4X00-RTL8019", "RBHMA4X00/RTL8019", {0x00, 0x60, 0x0a}}, /* Toshiba built-in */ | ||
120 | #endif | ||
114 | {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */ | 121 | {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */ |
115 | {NULL,} | 122 | {NULL,} |
116 | }; | 123 | }; |
@@ -226,6 +233,10 @@ struct net_device * __init ne_probe(int unit) | |||
226 | sprintf(dev->name, "eth%d", unit); | 233 | sprintf(dev->name, "eth%d", unit); |
227 | netdev_boot_setup_check(dev); | 234 | netdev_boot_setup_check(dev); |
228 | 235 | ||
236 | #ifdef CONFIG_TOSHIBA_RBTX4938 | ||
237 | dev->base_addr = 0x07f20280; | ||
238 | dev->irq = RBTX4938_RTL_8019_IRQ; | ||
239 | #endif | ||
229 | err = do_ne_probe(dev); | 240 | err = do_ne_probe(dev); |
230 | if (err) | 241 | if (err) |
231 | goto out; | 242 | goto out; |
@@ -506,6 +517,10 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr) | |||
506 | ei_status.name = name; | 517 | ei_status.name = name; |
507 | ei_status.tx_start_page = start_page; | 518 | ei_status.tx_start_page = start_page; |
508 | ei_status.stop_page = stop_page; | 519 | ei_status.stop_page = stop_page; |
520 | #if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) | ||
521 | wordlength = 1; | ||
522 | #endif | ||
523 | |||
509 | #ifdef CONFIG_PLAT_OAKS32R | 524 | #ifdef CONFIG_PLAT_OAKS32R |
510 | ei_status.word16 = 0; | 525 | ei_status.word16 = 0; |
511 | #else | 526 | #else |
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c index f1c01ac29102..e531a4eedfee 100644 --- a/drivers/net/ne2k-pci.c +++ b/drivers/net/ne2k-pci.c | |||
@@ -372,6 +372,7 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev, | |||
372 | printk("%2.2X%s", SA_prom[i], i == 5 ? ".\n": ":"); | 372 | printk("%2.2X%s", SA_prom[i], i == 5 ? ".\n": ":"); |
373 | dev->dev_addr[i] = SA_prom[i]; | 373 | dev->dev_addr[i] = SA_prom[i]; |
374 | } | 374 | } |
375 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
375 | 376 | ||
376 | return 0; | 377 | return 0; |
377 | 378 | ||
@@ -637,6 +638,7 @@ static struct ethtool_ops ne2k_pci_ethtool_ops = { | |||
637 | .get_drvinfo = ne2k_pci_get_drvinfo, | 638 | .get_drvinfo = ne2k_pci_get_drvinfo, |
638 | .get_tx_csum = ethtool_op_get_tx_csum, | 639 | .get_tx_csum = ethtool_op_get_tx_csum, |
639 | .get_sg = ethtool_op_get_sg, | 640 | .get_sg = ethtool_op_get_sg, |
641 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
640 | }; | 642 | }; |
641 | 643 | ||
642 | static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev) | 644 | static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev) |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index e4811b42a6b7..a3c3fc9c0d8a 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
@@ -1632,8 +1632,7 @@ static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab | |||
1632 | timed_out = 1; | 1632 | timed_out = 1; |
1633 | break; | 1633 | break; |
1634 | } | 1634 | } |
1635 | set_current_state(TASK_UNINTERRUPTIBLE); | 1635 | schedule_timeout_uninterruptible(1); |
1636 | schedule_timeout(1); | ||
1637 | } | 1636 | } |
1638 | 1637 | ||
1639 | if (status & fail) | 1638 | if (status & fail) |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 113b68099216..70fe81a89df9 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -22,8 +22,8 @@ | |||
22 | *************************************************************************/ | 22 | *************************************************************************/ |
23 | 23 | ||
24 | #define DRV_NAME "pcnet32" | 24 | #define DRV_NAME "pcnet32" |
25 | #define DRV_VERSION "1.30j" | 25 | #define DRV_VERSION "1.31a" |
26 | #define DRV_RELDATE "29.04.2005" | 26 | #define DRV_RELDATE "12.Sep.2005" |
27 | #define PFX DRV_NAME ": " | 27 | #define PFX DRV_NAME ": " |
28 | 28 | ||
29 | static const char *version = | 29 | static const char *version = |
@@ -257,6 +257,9 @@ static int homepna[MAX_UNITS]; | |||
257 | * v1.30h 24 Jun 2004 Don Fry correctly select auto, speed, duplex in bcr32. | 257 | * v1.30h 24 Jun 2004 Don Fry correctly select auto, speed, duplex in bcr32. |
258 | * v1.30i 28 Jun 2004 Don Fry change to use module_param. | 258 | * v1.30i 28 Jun 2004 Don Fry change to use module_param. |
259 | * v1.30j 29 Apr 2005 Don Fry fix skb/map leak with loopback test. | 259 | * v1.30j 29 Apr 2005 Don Fry fix skb/map leak with loopback test. |
260 | * v1.31 02 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> added set_ringparam(). | ||
261 | * v1.31a 12 Sep 2005 Hubert WS Lin <wslin@tw.ibm.c0m> set min ring size to 4 | ||
262 | * to allow loopback test to work unchanged. | ||
260 | */ | 263 | */ |
261 | 264 | ||
262 | 265 | ||
@@ -266,17 +269,17 @@ static int homepna[MAX_UNITS]; | |||
266 | * That translates to 2 (4 == 2^^2) and 4 (16 == 2^^4). | 269 | * That translates to 2 (4 == 2^^2) and 4 (16 == 2^^4). |
267 | */ | 270 | */ |
268 | #ifndef PCNET32_LOG_TX_BUFFERS | 271 | #ifndef PCNET32_LOG_TX_BUFFERS |
269 | #define PCNET32_LOG_TX_BUFFERS 4 | 272 | #define PCNET32_LOG_TX_BUFFERS 4 |
270 | #define PCNET32_LOG_RX_BUFFERS 5 | 273 | #define PCNET32_LOG_RX_BUFFERS 5 |
274 | #define PCNET32_LOG_MAX_TX_BUFFERS 9 /* 2^9 == 512 */ | ||
275 | #define PCNET32_LOG_MAX_RX_BUFFERS 9 | ||
271 | #endif | 276 | #endif |
272 | 277 | ||
273 | #define TX_RING_SIZE (1 << (PCNET32_LOG_TX_BUFFERS)) | 278 | #define TX_RING_SIZE (1 << (PCNET32_LOG_TX_BUFFERS)) |
274 | #define TX_RING_MOD_MASK (TX_RING_SIZE - 1) | 279 | #define TX_MAX_RING_SIZE (1 << (PCNET32_LOG_MAX_TX_BUFFERS)) |
275 | #define TX_RING_LEN_BITS ((PCNET32_LOG_TX_BUFFERS) << 12) | ||
276 | 280 | ||
277 | #define RX_RING_SIZE (1 << (PCNET32_LOG_RX_BUFFERS)) | 281 | #define RX_RING_SIZE (1 << (PCNET32_LOG_RX_BUFFERS)) |
278 | #define RX_RING_MOD_MASK (RX_RING_SIZE - 1) | 282 | #define RX_MAX_RING_SIZE (1 << (PCNET32_LOG_MAX_RX_BUFFERS)) |
279 | #define RX_RING_LEN_BITS ((PCNET32_LOG_RX_BUFFERS) << 4) | ||
280 | 283 | ||
281 | #define PKT_BUF_SZ 1544 | 284 | #define PKT_BUF_SZ 1544 |
282 | 285 | ||
@@ -334,14 +337,14 @@ struct pcnet32_access { | |||
334 | }; | 337 | }; |
335 | 338 | ||
336 | /* | 339 | /* |
337 | * The first three fields of pcnet32_private are read by the ethernet device | 340 | * The first field of pcnet32_private is read by the ethernet device |
338 | * so we allocate the structure should be allocated by pci_alloc_consistent(). | 341 | * so the structure should be allocated using pci_alloc_consistent(). |
339 | */ | 342 | */ |
340 | struct pcnet32_private { | 343 | struct pcnet32_private { |
341 | /* The Tx and Rx ring entries must be aligned on 16-byte boundaries in 32bit mode. */ | ||
342 | struct pcnet32_rx_head rx_ring[RX_RING_SIZE]; | ||
343 | struct pcnet32_tx_head tx_ring[TX_RING_SIZE]; | ||
344 | struct pcnet32_init_block init_block; | 344 | struct pcnet32_init_block init_block; |
345 | /* The Tx and Rx ring entries must be aligned on 16-byte boundaries in 32bit mode. */ | ||
346 | struct pcnet32_rx_head *rx_ring; | ||
347 | struct pcnet32_tx_head *tx_ring; | ||
345 | dma_addr_t dma_addr; /* DMA address of beginning of this | 348 | dma_addr_t dma_addr; /* DMA address of beginning of this |
346 | object, returned by | 349 | object, returned by |
347 | pci_alloc_consistent */ | 350 | pci_alloc_consistent */ |
@@ -349,13 +352,21 @@ struct pcnet32_private { | |||
349 | structure */ | 352 | structure */ |
350 | const char *name; | 353 | const char *name; |
351 | /* The saved address of a sent-in-place packet/buffer, for skfree(). */ | 354 | /* The saved address of a sent-in-place packet/buffer, for skfree(). */ |
352 | struct sk_buff *tx_skbuff[TX_RING_SIZE]; | 355 | struct sk_buff **tx_skbuff; |
353 | struct sk_buff *rx_skbuff[RX_RING_SIZE]; | 356 | struct sk_buff **rx_skbuff; |
354 | dma_addr_t tx_dma_addr[TX_RING_SIZE]; | 357 | dma_addr_t *tx_dma_addr; |
355 | dma_addr_t rx_dma_addr[RX_RING_SIZE]; | 358 | dma_addr_t *rx_dma_addr; |
356 | struct pcnet32_access a; | 359 | struct pcnet32_access a; |
357 | spinlock_t lock; /* Guard lock */ | 360 | spinlock_t lock; /* Guard lock */ |
358 | unsigned int cur_rx, cur_tx; /* The next free ring entry */ | 361 | unsigned int cur_rx, cur_tx; /* The next free ring entry */ |
362 | unsigned int rx_ring_size; /* current rx ring size */ | ||
363 | unsigned int tx_ring_size; /* current tx ring size */ | ||
364 | unsigned int rx_mod_mask; /* rx ring modular mask */ | ||
365 | unsigned int tx_mod_mask; /* tx ring modular mask */ | ||
366 | unsigned short rx_len_bits; | ||
367 | unsigned short tx_len_bits; | ||
368 | dma_addr_t rx_ring_dma_addr; | ||
369 | dma_addr_t tx_ring_dma_addr; | ||
359 | unsigned int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */ | 370 | unsigned int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */ |
360 | struct net_device_stats stats; | 371 | struct net_device_stats stats; |
361 | char tx_full; | 372 | char tx_full; |
@@ -397,6 +408,9 @@ static int pcnet32_get_regs_len(struct net_device *dev); | |||
397 | static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, | 408 | static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, |
398 | void *ptr); | 409 | void *ptr); |
399 | static void pcnet32_purge_tx_ring(struct net_device *dev); | 410 | static void pcnet32_purge_tx_ring(struct net_device *dev); |
411 | static int pcnet32_alloc_ring(struct net_device *dev); | ||
412 | static void pcnet32_free_ring(struct net_device *dev); | ||
413 | |||
400 | 414 | ||
401 | enum pci_flags_bit { | 415 | enum pci_flags_bit { |
402 | PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4, | 416 | PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4, |
@@ -613,10 +627,62 @@ static void pcnet32_get_ringparam(struct net_device *dev, struct ethtool_ringpar | |||
613 | { | 627 | { |
614 | struct pcnet32_private *lp = dev->priv; | 628 | struct pcnet32_private *lp = dev->priv; |
615 | 629 | ||
616 | ering->tx_max_pending = TX_RING_SIZE - 1; | 630 | ering->tx_max_pending = TX_MAX_RING_SIZE - 1; |
617 | ering->tx_pending = lp->cur_tx - lp->dirty_tx; | 631 | ering->tx_pending = lp->tx_ring_size - 1; |
618 | ering->rx_max_pending = RX_RING_SIZE - 1; | 632 | ering->rx_max_pending = RX_MAX_RING_SIZE - 1; |
619 | ering->rx_pending = lp->cur_rx & RX_RING_MOD_MASK; | 633 | ering->rx_pending = lp->rx_ring_size - 1; |
634 | } | ||
635 | |||
636 | static int pcnet32_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) | ||
637 | { | ||
638 | struct pcnet32_private *lp = dev->priv; | ||
639 | unsigned long flags; | ||
640 | int i; | ||
641 | |||
642 | if (ering->rx_mini_pending || ering->rx_jumbo_pending) | ||
643 | return -EINVAL; | ||
644 | |||
645 | if (netif_running(dev)) | ||
646 | pcnet32_close(dev); | ||
647 | |||
648 | spin_lock_irqsave(&lp->lock, flags); | ||
649 | pcnet32_free_ring(dev); | ||
650 | lp->tx_ring_size = min(ering->tx_pending, (unsigned int) TX_MAX_RING_SIZE); | ||
651 | lp->rx_ring_size = min(ering->rx_pending, (unsigned int) RX_MAX_RING_SIZE); | ||
652 | |||
653 | /* set the minimum ring size to 4, to allow the loopback test to work | ||
654 | * unchanged. | ||
655 | */ | ||
656 | for (i = 2; i <= PCNET32_LOG_MAX_TX_BUFFERS; i++) { | ||
657 | if (lp->tx_ring_size <= (1 << i)) | ||
658 | break; | ||
659 | } | ||
660 | lp->tx_ring_size = (1 << i); | ||
661 | lp->tx_mod_mask = lp->tx_ring_size - 1; | ||
662 | lp->tx_len_bits = (i << 12); | ||
663 | |||
664 | for (i = 2; i <= PCNET32_LOG_MAX_RX_BUFFERS; i++) { | ||
665 | if (lp->rx_ring_size <= (1 << i)) | ||
666 | break; | ||
667 | } | ||
668 | lp->rx_ring_size = (1 << i); | ||
669 | lp->rx_mod_mask = lp->rx_ring_size - 1; | ||
670 | lp->rx_len_bits = (i << 4); | ||
671 | |||
672 | if (pcnet32_alloc_ring(dev)) { | ||
673 | pcnet32_free_ring(dev); | ||
674 | return -ENOMEM; | ||
675 | } | ||
676 | |||
677 | spin_unlock_irqrestore(&lp->lock, flags); | ||
678 | |||
679 | if (pcnet32_debug & NETIF_MSG_DRV) | ||
680 | printk(KERN_INFO PFX "Ring Param Settings: RX: %d, TX: %d\n", lp->rx_ring_size, lp->tx_ring_size); | ||
681 | |||
682 | if (netif_running(dev)) | ||
683 | pcnet32_open(dev); | ||
684 | |||
685 | return 0; | ||
620 | } | 686 | } |
621 | 687 | ||
622 | static void pcnet32_get_strings(struct net_device *dev, u32 stringset, u8 *data) | 688 | static void pcnet32_get_strings(struct net_device *dev, u32 stringset, u8 *data) |
@@ -948,6 +1014,7 @@ static struct ethtool_ops pcnet32_ethtool_ops = { | |||
948 | .nway_reset = pcnet32_nway_reset, | 1014 | .nway_reset = pcnet32_nway_reset, |
949 | .get_link = pcnet32_get_link, | 1015 | .get_link = pcnet32_get_link, |
950 | .get_ringparam = pcnet32_get_ringparam, | 1016 | .get_ringparam = pcnet32_get_ringparam, |
1017 | .set_ringparam = pcnet32_set_ringparam, | ||
951 | .get_tx_csum = ethtool_op_get_tx_csum, | 1018 | .get_tx_csum = ethtool_op_get_tx_csum, |
952 | .get_sg = ethtool_op_get_sg, | 1019 | .get_sg = ethtool_op_get_sg, |
953 | .get_tso = ethtool_op_get_tso, | 1020 | .get_tso = ethtool_op_get_tso, |
@@ -957,6 +1024,7 @@ static struct ethtool_ops pcnet32_ethtool_ops = { | |||
957 | .phys_id = pcnet32_phys_id, | 1024 | .phys_id = pcnet32_phys_id, |
958 | .get_regs_len = pcnet32_get_regs_len, | 1025 | .get_regs_len = pcnet32_get_regs_len, |
959 | .get_regs = pcnet32_get_regs, | 1026 | .get_regs = pcnet32_get_regs, |
1027 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
960 | }; | 1028 | }; |
961 | 1029 | ||
962 | /* only probes for non-PCI devices, the rest are handled by | 1030 | /* only probes for non-PCI devices, the rest are handled by |
@@ -1185,9 +1253,10 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1185 | memcpy(dev->dev_addr, promaddr, 6); | 1253 | memcpy(dev->dev_addr, promaddr, 6); |
1186 | } | 1254 | } |
1187 | } | 1255 | } |
1256 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
1188 | 1257 | ||
1189 | /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ | 1258 | /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ |
1190 | if (!is_valid_ether_addr(dev->dev_addr)) | 1259 | if (!is_valid_ether_addr(dev->perm_addr)) |
1191 | memset(dev->dev_addr, 0, sizeof(dev->dev_addr)); | 1260 | memset(dev->dev_addr, 0, sizeof(dev->dev_addr)); |
1192 | 1261 | ||
1193 | if (pcnet32_debug & NETIF_MSG_PROBE) { | 1262 | if (pcnet32_debug & NETIF_MSG_PROBE) { |
@@ -1239,6 +1308,12 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1239 | dev->priv = lp; | 1308 | dev->priv = lp; |
1240 | lp->name = chipname; | 1309 | lp->name = chipname; |
1241 | lp->shared_irq = shared; | 1310 | lp->shared_irq = shared; |
1311 | lp->tx_ring_size = TX_RING_SIZE; /* default tx ring size */ | ||
1312 | lp->rx_ring_size = RX_RING_SIZE; /* default rx ring size */ | ||
1313 | lp->tx_mod_mask = lp->tx_ring_size - 1; | ||
1314 | lp->rx_mod_mask = lp->rx_ring_size - 1; | ||
1315 | lp->tx_len_bits = (PCNET32_LOG_TX_BUFFERS << 12); | ||
1316 | lp->rx_len_bits = (PCNET32_LOG_RX_BUFFERS << 4); | ||
1242 | lp->mii_if.full_duplex = fdx; | 1317 | lp->mii_if.full_duplex = fdx; |
1243 | lp->mii_if.phy_id_mask = 0x1f; | 1318 | lp->mii_if.phy_id_mask = 0x1f; |
1244 | lp->mii_if.reg_num_mask = 0x1f; | 1319 | lp->mii_if.reg_num_mask = 0x1f; |
@@ -1265,21 +1340,23 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1265 | } | 1340 | } |
1266 | lp->a = *a; | 1341 | lp->a = *a; |
1267 | 1342 | ||
1343 | if (pcnet32_alloc_ring(dev)) { | ||
1344 | ret = -ENOMEM; | ||
1345 | goto err_free_ring; | ||
1346 | } | ||
1268 | /* detect special T1/E1 WAN card by checking for MAC address */ | 1347 | /* detect special T1/E1 WAN card by checking for MAC address */ |
1269 | if (dev->dev_addr[0] == 0x00 && dev->dev_addr[1] == 0xe0 | 1348 | if (dev->dev_addr[0] == 0x00 && dev->dev_addr[1] == 0xe0 |
1270 | && dev->dev_addr[2] == 0x75) | 1349 | && dev->dev_addr[2] == 0x75) |
1271 | lp->options = PCNET32_PORT_FD | PCNET32_PORT_GPSI; | 1350 | lp->options = PCNET32_PORT_FD | PCNET32_PORT_GPSI; |
1272 | 1351 | ||
1273 | lp->init_block.mode = le16_to_cpu(0x0003); /* Disable Rx and Tx. */ | 1352 | lp->init_block.mode = le16_to_cpu(0x0003); /* Disable Rx and Tx. */ |
1274 | lp->init_block.tlen_rlen = le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS); | 1353 | lp->init_block.tlen_rlen = le16_to_cpu(lp->tx_len_bits | lp->rx_len_bits); |
1275 | for (i = 0; i < 6; i++) | 1354 | for (i = 0; i < 6; i++) |
1276 | lp->init_block.phys_addr[i] = dev->dev_addr[i]; | 1355 | lp->init_block.phys_addr[i] = dev->dev_addr[i]; |
1277 | lp->init_block.filter[0] = 0x00000000; | 1356 | lp->init_block.filter[0] = 0x00000000; |
1278 | lp->init_block.filter[1] = 0x00000000; | 1357 | lp->init_block.filter[1] = 0x00000000; |
1279 | lp->init_block.rx_ring = (u32)le32_to_cpu(lp->dma_addr + | 1358 | lp->init_block.rx_ring = (u32)le32_to_cpu(lp->rx_ring_dma_addr); |
1280 | offsetof(struct pcnet32_private, rx_ring)); | 1359 | lp->init_block.tx_ring = (u32)le32_to_cpu(lp->tx_ring_dma_addr); |
1281 | lp->init_block.tx_ring = (u32)le32_to_cpu(lp->dma_addr + | ||
1282 | offsetof(struct pcnet32_private, tx_ring)); | ||
1283 | 1360 | ||
1284 | /* switch pcnet32 to 32bit mode */ | 1361 | /* switch pcnet32 to 32bit mode */ |
1285 | a->write_bcr(ioaddr, 20, 2); | 1362 | a->write_bcr(ioaddr, 20, 2); |
@@ -1310,7 +1387,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1310 | if (pcnet32_debug & NETIF_MSG_PROBE) | 1387 | if (pcnet32_debug & NETIF_MSG_PROBE) |
1311 | printk(", failed to detect IRQ line.\n"); | 1388 | printk(", failed to detect IRQ line.\n"); |
1312 | ret = -ENODEV; | 1389 | ret = -ENODEV; |
1313 | goto err_free_consistent; | 1390 | goto err_free_ring; |
1314 | } | 1391 | } |
1315 | if (pcnet32_debug & NETIF_MSG_PROBE) | 1392 | if (pcnet32_debug & NETIF_MSG_PROBE) |
1316 | printk(", probed IRQ %d.\n", dev->irq); | 1393 | printk(", probed IRQ %d.\n", dev->irq); |
@@ -1341,7 +1418,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1341 | 1418 | ||
1342 | /* Fill in the generic fields of the device structure. */ | 1419 | /* Fill in the generic fields of the device structure. */ |
1343 | if (register_netdev(dev)) | 1420 | if (register_netdev(dev)) |
1344 | goto err_free_consistent; | 1421 | goto err_free_ring; |
1345 | 1422 | ||
1346 | if (pdev) { | 1423 | if (pdev) { |
1347 | pci_set_drvdata(pdev, dev); | 1424 | pci_set_drvdata(pdev, dev); |
@@ -1359,6 +1436,8 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1359 | 1436 | ||
1360 | return 0; | 1437 | return 0; |
1361 | 1438 | ||
1439 | err_free_ring: | ||
1440 | pcnet32_free_ring(dev); | ||
1362 | err_free_consistent: | 1441 | err_free_consistent: |
1363 | pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); | 1442 | pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); |
1364 | err_free_netdev: | 1443 | err_free_netdev: |
@@ -1369,6 +1448,86 @@ err_release_region: | |||
1369 | } | 1448 | } |
1370 | 1449 | ||
1371 | 1450 | ||
1451 | static int pcnet32_alloc_ring(struct net_device *dev) | ||
1452 | { | ||
1453 | struct pcnet32_private *lp = dev->priv; | ||
1454 | |||
1455 | if ((lp->tx_ring = pci_alloc_consistent(lp->pci_dev, sizeof(struct pcnet32_tx_head) * lp->tx_ring_size, | ||
1456 | &lp->tx_ring_dma_addr)) == NULL) { | ||
1457 | if (pcnet32_debug & NETIF_MSG_DRV) | ||
1458 | printk(KERN_ERR PFX "Consistent memory allocation failed.\n"); | ||
1459 | return -ENOMEM; | ||
1460 | } | ||
1461 | |||
1462 | if ((lp->rx_ring = pci_alloc_consistent(lp->pci_dev, sizeof(struct pcnet32_rx_head) * lp->rx_ring_size, | ||
1463 | &lp->rx_ring_dma_addr)) == NULL) { | ||
1464 | if (pcnet32_debug & NETIF_MSG_DRV) | ||
1465 | printk(KERN_ERR PFX "Consistent memory allocation failed.\n"); | ||
1466 | return -ENOMEM; | ||
1467 | } | ||
1468 | |||
1469 | if (!(lp->tx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->tx_ring_size, GFP_ATOMIC))) { | ||
1470 | if (pcnet32_debug & NETIF_MSG_DRV) | ||
1471 | printk(KERN_ERR PFX "Memory allocation failed.\n"); | ||
1472 | return -ENOMEM; | ||
1473 | } | ||
1474 | memset(lp->tx_dma_addr, 0, sizeof(dma_addr_t) * lp->tx_ring_size); | ||
1475 | |||
1476 | if (!(lp->rx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->rx_ring_size, GFP_ATOMIC))) { | ||
1477 | if (pcnet32_debug & NETIF_MSG_DRV) | ||
1478 | printk(KERN_ERR PFX "Memory allocation failed.\n"); | ||
1479 | return -ENOMEM; | ||
1480 | } | ||
1481 | memset(lp->rx_dma_addr, 0, sizeof(dma_addr_t) * lp->rx_ring_size); | ||
1482 | |||
1483 | if (!(lp->tx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->tx_ring_size, GFP_ATOMIC))) { | ||
1484 | if (pcnet32_debug & NETIF_MSG_DRV) | ||
1485 | printk(KERN_ERR PFX "Memory allocation failed.\n"); | ||
1486 | return -ENOMEM; | ||
1487 | } | ||
1488 | memset(lp->tx_skbuff, 0, sizeof(struct sk_buff *) * lp->tx_ring_size); | ||
1489 | |||
1490 | if (!(lp->rx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->rx_ring_size, GFP_ATOMIC))) { | ||
1491 | if (pcnet32_debug & NETIF_MSG_DRV) | ||
1492 | printk(KERN_ERR PFX "Memory allocation failed.\n"); | ||
1493 | return -ENOMEM; | ||
1494 | } | ||
1495 | memset(lp->rx_skbuff, 0, sizeof(struct sk_buff *) * lp->rx_ring_size); | ||
1496 | |||
1497 | return 0; | ||
1498 | } | ||
1499 | |||
1500 | |||
1501 | static void pcnet32_free_ring(struct net_device *dev) | ||
1502 | { | ||
1503 | struct pcnet32_private *lp = dev->priv; | ||
1504 | |||
1505 | kfree(lp->tx_skbuff); | ||
1506 | lp->tx_skbuff = NULL; | ||
1507 | |||
1508 | kfree(lp->rx_skbuff); | ||
1509 | lp->rx_skbuff = NULL; | ||
1510 | |||
1511 | kfree(lp->tx_dma_addr); | ||
1512 | lp->tx_dma_addr = NULL; | ||
1513 | |||
1514 | kfree(lp->rx_dma_addr); | ||
1515 | lp->rx_dma_addr = NULL; | ||
1516 | |||
1517 | if (lp->tx_ring) { | ||
1518 | pci_free_consistent(lp->pci_dev, sizeof(struct pcnet32_tx_head) * lp->tx_ring_size, | ||
1519 | lp->tx_ring, lp->tx_ring_dma_addr); | ||
1520 | lp->tx_ring = NULL; | ||
1521 | } | ||
1522 | |||
1523 | if (lp->rx_ring) { | ||
1524 | pci_free_consistent(lp->pci_dev, sizeof(struct pcnet32_rx_head) * lp->rx_ring_size, | ||
1525 | lp->rx_ring, lp->rx_ring_dma_addr); | ||
1526 | lp->rx_ring = NULL; | ||
1527 | } | ||
1528 | } | ||
1529 | |||
1530 | |||
1372 | static int | 1531 | static int |
1373 | pcnet32_open(struct net_device *dev) | 1532 | pcnet32_open(struct net_device *dev) |
1374 | { | 1533 | { |
@@ -1400,8 +1559,8 @@ pcnet32_open(struct net_device *dev) | |||
1400 | if (netif_msg_ifup(lp)) | 1559 | if (netif_msg_ifup(lp)) |
1401 | printk(KERN_DEBUG "%s: pcnet32_open() irq %d tx/rx rings %#x/%#x init %#x.\n", | 1560 | printk(KERN_DEBUG "%s: pcnet32_open() irq %d tx/rx rings %#x/%#x init %#x.\n", |
1402 | dev->name, dev->irq, | 1561 | dev->name, dev->irq, |
1403 | (u32) (lp->dma_addr + offsetof(struct pcnet32_private, tx_ring)), | 1562 | (u32) (lp->tx_ring_dma_addr), |
1404 | (u32) (lp->dma_addr + offsetof(struct pcnet32_private, rx_ring)), | 1563 | (u32) (lp->rx_ring_dma_addr), |
1405 | (u32) (lp->dma_addr + offsetof(struct pcnet32_private, init_block))); | 1564 | (u32) (lp->dma_addr + offsetof(struct pcnet32_private, init_block))); |
1406 | 1565 | ||
1407 | /* set/reset autoselect bit */ | 1566 | /* set/reset autoselect bit */ |
@@ -1521,7 +1680,7 @@ pcnet32_open(struct net_device *dev) | |||
1521 | 1680 | ||
1522 | err_free_ring: | 1681 | err_free_ring: |
1523 | /* free any allocated skbuffs */ | 1682 | /* free any allocated skbuffs */ |
1524 | for (i = 0; i < RX_RING_SIZE; i++) { | 1683 | for (i = 0; i < lp->rx_ring_size; i++) { |
1525 | lp->rx_ring[i].status = 0; | 1684 | lp->rx_ring[i].status = 0; |
1526 | if (lp->rx_skbuff[i]) { | 1685 | if (lp->rx_skbuff[i]) { |
1527 | pci_unmap_single(lp->pci_dev, lp->rx_dma_addr[i], PKT_BUF_SZ-2, | 1686 | pci_unmap_single(lp->pci_dev, lp->rx_dma_addr[i], PKT_BUF_SZ-2, |
@@ -1531,6 +1690,9 @@ err_free_ring: | |||
1531 | lp->rx_skbuff[i] = NULL; | 1690 | lp->rx_skbuff[i] = NULL; |
1532 | lp->rx_dma_addr[i] = 0; | 1691 | lp->rx_dma_addr[i] = 0; |
1533 | } | 1692 | } |
1693 | |||
1694 | pcnet32_free_ring(dev); | ||
1695 | |||
1534 | /* | 1696 | /* |
1535 | * Switch back to 16bit mode to avoid problems with dumb | 1697 | * Switch back to 16bit mode to avoid problems with dumb |
1536 | * DOS packet driver after a warm reboot | 1698 | * DOS packet driver after a warm reboot |
@@ -1562,7 +1724,7 @@ pcnet32_purge_tx_ring(struct net_device *dev) | |||
1562 | struct pcnet32_private *lp = dev->priv; | 1724 | struct pcnet32_private *lp = dev->priv; |
1563 | int i; | 1725 | int i; |
1564 | 1726 | ||
1565 | for (i = 0; i < TX_RING_SIZE; i++) { | 1727 | for (i = 0; i < lp->tx_ring_size; i++) { |
1566 | lp->tx_ring[i].status = 0; /* CPU owns buffer */ | 1728 | lp->tx_ring[i].status = 0; /* CPU owns buffer */ |
1567 | wmb(); /* Make sure adapter sees owner change */ | 1729 | wmb(); /* Make sure adapter sees owner change */ |
1568 | if (lp->tx_skbuff[i]) { | 1730 | if (lp->tx_skbuff[i]) { |
@@ -1587,7 +1749,7 @@ pcnet32_init_ring(struct net_device *dev) | |||
1587 | lp->cur_rx = lp->cur_tx = 0; | 1749 | lp->cur_rx = lp->cur_tx = 0; |
1588 | lp->dirty_rx = lp->dirty_tx = 0; | 1750 | lp->dirty_rx = lp->dirty_tx = 0; |
1589 | 1751 | ||
1590 | for (i = 0; i < RX_RING_SIZE; i++) { | 1752 | for (i = 0; i < lp->rx_ring_size; i++) { |
1591 | struct sk_buff *rx_skbuff = lp->rx_skbuff[i]; | 1753 | struct sk_buff *rx_skbuff = lp->rx_skbuff[i]; |
1592 | if (rx_skbuff == NULL) { | 1754 | if (rx_skbuff == NULL) { |
1593 | if (!(rx_skbuff = lp->rx_skbuff[i] = dev_alloc_skb (PKT_BUF_SZ))) { | 1755 | if (!(rx_skbuff = lp->rx_skbuff[i] = dev_alloc_skb (PKT_BUF_SZ))) { |
@@ -1611,20 +1773,18 @@ pcnet32_init_ring(struct net_device *dev) | |||
1611 | } | 1773 | } |
1612 | /* The Tx buffer address is filled in as needed, but we do need to clear | 1774 | /* The Tx buffer address is filled in as needed, but we do need to clear |
1613 | * the upper ownership bit. */ | 1775 | * the upper ownership bit. */ |
1614 | for (i = 0; i < TX_RING_SIZE; i++) { | 1776 | for (i = 0; i < lp->tx_ring_size; i++) { |
1615 | lp->tx_ring[i].status = 0; /* CPU owns buffer */ | 1777 | lp->tx_ring[i].status = 0; /* CPU owns buffer */ |
1616 | wmb(); /* Make sure adapter sees owner change */ | 1778 | wmb(); /* Make sure adapter sees owner change */ |
1617 | lp->tx_ring[i].base = 0; | 1779 | lp->tx_ring[i].base = 0; |
1618 | lp->tx_dma_addr[i] = 0; | 1780 | lp->tx_dma_addr[i] = 0; |
1619 | } | 1781 | } |
1620 | 1782 | ||
1621 | lp->init_block.tlen_rlen = le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS); | 1783 | lp->init_block.tlen_rlen = le16_to_cpu(lp->tx_len_bits | lp->rx_len_bits); |
1622 | for (i = 0; i < 6; i++) | 1784 | for (i = 0; i < 6; i++) |
1623 | lp->init_block.phys_addr[i] = dev->dev_addr[i]; | 1785 | lp->init_block.phys_addr[i] = dev->dev_addr[i]; |
1624 | lp->init_block.rx_ring = (u32)le32_to_cpu(lp->dma_addr + | 1786 | lp->init_block.rx_ring = (u32)le32_to_cpu(lp->rx_ring_dma_addr); |
1625 | offsetof(struct pcnet32_private, rx_ring)); | 1787 | lp->init_block.tx_ring = (u32)le32_to_cpu(lp->tx_ring_dma_addr); |
1626 | lp->init_block.tx_ring = (u32)le32_to_cpu(lp->dma_addr + | ||
1627 | offsetof(struct pcnet32_private, tx_ring)); | ||
1628 | wmb(); /* Make sure all changes are visible */ | 1788 | wmb(); /* Make sure all changes are visible */ |
1629 | return 0; | 1789 | return 0; |
1630 | } | 1790 | } |
@@ -1682,13 +1842,13 @@ pcnet32_tx_timeout (struct net_device *dev) | |||
1682 | printk(KERN_DEBUG " Ring data dump: dirty_tx %d cur_tx %d%s cur_rx %d.", | 1842 | printk(KERN_DEBUG " Ring data dump: dirty_tx %d cur_tx %d%s cur_rx %d.", |
1683 | lp->dirty_tx, lp->cur_tx, lp->tx_full ? " (full)" : "", | 1843 | lp->dirty_tx, lp->cur_tx, lp->tx_full ? " (full)" : "", |
1684 | lp->cur_rx); | 1844 | lp->cur_rx); |
1685 | for (i = 0 ; i < RX_RING_SIZE; i++) | 1845 | for (i = 0 ; i < lp->rx_ring_size; i++) |
1686 | printk("%s %08x %04x %08x %04x", i & 1 ? "" : "\n ", | 1846 | printk("%s %08x %04x %08x %04x", i & 1 ? "" : "\n ", |
1687 | le32_to_cpu(lp->rx_ring[i].base), | 1847 | le32_to_cpu(lp->rx_ring[i].base), |
1688 | (-le16_to_cpu(lp->rx_ring[i].buf_length)) & 0xffff, | 1848 | (-le16_to_cpu(lp->rx_ring[i].buf_length)) & 0xffff, |
1689 | le32_to_cpu(lp->rx_ring[i].msg_length), | 1849 | le32_to_cpu(lp->rx_ring[i].msg_length), |
1690 | le16_to_cpu(lp->rx_ring[i].status)); | 1850 | le16_to_cpu(lp->rx_ring[i].status)); |
1691 | for (i = 0 ; i < TX_RING_SIZE; i++) | 1851 | for (i = 0 ; i < lp->tx_ring_size; i++) |
1692 | printk("%s %08x %04x %08x %04x", i & 1 ? "" : "\n ", | 1852 | printk("%s %08x %04x %08x %04x", i & 1 ? "" : "\n ", |
1693 | le32_to_cpu(lp->tx_ring[i].base), | 1853 | le32_to_cpu(lp->tx_ring[i].base), |
1694 | (-le16_to_cpu(lp->tx_ring[i].length)) & 0xffff, | 1854 | (-le16_to_cpu(lp->tx_ring[i].length)) & 0xffff, |
@@ -1729,7 +1889,7 @@ pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1729 | /* Fill in a Tx ring entry */ | 1889 | /* Fill in a Tx ring entry */ |
1730 | 1890 | ||
1731 | /* Mask to ring buffer boundary. */ | 1891 | /* Mask to ring buffer boundary. */ |
1732 | entry = lp->cur_tx & TX_RING_MOD_MASK; | 1892 | entry = lp->cur_tx & lp->tx_mod_mask; |
1733 | 1893 | ||
1734 | /* Caution: the write order is important here, set the status | 1894 | /* Caution: the write order is important here, set the status |
1735 | * with the "ownership" bits last. */ | 1895 | * with the "ownership" bits last. */ |
@@ -1753,7 +1913,7 @@ pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1753 | 1913 | ||
1754 | dev->trans_start = jiffies; | 1914 | dev->trans_start = jiffies; |
1755 | 1915 | ||
1756 | if (lp->tx_ring[(entry+1) & TX_RING_MOD_MASK].base != 0) { | 1916 | if (lp->tx_ring[(entry+1) & lp->tx_mod_mask].base != 0) { |
1757 | lp->tx_full = 1; | 1917 | lp->tx_full = 1; |
1758 | netif_stop_queue(dev); | 1918 | netif_stop_queue(dev); |
1759 | } | 1919 | } |
@@ -1806,7 +1966,7 @@ pcnet32_interrupt(int irq, void *dev_id, struct pt_regs * regs) | |||
1806 | int delta; | 1966 | int delta; |
1807 | 1967 | ||
1808 | while (dirty_tx != lp->cur_tx) { | 1968 | while (dirty_tx != lp->cur_tx) { |
1809 | int entry = dirty_tx & TX_RING_MOD_MASK; | 1969 | int entry = dirty_tx & lp->tx_mod_mask; |
1810 | int status = (short)le16_to_cpu(lp->tx_ring[entry].status); | 1970 | int status = (short)le16_to_cpu(lp->tx_ring[entry].status); |
1811 | 1971 | ||
1812 | if (status < 0) | 1972 | if (status < 0) |
@@ -1864,18 +2024,18 @@ pcnet32_interrupt(int irq, void *dev_id, struct pt_regs * regs) | |||
1864 | dirty_tx++; | 2024 | dirty_tx++; |
1865 | } | 2025 | } |
1866 | 2026 | ||
1867 | delta = (lp->cur_tx - dirty_tx) & (TX_RING_MOD_MASK + TX_RING_SIZE); | 2027 | delta = (lp->cur_tx - dirty_tx) & (lp->tx_mod_mask + lp->tx_ring_size); |
1868 | if (delta > TX_RING_SIZE) { | 2028 | if (delta > lp->tx_ring_size) { |
1869 | if (netif_msg_drv(lp)) | 2029 | if (netif_msg_drv(lp)) |
1870 | printk(KERN_ERR "%s: out-of-sync dirty pointer, %d vs. %d, full=%d.\n", | 2030 | printk(KERN_ERR "%s: out-of-sync dirty pointer, %d vs. %d, full=%d.\n", |
1871 | dev->name, dirty_tx, lp->cur_tx, lp->tx_full); | 2031 | dev->name, dirty_tx, lp->cur_tx, lp->tx_full); |
1872 | dirty_tx += TX_RING_SIZE; | 2032 | dirty_tx += lp->tx_ring_size; |
1873 | delta -= TX_RING_SIZE; | 2033 | delta -= lp->tx_ring_size; |
1874 | } | 2034 | } |
1875 | 2035 | ||
1876 | if (lp->tx_full && | 2036 | if (lp->tx_full && |
1877 | netif_queue_stopped(dev) && | 2037 | netif_queue_stopped(dev) && |
1878 | delta < TX_RING_SIZE - 2) { | 2038 | delta < lp->tx_ring_size - 2) { |
1879 | /* The ring is no longer full, clear tbusy. */ | 2039 | /* The ring is no longer full, clear tbusy. */ |
1880 | lp->tx_full = 0; | 2040 | lp->tx_full = 0; |
1881 | netif_wake_queue (dev); | 2041 | netif_wake_queue (dev); |
@@ -1932,8 +2092,8 @@ static int | |||
1932 | pcnet32_rx(struct net_device *dev) | 2092 | pcnet32_rx(struct net_device *dev) |
1933 | { | 2093 | { |
1934 | struct pcnet32_private *lp = dev->priv; | 2094 | struct pcnet32_private *lp = dev->priv; |
1935 | int entry = lp->cur_rx & RX_RING_MOD_MASK; | 2095 | int entry = lp->cur_rx & lp->rx_mod_mask; |
1936 | int boguscnt = RX_RING_SIZE / 2; | 2096 | int boguscnt = lp->rx_ring_size / 2; |
1937 | 2097 | ||
1938 | /* If we own the next entry, it's a new packet. Send it up. */ | 2098 | /* If we own the next entry, it's a new packet. Send it up. */ |
1939 | while ((short)le16_to_cpu(lp->rx_ring[entry].status) >= 0) { | 2099 | while ((short)le16_to_cpu(lp->rx_ring[entry].status) >= 0) { |
@@ -1998,12 +2158,12 @@ pcnet32_rx(struct net_device *dev) | |||
1998 | if (netif_msg_drv(lp)) | 2158 | if (netif_msg_drv(lp)) |
1999 | printk(KERN_ERR "%s: Memory squeeze, deferring packet.\n", | 2159 | printk(KERN_ERR "%s: Memory squeeze, deferring packet.\n", |
2000 | dev->name); | 2160 | dev->name); |
2001 | for (i = 0; i < RX_RING_SIZE; i++) | 2161 | for (i = 0; i < lp->rx_ring_size; i++) |
2002 | if ((short)le16_to_cpu(lp->rx_ring[(entry+i) | 2162 | if ((short)le16_to_cpu(lp->rx_ring[(entry+i) |
2003 | & RX_RING_MOD_MASK].status) < 0) | 2163 | & lp->rx_mod_mask].status) < 0) |
2004 | break; | 2164 | break; |
2005 | 2165 | ||
2006 | if (i > RX_RING_SIZE -2) { | 2166 | if (i > lp->rx_ring_size -2) { |
2007 | lp->stats.rx_dropped++; | 2167 | lp->stats.rx_dropped++; |
2008 | lp->rx_ring[entry].status |= le16_to_cpu(0x8000); | 2168 | lp->rx_ring[entry].status |= le16_to_cpu(0x8000); |
2009 | wmb(); /* Make sure adapter sees owner change */ | 2169 | wmb(); /* Make sure adapter sees owner change */ |
@@ -2041,7 +2201,7 @@ pcnet32_rx(struct net_device *dev) | |||
2041 | lp->rx_ring[entry].buf_length = le16_to_cpu(2-PKT_BUF_SZ); | 2201 | lp->rx_ring[entry].buf_length = le16_to_cpu(2-PKT_BUF_SZ); |
2042 | wmb(); /* Make sure owner changes after all others are visible */ | 2202 | wmb(); /* Make sure owner changes after all others are visible */ |
2043 | lp->rx_ring[entry].status |= le16_to_cpu(0x8000); | 2203 | lp->rx_ring[entry].status |= le16_to_cpu(0x8000); |
2044 | entry = (++lp->cur_rx) & RX_RING_MOD_MASK; | 2204 | entry = (++lp->cur_rx) & lp->rx_mod_mask; |
2045 | if (--boguscnt <= 0) break; /* don't stay in loop forever */ | 2205 | if (--boguscnt <= 0) break; /* don't stay in loop forever */ |
2046 | } | 2206 | } |
2047 | 2207 | ||
@@ -2084,7 +2244,7 @@ pcnet32_close(struct net_device *dev) | |||
2084 | spin_lock_irqsave(&lp->lock, flags); | 2244 | spin_lock_irqsave(&lp->lock, flags); |
2085 | 2245 | ||
2086 | /* free all allocated skbuffs */ | 2246 | /* free all allocated skbuffs */ |
2087 | for (i = 0; i < RX_RING_SIZE; i++) { | 2247 | for (i = 0; i < lp->rx_ring_size; i++) { |
2088 | lp->rx_ring[i].status = 0; | 2248 | lp->rx_ring[i].status = 0; |
2089 | wmb(); /* Make sure adapter sees owner change */ | 2249 | wmb(); /* Make sure adapter sees owner change */ |
2090 | if (lp->rx_skbuff[i]) { | 2250 | if (lp->rx_skbuff[i]) { |
@@ -2096,7 +2256,7 @@ pcnet32_close(struct net_device *dev) | |||
2096 | lp->rx_dma_addr[i] = 0; | 2256 | lp->rx_dma_addr[i] = 0; |
2097 | } | 2257 | } |
2098 | 2258 | ||
2099 | for (i = 0; i < TX_RING_SIZE; i++) { | 2259 | for (i = 0; i < lp->tx_ring_size; i++) { |
2100 | lp->tx_ring[i].status = 0; /* CPU owns buffer */ | 2260 | lp->tx_ring[i].status = 0; /* CPU owns buffer */ |
2101 | wmb(); /* Make sure adapter sees owner change */ | 2261 | wmb(); /* Make sure adapter sees owner change */ |
2102 | if (lp->tx_skbuff[i]) { | 2262 | if (lp->tx_skbuff[i]) { |
@@ -2265,6 +2425,7 @@ static void __devexit pcnet32_remove_one(struct pci_dev *pdev) | |||
2265 | struct pcnet32_private *lp = dev->priv; | 2425 | struct pcnet32_private *lp = dev->priv; |
2266 | 2426 | ||
2267 | unregister_netdev(dev); | 2427 | unregister_netdev(dev); |
2428 | pcnet32_free_ring(dev); | ||
2268 | release_region(dev->base_addr, PCNET32_TOTAL_SIZE); | 2429 | release_region(dev->base_addr, PCNET32_TOTAL_SIZE); |
2269 | pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); | 2430 | pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); |
2270 | free_netdev(dev); | 2431 | free_netdev(dev); |
@@ -2340,6 +2501,7 @@ static void __exit pcnet32_cleanup_module(void) | |||
2340 | struct pcnet32_private *lp = pcnet32_dev->priv; | 2501 | struct pcnet32_private *lp = pcnet32_dev->priv; |
2341 | next_dev = lp->next; | 2502 | next_dev = lp->next; |
2342 | unregister_netdev(pcnet32_dev); | 2503 | unregister_netdev(pcnet32_dev); |
2504 | pcnet32_free_ring(pcnet32_dev); | ||
2343 | release_region(pcnet32_dev->base_addr, PCNET32_TOTAL_SIZE); | 2505 | release_region(pcnet32_dev->base_addr, PCNET32_TOTAL_SIZE); |
2344 | pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); | 2506 | pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr); |
2345 | free_netdev(pcnet32_dev); | 2507 | free_netdev(pcnet32_dev); |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 14f4de1a8180..c782a6329805 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -12,14 +12,6 @@ config PHYLIB | |||
12 | devices. This option provides infrastructure for | 12 | devices. This option provides infrastructure for |
13 | managing PHY devices. | 13 | managing PHY devices. |
14 | 14 | ||
15 | config PHYCONTROL | ||
16 | bool " Support for automatically handling PHY state changes" | ||
17 | depends on PHYLIB | ||
18 | help | ||
19 | Adds code to perform all the work for keeping PHY link | ||
20 | state (speed/duplex/etc) up-to-date. Also handles | ||
21 | interrupts. | ||
22 | |||
23 | comment "MII PHY device drivers" | 15 | comment "MII PHY device drivers" |
24 | depends on PHYLIB | 16 | depends on PHYLIB |
25 | 17 | ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index d9e11f93bf3a..9209da9dde0d 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -242,10 +242,6 @@ EXPORT_SYMBOL(phy_sanitize_settings); | |||
242 | * choose the next best ones from the ones selected, so we don't | 242 | * choose the next best ones from the ones selected, so we don't |
243 | * care if ethtool tries to give us bad values | 243 | * care if ethtool tries to give us bad values |
244 | * | 244 | * |
245 | * A note about the PHYCONTROL Layer. If you turn off | ||
246 | * CONFIG_PHYCONTROL, you will need to read the PHY status | ||
247 | * registers after this function completes, and update your | ||
248 | * controller manually. | ||
249 | */ | 245 | */ |
250 | int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) | 246 | int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) |
251 | { | 247 | { |
@@ -380,7 +376,6 @@ int phy_start_aneg(struct phy_device *phydev) | |||
380 | 376 | ||
381 | err = phydev->drv->config_aneg(phydev); | 377 | err = phydev->drv->config_aneg(phydev); |
382 | 378 | ||
383 | #ifdef CONFIG_PHYCONTROL | ||
384 | if (err < 0) | 379 | if (err < 0) |
385 | goto out_unlock; | 380 | goto out_unlock; |
386 | 381 | ||
@@ -395,14 +390,12 @@ int phy_start_aneg(struct phy_device *phydev) | |||
395 | } | 390 | } |
396 | 391 | ||
397 | out_unlock: | 392 | out_unlock: |
398 | #endif | ||
399 | spin_unlock(&phydev->lock); | 393 | spin_unlock(&phydev->lock); |
400 | return err; | 394 | return err; |
401 | } | 395 | } |
402 | EXPORT_SYMBOL(phy_start_aneg); | 396 | EXPORT_SYMBOL(phy_start_aneg); |
403 | 397 | ||
404 | 398 | ||
405 | #ifdef CONFIG_PHYCONTROL | ||
406 | static void phy_change(void *data); | 399 | static void phy_change(void *data); |
407 | static void phy_timer(unsigned long data); | 400 | static void phy_timer(unsigned long data); |
408 | 401 | ||
@@ -868,4 +861,3 @@ static void phy_timer(unsigned long data) | |||
868 | mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ); | 861 | mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ); |
869 | } | 862 | } |
870 | 863 | ||
871 | #endif /* CONFIG_PHYCONTROL */ | ||
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 33f7bdb5857c..6da1aa0706a1 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -101,7 +101,6 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr) | |||
101 | return dev; | 101 | return dev; |
102 | } | 102 | } |
103 | 103 | ||
104 | #ifdef CONFIG_PHYCONTROL | ||
105 | /* phy_prepare_link: | 104 | /* phy_prepare_link: |
106 | * | 105 | * |
107 | * description: Tells the PHY infrastructure to handle the | 106 | * description: Tells the PHY infrastructure to handle the |
@@ -160,8 +159,6 @@ void phy_disconnect(struct phy_device *phydev) | |||
160 | } | 159 | } |
161 | EXPORT_SYMBOL(phy_disconnect); | 160 | EXPORT_SYMBOL(phy_disconnect); |
162 | 161 | ||
163 | #endif /* CONFIG_PHYCONTROL */ | ||
164 | |||
165 | /* phy_attach: | 162 | /* phy_attach: |
166 | * | 163 | * |
167 | * description: Called by drivers to attach to a particular PHY | 164 | * description: Called by drivers to attach to a particular PHY |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index afb3f186b884..159b56a56ef4 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1027,6 +1027,7 @@ static struct ethtool_ops rtl8169_ethtool_ops = { | |||
1027 | .get_strings = rtl8169_get_strings, | 1027 | .get_strings = rtl8169_get_strings, |
1028 | .get_stats_count = rtl8169_get_stats_count, | 1028 | .get_stats_count = rtl8169_get_stats_count, |
1029 | .get_ethtool_stats = rtl8169_get_ethtool_stats, | 1029 | .get_ethtool_stats = rtl8169_get_ethtool_stats, |
1030 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
1030 | }; | 1031 | }; |
1031 | 1032 | ||
1032 | static void rtl8169_write_gmii_reg_bit(void __iomem *ioaddr, int reg, int bitnum, | 1033 | static void rtl8169_write_gmii_reg_bit(void __iomem *ioaddr, int reg, int bitnum, |
@@ -1511,6 +1512,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1511 | /* Get MAC address. FIXME: read EEPROM */ | 1512 | /* Get MAC address. FIXME: read EEPROM */ |
1512 | for (i = 0; i < MAC_ADDR_LEN; i++) | 1513 | for (i = 0; i < MAC_ADDR_LEN; i++) |
1513 | dev->dev_addr[i] = RTL_R8(MAC0 + i); | 1514 | dev->dev_addr[i] = RTL_R8(MAC0 + i); |
1515 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
1514 | 1516 | ||
1515 | dev->open = rtl8169_open; | 1517 | dev->open = rtl8169_open; |
1516 | dev->hard_start_xmit = rtl8169_start_xmit; | 1518 | dev->hard_start_xmit = rtl8169_start_xmit; |
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c new file mode 100644 index 000000000000..12cde0604580 --- /dev/null +++ b/drivers/net/rionet.c | |||
@@ -0,0 +1,574 @@ | |||
1 | /* | ||
2 | * rionet - Ethernet driver over RapidIO messaging services | ||
3 | * | ||
4 | * Copyright 2005 MontaVista Software, Inc. | ||
5 | * Matt Porter <mporter@kernel.crashing.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/dma-mapping.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/rio.h> | ||
18 | #include <linux/rio_drv.h> | ||
19 | #include <linux/rio_ids.h> | ||
20 | |||
21 | #include <linux/netdevice.h> | ||
22 | #include <linux/etherdevice.h> | ||
23 | #include <linux/skbuff.h> | ||
24 | #include <linux/crc32.h> | ||
25 | #include <linux/ethtool.h> | ||
26 | |||
27 | #define DRV_NAME "rionet" | ||
28 | #define DRV_VERSION "0.2" | ||
29 | #define DRV_AUTHOR "Matt Porter <mporter@kernel.crashing.org>" | ||
30 | #define DRV_DESC "Ethernet over RapidIO" | ||
31 | |||
32 | MODULE_AUTHOR(DRV_AUTHOR); | ||
33 | MODULE_DESCRIPTION(DRV_DESC); | ||
34 | MODULE_LICENSE("GPL"); | ||
35 | |||
36 | #define RIONET_DEFAULT_MSGLEVEL \ | ||
37 | (NETIF_MSG_DRV | \ | ||
38 | NETIF_MSG_LINK | \ | ||
39 | NETIF_MSG_RX_ERR | \ | ||
40 | NETIF_MSG_TX_ERR) | ||
41 | |||
42 | #define RIONET_DOORBELL_JOIN 0x1000 | ||
43 | #define RIONET_DOORBELL_LEAVE 0x1001 | ||
44 | |||
45 | #define RIONET_MAILBOX 0 | ||
46 | |||
47 | #define RIONET_TX_RING_SIZE CONFIG_RIONET_TX_SIZE | ||
48 | #define RIONET_RX_RING_SIZE CONFIG_RIONET_RX_SIZE | ||
49 | |||
50 | static LIST_HEAD(rionet_peers); | ||
51 | |||
52 | struct rionet_private { | ||
53 | struct rio_mport *mport; | ||
54 | struct sk_buff *rx_skb[RIONET_RX_RING_SIZE]; | ||
55 | struct sk_buff *tx_skb[RIONET_TX_RING_SIZE]; | ||
56 | struct net_device_stats stats; | ||
57 | int rx_slot; | ||
58 | int tx_slot; | ||
59 | int tx_cnt; | ||
60 | int ack_slot; | ||
61 | spinlock_t lock; | ||
62 | spinlock_t tx_lock; | ||
63 | u32 msg_enable; | ||
64 | }; | ||
65 | |||
66 | struct rionet_peer { | ||
67 | struct list_head node; | ||
68 | struct rio_dev *rdev; | ||
69 | struct resource *res; | ||
70 | }; | ||
71 | |||
72 | static int rionet_check = 0; | ||
73 | static int rionet_capable = 1; | ||
74 | |||
75 | /* | ||
76 | * This is a fast lookup table for for translating TX | ||
77 | * Ethernet packets into a destination RIO device. It | ||
78 | * could be made into a hash table to save memory depending | ||
79 | * on system trade-offs. | ||
80 | */ | ||
81 | static struct rio_dev *rionet_active[RIO_MAX_ROUTE_ENTRIES]; | ||
82 | |||
83 | #define is_rionet_capable(pef, src_ops, dst_ops) \ | ||
84 | ((pef & RIO_PEF_INB_MBOX) && \ | ||
85 | (pef & RIO_PEF_INB_DOORBELL) && \ | ||
86 | (src_ops & RIO_SRC_OPS_DOORBELL) && \ | ||
87 | (dst_ops & RIO_DST_OPS_DOORBELL)) | ||
88 | #define dev_rionet_capable(dev) \ | ||
89 | is_rionet_capable(dev->pef, dev->src_ops, dev->dst_ops) | ||
90 | |||
91 | #define RIONET_MAC_MATCH(x) (*(u32 *)x == 0x00010001) | ||
92 | #define RIONET_GET_DESTID(x) (*(u16 *)(x + 4)) | ||
93 | |||
94 | static struct net_device_stats *rionet_stats(struct net_device *ndev) | ||
95 | { | ||
96 | struct rionet_private *rnet = ndev->priv; | ||
97 | return &rnet->stats; | ||
98 | } | ||
99 | |||
100 | static int rionet_rx_clean(struct net_device *ndev) | ||
101 | { | ||
102 | int i; | ||
103 | int error = 0; | ||
104 | struct rionet_private *rnet = ndev->priv; | ||
105 | void *data; | ||
106 | |||
107 | i = rnet->rx_slot; | ||
108 | |||
109 | do { | ||
110 | if (!rnet->rx_skb[i]) | ||
111 | continue; | ||
112 | |||
113 | if (!(data = rio_get_inb_message(rnet->mport, RIONET_MAILBOX))) | ||
114 | break; | ||
115 | |||
116 | rnet->rx_skb[i]->data = data; | ||
117 | skb_put(rnet->rx_skb[i], RIO_MAX_MSG_SIZE); | ||
118 | rnet->rx_skb[i]->dev = ndev; | ||
119 | rnet->rx_skb[i]->protocol = | ||
120 | eth_type_trans(rnet->rx_skb[i], ndev); | ||
121 | error = netif_rx(rnet->rx_skb[i]); | ||
122 | |||
123 | if (error == NET_RX_DROP) { | ||
124 | rnet->stats.rx_dropped++; | ||
125 | } else if (error == NET_RX_BAD) { | ||
126 | if (netif_msg_rx_err(rnet)) | ||
127 | printk(KERN_WARNING "%s: bad rx packet\n", | ||
128 | DRV_NAME); | ||
129 | rnet->stats.rx_errors++; | ||
130 | } else { | ||
131 | rnet->stats.rx_packets++; | ||
132 | rnet->stats.rx_bytes += RIO_MAX_MSG_SIZE; | ||
133 | } | ||
134 | |||
135 | } while ((i = (i + 1) % RIONET_RX_RING_SIZE) != rnet->rx_slot); | ||
136 | |||
137 | return i; | ||
138 | } | ||
139 | |||
140 | static void rionet_rx_fill(struct net_device *ndev, int end) | ||
141 | { | ||
142 | int i; | ||
143 | struct rionet_private *rnet = ndev->priv; | ||
144 | |||
145 | i = rnet->rx_slot; | ||
146 | do { | ||
147 | rnet->rx_skb[i] = dev_alloc_skb(RIO_MAX_MSG_SIZE); | ||
148 | |||
149 | if (!rnet->rx_skb[i]) | ||
150 | break; | ||
151 | |||
152 | rio_add_inb_buffer(rnet->mport, RIONET_MAILBOX, | ||
153 | rnet->rx_skb[i]->data); | ||
154 | } while ((i = (i + 1) % RIONET_RX_RING_SIZE) != end); | ||
155 | |||
156 | rnet->rx_slot = i; | ||
157 | } | ||
158 | |||
159 | static int rionet_queue_tx_msg(struct sk_buff *skb, struct net_device *ndev, | ||
160 | struct rio_dev *rdev) | ||
161 | { | ||
162 | struct rionet_private *rnet = ndev->priv; | ||
163 | |||
164 | rio_add_outb_message(rnet->mport, rdev, 0, skb->data, skb->len); | ||
165 | rnet->tx_skb[rnet->tx_slot] = skb; | ||
166 | |||
167 | rnet->stats.tx_packets++; | ||
168 | rnet->stats.tx_bytes += skb->len; | ||
169 | |||
170 | if (++rnet->tx_cnt == RIONET_TX_RING_SIZE) | ||
171 | netif_stop_queue(ndev); | ||
172 | |||
173 | ++rnet->tx_slot; | ||
174 | rnet->tx_slot &= (RIONET_TX_RING_SIZE - 1); | ||
175 | |||
176 | if (netif_msg_tx_queued(rnet)) | ||
177 | printk(KERN_INFO "%s: queued skb %8.8x len %8.8x\n", DRV_NAME, | ||
178 | (u32) skb, skb->len); | ||
179 | |||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | ||
184 | { | ||
185 | int i; | ||
186 | struct rionet_private *rnet = ndev->priv; | ||
187 | struct ethhdr *eth = (struct ethhdr *)skb->data; | ||
188 | u16 destid; | ||
189 | unsigned long flags; | ||
190 | |||
191 | local_irq_save(flags); | ||
192 | if (!spin_trylock(&rnet->tx_lock)) { | ||
193 | local_irq_restore(flags); | ||
194 | return NETDEV_TX_LOCKED; | ||
195 | } | ||
196 | |||
197 | if ((rnet->tx_cnt + 1) > RIONET_TX_RING_SIZE) { | ||
198 | netif_stop_queue(ndev); | ||
199 | spin_unlock_irqrestore(&rnet->tx_lock, flags); | ||
200 | printk(KERN_ERR "%s: BUG! Tx Ring full when queue awake!\n", | ||
201 | ndev->name); | ||
202 | return NETDEV_TX_BUSY; | ||
203 | } | ||
204 | |||
205 | if (eth->h_dest[0] & 0x01) { | ||
206 | for (i = 0; i < RIO_MAX_ROUTE_ENTRIES; i++) | ||
207 | if (rionet_active[i]) | ||
208 | rionet_queue_tx_msg(skb, ndev, | ||
209 | rionet_active[i]); | ||
210 | } else if (RIONET_MAC_MATCH(eth->h_dest)) { | ||
211 | destid = RIONET_GET_DESTID(eth->h_dest); | ||
212 | if (rionet_active[destid]) | ||
213 | rionet_queue_tx_msg(skb, ndev, rionet_active[destid]); | ||
214 | } | ||
215 | |||
216 | spin_unlock_irqrestore(&rnet->tx_lock, flags); | ||
217 | |||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static void rionet_dbell_event(struct rio_mport *mport, void *dev_id, u16 sid, u16 tid, | ||
222 | u16 info) | ||
223 | { | ||
224 | struct net_device *ndev = dev_id; | ||
225 | struct rionet_private *rnet = ndev->priv; | ||
226 | struct rionet_peer *peer; | ||
227 | |||
228 | if (netif_msg_intr(rnet)) | ||
229 | printk(KERN_INFO "%s: doorbell sid %4.4x tid %4.4x info %4.4x", | ||
230 | DRV_NAME, sid, tid, info); | ||
231 | if (info == RIONET_DOORBELL_JOIN) { | ||
232 | if (!rionet_active[sid]) { | ||
233 | list_for_each_entry(peer, &rionet_peers, node) { | ||
234 | if (peer->rdev->destid == sid) | ||
235 | rionet_active[sid] = peer->rdev; | ||
236 | } | ||
237 | rio_mport_send_doorbell(mport, sid, | ||
238 | RIONET_DOORBELL_JOIN); | ||
239 | } | ||
240 | } else if (info == RIONET_DOORBELL_LEAVE) { | ||
241 | rionet_active[sid] = NULL; | ||
242 | } else { | ||
243 | if (netif_msg_intr(rnet)) | ||
244 | printk(KERN_WARNING "%s: unhandled doorbell\n", | ||
245 | DRV_NAME); | ||
246 | } | ||
247 | } | ||
248 | |||
249 | static void rionet_inb_msg_event(struct rio_mport *mport, void *dev_id, int mbox, int slot) | ||
250 | { | ||
251 | int n; | ||
252 | struct net_device *ndev = dev_id; | ||
253 | struct rionet_private *rnet = (struct rionet_private *)ndev->priv; | ||
254 | |||
255 | if (netif_msg_intr(rnet)) | ||
256 | printk(KERN_INFO "%s: inbound message event, mbox %d slot %d\n", | ||
257 | DRV_NAME, mbox, slot); | ||
258 | |||
259 | spin_lock(&rnet->lock); | ||
260 | if ((n = rionet_rx_clean(ndev)) != rnet->rx_slot) | ||
261 | rionet_rx_fill(ndev, n); | ||
262 | spin_unlock(&rnet->lock); | ||
263 | } | ||
264 | |||
265 | static void rionet_outb_msg_event(struct rio_mport *mport, void *dev_id, int mbox, int slot) | ||
266 | { | ||
267 | struct net_device *ndev = dev_id; | ||
268 | struct rionet_private *rnet = ndev->priv; | ||
269 | |||
270 | spin_lock(&rnet->lock); | ||
271 | |||
272 | if (netif_msg_intr(rnet)) | ||
273 | printk(KERN_INFO | ||
274 | "%s: outbound message event, mbox %d slot %d\n", | ||
275 | DRV_NAME, mbox, slot); | ||
276 | |||
277 | while (rnet->tx_cnt && (rnet->ack_slot != slot)) { | ||
278 | /* dma unmap single */ | ||
279 | dev_kfree_skb_irq(rnet->tx_skb[rnet->ack_slot]); | ||
280 | rnet->tx_skb[rnet->ack_slot] = NULL; | ||
281 | ++rnet->ack_slot; | ||
282 | rnet->ack_slot &= (RIONET_TX_RING_SIZE - 1); | ||
283 | rnet->tx_cnt--; | ||
284 | } | ||
285 | |||
286 | if (rnet->tx_cnt < RIONET_TX_RING_SIZE) | ||
287 | netif_wake_queue(ndev); | ||
288 | |||
289 | spin_unlock(&rnet->lock); | ||
290 | } | ||
291 | |||
292 | static int rionet_open(struct net_device *ndev) | ||
293 | { | ||
294 | int i, rc = 0; | ||
295 | struct rionet_peer *peer, *tmp; | ||
296 | u32 pwdcsr; | ||
297 | struct rionet_private *rnet = ndev->priv; | ||
298 | |||
299 | if (netif_msg_ifup(rnet)) | ||
300 | printk(KERN_INFO "%s: open\n", DRV_NAME); | ||
301 | |||
302 | if ((rc = rio_request_inb_dbell(rnet->mport, | ||
303 | (void *)ndev, | ||
304 | RIONET_DOORBELL_JOIN, | ||
305 | RIONET_DOORBELL_LEAVE, | ||
306 | rionet_dbell_event)) < 0) | ||
307 | goto out; | ||
308 | |||
309 | if ((rc = rio_request_inb_mbox(rnet->mport, | ||
310 | (void *)ndev, | ||
311 | RIONET_MAILBOX, | ||
312 | RIONET_RX_RING_SIZE, | ||
313 | rionet_inb_msg_event)) < 0) | ||
314 | goto out; | ||
315 | |||
316 | if ((rc = rio_request_outb_mbox(rnet->mport, | ||
317 | (void *)ndev, | ||
318 | RIONET_MAILBOX, | ||
319 | RIONET_TX_RING_SIZE, | ||
320 | rionet_outb_msg_event)) < 0) | ||
321 | goto out; | ||
322 | |||
323 | /* Initialize inbound message ring */ | ||
324 | for (i = 0; i < RIONET_RX_RING_SIZE; i++) | ||
325 | rnet->rx_skb[i] = NULL; | ||
326 | rnet->rx_slot = 0; | ||
327 | rionet_rx_fill(ndev, 0); | ||
328 | |||
329 | rnet->tx_slot = 0; | ||
330 | rnet->tx_cnt = 0; | ||
331 | rnet->ack_slot = 0; | ||
332 | |||
333 | netif_carrier_on(ndev); | ||
334 | netif_start_queue(ndev); | ||
335 | |||
336 | list_for_each_entry_safe(peer, tmp, &rionet_peers, node) { | ||
337 | if (!(peer->res = rio_request_outb_dbell(peer->rdev, | ||
338 | RIONET_DOORBELL_JOIN, | ||
339 | RIONET_DOORBELL_LEAVE))) | ||
340 | { | ||
341 | printk(KERN_ERR "%s: error requesting doorbells\n", | ||
342 | DRV_NAME); | ||
343 | continue; | ||
344 | } | ||
345 | |||
346 | /* | ||
347 | * If device has initialized inbound doorbells, | ||
348 | * send a join message | ||
349 | */ | ||
350 | rio_read_config_32(peer->rdev, RIO_WRITE_PORT_CSR, &pwdcsr); | ||
351 | if (pwdcsr & RIO_DOORBELL_AVAIL) | ||
352 | rio_send_doorbell(peer->rdev, RIONET_DOORBELL_JOIN); | ||
353 | } | ||
354 | |||
355 | out: | ||
356 | return rc; | ||
357 | } | ||
358 | |||
359 | static int rionet_close(struct net_device *ndev) | ||
360 | { | ||
361 | struct rionet_private *rnet = (struct rionet_private *)ndev->priv; | ||
362 | struct rionet_peer *peer, *tmp; | ||
363 | int i; | ||
364 | |||
365 | if (netif_msg_ifup(rnet)) | ||
366 | printk(KERN_INFO "%s: close\n", DRV_NAME); | ||
367 | |||
368 | netif_stop_queue(ndev); | ||
369 | netif_carrier_off(ndev); | ||
370 | |||
371 | for (i = 0; i < RIONET_RX_RING_SIZE; i++) | ||
372 | if (rnet->rx_skb[i]) | ||
373 | kfree_skb(rnet->rx_skb[i]); | ||
374 | |||
375 | list_for_each_entry_safe(peer, tmp, &rionet_peers, node) { | ||
376 | if (rionet_active[peer->rdev->destid]) { | ||
377 | rio_send_doorbell(peer->rdev, RIONET_DOORBELL_LEAVE); | ||
378 | rionet_active[peer->rdev->destid] = NULL; | ||
379 | } | ||
380 | rio_release_outb_dbell(peer->rdev, peer->res); | ||
381 | } | ||
382 | |||
383 | rio_release_inb_dbell(rnet->mport, RIONET_DOORBELL_JOIN, | ||
384 | RIONET_DOORBELL_LEAVE); | ||
385 | rio_release_inb_mbox(rnet->mport, RIONET_MAILBOX); | ||
386 | rio_release_outb_mbox(rnet->mport, RIONET_MAILBOX); | ||
387 | |||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | static void rionet_remove(struct rio_dev *rdev) | ||
392 | { | ||
393 | struct net_device *ndev = NULL; | ||
394 | struct rionet_peer *peer, *tmp; | ||
395 | |||
396 | unregister_netdev(ndev); | ||
397 | kfree(ndev); | ||
398 | |||
399 | list_for_each_entry_safe(peer, tmp, &rionet_peers, node) { | ||
400 | list_del(&peer->node); | ||
401 | kfree(peer); | ||
402 | } | ||
403 | } | ||
404 | |||
405 | static void rionet_get_drvinfo(struct net_device *ndev, | ||
406 | struct ethtool_drvinfo *info) | ||
407 | { | ||
408 | struct rionet_private *rnet = ndev->priv; | ||
409 | |||
410 | strcpy(info->driver, DRV_NAME); | ||
411 | strcpy(info->version, DRV_VERSION); | ||
412 | strcpy(info->fw_version, "n/a"); | ||
413 | strcpy(info->bus_info, rnet->mport->name); | ||
414 | } | ||
415 | |||
416 | static u32 rionet_get_msglevel(struct net_device *ndev) | ||
417 | { | ||
418 | struct rionet_private *rnet = ndev->priv; | ||
419 | |||
420 | return rnet->msg_enable; | ||
421 | } | ||
422 | |||
423 | static void rionet_set_msglevel(struct net_device *ndev, u32 value) | ||
424 | { | ||
425 | struct rionet_private *rnet = ndev->priv; | ||
426 | |||
427 | rnet->msg_enable = value; | ||
428 | } | ||
429 | |||
430 | static struct ethtool_ops rionet_ethtool_ops = { | ||
431 | .get_drvinfo = rionet_get_drvinfo, | ||
432 | .get_msglevel = rionet_get_msglevel, | ||
433 | .set_msglevel = rionet_set_msglevel, | ||
434 | .get_link = ethtool_op_get_link, | ||
435 | }; | ||
436 | |||
437 | static int rionet_setup_netdev(struct rio_mport *mport) | ||
438 | { | ||
439 | int rc = 0; | ||
440 | struct net_device *ndev = NULL; | ||
441 | struct rionet_private *rnet; | ||
442 | u16 device_id; | ||
443 | |||
444 | /* Allocate our net_device structure */ | ||
445 | ndev = alloc_etherdev(sizeof(struct rionet_private)); | ||
446 | if (ndev == NULL) { | ||
447 | printk(KERN_INFO "%s: could not allocate ethernet device.\n", | ||
448 | DRV_NAME); | ||
449 | rc = -ENOMEM; | ||
450 | goto out; | ||
451 | } | ||
452 | |||
453 | /* Set up private area */ | ||
454 | rnet = (struct rionet_private *)ndev->priv; | ||
455 | rnet->mport = mport; | ||
456 | |||
457 | /* Set the default MAC address */ | ||
458 | device_id = rio_local_get_device_id(mport); | ||
459 | ndev->dev_addr[0] = 0x00; | ||
460 | ndev->dev_addr[1] = 0x01; | ||
461 | ndev->dev_addr[2] = 0x00; | ||
462 | ndev->dev_addr[3] = 0x01; | ||
463 | ndev->dev_addr[4] = device_id >> 8; | ||
464 | ndev->dev_addr[5] = device_id & 0xff; | ||
465 | |||
466 | /* Fill in the driver function table */ | ||
467 | ndev->open = &rionet_open; | ||
468 | ndev->hard_start_xmit = &rionet_start_xmit; | ||
469 | ndev->stop = &rionet_close; | ||
470 | ndev->get_stats = &rionet_stats; | ||
471 | ndev->mtu = RIO_MAX_MSG_SIZE - 14; | ||
472 | ndev->features = NETIF_F_LLTX; | ||
473 | SET_ETHTOOL_OPS(ndev, &rionet_ethtool_ops); | ||
474 | |||
475 | SET_MODULE_OWNER(ndev); | ||
476 | |||
477 | spin_lock_init(&rnet->lock); | ||
478 | spin_lock_init(&rnet->tx_lock); | ||
479 | |||
480 | rnet->msg_enable = RIONET_DEFAULT_MSGLEVEL; | ||
481 | |||
482 | rc = register_netdev(ndev); | ||
483 | if (rc != 0) | ||
484 | goto out; | ||
485 | |||
486 | printk("%s: %s %s Version %s, MAC %02x:%02x:%02x:%02x:%02x:%02x\n", | ||
487 | ndev->name, | ||
488 | DRV_NAME, | ||
489 | DRV_DESC, | ||
490 | DRV_VERSION, | ||
491 | ndev->dev_addr[0], ndev->dev_addr[1], ndev->dev_addr[2], | ||
492 | ndev->dev_addr[3], ndev->dev_addr[4], ndev->dev_addr[5]); | ||
493 | |||
494 | out: | ||
495 | return rc; | ||
496 | } | ||
497 | |||
498 | /* | ||
499 | * XXX Make multi-net safe | ||
500 | */ | ||
501 | static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id) | ||
502 | { | ||
503 | int rc = -ENODEV; | ||
504 | u32 lpef, lsrc_ops, ldst_ops; | ||
505 | struct rionet_peer *peer; | ||
506 | |||
507 | /* If local device is not rionet capable, give up quickly */ | ||
508 | if (!rionet_capable) | ||
509 | goto out; | ||
510 | |||
511 | /* | ||
512 | * First time through, make sure local device is rionet | ||
513 | * capable, setup netdev, and set flags so this is skipped | ||
514 | * on later probes | ||
515 | */ | ||
516 | if (!rionet_check) { | ||
517 | rio_local_read_config_32(rdev->net->hport, RIO_PEF_CAR, &lpef); | ||
518 | rio_local_read_config_32(rdev->net->hport, RIO_SRC_OPS_CAR, | ||
519 | &lsrc_ops); | ||
520 | rio_local_read_config_32(rdev->net->hport, RIO_DST_OPS_CAR, | ||
521 | &ldst_ops); | ||
522 | if (!is_rionet_capable(lpef, lsrc_ops, ldst_ops)) { | ||
523 | printk(KERN_ERR | ||
524 | "%s: local device is not network capable\n", | ||
525 | DRV_NAME); | ||
526 | rionet_check = 1; | ||
527 | rionet_capable = 0; | ||
528 | goto out; | ||
529 | } | ||
530 | |||
531 | rc = rionet_setup_netdev(rdev->net->hport); | ||
532 | rionet_check = 1; | ||
533 | } | ||
534 | |||
535 | /* | ||
536 | * If the remote device has mailbox/doorbell capabilities, | ||
537 | * add it to the peer list. | ||
538 | */ | ||
539 | if (dev_rionet_capable(rdev)) { | ||
540 | if (!(peer = kmalloc(sizeof(struct rionet_peer), GFP_KERNEL))) { | ||
541 | rc = -ENOMEM; | ||
542 | goto out; | ||
543 | } | ||
544 | peer->rdev = rdev; | ||
545 | list_add_tail(&peer->node, &rionet_peers); | ||
546 | } | ||
547 | |||
548 | out: | ||
549 | return rc; | ||
550 | } | ||
551 | |||
552 | static struct rio_device_id rionet_id_table[] = { | ||
553 | {RIO_DEVICE(RIO_ANY_ID, RIO_ANY_ID)} | ||
554 | }; | ||
555 | |||
556 | static struct rio_driver rionet_driver = { | ||
557 | .name = "rionet", | ||
558 | .id_table = rionet_id_table, | ||
559 | .probe = rionet_probe, | ||
560 | .remove = rionet_remove, | ||
561 | }; | ||
562 | |||
563 | static int __init rionet_init(void) | ||
564 | { | ||
565 | return rio_register_driver(&rionet_driver); | ||
566 | } | ||
567 | |||
568 | static void __exit rionet_exit(void) | ||
569 | { | ||
570 | rio_unregister_driver(&rionet_driver); | ||
571 | } | ||
572 | |||
573 | module_init(rionet_init); | ||
574 | module_exit(rionet_exit); | ||
diff --git a/drivers/net/s2io-regs.h b/drivers/net/s2io-regs.h index 7cefe5507b9e..00179bc3437f 100644 --- a/drivers/net/s2io-regs.h +++ b/drivers/net/s2io-regs.h | |||
@@ -814,6 +814,17 @@ typedef struct _XENA_dev_config { | |||
814 | u64 rxgxs_ber_0; /* CHANGED */ | 814 | u64 rxgxs_ber_0; /* CHANGED */ |
815 | u64 rxgxs_ber_1; /* CHANGED */ | 815 | u64 rxgxs_ber_1; /* CHANGED */ |
816 | 816 | ||
817 | u64 spi_control; | ||
818 | #define SPI_CONTROL_KEY(key) vBIT(key,0,4) | ||
819 | #define SPI_CONTROL_BYTECNT(cnt) vBIT(cnt,29,3) | ||
820 | #define SPI_CONTROL_CMD(cmd) vBIT(cmd,32,8) | ||
821 | #define SPI_CONTROL_ADDR(addr) vBIT(addr,40,24) | ||
822 | #define SPI_CONTROL_SEL1 BIT(4) | ||
823 | #define SPI_CONTROL_REQ BIT(7) | ||
824 | #define SPI_CONTROL_NACK BIT(5) | ||
825 | #define SPI_CONTROL_DONE BIT(6) | ||
826 | u64 spi_data; | ||
827 | #define SPI_DATA_WRITE(data,len) vBIT(data,0,len) | ||
817 | } XENA_dev_config_t; | 828 | } XENA_dev_config_t; |
818 | 829 | ||
819 | #define XENA_REG_SPACE sizeof(XENA_dev_config_t) | 830 | #define XENA_REG_SPACE sizeof(XENA_dev_config_t) |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index dd451e099a4c..d303d162974f 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -65,9 +65,11 @@ | |||
65 | #include "s2io.h" | 65 | #include "s2io.h" |
66 | #include "s2io-regs.h" | 66 | #include "s2io-regs.h" |
67 | 67 | ||
68 | #define DRV_VERSION "Version 2.0.9.1" | ||
69 | |||
68 | /* S2io Driver name & version. */ | 70 | /* S2io Driver name & version. */ |
69 | static char s2io_driver_name[] = "Neterion"; | 71 | static char s2io_driver_name[] = "Neterion"; |
70 | static char s2io_driver_version[] = "Version 2.0.8.1"; | 72 | static char s2io_driver_version[] = DRV_VERSION; |
71 | 73 | ||
72 | static inline int RXD_IS_UP2DT(RxD_t *rxdp) | 74 | static inline int RXD_IS_UP2DT(RxD_t *rxdp) |
73 | { | 75 | { |
@@ -307,6 +309,8 @@ static unsigned int indicate_max_pkts; | |||
307 | #endif | 309 | #endif |
308 | /* Frequency of Rx desc syncs expressed as power of 2 */ | 310 | /* Frequency of Rx desc syncs expressed as power of 2 */ |
309 | static unsigned int rxsync_frequency = 3; | 311 | static unsigned int rxsync_frequency = 3; |
312 | /* Interrupt type. Values can be 0(INTA), 1(MSI), 2(MSI_X) */ | ||
313 | static unsigned int intr_type = 0; | ||
310 | 314 | ||
311 | /* | 315 | /* |
312 | * S2IO device table. | 316 | * S2IO device table. |
@@ -1396,8 +1400,13 @@ static int init_nic(struct s2io_nic *nic) | |||
1396 | writeq(val64, &bar0->rti_data1_mem); | 1400 | writeq(val64, &bar0->rti_data1_mem); |
1397 | 1401 | ||
1398 | val64 = RTI_DATA2_MEM_RX_UFC_A(0x1) | | 1402 | val64 = RTI_DATA2_MEM_RX_UFC_A(0x1) | |
1399 | RTI_DATA2_MEM_RX_UFC_B(0x2) | | 1403 | RTI_DATA2_MEM_RX_UFC_B(0x2) ; |
1400 | RTI_DATA2_MEM_RX_UFC_C(0x40) | RTI_DATA2_MEM_RX_UFC_D(0x80); | 1404 | if (nic->intr_type == MSI_X) |
1405 | val64 |= (RTI_DATA2_MEM_RX_UFC_C(0x20) | \ | ||
1406 | RTI_DATA2_MEM_RX_UFC_D(0x40)); | ||
1407 | else | ||
1408 | val64 |= (RTI_DATA2_MEM_RX_UFC_C(0x40) | \ | ||
1409 | RTI_DATA2_MEM_RX_UFC_D(0x80)); | ||
1401 | writeq(val64, &bar0->rti_data2_mem); | 1410 | writeq(val64, &bar0->rti_data2_mem); |
1402 | 1411 | ||
1403 | for (i = 0; i < config->rx_ring_num; i++) { | 1412 | for (i = 0; i < config->rx_ring_num; i++) { |
@@ -1507,17 +1516,15 @@ static int init_nic(struct s2io_nic *nic) | |||
1507 | #define LINK_UP_DOWN_INTERRUPT 1 | 1516 | #define LINK_UP_DOWN_INTERRUPT 1 |
1508 | #define MAC_RMAC_ERR_TIMER 2 | 1517 | #define MAC_RMAC_ERR_TIMER 2 |
1509 | 1518 | ||
1510 | #if defined(CONFIG_MSI_MODE) || defined(CONFIG_MSIX_MODE) | ||
1511 | #define s2io_link_fault_indication(x) MAC_RMAC_ERR_TIMER | ||
1512 | #else | ||
1513 | int s2io_link_fault_indication(nic_t *nic) | 1519 | int s2io_link_fault_indication(nic_t *nic) |
1514 | { | 1520 | { |
1521 | if (nic->intr_type != INTA) | ||
1522 | return MAC_RMAC_ERR_TIMER; | ||
1515 | if (nic->device_type == XFRAME_II_DEVICE) | 1523 | if (nic->device_type == XFRAME_II_DEVICE) |
1516 | return LINK_UP_DOWN_INTERRUPT; | 1524 | return LINK_UP_DOWN_INTERRUPT; |
1517 | else | 1525 | else |
1518 | return MAC_RMAC_ERR_TIMER; | 1526 | return MAC_RMAC_ERR_TIMER; |
1519 | } | 1527 | } |
1520 | #endif | ||
1521 | 1528 | ||
1522 | /** | 1529 | /** |
1523 | * en_dis_able_nic_intrs - Enable or Disable the interrupts | 1530 | * en_dis_able_nic_intrs - Enable or Disable the interrupts |
@@ -1941,11 +1948,14 @@ static int start_nic(struct s2io_nic *nic) | |||
1941 | } | 1948 | } |
1942 | 1949 | ||
1943 | /* Enable select interrupts */ | 1950 | /* Enable select interrupts */ |
1944 | interruptible = TX_TRAFFIC_INTR | RX_TRAFFIC_INTR; | 1951 | if (nic->intr_type != INTA) |
1945 | interruptible |= TX_PIC_INTR | RX_PIC_INTR; | 1952 | en_dis_able_nic_intrs(nic, ENA_ALL_INTRS, DISABLE_INTRS); |
1946 | interruptible |= TX_MAC_INTR | RX_MAC_INTR; | 1953 | else { |
1947 | 1954 | interruptible = TX_TRAFFIC_INTR | RX_TRAFFIC_INTR; | |
1948 | en_dis_able_nic_intrs(nic, interruptible, ENABLE_INTRS); | 1955 | interruptible |= TX_PIC_INTR | RX_PIC_INTR; |
1956 | interruptible |= TX_MAC_INTR | RX_MAC_INTR; | ||
1957 | en_dis_able_nic_intrs(nic, interruptible, ENABLE_INTRS); | ||
1958 | } | ||
1949 | 1959 | ||
1950 | /* | 1960 | /* |
1951 | * With some switches, link might be already up at this point. | 1961 | * With some switches, link might be already up at this point. |
@@ -2633,11 +2643,11 @@ static void tx_intr_handler(fifo_info_t *fifo_data) | |||
2633 | err = txdlp->Control_1 & TXD_T_CODE; | 2643 | err = txdlp->Control_1 & TXD_T_CODE; |
2634 | if ((err >> 48) == 0xA) { | 2644 | if ((err >> 48) == 0xA) { |
2635 | DBG_PRINT(TX_DBG, "TxD returned due \ | 2645 | DBG_PRINT(TX_DBG, "TxD returned due \ |
2636 | to loss of link\n"); | 2646 | to loss of link\n"); |
2637 | } | 2647 | } |
2638 | else { | 2648 | else { |
2639 | DBG_PRINT(ERR_DBG, "***TxD error \ | 2649 | DBG_PRINT(ERR_DBG, "***TxD error \ |
2640 | %llx\n", err); | 2650 | %llx\n", err); |
2641 | } | 2651 | } |
2642 | } | 2652 | } |
2643 | 2653 | ||
@@ -2854,6 +2864,9 @@ void s2io_reset(nic_t * sp) | |||
2854 | /* Set swapper to enable I/O register access */ | 2864 | /* Set swapper to enable I/O register access */ |
2855 | s2io_set_swapper(sp); | 2865 | s2io_set_swapper(sp); |
2856 | 2866 | ||
2867 | /* Restore the MSIX table entries from local variables */ | ||
2868 | restore_xmsi_data(sp); | ||
2869 | |||
2857 | /* Clear certain PCI/PCI-X fields after reset */ | 2870 | /* Clear certain PCI/PCI-X fields after reset */ |
2858 | if (sp->device_type == XFRAME_II_DEVICE) { | 2871 | if (sp->device_type == XFRAME_II_DEVICE) { |
2859 | /* Clear parity err detect bit */ | 2872 | /* Clear parity err detect bit */ |
@@ -2983,8 +2996,9 @@ int s2io_set_swapper(nic_t * sp) | |||
2983 | SWAPPER_CTRL_RXD_W_FE | | 2996 | SWAPPER_CTRL_RXD_W_FE | |
2984 | SWAPPER_CTRL_RXF_W_FE | | 2997 | SWAPPER_CTRL_RXF_W_FE | |
2985 | SWAPPER_CTRL_XMSI_FE | | 2998 | SWAPPER_CTRL_XMSI_FE | |
2986 | SWAPPER_CTRL_XMSI_SE | | ||
2987 | SWAPPER_CTRL_STATS_FE | SWAPPER_CTRL_STATS_SE); | 2999 | SWAPPER_CTRL_STATS_FE | SWAPPER_CTRL_STATS_SE); |
3000 | if (sp->intr_type == INTA) | ||
3001 | val64 |= SWAPPER_CTRL_XMSI_SE; | ||
2988 | writeq(val64, &bar0->swapper_ctrl); | 3002 | writeq(val64, &bar0->swapper_ctrl); |
2989 | #else | 3003 | #else |
2990 | /* | 3004 | /* |
@@ -3005,8 +3019,9 @@ int s2io_set_swapper(nic_t * sp) | |||
3005 | SWAPPER_CTRL_RXD_W_SE | | 3019 | SWAPPER_CTRL_RXD_W_SE | |
3006 | SWAPPER_CTRL_RXF_W_FE | | 3020 | SWAPPER_CTRL_RXF_W_FE | |
3007 | SWAPPER_CTRL_XMSI_FE | | 3021 | SWAPPER_CTRL_XMSI_FE | |
3008 | SWAPPER_CTRL_XMSI_SE | | ||
3009 | SWAPPER_CTRL_STATS_FE | SWAPPER_CTRL_STATS_SE); | 3022 | SWAPPER_CTRL_STATS_FE | SWAPPER_CTRL_STATS_SE); |
3023 | if (sp->intr_type == INTA) | ||
3024 | val64 |= SWAPPER_CTRL_XMSI_SE; | ||
3010 | writeq(val64, &bar0->swapper_ctrl); | 3025 | writeq(val64, &bar0->swapper_ctrl); |
3011 | #endif | 3026 | #endif |
3012 | val64 = readq(&bar0->swapper_ctrl); | 3027 | val64 = readq(&bar0->swapper_ctrl); |
@@ -3028,6 +3043,201 @@ int s2io_set_swapper(nic_t * sp) | |||
3028 | return SUCCESS; | 3043 | return SUCCESS; |
3029 | } | 3044 | } |
3030 | 3045 | ||
3046 | int wait_for_msix_trans(nic_t *nic, int i) | ||
3047 | { | ||
3048 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; | ||
3049 | u64 val64; | ||
3050 | int ret = 0, cnt = 0; | ||
3051 | |||
3052 | do { | ||
3053 | val64 = readq(&bar0->xmsi_access); | ||
3054 | if (!(val64 & BIT(15))) | ||
3055 | break; | ||
3056 | mdelay(1); | ||
3057 | cnt++; | ||
3058 | } while(cnt < 5); | ||
3059 | if (cnt == 5) { | ||
3060 | DBG_PRINT(ERR_DBG, "XMSI # %d Access failed\n", i); | ||
3061 | ret = 1; | ||
3062 | } | ||
3063 | |||
3064 | return ret; | ||
3065 | } | ||
3066 | |||
3067 | void restore_xmsi_data(nic_t *nic) | ||
3068 | { | ||
3069 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; | ||
3070 | u64 val64; | ||
3071 | int i; | ||
3072 | |||
3073 | for (i=0; i< MAX_REQUESTED_MSI_X; i++) { | ||
3074 | writeq(nic->msix_info[i].addr, &bar0->xmsi_address); | ||
3075 | writeq(nic->msix_info[i].data, &bar0->xmsi_data); | ||
3076 | val64 = (BIT(7) | BIT(15) | vBIT(i, 26, 6)); | ||
3077 | writeq(val64, &bar0->xmsi_access); | ||
3078 | if (wait_for_msix_trans(nic, i)) { | ||
3079 | DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__); | ||
3080 | continue; | ||
3081 | } | ||
3082 | } | ||
3083 | } | ||
3084 | |||
3085 | void store_xmsi_data(nic_t *nic) | ||
3086 | { | ||
3087 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; | ||
3088 | u64 val64, addr, data; | ||
3089 | int i; | ||
3090 | |||
3091 | /* Store and display */ | ||
3092 | for (i=0; i< MAX_REQUESTED_MSI_X; i++) { | ||
3093 | val64 = (BIT(15) | vBIT(i, 26, 6)); | ||
3094 | writeq(val64, &bar0->xmsi_access); | ||
3095 | if (wait_for_msix_trans(nic, i)) { | ||
3096 | DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__); | ||
3097 | continue; | ||
3098 | } | ||
3099 | addr = readq(&bar0->xmsi_address); | ||
3100 | data = readq(&bar0->xmsi_data); | ||
3101 | if (addr && data) { | ||
3102 | nic->msix_info[i].addr = addr; | ||
3103 | nic->msix_info[i].data = data; | ||
3104 | } | ||
3105 | } | ||
3106 | } | ||
3107 | |||
3108 | int s2io_enable_msi(nic_t *nic) | ||
3109 | { | ||
3110 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; | ||
3111 | u16 msi_ctrl, msg_val; | ||
3112 | struct config_param *config = &nic->config; | ||
3113 | struct net_device *dev = nic->dev; | ||
3114 | u64 val64, tx_mat, rx_mat; | ||
3115 | int i, err; | ||
3116 | |||
3117 | val64 = readq(&bar0->pic_control); | ||
3118 | val64 &= ~BIT(1); | ||
3119 | writeq(val64, &bar0->pic_control); | ||
3120 | |||
3121 | err = pci_enable_msi(nic->pdev); | ||
3122 | if (err) { | ||
3123 | DBG_PRINT(ERR_DBG, "%s: enabling MSI failed\n", | ||
3124 | nic->dev->name); | ||
3125 | return err; | ||
3126 | } | ||
3127 | |||
3128 | /* | ||
3129 | * Enable MSI and use MSI-1 in stead of the standard MSI-0 | ||
3130 | * for interrupt handling. | ||
3131 | */ | ||
3132 | pci_read_config_word(nic->pdev, 0x4c, &msg_val); | ||
3133 | msg_val ^= 0x1; | ||
3134 | pci_write_config_word(nic->pdev, 0x4c, msg_val); | ||
3135 | pci_read_config_word(nic->pdev, 0x4c, &msg_val); | ||
3136 | |||
3137 | pci_read_config_word(nic->pdev, 0x42, &msi_ctrl); | ||
3138 | msi_ctrl |= 0x10; | ||
3139 | pci_write_config_word(nic->pdev, 0x42, msi_ctrl); | ||
3140 | |||
3141 | /* program MSI-1 into all usable Tx_Mat and Rx_Mat fields */ | ||
3142 | tx_mat = readq(&bar0->tx_mat0_n[0]); | ||
3143 | for (i=0; i<config->tx_fifo_num; i++) { | ||
3144 | tx_mat |= TX_MAT_SET(i, 1); | ||
3145 | } | ||
3146 | writeq(tx_mat, &bar0->tx_mat0_n[0]); | ||
3147 | |||
3148 | rx_mat = readq(&bar0->rx_mat); | ||
3149 | for (i=0; i<config->rx_ring_num; i++) { | ||
3150 | rx_mat |= RX_MAT_SET(i, 1); | ||
3151 | } | ||
3152 | writeq(rx_mat, &bar0->rx_mat); | ||
3153 | |||
3154 | dev->irq = nic->pdev->irq; | ||
3155 | return 0; | ||
3156 | } | ||
3157 | |||
3158 | int s2io_enable_msi_x(nic_t *nic) | ||
3159 | { | ||
3160 | XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; | ||
3161 | u64 tx_mat, rx_mat; | ||
3162 | u16 msi_control; /* Temp variable */ | ||
3163 | int ret, i, j, msix_indx = 1; | ||
3164 | |||
3165 | nic->entries = kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct msix_entry), | ||
3166 | GFP_KERNEL); | ||
3167 | if (nic->entries == NULL) { | ||
3168 | DBG_PRINT(ERR_DBG, "%s: Memory allocation failed\n", __FUNCTION__); | ||
3169 | return -ENOMEM; | ||
3170 | } | ||
3171 | memset(nic->entries, 0, MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); | ||
3172 | |||
3173 | nic->s2io_entries = | ||
3174 | kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry), | ||
3175 | GFP_KERNEL); | ||
3176 | if (nic->s2io_entries == NULL) { | ||
3177 | DBG_PRINT(ERR_DBG, "%s: Memory allocation failed\n", __FUNCTION__); | ||
3178 | kfree(nic->entries); | ||
3179 | return -ENOMEM; | ||
3180 | } | ||
3181 | memset(nic->s2io_entries, 0, | ||
3182 | MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry)); | ||
3183 | |||
3184 | for (i=0; i< MAX_REQUESTED_MSI_X; i++) { | ||
3185 | nic->entries[i].entry = i; | ||
3186 | nic->s2io_entries[i].entry = i; | ||
3187 | nic->s2io_entries[i].arg = NULL; | ||
3188 | nic->s2io_entries[i].in_use = 0; | ||
3189 | } | ||
3190 | |||
3191 | tx_mat = readq(&bar0->tx_mat0_n[0]); | ||
3192 | for (i=0; i<nic->config.tx_fifo_num; i++, msix_indx++) { | ||
3193 | tx_mat |= TX_MAT_SET(i, msix_indx); | ||
3194 | nic->s2io_entries[msix_indx].arg = &nic->mac_control.fifos[i]; | ||
3195 | nic->s2io_entries[msix_indx].type = MSIX_FIFO_TYPE; | ||
3196 | nic->s2io_entries[msix_indx].in_use = MSIX_FLG; | ||
3197 | } | ||
3198 | writeq(tx_mat, &bar0->tx_mat0_n[0]); | ||
3199 | |||
3200 | if (!nic->config.bimodal) { | ||
3201 | rx_mat = readq(&bar0->rx_mat); | ||
3202 | for (j=0; j<nic->config.rx_ring_num; j++, msix_indx++) { | ||
3203 | rx_mat |= RX_MAT_SET(j, msix_indx); | ||
3204 | nic->s2io_entries[msix_indx].arg = &nic->mac_control.rings[j]; | ||
3205 | nic->s2io_entries[msix_indx].type = MSIX_RING_TYPE; | ||
3206 | nic->s2io_entries[msix_indx].in_use = MSIX_FLG; | ||
3207 | } | ||
3208 | writeq(rx_mat, &bar0->rx_mat); | ||
3209 | } else { | ||
3210 | tx_mat = readq(&bar0->tx_mat0_n[7]); | ||
3211 | for (j=0; j<nic->config.rx_ring_num; j++, msix_indx++) { | ||
3212 | tx_mat |= TX_MAT_SET(i, msix_indx); | ||
3213 | nic->s2io_entries[msix_indx].arg = &nic->mac_control.rings[j]; | ||
3214 | nic->s2io_entries[msix_indx].type = MSIX_RING_TYPE; | ||
3215 | nic->s2io_entries[msix_indx].in_use = MSIX_FLG; | ||
3216 | } | ||
3217 | writeq(tx_mat, &bar0->tx_mat0_n[7]); | ||
3218 | } | ||
3219 | |||
3220 | ret = pci_enable_msix(nic->pdev, nic->entries, MAX_REQUESTED_MSI_X); | ||
3221 | if (ret) { | ||
3222 | DBG_PRINT(ERR_DBG, "%s: Enabling MSIX failed\n", nic->dev->name); | ||
3223 | kfree(nic->entries); | ||
3224 | kfree(nic->s2io_entries); | ||
3225 | nic->entries = NULL; | ||
3226 | nic->s2io_entries = NULL; | ||
3227 | return -ENOMEM; | ||
3228 | } | ||
3229 | |||
3230 | /* | ||
3231 | * To enable MSI-X, MSI also needs to be enabled, due to a bug | ||
3232 | * in the herc NIC. (Temp change, needs to be removed later) | ||
3233 | */ | ||
3234 | pci_read_config_word(nic->pdev, 0x42, &msi_control); | ||
3235 | msi_control |= 0x1; /* Enable MSI */ | ||
3236 | pci_write_config_word(nic->pdev, 0x42, msi_control); | ||
3237 | |||
3238 | return 0; | ||
3239 | } | ||
3240 | |||
3031 | /* ********************************************************* * | 3241 | /* ********************************************************* * |
3032 | * Functions defined below concern the OS part of the driver * | 3242 | * Functions defined below concern the OS part of the driver * |
3033 | * ********************************************************* */ | 3243 | * ********************************************************* */ |
@@ -3048,6 +3258,8 @@ int s2io_open(struct net_device *dev) | |||
3048 | { | 3258 | { |
3049 | nic_t *sp = dev->priv; | 3259 | nic_t *sp = dev->priv; |
3050 | int err = 0; | 3260 | int err = 0; |
3261 | int i; | ||
3262 | u16 msi_control; /* Temp variable */ | ||
3051 | 3263 | ||
3052 | /* | 3264 | /* |
3053 | * Make sure you have link off by default every time | 3265 | * Make sure you have link off by default every time |
@@ -3064,13 +3276,55 @@ int s2io_open(struct net_device *dev) | |||
3064 | goto hw_init_failed; | 3276 | goto hw_init_failed; |
3065 | } | 3277 | } |
3066 | 3278 | ||
3279 | /* Store the values of the MSIX table in the nic_t structure */ | ||
3280 | store_xmsi_data(sp); | ||
3281 | |||
3067 | /* After proper initialization of H/W, register ISR */ | 3282 | /* After proper initialization of H/W, register ISR */ |
3068 | err = request_irq((int) sp->pdev->irq, s2io_isr, SA_SHIRQ, | 3283 | if (sp->intr_type == MSI) { |
3069 | sp->name, dev); | 3284 | err = request_irq((int) sp->pdev->irq, s2io_msi_handle, |
3070 | if (err) { | 3285 | SA_SHIRQ, sp->name, dev); |
3071 | DBG_PRINT(ERR_DBG, "%s: ISR registration failed\n", | 3286 | if (err) { |
3072 | dev->name); | 3287 | DBG_PRINT(ERR_DBG, "%s: MSI registration \ |
3073 | goto isr_registration_failed; | 3288 | failed\n", dev->name); |
3289 | goto isr_registration_failed; | ||
3290 | } | ||
3291 | } | ||
3292 | if (sp->intr_type == MSI_X) { | ||
3293 | for (i=1; (sp->s2io_entries[i].in_use == MSIX_FLG); i++) { | ||
3294 | if (sp->s2io_entries[i].type == MSIX_FIFO_TYPE) { | ||
3295 | sprintf(sp->desc1, "%s:MSI-X-%d-TX", | ||
3296 | dev->name, i); | ||
3297 | err = request_irq(sp->entries[i].vector, | ||
3298 | s2io_msix_fifo_handle, 0, sp->desc1, | ||
3299 | sp->s2io_entries[i].arg); | ||
3300 | DBG_PRINT(ERR_DBG, "%s @ 0x%llx\n", sp->desc1, | ||
3301 | sp->msix_info[i].addr); | ||
3302 | } else { | ||
3303 | sprintf(sp->desc2, "%s:MSI-X-%d-RX", | ||
3304 | dev->name, i); | ||
3305 | err = request_irq(sp->entries[i].vector, | ||
3306 | s2io_msix_ring_handle, 0, sp->desc2, | ||
3307 | sp->s2io_entries[i].arg); | ||
3308 | DBG_PRINT(ERR_DBG, "%s @ 0x%llx\n", sp->desc2, | ||
3309 | sp->msix_info[i].addr); | ||
3310 | } | ||
3311 | if (err) { | ||
3312 | DBG_PRINT(ERR_DBG, "%s: MSI-X-%d registration \ | ||
3313 | failed\n", dev->name, i); | ||
3314 | DBG_PRINT(ERR_DBG, "Returned: %d\n", err); | ||
3315 | goto isr_registration_failed; | ||
3316 | } | ||
3317 | sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS; | ||
3318 | } | ||
3319 | } | ||
3320 | if (sp->intr_type == INTA) { | ||
3321 | err = request_irq((int) sp->pdev->irq, s2io_isr, SA_SHIRQ, | ||
3322 | sp->name, dev); | ||
3323 | if (err) { | ||
3324 | DBG_PRINT(ERR_DBG, "%s: ISR registration failed\n", | ||
3325 | dev->name); | ||
3326 | goto isr_registration_failed; | ||
3327 | } | ||
3074 | } | 3328 | } |
3075 | 3329 | ||
3076 | if (s2io_set_mac_addr(dev, dev->dev_addr) == FAILURE) { | 3330 | if (s2io_set_mac_addr(dev, dev->dev_addr) == FAILURE) { |
@@ -3083,11 +3337,37 @@ int s2io_open(struct net_device *dev) | |||
3083 | return 0; | 3337 | return 0; |
3084 | 3338 | ||
3085 | setting_mac_address_failed: | 3339 | setting_mac_address_failed: |
3086 | free_irq(sp->pdev->irq, dev); | 3340 | if (sp->intr_type != MSI_X) |
3341 | free_irq(sp->pdev->irq, dev); | ||
3087 | isr_registration_failed: | 3342 | isr_registration_failed: |
3088 | del_timer_sync(&sp->alarm_timer); | 3343 | del_timer_sync(&sp->alarm_timer); |
3344 | if (sp->intr_type == MSI_X) { | ||
3345 | if (sp->device_type == XFRAME_II_DEVICE) { | ||
3346 | for (i=1; (sp->s2io_entries[i].in_use == | ||
3347 | MSIX_REGISTERED_SUCCESS); i++) { | ||
3348 | int vector = sp->entries[i].vector; | ||
3349 | void *arg = sp->s2io_entries[i].arg; | ||
3350 | |||
3351 | free_irq(vector, arg); | ||
3352 | } | ||
3353 | pci_disable_msix(sp->pdev); | ||
3354 | |||
3355 | /* Temp */ | ||
3356 | pci_read_config_word(sp->pdev, 0x42, &msi_control); | ||
3357 | msi_control &= 0xFFFE; /* Disable MSI */ | ||
3358 | pci_write_config_word(sp->pdev, 0x42, msi_control); | ||
3359 | } | ||
3360 | } | ||
3361 | else if (sp->intr_type == MSI) | ||
3362 | pci_disable_msi(sp->pdev); | ||
3089 | s2io_reset(sp); | 3363 | s2io_reset(sp); |
3090 | hw_init_failed: | 3364 | hw_init_failed: |
3365 | if (sp->intr_type == MSI_X) { | ||
3366 | if (sp->entries) | ||
3367 | kfree(sp->entries); | ||
3368 | if (sp->s2io_entries) | ||
3369 | kfree(sp->s2io_entries); | ||
3370 | } | ||
3091 | return err; | 3371 | return err; |
3092 | } | 3372 | } |
3093 | 3373 | ||
@@ -3107,12 +3387,35 @@ hw_init_failed: | |||
3107 | int s2io_close(struct net_device *dev) | 3387 | int s2io_close(struct net_device *dev) |
3108 | { | 3388 | { |
3109 | nic_t *sp = dev->priv; | 3389 | nic_t *sp = dev->priv; |
3390 | int i; | ||
3391 | u16 msi_control; | ||
3392 | |||
3110 | flush_scheduled_work(); | 3393 | flush_scheduled_work(); |
3111 | netif_stop_queue(dev); | 3394 | netif_stop_queue(dev); |
3112 | /* Reset card, kill tasklet and free Tx and Rx buffers. */ | 3395 | /* Reset card, kill tasklet and free Tx and Rx buffers. */ |
3113 | s2io_card_down(sp); | 3396 | s2io_card_down(sp); |
3114 | 3397 | ||
3115 | free_irq(sp->pdev->irq, dev); | 3398 | if (sp->intr_type == MSI_X) { |
3399 | if (sp->device_type == XFRAME_II_DEVICE) { | ||
3400 | for (i=1; (sp->s2io_entries[i].in_use == | ||
3401 | MSIX_REGISTERED_SUCCESS); i++) { | ||
3402 | int vector = sp->entries[i].vector; | ||
3403 | void *arg = sp->s2io_entries[i].arg; | ||
3404 | |||
3405 | free_irq(vector, arg); | ||
3406 | } | ||
3407 | pci_read_config_word(sp->pdev, 0x42, &msi_control); | ||
3408 | msi_control &= 0xFFFE; /* Disable MSI */ | ||
3409 | pci_write_config_word(sp->pdev, 0x42, msi_control); | ||
3410 | |||
3411 | pci_disable_msix(sp->pdev); | ||
3412 | } | ||
3413 | } | ||
3414 | else { | ||
3415 | free_irq(sp->pdev->irq, dev); | ||
3416 | if (sp->intr_type == MSI) | ||
3417 | pci_disable_msi(sp->pdev); | ||
3418 | } | ||
3116 | sp->device_close_flag = TRUE; /* Device is shut down. */ | 3419 | sp->device_close_flag = TRUE; /* Device is shut down. */ |
3117 | return 0; | 3420 | return 0; |
3118 | } | 3421 | } |
@@ -3278,6 +3581,104 @@ s2io_alarm_handle(unsigned long data) | |||
3278 | mod_timer(&sp->alarm_timer, jiffies + HZ / 2); | 3581 | mod_timer(&sp->alarm_timer, jiffies + HZ / 2); |
3279 | } | 3582 | } |
3280 | 3583 | ||
3584 | static irqreturn_t | ||
3585 | s2io_msi_handle(int irq, void *dev_id, struct pt_regs *regs) | ||
3586 | { | ||
3587 | struct net_device *dev = (struct net_device *) dev_id; | ||
3588 | nic_t *sp = dev->priv; | ||
3589 | int i; | ||
3590 | int ret; | ||
3591 | mac_info_t *mac_control; | ||
3592 | struct config_param *config; | ||
3593 | |||
3594 | atomic_inc(&sp->isr_cnt); | ||
3595 | mac_control = &sp->mac_control; | ||
3596 | config = &sp->config; | ||
3597 | DBG_PRINT(INTR_DBG, "%s: MSI handler\n", __FUNCTION__); | ||
3598 | |||
3599 | /* If Intr is because of Rx Traffic */ | ||
3600 | for (i = 0; i < config->rx_ring_num; i++) | ||
3601 | rx_intr_handler(&mac_control->rings[i]); | ||
3602 | |||
3603 | /* If Intr is because of Tx Traffic */ | ||
3604 | for (i = 0; i < config->tx_fifo_num; i++) | ||
3605 | tx_intr_handler(&mac_control->fifos[i]); | ||
3606 | |||
3607 | /* | ||
3608 | * If the Rx buffer count is below the panic threshold then | ||
3609 | * reallocate the buffers from the interrupt handler itself, | ||
3610 | * else schedule a tasklet to reallocate the buffers. | ||
3611 | */ | ||
3612 | for (i = 0; i < config->rx_ring_num; i++) { | ||
3613 | int rxb_size = atomic_read(&sp->rx_bufs_left[i]); | ||
3614 | int level = rx_buffer_level(sp, rxb_size, i); | ||
3615 | |||
3616 | if ((level == PANIC) && (!TASKLET_IN_USE)) { | ||
3617 | DBG_PRINT(INTR_DBG, "%s: Rx BD hit ", dev->name); | ||
3618 | DBG_PRINT(INTR_DBG, "PANIC levels\n"); | ||
3619 | if ((ret = fill_rx_buffers(sp, i)) == -ENOMEM) { | ||
3620 | DBG_PRINT(ERR_DBG, "%s:Out of memory", | ||
3621 | dev->name); | ||
3622 | DBG_PRINT(ERR_DBG, " in ISR!!\n"); | ||
3623 | clear_bit(0, (&sp->tasklet_status)); | ||
3624 | atomic_dec(&sp->isr_cnt); | ||
3625 | return IRQ_HANDLED; | ||
3626 | } | ||
3627 | clear_bit(0, (&sp->tasklet_status)); | ||
3628 | } else if (level == LOW) { | ||
3629 | tasklet_schedule(&sp->task); | ||
3630 | } | ||
3631 | } | ||
3632 | |||
3633 | atomic_dec(&sp->isr_cnt); | ||
3634 | return IRQ_HANDLED; | ||
3635 | } | ||
3636 | |||
3637 | static irqreturn_t | ||
3638 | s2io_msix_ring_handle(int irq, void *dev_id, struct pt_regs *regs) | ||
3639 | { | ||
3640 | ring_info_t *ring = (ring_info_t *)dev_id; | ||
3641 | nic_t *sp = ring->nic; | ||
3642 | int rxb_size, level, rng_n; | ||
3643 | |||
3644 | atomic_inc(&sp->isr_cnt); | ||
3645 | rx_intr_handler(ring); | ||
3646 | |||
3647 | rng_n = ring->ring_no; | ||
3648 | rxb_size = atomic_read(&sp->rx_bufs_left[rng_n]); | ||
3649 | level = rx_buffer_level(sp, rxb_size, rng_n); | ||
3650 | |||
3651 | if ((level == PANIC) && (!TASKLET_IN_USE)) { | ||
3652 | int ret; | ||
3653 | DBG_PRINT(INTR_DBG, "%s: Rx BD hit ", __FUNCTION__); | ||
3654 | DBG_PRINT(INTR_DBG, "PANIC levels\n"); | ||
3655 | if ((ret = fill_rx_buffers(sp, rng_n)) == -ENOMEM) { | ||
3656 | DBG_PRINT(ERR_DBG, "Out of memory in %s", | ||
3657 | __FUNCTION__); | ||
3658 | clear_bit(0, (&sp->tasklet_status)); | ||
3659 | return IRQ_HANDLED; | ||
3660 | } | ||
3661 | clear_bit(0, (&sp->tasklet_status)); | ||
3662 | } else if (level == LOW) { | ||
3663 | tasklet_schedule(&sp->task); | ||
3664 | } | ||
3665 | atomic_dec(&sp->isr_cnt); | ||
3666 | |||
3667 | return IRQ_HANDLED; | ||
3668 | } | ||
3669 | |||
3670 | static irqreturn_t | ||
3671 | s2io_msix_fifo_handle(int irq, void *dev_id, struct pt_regs *regs) | ||
3672 | { | ||
3673 | fifo_info_t *fifo = (fifo_info_t *)dev_id; | ||
3674 | nic_t *sp = fifo->nic; | ||
3675 | |||
3676 | atomic_inc(&sp->isr_cnt); | ||
3677 | tx_intr_handler(fifo); | ||
3678 | atomic_dec(&sp->isr_cnt); | ||
3679 | return IRQ_HANDLED; | ||
3680 | } | ||
3681 | |||
3281 | static void s2io_txpic_intr_handle(nic_t *sp) | 3682 | static void s2io_txpic_intr_handle(nic_t *sp) |
3282 | { | 3683 | { |
3283 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 3684 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
@@ -3778,11 +4179,10 @@ static void s2io_ethtool_gdrvinfo(struct net_device *dev, | |||
3778 | { | 4179 | { |
3779 | nic_t *sp = dev->priv; | 4180 | nic_t *sp = dev->priv; |
3780 | 4181 | ||
3781 | strncpy(info->driver, s2io_driver_name, sizeof(s2io_driver_name)); | 4182 | strncpy(info->driver, s2io_driver_name, sizeof(info->driver)); |
3782 | strncpy(info->version, s2io_driver_version, | 4183 | strncpy(info->version, s2io_driver_version, sizeof(info->version)); |
3783 | sizeof(s2io_driver_version)); | 4184 | strncpy(info->fw_version, "", sizeof(info->fw_version)); |
3784 | strncpy(info->fw_version, "", 32); | 4185 | strncpy(info->bus_info, pci_name(sp->pdev), sizeof(info->bus_info)); |
3785 | strncpy(info->bus_info, pci_name(sp->pdev), 32); | ||
3786 | info->regdump_len = XENA_REG_SPACE; | 4186 | info->regdump_len = XENA_REG_SPACE; |
3787 | info->eedump_len = XENA_EEPROM_SPACE; | 4187 | info->eedump_len = XENA_EEPROM_SPACE; |
3788 | info->testinfo_len = S2IO_TEST_LEN; | 4188 | info->testinfo_len = S2IO_TEST_LEN; |
@@ -3978,29 +4378,53 @@ static int s2io_ethtool_setpause_data(struct net_device *dev, | |||
3978 | */ | 4378 | */ |
3979 | 4379 | ||
3980 | #define S2IO_DEV_ID 5 | 4380 | #define S2IO_DEV_ID 5 |
3981 | static int read_eeprom(nic_t * sp, int off, u32 * data) | 4381 | static int read_eeprom(nic_t * sp, int off, u64 * data) |
3982 | { | 4382 | { |
3983 | int ret = -1; | 4383 | int ret = -1; |
3984 | u32 exit_cnt = 0; | 4384 | u32 exit_cnt = 0; |
3985 | u64 val64; | 4385 | u64 val64; |
3986 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 4386 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
3987 | 4387 | ||
3988 | val64 = I2C_CONTROL_DEV_ID(S2IO_DEV_ID) | I2C_CONTROL_ADDR(off) | | 4388 | if (sp->device_type == XFRAME_I_DEVICE) { |
3989 | I2C_CONTROL_BYTE_CNT(0x3) | I2C_CONTROL_READ | | 4389 | val64 = I2C_CONTROL_DEV_ID(S2IO_DEV_ID) | I2C_CONTROL_ADDR(off) | |
3990 | I2C_CONTROL_CNTL_START; | 4390 | I2C_CONTROL_BYTE_CNT(0x3) | I2C_CONTROL_READ | |
3991 | SPECIAL_REG_WRITE(val64, &bar0->i2c_control, LF); | 4391 | I2C_CONTROL_CNTL_START; |
4392 | SPECIAL_REG_WRITE(val64, &bar0->i2c_control, LF); | ||
3992 | 4393 | ||
3993 | while (exit_cnt < 5) { | 4394 | while (exit_cnt < 5) { |
3994 | val64 = readq(&bar0->i2c_control); | 4395 | val64 = readq(&bar0->i2c_control); |
3995 | if (I2C_CONTROL_CNTL_END(val64)) { | 4396 | if (I2C_CONTROL_CNTL_END(val64)) { |
3996 | *data = I2C_CONTROL_GET_DATA(val64); | 4397 | *data = I2C_CONTROL_GET_DATA(val64); |
3997 | ret = 0; | 4398 | ret = 0; |
3998 | break; | 4399 | break; |
4400 | } | ||
4401 | msleep(50); | ||
4402 | exit_cnt++; | ||
3999 | } | 4403 | } |
4000 | msleep(50); | ||
4001 | exit_cnt++; | ||
4002 | } | 4404 | } |
4003 | 4405 | ||
4406 | if (sp->device_type == XFRAME_II_DEVICE) { | ||
4407 | val64 = SPI_CONTROL_KEY(0x9) | SPI_CONTROL_SEL1 | | ||
4408 | SPI_CONTROL_BYTECNT(0x3) | | ||
4409 | SPI_CONTROL_CMD(0x3) | SPI_CONTROL_ADDR(off); | ||
4410 | SPECIAL_REG_WRITE(val64, &bar0->spi_control, LF); | ||
4411 | val64 |= SPI_CONTROL_REQ; | ||
4412 | SPECIAL_REG_WRITE(val64, &bar0->spi_control, LF); | ||
4413 | while (exit_cnt < 5) { | ||
4414 | val64 = readq(&bar0->spi_control); | ||
4415 | if (val64 & SPI_CONTROL_NACK) { | ||
4416 | ret = 1; | ||
4417 | break; | ||
4418 | } else if (val64 & SPI_CONTROL_DONE) { | ||
4419 | *data = readq(&bar0->spi_data); | ||
4420 | *data &= 0xffffff; | ||
4421 | ret = 0; | ||
4422 | break; | ||
4423 | } | ||
4424 | msleep(50); | ||
4425 | exit_cnt++; | ||
4426 | } | ||
4427 | } | ||
4004 | return ret; | 4428 | return ret; |
4005 | } | 4429 | } |
4006 | 4430 | ||
@@ -4019,28 +4443,53 @@ static int read_eeprom(nic_t * sp, int off, u32 * data) | |||
4019 | * 0 on success, -1 on failure. | 4443 | * 0 on success, -1 on failure. |
4020 | */ | 4444 | */ |
4021 | 4445 | ||
4022 | static int write_eeprom(nic_t * sp, int off, u32 data, int cnt) | 4446 | static int write_eeprom(nic_t * sp, int off, u64 data, int cnt) |
4023 | { | 4447 | { |
4024 | int exit_cnt = 0, ret = -1; | 4448 | int exit_cnt = 0, ret = -1; |
4025 | u64 val64; | 4449 | u64 val64; |
4026 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 4450 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
4027 | 4451 | ||
4028 | val64 = I2C_CONTROL_DEV_ID(S2IO_DEV_ID) | I2C_CONTROL_ADDR(off) | | 4452 | if (sp->device_type == XFRAME_I_DEVICE) { |
4029 | I2C_CONTROL_BYTE_CNT(cnt) | I2C_CONTROL_SET_DATA(data) | | 4453 | val64 = I2C_CONTROL_DEV_ID(S2IO_DEV_ID) | I2C_CONTROL_ADDR(off) | |
4030 | I2C_CONTROL_CNTL_START; | 4454 | I2C_CONTROL_BYTE_CNT(cnt) | I2C_CONTROL_SET_DATA((u32)data) | |
4031 | SPECIAL_REG_WRITE(val64, &bar0->i2c_control, LF); | 4455 | I2C_CONTROL_CNTL_START; |
4456 | SPECIAL_REG_WRITE(val64, &bar0->i2c_control, LF); | ||
4457 | |||
4458 | while (exit_cnt < 5) { | ||
4459 | val64 = readq(&bar0->i2c_control); | ||
4460 | if (I2C_CONTROL_CNTL_END(val64)) { | ||
4461 | if (!(val64 & I2C_CONTROL_NACK)) | ||
4462 | ret = 0; | ||
4463 | break; | ||
4464 | } | ||
4465 | msleep(50); | ||
4466 | exit_cnt++; | ||
4467 | } | ||
4468 | } | ||
4032 | 4469 | ||
4033 | while (exit_cnt < 5) { | 4470 | if (sp->device_type == XFRAME_II_DEVICE) { |
4034 | val64 = readq(&bar0->i2c_control); | 4471 | int write_cnt = (cnt == 8) ? 0 : cnt; |
4035 | if (I2C_CONTROL_CNTL_END(val64)) { | 4472 | writeq(SPI_DATA_WRITE(data,(cnt<<3)), &bar0->spi_data); |
4036 | if (!(val64 & I2C_CONTROL_NACK)) | 4473 | |
4474 | val64 = SPI_CONTROL_KEY(0x9) | SPI_CONTROL_SEL1 | | ||
4475 | SPI_CONTROL_BYTECNT(write_cnt) | | ||
4476 | SPI_CONTROL_CMD(0x2) | SPI_CONTROL_ADDR(off); | ||
4477 | SPECIAL_REG_WRITE(val64, &bar0->spi_control, LF); | ||
4478 | val64 |= SPI_CONTROL_REQ; | ||
4479 | SPECIAL_REG_WRITE(val64, &bar0->spi_control, LF); | ||
4480 | while (exit_cnt < 5) { | ||
4481 | val64 = readq(&bar0->spi_control); | ||
4482 | if (val64 & SPI_CONTROL_NACK) { | ||
4483 | ret = 1; | ||
4484 | break; | ||
4485 | } else if (val64 & SPI_CONTROL_DONE) { | ||
4037 | ret = 0; | 4486 | ret = 0; |
4038 | break; | 4487 | break; |
4488 | } | ||
4489 | msleep(50); | ||
4490 | exit_cnt++; | ||
4039 | } | 4491 | } |
4040 | msleep(50); | ||
4041 | exit_cnt++; | ||
4042 | } | 4492 | } |
4043 | |||
4044 | return ret; | 4493 | return ret; |
4045 | } | 4494 | } |
4046 | 4495 | ||
@@ -4060,7 +4509,8 @@ static int write_eeprom(nic_t * sp, int off, u32 data, int cnt) | |||
4060 | static int s2io_ethtool_geeprom(struct net_device *dev, | 4509 | static int s2io_ethtool_geeprom(struct net_device *dev, |
4061 | struct ethtool_eeprom *eeprom, u8 * data_buf) | 4510 | struct ethtool_eeprom *eeprom, u8 * data_buf) |
4062 | { | 4511 | { |
4063 | u32 data, i, valid; | 4512 | u32 i, valid; |
4513 | u64 data; | ||
4064 | nic_t *sp = dev->priv; | 4514 | nic_t *sp = dev->priv; |
4065 | 4515 | ||
4066 | eeprom->magic = sp->pdev->vendor | (sp->pdev->device << 16); | 4516 | eeprom->magic = sp->pdev->vendor | (sp->pdev->device << 16); |
@@ -4098,7 +4548,7 @@ static int s2io_ethtool_seeprom(struct net_device *dev, | |||
4098 | u8 * data_buf) | 4548 | u8 * data_buf) |
4099 | { | 4549 | { |
4100 | int len = eeprom->len, cnt = 0; | 4550 | int len = eeprom->len, cnt = 0; |
4101 | u32 valid = 0, data; | 4551 | u64 valid = 0, data; |
4102 | nic_t *sp = dev->priv; | 4552 | nic_t *sp = dev->priv; |
4103 | 4553 | ||
4104 | if (eeprom->magic != (sp->pdev->vendor | (sp->pdev->device << 16))) { | 4554 | if (eeprom->magic != (sp->pdev->vendor | (sp->pdev->device << 16))) { |
@@ -4146,7 +4596,7 @@ static int s2io_ethtool_seeprom(struct net_device *dev, | |||
4146 | static int s2io_register_test(nic_t * sp, uint64_t * data) | 4596 | static int s2io_register_test(nic_t * sp, uint64_t * data) |
4147 | { | 4597 | { |
4148 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 4598 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
4149 | u64 val64 = 0; | 4599 | u64 val64 = 0, exp_val; |
4150 | int fail = 0; | 4600 | int fail = 0; |
4151 | 4601 | ||
4152 | val64 = readq(&bar0->pif_rd_swapper_fb); | 4602 | val64 = readq(&bar0->pif_rd_swapper_fb); |
@@ -4162,7 +4612,11 @@ static int s2io_register_test(nic_t * sp, uint64_t * data) | |||
4162 | } | 4612 | } |
4163 | 4613 | ||
4164 | val64 = readq(&bar0->rx_queue_cfg); | 4614 | val64 = readq(&bar0->rx_queue_cfg); |
4165 | if (val64 != 0x0808080808080808ULL) { | 4615 | if (sp->device_type == XFRAME_II_DEVICE) |
4616 | exp_val = 0x0404040404040404ULL; | ||
4617 | else | ||
4618 | exp_val = 0x0808080808080808ULL; | ||
4619 | if (val64 != exp_val) { | ||
4166 | fail = 1; | 4620 | fail = 1; |
4167 | DBG_PRINT(INFO_DBG, "Read Test level 3 fails\n"); | 4621 | DBG_PRINT(INFO_DBG, "Read Test level 3 fails\n"); |
4168 | } | 4622 | } |
@@ -4190,7 +4644,7 @@ static int s2io_register_test(nic_t * sp, uint64_t * data) | |||
4190 | } | 4644 | } |
4191 | 4645 | ||
4192 | *data = fail; | 4646 | *data = fail; |
4193 | return 0; | 4647 | return fail; |
4194 | } | 4648 | } |
4195 | 4649 | ||
4196 | /** | 4650 | /** |
@@ -4209,58 +4663,83 @@ static int s2io_register_test(nic_t * sp, uint64_t * data) | |||
4209 | static int s2io_eeprom_test(nic_t * sp, uint64_t * data) | 4663 | static int s2io_eeprom_test(nic_t * sp, uint64_t * data) |
4210 | { | 4664 | { |
4211 | int fail = 0; | 4665 | int fail = 0; |
4212 | u32 ret_data; | 4666 | u64 ret_data, org_4F0, org_7F0; |
4667 | u8 saved_4F0 = 0, saved_7F0 = 0; | ||
4668 | struct net_device *dev = sp->dev; | ||
4213 | 4669 | ||
4214 | /* Test Write Error at offset 0 */ | 4670 | /* Test Write Error at offset 0 */ |
4215 | if (!write_eeprom(sp, 0, 0, 3)) | 4671 | /* Note that SPI interface allows write access to all areas |
4216 | fail = 1; | 4672 | * of EEPROM. Hence doing all negative testing only for Xframe I. |
4673 | */ | ||
4674 | if (sp->device_type == XFRAME_I_DEVICE) | ||
4675 | if (!write_eeprom(sp, 0, 0, 3)) | ||
4676 | fail = 1; | ||
4677 | |||
4678 | /* Save current values at offsets 0x4F0 and 0x7F0 */ | ||
4679 | if (!read_eeprom(sp, 0x4F0, &org_4F0)) | ||
4680 | saved_4F0 = 1; | ||
4681 | if (!read_eeprom(sp, 0x7F0, &org_7F0)) | ||
4682 | saved_7F0 = 1; | ||
4217 | 4683 | ||
4218 | /* Test Write at offset 4f0 */ | 4684 | /* Test Write at offset 4f0 */ |
4219 | if (write_eeprom(sp, 0x4F0, 0x01234567, 3)) | 4685 | if (write_eeprom(sp, 0x4F0, 0x012345, 3)) |
4220 | fail = 1; | 4686 | fail = 1; |
4221 | if (read_eeprom(sp, 0x4F0, &ret_data)) | 4687 | if (read_eeprom(sp, 0x4F0, &ret_data)) |
4222 | fail = 1; | 4688 | fail = 1; |
4223 | 4689 | ||
4224 | if (ret_data != 0x01234567) | 4690 | if (ret_data != 0x012345) { |
4691 | DBG_PRINT(ERR_DBG, "%s: eeprom test error at offset 0x4F0. Data written %llx Data read %llx\n", dev->name, (u64)0x12345, ret_data); | ||
4225 | fail = 1; | 4692 | fail = 1; |
4693 | } | ||
4226 | 4694 | ||
4227 | /* Reset the EEPROM data go FFFF */ | 4695 | /* Reset the EEPROM data go FFFF */ |
4228 | write_eeprom(sp, 0x4F0, 0xFFFFFFFF, 3); | 4696 | write_eeprom(sp, 0x4F0, 0xFFFFFF, 3); |
4229 | 4697 | ||
4230 | /* Test Write Request Error at offset 0x7c */ | 4698 | /* Test Write Request Error at offset 0x7c */ |
4231 | if (!write_eeprom(sp, 0x07C, 0, 3)) | 4699 | if (sp->device_type == XFRAME_I_DEVICE) |
4232 | fail = 1; | 4700 | if (!write_eeprom(sp, 0x07C, 0, 3)) |
4701 | fail = 1; | ||
4233 | 4702 | ||
4234 | /* Test Write Request at offset 0x7fc */ | 4703 | /* Test Write Request at offset 0x7f0 */ |
4235 | if (write_eeprom(sp, 0x7FC, 0x01234567, 3)) | 4704 | if (write_eeprom(sp, 0x7F0, 0x012345, 3)) |
4236 | fail = 1; | 4705 | fail = 1; |
4237 | if (read_eeprom(sp, 0x7FC, &ret_data)) | 4706 | if (read_eeprom(sp, 0x7F0, &ret_data)) |
4238 | fail = 1; | 4707 | fail = 1; |
4239 | 4708 | ||
4240 | if (ret_data != 0x01234567) | 4709 | if (ret_data != 0x012345) { |
4710 | DBG_PRINT(ERR_DBG, "%s: eeprom test error at offset 0x7F0. Data written %llx Data read %llx\n", dev->name, (u64)0x12345, ret_data); | ||
4241 | fail = 1; | 4711 | fail = 1; |
4712 | } | ||
4242 | 4713 | ||
4243 | /* Reset the EEPROM data go FFFF */ | 4714 | /* Reset the EEPROM data go FFFF */ |
4244 | write_eeprom(sp, 0x7FC, 0xFFFFFFFF, 3); | 4715 | write_eeprom(sp, 0x7F0, 0xFFFFFF, 3); |
4245 | 4716 | ||
4246 | /* Test Write Error at offset 0x80 */ | 4717 | if (sp->device_type == XFRAME_I_DEVICE) { |
4247 | if (!write_eeprom(sp, 0x080, 0, 3)) | 4718 | /* Test Write Error at offset 0x80 */ |
4248 | fail = 1; | 4719 | if (!write_eeprom(sp, 0x080, 0, 3)) |
4720 | fail = 1; | ||
4249 | 4721 | ||
4250 | /* Test Write Error at offset 0xfc */ | 4722 | /* Test Write Error at offset 0xfc */ |
4251 | if (!write_eeprom(sp, 0x0FC, 0, 3)) | 4723 | if (!write_eeprom(sp, 0x0FC, 0, 3)) |
4252 | fail = 1; | 4724 | fail = 1; |
4253 | 4725 | ||
4254 | /* Test Write Error at offset 0x100 */ | 4726 | /* Test Write Error at offset 0x100 */ |
4255 | if (!write_eeprom(sp, 0x100, 0, 3)) | 4727 | if (!write_eeprom(sp, 0x100, 0, 3)) |
4256 | fail = 1; | 4728 | fail = 1; |
4257 | 4729 | ||
4258 | /* Test Write Error at offset 4ec */ | 4730 | /* Test Write Error at offset 4ec */ |
4259 | if (!write_eeprom(sp, 0x4EC, 0, 3)) | 4731 | if (!write_eeprom(sp, 0x4EC, 0, 3)) |
4260 | fail = 1; | 4732 | fail = 1; |
4733 | } | ||
4734 | |||
4735 | /* Restore values at offsets 0x4F0 and 0x7F0 */ | ||
4736 | if (saved_4F0) | ||
4737 | write_eeprom(sp, 0x4F0, org_4F0, 3); | ||
4738 | if (saved_7F0) | ||
4739 | write_eeprom(sp, 0x7F0, org_7F0, 3); | ||
4261 | 4740 | ||
4262 | *data = fail; | 4741 | *data = fail; |
4263 | return 0; | 4742 | return fail; |
4264 | } | 4743 | } |
4265 | 4744 | ||
4266 | /** | 4745 | /** |
@@ -4342,7 +4821,7 @@ static int s2io_rldram_test(nic_t * sp, uint64_t * data) | |||
4342 | { | 4821 | { |
4343 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | 4822 | XENA_dev_config_t __iomem *bar0 = sp->bar0; |
4344 | u64 val64; | 4823 | u64 val64; |
4345 | int cnt, iteration = 0, test_pass = 0; | 4824 | int cnt, iteration = 0, test_fail = 0; |
4346 | 4825 | ||
4347 | val64 = readq(&bar0->adapter_control); | 4826 | val64 = readq(&bar0->adapter_control); |
4348 | val64 &= ~ADAPTER_ECC_EN; | 4827 | val64 &= ~ADAPTER_ECC_EN; |
@@ -4350,7 +4829,7 @@ static int s2io_rldram_test(nic_t * sp, uint64_t * data) | |||
4350 | 4829 | ||
4351 | val64 = readq(&bar0->mc_rldram_test_ctrl); | 4830 | val64 = readq(&bar0->mc_rldram_test_ctrl); |
4352 | val64 |= MC_RLDRAM_TEST_MODE; | 4831 | val64 |= MC_RLDRAM_TEST_MODE; |
4353 | writeq(val64, &bar0->mc_rldram_test_ctrl); | 4832 | SPECIAL_REG_WRITE(val64, &bar0->mc_rldram_test_ctrl, LF); |
4354 | 4833 | ||
4355 | val64 = readq(&bar0->mc_rldram_mrs); | 4834 | val64 = readq(&bar0->mc_rldram_mrs); |
4356 | val64 |= MC_RLDRAM_QUEUE_SIZE_ENABLE; | 4835 | val64 |= MC_RLDRAM_QUEUE_SIZE_ENABLE; |
@@ -4378,17 +4857,12 @@ static int s2io_rldram_test(nic_t * sp, uint64_t * data) | |||
4378 | } | 4857 | } |
4379 | writeq(val64, &bar0->mc_rldram_test_d2); | 4858 | writeq(val64, &bar0->mc_rldram_test_d2); |
4380 | 4859 | ||
4381 | val64 = (u64) (0x0000003fffff0000ULL); | 4860 | val64 = (u64) (0x0000003ffffe0100ULL); |
4382 | writeq(val64, &bar0->mc_rldram_test_add); | 4861 | writeq(val64, &bar0->mc_rldram_test_add); |
4383 | 4862 | ||
4384 | 4863 | val64 = MC_RLDRAM_TEST_MODE | MC_RLDRAM_TEST_WRITE | | |
4385 | val64 = MC_RLDRAM_TEST_MODE; | 4864 | MC_RLDRAM_TEST_GO; |
4386 | writeq(val64, &bar0->mc_rldram_test_ctrl); | 4865 | SPECIAL_REG_WRITE(val64, &bar0->mc_rldram_test_ctrl, LF); |
4387 | |||
4388 | val64 |= | ||
4389 | MC_RLDRAM_TEST_MODE | MC_RLDRAM_TEST_WRITE | | ||
4390 | MC_RLDRAM_TEST_GO; | ||
4391 | writeq(val64, &bar0->mc_rldram_test_ctrl); | ||
4392 | 4866 | ||
4393 | for (cnt = 0; cnt < 5; cnt++) { | 4867 | for (cnt = 0; cnt < 5; cnt++) { |
4394 | val64 = readq(&bar0->mc_rldram_test_ctrl); | 4868 | val64 = readq(&bar0->mc_rldram_test_ctrl); |
@@ -4400,11 +4874,8 @@ static int s2io_rldram_test(nic_t * sp, uint64_t * data) | |||
4400 | if (cnt == 5) | 4874 | if (cnt == 5) |
4401 | break; | 4875 | break; |
4402 | 4876 | ||
4403 | val64 = MC_RLDRAM_TEST_MODE; | 4877 | val64 = MC_RLDRAM_TEST_MODE | MC_RLDRAM_TEST_GO; |
4404 | writeq(val64, &bar0->mc_rldram_test_ctrl); | 4878 | SPECIAL_REG_WRITE(val64, &bar0->mc_rldram_test_ctrl, LF); |
4405 | |||
4406 | val64 |= MC_RLDRAM_TEST_MODE | MC_RLDRAM_TEST_GO; | ||
4407 | writeq(val64, &bar0->mc_rldram_test_ctrl); | ||
4408 | 4879 | ||
4409 | for (cnt = 0; cnt < 5; cnt++) { | 4880 | for (cnt = 0; cnt < 5; cnt++) { |
4410 | val64 = readq(&bar0->mc_rldram_test_ctrl); | 4881 | val64 = readq(&bar0->mc_rldram_test_ctrl); |
@@ -4417,18 +4888,18 @@ static int s2io_rldram_test(nic_t * sp, uint64_t * data) | |||
4417 | break; | 4888 | break; |
4418 | 4889 | ||
4419 | val64 = readq(&bar0->mc_rldram_test_ctrl); | 4890 | val64 = readq(&bar0->mc_rldram_test_ctrl); |
4420 | if (val64 & MC_RLDRAM_TEST_PASS) | 4891 | if (!(val64 & MC_RLDRAM_TEST_PASS)) |
4421 | test_pass = 1; | 4892 | test_fail = 1; |
4422 | 4893 | ||
4423 | iteration++; | 4894 | iteration++; |
4424 | } | 4895 | } |
4425 | 4896 | ||
4426 | if (!test_pass) | 4897 | *data = test_fail; |
4427 | *data = 1; | ||
4428 | else | ||
4429 | *data = 0; | ||
4430 | 4898 | ||
4431 | return 0; | 4899 | /* Bring the adapter out of test mode */ |
4900 | SPECIAL_REG_WRITE(0, &bar0->mc_rldram_test_ctrl, LF); | ||
4901 | |||
4902 | return test_fail; | ||
4432 | } | 4903 | } |
4433 | 4904 | ||
4434 | /** | 4905 | /** |
@@ -4932,7 +5403,7 @@ static void s2io_card_down(nic_t * sp) | |||
4932 | 5403 | ||
4933 | static int s2io_card_up(nic_t * sp) | 5404 | static int s2io_card_up(nic_t * sp) |
4934 | { | 5405 | { |
4935 | int i, ret; | 5406 | int i, ret = 0; |
4936 | mac_info_t *mac_control; | 5407 | mac_info_t *mac_control; |
4937 | struct config_param *config; | 5408 | struct config_param *config; |
4938 | struct net_device *dev = (struct net_device *) sp->dev; | 5409 | struct net_device *dev = (struct net_device *) sp->dev; |
@@ -4944,6 +5415,15 @@ static int s2io_card_up(nic_t * sp) | |||
4944 | return -ENODEV; | 5415 | return -ENODEV; |
4945 | } | 5416 | } |
4946 | 5417 | ||
5418 | if (sp->intr_type == MSI) | ||
5419 | ret = s2io_enable_msi(sp); | ||
5420 | else if (sp->intr_type == MSI_X) | ||
5421 | ret = s2io_enable_msi_x(sp); | ||
5422 | if (ret) { | ||
5423 | DBG_PRINT(ERR_DBG, "%s: Defaulting to INTA\n", dev->name); | ||
5424 | sp->intr_type = INTA; | ||
5425 | } | ||
5426 | |||
4947 | /* | 5427 | /* |
4948 | * Initializing the Rx buffers. For now we are considering only 1 | 5428 | * Initializing the Rx buffers. For now we are considering only 1 |
4949 | * Rx ring and initializing buffers into 30 Rx blocks | 5429 | * Rx ring and initializing buffers into 30 Rx blocks |
@@ -5228,6 +5708,8 @@ static void s2io_init_pci(nic_t * sp) | |||
5228 | 5708 | ||
5229 | MODULE_AUTHOR("Raghavendra Koushik <raghavendra.koushik@neterion.com>"); | 5709 | MODULE_AUTHOR("Raghavendra Koushik <raghavendra.koushik@neterion.com>"); |
5230 | MODULE_LICENSE("GPL"); | 5710 | MODULE_LICENSE("GPL"); |
5711 | MODULE_VERSION(DRV_VERSION); | ||
5712 | |||
5231 | module_param(tx_fifo_num, int, 0); | 5713 | module_param(tx_fifo_num, int, 0); |
5232 | module_param(rx_ring_num, int, 0); | 5714 | module_param(rx_ring_num, int, 0); |
5233 | module_param_array(tx_fifo_len, uint, NULL, 0); | 5715 | module_param_array(tx_fifo_len, uint, NULL, 0); |
@@ -5245,6 +5727,7 @@ module_param(bimodal, bool, 0); | |||
5245 | module_param(indicate_max_pkts, int, 0); | 5727 | module_param(indicate_max_pkts, int, 0); |
5246 | #endif | 5728 | #endif |
5247 | module_param(rxsync_frequency, int, 0); | 5729 | module_param(rxsync_frequency, int, 0); |
5730 | module_param(intr_type, int, 0); | ||
5248 | 5731 | ||
5249 | /** | 5732 | /** |
5250 | * s2io_init_nic - Initialization of the adapter . | 5733 | * s2io_init_nic - Initialization of the adapter . |
@@ -5274,9 +5757,16 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
5274 | mac_info_t *mac_control; | 5757 | mac_info_t *mac_control; |
5275 | struct config_param *config; | 5758 | struct config_param *config; |
5276 | int mode; | 5759 | int mode; |
5760 | u8 dev_intr_type = intr_type; | ||
5277 | 5761 | ||
5278 | #ifdef CONFIG_S2IO_NAPI | 5762 | #ifdef CONFIG_S2IO_NAPI |
5279 | DBG_PRINT(ERR_DBG, "NAPI support has been enabled\n"); | 5763 | if (dev_intr_type != INTA) { |
5764 | DBG_PRINT(ERR_DBG, "NAPI cannot be enabled when MSI/MSI-X \ | ||
5765 | is enabled. Defaulting to INTA\n"); | ||
5766 | dev_intr_type = INTA; | ||
5767 | } | ||
5768 | else | ||
5769 | DBG_PRINT(ERR_DBG, "NAPI support has been enabled\n"); | ||
5280 | #endif | 5770 | #endif |
5281 | 5771 | ||
5282 | if ((ret = pci_enable_device(pdev))) { | 5772 | if ((ret = pci_enable_device(pdev))) { |
@@ -5303,10 +5793,35 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
5303 | return -ENOMEM; | 5793 | return -ENOMEM; |
5304 | } | 5794 | } |
5305 | 5795 | ||
5306 | if (pci_request_regions(pdev, s2io_driver_name)) { | 5796 | if ((dev_intr_type == MSI_X) && |
5307 | DBG_PRINT(ERR_DBG, "Request Regions failed\n"), | 5797 | ((pdev->device != PCI_DEVICE_ID_HERC_WIN) && |
5308 | pci_disable_device(pdev); | 5798 | (pdev->device != PCI_DEVICE_ID_HERC_UNI))) { |
5309 | return -ENODEV; | 5799 | DBG_PRINT(ERR_DBG, "Xframe I does not support MSI_X. \ |
5800 | Defaulting to INTA\n"); | ||
5801 | dev_intr_type = INTA; | ||
5802 | } | ||
5803 | if (dev_intr_type != MSI_X) { | ||
5804 | if (pci_request_regions(pdev, s2io_driver_name)) { | ||
5805 | DBG_PRINT(ERR_DBG, "Request Regions failed\n"), | ||
5806 | pci_disable_device(pdev); | ||
5807 | return -ENODEV; | ||
5808 | } | ||
5809 | } | ||
5810 | else { | ||
5811 | if (!(request_mem_region(pci_resource_start(pdev, 0), | ||
5812 | pci_resource_len(pdev, 0), s2io_driver_name))) { | ||
5813 | DBG_PRINT(ERR_DBG, "bar0 Request Regions failed\n"); | ||
5814 | pci_disable_device(pdev); | ||
5815 | return -ENODEV; | ||
5816 | } | ||
5817 | if (!(request_mem_region(pci_resource_start(pdev, 2), | ||
5818 | pci_resource_len(pdev, 2), s2io_driver_name))) { | ||
5819 | DBG_PRINT(ERR_DBG, "bar1 Request Regions failed\n"); | ||
5820 | release_mem_region(pci_resource_start(pdev, 0), | ||
5821 | pci_resource_len(pdev, 0)); | ||
5822 | pci_disable_device(pdev); | ||
5823 | return -ENODEV; | ||
5824 | } | ||
5310 | } | 5825 | } |
5311 | 5826 | ||
5312 | dev = alloc_etherdev(sizeof(nic_t)); | 5827 | dev = alloc_etherdev(sizeof(nic_t)); |
@@ -5329,6 +5844,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
5329 | sp->pdev = pdev; | 5844 | sp->pdev = pdev; |
5330 | sp->high_dma_flag = dma_flag; | 5845 | sp->high_dma_flag = dma_flag; |
5331 | sp->device_enabled_once = FALSE; | 5846 | sp->device_enabled_once = FALSE; |
5847 | sp->intr_type = dev_intr_type; | ||
5332 | 5848 | ||
5333 | if ((pdev->device == PCI_DEVICE_ID_HERC_WIN) || | 5849 | if ((pdev->device == PCI_DEVICE_ID_HERC_WIN) || |
5334 | (pdev->device == PCI_DEVICE_ID_HERC_UNI)) | 5850 | (pdev->device == PCI_DEVICE_ID_HERC_UNI)) |
@@ -5336,6 +5852,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
5336 | else | 5852 | else |
5337 | sp->device_type = XFRAME_I_DEVICE; | 5853 | sp->device_type = XFRAME_I_DEVICE; |
5338 | 5854 | ||
5855 | |||
5339 | /* Initialize some PCI/PCI-X fields of the NIC. */ | 5856 | /* Initialize some PCI/PCI-X fields of the NIC. */ |
5340 | s2io_init_pci(sp); | 5857 | s2io_init_pci(sp); |
5341 | 5858 | ||
@@ -5571,12 +6088,23 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
5571 | if (sp->device_type & XFRAME_II_DEVICE) { | 6088 | if (sp->device_type & XFRAME_II_DEVICE) { |
5572 | DBG_PRINT(ERR_DBG, "%s: Neterion Xframe II 10GbE adapter ", | 6089 | DBG_PRINT(ERR_DBG, "%s: Neterion Xframe II 10GbE adapter ", |
5573 | dev->name); | 6090 | dev->name); |
5574 | DBG_PRINT(ERR_DBG, "(rev %d), %s", | 6091 | DBG_PRINT(ERR_DBG, "(rev %d), Version %s", |
5575 | get_xena_rev_id(sp->pdev), | 6092 | get_xena_rev_id(sp->pdev), |
5576 | s2io_driver_version); | 6093 | s2io_driver_version); |
5577 | #ifdef CONFIG_2BUFF_MODE | 6094 | #ifdef CONFIG_2BUFF_MODE |
5578 | DBG_PRINT(ERR_DBG, ", Buffer mode %d",2); | 6095 | DBG_PRINT(ERR_DBG, ", Buffer mode %d",2); |
5579 | #endif | 6096 | #endif |
6097 | switch(sp->intr_type) { | ||
6098 | case INTA: | ||
6099 | DBG_PRINT(ERR_DBG, ", Intr type INTA"); | ||
6100 | break; | ||
6101 | case MSI: | ||
6102 | DBG_PRINT(ERR_DBG, ", Intr type MSI"); | ||
6103 | break; | ||
6104 | case MSI_X: | ||
6105 | DBG_PRINT(ERR_DBG, ", Intr type MSI-X"); | ||
6106 | break; | ||
6107 | } | ||
5580 | 6108 | ||
5581 | DBG_PRINT(ERR_DBG, "\nCopyright(c) 2002-2005 Neterion Inc.\n"); | 6109 | DBG_PRINT(ERR_DBG, "\nCopyright(c) 2002-2005 Neterion Inc.\n"); |
5582 | DBG_PRINT(ERR_DBG, "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x\n", | 6110 | DBG_PRINT(ERR_DBG, "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x\n", |
@@ -5595,12 +6123,23 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
5595 | } else { | 6123 | } else { |
5596 | DBG_PRINT(ERR_DBG, "%s: Neterion Xframe I 10GbE adapter ", | 6124 | DBG_PRINT(ERR_DBG, "%s: Neterion Xframe I 10GbE adapter ", |
5597 | dev->name); | 6125 | dev->name); |
5598 | DBG_PRINT(ERR_DBG, "(rev %d), %s", | 6126 | DBG_PRINT(ERR_DBG, "(rev %d), Version %s", |
5599 | get_xena_rev_id(sp->pdev), | 6127 | get_xena_rev_id(sp->pdev), |
5600 | s2io_driver_version); | 6128 | s2io_driver_version); |
5601 | #ifdef CONFIG_2BUFF_MODE | 6129 | #ifdef CONFIG_2BUFF_MODE |
5602 | DBG_PRINT(ERR_DBG, ", Buffer mode %d",2); | 6130 | DBG_PRINT(ERR_DBG, ", Buffer mode %d",2); |
5603 | #endif | 6131 | #endif |
6132 | switch(sp->intr_type) { | ||
6133 | case INTA: | ||
6134 | DBG_PRINT(ERR_DBG, ", Intr type INTA"); | ||
6135 | break; | ||
6136 | case MSI: | ||
6137 | DBG_PRINT(ERR_DBG, ", Intr type MSI"); | ||
6138 | break; | ||
6139 | case MSI_X: | ||
6140 | DBG_PRINT(ERR_DBG, ", Intr type MSI-X"); | ||
6141 | break; | ||
6142 | } | ||
5604 | DBG_PRINT(ERR_DBG, "\nCopyright(c) 2002-2005 Neterion Inc.\n"); | 6143 | DBG_PRINT(ERR_DBG, "\nCopyright(c) 2002-2005 Neterion Inc.\n"); |
5605 | DBG_PRINT(ERR_DBG, "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x\n", | 6144 | DBG_PRINT(ERR_DBG, "MAC ADDR: %02x:%02x:%02x:%02x:%02x:%02x\n", |
5606 | sp->def_mac_addr[0].mac_addr[0], | 6145 | sp->def_mac_addr[0].mac_addr[0], |
@@ -5644,7 +6183,14 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
5644 | mem_alloc_failed: | 6183 | mem_alloc_failed: |
5645 | free_shared_mem(sp); | 6184 | free_shared_mem(sp); |
5646 | pci_disable_device(pdev); | 6185 | pci_disable_device(pdev); |
5647 | pci_release_regions(pdev); | 6186 | if (dev_intr_type != MSI_X) |
6187 | pci_release_regions(pdev); | ||
6188 | else { | ||
6189 | release_mem_region(pci_resource_start(pdev, 0), | ||
6190 | pci_resource_len(pdev, 0)); | ||
6191 | release_mem_region(pci_resource_start(pdev, 2), | ||
6192 | pci_resource_len(pdev, 2)); | ||
6193 | } | ||
5648 | pci_set_drvdata(pdev, NULL); | 6194 | pci_set_drvdata(pdev, NULL); |
5649 | free_netdev(dev); | 6195 | free_netdev(dev); |
5650 | 6196 | ||
@@ -5678,7 +6224,14 @@ static void __devexit s2io_rem_nic(struct pci_dev *pdev) | |||
5678 | iounmap(sp->bar0); | 6224 | iounmap(sp->bar0); |
5679 | iounmap(sp->bar1); | 6225 | iounmap(sp->bar1); |
5680 | pci_disable_device(pdev); | 6226 | pci_disable_device(pdev); |
5681 | pci_release_regions(pdev); | 6227 | if (sp->intr_type != MSI_X) |
6228 | pci_release_regions(pdev); | ||
6229 | else { | ||
6230 | release_mem_region(pci_resource_start(pdev, 0), | ||
6231 | pci_resource_len(pdev, 0)); | ||
6232 | release_mem_region(pci_resource_start(pdev, 2), | ||
6233 | pci_resource_len(pdev, 2)); | ||
6234 | } | ||
5682 | pci_set_drvdata(pdev, NULL); | 6235 | pci_set_drvdata(pdev, NULL); |
5683 | free_netdev(dev); | 6236 | free_netdev(dev); |
5684 | } | 6237 | } |
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 89151cb52181..1cc24b56760e 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h | |||
@@ -652,6 +652,30 @@ typedef struct { | |||
652 | #define SMALL_BLK_CNT 30 | 652 | #define SMALL_BLK_CNT 30 |
653 | #define LARGE_BLK_CNT 100 | 653 | #define LARGE_BLK_CNT 100 |
654 | 654 | ||
655 | /* | ||
656 | * Structure to keep track of the MSI-X vectors and the corresponding | ||
657 | * argument registered against each vector | ||
658 | */ | ||
659 | #define MAX_REQUESTED_MSI_X 17 | ||
660 | struct s2io_msix_entry | ||
661 | { | ||
662 | u16 vector; | ||
663 | u16 entry; | ||
664 | void *arg; | ||
665 | |||
666 | u8 type; | ||
667 | #define MSIX_FIFO_TYPE 1 | ||
668 | #define MSIX_RING_TYPE 2 | ||
669 | |||
670 | u8 in_use; | ||
671 | #define MSIX_REGISTERED_SUCCESS 0xAA | ||
672 | }; | ||
673 | |||
674 | struct msix_info_st { | ||
675 | u64 addr; | ||
676 | u64 data; | ||
677 | }; | ||
678 | |||
655 | /* Structure representing one instance of the NIC */ | 679 | /* Structure representing one instance of the NIC */ |
656 | struct s2io_nic { | 680 | struct s2io_nic { |
657 | #ifdef CONFIG_S2IO_NAPI | 681 | #ifdef CONFIG_S2IO_NAPI |
@@ -719,13 +743,8 @@ struct s2io_nic { | |||
719 | * a schedule task that will set the correct Link state once the | 743 | * a schedule task that will set the correct Link state once the |
720 | * NIC's PHY has stabilized after a state change. | 744 | * NIC's PHY has stabilized after a state change. |
721 | */ | 745 | */ |
722 | #ifdef INIT_TQUEUE | ||
723 | struct tq_struct rst_timer_task; | ||
724 | struct tq_struct set_link_task; | ||
725 | #else | ||
726 | struct work_struct rst_timer_task; | 746 | struct work_struct rst_timer_task; |
727 | struct work_struct set_link_task; | 747 | struct work_struct set_link_task; |
728 | #endif | ||
729 | 748 | ||
730 | /* Flag that can be used to turn on or turn off the Rx checksum | 749 | /* Flag that can be used to turn on or turn off the Rx checksum |
731 | * offload feature. | 750 | * offload feature. |
@@ -748,10 +767,23 @@ struct s2io_nic { | |||
748 | atomic_t card_state; | 767 | atomic_t card_state; |
749 | volatile unsigned long link_state; | 768 | volatile unsigned long link_state; |
750 | struct vlan_group *vlgrp; | 769 | struct vlan_group *vlgrp; |
770 | #define MSIX_FLG 0xA5 | ||
771 | struct msix_entry *entries; | ||
772 | struct s2io_msix_entry *s2io_entries; | ||
773 | char desc1[35]; | ||
774 | char desc2[35]; | ||
775 | |||
776 | struct msix_info_st msix_info[0x3f]; | ||
777 | |||
751 | #define XFRAME_I_DEVICE 1 | 778 | #define XFRAME_I_DEVICE 1 |
752 | #define XFRAME_II_DEVICE 2 | 779 | #define XFRAME_II_DEVICE 2 |
753 | u8 device_type; | 780 | u8 device_type; |
754 | 781 | ||
782 | #define INTA 0 | ||
783 | #define MSI 1 | ||
784 | #define MSI_X 2 | ||
785 | u8 intr_type; | ||
786 | |||
755 | spinlock_t rx_lock; | 787 | spinlock_t rx_lock; |
756 | atomic_t isr_cnt; | 788 | atomic_t isr_cnt; |
757 | }; | 789 | }; |
@@ -886,6 +918,13 @@ static int s2io_poll(struct net_device *dev, int *budget); | |||
886 | static void s2io_init_pci(nic_t * sp); | 918 | static void s2io_init_pci(nic_t * sp); |
887 | int s2io_set_mac_addr(struct net_device *dev, u8 * addr); | 919 | int s2io_set_mac_addr(struct net_device *dev, u8 * addr); |
888 | static void s2io_alarm_handle(unsigned long data); | 920 | static void s2io_alarm_handle(unsigned long data); |
921 | static int s2io_enable_msi(nic_t *nic); | ||
922 | static irqreturn_t s2io_msi_handle(int irq, void *dev_id, struct pt_regs *regs); | ||
923 | static irqreturn_t | ||
924 | s2io_msix_ring_handle(int irq, void *dev_id, struct pt_regs *regs); | ||
925 | static irqreturn_t | ||
926 | s2io_msix_fifo_handle(int irq, void *dev_id, struct pt_regs *regs); | ||
927 | int s2io_enable_msi_x(nic_t *nic); | ||
889 | static irqreturn_t s2io_isr(int irq, void *dev_id, struct pt_regs *regs); | 928 | static irqreturn_t s2io_isr(int irq, void *dev_id, struct pt_regs *regs); |
890 | static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag); | 929 | static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag); |
891 | static struct ethtool_ops netdev_ethtool_ops; | 930 | static struct ethtool_ops netdev_ethtool_ops; |
@@ -894,4 +933,5 @@ int s2io_set_swapper(nic_t * sp); | |||
894 | static void s2io_card_down(nic_t *nic); | 933 | static void s2io_card_down(nic_t *nic); |
895 | static int s2io_card_up(nic_t *nic); | 934 | static int s2io_card_up(nic_t *nic); |
896 | int get_xena_rev_id(struct pci_dev *pdev); | 935 | int get_xena_rev_id(struct pci_dev *pdev); |
936 | void restore_xmsi_data(nic_t *nic); | ||
897 | #endif /* _S2IO_H */ | 937 | #endif /* _S2IO_H */ |
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index 7abd55a4fb21..aa4ca1821759 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | * | 13 | * |
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
@@ -118,8 +118,6 @@ MODULE_PARM_DESC(int_timeout, "Timeout value"); | |||
118 | ********************************************************************* */ | 118 | ********************************************************************* */ |
119 | 119 | ||
120 | 120 | ||
121 | typedef unsigned long sbmac_port_t; | ||
122 | |||
123 | typedef enum { sbmac_speed_auto, sbmac_speed_10, | 121 | typedef enum { sbmac_speed_auto, sbmac_speed_10, |
124 | sbmac_speed_100, sbmac_speed_1000 } sbmac_speed_t; | 122 | sbmac_speed_100, sbmac_speed_1000 } sbmac_speed_t; |
125 | 123 | ||
@@ -129,7 +127,7 @@ typedef enum { sbmac_duplex_auto, sbmac_duplex_half, | |||
129 | typedef enum { sbmac_fc_auto, sbmac_fc_disabled, sbmac_fc_frame, | 127 | typedef enum { sbmac_fc_auto, sbmac_fc_disabled, sbmac_fc_frame, |
130 | sbmac_fc_collision, sbmac_fc_carrier } sbmac_fc_t; | 128 | sbmac_fc_collision, sbmac_fc_carrier } sbmac_fc_t; |
131 | 129 | ||
132 | typedef enum { sbmac_state_uninit, sbmac_state_off, sbmac_state_on, | 130 | typedef enum { sbmac_state_uninit, sbmac_state_off, sbmac_state_on, |
133 | sbmac_state_broken } sbmac_state_t; | 131 | sbmac_state_broken } sbmac_state_t; |
134 | 132 | ||
135 | 133 | ||
@@ -144,17 +142,13 @@ typedef enum { sbmac_state_uninit, sbmac_state_off, sbmac_state_on, | |||
144 | 142 | ||
145 | #define NUMCACHEBLKS(x) (((x)+SMP_CACHE_BYTES-1)/SMP_CACHE_BYTES) | 143 | #define NUMCACHEBLKS(x) (((x)+SMP_CACHE_BYTES-1)/SMP_CACHE_BYTES) |
146 | 144 | ||
147 | #define SBMAC_READCSR(t) __raw_readq((unsigned long)t) | ||
148 | #define SBMAC_WRITECSR(t,v) __raw_writeq(v, (unsigned long)t) | ||
149 | |||
150 | |||
151 | #define SBMAC_MAX_TXDESCR 32 | 145 | #define SBMAC_MAX_TXDESCR 32 |
152 | #define SBMAC_MAX_RXDESCR 32 | 146 | #define SBMAC_MAX_RXDESCR 32 |
153 | 147 | ||
154 | #define ETHER_ALIGN 2 | 148 | #define ETHER_ALIGN 2 |
155 | #define ETHER_ADDR_LEN 6 | 149 | #define ETHER_ADDR_LEN 6 |
156 | #define ENET_PACKET_SIZE 1518 | 150 | #define ENET_PACKET_SIZE 1518 |
157 | /*#define ENET_PACKET_SIZE 9216 */ | 151 | /*#define ENET_PACKET_SIZE 9216 */ |
158 | 152 | ||
159 | /********************************************************************** | 153 | /********************************************************************** |
160 | * DMA Descriptor structure | 154 | * DMA Descriptor structure |
@@ -172,12 +166,12 @@ typedef unsigned long paddr_t; | |||
172 | ********************************************************************* */ | 166 | ********************************************************************* */ |
173 | 167 | ||
174 | typedef struct sbmacdma_s { | 168 | typedef struct sbmacdma_s { |
175 | 169 | ||
176 | /* | 170 | /* |
177 | * This stuff is used to identify the channel and the registers | 171 | * This stuff is used to identify the channel and the registers |
178 | * associated with it. | 172 | * associated with it. |
179 | */ | 173 | */ |
180 | 174 | ||
181 | struct sbmac_softc *sbdma_eth; /* back pointer to associated MAC */ | 175 | struct sbmac_softc *sbdma_eth; /* back pointer to associated MAC */ |
182 | int sbdma_channel; /* channel number */ | 176 | int sbdma_channel; /* channel number */ |
183 | int sbdma_txdir; /* direction (1=transmit) */ | 177 | int sbdma_txdir; /* direction (1=transmit) */ |
@@ -187,21 +181,21 @@ typedef struct sbmacdma_s { | |||
187 | int sbdma_int_timeout; /* # usec rx/tx interrupt */ | 181 | int sbdma_int_timeout; /* # usec rx/tx interrupt */ |
188 | #endif | 182 | #endif |
189 | 183 | ||
190 | sbmac_port_t sbdma_config0; /* DMA config register 0 */ | 184 | volatile void __iomem *sbdma_config0; /* DMA config register 0 */ |
191 | sbmac_port_t sbdma_config1; /* DMA config register 1 */ | 185 | volatile void __iomem *sbdma_config1; /* DMA config register 1 */ |
192 | sbmac_port_t sbdma_dscrbase; /* Descriptor base address */ | 186 | volatile void __iomem *sbdma_dscrbase; /* Descriptor base address */ |
193 | sbmac_port_t sbdma_dscrcnt; /* Descriptor count register */ | 187 | volatile void __iomem *sbdma_dscrcnt; /* Descriptor count register */ |
194 | sbmac_port_t sbdma_curdscr; /* current descriptor address */ | 188 | volatile void __iomem *sbdma_curdscr; /* current descriptor address */ |
195 | 189 | ||
196 | /* | 190 | /* |
197 | * This stuff is for maintenance of the ring | 191 | * This stuff is for maintenance of the ring |
198 | */ | 192 | */ |
199 | 193 | ||
200 | sbdmadscr_t *sbdma_dscrtable; /* base of descriptor table */ | 194 | sbdmadscr_t *sbdma_dscrtable; /* base of descriptor table */ |
201 | sbdmadscr_t *sbdma_dscrtable_end; /* end of descriptor table */ | 195 | sbdmadscr_t *sbdma_dscrtable_end; /* end of descriptor table */ |
202 | 196 | ||
203 | struct sk_buff **sbdma_ctxtable; /* context table, one per descr */ | 197 | struct sk_buff **sbdma_ctxtable; /* context table, one per descr */ |
204 | 198 | ||
205 | paddr_t sbdma_dscrtable_phys; /* and also the phys addr */ | 199 | paddr_t sbdma_dscrtable_phys; /* and also the phys addr */ |
206 | sbdmadscr_t *sbdma_addptr; /* next dscr for sw to add */ | 200 | sbdmadscr_t *sbdma_addptr; /* next dscr for sw to add */ |
207 | sbdmadscr_t *sbdma_remptr; /* next dscr for sw to remove */ | 201 | sbdmadscr_t *sbdma_remptr; /* next dscr for sw to remove */ |
@@ -213,15 +207,15 @@ typedef struct sbmacdma_s { | |||
213 | ********************************************************************* */ | 207 | ********************************************************************* */ |
214 | 208 | ||
215 | struct sbmac_softc { | 209 | struct sbmac_softc { |
216 | 210 | ||
217 | /* | 211 | /* |
218 | * Linux-specific things | 212 | * Linux-specific things |
219 | */ | 213 | */ |
220 | 214 | ||
221 | struct net_device *sbm_dev; /* pointer to linux device */ | 215 | struct net_device *sbm_dev; /* pointer to linux device */ |
222 | spinlock_t sbm_lock; /* spin lock */ | 216 | spinlock_t sbm_lock; /* spin lock */ |
223 | struct timer_list sbm_timer; /* for monitoring MII */ | 217 | struct timer_list sbm_timer; /* for monitoring MII */ |
224 | struct net_device_stats sbm_stats; | 218 | struct net_device_stats sbm_stats; |
225 | int sbm_devflags; /* current device flags */ | 219 | int sbm_devflags; /* current device flags */ |
226 | 220 | ||
227 | int sbm_phy_oldbmsr; | 221 | int sbm_phy_oldbmsr; |
@@ -229,31 +223,31 @@ struct sbmac_softc { | |||
229 | int sbm_phy_oldk1stsr; | 223 | int sbm_phy_oldk1stsr; |
230 | int sbm_phy_oldlinkstat; | 224 | int sbm_phy_oldlinkstat; |
231 | int sbm_buffersize; | 225 | int sbm_buffersize; |
232 | 226 | ||
233 | unsigned char sbm_phys[2]; | 227 | unsigned char sbm_phys[2]; |
234 | 228 | ||
235 | /* | 229 | /* |
236 | * Controller-specific things | 230 | * Controller-specific things |
237 | */ | 231 | */ |
238 | 232 | ||
239 | unsigned long sbm_base; /* MAC's base address */ | 233 | volatile void __iomem *sbm_base; /* MAC's base address */ |
240 | sbmac_state_t sbm_state; /* current state */ | 234 | sbmac_state_t sbm_state; /* current state */ |
241 | 235 | ||
242 | sbmac_port_t sbm_macenable; /* MAC Enable Register */ | 236 | volatile void __iomem *sbm_macenable; /* MAC Enable Register */ |
243 | sbmac_port_t sbm_maccfg; /* MAC Configuration Register */ | 237 | volatile void __iomem *sbm_maccfg; /* MAC Configuration Register */ |
244 | sbmac_port_t sbm_fifocfg; /* FIFO configuration register */ | 238 | volatile void __iomem *sbm_fifocfg; /* FIFO configuration register */ |
245 | sbmac_port_t sbm_framecfg; /* Frame configuration register */ | 239 | volatile void __iomem *sbm_framecfg; /* Frame configuration register */ |
246 | sbmac_port_t sbm_rxfilter; /* receive filter register */ | 240 | volatile void __iomem *sbm_rxfilter; /* receive filter register */ |
247 | sbmac_port_t sbm_isr; /* Interrupt status register */ | 241 | volatile void __iomem *sbm_isr; /* Interrupt status register */ |
248 | sbmac_port_t sbm_imr; /* Interrupt mask register */ | 242 | volatile void __iomem *sbm_imr; /* Interrupt mask register */ |
249 | sbmac_port_t sbm_mdio; /* MDIO register */ | 243 | volatile void __iomem *sbm_mdio; /* MDIO register */ |
250 | 244 | ||
251 | sbmac_speed_t sbm_speed; /* current speed */ | 245 | sbmac_speed_t sbm_speed; /* current speed */ |
252 | sbmac_duplex_t sbm_duplex; /* current duplex */ | 246 | sbmac_duplex_t sbm_duplex; /* current duplex */ |
253 | sbmac_fc_t sbm_fc; /* current flow control setting */ | 247 | sbmac_fc_t sbm_fc; /* current flow control setting */ |
254 | 248 | ||
255 | unsigned char sbm_hwaddr[ETHER_ADDR_LEN]; | 249 | unsigned char sbm_hwaddr[ETHER_ADDR_LEN]; |
256 | 250 | ||
257 | sbmacdma_t sbm_txdma; /* for now, only use channel 0 */ | 251 | sbmacdma_t sbm_txdma; /* for now, only use channel 0 */ |
258 | sbmacdma_t sbm_rxdma; | 252 | sbmacdma_t sbm_rxdma; |
259 | int rx_hw_checksum; | 253 | int rx_hw_checksum; |
@@ -302,6 +296,7 @@ static void sbmac_set_rx_mode(struct net_device *dev); | |||
302 | static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 296 | static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
303 | static int sbmac_close(struct net_device *dev); | 297 | static int sbmac_close(struct net_device *dev); |
304 | static int sbmac_mii_poll(struct sbmac_softc *s,int noisy); | 298 | static int sbmac_mii_poll(struct sbmac_softc *s,int noisy); |
299 | static int sbmac_mii_probe(struct net_device *dev); | ||
305 | 300 | ||
306 | static void sbmac_mii_sync(struct sbmac_softc *s); | 301 | static void sbmac_mii_sync(struct sbmac_softc *s); |
307 | static void sbmac_mii_senddata(struct sbmac_softc *s,unsigned int data, int bitcnt); | 302 | static void sbmac_mii_senddata(struct sbmac_softc *s,unsigned int data, int bitcnt); |
@@ -439,6 +434,9 @@ static uint64_t sbmac_orig_hwaddr[MAX_UNITS]; | |||
439 | 434 | ||
440 | #define MII_BMCR 0x00 /* Basic mode control register (rw) */ | 435 | #define MII_BMCR 0x00 /* Basic mode control register (rw) */ |
441 | #define MII_BMSR 0x01 /* Basic mode status register (ro) */ | 436 | #define MII_BMSR 0x01 /* Basic mode status register (ro) */ |
437 | #define MII_PHYIDR1 0x02 | ||
438 | #define MII_PHYIDR2 0x03 | ||
439 | |||
442 | #define MII_K1STSR 0x0A /* 1K Status Register (ro) */ | 440 | #define MII_K1STSR 0x0A /* 1K Status Register (ro) */ |
443 | #define MII_ANLPAR 0x05 /* Autonegotiation lnk partner abilities (rw) */ | 441 | #define MII_ANLPAR 0x05 /* Autonegotiation lnk partner abilities (rw) */ |
444 | 442 | ||
@@ -450,13 +448,13 @@ static uint64_t sbmac_orig_hwaddr[MAX_UNITS]; | |||
450 | 448 | ||
451 | /********************************************************************** | 449 | /********************************************************************** |
452 | * SBMAC_MII_SYNC(s) | 450 | * SBMAC_MII_SYNC(s) |
453 | * | 451 | * |
454 | * Synchronize with the MII - send a pattern of bits to the MII | 452 | * Synchronize with the MII - send a pattern of bits to the MII |
455 | * that will guarantee that it is ready to accept a command. | 453 | * that will guarantee that it is ready to accept a command. |
456 | * | 454 | * |
457 | * Input parameters: | 455 | * Input parameters: |
458 | * s - sbmac structure | 456 | * s - sbmac structure |
459 | * | 457 | * |
460 | * Return value: | 458 | * Return value: |
461 | * nothing | 459 | * nothing |
462 | ********************************************************************* */ | 460 | ********************************************************************* */ |
@@ -467,25 +465,25 @@ static void sbmac_mii_sync(struct sbmac_softc *s) | |||
467 | uint64_t bits; | 465 | uint64_t bits; |
468 | int mac_mdio_genc; | 466 | int mac_mdio_genc; |
469 | 467 | ||
470 | mac_mdio_genc = SBMAC_READCSR(s->sbm_mdio) & M_MAC_GENC; | 468 | mac_mdio_genc = __raw_readq(s->sbm_mdio) & M_MAC_GENC; |
471 | 469 | ||
472 | bits = M_MAC_MDIO_DIR_OUTPUT | M_MAC_MDIO_OUT; | 470 | bits = M_MAC_MDIO_DIR_OUTPUT | M_MAC_MDIO_OUT; |
473 | 471 | ||
474 | SBMAC_WRITECSR(s->sbm_mdio,bits | mac_mdio_genc); | 472 | __raw_writeq(bits | mac_mdio_genc, s->sbm_mdio); |
475 | 473 | ||
476 | for (cnt = 0; cnt < 32; cnt++) { | 474 | for (cnt = 0; cnt < 32; cnt++) { |
477 | SBMAC_WRITECSR(s->sbm_mdio,bits | M_MAC_MDC | mac_mdio_genc); | 475 | __raw_writeq(bits | M_MAC_MDC | mac_mdio_genc, s->sbm_mdio); |
478 | SBMAC_WRITECSR(s->sbm_mdio,bits | mac_mdio_genc); | 476 | __raw_writeq(bits | mac_mdio_genc, s->sbm_mdio); |
479 | } | 477 | } |
480 | } | 478 | } |
481 | 479 | ||
482 | /********************************************************************** | 480 | /********************************************************************** |
483 | * SBMAC_MII_SENDDATA(s,data,bitcnt) | 481 | * SBMAC_MII_SENDDATA(s,data,bitcnt) |
484 | * | 482 | * |
485 | * Send some bits to the MII. The bits to be sent are right- | 483 | * Send some bits to the MII. The bits to be sent are right- |
486 | * justified in the 'data' parameter. | 484 | * justified in the 'data' parameter. |
487 | * | 485 | * |
488 | * Input parameters: | 486 | * Input parameters: |
489 | * s - sbmac structure | 487 | * s - sbmac structure |
490 | * data - data to send | 488 | * data - data to send |
491 | * bitcnt - number of bits to send | 489 | * bitcnt - number of bits to send |
@@ -498,20 +496,20 @@ static void sbmac_mii_senddata(struct sbmac_softc *s,unsigned int data, int bitc | |||
498 | unsigned int curmask; | 496 | unsigned int curmask; |
499 | int mac_mdio_genc; | 497 | int mac_mdio_genc; |
500 | 498 | ||
501 | mac_mdio_genc = SBMAC_READCSR(s->sbm_mdio) & M_MAC_GENC; | 499 | mac_mdio_genc = __raw_readq(s->sbm_mdio) & M_MAC_GENC; |
502 | 500 | ||
503 | bits = M_MAC_MDIO_DIR_OUTPUT; | 501 | bits = M_MAC_MDIO_DIR_OUTPUT; |
504 | SBMAC_WRITECSR(s->sbm_mdio,bits | mac_mdio_genc); | 502 | __raw_writeq(bits | mac_mdio_genc, s->sbm_mdio); |
505 | 503 | ||
506 | curmask = 1 << (bitcnt - 1); | 504 | curmask = 1 << (bitcnt - 1); |
507 | 505 | ||
508 | for (i = 0; i < bitcnt; i++) { | 506 | for (i = 0; i < bitcnt; i++) { |
509 | if (data & curmask) | 507 | if (data & curmask) |
510 | bits |= M_MAC_MDIO_OUT; | 508 | bits |= M_MAC_MDIO_OUT; |
511 | else bits &= ~M_MAC_MDIO_OUT; | 509 | else bits &= ~M_MAC_MDIO_OUT; |
512 | SBMAC_WRITECSR(s->sbm_mdio,bits | mac_mdio_genc); | 510 | __raw_writeq(bits | mac_mdio_genc, s->sbm_mdio); |
513 | SBMAC_WRITECSR(s->sbm_mdio,bits | M_MAC_MDC | mac_mdio_genc); | 511 | __raw_writeq(bits | M_MAC_MDC | mac_mdio_genc, s->sbm_mdio); |
514 | SBMAC_WRITECSR(s->sbm_mdio,bits | mac_mdio_genc); | 512 | __raw_writeq(bits | mac_mdio_genc, s->sbm_mdio); |
515 | curmask >>= 1; | 513 | curmask >>= 1; |
516 | } | 514 | } |
517 | } | 515 | } |
@@ -520,14 +518,14 @@ static void sbmac_mii_senddata(struct sbmac_softc *s,unsigned int data, int bitc | |||
520 | 518 | ||
521 | /********************************************************************** | 519 | /********************************************************************** |
522 | * SBMAC_MII_READ(s,phyaddr,regidx) | 520 | * SBMAC_MII_READ(s,phyaddr,regidx) |
523 | * | 521 | * |
524 | * Read a PHY register. | 522 | * Read a PHY register. |
525 | * | 523 | * |
526 | * Input parameters: | 524 | * Input parameters: |
527 | * s - sbmac structure | 525 | * s - sbmac structure |
528 | * phyaddr - PHY's address | 526 | * phyaddr - PHY's address |
529 | * regidx = index of register to read | 527 | * regidx = index of register to read |
530 | * | 528 | * |
531 | * Return value: | 529 | * Return value: |
532 | * value read, or 0 if an error occurred. | 530 | * value read, or 0 if an error occurred. |
533 | ********************************************************************* */ | 531 | ********************************************************************* */ |
@@ -543,9 +541,9 @@ static unsigned int sbmac_mii_read(struct sbmac_softc *s,int phyaddr,int regidx) | |||
543 | * Synchronize ourselves so that the PHY knows the next | 541 | * Synchronize ourselves so that the PHY knows the next |
544 | * thing coming down is a command | 542 | * thing coming down is a command |
545 | */ | 543 | */ |
546 | 544 | ||
547 | sbmac_mii_sync(s); | 545 | sbmac_mii_sync(s); |
548 | 546 | ||
549 | /* | 547 | /* |
550 | * Send the data to the PHY. The sequence is | 548 | * Send the data to the PHY. The sequence is |
551 | * a "start" command (2 bits) | 549 | * a "start" command (2 bits) |
@@ -553,59 +551,55 @@ static unsigned int sbmac_mii_read(struct sbmac_softc *s,int phyaddr,int regidx) | |||
553 | * the PHY addr (5 bits) | 551 | * the PHY addr (5 bits) |
554 | * the register index (5 bits) | 552 | * the register index (5 bits) |
555 | */ | 553 | */ |
556 | 554 | ||
557 | sbmac_mii_senddata(s,MII_COMMAND_START, 2); | 555 | sbmac_mii_senddata(s,MII_COMMAND_START, 2); |
558 | sbmac_mii_senddata(s,MII_COMMAND_READ, 2); | 556 | sbmac_mii_senddata(s,MII_COMMAND_READ, 2); |
559 | sbmac_mii_senddata(s,phyaddr, 5); | 557 | sbmac_mii_senddata(s,phyaddr, 5); |
560 | sbmac_mii_senddata(s,regidx, 5); | 558 | sbmac_mii_senddata(s,regidx, 5); |
561 | 559 | ||
562 | mac_mdio_genc = SBMAC_READCSR(s->sbm_mdio) & M_MAC_GENC; | 560 | mac_mdio_genc = __raw_readq(s->sbm_mdio) & M_MAC_GENC; |
563 | 561 | ||
564 | /* | 562 | /* |
565 | * Switch the port around without a clock transition. | 563 | * Switch the port around without a clock transition. |
566 | */ | 564 | */ |
567 | SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_INPUT | mac_mdio_genc); | 565 | __raw_writeq(M_MAC_MDIO_DIR_INPUT | mac_mdio_genc, s->sbm_mdio); |
568 | 566 | ||
569 | /* | 567 | /* |
570 | * Send out a clock pulse to signal we want the status | 568 | * Send out a clock pulse to signal we want the status |
571 | */ | 569 | */ |
572 | 570 | ||
573 | SBMAC_WRITECSR(s->sbm_mdio, | 571 | __raw_writeq(M_MAC_MDIO_DIR_INPUT | M_MAC_MDC | mac_mdio_genc, s->sbm_mdio); |
574 | M_MAC_MDIO_DIR_INPUT | M_MAC_MDC | mac_mdio_genc); | 572 | __raw_writeq(M_MAC_MDIO_DIR_INPUT | mac_mdio_genc, s->sbm_mdio); |
575 | SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_INPUT | mac_mdio_genc); | 573 | |
576 | 574 | /* | |
577 | /* | ||
578 | * If an error occurred, the PHY will signal '1' back | 575 | * If an error occurred, the PHY will signal '1' back |
579 | */ | 576 | */ |
580 | error = SBMAC_READCSR(s->sbm_mdio) & M_MAC_MDIO_IN; | 577 | error = __raw_readq(s->sbm_mdio) & M_MAC_MDIO_IN; |
581 | 578 | ||
582 | /* | 579 | /* |
583 | * Issue an 'idle' clock pulse, but keep the direction | 580 | * Issue an 'idle' clock pulse, but keep the direction |
584 | * the same. | 581 | * the same. |
585 | */ | 582 | */ |
586 | SBMAC_WRITECSR(s->sbm_mdio, | 583 | __raw_writeq(M_MAC_MDIO_DIR_INPUT | M_MAC_MDC | mac_mdio_genc, s->sbm_mdio); |
587 | M_MAC_MDIO_DIR_INPUT | M_MAC_MDC | mac_mdio_genc); | 584 | __raw_writeq(M_MAC_MDIO_DIR_INPUT | mac_mdio_genc, s->sbm_mdio); |
588 | SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_INPUT | mac_mdio_genc); | 585 | |
589 | |||
590 | regval = 0; | 586 | regval = 0; |
591 | 587 | ||
592 | for (idx = 0; idx < 16; idx++) { | 588 | for (idx = 0; idx < 16; idx++) { |
593 | regval <<= 1; | 589 | regval <<= 1; |
594 | 590 | ||
595 | if (error == 0) { | 591 | if (error == 0) { |
596 | if (SBMAC_READCSR(s->sbm_mdio) & M_MAC_MDIO_IN) | 592 | if (__raw_readq(s->sbm_mdio) & M_MAC_MDIO_IN) |
597 | regval |= 1; | 593 | regval |= 1; |
598 | } | 594 | } |
599 | 595 | ||
600 | SBMAC_WRITECSR(s->sbm_mdio, | 596 | __raw_writeq(M_MAC_MDIO_DIR_INPUT|M_MAC_MDC | mac_mdio_genc, s->sbm_mdio); |
601 | M_MAC_MDIO_DIR_INPUT|M_MAC_MDC | mac_mdio_genc); | 597 | __raw_writeq(M_MAC_MDIO_DIR_INPUT | mac_mdio_genc, s->sbm_mdio); |
602 | SBMAC_WRITECSR(s->sbm_mdio, | ||
603 | M_MAC_MDIO_DIR_INPUT | mac_mdio_genc); | ||
604 | } | 598 | } |
605 | 599 | ||
606 | /* Switch back to output */ | 600 | /* Switch back to output */ |
607 | SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_OUTPUT | mac_mdio_genc); | 601 | __raw_writeq(M_MAC_MDIO_DIR_OUTPUT | mac_mdio_genc, s->sbm_mdio); |
608 | 602 | ||
609 | if (error == 0) | 603 | if (error == 0) |
610 | return regval; | 604 | return regval; |
611 | return 0; | 605 | return 0; |
@@ -614,15 +608,15 @@ static unsigned int sbmac_mii_read(struct sbmac_softc *s,int phyaddr,int regidx) | |||
614 | 608 | ||
615 | /********************************************************************** | 609 | /********************************************************************** |
616 | * SBMAC_MII_WRITE(s,phyaddr,regidx,regval) | 610 | * SBMAC_MII_WRITE(s,phyaddr,regidx,regval) |
617 | * | 611 | * |
618 | * Write a value to a PHY register. | 612 | * Write a value to a PHY register. |
619 | * | 613 | * |
620 | * Input parameters: | 614 | * Input parameters: |
621 | * s - sbmac structure | 615 | * s - sbmac structure |
622 | * phyaddr - PHY to use | 616 | * phyaddr - PHY to use |
623 | * regidx - register within the PHY | 617 | * regidx - register within the PHY |
624 | * regval - data to write to register | 618 | * regval - data to write to register |
625 | * | 619 | * |
626 | * Return value: | 620 | * Return value: |
627 | * nothing | 621 | * nothing |
628 | ********************************************************************* */ | 622 | ********************************************************************* */ |
@@ -633,7 +627,7 @@ static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx, | |||
633 | int mac_mdio_genc; | 627 | int mac_mdio_genc; |
634 | 628 | ||
635 | sbmac_mii_sync(s); | 629 | sbmac_mii_sync(s); |
636 | 630 | ||
637 | sbmac_mii_senddata(s,MII_COMMAND_START,2); | 631 | sbmac_mii_senddata(s,MII_COMMAND_START,2); |
638 | sbmac_mii_senddata(s,MII_COMMAND_WRITE,2); | 632 | sbmac_mii_senddata(s,MII_COMMAND_WRITE,2); |
639 | sbmac_mii_senddata(s,phyaddr, 5); | 633 | sbmac_mii_senddata(s,phyaddr, 5); |
@@ -641,27 +635,27 @@ static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx, | |||
641 | sbmac_mii_senddata(s,MII_COMMAND_ACK,2); | 635 | sbmac_mii_senddata(s,MII_COMMAND_ACK,2); |
642 | sbmac_mii_senddata(s,regval,16); | 636 | sbmac_mii_senddata(s,regval,16); |
643 | 637 | ||
644 | mac_mdio_genc = SBMAC_READCSR(s->sbm_mdio) & M_MAC_GENC; | 638 | mac_mdio_genc = __raw_readq(s->sbm_mdio) & M_MAC_GENC; |
645 | 639 | ||
646 | SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_OUTPUT | mac_mdio_genc); | 640 | __raw_writeq(M_MAC_MDIO_DIR_OUTPUT | mac_mdio_genc, s->sbm_mdio); |
647 | } | 641 | } |
648 | 642 | ||
649 | 643 | ||
650 | 644 | ||
651 | /********************************************************************** | 645 | /********************************************************************** |
652 | * SBDMA_INITCTX(d,s,chan,txrx,maxdescr) | 646 | * SBDMA_INITCTX(d,s,chan,txrx,maxdescr) |
653 | * | 647 | * |
654 | * Initialize a DMA channel context. Since there are potentially | 648 | * Initialize a DMA channel context. Since there are potentially |
655 | * eight DMA channels per MAC, it's nice to do this in a standard | 649 | * eight DMA channels per MAC, it's nice to do this in a standard |
656 | * way. | 650 | * way. |
657 | * | 651 | * |
658 | * Input parameters: | 652 | * Input parameters: |
659 | * d - sbmacdma_t structure (DMA channel context) | 653 | * d - sbmacdma_t structure (DMA channel context) |
660 | * s - sbmac_softc structure (pointer to a MAC) | 654 | * s - sbmac_softc structure (pointer to a MAC) |
661 | * chan - channel number (0..1 right now) | 655 | * chan - channel number (0..1 right now) |
662 | * txrx - Identifies DMA_TX or DMA_RX for channel direction | 656 | * txrx - Identifies DMA_TX or DMA_RX for channel direction |
663 | * maxdescr - number of descriptors | 657 | * maxdescr - number of descriptors |
664 | * | 658 | * |
665 | * Return value: | 659 | * Return value: |
666 | * nothing | 660 | * nothing |
667 | ********************************************************************* */ | 661 | ********************************************************************* */ |
@@ -672,101 +666,87 @@ static void sbdma_initctx(sbmacdma_t *d, | |||
672 | int txrx, | 666 | int txrx, |
673 | int maxdescr) | 667 | int maxdescr) |
674 | { | 668 | { |
675 | /* | 669 | /* |
676 | * Save away interesting stuff in the structure | 670 | * Save away interesting stuff in the structure |
677 | */ | 671 | */ |
678 | 672 | ||
679 | d->sbdma_eth = s; | 673 | d->sbdma_eth = s; |
680 | d->sbdma_channel = chan; | 674 | d->sbdma_channel = chan; |
681 | d->sbdma_txdir = txrx; | 675 | d->sbdma_txdir = txrx; |
682 | 676 | ||
683 | #if 0 | 677 | #if 0 |
684 | /* RMON clearing */ | 678 | /* RMON clearing */ |
685 | s->sbe_idx =(s->sbm_base - A_MAC_BASE_0)/MAC_SPACING; | 679 | s->sbe_idx =(s->sbm_base - A_MAC_BASE_0)/MAC_SPACING; |
686 | #endif | 680 | #endif |
687 | 681 | ||
688 | SBMAC_WRITECSR(IOADDR( | 682 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_BYTES))); |
689 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_BYTES)), 0); | 683 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_COLLISIONS))); |
690 | SBMAC_WRITECSR(IOADDR( | 684 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_LATE_COL))); |
691 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_COLLISIONS)), 0); | 685 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_EX_COL))); |
692 | SBMAC_WRITECSR(IOADDR( | 686 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_FCS_ERROR))); |
693 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_LATE_COL)), 0); | 687 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_ABORT))); |
694 | SBMAC_WRITECSR(IOADDR( | 688 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_BAD))); |
695 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_EX_COL)), 0); | 689 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_GOOD))); |
696 | SBMAC_WRITECSR(IOADDR( | 690 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_RUNT))); |
697 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_FCS_ERROR)), 0); | 691 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_OVERSIZE))); |
698 | SBMAC_WRITECSR(IOADDR( | 692 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BYTES))); |
699 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_ABORT)), 0); | 693 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_MCAST))); |
700 | SBMAC_WRITECSR(IOADDR( | 694 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BCAST))); |
701 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_BAD)), 0); | 695 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BAD))); |
702 | SBMAC_WRITECSR(IOADDR( | 696 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_GOOD))); |
703 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_GOOD)), 0); | 697 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_RUNT))); |
704 | SBMAC_WRITECSR(IOADDR( | 698 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_OVERSIZE))); |
705 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_RUNT)), 0); | 699 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_FCS_ERROR))); |
706 | SBMAC_WRITECSR(IOADDR( | 700 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_LENGTH_ERROR))); |
707 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_OVERSIZE)), 0); | 701 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_CODE_ERROR))); |
708 | SBMAC_WRITECSR(IOADDR( | 702 | __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_ALIGN_ERROR))); |
709 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BYTES)), 0); | 703 | |
710 | SBMAC_WRITECSR(IOADDR( | 704 | /* |
711 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_MCAST)), 0); | 705 | * initialize register pointers |
712 | SBMAC_WRITECSR(IOADDR( | 706 | */ |
713 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BCAST)), 0); | 707 | |
714 | SBMAC_WRITECSR(IOADDR( | 708 | d->sbdma_config0 = |
715 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BAD)), 0); | ||
716 | SBMAC_WRITECSR(IOADDR( | ||
717 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_GOOD)), 0); | ||
718 | SBMAC_WRITECSR(IOADDR( | ||
719 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_RUNT)), 0); | ||
720 | SBMAC_WRITECSR(IOADDR( | ||
721 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_OVERSIZE)), 0); | ||
722 | SBMAC_WRITECSR(IOADDR( | ||
723 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_FCS_ERROR)), 0); | ||
724 | SBMAC_WRITECSR(IOADDR( | ||
725 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_LENGTH_ERROR)), 0); | ||
726 | SBMAC_WRITECSR(IOADDR( | ||
727 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_CODE_ERROR)), 0); | ||
728 | SBMAC_WRITECSR(IOADDR( | ||
729 | A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_ALIGN_ERROR)), 0); | ||
730 | |||
731 | /* | ||
732 | * initialize register pointers | ||
733 | */ | ||
734 | |||
735 | d->sbdma_config0 = | ||
736 | s->sbm_base + R_MAC_DMA_REGISTER(txrx,chan,R_MAC_DMA_CONFIG0); | 709 | s->sbm_base + R_MAC_DMA_REGISTER(txrx,chan,R_MAC_DMA_CONFIG0); |
737 | d->sbdma_config1 = | 710 | d->sbdma_config1 = |
738 | s->sbm_base + R_MAC_DMA_REGISTER(txrx,chan,R_MAC_DMA_CONFIG1); | 711 | s->sbm_base + R_MAC_DMA_REGISTER(txrx,chan,R_MAC_DMA_CONFIG1); |
739 | d->sbdma_dscrbase = | 712 | d->sbdma_dscrbase = |
740 | s->sbm_base + R_MAC_DMA_REGISTER(txrx,chan,R_MAC_DMA_DSCR_BASE); | 713 | s->sbm_base + R_MAC_DMA_REGISTER(txrx,chan,R_MAC_DMA_DSCR_BASE); |
741 | d->sbdma_dscrcnt = | 714 | d->sbdma_dscrcnt = |
742 | s->sbm_base + R_MAC_DMA_REGISTER(txrx,chan,R_MAC_DMA_DSCR_CNT); | 715 | s->sbm_base + R_MAC_DMA_REGISTER(txrx,chan,R_MAC_DMA_DSCR_CNT); |
743 | d->sbdma_curdscr = | 716 | d->sbdma_curdscr = |
744 | s->sbm_base + R_MAC_DMA_REGISTER(txrx,chan,R_MAC_DMA_CUR_DSCRADDR); | 717 | s->sbm_base + R_MAC_DMA_REGISTER(txrx,chan,R_MAC_DMA_CUR_DSCRADDR); |
745 | 718 | ||
746 | /* | 719 | /* |
747 | * Allocate memory for the ring | 720 | * Allocate memory for the ring |
748 | */ | 721 | */ |
749 | 722 | ||
750 | d->sbdma_maxdescr = maxdescr; | 723 | d->sbdma_maxdescr = maxdescr; |
751 | 724 | ||
752 | d->sbdma_dscrtable = (sbdmadscr_t *) | 725 | d->sbdma_dscrtable = (sbdmadscr_t *) |
753 | kmalloc(d->sbdma_maxdescr*sizeof(sbdmadscr_t), GFP_KERNEL); | 726 | kmalloc((d->sbdma_maxdescr+1)*sizeof(sbdmadscr_t), GFP_KERNEL); |
754 | 727 | ||
728 | /* | ||
729 | * The descriptor table must be aligned to at least 16 bytes or the | ||
730 | * MAC will corrupt it. | ||
731 | */ | ||
732 | d->sbdma_dscrtable = (sbdmadscr_t *) | ||
733 | ALIGN((unsigned long)d->sbdma_dscrtable, sizeof(sbdmadscr_t)); | ||
734 | |||
755 | memset(d->sbdma_dscrtable,0,d->sbdma_maxdescr*sizeof(sbdmadscr_t)); | 735 | memset(d->sbdma_dscrtable,0,d->sbdma_maxdescr*sizeof(sbdmadscr_t)); |
756 | 736 | ||
757 | d->sbdma_dscrtable_end = d->sbdma_dscrtable + d->sbdma_maxdescr; | 737 | d->sbdma_dscrtable_end = d->sbdma_dscrtable + d->sbdma_maxdescr; |
758 | 738 | ||
759 | d->sbdma_dscrtable_phys = virt_to_phys(d->sbdma_dscrtable); | 739 | d->sbdma_dscrtable_phys = virt_to_phys(d->sbdma_dscrtable); |
760 | 740 | ||
761 | /* | 741 | /* |
762 | * And context table | 742 | * And context table |
763 | */ | 743 | */ |
764 | 744 | ||
765 | d->sbdma_ctxtable = (struct sk_buff **) | 745 | d->sbdma_ctxtable = (struct sk_buff **) |
766 | kmalloc(d->sbdma_maxdescr*sizeof(struct sk_buff *), GFP_KERNEL); | 746 | kmalloc(d->sbdma_maxdescr*sizeof(struct sk_buff *), GFP_KERNEL); |
767 | 747 | ||
768 | memset(d->sbdma_ctxtable,0,d->sbdma_maxdescr*sizeof(struct sk_buff *)); | 748 | memset(d->sbdma_ctxtable,0,d->sbdma_maxdescr*sizeof(struct sk_buff *)); |
769 | 749 | ||
770 | #ifdef CONFIG_SBMAC_COALESCE | 750 | #ifdef CONFIG_SBMAC_COALESCE |
771 | /* | 751 | /* |
772 | * Setup Rx/Tx DMA coalescing defaults | 752 | * Setup Rx/Tx DMA coalescing defaults |
@@ -777,7 +757,7 @@ static void sbdma_initctx(sbmacdma_t *d, | |||
777 | } else { | 757 | } else { |
778 | d->sbdma_int_pktcnt = 1; | 758 | d->sbdma_int_pktcnt = 1; |
779 | } | 759 | } |
780 | 760 | ||
781 | if ( int_timeout ) { | 761 | if ( int_timeout ) { |
782 | d->sbdma_int_timeout = int_timeout; | 762 | d->sbdma_int_timeout = int_timeout; |
783 | } else { | 763 | } else { |
@@ -789,13 +769,13 @@ static void sbdma_initctx(sbmacdma_t *d, | |||
789 | 769 | ||
790 | /********************************************************************** | 770 | /********************************************************************** |
791 | * SBDMA_CHANNEL_START(d) | 771 | * SBDMA_CHANNEL_START(d) |
792 | * | 772 | * |
793 | * Initialize the hardware registers for a DMA channel. | 773 | * Initialize the hardware registers for a DMA channel. |
794 | * | 774 | * |
795 | * Input parameters: | 775 | * Input parameters: |
796 | * d - DMA channel to init (context must be previously init'd | 776 | * d - DMA channel to init (context must be previously init'd |
797 | * rxtx - DMA_RX or DMA_TX depending on what type of channel | 777 | * rxtx - DMA_RX or DMA_TX depending on what type of channel |
798 | * | 778 | * |
799 | * Return value: | 779 | * Return value: |
800 | * nothing | 780 | * nothing |
801 | ********************************************************************* */ | 781 | ********************************************************************* */ |
@@ -805,24 +785,21 @@ static void sbdma_channel_start(sbmacdma_t *d, int rxtx ) | |||
805 | /* | 785 | /* |
806 | * Turn on the DMA channel | 786 | * Turn on the DMA channel |
807 | */ | 787 | */ |
808 | 788 | ||
809 | #ifdef CONFIG_SBMAC_COALESCE | 789 | #ifdef CONFIG_SBMAC_COALESCE |
810 | SBMAC_WRITECSR(d->sbdma_config1, | 790 | __raw_writeq(V_DMA_INT_TIMEOUT(d->sbdma_int_timeout) | |
811 | V_DMA_INT_TIMEOUT(d->sbdma_int_timeout) | | 791 | 0, d->sbdma_config1); |
812 | 0); | 792 | __raw_writeq(M_DMA_EOP_INT_EN | |
813 | SBMAC_WRITECSR(d->sbdma_config0, | ||
814 | M_DMA_EOP_INT_EN | | ||
815 | V_DMA_RINGSZ(d->sbdma_maxdescr) | | 793 | V_DMA_RINGSZ(d->sbdma_maxdescr) | |
816 | V_DMA_INT_PKTCNT(d->sbdma_int_pktcnt) | | 794 | V_DMA_INT_PKTCNT(d->sbdma_int_pktcnt) | |
817 | 0); | 795 | 0, d->sbdma_config0); |
818 | #else | 796 | #else |
819 | SBMAC_WRITECSR(d->sbdma_config1,0); | 797 | __raw_writeq(0, d->sbdma_config1); |
820 | SBMAC_WRITECSR(d->sbdma_config0, | 798 | __raw_writeq(V_DMA_RINGSZ(d->sbdma_maxdescr) | |
821 | V_DMA_RINGSZ(d->sbdma_maxdescr) | | 799 | 0, d->sbdma_config0); |
822 | 0); | ||
823 | #endif | 800 | #endif |
824 | 801 | ||
825 | SBMAC_WRITECSR(d->sbdma_dscrbase,d->sbdma_dscrtable_phys); | 802 | __raw_writeq(d->sbdma_dscrtable_phys, d->sbdma_dscrbase); |
826 | 803 | ||
827 | /* | 804 | /* |
828 | * Initialize ring pointers | 805 | * Initialize ring pointers |
@@ -834,12 +811,12 @@ static void sbdma_channel_start(sbmacdma_t *d, int rxtx ) | |||
834 | 811 | ||
835 | /********************************************************************** | 812 | /********************************************************************** |
836 | * SBDMA_CHANNEL_STOP(d) | 813 | * SBDMA_CHANNEL_STOP(d) |
837 | * | 814 | * |
838 | * Initialize the hardware registers for a DMA channel. | 815 | * Initialize the hardware registers for a DMA channel. |
839 | * | 816 | * |
840 | * Input parameters: | 817 | * Input parameters: |
841 | * d - DMA channel to init (context must be previously init'd | 818 | * d - DMA channel to init (context must be previously init'd |
842 | * | 819 | * |
843 | * Return value: | 820 | * Return value: |
844 | * nothing | 821 | * nothing |
845 | ********************************************************************* */ | 822 | ********************************************************************* */ |
@@ -849,44 +826,44 @@ static void sbdma_channel_stop(sbmacdma_t *d) | |||
849 | /* | 826 | /* |
850 | * Turn off the DMA channel | 827 | * Turn off the DMA channel |
851 | */ | 828 | */ |
852 | 829 | ||
853 | SBMAC_WRITECSR(d->sbdma_config1,0); | 830 | __raw_writeq(0, d->sbdma_config1); |
854 | 831 | ||
855 | SBMAC_WRITECSR(d->sbdma_dscrbase,0); | 832 | __raw_writeq(0, d->sbdma_dscrbase); |
856 | 833 | ||
857 | SBMAC_WRITECSR(d->sbdma_config0,0); | 834 | __raw_writeq(0, d->sbdma_config0); |
858 | 835 | ||
859 | /* | 836 | /* |
860 | * Zero ring pointers | 837 | * Zero ring pointers |
861 | */ | 838 | */ |
862 | 839 | ||
863 | d->sbdma_addptr = 0; | 840 | d->sbdma_addptr = NULL; |
864 | d->sbdma_remptr = 0; | 841 | d->sbdma_remptr = NULL; |
865 | } | 842 | } |
866 | 843 | ||
867 | static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset) | 844 | static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset) |
868 | { | 845 | { |
869 | unsigned long addr; | 846 | unsigned long addr; |
870 | unsigned long newaddr; | 847 | unsigned long newaddr; |
871 | 848 | ||
872 | addr = (unsigned long) skb->data; | 849 | addr = (unsigned long) skb->data; |
873 | 850 | ||
874 | newaddr = (addr + power2 - 1) & ~(power2 - 1); | 851 | newaddr = (addr + power2 - 1) & ~(power2 - 1); |
875 | 852 | ||
876 | skb_reserve(skb,newaddr-addr+offset); | 853 | skb_reserve(skb,newaddr-addr+offset); |
877 | } | 854 | } |
878 | 855 | ||
879 | 856 | ||
880 | /********************************************************************** | 857 | /********************************************************************** |
881 | * SBDMA_ADD_RCVBUFFER(d,sb) | 858 | * SBDMA_ADD_RCVBUFFER(d,sb) |
882 | * | 859 | * |
883 | * Add a buffer to the specified DMA channel. For receive channels, | 860 | * Add a buffer to the specified DMA channel. For receive channels, |
884 | * this queues a buffer for inbound packets. | 861 | * this queues a buffer for inbound packets. |
885 | * | 862 | * |
886 | * Input parameters: | 863 | * Input parameters: |
887 | * d - DMA channel descriptor | 864 | * d - DMA channel descriptor |
888 | * sb - sk_buff to add, or NULL if we should allocate one | 865 | * sb - sk_buff to add, or NULL if we should allocate one |
889 | * | 866 | * |
890 | * Return value: | 867 | * Return value: |
891 | * 0 if buffer could not be added (ring is full) | 868 | * 0 if buffer could not be added (ring is full) |
892 | * 1 if buffer added successfully | 869 | * 1 if buffer added successfully |
@@ -899,24 +876,24 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb) | |||
899 | sbdmadscr_t *nextdsc; | 876 | sbdmadscr_t *nextdsc; |
900 | struct sk_buff *sb_new = NULL; | 877 | struct sk_buff *sb_new = NULL; |
901 | int pktsize = ENET_PACKET_SIZE; | 878 | int pktsize = ENET_PACKET_SIZE; |
902 | 879 | ||
903 | /* get pointer to our current place in the ring */ | 880 | /* get pointer to our current place in the ring */ |
904 | 881 | ||
905 | dsc = d->sbdma_addptr; | 882 | dsc = d->sbdma_addptr; |
906 | nextdsc = SBDMA_NEXTBUF(d,sbdma_addptr); | 883 | nextdsc = SBDMA_NEXTBUF(d,sbdma_addptr); |
907 | 884 | ||
908 | /* | 885 | /* |
909 | * figure out if the ring is full - if the next descriptor | 886 | * figure out if the ring is full - if the next descriptor |
910 | * is the same as the one that we're going to remove from | 887 | * is the same as the one that we're going to remove from |
911 | * the ring, the ring is full | 888 | * the ring, the ring is full |
912 | */ | 889 | */ |
913 | 890 | ||
914 | if (nextdsc == d->sbdma_remptr) { | 891 | if (nextdsc == d->sbdma_remptr) { |
915 | return -ENOSPC; | 892 | return -ENOSPC; |
916 | } | 893 | } |
917 | 894 | ||
918 | /* | 895 | /* |
919 | * Allocate a sk_buff if we don't already have one. | 896 | * Allocate a sk_buff if we don't already have one. |
920 | * If we do have an sk_buff, reset it so that it's empty. | 897 | * If we do have an sk_buff, reset it so that it's empty. |
921 | * | 898 | * |
922 | * Note: sk_buffs don't seem to be guaranteed to have any sort | 899 | * Note: sk_buffs don't seem to be guaranteed to have any sort |
@@ -925,7 +902,7 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb) | |||
925 | * | 902 | * |
926 | * 1. the data does not start in the middle of a cache line. | 903 | * 1. the data does not start in the middle of a cache line. |
927 | * 2. The data does not end in the middle of a cache line | 904 | * 2. The data does not end in the middle of a cache line |
928 | * 3. The buffer can be aligned such that the IP addresses are | 905 | * 3. The buffer can be aligned such that the IP addresses are |
929 | * naturally aligned. | 906 | * naturally aligned. |
930 | * | 907 | * |
931 | * Remember, the SOCs MAC writes whole cache lines at a time, | 908 | * Remember, the SOCs MAC writes whole cache lines at a time, |
@@ -933,7 +910,7 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb) | |||
933 | * data portion starts in the middle of a cache line, the SOC | 910 | * data portion starts in the middle of a cache line, the SOC |
934 | * DMA will trash the beginning (and ending) portions. | 911 | * DMA will trash the beginning (and ending) portions. |
935 | */ | 912 | */ |
936 | 913 | ||
937 | if (sb == NULL) { | 914 | if (sb == NULL) { |
938 | sb_new = dev_alloc_skb(ENET_PACKET_SIZE + SMP_CACHE_BYTES * 2 + ETHER_ALIGN); | 915 | sb_new = dev_alloc_skb(ENET_PACKET_SIZE + SMP_CACHE_BYTES * 2 + ETHER_ALIGN); |
939 | if (sb_new == NULL) { | 916 | if (sb_new == NULL) { |
@@ -949,23 +926,22 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb) | |||
949 | } | 926 | } |
950 | else { | 927 | else { |
951 | sb_new = sb; | 928 | sb_new = sb; |
952 | /* | 929 | /* |
953 | * nothing special to reinit buffer, it's already aligned | 930 | * nothing special to reinit buffer, it's already aligned |
954 | * and sb->data already points to a good place. | 931 | * and sb->data already points to a good place. |
955 | */ | 932 | */ |
956 | } | 933 | } |
957 | 934 | ||
958 | /* | 935 | /* |
959 | * fill in the descriptor | 936 | * fill in the descriptor |
960 | */ | 937 | */ |
961 | 938 | ||
962 | #ifdef CONFIG_SBMAC_COALESCE | 939 | #ifdef CONFIG_SBMAC_COALESCE |
963 | /* | 940 | /* |
964 | * Do not interrupt per DMA transfer. | 941 | * Do not interrupt per DMA transfer. |
965 | */ | 942 | */ |
966 | dsc->dscr_a = virt_to_phys(sb_new->data) | | 943 | dsc->dscr_a = virt_to_phys(sb_new->data) | |
967 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | | 944 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 0; |
968 | 0; | ||
969 | #else | 945 | #else |
970 | dsc->dscr_a = virt_to_phys(sb_new->data) | | 946 | dsc->dscr_a = virt_to_phys(sb_new->data) | |
971 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | | 947 | V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | |
@@ -974,38 +950,38 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb) | |||
974 | 950 | ||
975 | /* receiving: no options */ | 951 | /* receiving: no options */ |
976 | dsc->dscr_b = 0; | 952 | dsc->dscr_b = 0; |
977 | 953 | ||
978 | /* | 954 | /* |
979 | * fill in the context | 955 | * fill in the context |
980 | */ | 956 | */ |
981 | 957 | ||
982 | d->sbdma_ctxtable[dsc-d->sbdma_dscrtable] = sb_new; | 958 | d->sbdma_ctxtable[dsc-d->sbdma_dscrtable] = sb_new; |
983 | 959 | ||
984 | /* | 960 | /* |
985 | * point at next packet | 961 | * point at next packet |
986 | */ | 962 | */ |
987 | 963 | ||
988 | d->sbdma_addptr = nextdsc; | 964 | d->sbdma_addptr = nextdsc; |
989 | 965 | ||
990 | /* | 966 | /* |
991 | * Give the buffer to the DMA engine. | 967 | * Give the buffer to the DMA engine. |
992 | */ | 968 | */ |
993 | 969 | ||
994 | SBMAC_WRITECSR(d->sbdma_dscrcnt,1); | 970 | __raw_writeq(1, d->sbdma_dscrcnt); |
995 | 971 | ||
996 | return 0; /* we did it */ | 972 | return 0; /* we did it */ |
997 | } | 973 | } |
998 | 974 | ||
999 | /********************************************************************** | 975 | /********************************************************************** |
1000 | * SBDMA_ADD_TXBUFFER(d,sb) | 976 | * SBDMA_ADD_TXBUFFER(d,sb) |
1001 | * | 977 | * |
1002 | * Add a transmit buffer to the specified DMA channel, causing a | 978 | * Add a transmit buffer to the specified DMA channel, causing a |
1003 | * transmit to start. | 979 | * transmit to start. |
1004 | * | 980 | * |
1005 | * Input parameters: | 981 | * Input parameters: |
1006 | * d - DMA channel descriptor | 982 | * d - DMA channel descriptor |
1007 | * sb - sk_buff to add | 983 | * sb - sk_buff to add |
1008 | * | 984 | * |
1009 | * Return value: | 985 | * Return value: |
1010 | * 0 transmit queued successfully | 986 | * 0 transmit queued successfully |
1011 | * otherwise error code | 987 | * otherwise error code |
@@ -1019,70 +995,70 @@ static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *sb) | |||
1019 | uint64_t phys; | 995 | uint64_t phys; |
1020 | uint64_t ncb; | 996 | uint64_t ncb; |
1021 | int length; | 997 | int length; |
1022 | 998 | ||
1023 | /* get pointer to our current place in the ring */ | 999 | /* get pointer to our current place in the ring */ |
1024 | 1000 | ||
1025 | dsc = d->sbdma_addptr; | 1001 | dsc = d->sbdma_addptr; |
1026 | nextdsc = SBDMA_NEXTBUF(d,sbdma_addptr); | 1002 | nextdsc = SBDMA_NEXTBUF(d,sbdma_addptr); |
1027 | 1003 | ||
1028 | /* | 1004 | /* |
1029 | * figure out if the ring is full - if the next descriptor | 1005 | * figure out if the ring is full - if the next descriptor |
1030 | * is the same as the one that we're going to remove from | 1006 | * is the same as the one that we're going to remove from |
1031 | * the ring, the ring is full | 1007 | * the ring, the ring is full |
1032 | */ | 1008 | */ |
1033 | 1009 | ||
1034 | if (nextdsc == d->sbdma_remptr) { | 1010 | if (nextdsc == d->sbdma_remptr) { |
1035 | return -ENOSPC; | 1011 | return -ENOSPC; |
1036 | } | 1012 | } |
1037 | 1013 | ||
1038 | /* | 1014 | /* |
1039 | * Under Linux, it's not necessary to copy/coalesce buffers | 1015 | * Under Linux, it's not necessary to copy/coalesce buffers |
1040 | * like it is on NetBSD. We think they're all contiguous, | 1016 | * like it is on NetBSD. We think they're all contiguous, |
1041 | * but that may not be true for GBE. | 1017 | * but that may not be true for GBE. |
1042 | */ | 1018 | */ |
1043 | 1019 | ||
1044 | length = sb->len; | 1020 | length = sb->len; |
1045 | 1021 | ||
1046 | /* | 1022 | /* |
1047 | * fill in the descriptor. Note that the number of cache | 1023 | * fill in the descriptor. Note that the number of cache |
1048 | * blocks in the descriptor is the number of blocks | 1024 | * blocks in the descriptor is the number of blocks |
1049 | * *spanned*, so we need to add in the offset (if any) | 1025 | * *spanned*, so we need to add in the offset (if any) |
1050 | * while doing the calculation. | 1026 | * while doing the calculation. |
1051 | */ | 1027 | */ |
1052 | 1028 | ||
1053 | phys = virt_to_phys(sb->data); | 1029 | phys = virt_to_phys(sb->data); |
1054 | ncb = NUMCACHEBLKS(length+(phys & (SMP_CACHE_BYTES - 1))); | 1030 | ncb = NUMCACHEBLKS(length+(phys & (SMP_CACHE_BYTES - 1))); |
1055 | 1031 | ||
1056 | dsc->dscr_a = phys | | 1032 | dsc->dscr_a = phys | |
1057 | V_DMA_DSCRA_A_SIZE(ncb) | | 1033 | V_DMA_DSCRA_A_SIZE(ncb) | |
1058 | #ifndef CONFIG_SBMAC_COALESCE | 1034 | #ifndef CONFIG_SBMAC_COALESCE |
1059 | M_DMA_DSCRA_INTERRUPT | | 1035 | M_DMA_DSCRA_INTERRUPT | |
1060 | #endif | 1036 | #endif |
1061 | M_DMA_ETHTX_SOP; | 1037 | M_DMA_ETHTX_SOP; |
1062 | 1038 | ||
1063 | /* transmitting: set outbound options and length */ | 1039 | /* transmitting: set outbound options and length */ |
1064 | 1040 | ||
1065 | dsc->dscr_b = V_DMA_DSCRB_OPTIONS(K_DMA_ETHTX_APPENDCRC_APPENDPAD) | | 1041 | dsc->dscr_b = V_DMA_DSCRB_OPTIONS(K_DMA_ETHTX_APPENDCRC_APPENDPAD) | |
1066 | V_DMA_DSCRB_PKT_SIZE(length); | 1042 | V_DMA_DSCRB_PKT_SIZE(length); |
1067 | 1043 | ||
1068 | /* | 1044 | /* |
1069 | * fill in the context | 1045 | * fill in the context |
1070 | */ | 1046 | */ |
1071 | 1047 | ||
1072 | d->sbdma_ctxtable[dsc-d->sbdma_dscrtable] = sb; | 1048 | d->sbdma_ctxtable[dsc-d->sbdma_dscrtable] = sb; |
1073 | 1049 | ||
1074 | /* | 1050 | /* |
1075 | * point at next packet | 1051 | * point at next packet |
1076 | */ | 1052 | */ |
1077 | 1053 | ||
1078 | d->sbdma_addptr = nextdsc; | 1054 | d->sbdma_addptr = nextdsc; |
1079 | 1055 | ||
1080 | /* | 1056 | /* |
1081 | * Give the buffer to the DMA engine. | 1057 | * Give the buffer to the DMA engine. |
1082 | */ | 1058 | */ |
1083 | 1059 | ||
1084 | SBMAC_WRITECSR(d->sbdma_dscrcnt,1); | 1060 | __raw_writeq(1, d->sbdma_dscrcnt); |
1085 | 1061 | ||
1086 | return 0; /* we did it */ | 1062 | return 0; /* we did it */ |
1087 | } | 1063 | } |
1088 | 1064 | ||
@@ -1091,12 +1067,12 @@ static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *sb) | |||
1091 | 1067 | ||
1092 | /********************************************************************** | 1068 | /********************************************************************** |
1093 | * SBDMA_EMPTYRING(d) | 1069 | * SBDMA_EMPTYRING(d) |
1094 | * | 1070 | * |
1095 | * Free all allocated sk_buffs on the specified DMA channel; | 1071 | * Free all allocated sk_buffs on the specified DMA channel; |
1096 | * | 1072 | * |
1097 | * Input parameters: | 1073 | * Input parameters: |
1098 | * d - DMA channel | 1074 | * d - DMA channel |
1099 | * | 1075 | * |
1100 | * Return value: | 1076 | * Return value: |
1101 | * nothing | 1077 | * nothing |
1102 | ********************************************************************* */ | 1078 | ********************************************************************* */ |
@@ -1105,7 +1081,7 @@ static void sbdma_emptyring(sbmacdma_t *d) | |||
1105 | { | 1081 | { |
1106 | int idx; | 1082 | int idx; |
1107 | struct sk_buff *sb; | 1083 | struct sk_buff *sb; |
1108 | 1084 | ||
1109 | for (idx = 0; idx < d->sbdma_maxdescr; idx++) { | 1085 | for (idx = 0; idx < d->sbdma_maxdescr; idx++) { |
1110 | sb = d->sbdma_ctxtable[idx]; | 1086 | sb = d->sbdma_ctxtable[idx]; |
1111 | if (sb) { | 1087 | if (sb) { |
@@ -1118,13 +1094,13 @@ static void sbdma_emptyring(sbmacdma_t *d) | |||
1118 | 1094 | ||
1119 | /********************************************************************** | 1095 | /********************************************************************** |
1120 | * SBDMA_FILLRING(d) | 1096 | * SBDMA_FILLRING(d) |
1121 | * | 1097 | * |
1122 | * Fill the specified DMA channel (must be receive channel) | 1098 | * Fill the specified DMA channel (must be receive channel) |
1123 | * with sk_buffs | 1099 | * with sk_buffs |
1124 | * | 1100 | * |
1125 | * Input parameters: | 1101 | * Input parameters: |
1126 | * d - DMA channel | 1102 | * d - DMA channel |
1127 | * | 1103 | * |
1128 | * Return value: | 1104 | * Return value: |
1129 | * nothing | 1105 | * nothing |
1130 | ********************************************************************* */ | 1106 | ********************************************************************* */ |
@@ -1132,7 +1108,7 @@ static void sbdma_emptyring(sbmacdma_t *d) | |||
1132 | static void sbdma_fillring(sbmacdma_t *d) | 1108 | static void sbdma_fillring(sbmacdma_t *d) |
1133 | { | 1109 | { |
1134 | int idx; | 1110 | int idx; |
1135 | 1111 | ||
1136 | for (idx = 0; idx < SBMAC_MAX_RXDESCR-1; idx++) { | 1112 | for (idx = 0; idx < SBMAC_MAX_RXDESCR-1; idx++) { |
1137 | if (sbdma_add_rcvbuffer(d,NULL) != 0) | 1113 | if (sbdma_add_rcvbuffer(d,NULL) != 0) |
1138 | break; | 1114 | break; |
@@ -1142,16 +1118,16 @@ static void sbdma_fillring(sbmacdma_t *d) | |||
1142 | 1118 | ||
1143 | /********************************************************************** | 1119 | /********************************************************************** |
1144 | * SBDMA_RX_PROCESS(sc,d) | 1120 | * SBDMA_RX_PROCESS(sc,d) |
1145 | * | 1121 | * |
1146 | * Process "completed" receive buffers on the specified DMA channel. | 1122 | * Process "completed" receive buffers on the specified DMA channel. |
1147 | * Note that this isn't really ideal for priority channels, since | 1123 | * Note that this isn't really ideal for priority channels, since |
1148 | * it processes all of the packets on a given channel before | 1124 | * it processes all of the packets on a given channel before |
1149 | * returning. | 1125 | * returning. |
1150 | * | 1126 | * |
1151 | * Input parameters: | 1127 | * Input parameters: |
1152 | * sc - softc structure | 1128 | * sc - softc structure |
1153 | * d - DMA channel context | 1129 | * d - DMA channel context |
1154 | * | 1130 | * |
1155 | * Return value: | 1131 | * Return value: |
1156 | * nothing | 1132 | * nothing |
1157 | ********************************************************************* */ | 1133 | ********************************************************************* */ |
@@ -1163,56 +1139,56 @@ static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d) | |||
1163 | sbdmadscr_t *dsc; | 1139 | sbdmadscr_t *dsc; |
1164 | struct sk_buff *sb; | 1140 | struct sk_buff *sb; |
1165 | int len; | 1141 | int len; |
1166 | 1142 | ||
1167 | for (;;) { | 1143 | for (;;) { |
1168 | /* | 1144 | /* |
1169 | * figure out where we are (as an index) and where | 1145 | * figure out where we are (as an index) and where |
1170 | * the hardware is (also as an index) | 1146 | * the hardware is (also as an index) |
1171 | * | 1147 | * |
1172 | * This could be done faster if (for example) the | 1148 | * This could be done faster if (for example) the |
1173 | * descriptor table was page-aligned and contiguous in | 1149 | * descriptor table was page-aligned and contiguous in |
1174 | * both virtual and physical memory -- you could then | 1150 | * both virtual and physical memory -- you could then |
1175 | * just compare the low-order bits of the virtual address | 1151 | * just compare the low-order bits of the virtual address |
1176 | * (sbdma_remptr) and the physical address (sbdma_curdscr CSR) | 1152 | * (sbdma_remptr) and the physical address (sbdma_curdscr CSR) |
1177 | */ | 1153 | */ |
1178 | 1154 | ||
1179 | curidx = d->sbdma_remptr - d->sbdma_dscrtable; | 1155 | curidx = d->sbdma_remptr - d->sbdma_dscrtable; |
1180 | hwidx = (int) (((SBMAC_READCSR(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - | 1156 | hwidx = (int) (((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - |
1181 | d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); | 1157 | d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); |
1182 | 1158 | ||
1183 | /* | 1159 | /* |
1184 | * If they're the same, that means we've processed all | 1160 | * If they're the same, that means we've processed all |
1185 | * of the descriptors up to (but not including) the one that | 1161 | * of the descriptors up to (but not including) the one that |
1186 | * the hardware is working on right now. | 1162 | * the hardware is working on right now. |
1187 | */ | 1163 | */ |
1188 | 1164 | ||
1189 | if (curidx == hwidx) | 1165 | if (curidx == hwidx) |
1190 | break; | 1166 | break; |
1191 | 1167 | ||
1192 | /* | 1168 | /* |
1193 | * Otherwise, get the packet's sk_buff ptr back | 1169 | * Otherwise, get the packet's sk_buff ptr back |
1194 | */ | 1170 | */ |
1195 | 1171 | ||
1196 | dsc = &(d->sbdma_dscrtable[curidx]); | 1172 | dsc = &(d->sbdma_dscrtable[curidx]); |
1197 | sb = d->sbdma_ctxtable[curidx]; | 1173 | sb = d->sbdma_ctxtable[curidx]; |
1198 | d->sbdma_ctxtable[curidx] = NULL; | 1174 | d->sbdma_ctxtable[curidx] = NULL; |
1199 | 1175 | ||
1200 | len = (int)G_DMA_DSCRB_PKT_SIZE(dsc->dscr_b) - 4; | 1176 | len = (int)G_DMA_DSCRB_PKT_SIZE(dsc->dscr_b) - 4; |
1201 | 1177 | ||
1202 | /* | 1178 | /* |
1203 | * Check packet status. If good, process it. | 1179 | * Check packet status. If good, process it. |
1204 | * If not, silently drop it and put it back on the | 1180 | * If not, silently drop it and put it back on the |
1205 | * receive ring. | 1181 | * receive ring. |
1206 | */ | 1182 | */ |
1207 | 1183 | ||
1208 | if (!(dsc->dscr_a & M_DMA_ETHRX_BAD)) { | 1184 | if (!(dsc->dscr_a & M_DMA_ETHRX_BAD)) { |
1209 | 1185 | ||
1210 | /* | 1186 | /* |
1211 | * Add a new buffer to replace the old one. If we fail | 1187 | * Add a new buffer to replace the old one. If we fail |
1212 | * to allocate a buffer, we're going to drop this | 1188 | * to allocate a buffer, we're going to drop this |
1213 | * packet and put it right back on the receive ring. | 1189 | * packet and put it right back on the receive ring. |
1214 | */ | 1190 | */ |
1215 | 1191 | ||
1216 | if (sbdma_add_rcvbuffer(d,NULL) == -ENOBUFS) { | 1192 | if (sbdma_add_rcvbuffer(d,NULL) == -ENOBUFS) { |
1217 | sc->sbm_stats.rx_dropped++; | 1193 | sc->sbm_stats.rx_dropped++; |
1218 | sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */ | 1194 | sbdma_add_rcvbuffer(d,sb); /* re-add old buffer */ |
@@ -1221,7 +1197,7 @@ static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d) | |||
1221 | * Set length into the packet | 1197 | * Set length into the packet |
1222 | */ | 1198 | */ |
1223 | skb_put(sb,len); | 1199 | skb_put(sb,len); |
1224 | 1200 | ||
1225 | /* | 1201 | /* |
1226 | * Buffer has been replaced on the | 1202 | * Buffer has been replaced on the |
1227 | * receive ring. Pass the buffer to | 1203 | * receive ring. Pass the buffer to |
@@ -1240,7 +1216,7 @@ static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d) | |||
1240 | sb->ip_summed = CHECKSUM_NONE; | 1216 | sb->ip_summed = CHECKSUM_NONE; |
1241 | } | 1217 | } |
1242 | } | 1218 | } |
1243 | 1219 | ||
1244 | netif_rx(sb); | 1220 | netif_rx(sb); |
1245 | } | 1221 | } |
1246 | } else { | 1222 | } else { |
@@ -1251,14 +1227,14 @@ static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d) | |||
1251 | sc->sbm_stats.rx_errors++; | 1227 | sc->sbm_stats.rx_errors++; |
1252 | sbdma_add_rcvbuffer(d,sb); | 1228 | sbdma_add_rcvbuffer(d,sb); |
1253 | } | 1229 | } |
1254 | 1230 | ||
1255 | 1231 | ||
1256 | /* | 1232 | /* |
1257 | * .. and advance to the next buffer. | 1233 | * .. and advance to the next buffer. |
1258 | */ | 1234 | */ |
1259 | 1235 | ||
1260 | d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); | 1236 | d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); |
1261 | 1237 | ||
1262 | } | 1238 | } |
1263 | } | 1239 | } |
1264 | 1240 | ||
@@ -1266,17 +1242,17 @@ static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d) | |||
1266 | 1242 | ||
1267 | /********************************************************************** | 1243 | /********************************************************************** |
1268 | * SBDMA_TX_PROCESS(sc,d) | 1244 | * SBDMA_TX_PROCESS(sc,d) |
1269 | * | 1245 | * |
1270 | * Process "completed" transmit buffers on the specified DMA channel. | 1246 | * Process "completed" transmit buffers on the specified DMA channel. |
1271 | * This is normally called within the interrupt service routine. | 1247 | * This is normally called within the interrupt service routine. |
1272 | * Note that this isn't really ideal for priority channels, since | 1248 | * Note that this isn't really ideal for priority channels, since |
1273 | * it processes all of the packets on a given channel before | 1249 | * it processes all of the packets on a given channel before |
1274 | * returning. | 1250 | * returning. |
1275 | * | 1251 | * |
1276 | * Input parameters: | 1252 | * Input parameters: |
1277 | * sc - softc structure | 1253 | * sc - softc structure |
1278 | * d - DMA channel context | 1254 | * d - DMA channel context |
1279 | * | 1255 | * |
1280 | * Return value: | 1256 | * Return value: |
1281 | * nothing | 1257 | * nothing |
1282 | ********************************************************************* */ | 1258 | ********************************************************************* */ |
@@ -1290,21 +1266,21 @@ static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d) | |||
1290 | unsigned long flags; | 1266 | unsigned long flags; |
1291 | 1267 | ||
1292 | spin_lock_irqsave(&(sc->sbm_lock), flags); | 1268 | spin_lock_irqsave(&(sc->sbm_lock), flags); |
1293 | 1269 | ||
1294 | for (;;) { | 1270 | for (;;) { |
1295 | /* | 1271 | /* |
1296 | * figure out where we are (as an index) and where | 1272 | * figure out where we are (as an index) and where |
1297 | * the hardware is (also as an index) | 1273 | * the hardware is (also as an index) |
1298 | * | 1274 | * |
1299 | * This could be done faster if (for example) the | 1275 | * This could be done faster if (for example) the |
1300 | * descriptor table was page-aligned and contiguous in | 1276 | * descriptor table was page-aligned and contiguous in |
1301 | * both virtual and physical memory -- you could then | 1277 | * both virtual and physical memory -- you could then |
1302 | * just compare the low-order bits of the virtual address | 1278 | * just compare the low-order bits of the virtual address |
1303 | * (sbdma_remptr) and the physical address (sbdma_curdscr CSR) | 1279 | * (sbdma_remptr) and the physical address (sbdma_curdscr CSR) |
1304 | */ | 1280 | */ |
1305 | 1281 | ||
1306 | curidx = d->sbdma_remptr - d->sbdma_dscrtable; | 1282 | curidx = d->sbdma_remptr - d->sbdma_dscrtable; |
1307 | hwidx = (int) (((SBMAC_READCSR(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - | 1283 | hwidx = (int) (((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - |
1308 | d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); | 1284 | d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); |
1309 | 1285 | ||
1310 | /* | 1286 | /* |
@@ -1312,75 +1288,75 @@ static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d) | |||
1312 | * of the descriptors up to (but not including) the one that | 1288 | * of the descriptors up to (but not including) the one that |
1313 | * the hardware is working on right now. | 1289 | * the hardware is working on right now. |
1314 | */ | 1290 | */ |
1315 | 1291 | ||
1316 | if (curidx == hwidx) | 1292 | if (curidx == hwidx) |
1317 | break; | 1293 | break; |
1318 | 1294 | ||
1319 | /* | 1295 | /* |
1320 | * Otherwise, get the packet's sk_buff ptr back | 1296 | * Otherwise, get the packet's sk_buff ptr back |
1321 | */ | 1297 | */ |
1322 | 1298 | ||
1323 | dsc = &(d->sbdma_dscrtable[curidx]); | 1299 | dsc = &(d->sbdma_dscrtable[curidx]); |
1324 | sb = d->sbdma_ctxtable[curidx]; | 1300 | sb = d->sbdma_ctxtable[curidx]; |
1325 | d->sbdma_ctxtable[curidx] = NULL; | 1301 | d->sbdma_ctxtable[curidx] = NULL; |
1326 | 1302 | ||
1327 | /* | 1303 | /* |
1328 | * Stats | 1304 | * Stats |
1329 | */ | 1305 | */ |
1330 | 1306 | ||
1331 | sc->sbm_stats.tx_bytes += sb->len; | 1307 | sc->sbm_stats.tx_bytes += sb->len; |
1332 | sc->sbm_stats.tx_packets++; | 1308 | sc->sbm_stats.tx_packets++; |
1333 | 1309 | ||
1334 | /* | 1310 | /* |
1335 | * for transmits, we just free buffers. | 1311 | * for transmits, we just free buffers. |
1336 | */ | 1312 | */ |
1337 | 1313 | ||
1338 | dev_kfree_skb_irq(sb); | 1314 | dev_kfree_skb_irq(sb); |
1339 | 1315 | ||
1340 | /* | 1316 | /* |
1341 | * .. and advance to the next buffer. | 1317 | * .. and advance to the next buffer. |
1342 | */ | 1318 | */ |
1343 | 1319 | ||
1344 | d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); | 1320 | d->sbdma_remptr = SBDMA_NEXTBUF(d,sbdma_remptr); |
1345 | 1321 | ||
1346 | } | 1322 | } |
1347 | 1323 | ||
1348 | /* | 1324 | /* |
1349 | * Decide if we should wake up the protocol or not. | 1325 | * Decide if we should wake up the protocol or not. |
1350 | * Other drivers seem to do this when we reach a low | 1326 | * Other drivers seem to do this when we reach a low |
1351 | * watermark on the transmit queue. | 1327 | * watermark on the transmit queue. |
1352 | */ | 1328 | */ |
1353 | 1329 | ||
1354 | netif_wake_queue(d->sbdma_eth->sbm_dev); | 1330 | netif_wake_queue(d->sbdma_eth->sbm_dev); |
1355 | 1331 | ||
1356 | spin_unlock_irqrestore(&(sc->sbm_lock), flags); | 1332 | spin_unlock_irqrestore(&(sc->sbm_lock), flags); |
1357 | 1333 | ||
1358 | } | 1334 | } |
1359 | 1335 | ||
1360 | 1336 | ||
1361 | 1337 | ||
1362 | /********************************************************************** | 1338 | /********************************************************************** |
1363 | * SBMAC_INITCTX(s) | 1339 | * SBMAC_INITCTX(s) |
1364 | * | 1340 | * |
1365 | * Initialize an Ethernet context structure - this is called | 1341 | * Initialize an Ethernet context structure - this is called |
1366 | * once per MAC on the 1250. Memory is allocated here, so don't | 1342 | * once per MAC on the 1250. Memory is allocated here, so don't |
1367 | * call it again from inside the ioctl routines that bring the | 1343 | * call it again from inside the ioctl routines that bring the |
1368 | * interface up/down | 1344 | * interface up/down |
1369 | * | 1345 | * |
1370 | * Input parameters: | 1346 | * Input parameters: |
1371 | * s - sbmac context structure | 1347 | * s - sbmac context structure |
1372 | * | 1348 | * |
1373 | * Return value: | 1349 | * Return value: |
1374 | * 0 | 1350 | * 0 |
1375 | ********************************************************************* */ | 1351 | ********************************************************************* */ |
1376 | 1352 | ||
1377 | static int sbmac_initctx(struct sbmac_softc *s) | 1353 | static int sbmac_initctx(struct sbmac_softc *s) |
1378 | { | 1354 | { |
1379 | 1355 | ||
1380 | /* | 1356 | /* |
1381 | * figure out the addresses of some ports | 1357 | * figure out the addresses of some ports |
1382 | */ | 1358 | */ |
1383 | 1359 | ||
1384 | s->sbm_macenable = s->sbm_base + R_MAC_ENABLE; | 1360 | s->sbm_macenable = s->sbm_base + R_MAC_ENABLE; |
1385 | s->sbm_maccfg = s->sbm_base + R_MAC_CFG; | 1361 | s->sbm_maccfg = s->sbm_base + R_MAC_CFG; |
1386 | s->sbm_fifocfg = s->sbm_base + R_MAC_THRSH_CFG; | 1362 | s->sbm_fifocfg = s->sbm_base + R_MAC_THRSH_CFG; |
@@ -1397,29 +1373,29 @@ static int sbmac_initctx(struct sbmac_softc *s) | |||
1397 | s->sbm_phy_oldanlpar = 0; | 1373 | s->sbm_phy_oldanlpar = 0; |
1398 | s->sbm_phy_oldk1stsr = 0; | 1374 | s->sbm_phy_oldk1stsr = 0; |
1399 | s->sbm_phy_oldlinkstat = 0; | 1375 | s->sbm_phy_oldlinkstat = 0; |
1400 | 1376 | ||
1401 | /* | 1377 | /* |
1402 | * Initialize the DMA channels. Right now, only one per MAC is used | 1378 | * Initialize the DMA channels. Right now, only one per MAC is used |
1403 | * Note: Only do this _once_, as it allocates memory from the kernel! | 1379 | * Note: Only do this _once_, as it allocates memory from the kernel! |
1404 | */ | 1380 | */ |
1405 | 1381 | ||
1406 | sbdma_initctx(&(s->sbm_txdma),s,0,DMA_TX,SBMAC_MAX_TXDESCR); | 1382 | sbdma_initctx(&(s->sbm_txdma),s,0,DMA_TX,SBMAC_MAX_TXDESCR); |
1407 | sbdma_initctx(&(s->sbm_rxdma),s,0,DMA_RX,SBMAC_MAX_RXDESCR); | 1383 | sbdma_initctx(&(s->sbm_rxdma),s,0,DMA_RX,SBMAC_MAX_RXDESCR); |
1408 | 1384 | ||
1409 | /* | 1385 | /* |
1410 | * initial state is OFF | 1386 | * initial state is OFF |
1411 | */ | 1387 | */ |
1412 | 1388 | ||
1413 | s->sbm_state = sbmac_state_off; | 1389 | s->sbm_state = sbmac_state_off; |
1414 | 1390 | ||
1415 | /* | 1391 | /* |
1416 | * Initial speed is (XXX TEMP) 10MBit/s HDX no FC | 1392 | * Initial speed is (XXX TEMP) 10MBit/s HDX no FC |
1417 | */ | 1393 | */ |
1418 | 1394 | ||
1419 | s->sbm_speed = sbmac_speed_10; | 1395 | s->sbm_speed = sbmac_speed_10; |
1420 | s->sbm_duplex = sbmac_duplex_half; | 1396 | s->sbm_duplex = sbmac_duplex_half; |
1421 | s->sbm_fc = sbmac_fc_disabled; | 1397 | s->sbm_fc = sbmac_fc_disabled; |
1422 | 1398 | ||
1423 | return 0; | 1399 | return 0; |
1424 | } | 1400 | } |
1425 | 1401 | ||
@@ -1430,7 +1406,7 @@ static void sbdma_uninitctx(struct sbmacdma_s *d) | |||
1430 | kfree(d->sbdma_dscrtable); | 1406 | kfree(d->sbdma_dscrtable); |
1431 | d->sbdma_dscrtable = NULL; | 1407 | d->sbdma_dscrtable = NULL; |
1432 | } | 1408 | } |
1433 | 1409 | ||
1434 | if (d->sbdma_ctxtable) { | 1410 | if (d->sbdma_ctxtable) { |
1435 | kfree(d->sbdma_ctxtable); | 1411 | kfree(d->sbdma_ctxtable); |
1436 | d->sbdma_ctxtable = NULL; | 1412 | d->sbdma_ctxtable = NULL; |
@@ -1447,12 +1423,12 @@ static void sbmac_uninitctx(struct sbmac_softc *sc) | |||
1447 | 1423 | ||
1448 | /********************************************************************** | 1424 | /********************************************************************** |
1449 | * SBMAC_CHANNEL_START(s) | 1425 | * SBMAC_CHANNEL_START(s) |
1450 | * | 1426 | * |
1451 | * Start packet processing on this MAC. | 1427 | * Start packet processing on this MAC. |
1452 | * | 1428 | * |
1453 | * Input parameters: | 1429 | * Input parameters: |
1454 | * s - sbmac structure | 1430 | * s - sbmac structure |
1455 | * | 1431 | * |
1456 | * Return value: | 1432 | * Return value: |
1457 | * nothing | 1433 | * nothing |
1458 | ********************************************************************* */ | 1434 | ********************************************************************* */ |
@@ -1460,49 +1436,49 @@ static void sbmac_uninitctx(struct sbmac_softc *sc) | |||
1460 | static void sbmac_channel_start(struct sbmac_softc *s) | 1436 | static void sbmac_channel_start(struct sbmac_softc *s) |
1461 | { | 1437 | { |
1462 | uint64_t reg; | 1438 | uint64_t reg; |
1463 | sbmac_port_t port; | 1439 | volatile void __iomem *port; |
1464 | uint64_t cfg,fifo,framecfg; | 1440 | uint64_t cfg,fifo,framecfg; |
1465 | int idx, th_value; | 1441 | int idx, th_value; |
1466 | 1442 | ||
1467 | /* | 1443 | /* |
1468 | * Don't do this if running | 1444 | * Don't do this if running |
1469 | */ | 1445 | */ |
1470 | 1446 | ||
1471 | if (s->sbm_state == sbmac_state_on) | 1447 | if (s->sbm_state == sbmac_state_on) |
1472 | return; | 1448 | return; |
1473 | 1449 | ||
1474 | /* | 1450 | /* |
1475 | * Bring the controller out of reset, but leave it off. | 1451 | * Bring the controller out of reset, but leave it off. |
1476 | */ | 1452 | */ |
1477 | 1453 | ||
1478 | SBMAC_WRITECSR(s->sbm_macenable,0); | 1454 | __raw_writeq(0, s->sbm_macenable); |
1479 | 1455 | ||
1480 | /* | 1456 | /* |
1481 | * Ignore all received packets | 1457 | * Ignore all received packets |
1482 | */ | 1458 | */ |
1483 | 1459 | ||
1484 | SBMAC_WRITECSR(s->sbm_rxfilter,0); | 1460 | __raw_writeq(0, s->sbm_rxfilter); |
1485 | 1461 | ||
1486 | /* | 1462 | /* |
1487 | * Calculate values for various control registers. | 1463 | * Calculate values for various control registers. |
1488 | */ | 1464 | */ |
1489 | 1465 | ||
1490 | cfg = M_MAC_RETRY_EN | | 1466 | cfg = M_MAC_RETRY_EN | |
1491 | M_MAC_TX_HOLD_SOP_EN | | 1467 | M_MAC_TX_HOLD_SOP_EN | |
1492 | V_MAC_TX_PAUSE_CNT_16K | | 1468 | V_MAC_TX_PAUSE_CNT_16K | |
1493 | M_MAC_AP_STAT_EN | | 1469 | M_MAC_AP_STAT_EN | |
1494 | M_MAC_FAST_SYNC | | 1470 | M_MAC_FAST_SYNC | |
1495 | M_MAC_SS_EN | | 1471 | M_MAC_SS_EN | |
1496 | 0; | 1472 | 0; |
1497 | 1473 | ||
1498 | /* | 1474 | /* |
1499 | * Be sure that RD_THRSH+WR_THRSH <= 32 for pass1 pars | 1475 | * Be sure that RD_THRSH+WR_THRSH <= 32 for pass1 pars |
1500 | * and make sure that RD_THRSH + WR_THRSH <=128 for pass2 and above | 1476 | * and make sure that RD_THRSH + WR_THRSH <=128 for pass2 and above |
1501 | * Use a larger RD_THRSH for gigabit | 1477 | * Use a larger RD_THRSH for gigabit |
1502 | */ | 1478 | */ |
1503 | if (periph_rev >= 2) | 1479 | if (periph_rev >= 2) |
1504 | th_value = 64; | 1480 | th_value = 64; |
1505 | else | 1481 | else |
1506 | th_value = 28; | 1482 | th_value = 28; |
1507 | 1483 | ||
1508 | fifo = V_MAC_TX_WR_THRSH(4) | /* Must be '4' or '8' */ | 1484 | fifo = V_MAC_TX_WR_THRSH(4) | /* Must be '4' or '8' */ |
@@ -1520,51 +1496,51 @@ static void sbmac_channel_start(struct sbmac_softc *s) | |||
1520 | V_MAC_BACKOFF_SEL(1); | 1496 | V_MAC_BACKOFF_SEL(1); |
1521 | 1497 | ||
1522 | /* | 1498 | /* |
1523 | * Clear out the hash address map | 1499 | * Clear out the hash address map |
1524 | */ | 1500 | */ |
1525 | 1501 | ||
1526 | port = s->sbm_base + R_MAC_HASH_BASE; | 1502 | port = s->sbm_base + R_MAC_HASH_BASE; |
1527 | for (idx = 0; idx < MAC_HASH_COUNT; idx++) { | 1503 | for (idx = 0; idx < MAC_HASH_COUNT; idx++) { |
1528 | SBMAC_WRITECSR(port,0); | 1504 | __raw_writeq(0, port); |
1529 | port += sizeof(uint64_t); | 1505 | port += sizeof(uint64_t); |
1530 | } | 1506 | } |
1531 | 1507 | ||
1532 | /* | 1508 | /* |
1533 | * Clear out the exact-match table | 1509 | * Clear out the exact-match table |
1534 | */ | 1510 | */ |
1535 | 1511 | ||
1536 | port = s->sbm_base + R_MAC_ADDR_BASE; | 1512 | port = s->sbm_base + R_MAC_ADDR_BASE; |
1537 | for (idx = 0; idx < MAC_ADDR_COUNT; idx++) { | 1513 | for (idx = 0; idx < MAC_ADDR_COUNT; idx++) { |
1538 | SBMAC_WRITECSR(port,0); | 1514 | __raw_writeq(0, port); |
1539 | port += sizeof(uint64_t); | 1515 | port += sizeof(uint64_t); |
1540 | } | 1516 | } |
1541 | 1517 | ||
1542 | /* | 1518 | /* |
1543 | * Clear out the DMA Channel mapping table registers | 1519 | * Clear out the DMA Channel mapping table registers |
1544 | */ | 1520 | */ |
1545 | 1521 | ||
1546 | port = s->sbm_base + R_MAC_CHUP0_BASE; | 1522 | port = s->sbm_base + R_MAC_CHUP0_BASE; |
1547 | for (idx = 0; idx < MAC_CHMAP_COUNT; idx++) { | 1523 | for (idx = 0; idx < MAC_CHMAP_COUNT; idx++) { |
1548 | SBMAC_WRITECSR(port,0); | 1524 | __raw_writeq(0, port); |
1549 | port += sizeof(uint64_t); | 1525 | port += sizeof(uint64_t); |
1550 | } | 1526 | } |
1551 | 1527 | ||
1552 | 1528 | ||
1553 | port = s->sbm_base + R_MAC_CHLO0_BASE; | 1529 | port = s->sbm_base + R_MAC_CHLO0_BASE; |
1554 | for (idx = 0; idx < MAC_CHMAP_COUNT; idx++) { | 1530 | for (idx = 0; idx < MAC_CHMAP_COUNT; idx++) { |
1555 | SBMAC_WRITECSR(port,0); | 1531 | __raw_writeq(0, port); |
1556 | port += sizeof(uint64_t); | 1532 | port += sizeof(uint64_t); |
1557 | } | 1533 | } |
1558 | 1534 | ||
1559 | /* | 1535 | /* |
1560 | * Program the hardware address. It goes into the hardware-address | 1536 | * Program the hardware address. It goes into the hardware-address |
1561 | * register as well as the first filter register. | 1537 | * register as well as the first filter register. |
1562 | */ | 1538 | */ |
1563 | 1539 | ||
1564 | reg = sbmac_addr2reg(s->sbm_hwaddr); | 1540 | reg = sbmac_addr2reg(s->sbm_hwaddr); |
1565 | 1541 | ||
1566 | port = s->sbm_base + R_MAC_ADDR_BASE; | 1542 | port = s->sbm_base + R_MAC_ADDR_BASE; |
1567 | SBMAC_WRITECSR(port,reg); | 1543 | __raw_writeq(reg, port); |
1568 | port = s->sbm_base + R_MAC_ETHERNET_ADDR; | 1544 | port = s->sbm_base + R_MAC_ETHERNET_ADDR; |
1569 | 1545 | ||
1570 | #ifdef CONFIG_SB1_PASS_1_WORKAROUNDS | 1546 | #ifdef CONFIG_SB1_PASS_1_WORKAROUNDS |
@@ -1573,108 +1549,105 @@ static void sbmac_channel_start(struct sbmac_softc *s) | |||
1573 | * destination address in the R_MAC_ETHERNET_ADDR register. | 1549 | * destination address in the R_MAC_ETHERNET_ADDR register. |
1574 | * Set the value to zero. | 1550 | * Set the value to zero. |
1575 | */ | 1551 | */ |
1576 | SBMAC_WRITECSR(port,0); | 1552 | __raw_writeq(0, port); |
1577 | #else | 1553 | #else |
1578 | SBMAC_WRITECSR(port,reg); | 1554 | __raw_writeq(reg, port); |
1579 | #endif | 1555 | #endif |
1580 | 1556 | ||
1581 | /* | 1557 | /* |
1582 | * Set the receive filter for no packets, and write values | 1558 | * Set the receive filter for no packets, and write values |
1583 | * to the various config registers | 1559 | * to the various config registers |
1584 | */ | 1560 | */ |
1585 | 1561 | ||
1586 | SBMAC_WRITECSR(s->sbm_rxfilter,0); | 1562 | __raw_writeq(0, s->sbm_rxfilter); |
1587 | SBMAC_WRITECSR(s->sbm_imr,0); | 1563 | __raw_writeq(0, s->sbm_imr); |
1588 | SBMAC_WRITECSR(s->sbm_framecfg,framecfg); | 1564 | __raw_writeq(framecfg, s->sbm_framecfg); |
1589 | SBMAC_WRITECSR(s->sbm_fifocfg,fifo); | 1565 | __raw_writeq(fifo, s->sbm_fifocfg); |
1590 | SBMAC_WRITECSR(s->sbm_maccfg,cfg); | 1566 | __raw_writeq(cfg, s->sbm_maccfg); |
1591 | 1567 | ||
1592 | /* | 1568 | /* |
1593 | * Initialize DMA channels (rings should be ok now) | 1569 | * Initialize DMA channels (rings should be ok now) |
1594 | */ | 1570 | */ |
1595 | 1571 | ||
1596 | sbdma_channel_start(&(s->sbm_rxdma), DMA_RX); | 1572 | sbdma_channel_start(&(s->sbm_rxdma), DMA_RX); |
1597 | sbdma_channel_start(&(s->sbm_txdma), DMA_TX); | 1573 | sbdma_channel_start(&(s->sbm_txdma), DMA_TX); |
1598 | 1574 | ||
1599 | /* | 1575 | /* |
1600 | * Configure the speed, duplex, and flow control | 1576 | * Configure the speed, duplex, and flow control |
1601 | */ | 1577 | */ |
1602 | 1578 | ||
1603 | sbmac_set_speed(s,s->sbm_speed); | 1579 | sbmac_set_speed(s,s->sbm_speed); |
1604 | sbmac_set_duplex(s,s->sbm_duplex,s->sbm_fc); | 1580 | sbmac_set_duplex(s,s->sbm_duplex,s->sbm_fc); |
1605 | 1581 | ||
1606 | /* | 1582 | /* |
1607 | * Fill the receive ring | 1583 | * Fill the receive ring |
1608 | */ | 1584 | */ |
1609 | 1585 | ||
1610 | sbdma_fillring(&(s->sbm_rxdma)); | 1586 | sbdma_fillring(&(s->sbm_rxdma)); |
1611 | 1587 | ||
1612 | /* | 1588 | /* |
1613 | * Turn on the rest of the bits in the enable register | 1589 | * Turn on the rest of the bits in the enable register |
1614 | */ | 1590 | */ |
1615 | 1591 | ||
1616 | SBMAC_WRITECSR(s->sbm_macenable, | 1592 | __raw_writeq(M_MAC_RXDMA_EN0 | |
1617 | M_MAC_RXDMA_EN0 | | ||
1618 | M_MAC_TXDMA_EN0 | | 1593 | M_MAC_TXDMA_EN0 | |
1619 | M_MAC_RX_ENABLE | | 1594 | M_MAC_RX_ENABLE | |
1620 | M_MAC_TX_ENABLE); | 1595 | M_MAC_TX_ENABLE, s->sbm_macenable); |
1621 | 1596 | ||
1622 | 1597 | ||
1623 | 1598 | ||
1624 | 1599 | ||
1625 | #ifdef CONFIG_SBMAC_COALESCE | 1600 | #ifdef CONFIG_SBMAC_COALESCE |
1626 | /* | 1601 | /* |
1627 | * Accept any TX interrupt and EOP count/timer RX interrupts on ch 0 | 1602 | * Accept any TX interrupt and EOP count/timer RX interrupts on ch 0 |
1628 | */ | 1603 | */ |
1629 | SBMAC_WRITECSR(s->sbm_imr, | 1604 | __raw_writeq(((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | |
1630 | ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | | 1605 | ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0), s->sbm_imr); |
1631 | ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0)); | ||
1632 | #else | 1606 | #else |
1633 | /* | 1607 | /* |
1634 | * Accept any kind of interrupt on TX and RX DMA channel 0 | 1608 | * Accept any kind of interrupt on TX and RX DMA channel 0 |
1635 | */ | 1609 | */ |
1636 | SBMAC_WRITECSR(s->sbm_imr, | 1610 | __raw_writeq((M_MAC_INT_CHANNEL << S_MAC_TX_CH0) | |
1637 | (M_MAC_INT_CHANNEL << S_MAC_TX_CH0) | | 1611 | (M_MAC_INT_CHANNEL << S_MAC_RX_CH0), s->sbm_imr); |
1638 | (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)); | ||
1639 | #endif | 1612 | #endif |
1640 | 1613 | ||
1641 | /* | 1614 | /* |
1642 | * Enable receiving unicasts and broadcasts | 1615 | * Enable receiving unicasts and broadcasts |
1643 | */ | 1616 | */ |
1644 | 1617 | ||
1645 | SBMAC_WRITECSR(s->sbm_rxfilter,M_MAC_UCAST_EN | M_MAC_BCAST_EN); | 1618 | __raw_writeq(M_MAC_UCAST_EN | M_MAC_BCAST_EN, s->sbm_rxfilter); |
1646 | 1619 | ||
1647 | /* | 1620 | /* |
1648 | * we're running now. | 1621 | * we're running now. |
1649 | */ | 1622 | */ |
1650 | 1623 | ||
1651 | s->sbm_state = sbmac_state_on; | 1624 | s->sbm_state = sbmac_state_on; |
1652 | 1625 | ||
1653 | /* | 1626 | /* |
1654 | * Program multicast addresses | 1627 | * Program multicast addresses |
1655 | */ | 1628 | */ |
1656 | 1629 | ||
1657 | sbmac_setmulti(s); | 1630 | sbmac_setmulti(s); |
1658 | 1631 | ||
1659 | /* | 1632 | /* |
1660 | * If channel was in promiscuous mode before, turn that on | 1633 | * If channel was in promiscuous mode before, turn that on |
1661 | */ | 1634 | */ |
1662 | 1635 | ||
1663 | if (s->sbm_devflags & IFF_PROMISC) { | 1636 | if (s->sbm_devflags & IFF_PROMISC) { |
1664 | sbmac_promiscuous_mode(s,1); | 1637 | sbmac_promiscuous_mode(s,1); |
1665 | } | 1638 | } |
1666 | 1639 | ||
1667 | } | 1640 | } |
1668 | 1641 | ||
1669 | 1642 | ||
1670 | /********************************************************************** | 1643 | /********************************************************************** |
1671 | * SBMAC_CHANNEL_STOP(s) | 1644 | * SBMAC_CHANNEL_STOP(s) |
1672 | * | 1645 | * |
1673 | * Stop packet processing on this MAC. | 1646 | * Stop packet processing on this MAC. |
1674 | * | 1647 | * |
1675 | * Input parameters: | 1648 | * Input parameters: |
1676 | * s - sbmac structure | 1649 | * s - sbmac structure |
1677 | * | 1650 | * |
1678 | * Return value: | 1651 | * Return value: |
1679 | * nothing | 1652 | * nothing |
1680 | ********************************************************************* */ | 1653 | ********************************************************************* */ |
@@ -1682,49 +1655,49 @@ static void sbmac_channel_start(struct sbmac_softc *s) | |||
1682 | static void sbmac_channel_stop(struct sbmac_softc *s) | 1655 | static void sbmac_channel_stop(struct sbmac_softc *s) |
1683 | { | 1656 | { |
1684 | /* don't do this if already stopped */ | 1657 | /* don't do this if already stopped */ |
1685 | 1658 | ||
1686 | if (s->sbm_state == sbmac_state_off) | 1659 | if (s->sbm_state == sbmac_state_off) |
1687 | return; | 1660 | return; |
1688 | 1661 | ||
1689 | /* don't accept any packets, disable all interrupts */ | 1662 | /* don't accept any packets, disable all interrupts */ |
1690 | 1663 | ||
1691 | SBMAC_WRITECSR(s->sbm_rxfilter,0); | 1664 | __raw_writeq(0, s->sbm_rxfilter); |
1692 | SBMAC_WRITECSR(s->sbm_imr,0); | 1665 | __raw_writeq(0, s->sbm_imr); |
1693 | 1666 | ||
1694 | /* Turn off ticker */ | 1667 | /* Turn off ticker */ |
1695 | 1668 | ||
1696 | /* XXX */ | 1669 | /* XXX */ |
1697 | 1670 | ||
1698 | /* turn off receiver and transmitter */ | 1671 | /* turn off receiver and transmitter */ |
1699 | 1672 | ||
1700 | SBMAC_WRITECSR(s->sbm_macenable,0); | 1673 | __raw_writeq(0, s->sbm_macenable); |
1701 | 1674 | ||
1702 | /* We're stopped now. */ | 1675 | /* We're stopped now. */ |
1703 | 1676 | ||
1704 | s->sbm_state = sbmac_state_off; | 1677 | s->sbm_state = sbmac_state_off; |
1705 | 1678 | ||
1706 | /* | 1679 | /* |
1707 | * Stop DMA channels (rings should be ok now) | 1680 | * Stop DMA channels (rings should be ok now) |
1708 | */ | 1681 | */ |
1709 | 1682 | ||
1710 | sbdma_channel_stop(&(s->sbm_rxdma)); | 1683 | sbdma_channel_stop(&(s->sbm_rxdma)); |
1711 | sbdma_channel_stop(&(s->sbm_txdma)); | 1684 | sbdma_channel_stop(&(s->sbm_txdma)); |
1712 | 1685 | ||
1713 | /* Empty the receive and transmit rings */ | 1686 | /* Empty the receive and transmit rings */ |
1714 | 1687 | ||
1715 | sbdma_emptyring(&(s->sbm_rxdma)); | 1688 | sbdma_emptyring(&(s->sbm_rxdma)); |
1716 | sbdma_emptyring(&(s->sbm_txdma)); | 1689 | sbdma_emptyring(&(s->sbm_txdma)); |
1717 | 1690 | ||
1718 | } | 1691 | } |
1719 | 1692 | ||
1720 | /********************************************************************** | 1693 | /********************************************************************** |
1721 | * SBMAC_SET_CHANNEL_STATE(state) | 1694 | * SBMAC_SET_CHANNEL_STATE(state) |
1722 | * | 1695 | * |
1723 | * Set the channel's state ON or OFF | 1696 | * Set the channel's state ON or OFF |
1724 | * | 1697 | * |
1725 | * Input parameters: | 1698 | * Input parameters: |
1726 | * state - new state | 1699 | * state - new state |
1727 | * | 1700 | * |
1728 | * Return value: | 1701 | * Return value: |
1729 | * old state | 1702 | * old state |
1730 | ********************************************************************* */ | 1703 | ********************************************************************* */ |
@@ -1732,43 +1705,43 @@ static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *sc, | |||
1732 | sbmac_state_t state) | 1705 | sbmac_state_t state) |
1733 | { | 1706 | { |
1734 | sbmac_state_t oldstate = sc->sbm_state; | 1707 | sbmac_state_t oldstate = sc->sbm_state; |
1735 | 1708 | ||
1736 | /* | 1709 | /* |
1737 | * If same as previous state, return | 1710 | * If same as previous state, return |
1738 | */ | 1711 | */ |
1739 | 1712 | ||
1740 | if (state == oldstate) { | 1713 | if (state == oldstate) { |
1741 | return oldstate; | 1714 | return oldstate; |
1742 | } | 1715 | } |
1743 | 1716 | ||
1744 | /* | 1717 | /* |
1745 | * If new state is ON, turn channel on | 1718 | * If new state is ON, turn channel on |
1746 | */ | 1719 | */ |
1747 | 1720 | ||
1748 | if (state == sbmac_state_on) { | 1721 | if (state == sbmac_state_on) { |
1749 | sbmac_channel_start(sc); | 1722 | sbmac_channel_start(sc); |
1750 | } | 1723 | } |
1751 | else { | 1724 | else { |
1752 | sbmac_channel_stop(sc); | 1725 | sbmac_channel_stop(sc); |
1753 | } | 1726 | } |
1754 | 1727 | ||
1755 | /* | 1728 | /* |
1756 | * Return previous state | 1729 | * Return previous state |
1757 | */ | 1730 | */ |
1758 | 1731 | ||
1759 | return oldstate; | 1732 | return oldstate; |
1760 | } | 1733 | } |
1761 | 1734 | ||
1762 | 1735 | ||
1763 | /********************************************************************** | 1736 | /********************************************************************** |
1764 | * SBMAC_PROMISCUOUS_MODE(sc,onoff) | 1737 | * SBMAC_PROMISCUOUS_MODE(sc,onoff) |
1765 | * | 1738 | * |
1766 | * Turn on or off promiscuous mode | 1739 | * Turn on or off promiscuous mode |
1767 | * | 1740 | * |
1768 | * Input parameters: | 1741 | * Input parameters: |
1769 | * sc - softc | 1742 | * sc - softc |
1770 | * onoff - 1 to turn on, 0 to turn off | 1743 | * onoff - 1 to turn on, 0 to turn off |
1771 | * | 1744 | * |
1772 | * Return value: | 1745 | * Return value: |
1773 | * nothing | 1746 | * nothing |
1774 | ********************************************************************* */ | 1747 | ********************************************************************* */ |
@@ -1776,30 +1749,30 @@ static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *sc, | |||
1776 | static void sbmac_promiscuous_mode(struct sbmac_softc *sc,int onoff) | 1749 | static void sbmac_promiscuous_mode(struct sbmac_softc *sc,int onoff) |
1777 | { | 1750 | { |
1778 | uint64_t reg; | 1751 | uint64_t reg; |
1779 | 1752 | ||
1780 | if (sc->sbm_state != sbmac_state_on) | 1753 | if (sc->sbm_state != sbmac_state_on) |
1781 | return; | 1754 | return; |
1782 | 1755 | ||
1783 | if (onoff) { | 1756 | if (onoff) { |
1784 | reg = SBMAC_READCSR(sc->sbm_rxfilter); | 1757 | reg = __raw_readq(sc->sbm_rxfilter); |
1785 | reg |= M_MAC_ALLPKT_EN; | 1758 | reg |= M_MAC_ALLPKT_EN; |
1786 | SBMAC_WRITECSR(sc->sbm_rxfilter,reg); | 1759 | __raw_writeq(reg, sc->sbm_rxfilter); |
1787 | } | 1760 | } |
1788 | else { | 1761 | else { |
1789 | reg = SBMAC_READCSR(sc->sbm_rxfilter); | 1762 | reg = __raw_readq(sc->sbm_rxfilter); |
1790 | reg &= ~M_MAC_ALLPKT_EN; | 1763 | reg &= ~M_MAC_ALLPKT_EN; |
1791 | SBMAC_WRITECSR(sc->sbm_rxfilter,reg); | 1764 | __raw_writeq(reg, sc->sbm_rxfilter); |
1792 | } | 1765 | } |
1793 | } | 1766 | } |
1794 | 1767 | ||
1795 | /********************************************************************** | 1768 | /********************************************************************** |
1796 | * SBMAC_SETIPHDR_OFFSET(sc,onoff) | 1769 | * SBMAC_SETIPHDR_OFFSET(sc,onoff) |
1797 | * | 1770 | * |
1798 | * Set the iphdr offset as 15 assuming ethernet encapsulation | 1771 | * Set the iphdr offset as 15 assuming ethernet encapsulation |
1799 | * | 1772 | * |
1800 | * Input parameters: | 1773 | * Input parameters: |
1801 | * sc - softc | 1774 | * sc - softc |
1802 | * | 1775 | * |
1803 | * Return value: | 1776 | * Return value: |
1804 | * nothing | 1777 | * nothing |
1805 | ********************************************************************* */ | 1778 | ********************************************************************* */ |
@@ -1807,12 +1780,12 @@ static void sbmac_promiscuous_mode(struct sbmac_softc *sc,int onoff) | |||
1807 | static void sbmac_set_iphdr_offset(struct sbmac_softc *sc) | 1780 | static void sbmac_set_iphdr_offset(struct sbmac_softc *sc) |
1808 | { | 1781 | { |
1809 | uint64_t reg; | 1782 | uint64_t reg; |
1810 | 1783 | ||
1811 | /* Hard code the off set to 15 for now */ | 1784 | /* Hard code the off set to 15 for now */ |
1812 | reg = SBMAC_READCSR(sc->sbm_rxfilter); | 1785 | reg = __raw_readq(sc->sbm_rxfilter); |
1813 | reg &= ~M_MAC_IPHDR_OFFSET | V_MAC_IPHDR_OFFSET(15); | 1786 | reg &= ~M_MAC_IPHDR_OFFSET | V_MAC_IPHDR_OFFSET(15); |
1814 | SBMAC_WRITECSR(sc->sbm_rxfilter,reg); | 1787 | __raw_writeq(reg, sc->sbm_rxfilter); |
1815 | 1788 | ||
1816 | /* read system identification to determine revision */ | 1789 | /* read system identification to determine revision */ |
1817 | if (periph_rev >= 2) { | 1790 | if (periph_rev >= 2) { |
1818 | sc->rx_hw_checksum = ENABLE; | 1791 | sc->rx_hw_checksum = ENABLE; |
@@ -1824,13 +1797,13 @@ static void sbmac_set_iphdr_offset(struct sbmac_softc *sc) | |||
1824 | 1797 | ||
1825 | /********************************************************************** | 1798 | /********************************************************************** |
1826 | * SBMAC_ADDR2REG(ptr) | 1799 | * SBMAC_ADDR2REG(ptr) |
1827 | * | 1800 | * |
1828 | * Convert six bytes into the 64-bit register value that | 1801 | * Convert six bytes into the 64-bit register value that |
1829 | * we typically write into the SBMAC's address/mcast registers | 1802 | * we typically write into the SBMAC's address/mcast registers |
1830 | * | 1803 | * |
1831 | * Input parameters: | 1804 | * Input parameters: |
1832 | * ptr - pointer to 6 bytes | 1805 | * ptr - pointer to 6 bytes |
1833 | * | 1806 | * |
1834 | * Return value: | 1807 | * Return value: |
1835 | * register value | 1808 | * register value |
1836 | ********************************************************************* */ | 1809 | ********************************************************************* */ |
@@ -1838,35 +1811,35 @@ static void sbmac_set_iphdr_offset(struct sbmac_softc *sc) | |||
1838 | static uint64_t sbmac_addr2reg(unsigned char *ptr) | 1811 | static uint64_t sbmac_addr2reg(unsigned char *ptr) |
1839 | { | 1812 | { |
1840 | uint64_t reg = 0; | 1813 | uint64_t reg = 0; |
1841 | 1814 | ||
1842 | ptr += 6; | 1815 | ptr += 6; |
1843 | 1816 | ||
1844 | reg |= (uint64_t) *(--ptr); | 1817 | reg |= (uint64_t) *(--ptr); |
1845 | reg <<= 8; | 1818 | reg <<= 8; |
1846 | reg |= (uint64_t) *(--ptr); | 1819 | reg |= (uint64_t) *(--ptr); |
1847 | reg <<= 8; | 1820 | reg <<= 8; |
1848 | reg |= (uint64_t) *(--ptr); | 1821 | reg |= (uint64_t) *(--ptr); |
1849 | reg <<= 8; | 1822 | reg <<= 8; |
1850 | reg |= (uint64_t) *(--ptr); | 1823 | reg |= (uint64_t) *(--ptr); |
1851 | reg <<= 8; | 1824 | reg <<= 8; |
1852 | reg |= (uint64_t) *(--ptr); | 1825 | reg |= (uint64_t) *(--ptr); |
1853 | reg <<= 8; | 1826 | reg <<= 8; |
1854 | reg |= (uint64_t) *(--ptr); | 1827 | reg |= (uint64_t) *(--ptr); |
1855 | 1828 | ||
1856 | return reg; | 1829 | return reg; |
1857 | } | 1830 | } |
1858 | 1831 | ||
1859 | 1832 | ||
1860 | /********************************************************************** | 1833 | /********************************************************************** |
1861 | * SBMAC_SET_SPEED(s,speed) | 1834 | * SBMAC_SET_SPEED(s,speed) |
1862 | * | 1835 | * |
1863 | * Configure LAN speed for the specified MAC. | 1836 | * Configure LAN speed for the specified MAC. |
1864 | * Warning: must be called when MAC is off! | 1837 | * Warning: must be called when MAC is off! |
1865 | * | 1838 | * |
1866 | * Input parameters: | 1839 | * Input parameters: |
1867 | * s - sbmac structure | 1840 | * s - sbmac structure |
1868 | * speed - speed to set MAC to (see sbmac_speed_t enum) | 1841 | * speed - speed to set MAC to (see sbmac_speed_t enum) |
1869 | * | 1842 | * |
1870 | * Return value: | 1843 | * Return value: |
1871 | * 1 if successful | 1844 | * 1 if successful |
1872 | * 0 indicates invalid parameters | 1845 | * 0 indicates invalid parameters |
@@ -1880,31 +1853,31 @@ static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed) | |||
1880 | /* | 1853 | /* |
1881 | * Save new current values | 1854 | * Save new current values |
1882 | */ | 1855 | */ |
1883 | 1856 | ||
1884 | s->sbm_speed = speed; | 1857 | s->sbm_speed = speed; |
1885 | 1858 | ||
1886 | if (s->sbm_state == sbmac_state_on) | 1859 | if (s->sbm_state == sbmac_state_on) |
1887 | return 0; /* save for next restart */ | 1860 | return 0; /* save for next restart */ |
1888 | 1861 | ||
1889 | /* | 1862 | /* |
1890 | * Read current register values | 1863 | * Read current register values |
1891 | */ | 1864 | */ |
1892 | 1865 | ||
1893 | cfg = SBMAC_READCSR(s->sbm_maccfg); | 1866 | cfg = __raw_readq(s->sbm_maccfg); |
1894 | framecfg = SBMAC_READCSR(s->sbm_framecfg); | 1867 | framecfg = __raw_readq(s->sbm_framecfg); |
1895 | 1868 | ||
1896 | /* | 1869 | /* |
1897 | * Mask out the stuff we want to change | 1870 | * Mask out the stuff we want to change |
1898 | */ | 1871 | */ |
1899 | 1872 | ||
1900 | cfg &= ~(M_MAC_BURST_EN | M_MAC_SPEED_SEL); | 1873 | cfg &= ~(M_MAC_BURST_EN | M_MAC_SPEED_SEL); |
1901 | framecfg &= ~(M_MAC_IFG_RX | M_MAC_IFG_TX | M_MAC_IFG_THRSH | | 1874 | framecfg &= ~(M_MAC_IFG_RX | M_MAC_IFG_TX | M_MAC_IFG_THRSH | |
1902 | M_MAC_SLOT_SIZE); | 1875 | M_MAC_SLOT_SIZE); |
1903 | 1876 | ||
1904 | /* | 1877 | /* |
1905 | * Now add in the new bits | 1878 | * Now add in the new bits |
1906 | */ | 1879 | */ |
1907 | 1880 | ||
1908 | switch (speed) { | 1881 | switch (speed) { |
1909 | case sbmac_speed_10: | 1882 | case sbmac_speed_10: |
1910 | framecfg |= V_MAC_IFG_RX_10 | | 1883 | framecfg |= V_MAC_IFG_RX_10 | |
@@ -1913,7 +1886,7 @@ static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed) | |||
1913 | V_MAC_SLOT_SIZE_10; | 1886 | V_MAC_SLOT_SIZE_10; |
1914 | cfg |= V_MAC_SPEED_SEL_10MBPS; | 1887 | cfg |= V_MAC_SPEED_SEL_10MBPS; |
1915 | break; | 1888 | break; |
1916 | 1889 | ||
1917 | case sbmac_speed_100: | 1890 | case sbmac_speed_100: |
1918 | framecfg |= V_MAC_IFG_RX_100 | | 1891 | framecfg |= V_MAC_IFG_RX_100 | |
1919 | V_MAC_IFG_TX_100 | | 1892 | V_MAC_IFG_TX_100 | |
@@ -1921,7 +1894,7 @@ static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed) | |||
1921 | V_MAC_SLOT_SIZE_100; | 1894 | V_MAC_SLOT_SIZE_100; |
1922 | cfg |= V_MAC_SPEED_SEL_100MBPS ; | 1895 | cfg |= V_MAC_SPEED_SEL_100MBPS ; |
1923 | break; | 1896 | break; |
1924 | 1897 | ||
1925 | case sbmac_speed_1000: | 1898 | case sbmac_speed_1000: |
1926 | framecfg |= V_MAC_IFG_RX_1000 | | 1899 | framecfg |= V_MAC_IFG_RX_1000 | |
1927 | V_MAC_IFG_TX_1000 | | 1900 | V_MAC_IFG_TX_1000 | |
@@ -1929,34 +1902,34 @@ static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed) | |||
1929 | V_MAC_SLOT_SIZE_1000; | 1902 | V_MAC_SLOT_SIZE_1000; |
1930 | cfg |= V_MAC_SPEED_SEL_1000MBPS | M_MAC_BURST_EN; | 1903 | cfg |= V_MAC_SPEED_SEL_1000MBPS | M_MAC_BURST_EN; |
1931 | break; | 1904 | break; |
1932 | 1905 | ||
1933 | case sbmac_speed_auto: /* XXX not implemented */ | 1906 | case sbmac_speed_auto: /* XXX not implemented */ |
1934 | /* fall through */ | 1907 | /* fall through */ |
1935 | default: | 1908 | default: |
1936 | return 0; | 1909 | return 0; |
1937 | } | 1910 | } |
1938 | 1911 | ||
1939 | /* | 1912 | /* |
1940 | * Send the bits back to the hardware | 1913 | * Send the bits back to the hardware |
1941 | */ | 1914 | */ |
1942 | 1915 | ||
1943 | SBMAC_WRITECSR(s->sbm_framecfg,framecfg); | 1916 | __raw_writeq(framecfg, s->sbm_framecfg); |
1944 | SBMAC_WRITECSR(s->sbm_maccfg,cfg); | 1917 | __raw_writeq(cfg, s->sbm_maccfg); |
1945 | 1918 | ||
1946 | return 1; | 1919 | return 1; |
1947 | } | 1920 | } |
1948 | 1921 | ||
1949 | /********************************************************************** | 1922 | /********************************************************************** |
1950 | * SBMAC_SET_DUPLEX(s,duplex,fc) | 1923 | * SBMAC_SET_DUPLEX(s,duplex,fc) |
1951 | * | 1924 | * |
1952 | * Set Ethernet duplex and flow control options for this MAC | 1925 | * Set Ethernet duplex and flow control options for this MAC |
1953 | * Warning: must be called when MAC is off! | 1926 | * Warning: must be called when MAC is off! |
1954 | * | 1927 | * |
1955 | * Input parameters: | 1928 | * Input parameters: |
1956 | * s - sbmac structure | 1929 | * s - sbmac structure |
1957 | * duplex - duplex setting (see sbmac_duplex_t) | 1930 | * duplex - duplex setting (see sbmac_duplex_t) |
1958 | * fc - flow control setting (see sbmac_fc_t) | 1931 | * fc - flow control setting (see sbmac_fc_t) |
1959 | * | 1932 | * |
1960 | * Return value: | 1933 | * Return value: |
1961 | * 1 if ok | 1934 | * 1 if ok |
1962 | * 0 if an invalid parameter combination was specified | 1935 | * 0 if an invalid parameter combination was specified |
@@ -1965,67 +1938,67 @@ static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed) | |||
1965 | static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc_t fc) | 1938 | static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc_t fc) |
1966 | { | 1939 | { |
1967 | uint64_t cfg; | 1940 | uint64_t cfg; |
1968 | 1941 | ||
1969 | /* | 1942 | /* |
1970 | * Save new current values | 1943 | * Save new current values |
1971 | */ | 1944 | */ |
1972 | 1945 | ||
1973 | s->sbm_duplex = duplex; | 1946 | s->sbm_duplex = duplex; |
1974 | s->sbm_fc = fc; | 1947 | s->sbm_fc = fc; |
1975 | 1948 | ||
1976 | if (s->sbm_state == sbmac_state_on) | 1949 | if (s->sbm_state == sbmac_state_on) |
1977 | return 0; /* save for next restart */ | 1950 | return 0; /* save for next restart */ |
1978 | 1951 | ||
1979 | /* | 1952 | /* |
1980 | * Read current register values | 1953 | * Read current register values |
1981 | */ | 1954 | */ |
1982 | 1955 | ||
1983 | cfg = SBMAC_READCSR(s->sbm_maccfg); | 1956 | cfg = __raw_readq(s->sbm_maccfg); |
1984 | 1957 | ||
1985 | /* | 1958 | /* |
1986 | * Mask off the stuff we're about to change | 1959 | * Mask off the stuff we're about to change |
1987 | */ | 1960 | */ |
1988 | 1961 | ||
1989 | cfg &= ~(M_MAC_FC_SEL | M_MAC_FC_CMD | M_MAC_HDX_EN); | 1962 | cfg &= ~(M_MAC_FC_SEL | M_MAC_FC_CMD | M_MAC_HDX_EN); |
1990 | 1963 | ||
1991 | 1964 | ||
1992 | switch (duplex) { | 1965 | switch (duplex) { |
1993 | case sbmac_duplex_half: | 1966 | case sbmac_duplex_half: |
1994 | switch (fc) { | 1967 | switch (fc) { |
1995 | case sbmac_fc_disabled: | 1968 | case sbmac_fc_disabled: |
1996 | cfg |= M_MAC_HDX_EN | V_MAC_FC_CMD_DISABLED; | 1969 | cfg |= M_MAC_HDX_EN | V_MAC_FC_CMD_DISABLED; |
1997 | break; | 1970 | break; |
1998 | 1971 | ||
1999 | case sbmac_fc_collision: | 1972 | case sbmac_fc_collision: |
2000 | cfg |= M_MAC_HDX_EN | V_MAC_FC_CMD_ENABLED; | 1973 | cfg |= M_MAC_HDX_EN | V_MAC_FC_CMD_ENABLED; |
2001 | break; | 1974 | break; |
2002 | 1975 | ||
2003 | case sbmac_fc_carrier: | 1976 | case sbmac_fc_carrier: |
2004 | cfg |= M_MAC_HDX_EN | V_MAC_FC_CMD_ENAB_FALSECARR; | 1977 | cfg |= M_MAC_HDX_EN | V_MAC_FC_CMD_ENAB_FALSECARR; |
2005 | break; | 1978 | break; |
2006 | 1979 | ||
2007 | case sbmac_fc_auto: /* XXX not implemented */ | 1980 | case sbmac_fc_auto: /* XXX not implemented */ |
2008 | /* fall through */ | 1981 | /* fall through */ |
2009 | case sbmac_fc_frame: /* not valid in half duplex */ | 1982 | case sbmac_fc_frame: /* not valid in half duplex */ |
2010 | default: /* invalid selection */ | 1983 | default: /* invalid selection */ |
2011 | return 0; | 1984 | return 0; |
2012 | } | 1985 | } |
2013 | break; | 1986 | break; |
2014 | 1987 | ||
2015 | case sbmac_duplex_full: | 1988 | case sbmac_duplex_full: |
2016 | switch (fc) { | 1989 | switch (fc) { |
2017 | case sbmac_fc_disabled: | 1990 | case sbmac_fc_disabled: |
2018 | cfg |= V_MAC_FC_CMD_DISABLED; | 1991 | cfg |= V_MAC_FC_CMD_DISABLED; |
2019 | break; | 1992 | break; |
2020 | 1993 | ||
2021 | case sbmac_fc_frame: | 1994 | case sbmac_fc_frame: |
2022 | cfg |= V_MAC_FC_CMD_ENABLED; | 1995 | cfg |= V_MAC_FC_CMD_ENABLED; |
2023 | break; | 1996 | break; |
2024 | 1997 | ||
2025 | case sbmac_fc_collision: /* not valid in full duplex */ | 1998 | case sbmac_fc_collision: /* not valid in full duplex */ |
2026 | case sbmac_fc_carrier: /* not valid in full duplex */ | 1999 | case sbmac_fc_carrier: /* not valid in full duplex */ |
2027 | case sbmac_fc_auto: /* XXX not implemented */ | 2000 | case sbmac_fc_auto: /* XXX not implemented */ |
2028 | /* fall through */ | 2001 | /* fall through */ |
2029 | default: | 2002 | default: |
2030 | return 0; | 2003 | return 0; |
2031 | } | 2004 | } |
@@ -2034,13 +2007,13 @@ static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc | |||
2034 | /* XXX not implemented */ | 2007 | /* XXX not implemented */ |
2035 | break; | 2008 | break; |
2036 | } | 2009 | } |
2037 | 2010 | ||
2038 | /* | 2011 | /* |
2039 | * Send the bits back to the hardware | 2012 | * Send the bits back to the hardware |
2040 | */ | 2013 | */ |
2041 | 2014 | ||
2042 | SBMAC_WRITECSR(s->sbm_maccfg,cfg); | 2015 | __raw_writeq(cfg, s->sbm_maccfg); |
2043 | 2016 | ||
2044 | return 1; | 2017 | return 1; |
2045 | } | 2018 | } |
2046 | 2019 | ||
@@ -2049,12 +2022,12 @@ static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc | |||
2049 | 2022 | ||
2050 | /********************************************************************** | 2023 | /********************************************************************** |
2051 | * SBMAC_INTR() | 2024 | * SBMAC_INTR() |
2052 | * | 2025 | * |
2053 | * Interrupt handler for MAC interrupts | 2026 | * Interrupt handler for MAC interrupts |
2054 | * | 2027 | * |
2055 | * Input parameters: | 2028 | * Input parameters: |
2056 | * MAC structure | 2029 | * MAC structure |
2057 | * | 2030 | * |
2058 | * Return value: | 2031 | * Return value: |
2059 | * nothing | 2032 | * nothing |
2060 | ********************************************************************* */ | 2033 | ********************************************************************* */ |
@@ -2066,27 +2039,27 @@ static irqreturn_t sbmac_intr(int irq,void *dev_instance,struct pt_regs *rgs) | |||
2066 | int handled = 0; | 2039 | int handled = 0; |
2067 | 2040 | ||
2068 | for (;;) { | 2041 | for (;;) { |
2069 | 2042 | ||
2070 | /* | 2043 | /* |
2071 | * Read the ISR (this clears the bits in the real | 2044 | * Read the ISR (this clears the bits in the real |
2072 | * register, except for counter addr) | 2045 | * register, except for counter addr) |
2073 | */ | 2046 | */ |
2074 | 2047 | ||
2075 | isr = SBMAC_READCSR(sc->sbm_isr) & ~M_MAC_COUNTER_ADDR; | 2048 | isr = __raw_readq(sc->sbm_isr) & ~M_MAC_COUNTER_ADDR; |
2076 | 2049 | ||
2077 | if (isr == 0) | 2050 | if (isr == 0) |
2078 | break; | 2051 | break; |
2079 | 2052 | ||
2080 | handled = 1; | 2053 | handled = 1; |
2081 | 2054 | ||
2082 | /* | 2055 | /* |
2083 | * Transmits on channel 0 | 2056 | * Transmits on channel 0 |
2084 | */ | 2057 | */ |
2085 | 2058 | ||
2086 | if (isr & (M_MAC_INT_CHANNEL << S_MAC_TX_CH0)) { | 2059 | if (isr & (M_MAC_INT_CHANNEL << S_MAC_TX_CH0)) { |
2087 | sbdma_tx_process(sc,&(sc->sbm_txdma)); | 2060 | sbdma_tx_process(sc,&(sc->sbm_txdma)); |
2088 | } | 2061 | } |
2089 | 2062 | ||
2090 | /* | 2063 | /* |
2091 | * Receives on channel 0 | 2064 | * Receives on channel 0 |
2092 | */ | 2065 | */ |
@@ -2106,8 +2079,8 @@ static irqreturn_t sbmac_intr(int irq,void *dev_instance,struct pt_regs *rgs) | |||
2106 | * EOP_SEEN here takes care of this case. | 2079 | * EOP_SEEN here takes care of this case. |
2107 | * (EOP_SEEN is part of M_MAC_INT_CHANNEL << S_MAC_RX_CH0) | 2080 | * (EOP_SEEN is part of M_MAC_INT_CHANNEL << S_MAC_RX_CH0) |
2108 | */ | 2081 | */ |
2109 | 2082 | ||
2110 | 2083 | ||
2111 | if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) { | 2084 | if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) { |
2112 | sbdma_rx_process(sc,&(sc->sbm_rxdma)); | 2085 | sbdma_rx_process(sc,&(sc->sbm_rxdma)); |
2113 | } | 2086 | } |
@@ -2118,29 +2091,29 @@ static irqreturn_t sbmac_intr(int irq,void *dev_instance,struct pt_regs *rgs) | |||
2118 | 2091 | ||
2119 | /********************************************************************** | 2092 | /********************************************************************** |
2120 | * SBMAC_START_TX(skb,dev) | 2093 | * SBMAC_START_TX(skb,dev) |
2121 | * | 2094 | * |
2122 | * Start output on the specified interface. Basically, we | 2095 | * Start output on the specified interface. Basically, we |
2123 | * queue as many buffers as we can until the ring fills up, or | 2096 | * queue as many buffers as we can until the ring fills up, or |
2124 | * we run off the end of the queue, whichever comes first. | 2097 | * we run off the end of the queue, whichever comes first. |
2125 | * | 2098 | * |
2126 | * Input parameters: | 2099 | * Input parameters: |
2127 | * | 2100 | * |
2128 | * | 2101 | * |
2129 | * Return value: | 2102 | * Return value: |
2130 | * nothing | 2103 | * nothing |
2131 | ********************************************************************* */ | 2104 | ********************************************************************* */ |
2132 | static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) | 2105 | static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) |
2133 | { | 2106 | { |
2134 | struct sbmac_softc *sc = netdev_priv(dev); | 2107 | struct sbmac_softc *sc = netdev_priv(dev); |
2135 | 2108 | ||
2136 | /* lock eth irq */ | 2109 | /* lock eth irq */ |
2137 | spin_lock_irq (&sc->sbm_lock); | 2110 | spin_lock_irq (&sc->sbm_lock); |
2138 | 2111 | ||
2139 | /* | 2112 | /* |
2140 | * Put the buffer on the transmit ring. If we | 2113 | * Put the buffer on the transmit ring. If we |
2141 | * don't have room, stop the queue. | 2114 | * don't have room, stop the queue. |
2142 | */ | 2115 | */ |
2143 | 2116 | ||
2144 | if (sbdma_add_txbuffer(&(sc->sbm_txdma),skb)) { | 2117 | if (sbdma_add_txbuffer(&(sc->sbm_txdma),skb)) { |
2145 | /* XXX save skb that we could not send */ | 2118 | /* XXX save skb that we could not send */ |
2146 | netif_stop_queue(dev); | 2119 | netif_stop_queue(dev); |
@@ -2148,24 +2121,24 @@ static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
2148 | 2121 | ||
2149 | return 1; | 2122 | return 1; |
2150 | } | 2123 | } |
2151 | 2124 | ||
2152 | dev->trans_start = jiffies; | 2125 | dev->trans_start = jiffies; |
2153 | 2126 | ||
2154 | spin_unlock_irq (&sc->sbm_lock); | 2127 | spin_unlock_irq (&sc->sbm_lock); |
2155 | 2128 | ||
2156 | return 0; | 2129 | return 0; |
2157 | } | 2130 | } |
2158 | 2131 | ||
2159 | /********************************************************************** | 2132 | /********************************************************************** |
2160 | * SBMAC_SETMULTI(sc) | 2133 | * SBMAC_SETMULTI(sc) |
2161 | * | 2134 | * |
2162 | * Reprogram the multicast table into the hardware, given | 2135 | * Reprogram the multicast table into the hardware, given |
2163 | * the list of multicasts associated with the interface | 2136 | * the list of multicasts associated with the interface |
2164 | * structure. | 2137 | * structure. |
2165 | * | 2138 | * |
2166 | * Input parameters: | 2139 | * Input parameters: |
2167 | * sc - softc | 2140 | * sc - softc |
2168 | * | 2141 | * |
2169 | * Return value: | 2142 | * Return value: |
2170 | * nothing | 2143 | * nothing |
2171 | ********************************************************************* */ | 2144 | ********************************************************************* */ |
@@ -2173,75 +2146,75 @@ static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
2173 | static void sbmac_setmulti(struct sbmac_softc *sc) | 2146 | static void sbmac_setmulti(struct sbmac_softc *sc) |
2174 | { | 2147 | { |
2175 | uint64_t reg; | 2148 | uint64_t reg; |
2176 | sbmac_port_t port; | 2149 | volatile void __iomem *port; |
2177 | int idx; | 2150 | int idx; |
2178 | struct dev_mc_list *mclist; | 2151 | struct dev_mc_list *mclist; |
2179 | struct net_device *dev = sc->sbm_dev; | 2152 | struct net_device *dev = sc->sbm_dev; |
2180 | 2153 | ||
2181 | /* | 2154 | /* |
2182 | * Clear out entire multicast table. We do this by nuking | 2155 | * Clear out entire multicast table. We do this by nuking |
2183 | * the entire hash table and all the direct matches except | 2156 | * the entire hash table and all the direct matches except |
2184 | * the first one, which is used for our station address | 2157 | * the first one, which is used for our station address |
2185 | */ | 2158 | */ |
2186 | 2159 | ||
2187 | for (idx = 1; idx < MAC_ADDR_COUNT; idx++) { | 2160 | for (idx = 1; idx < MAC_ADDR_COUNT; idx++) { |
2188 | port = sc->sbm_base + R_MAC_ADDR_BASE+(idx*sizeof(uint64_t)); | 2161 | port = sc->sbm_base + R_MAC_ADDR_BASE+(idx*sizeof(uint64_t)); |
2189 | SBMAC_WRITECSR(port,0); | 2162 | __raw_writeq(0, port); |
2190 | } | 2163 | } |
2191 | 2164 | ||
2192 | for (idx = 0; idx < MAC_HASH_COUNT; idx++) { | 2165 | for (idx = 0; idx < MAC_HASH_COUNT; idx++) { |
2193 | port = sc->sbm_base + R_MAC_HASH_BASE+(idx*sizeof(uint64_t)); | 2166 | port = sc->sbm_base + R_MAC_HASH_BASE+(idx*sizeof(uint64_t)); |
2194 | SBMAC_WRITECSR(port,0); | 2167 | __raw_writeq(0, port); |
2195 | } | 2168 | } |
2196 | 2169 | ||
2197 | /* | 2170 | /* |
2198 | * Clear the filter to say we don't want any multicasts. | 2171 | * Clear the filter to say we don't want any multicasts. |
2199 | */ | 2172 | */ |
2200 | 2173 | ||
2201 | reg = SBMAC_READCSR(sc->sbm_rxfilter); | 2174 | reg = __raw_readq(sc->sbm_rxfilter); |
2202 | reg &= ~(M_MAC_MCAST_INV | M_MAC_MCAST_EN); | 2175 | reg &= ~(M_MAC_MCAST_INV | M_MAC_MCAST_EN); |
2203 | SBMAC_WRITECSR(sc->sbm_rxfilter,reg); | 2176 | __raw_writeq(reg, sc->sbm_rxfilter); |
2204 | 2177 | ||
2205 | if (dev->flags & IFF_ALLMULTI) { | 2178 | if (dev->flags & IFF_ALLMULTI) { |
2206 | /* | 2179 | /* |
2207 | * Enable ALL multicasts. Do this by inverting the | 2180 | * Enable ALL multicasts. Do this by inverting the |
2208 | * multicast enable bit. | 2181 | * multicast enable bit. |
2209 | */ | 2182 | */ |
2210 | reg = SBMAC_READCSR(sc->sbm_rxfilter); | 2183 | reg = __raw_readq(sc->sbm_rxfilter); |
2211 | reg |= (M_MAC_MCAST_INV | M_MAC_MCAST_EN); | 2184 | reg |= (M_MAC_MCAST_INV | M_MAC_MCAST_EN); |
2212 | SBMAC_WRITECSR(sc->sbm_rxfilter,reg); | 2185 | __raw_writeq(reg, sc->sbm_rxfilter); |
2213 | return; | 2186 | return; |
2214 | } | 2187 | } |
2215 | |||
2216 | 2188 | ||
2217 | /* | 2189 | |
2190 | /* | ||
2218 | * Progam new multicast entries. For now, only use the | 2191 | * Progam new multicast entries. For now, only use the |
2219 | * perfect filter. In the future we'll need to use the | 2192 | * perfect filter. In the future we'll need to use the |
2220 | * hash filter if the perfect filter overflows | 2193 | * hash filter if the perfect filter overflows |
2221 | */ | 2194 | */ |
2222 | 2195 | ||
2223 | /* XXX only using perfect filter for now, need to use hash | 2196 | /* XXX only using perfect filter for now, need to use hash |
2224 | * XXX if the table overflows */ | 2197 | * XXX if the table overflows */ |
2225 | 2198 | ||
2226 | idx = 1; /* skip station address */ | 2199 | idx = 1; /* skip station address */ |
2227 | mclist = dev->mc_list; | 2200 | mclist = dev->mc_list; |
2228 | while (mclist && (idx < MAC_ADDR_COUNT)) { | 2201 | while (mclist && (idx < MAC_ADDR_COUNT)) { |
2229 | reg = sbmac_addr2reg(mclist->dmi_addr); | 2202 | reg = sbmac_addr2reg(mclist->dmi_addr); |
2230 | port = sc->sbm_base + R_MAC_ADDR_BASE+(idx * sizeof(uint64_t)); | 2203 | port = sc->sbm_base + R_MAC_ADDR_BASE+(idx * sizeof(uint64_t)); |
2231 | SBMAC_WRITECSR(port,reg); | 2204 | __raw_writeq(reg, port); |
2232 | idx++; | 2205 | idx++; |
2233 | mclist = mclist->next; | 2206 | mclist = mclist->next; |
2234 | } | 2207 | } |
2235 | 2208 | ||
2236 | /* | 2209 | /* |
2237 | * Enable the "accept multicast bits" if we programmed at least one | 2210 | * Enable the "accept multicast bits" if we programmed at least one |
2238 | * multicast. | 2211 | * multicast. |
2239 | */ | 2212 | */ |
2240 | 2213 | ||
2241 | if (idx > 1) { | 2214 | if (idx > 1) { |
2242 | reg = SBMAC_READCSR(sc->sbm_rxfilter); | 2215 | reg = __raw_readq(sc->sbm_rxfilter); |
2243 | reg |= M_MAC_MCAST_EN; | 2216 | reg |= M_MAC_MCAST_EN; |
2244 | SBMAC_WRITECSR(sc->sbm_rxfilter,reg); | 2217 | __raw_writeq(reg, sc->sbm_rxfilter); |
2245 | } | 2218 | } |
2246 | } | 2219 | } |
2247 | 2220 | ||
@@ -2250,12 +2223,12 @@ static void sbmac_setmulti(struct sbmac_softc *sc) | |||
2250 | #if defined(SBMAC_ETH0_HWADDR) || defined(SBMAC_ETH1_HWADDR) || defined(SBMAC_ETH2_HWADDR) | 2223 | #if defined(SBMAC_ETH0_HWADDR) || defined(SBMAC_ETH1_HWADDR) || defined(SBMAC_ETH2_HWADDR) |
2251 | /********************************************************************** | 2224 | /********************************************************************** |
2252 | * SBMAC_PARSE_XDIGIT(str) | 2225 | * SBMAC_PARSE_XDIGIT(str) |
2253 | * | 2226 | * |
2254 | * Parse a hex digit, returning its value | 2227 | * Parse a hex digit, returning its value |
2255 | * | 2228 | * |
2256 | * Input parameters: | 2229 | * Input parameters: |
2257 | * str - character | 2230 | * str - character |
2258 | * | 2231 | * |
2259 | * Return value: | 2232 | * Return value: |
2260 | * hex value, or -1 if invalid | 2233 | * hex value, or -1 if invalid |
2261 | ********************************************************************* */ | 2234 | ********************************************************************* */ |
@@ -2263,7 +2236,7 @@ static void sbmac_setmulti(struct sbmac_softc *sc) | |||
2263 | static int sbmac_parse_xdigit(char str) | 2236 | static int sbmac_parse_xdigit(char str) |
2264 | { | 2237 | { |
2265 | int digit; | 2238 | int digit; |
2266 | 2239 | ||
2267 | if ((str >= '0') && (str <= '9')) | 2240 | if ((str >= '0') && (str <= '9')) |
2268 | digit = str - '0'; | 2241 | digit = str - '0'; |
2269 | else if ((str >= 'a') && (str <= 'f')) | 2242 | else if ((str >= 'a') && (str <= 'f')) |
@@ -2272,20 +2245,20 @@ static int sbmac_parse_xdigit(char str) | |||
2272 | digit = str - 'A' + 10; | 2245 | digit = str - 'A' + 10; |
2273 | else | 2246 | else |
2274 | return -1; | 2247 | return -1; |
2275 | 2248 | ||
2276 | return digit; | 2249 | return digit; |
2277 | } | 2250 | } |
2278 | 2251 | ||
2279 | /********************************************************************** | 2252 | /********************************************************************** |
2280 | * SBMAC_PARSE_HWADDR(str,hwaddr) | 2253 | * SBMAC_PARSE_HWADDR(str,hwaddr) |
2281 | * | 2254 | * |
2282 | * Convert a string in the form xx:xx:xx:xx:xx:xx into a 6-byte | 2255 | * Convert a string in the form xx:xx:xx:xx:xx:xx into a 6-byte |
2283 | * Ethernet address. | 2256 | * Ethernet address. |
2284 | * | 2257 | * |
2285 | * Input parameters: | 2258 | * Input parameters: |
2286 | * str - string | 2259 | * str - string |
2287 | * hwaddr - pointer to hardware address | 2260 | * hwaddr - pointer to hardware address |
2288 | * | 2261 | * |
2289 | * Return value: | 2262 | * Return value: |
2290 | * 0 if ok, else -1 | 2263 | * 0 if ok, else -1 |
2291 | ********************************************************************* */ | 2264 | ********************************************************************* */ |
@@ -2294,7 +2267,7 @@ static int sbmac_parse_hwaddr(char *str, unsigned char *hwaddr) | |||
2294 | { | 2267 | { |
2295 | int digit1,digit2; | 2268 | int digit1,digit2; |
2296 | int idx = 6; | 2269 | int idx = 6; |
2297 | 2270 | ||
2298 | while (*str && (idx > 0)) { | 2271 | while (*str && (idx > 0)) { |
2299 | digit1 = sbmac_parse_xdigit(*str); | 2272 | digit1 = sbmac_parse_xdigit(*str); |
2300 | if (digit1 < 0) | 2273 | if (digit1 < 0) |
@@ -2302,7 +2275,7 @@ static int sbmac_parse_hwaddr(char *str, unsigned char *hwaddr) | |||
2302 | str++; | 2275 | str++; |
2303 | if (!*str) | 2276 | if (!*str) |
2304 | return -1; | 2277 | return -1; |
2305 | 2278 | ||
2306 | if ((*str == ':') || (*str == '-')) { | 2279 | if ((*str == ':') || (*str == '-')) { |
2307 | digit2 = digit1; | 2280 | digit2 = digit1; |
2308 | digit1 = 0; | 2281 | digit1 = 0; |
@@ -2313,10 +2286,10 @@ static int sbmac_parse_hwaddr(char *str, unsigned char *hwaddr) | |||
2313 | return -1; | 2286 | return -1; |
2314 | str++; | 2287 | str++; |
2315 | } | 2288 | } |
2316 | 2289 | ||
2317 | *hwaddr++ = (digit1 << 4) | digit2; | 2290 | *hwaddr++ = (digit1 << 4) | digit2; |
2318 | idx--; | 2291 | idx--; |
2319 | 2292 | ||
2320 | if (*str == '-') | 2293 | if (*str == '-') |
2321 | str++; | 2294 | str++; |
2322 | if (*str == ':') | 2295 | if (*str == ':') |
@@ -2337,12 +2310,12 @@ static int sb1250_change_mtu(struct net_device *_dev, int new_mtu) | |||
2337 | 2310 | ||
2338 | /********************************************************************** | 2311 | /********************************************************************** |
2339 | * SBMAC_INIT(dev) | 2312 | * SBMAC_INIT(dev) |
2340 | * | 2313 | * |
2341 | * Attach routine - init hardware and hook ourselves into linux | 2314 | * Attach routine - init hardware and hook ourselves into linux |
2342 | * | 2315 | * |
2343 | * Input parameters: | 2316 | * Input parameters: |
2344 | * dev - net_device structure | 2317 | * dev - net_device structure |
2345 | * | 2318 | * |
2346 | * Return value: | 2319 | * Return value: |
2347 | * status | 2320 | * status |
2348 | ********************************************************************* */ | 2321 | ********************************************************************* */ |
@@ -2354,53 +2327,53 @@ static int sbmac_init(struct net_device *dev, int idx) | |||
2354 | uint64_t ea_reg; | 2327 | uint64_t ea_reg; |
2355 | int i; | 2328 | int i; |
2356 | int err; | 2329 | int err; |
2357 | 2330 | ||
2358 | sc = netdev_priv(dev); | 2331 | sc = netdev_priv(dev); |
2359 | 2332 | ||
2360 | /* Determine controller base address */ | 2333 | /* Determine controller base address */ |
2361 | 2334 | ||
2362 | sc->sbm_base = IOADDR(dev->base_addr); | 2335 | sc->sbm_base = IOADDR(dev->base_addr); |
2363 | sc->sbm_dev = dev; | 2336 | sc->sbm_dev = dev; |
2364 | sc->sbe_idx = idx; | 2337 | sc->sbe_idx = idx; |
2365 | 2338 | ||
2366 | eaddr = sc->sbm_hwaddr; | 2339 | eaddr = sc->sbm_hwaddr; |
2367 | 2340 | ||
2368 | /* | 2341 | /* |
2369 | * Read the ethernet address. The firwmare left this programmed | 2342 | * Read the ethernet address. The firwmare left this programmed |
2370 | * for us in the ethernet address register for each mac. | 2343 | * for us in the ethernet address register for each mac. |
2371 | */ | 2344 | */ |
2372 | 2345 | ||
2373 | ea_reg = SBMAC_READCSR(sc->sbm_base + R_MAC_ETHERNET_ADDR); | 2346 | ea_reg = __raw_readq(sc->sbm_base + R_MAC_ETHERNET_ADDR); |
2374 | SBMAC_WRITECSR(sc->sbm_base + R_MAC_ETHERNET_ADDR, 0); | 2347 | __raw_writeq(0, sc->sbm_base + R_MAC_ETHERNET_ADDR); |
2375 | for (i = 0; i < 6; i++) { | 2348 | for (i = 0; i < 6; i++) { |
2376 | eaddr[i] = (uint8_t) (ea_reg & 0xFF); | 2349 | eaddr[i] = (uint8_t) (ea_reg & 0xFF); |
2377 | ea_reg >>= 8; | 2350 | ea_reg >>= 8; |
2378 | } | 2351 | } |
2379 | 2352 | ||
2380 | for (i = 0; i < 6; i++) { | 2353 | for (i = 0; i < 6; i++) { |
2381 | dev->dev_addr[i] = eaddr[i]; | 2354 | dev->dev_addr[i] = eaddr[i]; |
2382 | } | 2355 | } |
2383 | 2356 | ||
2384 | 2357 | ||
2385 | /* | 2358 | /* |
2386 | * Init packet size | 2359 | * Init packet size |
2387 | */ | 2360 | */ |
2388 | 2361 | ||
2389 | sc->sbm_buffersize = ENET_PACKET_SIZE + SMP_CACHE_BYTES * 2 + ETHER_ALIGN; | 2362 | sc->sbm_buffersize = ENET_PACKET_SIZE + SMP_CACHE_BYTES * 2 + ETHER_ALIGN; |
2390 | 2363 | ||
2391 | /* | 2364 | /* |
2392 | * Initialize context (get pointers to registers and stuff), then | 2365 | * Initialize context (get pointers to registers and stuff), then |
2393 | * allocate the memory for the descriptor tables. | 2366 | * allocate the memory for the descriptor tables. |
2394 | */ | 2367 | */ |
2395 | 2368 | ||
2396 | sbmac_initctx(sc); | 2369 | sbmac_initctx(sc); |
2397 | 2370 | ||
2398 | /* | 2371 | /* |
2399 | * Set up Linux device callins | 2372 | * Set up Linux device callins |
2400 | */ | 2373 | */ |
2401 | 2374 | ||
2402 | spin_lock_init(&(sc->sbm_lock)); | 2375 | spin_lock_init(&(sc->sbm_lock)); |
2403 | 2376 | ||
2404 | dev->open = sbmac_open; | 2377 | dev->open = sbmac_open; |
2405 | dev->hard_start_xmit = sbmac_start_tx; | 2378 | dev->hard_start_xmit = sbmac_start_tx; |
2406 | dev->stop = sbmac_close; | 2379 | dev->stop = sbmac_close; |
@@ -2419,7 +2392,7 @@ static int sbmac_init(struct net_device *dev, int idx) | |||
2419 | if (err) | 2392 | if (err) |
2420 | goto out_uninit; | 2393 | goto out_uninit; |
2421 | 2394 | ||
2422 | if (periph_rev >= 2) { | 2395 | if (sc->rx_hw_checksum == ENABLE) { |
2423 | printk(KERN_INFO "%s: enabling TCP rcv checksum\n", | 2396 | printk(KERN_INFO "%s: enabling TCP rcv checksum\n", |
2424 | sc->sbm_dev->name); | 2397 | sc->sbm_dev->name); |
2425 | } | 2398 | } |
@@ -2430,10 +2403,10 @@ static int sbmac_init(struct net_device *dev, int idx) | |||
2430 | * was being displayed) | 2403 | * was being displayed) |
2431 | */ | 2404 | */ |
2432 | printk(KERN_INFO | 2405 | printk(KERN_INFO |
2433 | "%s: SiByte Ethernet at 0x%08lX, address: %02X:%02X:%02X:%02X:%02X:%02X\n", | 2406 | "%s: SiByte Ethernet at 0x%08lX, address: %02X:%02X:%02X:%02X:%02X:%02X\n", |
2434 | dev->name, dev->base_addr, | 2407 | dev->name, dev->base_addr, |
2435 | eaddr[0],eaddr[1],eaddr[2],eaddr[3],eaddr[4],eaddr[5]); | 2408 | eaddr[0],eaddr[1],eaddr[2],eaddr[3],eaddr[4],eaddr[5]); |
2436 | 2409 | ||
2437 | 2410 | ||
2438 | return 0; | 2411 | return 0; |
2439 | 2412 | ||
@@ -2447,54 +2420,86 @@ out_uninit: | |||
2447 | static int sbmac_open(struct net_device *dev) | 2420 | static int sbmac_open(struct net_device *dev) |
2448 | { | 2421 | { |
2449 | struct sbmac_softc *sc = netdev_priv(dev); | 2422 | struct sbmac_softc *sc = netdev_priv(dev); |
2450 | 2423 | ||
2451 | if (debug > 1) { | 2424 | if (debug > 1) { |
2452 | printk(KERN_DEBUG "%s: sbmac_open() irq %d.\n", dev->name, dev->irq); | 2425 | printk(KERN_DEBUG "%s: sbmac_open() irq %d.\n", dev->name, dev->irq); |
2453 | } | 2426 | } |
2454 | 2427 | ||
2455 | /* | 2428 | /* |
2456 | * map/route interrupt (clear status first, in case something | 2429 | * map/route interrupt (clear status first, in case something |
2457 | * weird is pending; we haven't initialized the mac registers | 2430 | * weird is pending; we haven't initialized the mac registers |
2458 | * yet) | 2431 | * yet) |
2459 | */ | 2432 | */ |
2460 | 2433 | ||
2461 | SBMAC_READCSR(sc->sbm_isr); | 2434 | __raw_readq(sc->sbm_isr); |
2462 | if (request_irq(dev->irq, &sbmac_intr, SA_SHIRQ, dev->name, dev)) | 2435 | if (request_irq(dev->irq, &sbmac_intr, SA_SHIRQ, dev->name, dev)) |
2463 | return -EBUSY; | 2436 | return -EBUSY; |
2464 | 2437 | ||
2465 | /* | 2438 | /* |
2466 | * Configure default speed | 2439 | * Probe phy address |
2440 | */ | ||
2441 | |||
2442 | if(sbmac_mii_probe(dev) == -1) { | ||
2443 | printk("%s: failed to probe PHY.\n", dev->name); | ||
2444 | return -EINVAL; | ||
2445 | } | ||
2446 | |||
2447 | /* | ||
2448 | * Configure default speed | ||
2467 | */ | 2449 | */ |
2468 | 2450 | ||
2469 | sbmac_mii_poll(sc,noisy_mii); | 2451 | sbmac_mii_poll(sc,noisy_mii); |
2470 | 2452 | ||
2471 | /* | 2453 | /* |
2472 | * Turn on the channel | 2454 | * Turn on the channel |
2473 | */ | 2455 | */ |
2474 | 2456 | ||
2475 | sbmac_set_channel_state(sc,sbmac_state_on); | 2457 | sbmac_set_channel_state(sc,sbmac_state_on); |
2476 | 2458 | ||
2477 | /* | 2459 | /* |
2478 | * XXX Station address is in dev->dev_addr | 2460 | * XXX Station address is in dev->dev_addr |
2479 | */ | 2461 | */ |
2480 | 2462 | ||
2481 | if (dev->if_port == 0) | 2463 | if (dev->if_port == 0) |
2482 | dev->if_port = 0; | 2464 | dev->if_port = 0; |
2483 | 2465 | ||
2484 | netif_start_queue(dev); | 2466 | netif_start_queue(dev); |
2485 | 2467 | ||
2486 | sbmac_set_rx_mode(dev); | 2468 | sbmac_set_rx_mode(dev); |
2487 | 2469 | ||
2488 | /* Set the timer to check for link beat. */ | 2470 | /* Set the timer to check for link beat. */ |
2489 | init_timer(&sc->sbm_timer); | 2471 | init_timer(&sc->sbm_timer); |
2490 | sc->sbm_timer.expires = jiffies + 2 * HZ/100; | 2472 | sc->sbm_timer.expires = jiffies + 2 * HZ/100; |
2491 | sc->sbm_timer.data = (unsigned long)dev; | 2473 | sc->sbm_timer.data = (unsigned long)dev; |
2492 | sc->sbm_timer.function = &sbmac_timer; | 2474 | sc->sbm_timer.function = &sbmac_timer; |
2493 | add_timer(&sc->sbm_timer); | 2475 | add_timer(&sc->sbm_timer); |
2494 | 2476 | ||
2495 | return 0; | 2477 | return 0; |
2496 | } | 2478 | } |
2497 | 2479 | ||
2480 | static int sbmac_mii_probe(struct net_device *dev) | ||
2481 | { | ||
2482 | int i; | ||
2483 | struct sbmac_softc *s = netdev_priv(dev); | ||
2484 | u16 bmsr, id1, id2; | ||
2485 | u32 vendor, device; | ||
2486 | |||
2487 | for (i=1; i<31; i++) { | ||
2488 | bmsr = sbmac_mii_read(s, i, MII_BMSR); | ||
2489 | if (bmsr != 0) { | ||
2490 | s->sbm_phys[0] = i; | ||
2491 | id1 = sbmac_mii_read(s, i, MII_PHYIDR1); | ||
2492 | id2 = sbmac_mii_read(s, i, MII_PHYIDR2); | ||
2493 | vendor = ((u32)id1 << 6) | ((id2 >> 10) & 0x3f); | ||
2494 | device = (id2 >> 4) & 0x3f; | ||
2495 | |||
2496 | printk(KERN_INFO "%s: found phy %d, vendor %06x part %02x\n", | ||
2497 | dev->name, i, vendor, device); | ||
2498 | return i; | ||
2499 | } | ||
2500 | } | ||
2501 | return -1; | ||
2502 | } | ||
2498 | 2503 | ||
2499 | 2504 | ||
2500 | static int sbmac_mii_poll(struct sbmac_softc *s,int noisy) | 2505 | static int sbmac_mii_poll(struct sbmac_softc *s,int noisy) |
@@ -2609,20 +2614,20 @@ static void sbmac_timer(unsigned long data) | |||
2609 | int mii_status; | 2614 | int mii_status; |
2610 | 2615 | ||
2611 | spin_lock_irq (&sc->sbm_lock); | 2616 | spin_lock_irq (&sc->sbm_lock); |
2612 | 2617 | ||
2613 | /* make IFF_RUNNING follow the MII status bit "Link established" */ | 2618 | /* make IFF_RUNNING follow the MII status bit "Link established" */ |
2614 | mii_status = sbmac_mii_read(sc, sc->sbm_phys[0], MII_BMSR); | 2619 | mii_status = sbmac_mii_read(sc, sc->sbm_phys[0], MII_BMSR); |
2615 | 2620 | ||
2616 | if ( (mii_status & BMSR_LINKSTAT) != (sc->sbm_phy_oldlinkstat) ) { | 2621 | if ( (mii_status & BMSR_LINKSTAT) != (sc->sbm_phy_oldlinkstat) ) { |
2617 | sc->sbm_phy_oldlinkstat = mii_status & BMSR_LINKSTAT; | 2622 | sc->sbm_phy_oldlinkstat = mii_status & BMSR_LINKSTAT; |
2618 | if (mii_status & BMSR_LINKSTAT) { | 2623 | if (mii_status & BMSR_LINKSTAT) { |
2619 | netif_carrier_on(dev); | 2624 | netif_carrier_on(dev); |
2620 | } | 2625 | } |
2621 | else { | 2626 | else { |
2622 | netif_carrier_off(dev); | 2627 | netif_carrier_off(dev); |
2623 | } | 2628 | } |
2624 | } | 2629 | } |
2625 | 2630 | ||
2626 | /* | 2631 | /* |
2627 | * Poll the PHY to see what speed we should be running at | 2632 | * Poll the PHY to see what speed we should be running at |
2628 | */ | 2633 | */ |
@@ -2640,9 +2645,9 @@ static void sbmac_timer(unsigned long data) | |||
2640 | sbmac_channel_start(sc); | 2645 | sbmac_channel_start(sc); |
2641 | } | 2646 | } |
2642 | } | 2647 | } |
2643 | 2648 | ||
2644 | spin_unlock_irq (&sc->sbm_lock); | 2649 | spin_unlock_irq (&sc->sbm_lock); |
2645 | 2650 | ||
2646 | sc->sbm_timer.expires = jiffies + next_tick; | 2651 | sc->sbm_timer.expires = jiffies + next_tick; |
2647 | add_timer(&sc->sbm_timer); | 2652 | add_timer(&sc->sbm_timer); |
2648 | } | 2653 | } |
@@ -2651,13 +2656,13 @@ static void sbmac_timer(unsigned long data) | |||
2651 | static void sbmac_tx_timeout (struct net_device *dev) | 2656 | static void sbmac_tx_timeout (struct net_device *dev) |
2652 | { | 2657 | { |
2653 | struct sbmac_softc *sc = netdev_priv(dev); | 2658 | struct sbmac_softc *sc = netdev_priv(dev); |
2654 | 2659 | ||
2655 | spin_lock_irq (&sc->sbm_lock); | 2660 | spin_lock_irq (&sc->sbm_lock); |
2656 | 2661 | ||
2657 | 2662 | ||
2658 | dev->trans_start = jiffies; | 2663 | dev->trans_start = jiffies; |
2659 | sc->sbm_stats.tx_errors++; | 2664 | sc->sbm_stats.tx_errors++; |
2660 | 2665 | ||
2661 | spin_unlock_irq (&sc->sbm_lock); | 2666 | spin_unlock_irq (&sc->sbm_lock); |
2662 | 2667 | ||
2663 | printk (KERN_WARNING "%s: Transmit timed out\n",dev->name); | 2668 | printk (KERN_WARNING "%s: Transmit timed out\n",dev->name); |
@@ -2670,13 +2675,13 @@ static struct net_device_stats *sbmac_get_stats(struct net_device *dev) | |||
2670 | { | 2675 | { |
2671 | struct sbmac_softc *sc = netdev_priv(dev); | 2676 | struct sbmac_softc *sc = netdev_priv(dev); |
2672 | unsigned long flags; | 2677 | unsigned long flags; |
2673 | 2678 | ||
2674 | spin_lock_irqsave(&sc->sbm_lock, flags); | 2679 | spin_lock_irqsave(&sc->sbm_lock, flags); |
2675 | 2680 | ||
2676 | /* XXX update other stats here */ | 2681 | /* XXX update other stats here */ |
2677 | 2682 | ||
2678 | spin_unlock_irqrestore(&sc->sbm_lock, flags); | 2683 | spin_unlock_irqrestore(&sc->sbm_lock, flags); |
2679 | 2684 | ||
2680 | return &sc->sbm_stats; | 2685 | return &sc->sbm_stats; |
2681 | } | 2686 | } |
2682 | 2687 | ||
@@ -2693,8 +2698,8 @@ static void sbmac_set_rx_mode(struct net_device *dev) | |||
2693 | /* | 2698 | /* |
2694 | * Promiscuous changed. | 2699 | * Promiscuous changed. |
2695 | */ | 2700 | */ |
2696 | 2701 | ||
2697 | if (dev->flags & IFF_PROMISC) { | 2702 | if (dev->flags & IFF_PROMISC) { |
2698 | /* Unconditionally log net taps. */ | 2703 | /* Unconditionally log net taps. */ |
2699 | msg_flag = 1; | 2704 | msg_flag = 1; |
2700 | sbmac_promiscuous_mode(sc,1); | 2705 | sbmac_promiscuous_mode(sc,1); |
@@ -2705,18 +2710,18 @@ static void sbmac_set_rx_mode(struct net_device *dev) | |||
2705 | } | 2710 | } |
2706 | } | 2711 | } |
2707 | spin_unlock_irqrestore(&sc->sbm_lock, flags); | 2712 | spin_unlock_irqrestore(&sc->sbm_lock, flags); |
2708 | 2713 | ||
2709 | if (msg_flag) { | 2714 | if (msg_flag) { |
2710 | printk(KERN_NOTICE "%s: Promiscuous mode %sabled.\n", | 2715 | printk(KERN_NOTICE "%s: Promiscuous mode %sabled.\n", |
2711 | dev->name,(msg_flag==1)?"en":"dis"); | 2716 | dev->name,(msg_flag==1)?"en":"dis"); |
2712 | } | 2717 | } |
2713 | 2718 | ||
2714 | /* | 2719 | /* |
2715 | * Program the multicasts. Do this every time. | 2720 | * Program the multicasts. Do this every time. |
2716 | */ | 2721 | */ |
2717 | 2722 | ||
2718 | sbmac_setmulti(sc); | 2723 | sbmac_setmulti(sc); |
2719 | 2724 | ||
2720 | } | 2725 | } |
2721 | 2726 | ||
2722 | static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 2727 | static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
@@ -2725,10 +2730,10 @@ static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
2725 | u16 *data = (u16 *)&rq->ifr_ifru; | 2730 | u16 *data = (u16 *)&rq->ifr_ifru; |
2726 | unsigned long flags; | 2731 | unsigned long flags; |
2727 | int retval; | 2732 | int retval; |
2728 | 2733 | ||
2729 | spin_lock_irqsave(&sc->sbm_lock, flags); | 2734 | spin_lock_irqsave(&sc->sbm_lock, flags); |
2730 | retval = 0; | 2735 | retval = 0; |
2731 | 2736 | ||
2732 | switch(cmd) { | 2737 | switch(cmd) { |
2733 | case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */ | 2738 | case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */ |
2734 | data[0] = sc->sbm_phys[0] & 0x1f; | 2739 | data[0] = sc->sbm_phys[0] & 0x1f; |
@@ -2750,7 +2755,7 @@ static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
2750 | default: | 2755 | default: |
2751 | retval = -EOPNOTSUPP; | 2756 | retval = -EOPNOTSUPP; |
2752 | } | 2757 | } |
2753 | 2758 | ||
2754 | spin_unlock_irqrestore(&sc->sbm_lock, flags); | 2759 | spin_unlock_irqrestore(&sc->sbm_lock, flags); |
2755 | return retval; | 2760 | return retval; |
2756 | } | 2761 | } |
@@ -2781,7 +2786,7 @@ static int sbmac_close(struct net_device *dev) | |||
2781 | 2786 | ||
2782 | sbdma_emptyring(&(sc->sbm_txdma)); | 2787 | sbdma_emptyring(&(sc->sbm_txdma)); |
2783 | sbdma_emptyring(&(sc->sbm_rxdma)); | 2788 | sbdma_emptyring(&(sc->sbm_rxdma)); |
2784 | 2789 | ||
2785 | return 0; | 2790 | return 0; |
2786 | } | 2791 | } |
2787 | 2792 | ||
@@ -2793,13 +2798,13 @@ sbmac_setup_hwaddr(int chan,char *addr) | |||
2793 | { | 2798 | { |
2794 | uint8_t eaddr[6]; | 2799 | uint8_t eaddr[6]; |
2795 | uint64_t val; | 2800 | uint64_t val; |
2796 | sbmac_port_t port; | 2801 | unsigned long port; |
2797 | 2802 | ||
2798 | port = A_MAC_CHANNEL_BASE(chan); | 2803 | port = A_MAC_CHANNEL_BASE(chan); |
2799 | sbmac_parse_hwaddr(addr,eaddr); | 2804 | sbmac_parse_hwaddr(addr,eaddr); |
2800 | val = sbmac_addr2reg(eaddr); | 2805 | val = sbmac_addr2reg(eaddr); |
2801 | SBMAC_WRITECSR(IOADDR(port+R_MAC_ETHERNET_ADDR),val); | 2806 | __raw_writeq(val, IOADDR(port+R_MAC_ETHERNET_ADDR)); |
2802 | val = SBMAC_READCSR(IOADDR(port+R_MAC_ETHERNET_ADDR)); | 2807 | val = __raw_readq(IOADDR(port+R_MAC_ETHERNET_ADDR)); |
2803 | } | 2808 | } |
2804 | #endif | 2809 | #endif |
2805 | 2810 | ||
@@ -2810,9 +2815,9 @@ sbmac_init_module(void) | |||
2810 | { | 2815 | { |
2811 | int idx; | 2816 | int idx; |
2812 | struct net_device *dev; | 2817 | struct net_device *dev; |
2813 | sbmac_port_t port; | 2818 | unsigned long port; |
2814 | int chip_max_units; | 2819 | int chip_max_units; |
2815 | 2820 | ||
2816 | /* | 2821 | /* |
2817 | * For bringup when not using the firmware, we can pre-fill | 2822 | * For bringup when not using the firmware, we can pre-fill |
2818 | * the MAC addresses using the environment variables | 2823 | * the MAC addresses using the environment variables |
@@ -2858,13 +2863,13 @@ sbmac_init_module(void) | |||
2858 | 2863 | ||
2859 | port = A_MAC_CHANNEL_BASE(idx); | 2864 | port = A_MAC_CHANNEL_BASE(idx); |
2860 | 2865 | ||
2861 | /* | 2866 | /* |
2862 | * The R_MAC_ETHERNET_ADDR register will be set to some nonzero | 2867 | * The R_MAC_ETHERNET_ADDR register will be set to some nonzero |
2863 | * value for us by the firmware if we're going to use this MAC. | 2868 | * value for us by the firmware if we're going to use this MAC. |
2864 | * If we find a zero, skip this MAC. | 2869 | * If we find a zero, skip this MAC. |
2865 | */ | 2870 | */ |
2866 | 2871 | ||
2867 | sbmac_orig_hwaddr[idx] = SBMAC_READCSR(IOADDR(port+R_MAC_ETHERNET_ADDR)); | 2872 | sbmac_orig_hwaddr[idx] = __raw_readq(IOADDR(port+R_MAC_ETHERNET_ADDR)); |
2868 | if (sbmac_orig_hwaddr[idx] == 0) { | 2873 | if (sbmac_orig_hwaddr[idx] == 0) { |
2869 | printk(KERN_DEBUG "sbmac: not configuring MAC at " | 2874 | printk(KERN_DEBUG "sbmac: not configuring MAC at " |
2870 | "%lx\n", port); | 2875 | "%lx\n", port); |
@@ -2876,7 +2881,7 @@ sbmac_init_module(void) | |||
2876 | */ | 2881 | */ |
2877 | 2882 | ||
2878 | dev = alloc_etherdev(sizeof(struct sbmac_softc)); | 2883 | dev = alloc_etherdev(sizeof(struct sbmac_softc)); |
2879 | if (!dev) | 2884 | if (!dev) |
2880 | return -ENOMEM; /* return ENOMEM */ | 2885 | return -ENOMEM; /* return ENOMEM */ |
2881 | 2886 | ||
2882 | printk(KERN_DEBUG "sbmac: configuring MAC at %lx\n", port); | 2887 | printk(KERN_DEBUG "sbmac: configuring MAC at %lx\n", port); |
@@ -2886,8 +2891,7 @@ sbmac_init_module(void) | |||
2886 | dev->mem_end = 0; | 2891 | dev->mem_end = 0; |
2887 | if (sbmac_init(dev, idx)) { | 2892 | if (sbmac_init(dev, idx)) { |
2888 | port = A_MAC_CHANNEL_BASE(idx); | 2893 | port = A_MAC_CHANNEL_BASE(idx); |
2889 | SBMAC_WRITECSR(IOADDR(port+R_MAC_ETHERNET_ADDR), | 2894 | __raw_writeq(sbmac_orig_hwaddr[idx], IOADDR(port+R_MAC_ETHERNET_ADDR)); |
2890 | sbmac_orig_hwaddr[idx]); | ||
2891 | free_netdev(dev); | 2895 | free_netdev(dev); |
2892 | continue; | 2896 | continue; |
2893 | } | 2897 | } |
diff --git a/drivers/net/sgiseeq.c b/drivers/net/sgiseeq.c index 9bc3b1c0dd6a..a4614df38a90 100644 --- a/drivers/net/sgiseeq.c +++ b/drivers/net/sgiseeq.c | |||
@@ -32,8 +32,6 @@ | |||
32 | 32 | ||
33 | #include "sgiseeq.h" | 33 | #include "sgiseeq.h" |
34 | 34 | ||
35 | static char *version = "sgiseeq.c: David S. Miller (dm@engr.sgi.com)\n"; | ||
36 | |||
37 | static char *sgiseeqstr = "SGI Seeq8003"; | 35 | static char *sgiseeqstr = "SGI Seeq8003"; |
38 | 36 | ||
39 | /* | 37 | /* |
@@ -113,9 +111,9 @@ static struct net_device *root_sgiseeq_dev; | |||
113 | 111 | ||
114 | static inline void hpc3_eth_reset(struct hpc3_ethregs *hregs) | 112 | static inline void hpc3_eth_reset(struct hpc3_ethregs *hregs) |
115 | { | 113 | { |
116 | hregs->rx_reset = HPC3_ERXRST_CRESET | HPC3_ERXRST_CLRIRQ; | 114 | hregs->reset = HPC3_ERST_CRESET | HPC3_ERST_CLRIRQ; |
117 | udelay(20); | 115 | udelay(20); |
118 | hregs->rx_reset = 0; | 116 | hregs->reset = 0; |
119 | } | 117 | } |
120 | 118 | ||
121 | static inline void reset_hpc3_and_seeq(struct hpc3_ethregs *hregs, | 119 | static inline void reset_hpc3_and_seeq(struct hpc3_ethregs *hregs, |
@@ -252,7 +250,6 @@ void sgiseeq_dump_rings(void) | |||
252 | 250 | ||
253 | #define TSTAT_INIT_SEEQ (SEEQ_TCMD_IPT|SEEQ_TCMD_I16|SEEQ_TCMD_IC|SEEQ_TCMD_IUF) | 251 | #define TSTAT_INIT_SEEQ (SEEQ_TCMD_IPT|SEEQ_TCMD_I16|SEEQ_TCMD_IC|SEEQ_TCMD_IUF) |
254 | #define TSTAT_INIT_EDLC ((TSTAT_INIT_SEEQ) | SEEQ_TCMD_RB2) | 252 | #define TSTAT_INIT_EDLC ((TSTAT_INIT_SEEQ) | SEEQ_TCMD_RB2) |
255 | #define RDMACFG_INIT (HPC3_ERXDCFG_FRXDC | HPC3_ERXDCFG_FEOP | HPC3_ERXDCFG_FIRQ) | ||
256 | 253 | ||
257 | static int init_seeq(struct net_device *dev, struct sgiseeq_private *sp, | 254 | static int init_seeq(struct net_device *dev, struct sgiseeq_private *sp, |
258 | struct sgiseeq_regs *sregs) | 255 | struct sgiseeq_regs *sregs) |
@@ -274,8 +271,6 @@ static int init_seeq(struct net_device *dev, struct sgiseeq_private *sp, | |||
274 | sregs->tstat = TSTAT_INIT_SEEQ; | 271 | sregs->tstat = TSTAT_INIT_SEEQ; |
275 | } | 272 | } |
276 | 273 | ||
277 | hregs->rx_dconfig |= RDMACFG_INIT; | ||
278 | |||
279 | hregs->rx_ndptr = CPHYSADDR(sp->rx_desc); | 274 | hregs->rx_ndptr = CPHYSADDR(sp->rx_desc); |
280 | hregs->tx_ndptr = CPHYSADDR(sp->tx_desc); | 275 | hregs->tx_ndptr = CPHYSADDR(sp->tx_desc); |
281 | 276 | ||
@@ -446,7 +441,7 @@ static irqreturn_t sgiseeq_interrupt(int irq, void *dev_id, struct pt_regs *regs | |||
446 | spin_lock(&sp->tx_lock); | 441 | spin_lock(&sp->tx_lock); |
447 | 442 | ||
448 | /* Ack the IRQ and set software state. */ | 443 | /* Ack the IRQ and set software state. */ |
449 | hregs->rx_reset = HPC3_ERXRST_CLRIRQ; | 444 | hregs->reset = HPC3_ERST_CLRIRQ; |
450 | 445 | ||
451 | /* Always check for received packets. */ | 446 | /* Always check for received packets. */ |
452 | sgiseeq_rx(dev, sp, hregs, sregs); | 447 | sgiseeq_rx(dev, sp, hregs, sregs); |
@@ -493,11 +488,13 @@ static int sgiseeq_close(struct net_device *dev) | |||
493 | { | 488 | { |
494 | struct sgiseeq_private *sp = netdev_priv(dev); | 489 | struct sgiseeq_private *sp = netdev_priv(dev); |
495 | struct sgiseeq_regs *sregs = sp->sregs; | 490 | struct sgiseeq_regs *sregs = sp->sregs; |
491 | unsigned int irq = dev->irq; | ||
496 | 492 | ||
497 | netif_stop_queue(dev); | 493 | netif_stop_queue(dev); |
498 | 494 | ||
499 | /* Shutdown the Seeq. */ | 495 | /* Shutdown the Seeq. */ |
500 | reset_hpc3_and_seeq(sp->hregs, sregs); | 496 | reset_hpc3_and_seeq(sp->hregs, sregs); |
497 | free_irq(irq, dev); | ||
501 | 498 | ||
502 | return 0; | 499 | return 0; |
503 | } | 500 | } |
@@ -644,7 +641,7 @@ static inline void setup_rx_ring(struct sgiseeq_rx_desc *buf, int nbufs) | |||
644 | 641 | ||
645 | #define ALIGNED(x) ((((unsigned long)(x)) + 0xf) & ~(0xf)) | 642 | #define ALIGNED(x) ((((unsigned long)(x)) + 0xf) & ~(0xf)) |
646 | 643 | ||
647 | static int sgiseeq_init(struct hpc3_regs* regs, int irq) | 644 | static int sgiseeq_init(struct hpc3_regs* hpcregs, int irq) |
648 | { | 645 | { |
649 | struct sgiseeq_init_block *sr; | 646 | struct sgiseeq_init_block *sr; |
650 | struct sgiseeq_private *sp; | 647 | struct sgiseeq_private *sp; |
@@ -680,8 +677,8 @@ static int sgiseeq_init(struct hpc3_regs* regs, int irq) | |||
680 | gpriv = sp; | 677 | gpriv = sp; |
681 | gdev = dev; | 678 | gdev = dev; |
682 | #endif | 679 | #endif |
683 | sp->sregs = (struct sgiseeq_regs *) &hpc3c0->eth_ext[0]; | 680 | sp->sregs = (struct sgiseeq_regs *) &hpcregs->eth_ext[0]; |
684 | sp->hregs = &hpc3c0->ethregs; | 681 | sp->hregs = &hpcregs->ethregs; |
685 | sp->name = sgiseeqstr; | 682 | sp->name = sgiseeqstr; |
686 | sp->mode = SEEQ_RCMD_RBCAST; | 683 | sp->mode = SEEQ_RCMD_RBCAST; |
687 | 684 | ||
@@ -698,6 +695,11 @@ static int sgiseeq_init(struct hpc3_regs* regs, int irq) | |||
698 | setup_rx_ring(sp->rx_desc, SEEQ_RX_BUFFERS); | 695 | setup_rx_ring(sp->rx_desc, SEEQ_RX_BUFFERS); |
699 | setup_tx_ring(sp->tx_desc, SEEQ_TX_BUFFERS); | 696 | setup_tx_ring(sp->tx_desc, SEEQ_TX_BUFFERS); |
700 | 697 | ||
698 | /* Setup PIO and DMA transfer timing */ | ||
699 | sp->hregs->pconfig = 0x161; | ||
700 | sp->hregs->dconfig = HPC3_EDCFG_FIRQ | HPC3_EDCFG_FEOP | | ||
701 | HPC3_EDCFG_FRXDC | HPC3_EDCFG_PTO | 0x026; | ||
702 | |||
701 | /* Reset the chip. */ | 703 | /* Reset the chip. */ |
702 | hpc3_eth_reset(sp->hregs); | 704 | hpc3_eth_reset(sp->hregs); |
703 | 705 | ||
@@ -724,7 +726,7 @@ static int sgiseeq_init(struct hpc3_regs* regs, int irq) | |||
724 | goto err_out_free_page; | 726 | goto err_out_free_page; |
725 | } | 727 | } |
726 | 728 | ||
727 | printk(KERN_INFO "%s: SGI Seeq8003 ", dev->name); | 729 | printk(KERN_INFO "%s: %s ", dev->name, sgiseeqstr); |
728 | for (i = 0; i < 6; i++) | 730 | for (i = 0; i < 6; i++) |
729 | printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':'); | 731 | printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':'); |
730 | 732 | ||
@@ -734,7 +736,7 @@ static int sgiseeq_init(struct hpc3_regs* regs, int irq) | |||
734 | return 0; | 736 | return 0; |
735 | 737 | ||
736 | err_out_free_page: | 738 | err_out_free_page: |
737 | free_page((unsigned long) sp); | 739 | free_page((unsigned long) sp->srings); |
738 | err_out_free_dev: | 740 | err_out_free_dev: |
739 | kfree(dev); | 741 | kfree(dev); |
740 | 742 | ||
@@ -744,8 +746,6 @@ err_out: | |||
744 | 746 | ||
745 | static int __init sgiseeq_probe(void) | 747 | static int __init sgiseeq_probe(void) |
746 | { | 748 | { |
747 | printk(version); | ||
748 | |||
749 | /* On board adapter on 1st HPC is always present */ | 749 | /* On board adapter on 1st HPC is always present */ |
750 | return sgiseeq_init(hpc3c0, SGI_ENET_IRQ); | 750 | return sgiseeq_init(hpc3c0, SGI_ENET_IRQ); |
751 | } | 751 | } |
@@ -754,15 +754,12 @@ static void __exit sgiseeq_exit(void) | |||
754 | { | 754 | { |
755 | struct net_device *next, *dev; | 755 | struct net_device *next, *dev; |
756 | struct sgiseeq_private *sp; | 756 | struct sgiseeq_private *sp; |
757 | int irq; | ||
758 | 757 | ||
759 | for (dev = root_sgiseeq_dev; dev; dev = next) { | 758 | for (dev = root_sgiseeq_dev; dev; dev = next) { |
760 | sp = (struct sgiseeq_private *) netdev_priv(dev); | 759 | sp = (struct sgiseeq_private *) netdev_priv(dev); |
761 | next = sp->next_module; | 760 | next = sp->next_module; |
762 | irq = dev->irq; | ||
763 | unregister_netdev(dev); | 761 | unregister_netdev(dev); |
764 | free_irq(irq, dev); | 762 | free_page((unsigned long) sp->srings); |
765 | free_page((unsigned long) sp); | ||
766 | free_netdev(dev); | 763 | free_netdev(dev); |
767 | } | 764 | } |
768 | } | 765 | } |
@@ -770,4 +767,6 @@ static void __exit sgiseeq_exit(void) | |||
770 | module_init(sgiseeq_probe); | 767 | module_init(sgiseeq_probe); |
771 | module_exit(sgiseeq_exit); | 768 | module_exit(sgiseeq_exit); |
772 | 769 | ||
770 | MODULE_DESCRIPTION("SGI Seeq 8003 driver"); | ||
771 | MODULE_AUTHOR("Linux/MIPS Mailing List <linux-mips@linux-mips.org>"); | ||
773 | MODULE_LICENSE("GPL"); | 772 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index c2e6484ef138..572f121b1f4e 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -730,6 +730,7 @@ static struct ethtool_ops skge_ethtool_ops = { | |||
730 | .phys_id = skge_phys_id, | 730 | .phys_id = skge_phys_id, |
731 | .get_stats_count = skge_get_stats_count, | 731 | .get_stats_count = skge_get_stats_count, |
732 | .get_ethtool_stats = skge_get_ethtool_stats, | 732 | .get_ethtool_stats = skge_get_ethtool_stats, |
733 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
733 | }; | 734 | }; |
734 | 735 | ||
735 | /* | 736 | /* |
@@ -3096,6 +3097,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, | |||
3096 | 3097 | ||
3097 | /* read the mac address */ | 3098 | /* read the mac address */ |
3098 | memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN); | 3099 | memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN); |
3100 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
3099 | 3101 | ||
3100 | /* device is off until link detection */ | 3102 | /* device is off until link detection */ |
3101 | netif_carrier_off(dev); | 3103 | netif_carrier_off(dev); |
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c index f88f5e32b714..cfaf47c63c58 100644 --- a/drivers/net/sunbmac.c +++ b/drivers/net/sunbmac.c | |||
@@ -214,7 +214,8 @@ static void bigmac_init_rings(struct bigmac *bp, int from_irq) | |||
214 | { | 214 | { |
215 | struct bmac_init_block *bb = bp->bmac_block; | 215 | struct bmac_init_block *bb = bp->bmac_block; |
216 | struct net_device *dev = bp->dev; | 216 | struct net_device *dev = bp->dev; |
217 | int i, gfp_flags = GFP_KERNEL; | 217 | int i; |
218 | gfp_t gfp_flags = GFP_KERNEL; | ||
218 | 219 | ||
219 | if (from_irq || in_interrupt()) | 220 | if (from_irq || in_interrupt()) |
220 | gfp_flags = GFP_ATOMIC; | 221 | gfp_flags = GFP_ATOMIC; |
diff --git a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h index 5674003fc38a..b0dbc5187143 100644 --- a/drivers/net/sunbmac.h +++ b/drivers/net/sunbmac.h | |||
@@ -339,7 +339,7 @@ struct bigmac { | |||
339 | #define ALIGNED_RX_SKB_ADDR(addr) \ | 339 | #define ALIGNED_RX_SKB_ADDR(addr) \ |
340 | ((((unsigned long)(addr) + (64 - 1)) & ~(64 - 1)) - (unsigned long)(addr)) | 340 | ((((unsigned long)(addr) + (64 - 1)) & ~(64 - 1)) - (unsigned long)(addr)) |
341 | 341 | ||
342 | static inline struct sk_buff *big_mac_alloc_skb(unsigned int length, int gfp_flags) | 342 | static inline struct sk_buff *big_mac_alloc_skb(unsigned int length, gfp_t gfp_flags) |
343 | { | 343 | { |
344 | struct sk_buff *skb; | 344 | struct sk_buff *skb; |
345 | 345 | ||
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index d500a5771dbc..5de0554fd7c6 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -518,6 +518,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, | |||
518 | #else | 518 | #else |
519 | int bar = 1; | 519 | int bar = 1; |
520 | #endif | 520 | #endif |
521 | int phy, phy_idx = 0; | ||
521 | 522 | ||
522 | 523 | ||
523 | /* when built into the kernel, we only print version if device is found */ | 524 | /* when built into the kernel, we only print version if device is found */ |
@@ -549,6 +550,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, | |||
549 | for (i = 0; i < 3; i++) | 550 | for (i = 0; i < 3; i++) |
550 | ((u16 *)dev->dev_addr)[i] = | 551 | ((u16 *)dev->dev_addr)[i] = |
551 | le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET)); | 552 | le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET)); |
553 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
552 | 554 | ||
553 | dev->base_addr = (unsigned long)ioaddr; | 555 | dev->base_addr = (unsigned long)ioaddr; |
554 | dev->irq = irq; | 556 | dev->irq = irq; |
@@ -605,33 +607,31 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, | |||
605 | printk("%2.2x:", dev->dev_addr[i]); | 607 | printk("%2.2x:", dev->dev_addr[i]); |
606 | printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq); | 608 | printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq); |
607 | 609 | ||
608 | if (1) { | 610 | np->phys[0] = 1; /* Default setting */ |
609 | int phy, phy_idx = 0; | 611 | np->mii_preamble_required++; |
610 | np->phys[0] = 1; /* Default setting */ | 612 | for (phy = 1; phy <= 32 && phy_idx < MII_CNT; phy++) { |
611 | np->mii_preamble_required++; | 613 | int mii_status = mdio_read(dev, phy, MII_BMSR); |
612 | for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) { | 614 | int phyx = phy & 0x1f; |
613 | int mii_status = mdio_read(dev, phy, MII_BMSR); | 615 | if (mii_status != 0xffff && mii_status != 0x0000) { |
614 | if (mii_status != 0xffff && mii_status != 0x0000) { | 616 | np->phys[phy_idx++] = phyx; |
615 | np->phys[phy_idx++] = phy; | 617 | np->mii_if.advertising = mdio_read(dev, phyx, MII_ADVERTISE); |
616 | np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); | 618 | if ((mii_status & 0x0040) == 0) |
617 | if ((mii_status & 0x0040) == 0) | 619 | np->mii_preamble_required++; |
618 | np->mii_preamble_required++; | 620 | printk(KERN_INFO "%s: MII PHY found at address %d, status " |
619 | printk(KERN_INFO "%s: MII PHY found at address %d, status " | 621 | "0x%4.4x advertising %4.4x.\n", |
620 | "0x%4.4x advertising %4.4x.\n", | 622 | dev->name, phyx, mii_status, np->mii_if.advertising); |
621 | dev->name, phy, mii_status, np->mii_if.advertising); | ||
622 | } | ||
623 | } | ||
624 | np->mii_preamble_required--; | ||
625 | |||
626 | if (phy_idx == 0) { | ||
627 | printk(KERN_INFO "%s: No MII transceiver found, aborting. ASIC status %x\n", | ||
628 | dev->name, ioread32(ioaddr + ASICCtrl)); | ||
629 | goto err_out_unregister; | ||
630 | } | 623 | } |
624 | } | ||
625 | np->mii_preamble_required--; | ||
631 | 626 | ||
632 | np->mii_if.phy_id = np->phys[0]; | 627 | if (phy_idx == 0) { |
628 | printk(KERN_INFO "%s: No MII transceiver found, aborting. ASIC status %x\n", | ||
629 | dev->name, ioread32(ioaddr + ASICCtrl)); | ||
630 | goto err_out_unregister; | ||
633 | } | 631 | } |
634 | 632 | ||
633 | np->mii_if.phy_id = np->phys[0]; | ||
634 | |||
635 | /* Parse override configuration */ | 635 | /* Parse override configuration */ |
636 | np->an_enable = 1; | 636 | np->an_enable = 1; |
637 | if (card_idx < MAX_UNITS) { | 637 | if (card_idx < MAX_UNITS) { |
@@ -692,7 +692,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, | |||
692 | /* Reset the chip to erase previous misconfiguration. */ | 692 | /* Reset the chip to erase previous misconfiguration. */ |
693 | if (netif_msg_hw(np)) | 693 | if (netif_msg_hw(np)) |
694 | printk("ASIC Control is %x.\n", ioread32(ioaddr + ASICCtrl)); | 694 | printk("ASIC Control is %x.\n", ioread32(ioaddr + ASICCtrl)); |
695 | iowrite16(0x007f, ioaddr + ASICCtrl + 2); | 695 | iowrite16(0x00ff, ioaddr + ASICCtrl + 2); |
696 | if (netif_msg_hw(np)) | 696 | if (netif_msg_hw(np)) |
697 | printk("ASIC Control is now %x.\n", ioread32(ioaddr + ASICCtrl)); | 697 | printk("ASIC Control is now %x.\n", ioread32(ioaddr + ASICCtrl)); |
698 | 698 | ||
@@ -1619,6 +1619,7 @@ static struct ethtool_ops ethtool_ops = { | |||
1619 | .get_link = get_link, | 1619 | .get_link = get_link, |
1620 | .get_msglevel = get_msglevel, | 1620 | .get_msglevel = get_msglevel, |
1621 | .set_msglevel = set_msglevel, | 1621 | .set_msglevel = set_msglevel, |
1622 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
1622 | }; | 1623 | }; |
1623 | 1624 | ||
1624 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 1625 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c index 32057e65808b..9f491563944e 100644 --- a/drivers/net/tokenring/ibmtr.c +++ b/drivers/net/tokenring/ibmtr.c | |||
@@ -318,7 +318,7 @@ static void ibmtr_cleanup_card(struct net_device *dev) | |||
318 | if (dev->base_addr) { | 318 | if (dev->base_addr) { |
319 | outb(0,dev->base_addr+ADAPTRESET); | 319 | outb(0,dev->base_addr+ADAPTRESET); |
320 | 320 | ||
321 | schedule_timeout(TR_RST_TIME); /* wait 50ms */ | 321 | schedule_timeout_uninterruptible(TR_RST_TIME); /* wait 50ms */ |
322 | 322 | ||
323 | outb(0,dev->base_addr+ADAPTRESETREL); | 323 | outb(0,dev->base_addr+ADAPTRESETREL); |
324 | } | 324 | } |
@@ -854,8 +854,7 @@ static int tok_init_card(struct net_device *dev) | |||
854 | writeb(~INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_EVEN); | 854 | writeb(~INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_EVEN); |
855 | outb(0, PIOaddr + ADAPTRESET); | 855 | outb(0, PIOaddr + ADAPTRESET); |
856 | 856 | ||
857 | current->state=TASK_UNINTERRUPTIBLE; | 857 | schedule_timeout_uninterruptible(TR_RST_TIME); /* wait 50ms */ |
858 | schedule_timeout(TR_RST_TIME); /* wait 50ms */ | ||
859 | 858 | ||
860 | outb(0, PIOaddr + ADAPTRESETREL); | 859 | outb(0, PIOaddr + ADAPTRESETREL); |
861 | #ifdef ENABLE_PAGING | 860 | #ifdef ENABLE_PAGING |
@@ -903,8 +902,8 @@ static int tok_open(struct net_device *dev) | |||
903 | DPRINTK("Adapter is up and running\n"); | 902 | DPRINTK("Adapter is up and running\n"); |
904 | return 0; | 903 | return 0; |
905 | } | 904 | } |
906 | current->state=TASK_INTERRUPTIBLE; | 905 | i=schedule_timeout_interruptible(TR_RETRY_INTERVAL); |
907 | i=schedule_timeout(TR_RETRY_INTERVAL); /* wait 30 seconds */ | 906 | /* wait 30 seconds */ |
908 | if(i!=0) break; /*prob. a signal, like the i>24*HZ case above */ | 907 | if(i!=0) break; /*prob. a signal, like the i>24*HZ case above */ |
909 | } | 908 | } |
910 | outb(0, dev->base_addr + ADAPTRESET);/* kill pending interrupts*/ | 909 | outb(0, dev->base_addr + ADAPTRESET);/* kill pending interrupts*/ |
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c index 9e7923192a49..05477d24fd49 100644 --- a/drivers/net/tokenring/olympic.c +++ b/drivers/net/tokenring/olympic.c | |||
@@ -1101,7 +1101,7 @@ static int olympic_close(struct net_device *dev) | |||
1101 | 1101 | ||
1102 | while(olympic_priv->srb_queued) { | 1102 | while(olympic_priv->srb_queued) { |
1103 | 1103 | ||
1104 | t = schedule_timeout(60*HZ); | 1104 | t = schedule_timeout_interruptible(60*HZ); |
1105 | 1105 | ||
1106 | if(signal_pending(current)) { | 1106 | if(signal_pending(current)) { |
1107 | printk(KERN_WARNING "%s: SRB timed out.\n",dev->name); | 1107 | printk(KERN_WARNING "%s: SRB timed out.\n",dev->name); |
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c index 2e39bf1f7462..c1925590a0e1 100644 --- a/drivers/net/tokenring/tms380tr.c +++ b/drivers/net/tokenring/tms380tr.c | |||
@@ -1243,8 +1243,7 @@ void tms380tr_wait(unsigned long time) | |||
1243 | 1243 | ||
1244 | tmp = jiffies + time/(1000000/HZ); | 1244 | tmp = jiffies + time/(1000000/HZ); |
1245 | do { | 1245 | do { |
1246 | current->state = TASK_INTERRUPTIBLE; | 1246 | tmp = schedule_timeout_interruptible(tmp); |
1247 | tmp = schedule_timeout(tmp); | ||
1248 | } while(time_after(tmp, jiffies)); | 1247 | } while(time_after(tmp, jiffies)); |
1249 | #else | 1248 | #else |
1250 | udelay(time); | 1249 | udelay(time); |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index a22d00198e4d..6b8eee8f7bfd 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -1787,10 +1787,15 @@ static void __init de21041_get_srom_info (struct de_private *de) | |||
1787 | /* DEC now has a specification but early board makers | 1787 | /* DEC now has a specification but early board makers |
1788 | just put the address in the first EEPROM locations. */ | 1788 | just put the address in the first EEPROM locations. */ |
1789 | /* This does memcmp(eedata, eedata+16, 8) */ | 1789 | /* This does memcmp(eedata, eedata+16, 8) */ |
1790 | |||
1791 | #ifndef CONFIG_MIPS_COBALT | ||
1792 | |||
1790 | for (i = 0; i < 8; i ++) | 1793 | for (i = 0; i < 8; i ++) |
1791 | if (ee_data[i] != ee_data[16+i]) | 1794 | if (ee_data[i] != ee_data[16+i]) |
1792 | sa_offset = 20; | 1795 | sa_offset = 20; |
1793 | 1796 | ||
1797 | #endif | ||
1798 | |||
1794 | /* store MAC address */ | 1799 | /* store MAC address */ |
1795 | for (i = 0; i < 6; i ++) | 1800 | for (i = 0; i < 6; i ++) |
1796 | de->dev->dev_addr[i] = ee_data[i + sa_offset]; | 1801 | de->dev->dev_addr[i] = ee_data[i + sa_offset]; |
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index ecfa6f8805ce..4c76cb794bfb 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -419,10 +419,9 @@ typhoon_reset(void __iomem *ioaddr, int wait_type) | |||
419 | TYPHOON_STATUS_WAITING_FOR_HOST) | 419 | TYPHOON_STATUS_WAITING_FOR_HOST) |
420 | goto out; | 420 | goto out; |
421 | 421 | ||
422 | if(wait_type == WaitSleep) { | 422 | if(wait_type == WaitSleep) |
423 | set_current_state(TASK_UNINTERRUPTIBLE); | 423 | schedule_timeout_uninterruptible(1); |
424 | schedule_timeout(1); | 424 | else |
425 | } else | ||
426 | udelay(TYPHOON_UDELAY); | 425 | udelay(TYPHOON_UDELAY); |
427 | } | 426 | } |
428 | 427 | ||
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index fc7738ffbfff..241871589283 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -490,6 +490,8 @@ struct rhine_private { | |||
490 | u8 tx_thresh, rx_thresh; | 490 | u8 tx_thresh, rx_thresh; |
491 | 491 | ||
492 | struct mii_if_info mii_if; | 492 | struct mii_if_info mii_if; |
493 | struct work_struct tx_timeout_task; | ||
494 | struct work_struct check_media_task; | ||
493 | void __iomem *base; | 495 | void __iomem *base; |
494 | }; | 496 | }; |
495 | 497 | ||
@@ -497,6 +499,8 @@ static int mdio_read(struct net_device *dev, int phy_id, int location); | |||
497 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); | 499 | static void mdio_write(struct net_device *dev, int phy_id, int location, int value); |
498 | static int rhine_open(struct net_device *dev); | 500 | static int rhine_open(struct net_device *dev); |
499 | static void rhine_tx_timeout(struct net_device *dev); | 501 | static void rhine_tx_timeout(struct net_device *dev); |
502 | static void rhine_tx_timeout_task(struct net_device *dev); | ||
503 | static void rhine_check_media_task(struct net_device *dev); | ||
500 | static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev); | 504 | static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev); |
501 | static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs); | 505 | static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs); |
502 | static void rhine_tx(struct net_device *dev); | 506 | static void rhine_tx(struct net_device *dev); |
@@ -814,8 +818,9 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
814 | 818 | ||
815 | for (i = 0; i < 6; i++) | 819 | for (i = 0; i < 6; i++) |
816 | dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i); | 820 | dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i); |
821 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
817 | 822 | ||
818 | if (!is_valid_ether_addr(dev->dev_addr)) { | 823 | if (!is_valid_ether_addr(dev->perm_addr)) { |
819 | rc = -EIO; | 824 | rc = -EIO; |
820 | printk(KERN_ERR "Invalid MAC address\n"); | 825 | printk(KERN_ERR "Invalid MAC address\n"); |
821 | goto err_out_unmap; | 826 | goto err_out_unmap; |
@@ -850,6 +855,12 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
850 | if (rp->quirks & rqRhineI) | 855 | if (rp->quirks & rqRhineI) |
851 | dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; | 856 | dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; |
852 | 857 | ||
858 | INIT_WORK(&rp->tx_timeout_task, | ||
859 | (void (*)(void *))rhine_tx_timeout_task, dev); | ||
860 | |||
861 | INIT_WORK(&rp->check_media_task, | ||
862 | (void (*)(void *))rhine_check_media_task, dev); | ||
863 | |||
853 | /* dev->name not defined before register_netdev()! */ | 864 | /* dev->name not defined before register_netdev()! */ |
854 | rc = register_netdev(dev); | 865 | rc = register_netdev(dev); |
855 | if (rc) | 866 | if (rc) |
@@ -1076,6 +1087,11 @@ static void rhine_check_media(struct net_device *dev, unsigned int init_media) | |||
1076 | ioaddr + ChipCmd1); | 1087 | ioaddr + ChipCmd1); |
1077 | } | 1088 | } |
1078 | 1089 | ||
1090 | static void rhine_check_media_task(struct net_device *dev) | ||
1091 | { | ||
1092 | rhine_check_media(dev, 0); | ||
1093 | } | ||
1094 | |||
1079 | static void init_registers(struct net_device *dev) | 1095 | static void init_registers(struct net_device *dev) |
1080 | { | 1096 | { |
1081 | struct rhine_private *rp = netdev_priv(dev); | 1097 | struct rhine_private *rp = netdev_priv(dev); |
@@ -1129,8 +1145,8 @@ static void rhine_disable_linkmon(void __iomem *ioaddr, u32 quirks) | |||
1129 | if (quirks & rqRhineI) { | 1145 | if (quirks & rqRhineI) { |
1130 | iowrite8(0x01, ioaddr + MIIRegAddr); // MII_BMSR | 1146 | iowrite8(0x01, ioaddr + MIIRegAddr); // MII_BMSR |
1131 | 1147 | ||
1132 | /* Can be called from ISR. Evil. */ | 1148 | /* Do not call from ISR! */ |
1133 | mdelay(1); | 1149 | msleep(1); |
1134 | 1150 | ||
1135 | /* 0x80 must be set immediately before turning it off */ | 1151 | /* 0x80 must be set immediately before turning it off */ |
1136 | iowrite8(0x80, ioaddr + MIICmd); | 1152 | iowrite8(0x80, ioaddr + MIICmd); |
@@ -1220,6 +1236,16 @@ static int rhine_open(struct net_device *dev) | |||
1220 | static void rhine_tx_timeout(struct net_device *dev) | 1236 | static void rhine_tx_timeout(struct net_device *dev) |
1221 | { | 1237 | { |
1222 | struct rhine_private *rp = netdev_priv(dev); | 1238 | struct rhine_private *rp = netdev_priv(dev); |
1239 | |||
1240 | /* | ||
1241 | * Move bulk of work outside of interrupt context | ||
1242 | */ | ||
1243 | schedule_work(&rp->tx_timeout_task); | ||
1244 | } | ||
1245 | |||
1246 | static void rhine_tx_timeout_task(struct net_device *dev) | ||
1247 | { | ||
1248 | struct rhine_private *rp = netdev_priv(dev); | ||
1223 | void __iomem *ioaddr = rp->base; | 1249 | void __iomem *ioaddr = rp->base; |
1224 | 1250 | ||
1225 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " | 1251 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " |
@@ -1625,7 +1651,7 @@ static void rhine_error(struct net_device *dev, int intr_status) | |||
1625 | spin_lock(&rp->lock); | 1651 | spin_lock(&rp->lock); |
1626 | 1652 | ||
1627 | if (intr_status & IntrLinkChange) | 1653 | if (intr_status & IntrLinkChange) |
1628 | rhine_check_media(dev, 0); | 1654 | schedule_work(&rp->check_media_task); |
1629 | if (intr_status & IntrStatsMax) { | 1655 | if (intr_status & IntrStatsMax) { |
1630 | rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs); | 1656 | rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs); |
1631 | rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed); | 1657 | rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed); |
@@ -1829,6 +1855,7 @@ static struct ethtool_ops netdev_ethtool_ops = { | |||
1829 | .set_wol = rhine_set_wol, | 1855 | .set_wol = rhine_set_wol, |
1830 | .get_sg = ethtool_op_get_sg, | 1856 | .get_sg = ethtool_op_get_sg, |
1831 | .get_tx_csum = ethtool_op_get_tx_csum, | 1857 | .get_tx_csum = ethtool_op_get_tx_csum, |
1858 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
1832 | }; | 1859 | }; |
1833 | 1860 | ||
1834 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 1861 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
@@ -1872,6 +1899,9 @@ static int rhine_close(struct net_device *dev) | |||
1872 | spin_unlock_irq(&rp->lock); | 1899 | spin_unlock_irq(&rp->lock); |
1873 | 1900 | ||
1874 | free_irq(rp->pdev->irq, dev); | 1901 | free_irq(rp->pdev->irq, dev); |
1902 | |||
1903 | flush_scheduled_work(); | ||
1904 | |||
1875 | free_rbufs(dev); | 1905 | free_rbufs(dev); |
1876 | free_tbufs(dev); | 1906 | free_tbufs(dev); |
1877 | free_ring(dev); | 1907 | free_ring(dev); |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 7ff814fd65d0..ae9e897c255e 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -1617,8 +1617,7 @@ static int get_wait_data(struct cosa_data *cosa) | |||
1617 | return r; | 1617 | return r; |
1618 | } | 1618 | } |
1619 | /* sleep if not ready to read */ | 1619 | /* sleep if not ready to read */ |
1620 | set_current_state(TASK_INTERRUPTIBLE); | 1620 | schedule_timeout_interruptible(1); |
1621 | schedule_timeout(1); | ||
1622 | } | 1621 | } |
1623 | printk(KERN_INFO "cosa: timeout in get_wait_data (status 0x%x)\n", | 1622 | printk(KERN_INFO "cosa: timeout in get_wait_data (status 0x%x)\n", |
1624 | cosa_getstatus(cosa)); | 1623 | cosa_getstatus(cosa)); |
@@ -1644,8 +1643,7 @@ static int put_wait_data(struct cosa_data *cosa, int data) | |||
1644 | } | 1643 | } |
1645 | #if 0 | 1644 | #if 0 |
1646 | /* sleep if not ready to read */ | 1645 | /* sleep if not ready to read */ |
1647 | current->state = TASK_INTERRUPTIBLE; | 1646 | schedule_timeout_interruptible(1); |
1648 | schedule_timeout(1); | ||
1649 | #endif | 1647 | #endif |
1650 | } | 1648 | } |
1651 | printk(KERN_INFO "cosa%d: timeout in put_wait_data (status 0x%x)\n", | 1649 | printk(KERN_INFO "cosa%d: timeout in put_wait_data (status 0x%x)\n", |
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c index 9e56fc346ba4..e6d005726aad 100644 --- a/drivers/net/wan/cycx_drv.c +++ b/drivers/net/wan/cycx_drv.c | |||
@@ -109,7 +109,7 @@ static long cycx_2x_irq_options[] = { 7, 3, 5, 9, 10, 11, 12, 15 }; | |||
109 | * < 0 error. | 109 | * < 0 error. |
110 | * Context: process */ | 110 | * Context: process */ |
111 | 111 | ||
112 | int __init cycx_drv_init(void) | 112 | static int __init cycx_drv_init(void) |
113 | { | 113 | { |
114 | printk(KERN_INFO "%s v%u.%u %s\n", fullname, MOD_VERSION, MOD_RELEASE, | 114 | printk(KERN_INFO "%s v%u.%u %s\n", fullname, MOD_VERSION, MOD_RELEASE, |
115 | copyright); | 115 | copyright); |
@@ -119,7 +119,7 @@ int __init cycx_drv_init(void) | |||
119 | 119 | ||
120 | /* Module 'remove' entry point. | 120 | /* Module 'remove' entry point. |
121 | * o release all remaining system resources */ | 121 | * o release all remaining system resources */ |
122 | void cycx_drv_cleanup(void) | 122 | static void cycx_drv_cleanup(void) |
123 | { | 123 | { |
124 | } | 124 | } |
125 | 125 | ||
@@ -184,8 +184,7 @@ int cycx_down(struct cycx_hw *hw) | |||
184 | } | 184 | } |
185 | 185 | ||
186 | /* Enable interrupt generation. */ | 186 | /* Enable interrupt generation. */ |
187 | EXPORT_SYMBOL(cycx_inten); | 187 | static void cycx_inten(struct cycx_hw *hw) |
188 | void cycx_inten(struct cycx_hw *hw) | ||
189 | { | 188 | { |
190 | writeb(0, hw->dpmbase); | 189 | writeb(0, hw->dpmbase); |
191 | } | 190 | } |
diff --git a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c index 7b48064364dc..430b1f630fb4 100644 --- a/drivers/net/wan/cycx_main.c +++ b/drivers/net/wan/cycx_main.c | |||
@@ -103,7 +103,7 @@ static struct cycx_device *cycx_card_array; /* adapter data space */ | |||
103 | * < 0 error. | 103 | * < 0 error. |
104 | * Context: process | 104 | * Context: process |
105 | */ | 105 | */ |
106 | int __init cycx_init(void) | 106 | static int __init cycx_init(void) |
107 | { | 107 | { |
108 | int cnt, err = -ENOMEM; | 108 | int cnt, err = -ENOMEM; |
109 | 109 | ||
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c index 02d57c0b4243..a631d1c2fa14 100644 --- a/drivers/net/wan/cycx_x25.c +++ b/drivers/net/wan/cycx_x25.c | |||
@@ -78,6 +78,7 @@ | |||
78 | 78 | ||
79 | #define CYCLOMX_X25_DEBUG 1 | 79 | #define CYCLOMX_X25_DEBUG 1 |
80 | 80 | ||
81 | #include <linux/ctype.h> /* isdigit() */ | ||
81 | #include <linux/errno.h> /* return codes */ | 82 | #include <linux/errno.h> /* return codes */ |
82 | #include <linux/if_arp.h> /* ARPHRD_HWX25 */ | 83 | #include <linux/if_arp.h> /* ARPHRD_HWX25 */ |
83 | #include <linux/kernel.h> /* printk(), and other useful stuff */ | 84 | #include <linux/kernel.h> /* printk(), and other useful stuff */ |
@@ -418,7 +419,7 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev, | |||
418 | 419 | ||
419 | /* Set channel timeouts (default if not specified) */ | 420 | /* Set channel timeouts (default if not specified) */ |
420 | chan->idle_tmout = conf->idle_timeout ? conf->idle_timeout : 90; | 421 | chan->idle_tmout = conf->idle_timeout ? conf->idle_timeout : 90; |
421 | } else if (is_digit(conf->addr[0])) { /* PVC */ | 422 | } else if (isdigit(conf->addr[0])) { /* PVC */ |
422 | s16 lcn = dec_to_uint(conf->addr, 0); | 423 | s16 lcn = dec_to_uint(conf->addr, 0); |
423 | 424 | ||
424 | if (lcn >= card->u.x.lo_pvc && lcn <= card->u.x.hi_pvc) | 425 | if (lcn >= card->u.x.lo_pvc && lcn <= card->u.x.hi_pvc) |
@@ -1531,7 +1532,7 @@ static unsigned dec_to_uint(u8 *str, int len) | |||
1531 | if (!len) | 1532 | if (!len) |
1532 | len = strlen(str); | 1533 | len = strlen(str); |
1533 | 1534 | ||
1534 | for (; len && is_digit(*str); ++str, --len) | 1535 | for (; len && isdigit(*str); ++str, --len) |
1535 | val = (val * 10) + (*str - (unsigned) '0'); | 1536 | val = (val * 10) + (*str - (unsigned) '0'); |
1536 | 1537 | ||
1537 | return val; | 1538 | return val; |
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index 520a77a798e2..2f61a47b4716 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
@@ -446,8 +446,8 @@ static inline unsigned int dscc4_tx_quiescent(struct dscc4_dev_priv *dpriv, | |||
446 | return readl(dpriv->base_addr + CH0FTDA + dpriv->dev_id*4) == dpriv->ltda; | 446 | return readl(dpriv->base_addr + CH0FTDA + dpriv->dev_id*4) == dpriv->ltda; |
447 | } | 447 | } |
448 | 448 | ||
449 | int state_check(u32 state, struct dscc4_dev_priv *dpriv, struct net_device *dev, | 449 | static int state_check(u32 state, struct dscc4_dev_priv *dpriv, |
450 | const char *msg) | 450 | struct net_device *dev, const char *msg) |
451 | { | 451 | { |
452 | int ret = 0; | 452 | int ret = 0; |
453 | 453 | ||
@@ -466,8 +466,9 @@ int state_check(u32 state, struct dscc4_dev_priv *dpriv, struct net_device *dev, | |||
466 | return ret; | 466 | return ret; |
467 | } | 467 | } |
468 | 468 | ||
469 | void dscc4_tx_print(struct net_device *dev, struct dscc4_dev_priv *dpriv, | 469 | static void dscc4_tx_print(struct net_device *dev, |
470 | char *msg) | 470 | struct dscc4_dev_priv *dpriv, |
471 | char *msg) | ||
471 | { | 472 | { |
472 | printk(KERN_DEBUG "%s: tx_current=%02d tx_dirty=%02d (%s)\n", | 473 | printk(KERN_DEBUG "%s: tx_current=%02d tx_dirty=%02d (%s)\n", |
473 | dev->name, dpriv->tx_current, dpriv->tx_dirty, msg); | 474 | dev->name, dpriv->tx_current, dpriv->tx_dirty, msg); |
@@ -507,7 +508,8 @@ static void dscc4_release_ring(struct dscc4_dev_priv *dpriv) | |||
507 | } | 508 | } |
508 | } | 509 | } |
509 | 510 | ||
510 | inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv, struct net_device *dev) | 511 | static inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv, |
512 | struct net_device *dev) | ||
511 | { | 513 | { |
512 | unsigned int dirty = dpriv->rx_dirty%RX_RING_SIZE; | 514 | unsigned int dirty = dpriv->rx_dirty%RX_RING_SIZE; |
513 | struct RxFD *rx_fd = dpriv->rx_fd + dirty; | 515 | struct RxFD *rx_fd = dpriv->rx_fd + dirty; |
@@ -542,8 +544,7 @@ static int dscc4_wait_ack_cec(struct dscc4_dev_priv *dpriv, | |||
542 | msg, i); | 544 | msg, i); |
543 | goto done; | 545 | goto done; |
544 | } | 546 | } |
545 | set_current_state(TASK_UNINTERRUPTIBLE); | 547 | schedule_timeout_uninterruptible(10); |
546 | schedule_timeout(10); | ||
547 | rmb(); | 548 | rmb(); |
548 | } while (++i > 0); | 549 | } while (++i > 0); |
549 | printk(KERN_ERR "%s: %s timeout\n", dev->name, msg); | 550 | printk(KERN_ERR "%s: %s timeout\n", dev->name, msg); |
@@ -588,8 +589,7 @@ static inline int dscc4_xpr_ack(struct dscc4_dev_priv *dpriv) | |||
588 | (dpriv->iqtx[cur] & Xpr)) | 589 | (dpriv->iqtx[cur] & Xpr)) |
589 | break; | 590 | break; |
590 | smp_rmb(); | 591 | smp_rmb(); |
591 | set_current_state(TASK_UNINTERRUPTIBLE); | 592 | schedule_timeout_uninterruptible(10); |
592 | schedule_timeout(10); | ||
593 | } while (++i > 0); | 593 | } while (++i > 0); |
594 | 594 | ||
595 | return (i >= 0 ) ? i : -EAGAIN; | 595 | return (i >= 0 ) ? i : -EAGAIN; |
@@ -1035,8 +1035,7 @@ static void dscc4_pci_reset(struct pci_dev *pdev, void __iomem *ioaddr) | |||
1035 | /* Flush posted writes */ | 1035 | /* Flush posted writes */ |
1036 | readl(ioaddr + GSTAR); | 1036 | readl(ioaddr + GSTAR); |
1037 | 1037 | ||
1038 | set_current_state(TASK_UNINTERRUPTIBLE); | 1038 | schedule_timeout_uninterruptible(10); |
1039 | schedule_timeout(10); | ||
1040 | 1039 | ||
1041 | for (i = 0; i < 16; i++) | 1040 | for (i = 0; i < 16; i++) |
1042 | pci_write_config_dword(pdev, i << 2, dscc4_pci_config_store[i]); | 1041 | pci_write_config_dword(pdev, i << 2, dscc4_pci_config_store[i]); |
@@ -1894,7 +1893,7 @@ try: | |||
1894 | * It failed and locked solid. Thus the introduction of a dummy skb. | 1893 | * It failed and locked solid. Thus the introduction of a dummy skb. |
1895 | * Problem is acknowledged in errata sheet DS5. Joy :o/ | 1894 | * Problem is acknowledged in errata sheet DS5. Joy :o/ |
1896 | */ | 1895 | */ |
1897 | struct sk_buff *dscc4_init_dummy_skb(struct dscc4_dev_priv *dpriv) | 1896 | static struct sk_buff *dscc4_init_dummy_skb(struct dscc4_dev_priv *dpriv) |
1898 | { | 1897 | { |
1899 | struct sk_buff *skb; | 1898 | struct sk_buff *skb; |
1900 | 1899 | ||
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 2c83cca34b86..7981a2c7906e 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -74,11 +74,11 @@ MODULE_LICENSE("GPL"); | |||
74 | /* | 74 | /* |
75 | * Modules parameters and associated varaibles | 75 | * Modules parameters and associated varaibles |
76 | */ | 76 | */ |
77 | int fst_txq_low = FST_LOW_WATER_MARK; | 77 | static int fst_txq_low = FST_LOW_WATER_MARK; |
78 | int fst_txq_high = FST_HIGH_WATER_MARK; | 78 | static int fst_txq_high = FST_HIGH_WATER_MARK; |
79 | int fst_max_reads = 7; | 79 | static int fst_max_reads = 7; |
80 | int fst_excluded_cards = 0; | 80 | static int fst_excluded_cards = 0; |
81 | int fst_excluded_list[FST_MAX_CARDS]; | 81 | static int fst_excluded_list[FST_MAX_CARDS]; |
82 | 82 | ||
83 | module_param(fst_txq_low, int, 0); | 83 | module_param(fst_txq_low, int, 0); |
84 | module_param(fst_txq_high, int, 0); | 84 | module_param(fst_txq_high, int, 0); |
@@ -572,13 +572,13 @@ static void do_bottom_half_rx(struct fst_card_info *card); | |||
572 | static void fst_process_tx_work_q(unsigned long work_q); | 572 | static void fst_process_tx_work_q(unsigned long work_q); |
573 | static void fst_process_int_work_q(unsigned long work_q); | 573 | static void fst_process_int_work_q(unsigned long work_q); |
574 | 574 | ||
575 | DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0); | 575 | static DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0); |
576 | DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0); | 576 | static DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0); |
577 | 577 | ||
578 | struct fst_card_info *fst_card_array[FST_MAX_CARDS]; | 578 | static struct fst_card_info *fst_card_array[FST_MAX_CARDS]; |
579 | spinlock_t fst_work_q_lock; | 579 | static spinlock_t fst_work_q_lock; |
580 | u64 fst_work_txq; | 580 | static u64 fst_work_txq; |
581 | u64 fst_work_intq; | 581 | static u64 fst_work_intq; |
582 | 582 | ||
583 | static void | 583 | static void |
584 | fst_q_work_item(u64 * queue, int card_index) | 584 | fst_q_work_item(u64 * queue, int card_index) |
@@ -980,8 +980,7 @@ fst_issue_cmd(struct fst_port_info *port, unsigned short cmd) | |||
980 | /* Wait for any previous command to complete */ | 980 | /* Wait for any previous command to complete */ |
981 | while (mbval > NAK) { | 981 | while (mbval > NAK) { |
982 | spin_unlock_irqrestore(&card->card_lock, flags); | 982 | spin_unlock_irqrestore(&card->card_lock, flags); |
983 | set_current_state(TASK_UNINTERRUPTIBLE); | 983 | schedule_timeout_uninterruptible(1); |
984 | schedule_timeout(1); | ||
985 | spin_lock_irqsave(&card->card_lock, flags); | 984 | spin_lock_irqsave(&card->card_lock, flags); |
986 | 985 | ||
987 | if (++safety > 2000) { | 986 | if (++safety > 2000) { |
@@ -1498,7 +1497,7 @@ do_bottom_half_rx(struct fst_card_info *card) | |||
1498 | * The interrupt service routine | 1497 | * The interrupt service routine |
1499 | * Dev_id is our fst_card_info pointer | 1498 | * Dev_id is our fst_card_info pointer |
1500 | */ | 1499 | */ |
1501 | irqreturn_t | 1500 | static irqreturn_t |
1502 | fst_intr(int irq, void *dev_id, struct pt_regs *regs) | 1501 | fst_intr(int irq, void *dev_id, struct pt_regs *regs) |
1503 | { | 1502 | { |
1504 | struct fst_card_info *card; | 1503 | struct fst_card_info *card; |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index a5d6891c9d4c..e1601d35dced 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -330,7 +330,7 @@ static int pvc_close(struct net_device *dev) | |||
330 | 330 | ||
331 | 331 | ||
332 | 332 | ||
333 | int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 333 | static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
334 | { | 334 | { |
335 | pvc_device *pvc = dev_to_pvc(dev); | 335 | pvc_device *pvc = dev_to_pvc(dev); |
336 | fr_proto_pvc_info info; | 336 | fr_proto_pvc_info info; |
diff --git a/drivers/net/wan/lmc/lmc_debug.c b/drivers/net/wan/lmc/lmc_debug.c index 9dccd9546a17..3b94352b0d03 100644 --- a/drivers/net/wan/lmc/lmc_debug.c +++ b/drivers/net/wan/lmc/lmc_debug.c | |||
@@ -8,10 +8,10 @@ | |||
8 | /* | 8 | /* |
9 | * Prints out len, max to 80 octets using printk, 20 per line | 9 | * Prints out len, max to 80 octets using printk, 20 per line |
10 | */ | 10 | */ |
11 | void lmcConsoleLog(char *type, unsigned char *ucData, int iLen) | ||
12 | { | ||
13 | #ifdef DEBUG | 11 | #ifdef DEBUG |
14 | #ifdef LMC_PACKET_LOG | 12 | #ifdef LMC_PACKET_LOG |
13 | void lmcConsoleLog(char *type, unsigned char *ucData, int iLen) | ||
14 | { | ||
15 | int iNewLine = 1; | 15 | int iNewLine = 1; |
16 | char str[80], *pstr; | 16 | char str[80], *pstr; |
17 | 17 | ||
@@ -43,26 +43,24 @@ void lmcConsoleLog(char *type, unsigned char *ucData, int iLen) | |||
43 | } | 43 | } |
44 | sprintf(pstr, "\n"); | 44 | sprintf(pstr, "\n"); |
45 | printk(str); | 45 | printk(str); |
46 | } | ||
46 | #endif | 47 | #endif |
47 | #endif | 48 | #endif |
48 | } | ||
49 | 49 | ||
50 | #ifdef DEBUG | 50 | #ifdef DEBUG |
51 | u_int32_t lmcEventLogIndex = 0; | 51 | u_int32_t lmcEventLogIndex = 0; |
52 | u_int32_t lmcEventLogBuf[LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS]; | 52 | u_int32_t lmcEventLogBuf[LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS]; |
53 | #endif | ||
54 | 53 | ||
55 | void lmcEventLog (u_int32_t EventNum, u_int32_t arg2, u_int32_t arg3) | 54 | void lmcEventLog (u_int32_t EventNum, u_int32_t arg2, u_int32_t arg3) |
56 | { | 55 | { |
57 | #ifdef DEBUG | ||
58 | lmcEventLogBuf[lmcEventLogIndex++] = EventNum; | 56 | lmcEventLogBuf[lmcEventLogIndex++] = EventNum; |
59 | lmcEventLogBuf[lmcEventLogIndex++] = arg2; | 57 | lmcEventLogBuf[lmcEventLogIndex++] = arg2; |
60 | lmcEventLogBuf[lmcEventLogIndex++] = arg3; | 58 | lmcEventLogBuf[lmcEventLogIndex++] = arg3; |
61 | lmcEventLogBuf[lmcEventLogIndex++] = jiffies; | 59 | lmcEventLogBuf[lmcEventLogIndex++] = jiffies; |
62 | 60 | ||
63 | lmcEventLogIndex &= (LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS) - 1; | 61 | lmcEventLogIndex &= (LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS) - 1; |
64 | #endif | ||
65 | } | 62 | } |
63 | #endif /* DEBUG */ | ||
66 | 64 | ||
67 | void lmc_trace(struct net_device *dev, char *msg){ | 65 | void lmc_trace(struct net_device *dev, char *msg){ |
68 | #ifdef LMC_TRACE | 66 | #ifdef LMC_TRACE |
diff --git a/drivers/net/wan/lmc/lmc_media.c b/drivers/net/wan/lmc/lmc_media.c index f55ce76b00ed..af8b55fdd9d9 100644 --- a/drivers/net/wan/lmc/lmc_media.c +++ b/drivers/net/wan/lmc/lmc_media.c | |||
@@ -48,14 +48,6 @@ | |||
48 | */ | 48 | */ |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * For lack of a better place, put the SSI cable stuff here. | ||
52 | */ | ||
53 | char *lmc_t1_cables[] = { | ||
54 | "V.10/RS423", "EIA530A", "reserved", "X.21", "V.35", | ||
55 | "EIA449/EIA530/V.36", "V.28/EIA232", "none", NULL | ||
56 | }; | ||
57 | |||
58 | /* | ||
59 | * protocol independent method. | 51 | * protocol independent method. |
60 | */ | 52 | */ |
61 | static void lmc_set_protocol (lmc_softc_t * const, lmc_ctl_t *); | 53 | static void lmc_set_protocol (lmc_softc_t * const, lmc_ctl_t *); |
diff --git a/drivers/net/wan/pc300.h b/drivers/net/wan/pc300.h index 73401b0f0151..2024b26b99e6 100644 --- a/drivers/net/wan/pc300.h +++ b/drivers/net/wan/pc300.h | |||
@@ -472,24 +472,8 @@ enum pc300_loopback_cmds { | |||
472 | 472 | ||
473 | #ifdef __KERNEL__ | 473 | #ifdef __KERNEL__ |
474 | /* Function Prototypes */ | 474 | /* Function Prototypes */ |
475 | int dma_buf_write(pc300_t *, int, ucchar *, int); | ||
476 | int dma_buf_read(pc300_t *, int, struct sk_buff *); | ||
477 | void tx_dma_start(pc300_t *, int); | 475 | void tx_dma_start(pc300_t *, int); |
478 | void rx_dma_start(pc300_t *, int); | ||
479 | void tx_dma_stop(pc300_t *, int); | ||
480 | void rx_dma_stop(pc300_t *, int); | ||
481 | int cpc_queue_xmit(struct sk_buff *, struct net_device *); | ||
482 | void cpc_net_rx(struct net_device *); | ||
483 | void cpc_sca_status(pc300_t *, int); | ||
484 | int cpc_change_mtu(struct net_device *, int); | ||
485 | int cpc_ioctl(struct net_device *, struct ifreq *, int); | ||
486 | int ch_config(pc300dev_t *); | ||
487 | int rx_config(pc300dev_t *); | ||
488 | int tx_config(pc300dev_t *); | ||
489 | void cpc_opench(pc300dev_t *); | ||
490 | void cpc_closech(pc300dev_t *); | ||
491 | int cpc_open(struct net_device *dev); | 476 | int cpc_open(struct net_device *dev); |
492 | int cpc_close(struct net_device *dev); | ||
493 | int cpc_set_media(hdlc_device *, int); | 477 | int cpc_set_media(hdlc_device *, int); |
494 | #endif /* __KERNEL__ */ | 478 | #endif /* __KERNEL__ */ |
495 | 479 | ||
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c index 3e7753b10717..a3e65d1bc19b 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c | |||
@@ -291,6 +291,7 @@ static uclong detect_ram(pc300_t *); | |||
291 | static void plx_init(pc300_t *); | 291 | static void plx_init(pc300_t *); |
292 | static void cpc_trace(struct net_device *, struct sk_buff *, char); | 292 | static void cpc_trace(struct net_device *, struct sk_buff *, char); |
293 | static int cpc_attach(struct net_device *, unsigned short, unsigned short); | 293 | static int cpc_attach(struct net_device *, unsigned short, unsigned short); |
294 | static int cpc_close(struct net_device *dev); | ||
294 | 295 | ||
295 | #ifdef CONFIG_PC300_MLPPP | 296 | #ifdef CONFIG_PC300_MLPPP |
296 | void cpc_tty_init(pc300dev_t * dev); | 297 | void cpc_tty_init(pc300dev_t * dev); |
@@ -437,7 +438,7 @@ static void rx_dma_buf_check(pc300_t * card, int ch) | |||
437 | printk("\n"); | 438 | printk("\n"); |
438 | } | 439 | } |
439 | 440 | ||
440 | int dma_get_rx_frame_size(pc300_t * card, int ch) | 441 | static int dma_get_rx_frame_size(pc300_t * card, int ch) |
441 | { | 442 | { |
442 | volatile pcsca_bd_t __iomem *ptdescr; | 443 | volatile pcsca_bd_t __iomem *ptdescr; |
443 | ucshort first_bd = card->chan[ch].rx_first_bd; | 444 | ucshort first_bd = card->chan[ch].rx_first_bd; |
@@ -462,7 +463,7 @@ int dma_get_rx_frame_size(pc300_t * card, int ch) | |||
462 | * dma_buf_write: writes a frame to the Tx DMA buffers | 463 | * dma_buf_write: writes a frame to the Tx DMA buffers |
463 | * NOTE: this function writes one frame at a time. | 464 | * NOTE: this function writes one frame at a time. |
464 | */ | 465 | */ |
465 | int dma_buf_write(pc300_t * card, int ch, ucchar * ptdata, int len) | 466 | static int dma_buf_write(pc300_t * card, int ch, ucchar * ptdata, int len) |
466 | { | 467 | { |
467 | int i, nchar; | 468 | int i, nchar; |
468 | volatile pcsca_bd_t __iomem *ptdescr; | 469 | volatile pcsca_bd_t __iomem *ptdescr; |
@@ -503,7 +504,7 @@ int dma_buf_write(pc300_t * card, int ch, ucchar * ptdata, int len) | |||
503 | * dma_buf_read: reads a frame from the Rx DMA buffers | 504 | * dma_buf_read: reads a frame from the Rx DMA buffers |
504 | * NOTE: this function reads one frame at a time. | 505 | * NOTE: this function reads one frame at a time. |
505 | */ | 506 | */ |
506 | int dma_buf_read(pc300_t * card, int ch, struct sk_buff *skb) | 507 | static int dma_buf_read(pc300_t * card, int ch, struct sk_buff *skb) |
507 | { | 508 | { |
508 | int nchar; | 509 | int nchar; |
509 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 510 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
@@ -560,7 +561,7 @@ int dma_buf_read(pc300_t * card, int ch, struct sk_buff *skb) | |||
560 | return (rcvd); | 561 | return (rcvd); |
561 | } | 562 | } |
562 | 563 | ||
563 | void tx_dma_stop(pc300_t * card, int ch) | 564 | static void tx_dma_stop(pc300_t * card, int ch) |
564 | { | 565 | { |
565 | void __iomem *scabase = card->hw.scabase; | 566 | void __iomem *scabase = card->hw.scabase; |
566 | ucchar drr_ena_bit = 1 << (5 + 2 * ch); | 567 | ucchar drr_ena_bit = 1 << (5 + 2 * ch); |
@@ -571,7 +572,7 @@ void tx_dma_stop(pc300_t * card, int ch) | |||
571 | cpc_writeb(scabase + DRR, drr_rst_bit & ~drr_ena_bit); | 572 | cpc_writeb(scabase + DRR, drr_rst_bit & ~drr_ena_bit); |
572 | } | 573 | } |
573 | 574 | ||
574 | void rx_dma_stop(pc300_t * card, int ch) | 575 | static void rx_dma_stop(pc300_t * card, int ch) |
575 | { | 576 | { |
576 | void __iomem *scabase = card->hw.scabase; | 577 | void __iomem *scabase = card->hw.scabase; |
577 | ucchar drr_ena_bit = 1 << (4 + 2 * ch); | 578 | ucchar drr_ena_bit = 1 << (4 + 2 * ch); |
@@ -582,7 +583,7 @@ void rx_dma_stop(pc300_t * card, int ch) | |||
582 | cpc_writeb(scabase + DRR, drr_rst_bit & ~drr_ena_bit); | 583 | cpc_writeb(scabase + DRR, drr_rst_bit & ~drr_ena_bit); |
583 | } | 584 | } |
584 | 585 | ||
585 | void rx_dma_start(pc300_t * card, int ch) | 586 | static void rx_dma_start(pc300_t * card, int ch) |
586 | { | 587 | { |
587 | void __iomem *scabase = card->hw.scabase; | 588 | void __iomem *scabase = card->hw.scabase; |
588 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 589 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
@@ -607,7 +608,7 @@ void rx_dma_start(pc300_t * card, int ch) | |||
607 | /*************************/ | 608 | /*************************/ |
608 | /*** FALC Routines ***/ | 609 | /*** FALC Routines ***/ |
609 | /*************************/ | 610 | /*************************/ |
610 | void falc_issue_cmd(pc300_t * card, int ch, ucchar cmd) | 611 | static void falc_issue_cmd(pc300_t * card, int ch, ucchar cmd) |
611 | { | 612 | { |
612 | void __iomem *falcbase = card->hw.falcbase; | 613 | void __iomem *falcbase = card->hw.falcbase; |
613 | unsigned long i = 0; | 614 | unsigned long i = 0; |
@@ -622,7 +623,7 @@ void falc_issue_cmd(pc300_t * card, int ch, ucchar cmd) | |||
622 | cpc_writeb(falcbase + F_REG(CMDR, ch), cmd); | 623 | cpc_writeb(falcbase + F_REG(CMDR, ch), cmd); |
623 | } | 624 | } |
624 | 625 | ||
625 | void falc_intr_enable(pc300_t * card, int ch) | 626 | static void falc_intr_enable(pc300_t * card, int ch) |
626 | { | 627 | { |
627 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 628 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
628 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 629 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -672,7 +673,7 @@ void falc_intr_enable(pc300_t * card, int ch) | |||
672 | } | 673 | } |
673 | } | 674 | } |
674 | 675 | ||
675 | void falc_open_timeslot(pc300_t * card, int ch, int timeslot) | 676 | static void falc_open_timeslot(pc300_t * card, int ch, int timeslot) |
676 | { | 677 | { |
677 | void __iomem *falcbase = card->hw.falcbase; | 678 | void __iomem *falcbase = card->hw.falcbase; |
678 | ucchar tshf = card->chan[ch].falc.offset; | 679 | ucchar tshf = card->chan[ch].falc.offset; |
@@ -688,7 +689,7 @@ void falc_open_timeslot(pc300_t * card, int ch, int timeslot) | |||
688 | (0x80 >> (timeslot & 0x07))); | 689 | (0x80 >> (timeslot & 0x07))); |
689 | } | 690 | } |
690 | 691 | ||
691 | void falc_close_timeslot(pc300_t * card, int ch, int timeslot) | 692 | static void falc_close_timeslot(pc300_t * card, int ch, int timeslot) |
692 | { | 693 | { |
693 | void __iomem *falcbase = card->hw.falcbase; | 694 | void __iomem *falcbase = card->hw.falcbase; |
694 | ucchar tshf = card->chan[ch].falc.offset; | 695 | ucchar tshf = card->chan[ch].falc.offset; |
@@ -704,7 +705,7 @@ void falc_close_timeslot(pc300_t * card, int ch, int timeslot) | |||
704 | ~(0x80 >> (timeslot & 0x07))); | 705 | ~(0x80 >> (timeslot & 0x07))); |
705 | } | 706 | } |
706 | 707 | ||
707 | void falc_close_all_timeslots(pc300_t * card, int ch) | 708 | static void falc_close_all_timeslots(pc300_t * card, int ch) |
708 | { | 709 | { |
709 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 710 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
710 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 711 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -726,7 +727,7 @@ void falc_close_all_timeslots(pc300_t * card, int ch) | |||
726 | } | 727 | } |
727 | } | 728 | } |
728 | 729 | ||
729 | void falc_open_all_timeslots(pc300_t * card, int ch) | 730 | static void falc_open_all_timeslots(pc300_t * card, int ch) |
730 | { | 731 | { |
731 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 732 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
732 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 733 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -758,7 +759,7 @@ void falc_open_all_timeslots(pc300_t * card, int ch) | |||
758 | } | 759 | } |
759 | } | 760 | } |
760 | 761 | ||
761 | void falc_init_timeslot(pc300_t * card, int ch) | 762 | static void falc_init_timeslot(pc300_t * card, int ch) |
762 | { | 763 | { |
763 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 764 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
764 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 765 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -776,7 +777,7 @@ void falc_init_timeslot(pc300_t * card, int ch) | |||
776 | } | 777 | } |
777 | } | 778 | } |
778 | 779 | ||
779 | void falc_enable_comm(pc300_t * card, int ch) | 780 | static void falc_enable_comm(pc300_t * card, int ch) |
780 | { | 781 | { |
781 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 782 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
782 | falc_t *pfalc = (falc_t *) & chan->falc; | 783 | falc_t *pfalc = (falc_t *) & chan->falc; |
@@ -792,7 +793,7 @@ void falc_enable_comm(pc300_t * card, int ch) | |||
792 | ~((CPLD_REG1_FALC_DCD | CPLD_REG1_FALC_CTS) << (2 * ch))); | 793 | ~((CPLD_REG1_FALC_DCD | CPLD_REG1_FALC_CTS) << (2 * ch))); |
793 | } | 794 | } |
794 | 795 | ||
795 | void falc_disable_comm(pc300_t * card, int ch) | 796 | static void falc_disable_comm(pc300_t * card, int ch) |
796 | { | 797 | { |
797 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 798 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
798 | falc_t *pfalc = (falc_t *) & chan->falc; | 799 | falc_t *pfalc = (falc_t *) & chan->falc; |
@@ -806,7 +807,7 @@ void falc_disable_comm(pc300_t * card, int ch) | |||
806 | ((CPLD_REG1_FALC_DCD | CPLD_REG1_FALC_CTS) << (2 * ch))); | 807 | ((CPLD_REG1_FALC_DCD | CPLD_REG1_FALC_CTS) << (2 * ch))); |
807 | } | 808 | } |
808 | 809 | ||
809 | void falc_init_t1(pc300_t * card, int ch) | 810 | static void falc_init_t1(pc300_t * card, int ch) |
810 | { | 811 | { |
811 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 812 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
812 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 813 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -975,7 +976,7 @@ void falc_init_t1(pc300_t * card, int ch) | |||
975 | falc_close_all_timeslots(card, ch); | 976 | falc_close_all_timeslots(card, ch); |
976 | } | 977 | } |
977 | 978 | ||
978 | void falc_init_e1(pc300_t * card, int ch) | 979 | static void falc_init_e1(pc300_t * card, int ch) |
979 | { | 980 | { |
980 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 981 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
981 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 982 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -1155,7 +1156,7 @@ void falc_init_e1(pc300_t * card, int ch) | |||
1155 | falc_close_all_timeslots(card, ch); | 1156 | falc_close_all_timeslots(card, ch); |
1156 | } | 1157 | } |
1157 | 1158 | ||
1158 | void falc_init_hdlc(pc300_t * card, int ch) | 1159 | static void falc_init_hdlc(pc300_t * card, int ch) |
1159 | { | 1160 | { |
1160 | void __iomem *falcbase = card->hw.falcbase; | 1161 | void __iomem *falcbase = card->hw.falcbase; |
1161 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1162 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
@@ -1181,7 +1182,7 @@ void falc_init_hdlc(pc300_t * card, int ch) | |||
1181 | falc_intr_enable(card, ch); | 1182 | falc_intr_enable(card, ch); |
1182 | } | 1183 | } |
1183 | 1184 | ||
1184 | void te_config(pc300_t * card, int ch) | 1185 | static void te_config(pc300_t * card, int ch) |
1185 | { | 1186 | { |
1186 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1187 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1187 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 1188 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -1241,7 +1242,7 @@ void te_config(pc300_t * card, int ch) | |||
1241 | CPC_UNLOCK(card, flags); | 1242 | CPC_UNLOCK(card, flags); |
1242 | } | 1243 | } |
1243 | 1244 | ||
1244 | void falc_check_status(pc300_t * card, int ch, unsigned char frs0) | 1245 | static void falc_check_status(pc300_t * card, int ch, unsigned char frs0) |
1245 | { | 1246 | { |
1246 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1247 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1247 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 1248 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -1397,7 +1398,7 @@ void falc_check_status(pc300_t * card, int ch, unsigned char frs0) | |||
1397 | } | 1398 | } |
1398 | } | 1399 | } |
1399 | 1400 | ||
1400 | void falc_update_stats(pc300_t * card, int ch) | 1401 | static void falc_update_stats(pc300_t * card, int ch) |
1401 | { | 1402 | { |
1402 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1403 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1403 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 1404 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -1450,7 +1451,7 @@ void falc_update_stats(pc300_t * card, int ch) | |||
1450 | * the synchronizer and then sent to the system interface. | 1451 | * the synchronizer and then sent to the system interface. |
1451 | *---------------------------------------------------------------------------- | 1452 | *---------------------------------------------------------------------------- |
1452 | */ | 1453 | */ |
1453 | void falc_remote_loop(pc300_t * card, int ch, int loop_on) | 1454 | static void falc_remote_loop(pc300_t * card, int ch, int loop_on) |
1454 | { | 1455 | { |
1455 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1456 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1456 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 1457 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -1495,7 +1496,7 @@ void falc_remote_loop(pc300_t * card, int ch, int loop_on) | |||
1495 | * coding must be identical. | 1496 | * coding must be identical. |
1496 | *---------------------------------------------------------------------------- | 1497 | *---------------------------------------------------------------------------- |
1497 | */ | 1498 | */ |
1498 | void falc_local_loop(pc300_t * card, int ch, int loop_on) | 1499 | static void falc_local_loop(pc300_t * card, int ch, int loop_on) |
1499 | { | 1500 | { |
1500 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1501 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1501 | falc_t *pfalc = (falc_t *) & chan->falc; | 1502 | falc_t *pfalc = (falc_t *) & chan->falc; |
@@ -1522,7 +1523,7 @@ void falc_local_loop(pc300_t * card, int ch, int loop_on) | |||
1522 | * looped. They are originated by the FALC-LH transmitter. | 1523 | * looped. They are originated by the FALC-LH transmitter. |
1523 | *---------------------------------------------------------------------------- | 1524 | *---------------------------------------------------------------------------- |
1524 | */ | 1525 | */ |
1525 | void falc_payload_loop(pc300_t * card, int ch, int loop_on) | 1526 | static void falc_payload_loop(pc300_t * card, int ch, int loop_on) |
1526 | { | 1527 | { |
1527 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1528 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1528 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 1529 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -1576,7 +1577,7 @@ void falc_payload_loop(pc300_t * card, int ch, int loop_on) | |||
1576 | * Description: Turns XLU bit off in the proper register | 1577 | * Description: Turns XLU bit off in the proper register |
1577 | *---------------------------------------------------------------------------- | 1578 | *---------------------------------------------------------------------------- |
1578 | */ | 1579 | */ |
1579 | void turn_off_xlu(pc300_t * card, int ch) | 1580 | static void turn_off_xlu(pc300_t * card, int ch) |
1580 | { | 1581 | { |
1581 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1582 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1582 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 1583 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -1597,7 +1598,7 @@ void turn_off_xlu(pc300_t * card, int ch) | |||
1597 | * Description: Turns XLD bit off in the proper register | 1598 | * Description: Turns XLD bit off in the proper register |
1598 | *---------------------------------------------------------------------------- | 1599 | *---------------------------------------------------------------------------- |
1599 | */ | 1600 | */ |
1600 | void turn_off_xld(pc300_t * card, int ch) | 1601 | static void turn_off_xld(pc300_t * card, int ch) |
1601 | { | 1602 | { |
1602 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1603 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1603 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 1604 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -1619,7 +1620,7 @@ void turn_off_xld(pc300_t * card, int ch) | |||
1619 | * to generate a LOOP activation code over a T1/E1 line. | 1620 | * to generate a LOOP activation code over a T1/E1 line. |
1620 | *---------------------------------------------------------------------------- | 1621 | *---------------------------------------------------------------------------- |
1621 | */ | 1622 | */ |
1622 | void falc_generate_loop_up_code(pc300_t * card, int ch) | 1623 | static void falc_generate_loop_up_code(pc300_t * card, int ch) |
1623 | { | 1624 | { |
1624 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1625 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1625 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 1626 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -1652,7 +1653,7 @@ void falc_generate_loop_up_code(pc300_t * card, int ch) | |||
1652 | * to generate a LOOP deactivation code over a T1/E1 line. | 1653 | * to generate a LOOP deactivation code over a T1/E1 line. |
1653 | *---------------------------------------------------------------------------- | 1654 | *---------------------------------------------------------------------------- |
1654 | */ | 1655 | */ |
1655 | void falc_generate_loop_down_code(pc300_t * card, int ch) | 1656 | static void falc_generate_loop_down_code(pc300_t * card, int ch) |
1656 | { | 1657 | { |
1657 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1658 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1658 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 1659 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -1682,7 +1683,7 @@ void falc_generate_loop_down_code(pc300_t * card, int ch) | |||
1682 | * it on the reception side. | 1683 | * it on the reception side. |
1683 | *---------------------------------------------------------------------------- | 1684 | *---------------------------------------------------------------------------- |
1684 | */ | 1685 | */ |
1685 | void falc_pattern_test(pc300_t * card, int ch, unsigned int activate) | 1686 | static void falc_pattern_test(pc300_t * card, int ch, unsigned int activate) |
1686 | { | 1687 | { |
1687 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1688 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1688 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 1689 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -1729,7 +1730,7 @@ void falc_pattern_test(pc300_t * card, int ch, unsigned int activate) | |||
1729 | * Description: This routine returns the bit error counter value | 1730 | * Description: This routine returns the bit error counter value |
1730 | *---------------------------------------------------------------------------- | 1731 | *---------------------------------------------------------------------------- |
1731 | */ | 1732 | */ |
1732 | ucshort falc_pattern_test_error(pc300_t * card, int ch) | 1733 | static ucshort falc_pattern_test_error(pc300_t * card, int ch) |
1733 | { | 1734 | { |
1734 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; | 1735 | pc300ch_t *chan = (pc300ch_t *) & card->chan[ch]; |
1735 | falc_t *pfalc = (falc_t *) & chan->falc; | 1736 | falc_t *pfalc = (falc_t *) & chan->falc; |
@@ -1769,7 +1770,7 @@ cpc_trace(struct net_device *dev, struct sk_buff *skb_main, char rx_tx) | |||
1769 | netif_rx(skb); | 1770 | netif_rx(skb); |
1770 | } | 1771 | } |
1771 | 1772 | ||
1772 | void cpc_tx_timeout(struct net_device *dev) | 1773 | static void cpc_tx_timeout(struct net_device *dev) |
1773 | { | 1774 | { |
1774 | pc300dev_t *d = (pc300dev_t *) dev->priv; | 1775 | pc300dev_t *d = (pc300dev_t *) dev->priv; |
1775 | pc300ch_t *chan = (pc300ch_t *) d->chan; | 1776 | pc300ch_t *chan = (pc300ch_t *) d->chan; |
@@ -1797,7 +1798,7 @@ void cpc_tx_timeout(struct net_device *dev) | |||
1797 | netif_wake_queue(dev); | 1798 | netif_wake_queue(dev); |
1798 | } | 1799 | } |
1799 | 1800 | ||
1800 | int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev) | 1801 | static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev) |
1801 | { | 1802 | { |
1802 | pc300dev_t *d = (pc300dev_t *) dev->priv; | 1803 | pc300dev_t *d = (pc300dev_t *) dev->priv; |
1803 | pc300ch_t *chan = (pc300ch_t *) d->chan; | 1804 | pc300ch_t *chan = (pc300ch_t *) d->chan; |
@@ -1880,7 +1881,7 @@ int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1880 | return 0; | 1881 | return 0; |
1881 | } | 1882 | } |
1882 | 1883 | ||
1883 | void cpc_net_rx(struct net_device *dev) | 1884 | static void cpc_net_rx(struct net_device *dev) |
1884 | { | 1885 | { |
1885 | pc300dev_t *d = (pc300dev_t *) dev->priv; | 1886 | pc300dev_t *d = (pc300dev_t *) dev->priv; |
1886 | pc300ch_t *chan = (pc300ch_t *) d->chan; | 1887 | pc300ch_t *chan = (pc300ch_t *) d->chan; |
@@ -2403,7 +2404,7 @@ static irqreturn_t cpc_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2403 | return IRQ_HANDLED; | 2404 | return IRQ_HANDLED; |
2404 | } | 2405 | } |
2405 | 2406 | ||
2406 | void cpc_sca_status(pc300_t * card, int ch) | 2407 | static void cpc_sca_status(pc300_t * card, int ch) |
2407 | { | 2408 | { |
2408 | ucchar ilar; | 2409 | ucchar ilar; |
2409 | void __iomem *scabase = card->hw.scabase; | 2410 | void __iomem *scabase = card->hw.scabase; |
@@ -2495,7 +2496,7 @@ void cpc_sca_status(pc300_t * card, int ch) | |||
2495 | } | 2496 | } |
2496 | } | 2497 | } |
2497 | 2498 | ||
2498 | void cpc_falc_status(pc300_t * card, int ch) | 2499 | static void cpc_falc_status(pc300_t * card, int ch) |
2499 | { | 2500 | { |
2500 | pc300ch_t *chan = &card->chan[ch]; | 2501 | pc300ch_t *chan = &card->chan[ch]; |
2501 | falc_t *pfalc = (falc_t *) & chan->falc; | 2502 | falc_t *pfalc = (falc_t *) & chan->falc; |
@@ -2523,7 +2524,7 @@ void cpc_falc_status(pc300_t * card, int ch) | |||
2523 | CPC_UNLOCK(card, flags); | 2524 | CPC_UNLOCK(card, flags); |
2524 | } | 2525 | } |
2525 | 2526 | ||
2526 | int cpc_change_mtu(struct net_device *dev, int new_mtu) | 2527 | static int cpc_change_mtu(struct net_device *dev, int new_mtu) |
2527 | { | 2528 | { |
2528 | if ((new_mtu < 128) || (new_mtu > PC300_DEF_MTU)) | 2529 | if ((new_mtu < 128) || (new_mtu > PC300_DEF_MTU)) |
2529 | return -EINVAL; | 2530 | return -EINVAL; |
@@ -2531,7 +2532,7 @@ int cpc_change_mtu(struct net_device *dev, int new_mtu) | |||
2531 | return 0; | 2532 | return 0; |
2532 | } | 2533 | } |
2533 | 2534 | ||
2534 | int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 2535 | static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
2535 | { | 2536 | { |
2536 | hdlc_device *hdlc = dev_to_hdlc(dev); | 2537 | hdlc_device *hdlc = dev_to_hdlc(dev); |
2537 | pc300dev_t *d = (pc300dev_t *) dev->priv; | 2538 | pc300dev_t *d = (pc300dev_t *) dev->priv; |
@@ -2856,7 +2857,7 @@ static int clock_rate_calc(uclong rate, uclong clock, int *br_io) | |||
2856 | } | 2857 | } |
2857 | } | 2858 | } |
2858 | 2859 | ||
2859 | int ch_config(pc300dev_t * d) | 2860 | static int ch_config(pc300dev_t * d) |
2860 | { | 2861 | { |
2861 | pc300ch_t *chan = (pc300ch_t *) d->chan; | 2862 | pc300ch_t *chan = (pc300ch_t *) d->chan; |
2862 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; | 2863 | pc300chconf_t *conf = (pc300chconf_t *) & chan->conf; |
@@ -3004,7 +3005,7 @@ int ch_config(pc300dev_t * d) | |||
3004 | return 0; | 3005 | return 0; |
3005 | } | 3006 | } |
3006 | 3007 | ||
3007 | int rx_config(pc300dev_t * d) | 3008 | static int rx_config(pc300dev_t * d) |
3008 | { | 3009 | { |
3009 | pc300ch_t *chan = (pc300ch_t *) d->chan; | 3010 | pc300ch_t *chan = (pc300ch_t *) d->chan; |
3010 | pc300_t *card = (pc300_t *) chan->card; | 3011 | pc300_t *card = (pc300_t *) chan->card; |
@@ -3035,7 +3036,7 @@ int rx_config(pc300dev_t * d) | |||
3035 | return 0; | 3036 | return 0; |
3036 | } | 3037 | } |
3037 | 3038 | ||
3038 | int tx_config(pc300dev_t * d) | 3039 | static int tx_config(pc300dev_t * d) |
3039 | { | 3040 | { |
3040 | pc300ch_t *chan = (pc300ch_t *) d->chan; | 3041 | pc300ch_t *chan = (pc300ch_t *) d->chan; |
3041 | pc300_t *card = (pc300_t *) chan->card; | 3042 | pc300_t *card = (pc300_t *) chan->card; |
@@ -3098,7 +3099,7 @@ static int cpc_attach(struct net_device *dev, unsigned short encoding, | |||
3098 | return 0; | 3099 | return 0; |
3099 | } | 3100 | } |
3100 | 3101 | ||
3101 | void cpc_opench(pc300dev_t * d) | 3102 | static void cpc_opench(pc300dev_t * d) |
3102 | { | 3103 | { |
3103 | pc300ch_t *chan = (pc300ch_t *) d->chan; | 3104 | pc300ch_t *chan = (pc300ch_t *) d->chan; |
3104 | pc300_t *card = (pc300_t *) chan->card; | 3105 | pc300_t *card = (pc300_t *) chan->card; |
@@ -3116,7 +3117,7 @@ void cpc_opench(pc300dev_t * d) | |||
3116 | cpc_readb(scabase + M_REG(CTL, ch)) & ~(CTL_RTS | CTL_DTR)); | 3117 | cpc_readb(scabase + M_REG(CTL, ch)) & ~(CTL_RTS | CTL_DTR)); |
3117 | } | 3118 | } |
3118 | 3119 | ||
3119 | void cpc_closech(pc300dev_t * d) | 3120 | static void cpc_closech(pc300dev_t * d) |
3120 | { | 3121 | { |
3121 | pc300ch_t *chan = (pc300ch_t *) d->chan; | 3122 | pc300ch_t *chan = (pc300ch_t *) d->chan; |
3122 | pc300_t *card = (pc300_t *) chan->card; | 3123 | pc300_t *card = (pc300_t *) chan->card; |
@@ -3173,7 +3174,7 @@ int cpc_open(struct net_device *dev) | |||
3173 | return 0; | 3174 | return 0; |
3174 | } | 3175 | } |
3175 | 3176 | ||
3176 | int cpc_close(struct net_device *dev) | 3177 | static int cpc_close(struct net_device *dev) |
3177 | { | 3178 | { |
3178 | hdlc_device *hdlc = dev_to_hdlc(dev); | 3179 | hdlc_device *hdlc = dev_to_hdlc(dev); |
3179 | pc300dev_t *d = (pc300dev_t *) dev->priv; | 3180 | pc300dev_t *d = (pc300dev_t *) dev->priv; |
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index 8454bf6caaa7..52f26b9c69d2 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c | |||
@@ -112,10 +112,10 @@ typedef struct _st_cpc_tty_area { | |||
112 | static struct tty_driver serial_drv; | 112 | static struct tty_driver serial_drv; |
113 | 113 | ||
114 | /* local variables */ | 114 | /* local variables */ |
115 | st_cpc_tty_area cpc_tty_area[CPC_TTY_NPORTS]; | 115 | static st_cpc_tty_area cpc_tty_area[CPC_TTY_NPORTS]; |
116 | 116 | ||
117 | int cpc_tty_cnt=0; /* number of intrfaces configured with MLPPP */ | 117 | static int cpc_tty_cnt = 0; /* number of intrfaces configured with MLPPP */ |
118 | int cpc_tty_unreg_flag = 0; | 118 | static int cpc_tty_unreg_flag = 0; |
119 | 119 | ||
120 | /* TTY functions prototype */ | 120 | /* TTY functions prototype */ |
121 | static int cpc_tty_open(struct tty_struct *tty, struct file *flip); | 121 | static int cpc_tty_open(struct tty_struct *tty, struct file *flip); |
@@ -132,9 +132,9 @@ static void cpc_tty_trace(pc300dev_t *dev, char* buf, int len, char rxtx); | |||
132 | static void cpc_tty_signal_off(pc300dev_t *pc300dev, unsigned char); | 132 | static void cpc_tty_signal_off(pc300dev_t *pc300dev, unsigned char); |
133 | static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char); | 133 | static void cpc_tty_signal_on(pc300dev_t *pc300dev, unsigned char); |
134 | 134 | ||
135 | int pc300_tiocmset(struct tty_struct *, struct file *, | 135 | static int pc300_tiocmset(struct tty_struct *, struct file *, |
136 | unsigned int, unsigned int); | 136 | unsigned int, unsigned int); |
137 | int pc300_tiocmget(struct tty_struct *, struct file *); | 137 | static int pc300_tiocmget(struct tty_struct *, struct file *); |
138 | 138 | ||
139 | /* functions called by PC300 driver */ | 139 | /* functions called by PC300 driver */ |
140 | void cpc_tty_init(pc300dev_t *dev); | 140 | void cpc_tty_init(pc300dev_t *dev); |
@@ -538,8 +538,8 @@ static int cpc_tty_chars_in_buffer(struct tty_struct *tty) | |||
538 | return(0); | 538 | return(0); |
539 | } | 539 | } |
540 | 540 | ||
541 | int pc300_tiocmset(struct tty_struct *tty, struct file *file, | 541 | static int pc300_tiocmset(struct tty_struct *tty, struct file *file, |
542 | unsigned int set, unsigned int clear) | 542 | unsigned int set, unsigned int clear) |
543 | { | 543 | { |
544 | st_cpc_tty_area *cpc_tty; | 544 | st_cpc_tty_area *cpc_tty; |
545 | 545 | ||
@@ -565,7 +565,7 @@ int pc300_tiocmset(struct tty_struct *tty, struct file *file, | |||
565 | return 0; | 565 | return 0; |
566 | } | 566 | } |
567 | 567 | ||
568 | int pc300_tiocmget(struct tty_struct *tty, struct file *file) | 568 | static int pc300_tiocmget(struct tty_struct *tty, struct file *file) |
569 | { | 569 | { |
570 | unsigned int result; | 570 | unsigned int result; |
571 | unsigned char status; | 571 | unsigned char status; |
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 3ac9a45b20fa..036adc4f8ba7 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c | |||
@@ -182,7 +182,7 @@ static char sdla_byte(struct net_device *dev, int addr) | |||
182 | return(byte); | 182 | return(byte); |
183 | } | 183 | } |
184 | 184 | ||
185 | void sdla_stop(struct net_device *dev) | 185 | static void sdla_stop(struct net_device *dev) |
186 | { | 186 | { |
187 | struct frad_local *flp; | 187 | struct frad_local *flp; |
188 | 188 | ||
@@ -209,7 +209,7 @@ void sdla_stop(struct net_device *dev) | |||
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | void sdla_start(struct net_device *dev) | 212 | static void sdla_start(struct net_device *dev) |
213 | { | 213 | { |
214 | struct frad_local *flp; | 214 | struct frad_local *flp; |
215 | 215 | ||
@@ -247,7 +247,7 @@ void sdla_start(struct net_device *dev) | |||
247 | * | 247 | * |
248 | ***************************************************/ | 248 | ***************************************************/ |
249 | 249 | ||
250 | int sdla_z80_poll(struct net_device *dev, int z80_addr, int jiffs, char resp1, char resp2) | 250 | static int sdla_z80_poll(struct net_device *dev, int z80_addr, int jiffs, char resp1, char resp2) |
251 | { | 251 | { |
252 | unsigned long start, done, now; | 252 | unsigned long start, done, now; |
253 | char resp, *temp; | 253 | char resp, *temp; |
@@ -505,7 +505,7 @@ static int sdla_cmd(struct net_device *dev, int cmd, short dlci, short flags, | |||
505 | 505 | ||
506 | static int sdla_reconfig(struct net_device *dev); | 506 | static int sdla_reconfig(struct net_device *dev); |
507 | 507 | ||
508 | int sdla_activate(struct net_device *slave, struct net_device *master) | 508 | static int sdla_activate(struct net_device *slave, struct net_device *master) |
509 | { | 509 | { |
510 | struct frad_local *flp; | 510 | struct frad_local *flp; |
511 | int i; | 511 | int i; |
@@ -527,7 +527,7 @@ int sdla_activate(struct net_device *slave, struct net_device *master) | |||
527 | return(0); | 527 | return(0); |
528 | } | 528 | } |
529 | 529 | ||
530 | int sdla_deactivate(struct net_device *slave, struct net_device *master) | 530 | static int sdla_deactivate(struct net_device *slave, struct net_device *master) |
531 | { | 531 | { |
532 | struct frad_local *flp; | 532 | struct frad_local *flp; |
533 | int i; | 533 | int i; |
@@ -549,7 +549,7 @@ int sdla_deactivate(struct net_device *slave, struct net_device *master) | |||
549 | return(0); | 549 | return(0); |
550 | } | 550 | } |
551 | 551 | ||
552 | int sdla_assoc(struct net_device *slave, struct net_device *master) | 552 | static int sdla_assoc(struct net_device *slave, struct net_device *master) |
553 | { | 553 | { |
554 | struct frad_local *flp; | 554 | struct frad_local *flp; |
555 | int i; | 555 | int i; |
@@ -585,7 +585,7 @@ int sdla_assoc(struct net_device *slave, struct net_device *master) | |||
585 | return(0); | 585 | return(0); |
586 | } | 586 | } |
587 | 587 | ||
588 | int sdla_deassoc(struct net_device *slave, struct net_device *master) | 588 | static int sdla_deassoc(struct net_device *slave, struct net_device *master) |
589 | { | 589 | { |
590 | struct frad_local *flp; | 590 | struct frad_local *flp; |
591 | int i; | 591 | int i; |
@@ -613,7 +613,7 @@ int sdla_deassoc(struct net_device *slave, struct net_device *master) | |||
613 | return(0); | 613 | return(0); |
614 | } | 614 | } |
615 | 615 | ||
616 | int sdla_dlci_conf(struct net_device *slave, struct net_device *master, int get) | 616 | static int sdla_dlci_conf(struct net_device *slave, struct net_device *master, int get) |
617 | { | 617 | { |
618 | struct frad_local *flp; | 618 | struct frad_local *flp; |
619 | struct dlci_local *dlp; | 619 | struct dlci_local *dlp; |
@@ -1324,7 +1324,7 @@ NOTE: This is rather a useless action right now, as the | |||
1324 | return(0); | 1324 | return(0); |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | int sdla_change_mtu(struct net_device *dev, int new_mtu) | 1327 | static int sdla_change_mtu(struct net_device *dev, int new_mtu) |
1328 | { | 1328 | { |
1329 | struct frad_local *flp; | 1329 | struct frad_local *flp; |
1330 | 1330 | ||
@@ -1337,7 +1337,7 @@ int sdla_change_mtu(struct net_device *dev, int new_mtu) | |||
1337 | return(-EOPNOTSUPP); | 1337 | return(-EOPNOTSUPP); |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | int sdla_set_config(struct net_device *dev, struct ifmap *map) | 1340 | static int sdla_set_config(struct net_device *dev, struct ifmap *map) |
1341 | { | 1341 | { |
1342 | struct frad_local *flp; | 1342 | struct frad_local *flp; |
1343 | int i; | 1343 | int i; |
diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c index 0497dbdb8631..7f1ce9d4333e 100644 --- a/drivers/net/wan/sdla_fr.c +++ b/drivers/net/wan/sdla_fr.c | |||
@@ -822,7 +822,7 @@ static int new_if(struct wan_device* wandev, struct net_device* dev, | |||
822 | chan->card = card; | 822 | chan->card = card; |
823 | 823 | ||
824 | /* verify media address */ | 824 | /* verify media address */ |
825 | if (is_digit(conf->addr[0])) { | 825 | if (isdigit(conf->addr[0])) { |
826 | 826 | ||
827 | dlci = dec_to_uint(conf->addr, 0); | 827 | dlci = dec_to_uint(conf->addr, 0); |
828 | 828 | ||
@@ -3456,7 +3456,7 @@ static unsigned int dec_to_uint (unsigned char* str, int len) | |||
3456 | if (!len) | 3456 | if (!len) |
3457 | len = strlen(str); | 3457 | len = strlen(str); |
3458 | 3458 | ||
3459 | for (val = 0; len && is_digit(*str); ++str, --len) | 3459 | for (val = 0; len && isdigit(*str); ++str, --len) |
3460 | val = (val * 10) + (*str - (unsigned)'0'); | 3460 | val = (val * 10) + (*str - (unsigned)'0'); |
3461 | 3461 | ||
3462 | return val; | 3462 | return val; |
diff --git a/drivers/net/wan/sdla_x25.c b/drivers/net/wan/sdla_x25.c index 8a95d61a2f8f..63f846d6f3a6 100644 --- a/drivers/net/wan/sdla_x25.c +++ b/drivers/net/wan/sdla_x25.c | |||
@@ -957,7 +957,7 @@ static int new_if(struct wan_device* wandev, struct net_device* dev, | |||
957 | chan->hold_timeout = (conf->hold_timeout) ? | 957 | chan->hold_timeout = (conf->hold_timeout) ? |
958 | conf->hold_timeout : 10; | 958 | conf->hold_timeout : 10; |
959 | 959 | ||
960 | }else if (is_digit(conf->addr[0])){ /* PVC */ | 960 | }else if (isdigit(conf->addr[0])){ /* PVC */ |
961 | int lcn = dec_to_uint(conf->addr, 0); | 961 | int lcn = dec_to_uint(conf->addr, 0); |
962 | 962 | ||
963 | if ((lcn >= card->u.x.lo_pvc) && (lcn <= card->u.x.hi_pvc)){ | 963 | if ((lcn >= card->u.x.lo_pvc) && (lcn <= card->u.x.hi_pvc)){ |
@@ -3875,7 +3875,7 @@ static unsigned int dec_to_uint (unsigned char* str, int len) | |||
3875 | if (!len) | 3875 | if (!len) |
3876 | len = strlen(str); | 3876 | len = strlen(str); |
3877 | 3877 | ||
3878 | for (val = 0; len && is_digit(*str); ++str, --len) | 3878 | for (val = 0; len && isdigit(*str); ++str, --len) |
3879 | val = (val * 10) + (*str - (unsigned)'0'); | 3879 | val = (val * 10) + (*str - (unsigned)'0'); |
3880 | 3880 | ||
3881 | return val; | 3881 | return val; |
@@ -3896,9 +3896,9 @@ static unsigned int hex_to_uint (unsigned char* str, int len) | |||
3896 | for (val = 0; len; ++str, --len) | 3896 | for (val = 0; len; ++str, --len) |
3897 | { | 3897 | { |
3898 | ch = *str; | 3898 | ch = *str; |
3899 | if (is_digit(ch)) | 3899 | if (isdigit(ch)) |
3900 | val = (val << 4) + (ch - (unsigned)'0'); | 3900 | val = (val << 4) + (ch - (unsigned)'0'); |
3901 | else if (is_hex_digit(ch)) | 3901 | else if (isxdigit(ch)) |
3902 | val = (val << 4) + ((ch & 0xDF) - (unsigned)'A' + 10); | 3902 | val = (val << 4) + ((ch & 0xDF) - (unsigned)'A' + 10); |
3903 | else break; | 3903 | else break; |
3904 | } | 3904 | } |
diff --git a/drivers/net/wan/sdladrv.c b/drivers/net/wan/sdladrv.c index c8bc6da57a41..7c2cf2e76300 100644 --- a/drivers/net/wan/sdladrv.c +++ b/drivers/net/wan/sdladrv.c | |||
@@ -642,9 +642,7 @@ int sdla_mapmem (sdlahw_t* hw, unsigned long addr) | |||
642 | * Enable interrupt generation. | 642 | * Enable interrupt generation. |
643 | */ | 643 | */ |
644 | 644 | ||
645 | EXPORT_SYMBOL(sdla_inten); | 645 | static int sdla_inten (sdlahw_t* hw) |
646 | |||
647 | int sdla_inten (sdlahw_t* hw) | ||
648 | { | 646 | { |
649 | unsigned port = hw->port; | 647 | unsigned port = hw->port; |
650 | int tmp, i; | 648 | int tmp, i; |
@@ -698,8 +696,7 @@ int sdla_inten (sdlahw_t* hw) | |||
698 | * Disable interrupt generation. | 696 | * Disable interrupt generation. |
699 | */ | 697 | */ |
700 | 698 | ||
701 | EXPORT_SYMBOL(sdla_intde); | 699 | #if 0 |
702 | |||
703 | int sdla_intde (sdlahw_t* hw) | 700 | int sdla_intde (sdlahw_t* hw) |
704 | { | 701 | { |
705 | unsigned port = hw->port; | 702 | unsigned port = hw->port; |
@@ -748,14 +745,13 @@ int sdla_intde (sdlahw_t* hw) | |||
748 | } | 745 | } |
749 | return 0; | 746 | return 0; |
750 | } | 747 | } |
748 | #endif /* 0 */ | ||
751 | 749 | ||
752 | /*============================================================================ | 750 | /*============================================================================ |
753 | * Acknowledge SDLA hardware interrupt. | 751 | * Acknowledge SDLA hardware interrupt. |
754 | */ | 752 | */ |
755 | 753 | ||
756 | EXPORT_SYMBOL(sdla_intack); | 754 | static int sdla_intack (sdlahw_t* hw) |
757 | |||
758 | int sdla_intack (sdlahw_t* hw) | ||
759 | { | 755 | { |
760 | unsigned port = hw->port; | 756 | unsigned port = hw->port; |
761 | int tmp; | 757 | int tmp; |
@@ -827,8 +823,7 @@ void read_S514_int_stat (sdlahw_t* hw, u32* int_status) | |||
827 | * Generate an interrupt to adapter's CPU. | 823 | * Generate an interrupt to adapter's CPU. |
828 | */ | 824 | */ |
829 | 825 | ||
830 | EXPORT_SYMBOL(sdla_intr); | 826 | #if 0 |
831 | |||
832 | int sdla_intr (sdlahw_t* hw) | 827 | int sdla_intr (sdlahw_t* hw) |
833 | { | 828 | { |
834 | unsigned port = hw->port; | 829 | unsigned port = hw->port; |
@@ -863,6 +858,7 @@ int sdla_intr (sdlahw_t* hw) | |||
863 | } | 858 | } |
864 | return 0; | 859 | return 0; |
865 | } | 860 | } |
861 | #endif /* 0 */ | ||
866 | 862 | ||
867 | /*============================================================================ | 863 | /*============================================================================ |
868 | * Execute Adapter Command. | 864 | * Execute Adapter Command. |
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index a6d3b55013a5..2d1bba06a085 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c | |||
@@ -221,7 +221,7 @@ static void sppp_clear_timeout(struct sppp *p) | |||
221 | * here. | 221 | * here. |
222 | */ | 222 | */ |
223 | 223 | ||
224 | void sppp_input (struct net_device *dev, struct sk_buff *skb) | 224 | static void sppp_input (struct net_device *dev, struct sk_buff *skb) |
225 | { | 225 | { |
226 | struct ppp_header *h; | 226 | struct ppp_header *h; |
227 | struct sppp *sp = (struct sppp *)sppp_of(dev); | 227 | struct sppp *sp = (struct sppp *)sppp_of(dev); |
@@ -355,8 +355,6 @@ done: | |||
355 | return; | 355 | return; |
356 | } | 356 | } |
357 | 357 | ||
358 | EXPORT_SYMBOL(sppp_input); | ||
359 | |||
360 | /* | 358 | /* |
361 | * Handle transmit packets. | 359 | * Handle transmit packets. |
362 | */ | 360 | */ |
@@ -990,7 +988,7 @@ EXPORT_SYMBOL(sppp_reopen); | |||
990 | * the mtu is out of range. | 988 | * the mtu is out of range. |
991 | */ | 989 | */ |
992 | 990 | ||
993 | int sppp_change_mtu(struct net_device *dev, int new_mtu) | 991 | static int sppp_change_mtu(struct net_device *dev, int new_mtu) |
994 | { | 992 | { |
995 | if(new_mtu<128||new_mtu>PPP_MTU||(dev->flags&IFF_UP)) | 993 | if(new_mtu<128||new_mtu>PPP_MTU||(dev->flags&IFF_UP)) |
996 | return -EINVAL; | 994 | return -EINVAL; |
@@ -998,8 +996,6 @@ int sppp_change_mtu(struct net_device *dev, int new_mtu) | |||
998 | return 0; | 996 | return 0; |
999 | } | 997 | } |
1000 | 998 | ||
1001 | EXPORT_SYMBOL(sppp_change_mtu); | ||
1002 | |||
1003 | /** | 999 | /** |
1004 | * sppp_do_ioctl - Ioctl handler for ppp/hdlc | 1000 | * sppp_do_ioctl - Ioctl handler for ppp/hdlc |
1005 | * @dev: Device subject to ioctl | 1001 | * @dev: Device subject to ioctl |
@@ -1456,7 +1452,7 @@ static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_t | |||
1456 | return 0; | 1452 | return 0; |
1457 | } | 1453 | } |
1458 | 1454 | ||
1459 | struct packet_type sppp_packet_type = { | 1455 | static struct packet_type sppp_packet_type = { |
1460 | .type = __constant_htons(ETH_P_WAN_PPP), | 1456 | .type = __constant_htons(ETH_P_WAN_PPP), |
1461 | .func = sppp_rcv, | 1457 | .func = sppp_rcv, |
1462 | }; | 1458 | }; |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 06998c2240d9..cb429e783749 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -1046,7 +1046,6 @@ static WifiCtlHdr wifictlhdr8023 = { | |||
1046 | } | 1046 | } |
1047 | }; | 1047 | }; |
1048 | 1048 | ||
1049 | #ifdef WIRELESS_EXT | ||
1050 | // Frequency list (map channels to frequencies) | 1049 | // Frequency list (map channels to frequencies) |
1051 | static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, | 1050 | static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, |
1052 | 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; | 1051 | 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; |
@@ -1067,7 +1066,6 @@ typedef struct wep_key_t { | |||
1067 | 1066 | ||
1068 | /* List of Wireless Handlers (new API) */ | 1067 | /* List of Wireless Handlers (new API) */ |
1069 | static const struct iw_handler_def airo_handler_def; | 1068 | static const struct iw_handler_def airo_handler_def; |
1070 | #endif /* WIRELESS_EXT */ | ||
1071 | 1069 | ||
1072 | static const char version[] = "airo.c 0.6 (Ben Reed & Javier Achirica)"; | 1070 | static const char version[] = "airo.c 0.6 (Ben Reed & Javier Achirica)"; |
1073 | 1071 | ||
@@ -1110,10 +1108,8 @@ static irqreturn_t airo_interrupt( int irq, void* dev_id, struct pt_regs | |||
1110 | static int airo_thread(void *data); | 1108 | static int airo_thread(void *data); |
1111 | static void timer_func( struct net_device *dev ); | 1109 | static void timer_func( struct net_device *dev ); |
1112 | static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 1110 | static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
1113 | #ifdef WIRELESS_EXT | ||
1114 | static struct iw_statistics *airo_get_wireless_stats (struct net_device *dev); | 1111 | static struct iw_statistics *airo_get_wireless_stats (struct net_device *dev); |
1115 | static void airo_read_wireless_stats (struct airo_info *local); | 1112 | static void airo_read_wireless_stats (struct airo_info *local); |
1116 | #endif /* WIRELESS_EXT */ | ||
1117 | #ifdef CISCO_EXT | 1113 | #ifdef CISCO_EXT |
1118 | static int readrids(struct net_device *dev, aironet_ioctl *comp); | 1114 | static int readrids(struct net_device *dev, aironet_ioctl *comp); |
1119 | static int writerids(struct net_device *dev, aironet_ioctl *comp); | 1115 | static int writerids(struct net_device *dev, aironet_ioctl *comp); |
@@ -1187,12 +1183,10 @@ struct airo_info { | |||
1187 | int fid; | 1183 | int fid; |
1188 | } xmit, xmit11; | 1184 | } xmit, xmit11; |
1189 | struct net_device *wifidev; | 1185 | struct net_device *wifidev; |
1190 | #ifdef WIRELESS_EXT | ||
1191 | struct iw_statistics wstats; // wireless stats | 1186 | struct iw_statistics wstats; // wireless stats |
1192 | unsigned long scan_timestamp; /* Time started to scan */ | 1187 | unsigned long scan_timestamp; /* Time started to scan */ |
1193 | struct iw_spy_data spy_data; | 1188 | struct iw_spy_data spy_data; |
1194 | struct iw_public_data wireless_data; | 1189 | struct iw_public_data wireless_data; |
1195 | #endif /* WIRELESS_EXT */ | ||
1196 | #ifdef MICSUPPORT | 1190 | #ifdef MICSUPPORT |
1197 | /* MIC stuff */ | 1191 | /* MIC stuff */ |
1198 | struct crypto_tfm *tfm; | 1192 | struct crypto_tfm *tfm; |
@@ -2527,7 +2521,8 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2527 | unsigned long mem_start, mem_len, aux_start, aux_len; | 2521 | unsigned long mem_start, mem_len, aux_start, aux_len; |
2528 | int rc = -1; | 2522 | int rc = -1; |
2529 | int i; | 2523 | int i; |
2530 | unsigned char *busaddroff,*vpackoff; | 2524 | dma_addr_t busaddroff; |
2525 | unsigned char *vpackoff; | ||
2531 | unsigned char __iomem *pciaddroff; | 2526 | unsigned char __iomem *pciaddroff; |
2532 | 2527 | ||
2533 | mem_start = pci_resource_start(pci, 1); | 2528 | mem_start = pci_resource_start(pci, 1); |
@@ -2570,7 +2565,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2570 | /* | 2565 | /* |
2571 | * Setup descriptor RX, TX, CONFIG | 2566 | * Setup descriptor RX, TX, CONFIG |
2572 | */ | 2567 | */ |
2573 | busaddroff = (unsigned char *)ai->shared_dma; | 2568 | busaddroff = ai->shared_dma; |
2574 | pciaddroff = ai->pciaux + AUX_OFFSET; | 2569 | pciaddroff = ai->pciaux + AUX_OFFSET; |
2575 | vpackoff = ai->shared; | 2570 | vpackoff = ai->shared; |
2576 | 2571 | ||
@@ -2579,7 +2574,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2579 | ai->rxfids[i].pending = 0; | 2574 | ai->rxfids[i].pending = 0; |
2580 | ai->rxfids[i].card_ram_off = pciaddroff; | 2575 | ai->rxfids[i].card_ram_off = pciaddroff; |
2581 | ai->rxfids[i].virtual_host_addr = vpackoff; | 2576 | ai->rxfids[i].virtual_host_addr = vpackoff; |
2582 | ai->rxfids[i].rx_desc.host_addr = (dma_addr_t) busaddroff; | 2577 | ai->rxfids[i].rx_desc.host_addr = busaddroff; |
2583 | ai->rxfids[i].rx_desc.valid = 1; | 2578 | ai->rxfids[i].rx_desc.valid = 1; |
2584 | ai->rxfids[i].rx_desc.len = PKTSIZE; | 2579 | ai->rxfids[i].rx_desc.len = PKTSIZE; |
2585 | ai->rxfids[i].rx_desc.rdy = 0; | 2580 | ai->rxfids[i].rx_desc.rdy = 0; |
@@ -2594,7 +2589,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2594 | ai->txfids[i].card_ram_off = pciaddroff; | 2589 | ai->txfids[i].card_ram_off = pciaddroff; |
2595 | ai->txfids[i].virtual_host_addr = vpackoff; | 2590 | ai->txfids[i].virtual_host_addr = vpackoff; |
2596 | ai->txfids[i].tx_desc.valid = 1; | 2591 | ai->txfids[i].tx_desc.valid = 1; |
2597 | ai->txfids[i].tx_desc.host_addr = (dma_addr_t) busaddroff; | 2592 | ai->txfids[i].tx_desc.host_addr = busaddroff; |
2598 | memcpy(ai->txfids[i].virtual_host_addr, | 2593 | memcpy(ai->txfids[i].virtual_host_addr, |
2599 | &wifictlhdr8023, sizeof(wifictlhdr8023)); | 2594 | &wifictlhdr8023, sizeof(wifictlhdr8023)); |
2600 | 2595 | ||
@@ -2607,8 +2602,8 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2607 | /* Rid descriptor setup */ | 2602 | /* Rid descriptor setup */ |
2608 | ai->config_desc.card_ram_off = pciaddroff; | 2603 | ai->config_desc.card_ram_off = pciaddroff; |
2609 | ai->config_desc.virtual_host_addr = vpackoff; | 2604 | ai->config_desc.virtual_host_addr = vpackoff; |
2610 | ai->config_desc.rid_desc.host_addr = (dma_addr_t) busaddroff; | 2605 | ai->config_desc.rid_desc.host_addr = busaddroff; |
2611 | ai->ridbus = (dma_addr_t)busaddroff; | 2606 | ai->ridbus = busaddroff; |
2612 | ai->config_desc.rid_desc.rid = 0; | 2607 | ai->config_desc.rid_desc.rid = 0; |
2613 | ai->config_desc.rid_desc.len = RIDSIZE; | 2608 | ai->config_desc.rid_desc.len = RIDSIZE; |
2614 | ai->config_desc.rid_desc.valid = 1; | 2609 | ai->config_desc.rid_desc.valid = 1; |
@@ -2647,9 +2642,7 @@ static void wifi_setup(struct net_device *dev) | |||
2647 | dev->get_stats = &airo_get_stats; | 2642 | dev->get_stats = &airo_get_stats; |
2648 | dev->set_mac_address = &airo_set_mac_address; | 2643 | dev->set_mac_address = &airo_set_mac_address; |
2649 | dev->do_ioctl = &airo_ioctl; | 2644 | dev->do_ioctl = &airo_ioctl; |
2650 | #ifdef WIRELESS_EXT | ||
2651 | dev->wireless_handlers = &airo_handler_def; | 2645 | dev->wireless_handlers = &airo_handler_def; |
2652 | #endif /* WIRELESS_EXT */ | ||
2653 | dev->change_mtu = &airo_change_mtu; | 2646 | dev->change_mtu = &airo_change_mtu; |
2654 | dev->open = &airo_open; | 2647 | dev->open = &airo_open; |
2655 | dev->stop = &airo_close; | 2648 | dev->stop = &airo_close; |
@@ -2675,9 +2668,7 @@ static struct net_device *init_wifidev(struct airo_info *ai, | |||
2675 | dev->priv = ethdev->priv; | 2668 | dev->priv = ethdev->priv; |
2676 | dev->irq = ethdev->irq; | 2669 | dev->irq = ethdev->irq; |
2677 | dev->base_addr = ethdev->base_addr; | 2670 | dev->base_addr = ethdev->base_addr; |
2678 | #ifdef WIRELESS_EXT | ||
2679 | dev->wireless_data = ethdev->wireless_data; | 2671 | dev->wireless_data = ethdev->wireless_data; |
2680 | #endif /* WIRELESS_EXT */ | ||
2681 | memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len); | 2672 | memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len); |
2682 | err = register_netdev(dev); | 2673 | err = register_netdev(dev); |
2683 | if (err<0) { | 2674 | if (err<0) { |
@@ -2755,11 +2746,9 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, | |||
2755 | dev->set_multicast_list = &airo_set_multicast_list; | 2746 | dev->set_multicast_list = &airo_set_multicast_list; |
2756 | dev->set_mac_address = &airo_set_mac_address; | 2747 | dev->set_mac_address = &airo_set_mac_address; |
2757 | dev->do_ioctl = &airo_ioctl; | 2748 | dev->do_ioctl = &airo_ioctl; |
2758 | #ifdef WIRELESS_EXT | ||
2759 | dev->wireless_handlers = &airo_handler_def; | 2749 | dev->wireless_handlers = &airo_handler_def; |
2760 | ai->wireless_data.spy_data = &ai->spy_data; | 2750 | ai->wireless_data.spy_data = &ai->spy_data; |
2761 | dev->wireless_data = &ai->wireless_data; | 2751 | dev->wireless_data = &ai->wireless_data; |
2762 | #endif /* WIRELESS_EXT */ | ||
2763 | dev->change_mtu = &airo_change_mtu; | 2752 | dev->change_mtu = &airo_change_mtu; |
2764 | dev->open = &airo_open; | 2753 | dev->open = &airo_open; |
2765 | dev->stop = &airo_close; | 2754 | dev->stop = &airo_close; |
@@ -5515,12 +5504,13 @@ static int airo_pci_resume(struct pci_dev *pdev) | |||
5515 | struct net_device *dev = pci_get_drvdata(pdev); | 5504 | struct net_device *dev = pci_get_drvdata(pdev); |
5516 | struct airo_info *ai = dev->priv; | 5505 | struct airo_info *ai = dev->priv; |
5517 | Resp rsp; | 5506 | Resp rsp; |
5507 | pci_power_t prev_state = pdev->current_state; | ||
5518 | 5508 | ||
5519 | pci_set_power_state(pdev, 0); | 5509 | pci_set_power_state(pdev, PCI_D0); |
5520 | pci_restore_state(pdev); | 5510 | pci_restore_state(pdev); |
5521 | pci_enable_wake(pdev, pci_choose_state(pdev, ai->power), 0); | 5511 | pci_enable_wake(pdev, PCI_D0, 0); |
5522 | 5512 | ||
5523 | if (ai->power.event > 1) { | 5513 | if (prev_state != PCI_D1) { |
5524 | reset_card(dev, 0); | 5514 | reset_card(dev, 0); |
5525 | mpi_init_descriptors(ai); | 5515 | mpi_init_descriptors(ai); |
5526 | setup_card(ai, dev->dev_addr, 0); | 5516 | setup_card(ai, dev->dev_addr, 0); |
@@ -5598,7 +5588,6 @@ static void __exit airo_cleanup_module( void ) | |||
5598 | remove_proc_entry("aironet", proc_root_driver); | 5588 | remove_proc_entry("aironet", proc_root_driver); |
5599 | } | 5589 | } |
5600 | 5590 | ||
5601 | #ifdef WIRELESS_EXT | ||
5602 | /* | 5591 | /* |
5603 | * Initial Wireless Extension code for Aironet driver by : | 5592 | * Initial Wireless Extension code for Aironet driver by : |
5604 | * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 17 November 00 | 5593 | * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 17 November 00 |
@@ -7107,8 +7096,6 @@ static const struct iw_handler_def airo_handler_def = | |||
7107 | .get_wireless_stats = airo_get_wireless_stats, | 7096 | .get_wireless_stats = airo_get_wireless_stats, |
7108 | }; | 7097 | }; |
7109 | 7098 | ||
7110 | #endif /* WIRELESS_EXT */ | ||
7111 | |||
7112 | /* | 7099 | /* |
7113 | * This defines the configuration part of the Wireless Extensions | 7100 | * This defines the configuration part of the Wireless Extensions |
7114 | * Note : irq and spinlock protection will occur in the subroutines | 7101 | * Note : irq and spinlock protection will occur in the subroutines |
@@ -7187,7 +7174,6 @@ static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
7187 | return rc; | 7174 | return rc; |
7188 | } | 7175 | } |
7189 | 7176 | ||
7190 | #ifdef WIRELESS_EXT | ||
7191 | /* | 7177 | /* |
7192 | * Get the Wireless stats out of the driver | 7178 | * Get the Wireless stats out of the driver |
7193 | * Note : irq and spinlock protection will occur in the subroutines | 7179 | * Note : irq and spinlock protection will occur in the subroutines |
@@ -7260,7 +7246,6 @@ static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev) | |||
7260 | 7246 | ||
7261 | return &local->wstats; | 7247 | return &local->wstats; |
7262 | } | 7248 | } |
7263 | #endif /* WIRELESS_EXT */ | ||
7264 | 7249 | ||
7265 | #ifdef CISCO_EXT | 7250 | #ifdef CISCO_EXT |
7266 | /* | 7251 | /* |
diff --git a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c index 9d496703c465..7b321f7cf358 100644 --- a/drivers/net/wireless/airport.c +++ b/drivers/net/wireless/airport.c | |||
@@ -15,28 +15,11 @@ | |||
15 | #define PFX DRIVER_NAME ": " | 15 | #define PFX DRIVER_NAME ": " |
16 | 16 | ||
17 | #include <linux/config.h> | 17 | #include <linux/config.h> |
18 | |||
19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
21 | #include <linux/init.h> | 20 | #include <linux/init.h> |
22 | #include <linux/ptrace.h> | 21 | #include <linux/delay.h> |
23 | #include <linux/slab.h> | ||
24 | #include <linux/string.h> | ||
25 | #include <linux/timer.h> | ||
26 | #include <linux/ioport.h> | ||
27 | #include <linux/netdevice.h> | ||
28 | #include <linux/if_arp.h> | ||
29 | #include <linux/etherdevice.h> | ||
30 | #include <linux/wireless.h> | ||
31 | |||
32 | #include <asm/io.h> | ||
33 | #include <asm/system.h> | ||
34 | #include <asm/current.h> | ||
35 | #include <asm/prom.h> | ||
36 | #include <asm/machdep.h> | ||
37 | #include <asm/pmac_feature.h> | 22 | #include <asm/pmac_feature.h> |
38 | #include <asm/irq.h> | ||
39 | #include <asm/uaccess.h> | ||
40 | 23 | ||
41 | #include "orinoco.h" | 24 | #include "orinoco.h" |
42 | 25 | ||
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 587869d86eee..d57011028b72 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -618,12 +618,12 @@ static int atmel_lock_mac(struct atmel_private *priv); | |||
618 | static void atmel_wmem32(struct atmel_private *priv, u16 pos, u32 data); | 618 | static void atmel_wmem32(struct atmel_private *priv, u16 pos, u32 data); |
619 | static void atmel_command_irq(struct atmel_private *priv); | 619 | static void atmel_command_irq(struct atmel_private *priv); |
620 | static int atmel_validate_channel(struct atmel_private *priv, int channel); | 620 | static int atmel_validate_channel(struct atmel_private *priv, int channel); |
621 | static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header, | 621 | static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr_4addr *header, |
622 | u16 frame_len, u8 rssi); | 622 | u16 frame_len, u8 rssi); |
623 | static void atmel_management_timer(u_long a); | 623 | static void atmel_management_timer(u_long a); |
624 | static void atmel_send_command(struct atmel_private *priv, int command, void *cmd, int cmd_size); | 624 | static void atmel_send_command(struct atmel_private *priv, int command, void *cmd, int cmd_size); |
625 | static int atmel_send_command_wait(struct atmel_private *priv, int command, void *cmd, int cmd_size); | 625 | static int atmel_send_command_wait(struct atmel_private *priv, int command, void *cmd, int cmd_size); |
626 | static void atmel_transmit_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header, | 626 | static void atmel_transmit_management_frame(struct atmel_private *priv, struct ieee80211_hdr_4addr *header, |
627 | u8 *body, int body_len); | 627 | u8 *body, int body_len); |
628 | 628 | ||
629 | static u8 atmel_get_mib8(struct atmel_private *priv, u8 type, u8 index); | 629 | static u8 atmel_get_mib8(struct atmel_private *priv, u8 type, u8 index); |
@@ -827,7 +827,7 @@ static void tx_update_descriptor(struct atmel_private *priv, int is_bcast, u16 l | |||
827 | static int start_tx (struct sk_buff *skb, struct net_device *dev) | 827 | static int start_tx (struct sk_buff *skb, struct net_device *dev) |
828 | { | 828 | { |
829 | struct atmel_private *priv = netdev_priv(dev); | 829 | struct atmel_private *priv = netdev_priv(dev); |
830 | struct ieee80211_hdr header; | 830 | struct ieee80211_hdr_4addr header; |
831 | unsigned long flags; | 831 | unsigned long flags; |
832 | u16 buff, frame_ctl, len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN; | 832 | u16 buff, frame_ctl, len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN; |
833 | u8 SNAP_RFC1024[6] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; | 833 | u8 SNAP_RFC1024[6] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; |
@@ -902,7 +902,7 @@ static int start_tx (struct sk_buff *skb, struct net_device *dev) | |||
902 | } | 902 | } |
903 | 903 | ||
904 | static void atmel_transmit_management_frame(struct atmel_private *priv, | 904 | static void atmel_transmit_management_frame(struct atmel_private *priv, |
905 | struct ieee80211_hdr *header, | 905 | struct ieee80211_hdr_4addr *header, |
906 | u8 *body, int body_len) | 906 | u8 *body, int body_len) |
907 | { | 907 | { |
908 | u16 buff; | 908 | u16 buff; |
@@ -917,7 +917,7 @@ static void atmel_transmit_management_frame(struct atmel_private *priv, | |||
917 | tx_update_descriptor(priv, header->addr1[0] & 0x01, len, buff, TX_PACKET_TYPE_MGMT); | 917 | tx_update_descriptor(priv, header->addr1[0] & 0x01, len, buff, TX_PACKET_TYPE_MGMT); |
918 | } | 918 | } |
919 | 919 | ||
920 | static void fast_rx_path(struct atmel_private *priv, struct ieee80211_hdr *header, | 920 | static void fast_rx_path(struct atmel_private *priv, struct ieee80211_hdr_4addr *header, |
921 | u16 msdu_size, u16 rx_packet_loc, u32 crc) | 921 | u16 msdu_size, u16 rx_packet_loc, u32 crc) |
922 | { | 922 | { |
923 | /* fast path: unfragmented packet copy directly into skbuf */ | 923 | /* fast path: unfragmented packet copy directly into skbuf */ |
@@ -990,7 +990,7 @@ static int probe_crc(struct atmel_private *priv, u16 packet_loc, u16 msdu_size) | |||
990 | return (crc ^ 0xffffffff) == netcrc; | 990 | return (crc ^ 0xffffffff) == netcrc; |
991 | } | 991 | } |
992 | 992 | ||
993 | static void frag_rx_path(struct atmel_private *priv, struct ieee80211_hdr *header, | 993 | static void frag_rx_path(struct atmel_private *priv, struct ieee80211_hdr_4addr *header, |
994 | u16 msdu_size, u16 rx_packet_loc, u32 crc, u16 seq_no, u8 frag_no, int more_frags) | 994 | u16 msdu_size, u16 rx_packet_loc, u32 crc, u16 seq_no, u8 frag_no, int more_frags) |
995 | { | 995 | { |
996 | u8 mac4[6]; | 996 | u8 mac4[6]; |
@@ -1082,7 +1082,7 @@ static void frag_rx_path(struct atmel_private *priv, struct ieee80211_hdr *heade | |||
1082 | static void rx_done_irq(struct atmel_private *priv) | 1082 | static void rx_done_irq(struct atmel_private *priv) |
1083 | { | 1083 | { |
1084 | int i; | 1084 | int i; |
1085 | struct ieee80211_hdr header; | 1085 | struct ieee80211_hdr_4addr header; |
1086 | 1086 | ||
1087 | for (i = 0; | 1087 | for (i = 0; |
1088 | atmel_rmem8(priv, atmel_rx(priv, RX_DESC_FLAGS_OFFSET, priv->rx_desc_head)) == RX_DESC_FLAG_VALID && | 1088 | atmel_rmem8(priv, atmel_rx(priv, RX_DESC_FLAGS_OFFSET, priv->rx_desc_head)) == RX_DESC_FLAG_VALID && |
@@ -2650,7 +2650,7 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c | |||
2650 | 2650 | ||
2651 | static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) | 2651 | static void send_authentication_request(struct atmel_private *priv, u8 *challenge, int challenge_len) |
2652 | { | 2652 | { |
2653 | struct ieee80211_hdr header; | 2653 | struct ieee80211_hdr_4addr header; |
2654 | struct auth_body auth; | 2654 | struct auth_body auth; |
2655 | 2655 | ||
2656 | header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH); | 2656 | header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH); |
@@ -2688,7 +2688,7 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc) | |||
2688 | { | 2688 | { |
2689 | u8 *ssid_el_p; | 2689 | u8 *ssid_el_p; |
2690 | int bodysize; | 2690 | int bodysize; |
2691 | struct ieee80211_hdr header; | 2691 | struct ieee80211_hdr_4addr header; |
2692 | struct ass_req_format { | 2692 | struct ass_req_format { |
2693 | u16 capability; | 2693 | u16 capability; |
2694 | u16 listen_interval; | 2694 | u16 listen_interval; |
@@ -2738,7 +2738,7 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc) | |||
2738 | atmel_transmit_management_frame(priv, &header, (void *)&body, bodysize); | 2738 | atmel_transmit_management_frame(priv, &header, (void *)&body, bodysize); |
2739 | } | 2739 | } |
2740 | 2740 | ||
2741 | static int is_frame_from_current_bss(struct atmel_private *priv, struct ieee80211_hdr *header) | 2741 | static int is_frame_from_current_bss(struct atmel_private *priv, struct ieee80211_hdr_4addr *header) |
2742 | { | 2742 | { |
2743 | if (le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_FROMDS) | 2743 | if (le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_FROMDS) |
2744 | return memcmp(header->addr3, priv->CurrentBSSID, 6) == 0; | 2744 | return memcmp(header->addr3, priv->CurrentBSSID, 6) == 0; |
@@ -2788,7 +2788,7 @@ static int retrieve_bss(struct atmel_private *priv) | |||
2788 | } | 2788 | } |
2789 | 2789 | ||
2790 | 2790 | ||
2791 | static void store_bss_info(struct atmel_private *priv, struct ieee80211_hdr *header, | 2791 | static void store_bss_info(struct atmel_private *priv, struct ieee80211_hdr_4addr *header, |
2792 | u16 capability, u16 beacon_period, u8 channel, u8 rssi, | 2792 | u16 capability, u16 beacon_period, u8 channel, u8 rssi, |
2793 | u8 ssid_len, u8 *ssid, int is_beacon) | 2793 | u8 ssid_len, u8 *ssid, int is_beacon) |
2794 | { | 2794 | { |
@@ -3072,7 +3072,7 @@ static void atmel_smooth_qual(struct atmel_private *priv) | |||
3072 | } | 3072 | } |
3073 | 3073 | ||
3074 | /* deals with incoming managment frames. */ | 3074 | /* deals with incoming managment frames. */ |
3075 | static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr *header, | 3075 | static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr_4addr *header, |
3076 | u16 frame_len, u8 rssi) | 3076 | u16 frame_len, u8 rssi) |
3077 | { | 3077 | { |
3078 | u16 subtype; | 3078 | u16 subtype; |
diff --git a/drivers/net/wireless/hermes.c b/drivers/net/wireless/hermes.c index 21c3d0d227e6..eba0d9d2b7c5 100644 --- a/drivers/net/wireless/hermes.c +++ b/drivers/net/wireless/hermes.c | |||
@@ -39,17 +39,10 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include <linux/config.h> | 41 | #include <linux/config.h> |
42 | |||
43 | #include <linux/module.h> | 42 | #include <linux/module.h> |
44 | #include <linux/types.h> | ||
45 | #include <linux/threads.h> | ||
46 | #include <linux/smp.h> | ||
47 | #include <asm/io.h> | ||
48 | #include <linux/delay.h> | ||
49 | #include <linux/init.h> | ||
50 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
51 | #include <linux/net.h> | 44 | #include <linux/init.h> |
52 | #include <asm/errno.h> | 45 | #include <linux/delay.h> |
53 | 46 | ||
54 | #include "hermes.h" | 47 | #include "hermes.h" |
55 | 48 | ||
diff --git a/drivers/net/wireless/hermes.h b/drivers/net/wireless/hermes.h index 8c9e874c9118..ad28e3294360 100644 --- a/drivers/net/wireless/hermes.h +++ b/drivers/net/wireless/hermes.h | |||
@@ -30,9 +30,8 @@ | |||
30 | * access to the hermes_t structure, and to the hardware | 30 | * access to the hermes_t structure, and to the hardware |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/delay.h> | ||
34 | #include <linux/if_ether.h> | 33 | #include <linux/if_ether.h> |
35 | #include <asm/byteorder.h> | 34 | #include <asm/io.h> |
36 | 35 | ||
37 | /* | 36 | /* |
38 | * Limits and constants | 37 | * Limits and constants |
@@ -192,13 +191,13 @@ | |||
192 | #define HERMES_RXSTAT_WMP (0x6000) /* Wavelan-II Management Protocol frame */ | 191 | #define HERMES_RXSTAT_WMP (0x6000) /* Wavelan-II Management Protocol frame */ |
193 | 192 | ||
194 | struct hermes_tx_descriptor { | 193 | struct hermes_tx_descriptor { |
195 | u16 status; | 194 | __le16 status; |
196 | u16 reserved1; | 195 | __le16 reserved1; |
197 | u16 reserved2; | 196 | __le16 reserved2; |
198 | u32 sw_support; | 197 | __le32 sw_support; |
199 | u8 retry_count; | 198 | u8 retry_count; |
200 | u8 tx_rate; | 199 | u8 tx_rate; |
201 | u16 tx_control; | 200 | __le16 tx_control; |
202 | } __attribute__ ((packed)); | 201 | } __attribute__ ((packed)); |
203 | 202 | ||
204 | #define HERMES_TXSTAT_RETRYERR (0x0001) | 203 | #define HERMES_TXSTAT_RETRYERR (0x0001) |
@@ -222,60 +221,60 @@ struct hermes_tx_descriptor { | |||
222 | #define HERMES_INQ_SEC_STAT_AGERE (0xF202) | 221 | #define HERMES_INQ_SEC_STAT_AGERE (0xF202) |
223 | 222 | ||
224 | struct hermes_tallies_frame { | 223 | struct hermes_tallies_frame { |
225 | u16 TxUnicastFrames; | 224 | __le16 TxUnicastFrames; |
226 | u16 TxMulticastFrames; | 225 | __le16 TxMulticastFrames; |
227 | u16 TxFragments; | 226 | __le16 TxFragments; |
228 | u16 TxUnicastOctets; | 227 | __le16 TxUnicastOctets; |
229 | u16 TxMulticastOctets; | 228 | __le16 TxMulticastOctets; |
230 | u16 TxDeferredTransmissions; | 229 | __le16 TxDeferredTransmissions; |
231 | u16 TxSingleRetryFrames; | 230 | __le16 TxSingleRetryFrames; |
232 | u16 TxMultipleRetryFrames; | 231 | __le16 TxMultipleRetryFrames; |
233 | u16 TxRetryLimitExceeded; | 232 | __le16 TxRetryLimitExceeded; |
234 | u16 TxDiscards; | 233 | __le16 TxDiscards; |
235 | u16 RxUnicastFrames; | 234 | __le16 RxUnicastFrames; |
236 | u16 RxMulticastFrames; | 235 | __le16 RxMulticastFrames; |
237 | u16 RxFragments; | 236 | __le16 RxFragments; |
238 | u16 RxUnicastOctets; | 237 | __le16 RxUnicastOctets; |
239 | u16 RxMulticastOctets; | 238 | __le16 RxMulticastOctets; |
240 | u16 RxFCSErrors; | 239 | __le16 RxFCSErrors; |
241 | u16 RxDiscards_NoBuffer; | 240 | __le16 RxDiscards_NoBuffer; |
242 | u16 TxDiscardsWrongSA; | 241 | __le16 TxDiscardsWrongSA; |
243 | u16 RxWEPUndecryptable; | 242 | __le16 RxWEPUndecryptable; |
244 | u16 RxMsgInMsgFragments; | 243 | __le16 RxMsgInMsgFragments; |
245 | u16 RxMsgInBadMsgFragments; | 244 | __le16 RxMsgInBadMsgFragments; |
246 | /* Those last are probably not available in very old firmwares */ | 245 | /* Those last are probably not available in very old firmwares */ |
247 | u16 RxDiscards_WEPICVError; | 246 | __le16 RxDiscards_WEPICVError; |
248 | u16 RxDiscards_WEPExcluded; | 247 | __le16 RxDiscards_WEPExcluded; |
249 | } __attribute__ ((packed)); | 248 | } __attribute__ ((packed)); |
250 | 249 | ||
251 | /* Grabbed from wlan-ng - Thanks Mark... - Jean II | 250 | /* Grabbed from wlan-ng - Thanks Mark... - Jean II |
252 | * This is the result of a scan inquiry command */ | 251 | * This is the result of a scan inquiry command */ |
253 | /* Structure describing info about an Access Point */ | 252 | /* Structure describing info about an Access Point */ |
254 | struct prism2_scan_apinfo { | 253 | struct prism2_scan_apinfo { |
255 | u16 channel; /* Channel where the AP sits */ | 254 | __le16 channel; /* Channel where the AP sits */ |
256 | u16 noise; /* Noise level */ | 255 | __le16 noise; /* Noise level */ |
257 | u16 level; /* Signal level */ | 256 | __le16 level; /* Signal level */ |
258 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ | 257 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ |
259 | u16 beacon_interv; /* Beacon interval */ | 258 | __le16 beacon_interv; /* Beacon interval */ |
260 | u16 capabilities; /* Capabilities */ | 259 | __le16 capabilities; /* Capabilities */ |
261 | u16 essid_len; /* ESSID length */ | 260 | __le16 essid_len; /* ESSID length */ |
262 | u8 essid[32]; /* ESSID of the network */ | 261 | u8 essid[32]; /* ESSID of the network */ |
263 | u8 rates[10]; /* Bit rate supported */ | 262 | u8 rates[10]; /* Bit rate supported */ |
264 | u16 proberesp_rate; /* Data rate of the response frame */ | 263 | __le16 proberesp_rate; /* Data rate of the response frame */ |
265 | u16 atim; /* ATIM window time, Kus (hostscan only) */ | 264 | __le16 atim; /* ATIM window time, Kus (hostscan only) */ |
266 | } __attribute__ ((packed)); | 265 | } __attribute__ ((packed)); |
267 | 266 | ||
268 | /* Same stuff for the Lucent/Agere card. | 267 | /* Same stuff for the Lucent/Agere card. |
269 | * Thanks to h1kari <h1kari AT dachb0den.com> - Jean II */ | 268 | * Thanks to h1kari <h1kari AT dachb0den.com> - Jean II */ |
270 | struct agere_scan_apinfo { | 269 | struct agere_scan_apinfo { |
271 | u16 channel; /* Channel where the AP sits */ | 270 | __le16 channel; /* Channel where the AP sits */ |
272 | u16 noise; /* Noise level */ | 271 | __le16 noise; /* Noise level */ |
273 | u16 level; /* Signal level */ | 272 | __le16 level; /* Signal level */ |
274 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ | 273 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ |
275 | u16 beacon_interv; /* Beacon interval */ | 274 | __le16 beacon_interv; /* Beacon interval */ |
276 | u16 capabilities; /* Capabilities */ | 275 | __le16 capabilities; /* Capabilities */ |
277 | /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ | 276 | /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ |
278 | u16 essid_len; /* ESSID length */ | 277 | __le16 essid_len; /* ESSID length */ |
279 | u8 essid[32]; /* ESSID of the network */ | 278 | u8 essid[32]; /* ESSID of the network */ |
280 | } __attribute__ ((packed)); | 279 | } __attribute__ ((packed)); |
281 | 280 | ||
@@ -283,16 +282,16 @@ struct agere_scan_apinfo { | |||
283 | struct symbol_scan_apinfo { | 282 | struct symbol_scan_apinfo { |
284 | u8 channel; /* Channel where the AP sits */ | 283 | u8 channel; /* Channel where the AP sits */ |
285 | u8 unknown1; /* 8 in 2.9x and 3.9x f/w, 0 otherwise */ | 284 | u8 unknown1; /* 8 in 2.9x and 3.9x f/w, 0 otherwise */ |
286 | u16 noise; /* Noise level */ | 285 | __le16 noise; /* Noise level */ |
287 | u16 level; /* Signal level */ | 286 | __le16 level; /* Signal level */ |
288 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ | 287 | u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ |
289 | u16 beacon_interv; /* Beacon interval */ | 288 | __le16 beacon_interv; /* Beacon interval */ |
290 | u16 capabilities; /* Capabilities */ | 289 | __le16 capabilities; /* Capabilities */ |
291 | /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ | 290 | /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ |
292 | u16 essid_len; /* ESSID length */ | 291 | __le16 essid_len; /* ESSID length */ |
293 | u8 essid[32]; /* ESSID of the network */ | 292 | u8 essid[32]; /* ESSID of the network */ |
294 | u16 rates[5]; /* Bit rate supported */ | 293 | __le16 rates[5]; /* Bit rate supported */ |
295 | u16 basic_rates; /* Basic rates bitmask */ | 294 | __le16 basic_rates; /* Basic rates bitmask */ |
296 | u8 unknown2[6]; /* Always FF:FF:FF:FF:00:00 */ | 295 | u8 unknown2[6]; /* Always FF:FF:FF:FF:00:00 */ |
297 | u8 unknown3[8]; /* Always 0, appeared in f/w 3.91-68 */ | 296 | u8 unknown3[8]; /* Always 0, appeared in f/w 3.91-68 */ |
298 | } __attribute__ ((packed)); | 297 | } __attribute__ ((packed)); |
@@ -312,7 +311,7 @@ union hermes_scan_info { | |||
312 | #define HERMES_LINKSTATUS_ASSOC_FAILED (0x0006) | 311 | #define HERMES_LINKSTATUS_ASSOC_FAILED (0x0006) |
313 | 312 | ||
314 | struct hermes_linkstatus { | 313 | struct hermes_linkstatus { |
315 | u16 linkstatus; /* Link status */ | 314 | __le16 linkstatus; /* Link status */ |
316 | } __attribute__ ((packed)); | 315 | } __attribute__ ((packed)); |
317 | 316 | ||
318 | struct hermes_response { | 317 | struct hermes_response { |
@@ -321,8 +320,8 @@ struct hermes_response { | |||
321 | 320 | ||
322 | /* "ID" structure - used for ESSID and station nickname */ | 321 | /* "ID" structure - used for ESSID and station nickname */ |
323 | struct hermes_idstring { | 322 | struct hermes_idstring { |
324 | u16 len; | 323 | __le16 len; |
325 | u16 val[16]; | 324 | __le16 val[16]; |
326 | } __attribute__ ((packed)); | 325 | } __attribute__ ((packed)); |
327 | 326 | ||
328 | struct hermes_multicast { | 327 | struct hermes_multicast { |
@@ -447,7 +446,7 @@ static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count | |||
447 | 446 | ||
448 | static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) | 447 | static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) |
449 | { | 448 | { |
450 | u16 rec; | 449 | __le16 rec; |
451 | int err; | 450 | int err; |
452 | 451 | ||
453 | err = HERMES_READ_RECORD(hw, bap, rid, &rec); | 452 | err = HERMES_READ_RECORD(hw, bap, rid, &rec); |
@@ -457,7 +456,7 @@ static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) | |||
457 | 456 | ||
458 | static inline int hermes_write_wordrec(hermes_t *hw, int bap, u16 rid, u16 word) | 457 | static inline int hermes_write_wordrec(hermes_t *hw, int bap, u16 rid, u16 word) |
459 | { | 458 | { |
460 | u16 rec = cpu_to_le16(word); | 459 | __le16 rec = cpu_to_le16(word); |
461 | return HERMES_WRITE_RECORD(hw, bap, rid, &rec); | 460 | return HERMES_WRITE_RECORD(hw, bap, rid, &rec); |
462 | } | 461 | } |
463 | 462 | ||
diff --git a/drivers/net/wireless/hostap/hostap.c b/drivers/net/wireless/hostap/hostap.c index e7f5821b4942..6a96cd9f2685 100644 --- a/drivers/net/wireless/hostap/hostap.c +++ b/drivers/net/wireless/hostap/hostap.c | |||
@@ -716,9 +716,6 @@ static int prism2_close(struct net_device *dev) | |||
716 | hostap_deauth_all_stas(dev, local->ap, 1); | 716 | hostap_deauth_all_stas(dev, local->ap, 1); |
717 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 717 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
718 | 718 | ||
719 | if (local->func->dev_close && local->func->dev_close(local)) | ||
720 | return 0; | ||
721 | |||
722 | if (dev == local->dev) { | 719 | if (dev == local->dev) { |
723 | local->func->hw_shutdown(dev, HOSTAP_HW_ENABLE_CMDCOMPL); | 720 | local->func->hw_shutdown(dev, HOSTAP_HW_ENABLE_CMDCOMPL); |
724 | } | 721 | } |
@@ -766,9 +763,6 @@ static int prism2_open(struct net_device *dev) | |||
766 | local->hw_downloading) | 763 | local->hw_downloading) |
767 | return -ENODEV; | 764 | return -ENODEV; |
768 | 765 | ||
769 | if (local->func->dev_open && local->func->dev_open(local)) | ||
770 | return 1; | ||
771 | |||
772 | if (!try_module_get(local->hw_module)) | 766 | if (!try_module_get(local->hw_module)) |
773 | return -ENODEV; | 767 | return -ENODEV; |
774 | local->num_dev_open++; | 768 | local->num_dev_open++; |
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index b0501243b175..ffac50899454 100644 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/hostap/hostap_80211_rx.c | |||
@@ -6,10 +6,10 @@ | |||
6 | void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, | 6 | void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, |
7 | struct hostap_80211_rx_status *rx_stats) | 7 | struct hostap_80211_rx_status *rx_stats) |
8 | { | 8 | { |
9 | struct ieee80211_hdr *hdr; | 9 | struct ieee80211_hdr_4addr *hdr; |
10 | u16 fc; | 10 | u16 fc; |
11 | 11 | ||
12 | hdr = (struct ieee80211_hdr *) skb->data; | 12 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
13 | 13 | ||
14 | printk(KERN_DEBUG "%s: RX signal=%d noise=%d rate=%d len=%d " | 14 | printk(KERN_DEBUG "%s: RX signal=%d noise=%d rate=%d len=%d " |
15 | "jiffies=%ld\n", | 15 | "jiffies=%ld\n", |
@@ -51,7 +51,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, | |||
51 | int hdrlen, phdrlen, head_need, tail_need; | 51 | int hdrlen, phdrlen, head_need, tail_need; |
52 | u16 fc; | 52 | u16 fc; |
53 | int prism_header, ret; | 53 | int prism_header, ret; |
54 | struct ieee80211_hdr *hdr; | 54 | struct ieee80211_hdr_4addr *hdr; |
55 | 55 | ||
56 | iface = netdev_priv(dev); | 56 | iface = netdev_priv(dev); |
57 | local = iface->local; | 57 | local = iface->local; |
@@ -70,7 +70,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, | |||
70 | phdrlen = 0; | 70 | phdrlen = 0; |
71 | } | 71 | } |
72 | 72 | ||
73 | hdr = (struct ieee80211_hdr *) skb->data; | 73 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
74 | fc = le16_to_cpu(hdr->frame_ctl); | 74 | fc = le16_to_cpu(hdr->frame_ctl); |
75 | 75 | ||
76 | if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) { | 76 | if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) { |
@@ -215,7 +215,7 @@ prism2_frag_cache_find(local_info_t *local, unsigned int seq, | |||
215 | 215 | ||
216 | /* Called only as a tasklet (software IRQ) */ | 216 | /* Called only as a tasklet (software IRQ) */ |
217 | static struct sk_buff * | 217 | static struct sk_buff * |
218 | prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr *hdr) | 218 | prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr_4addr *hdr) |
219 | { | 219 | { |
220 | struct sk_buff *skb = NULL; | 220 | struct sk_buff *skb = NULL; |
221 | u16 sc; | 221 | u16 sc; |
@@ -229,7 +229,7 @@ prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr *hdr) | |||
229 | if (frag == 0) { | 229 | if (frag == 0) { |
230 | /* Reserve enough space to fit maximum frame length */ | 230 | /* Reserve enough space to fit maximum frame length */ |
231 | skb = dev_alloc_skb(local->dev->mtu + | 231 | skb = dev_alloc_skb(local->dev->mtu + |
232 | sizeof(struct ieee80211_hdr) + | 232 | sizeof(struct ieee80211_hdr_4addr) + |
233 | 8 /* LLC */ + | 233 | 8 /* LLC */ + |
234 | 2 /* alignment */ + | 234 | 2 /* alignment */ + |
235 | 8 /* WEP */ + ETH_ALEN /* WDS */); | 235 | 8 /* WEP */ + ETH_ALEN /* WDS */); |
@@ -267,7 +267,7 @@ prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr *hdr) | |||
267 | 267 | ||
268 | /* Called only as a tasklet (software IRQ) */ | 268 | /* Called only as a tasklet (software IRQ) */ |
269 | static int prism2_frag_cache_invalidate(local_info_t *local, | 269 | static int prism2_frag_cache_invalidate(local_info_t *local, |
270 | struct ieee80211_hdr *hdr) | 270 | struct ieee80211_hdr_4addr *hdr) |
271 | { | 271 | { |
272 | u16 sc; | 272 | u16 sc; |
273 | unsigned int seq; | 273 | unsigned int seq; |
@@ -441,7 +441,7 @@ hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb, | |||
441 | u16 stype) | 441 | u16 stype) |
442 | { | 442 | { |
443 | if (local->iw_mode == IW_MODE_MASTER) { | 443 | if (local->iw_mode == IW_MODE_MASTER) { |
444 | hostap_update_sta_ps(local, (struct ieee80211_hdr *) | 444 | hostap_update_sta_ps(local, (struct ieee80211_hdr_4addr *) |
445 | skb->data); | 445 | skb->data); |
446 | } | 446 | } |
447 | 447 | ||
@@ -520,7 +520,7 @@ static inline struct net_device *prism2_rx_get_wds(local_info_t *local, | |||
520 | 520 | ||
521 | 521 | ||
522 | static inline int | 522 | static inline int |
523 | hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr, | 523 | hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr, |
524 | u16 fc, struct net_device **wds) | 524 | u16 fc, struct net_device **wds) |
525 | { | 525 | { |
526 | /* FIX: is this really supposed to accept WDS frames only in Master | 526 | /* FIX: is this really supposed to accept WDS frames only in Master |
@@ -579,13 +579,13 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb) | |||
579 | { | 579 | { |
580 | struct net_device *dev = local->dev; | 580 | struct net_device *dev = local->dev; |
581 | u16 fc, ethertype; | 581 | u16 fc, ethertype; |
582 | struct ieee80211_hdr *hdr; | 582 | struct ieee80211_hdr_4addr *hdr; |
583 | u8 *pos; | 583 | u8 *pos; |
584 | 584 | ||
585 | if (skb->len < 24) | 585 | if (skb->len < 24) |
586 | return 0; | 586 | return 0; |
587 | 587 | ||
588 | hdr = (struct ieee80211_hdr *) skb->data; | 588 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
589 | fc = le16_to_cpu(hdr->frame_ctl); | 589 | fc = le16_to_cpu(hdr->frame_ctl); |
590 | 590 | ||
591 | /* check that the frame is unicast frame to us */ | 591 | /* check that the frame is unicast frame to us */ |
@@ -619,13 +619,13 @@ static inline int | |||
619 | hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, | 619 | hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, |
620 | struct ieee80211_crypt_data *crypt) | 620 | struct ieee80211_crypt_data *crypt) |
621 | { | 621 | { |
622 | struct ieee80211_hdr *hdr; | 622 | struct ieee80211_hdr_4addr *hdr; |
623 | int res, hdrlen; | 623 | int res, hdrlen; |
624 | 624 | ||
625 | if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) | 625 | if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) |
626 | return 0; | 626 | return 0; |
627 | 627 | ||
628 | hdr = (struct ieee80211_hdr *) skb->data; | 628 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
629 | hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); | 629 | hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); |
630 | 630 | ||
631 | if (local->tkip_countermeasures && | 631 | if (local->tkip_countermeasures && |
@@ -658,13 +658,13 @@ static inline int | |||
658 | hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, | 658 | hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, |
659 | int keyidx, struct ieee80211_crypt_data *crypt) | 659 | int keyidx, struct ieee80211_crypt_data *crypt) |
660 | { | 660 | { |
661 | struct ieee80211_hdr *hdr; | 661 | struct ieee80211_hdr_4addr *hdr; |
662 | int res, hdrlen; | 662 | int res, hdrlen; |
663 | 663 | ||
664 | if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) | 664 | if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) |
665 | return 0; | 665 | return 0; |
666 | 666 | ||
667 | hdr = (struct ieee80211_hdr *) skb->data; | 667 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
668 | hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); | 668 | hdrlen = hostap_80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); |
669 | 669 | ||
670 | atomic_inc(&crypt->refcnt); | 670 | atomic_inc(&crypt->refcnt); |
@@ -689,7 +689,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
689 | { | 689 | { |
690 | struct hostap_interface *iface; | 690 | struct hostap_interface *iface; |
691 | local_info_t *local; | 691 | local_info_t *local; |
692 | struct ieee80211_hdr *hdr; | 692 | struct ieee80211_hdr_4addr *hdr; |
693 | size_t hdrlen; | 693 | size_t hdrlen; |
694 | u16 fc, type, stype, sc; | 694 | u16 fc, type, stype, sc; |
695 | struct net_device *wds = NULL; | 695 | struct net_device *wds = NULL; |
@@ -716,7 +716,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
716 | dev = local->ddev; | 716 | dev = local->ddev; |
717 | iface = netdev_priv(dev); | 717 | iface = netdev_priv(dev); |
718 | 718 | ||
719 | hdr = (struct ieee80211_hdr *) skb->data; | 719 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
720 | stats = hostap_get_stats(dev); | 720 | stats = hostap_get_stats(dev); |
721 | 721 | ||
722 | if (skb->len < 10) | 722 | if (skb->len < 10) |
@@ -737,7 +737,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
737 | struct iw_quality wstats; | 737 | struct iw_quality wstats; |
738 | wstats.level = rx_stats->signal; | 738 | wstats.level = rx_stats->signal; |
739 | wstats.noise = rx_stats->noise; | 739 | wstats.noise = rx_stats->noise; |
740 | wstats.updated = 6; /* No qual value */ | 740 | wstats.updated = IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_UPDATED |
741 | | IW_QUAL_QUAL_INVALID | IW_QUAL_DBM; | ||
741 | /* Update spy records */ | 742 | /* Update spy records */ |
742 | wireless_spy_update(dev, hdr->addr2, &wstats); | 743 | wireless_spy_update(dev, hdr->addr2, &wstats); |
743 | } | 744 | } |
@@ -889,7 +890,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
889 | if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && | 890 | if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && |
890 | (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) | 891 | (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) |
891 | goto rx_dropped; | 892 | goto rx_dropped; |
892 | hdr = (struct ieee80211_hdr *) skb->data; | 893 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
893 | 894 | ||
894 | /* skb: hdr + (possibly fragmented) plaintext payload */ | 895 | /* skb: hdr + (possibly fragmented) plaintext payload */ |
895 | 896 | ||
@@ -941,7 +942,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
941 | /* this was the last fragment and the frame will be | 942 | /* this was the last fragment and the frame will be |
942 | * delivered, so remove skb from fragment cache */ | 943 | * delivered, so remove skb from fragment cache */ |
943 | skb = frag_skb; | 944 | skb = frag_skb; |
944 | hdr = (struct ieee80211_hdr *) skb->data; | 945 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
945 | prism2_frag_cache_invalidate(local, hdr); | 946 | prism2_frag_cache_invalidate(local, hdr); |
946 | } | 947 | } |
947 | 948 | ||
@@ -952,7 +953,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
952 | hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) | 953 | hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) |
953 | goto rx_dropped; | 954 | goto rx_dropped; |
954 | 955 | ||
955 | hdr = (struct ieee80211_hdr *) skb->data; | 956 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
956 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) { | 957 | if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) { |
957 | if (local->ieee_802_1x && | 958 | if (local->ieee_802_1x && |
958 | hostap_is_eapol_frame(local, skb)) { | 959 | hostap_is_eapol_frame(local, skb)) { |
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c index 6358015f6526..9d24f8a38ac5 100644 --- a/drivers/net/wireless/hostap/hostap_80211_tx.c +++ b/drivers/net/wireless/hostap/hostap_80211_tx.c | |||
@@ -1,9 +1,9 @@ | |||
1 | void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) | 1 | void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) |
2 | { | 2 | { |
3 | struct ieee80211_hdr *hdr; | 3 | struct ieee80211_hdr_4addr *hdr; |
4 | u16 fc; | 4 | u16 fc; |
5 | 5 | ||
6 | hdr = (struct ieee80211_hdr *) skb->data; | 6 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
7 | 7 | ||
8 | printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n", | 8 | printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n", |
9 | name, skb->len, jiffies); | 9 | name, skb->len, jiffies); |
@@ -41,7 +41,7 @@ int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
41 | struct hostap_interface *iface; | 41 | struct hostap_interface *iface; |
42 | local_info_t *local; | 42 | local_info_t *local; |
43 | int need_headroom, need_tailroom = 0; | 43 | int need_headroom, need_tailroom = 0; |
44 | struct ieee80211_hdr hdr; | 44 | struct ieee80211_hdr_4addr hdr; |
45 | u16 fc, ethertype = 0; | 45 | u16 fc, ethertype = 0; |
46 | enum { | 46 | enum { |
47 | WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME | 47 | WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME |
@@ -244,7 +244,7 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
244 | struct hostap_interface *iface; | 244 | struct hostap_interface *iface; |
245 | local_info_t *local; | 245 | local_info_t *local; |
246 | struct hostap_skb_tx_data *meta; | 246 | struct hostap_skb_tx_data *meta; |
247 | struct ieee80211_hdr *hdr; | 247 | struct ieee80211_hdr_4addr *hdr; |
248 | u16 fc; | 248 | u16 fc; |
249 | 249 | ||
250 | iface = netdev_priv(dev); | 250 | iface = netdev_priv(dev); |
@@ -266,7 +266,7 @@ int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
266 | meta->iface = iface; | 266 | meta->iface = iface; |
267 | 267 | ||
268 | if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { | 268 | if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { |
269 | hdr = (struct ieee80211_hdr *) skb->data; | 269 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
270 | fc = le16_to_cpu(hdr->frame_ctl); | 270 | fc = le16_to_cpu(hdr->frame_ctl); |
271 | if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && | 271 | if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA && |
272 | WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_DATA) { | 272 | WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_DATA) { |
@@ -289,7 +289,7 @@ struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, | |||
289 | { | 289 | { |
290 | struct hostap_interface *iface; | 290 | struct hostap_interface *iface; |
291 | local_info_t *local; | 291 | local_info_t *local; |
292 | struct ieee80211_hdr *hdr; | 292 | struct ieee80211_hdr_4addr *hdr; |
293 | u16 fc; | 293 | u16 fc; |
294 | int hdr_len, res; | 294 | int hdr_len, res; |
295 | 295 | ||
@@ -303,7 +303,7 @@ struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, | |||
303 | 303 | ||
304 | if (local->tkip_countermeasures && | 304 | if (local->tkip_countermeasures && |
305 | crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { | 305 | crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { |
306 | hdr = (struct ieee80211_hdr *) skb->data; | 306 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
307 | if (net_ratelimit()) { | 307 | if (net_ratelimit()) { |
308 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " | 308 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " |
309 | "TX packet to " MACSTR "\n", | 309 | "TX packet to " MACSTR "\n", |
@@ -317,15 +317,15 @@ struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, | |||
317 | if (skb == NULL) | 317 | if (skb == NULL) |
318 | return NULL; | 318 | return NULL; |
319 | 319 | ||
320 | if ((skb_headroom(skb) < crypt->ops->extra_prefix_len || | 320 | if ((skb_headroom(skb) < crypt->ops->extra_mpdu_prefix_len || |
321 | skb_tailroom(skb) < crypt->ops->extra_postfix_len) && | 321 | skb_tailroom(skb) < crypt->ops->extra_mpdu_postfix_len) && |
322 | pskb_expand_head(skb, crypt->ops->extra_prefix_len, | 322 | pskb_expand_head(skb, crypt->ops->extra_mpdu_prefix_len, |
323 | crypt->ops->extra_postfix_len, GFP_ATOMIC)) { | 323 | crypt->ops->extra_mpdu_postfix_len, GFP_ATOMIC)) { |
324 | kfree_skb(skb); | 324 | kfree_skb(skb); |
325 | return NULL; | 325 | return NULL; |
326 | } | 326 | } |
327 | 327 | ||
328 | hdr = (struct ieee80211_hdr *) skb->data; | 328 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
329 | fc = le16_to_cpu(hdr->frame_ctl); | 329 | fc = le16_to_cpu(hdr->frame_ctl); |
330 | hdr_len = hostap_80211_get_hdrlen(fc); | 330 | hdr_len = hostap_80211_get_hdrlen(fc); |
331 | 331 | ||
@@ -360,7 +360,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
360 | ap_tx_ret tx_ret; | 360 | ap_tx_ret tx_ret; |
361 | struct hostap_skb_tx_data *meta; | 361 | struct hostap_skb_tx_data *meta; |
362 | int no_encrypt = 0; | 362 | int no_encrypt = 0; |
363 | struct ieee80211_hdr *hdr; | 363 | struct ieee80211_hdr_4addr *hdr; |
364 | 364 | ||
365 | iface = netdev_priv(dev); | 365 | iface = netdev_priv(dev); |
366 | local = iface->local; | 366 | local = iface->local; |
@@ -403,7 +403,7 @@ int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
403 | tx_ret = hostap_handle_sta_tx(local, &tx); | 403 | tx_ret = hostap_handle_sta_tx(local, &tx); |
404 | skb = tx.skb; | 404 | skb = tx.skb; |
405 | meta = (struct hostap_skb_tx_data *) skb->cb; | 405 | meta = (struct hostap_skb_tx_data *) skb->cb; |
406 | hdr = (struct ieee80211_hdr *) skb->data; | 406 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
407 | fc = le16_to_cpu(hdr->frame_ctl); | 407 | fc = le16_to_cpu(hdr->frame_ctl); |
408 | switch (tx_ret) { | 408 | switch (tx_ret) { |
409 | case AP_TX_CONTINUE: | 409 | case AP_TX_CONTINUE: |
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index 930cef8367f2..9da94ab7f05f 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c | |||
@@ -591,14 +591,14 @@ static void hostap_ap_tx_cb(struct sk_buff *skb, int ok, void *data) | |||
591 | { | 591 | { |
592 | struct ap_data *ap = data; | 592 | struct ap_data *ap = data; |
593 | u16 fc; | 593 | u16 fc; |
594 | struct ieee80211_hdr *hdr; | 594 | struct ieee80211_hdr_4addr *hdr; |
595 | 595 | ||
596 | if (!ap->local->hostapd || !ap->local->apdev) { | 596 | if (!ap->local->hostapd || !ap->local->apdev) { |
597 | dev_kfree_skb(skb); | 597 | dev_kfree_skb(skb); |
598 | return; | 598 | return; |
599 | } | 599 | } |
600 | 600 | ||
601 | hdr = (struct ieee80211_hdr *) skb->data; | 601 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
602 | fc = le16_to_cpu(hdr->frame_ctl); | 602 | fc = le16_to_cpu(hdr->frame_ctl); |
603 | 603 | ||
604 | /* Pass the TX callback frame to the hostapd; use 802.11 header version | 604 | /* Pass the TX callback frame to the hostapd; use 802.11 header version |
@@ -623,7 +623,7 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data) | |||
623 | { | 623 | { |
624 | struct ap_data *ap = data; | 624 | struct ap_data *ap = data; |
625 | struct net_device *dev = ap->local->dev; | 625 | struct net_device *dev = ap->local->dev; |
626 | struct ieee80211_hdr *hdr; | 626 | struct ieee80211_hdr_4addr *hdr; |
627 | u16 fc, *pos, auth_alg, auth_transaction, status; | 627 | u16 fc, *pos, auth_alg, auth_transaction, status; |
628 | struct sta_info *sta = NULL; | 628 | struct sta_info *sta = NULL; |
629 | char *txt = NULL; | 629 | char *txt = NULL; |
@@ -633,7 +633,7 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data) | |||
633 | return; | 633 | return; |
634 | } | 634 | } |
635 | 635 | ||
636 | hdr = (struct ieee80211_hdr *) skb->data; | 636 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
637 | fc = le16_to_cpu(hdr->frame_ctl); | 637 | fc = le16_to_cpu(hdr->frame_ctl); |
638 | if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || | 638 | if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || |
639 | WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_AUTH || | 639 | WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_AUTH || |
@@ -692,7 +692,7 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) | |||
692 | { | 692 | { |
693 | struct ap_data *ap = data; | 693 | struct ap_data *ap = data; |
694 | struct net_device *dev = ap->local->dev; | 694 | struct net_device *dev = ap->local->dev; |
695 | struct ieee80211_hdr *hdr; | 695 | struct ieee80211_hdr_4addr *hdr; |
696 | u16 fc, *pos, status; | 696 | u16 fc, *pos, status; |
697 | struct sta_info *sta = NULL; | 697 | struct sta_info *sta = NULL; |
698 | char *txt = NULL; | 698 | char *txt = NULL; |
@@ -702,7 +702,7 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) | |||
702 | return; | 702 | return; |
703 | } | 703 | } |
704 | 704 | ||
705 | hdr = (struct ieee80211_hdr *) skb->data; | 705 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
706 | fc = le16_to_cpu(hdr->frame_ctl); | 706 | fc = le16_to_cpu(hdr->frame_ctl); |
707 | if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || | 707 | if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT || |
708 | (WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_ASSOC_RESP && | 708 | (WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_ASSOC_RESP && |
@@ -757,12 +757,12 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) | |||
757 | static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data) | 757 | static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data) |
758 | { | 758 | { |
759 | struct ap_data *ap = data; | 759 | struct ap_data *ap = data; |
760 | struct ieee80211_hdr *hdr; | 760 | struct ieee80211_hdr_4addr *hdr; |
761 | struct sta_info *sta; | 761 | struct sta_info *sta; |
762 | 762 | ||
763 | if (skb->len < 24) | 763 | if (skb->len < 24) |
764 | goto fail; | 764 | goto fail; |
765 | hdr = (struct ieee80211_hdr *) skb->data; | 765 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
766 | if (ok) { | 766 | if (ok) { |
767 | spin_lock(&ap->sta_table_lock); | 767 | spin_lock(&ap->sta_table_lock); |
768 | sta = ap_get_sta(ap, hdr->addr1); | 768 | sta = ap_get_sta(ap, hdr->addr1); |
@@ -918,7 +918,7 @@ static void prism2_send_mgmt(struct net_device *dev, | |||
918 | { | 918 | { |
919 | struct hostap_interface *iface; | 919 | struct hostap_interface *iface; |
920 | local_info_t *local; | 920 | local_info_t *local; |
921 | struct ieee80211_hdr *hdr; | 921 | struct ieee80211_hdr_4addr *hdr; |
922 | u16 fc; | 922 | u16 fc; |
923 | struct sk_buff *skb; | 923 | struct sk_buff *skb; |
924 | struct hostap_skb_tx_data *meta; | 924 | struct hostap_skb_tx_data *meta; |
@@ -944,7 +944,7 @@ static void prism2_send_mgmt(struct net_device *dev, | |||
944 | 944 | ||
945 | fc = type_subtype; | 945 | fc = type_subtype; |
946 | hdrlen = hostap_80211_get_hdrlen(fc); | 946 | hdrlen = hostap_80211_get_hdrlen(fc); |
947 | hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen); | 947 | hdr = (struct ieee80211_hdr_4addr *) skb_put(skb, hdrlen); |
948 | if (body) | 948 | if (body) |
949 | memcpy(skb_put(skb, body_len), body, body_len); | 949 | memcpy(skb_put(skb, body_len), body, body_len); |
950 | 950 | ||
@@ -1256,14 +1256,14 @@ static char * ap_auth_make_challenge(struct ap_data *ap) | |||
1256 | } | 1256 | } |
1257 | 1257 | ||
1258 | skb = dev_alloc_skb(WLAN_AUTH_CHALLENGE_LEN + | 1258 | skb = dev_alloc_skb(WLAN_AUTH_CHALLENGE_LEN + |
1259 | ap->crypt->extra_prefix_len + | 1259 | ap->crypt->extra_mpdu_prefix_len + |
1260 | ap->crypt->extra_postfix_len); | 1260 | ap->crypt->extra_mpdu_postfix_len); |
1261 | if (skb == NULL) { | 1261 | if (skb == NULL) { |
1262 | kfree(tmpbuf); | 1262 | kfree(tmpbuf); |
1263 | return NULL; | 1263 | return NULL; |
1264 | } | 1264 | } |
1265 | 1265 | ||
1266 | skb_reserve(skb, ap->crypt->extra_prefix_len); | 1266 | skb_reserve(skb, ap->crypt->extra_mpdu_prefix_len); |
1267 | memset(skb_put(skb, WLAN_AUTH_CHALLENGE_LEN), 0, | 1267 | memset(skb_put(skb, WLAN_AUTH_CHALLENGE_LEN), 0, |
1268 | WLAN_AUTH_CHALLENGE_LEN); | 1268 | WLAN_AUTH_CHALLENGE_LEN); |
1269 | if (ap->crypt->encrypt_mpdu(skb, 0, ap->crypt_priv)) { | 1269 | if (ap->crypt->encrypt_mpdu(skb, 0, ap->crypt_priv)) { |
@@ -1272,7 +1272,7 @@ static char * ap_auth_make_challenge(struct ap_data *ap) | |||
1272 | return NULL; | 1272 | return NULL; |
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | memcpy(tmpbuf, skb->data + ap->crypt->extra_prefix_len, | 1275 | memcpy(tmpbuf, skb->data + ap->crypt->extra_mpdu_prefix_len, |
1276 | WLAN_AUTH_CHALLENGE_LEN); | 1276 | WLAN_AUTH_CHALLENGE_LEN); |
1277 | dev_kfree_skb(skb); | 1277 | dev_kfree_skb(skb); |
1278 | 1278 | ||
@@ -1285,7 +1285,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb, | |||
1285 | struct hostap_80211_rx_status *rx_stats) | 1285 | struct hostap_80211_rx_status *rx_stats) |
1286 | { | 1286 | { |
1287 | struct net_device *dev = local->dev; | 1287 | struct net_device *dev = local->dev; |
1288 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 1288 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; |
1289 | size_t hdrlen; | 1289 | size_t hdrlen; |
1290 | struct ap_data *ap = local->ap; | 1290 | struct ap_data *ap = local->ap; |
1291 | char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; | 1291 | char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; |
@@ -1498,7 +1498,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb, | |||
1498 | struct hostap_80211_rx_status *rx_stats, int reassoc) | 1498 | struct hostap_80211_rx_status *rx_stats, int reassoc) |
1499 | { | 1499 | { |
1500 | struct net_device *dev = local->dev; | 1500 | struct net_device *dev = local->dev; |
1501 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 1501 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; |
1502 | char body[12], *p, *lpos; | 1502 | char body[12], *p, *lpos; |
1503 | int len, left; | 1503 | int len, left; |
1504 | u16 *pos; | 1504 | u16 *pos; |
@@ -1705,7 +1705,7 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb, | |||
1705 | struct hostap_80211_rx_status *rx_stats) | 1705 | struct hostap_80211_rx_status *rx_stats) |
1706 | { | 1706 | { |
1707 | struct net_device *dev = local->dev; | 1707 | struct net_device *dev = local->dev; |
1708 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 1708 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; |
1709 | char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); | 1709 | char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); |
1710 | int len; | 1710 | int len; |
1711 | u16 reason_code, *pos; | 1711 | u16 reason_code, *pos; |
@@ -1746,7 +1746,7 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb, | |||
1746 | struct hostap_80211_rx_status *rx_stats) | 1746 | struct hostap_80211_rx_status *rx_stats) |
1747 | { | 1747 | { |
1748 | struct net_device *dev = local->dev; | 1748 | struct net_device *dev = local->dev; |
1749 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 1749 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; |
1750 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; | 1750 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; |
1751 | int len; | 1751 | int len; |
1752 | u16 reason_code, *pos; | 1752 | u16 reason_code, *pos; |
@@ -1784,7 +1784,7 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb, | |||
1784 | 1784 | ||
1785 | /* Called only as a scheduled task for pending AP frames. */ | 1785 | /* Called only as a scheduled task for pending AP frames. */ |
1786 | static void ap_handle_data_nullfunc(local_info_t *local, | 1786 | static void ap_handle_data_nullfunc(local_info_t *local, |
1787 | struct ieee80211_hdr *hdr) | 1787 | struct ieee80211_hdr_4addr *hdr) |
1788 | { | 1788 | { |
1789 | struct net_device *dev = local->dev; | 1789 | struct net_device *dev = local->dev; |
1790 | 1790 | ||
@@ -1801,7 +1801,7 @@ static void ap_handle_data_nullfunc(local_info_t *local, | |||
1801 | 1801 | ||
1802 | /* Called only as a scheduled task for pending AP frames. */ | 1802 | /* Called only as a scheduled task for pending AP frames. */ |
1803 | static void ap_handle_dropped_data(local_info_t *local, | 1803 | static void ap_handle_dropped_data(local_info_t *local, |
1804 | struct ieee80211_hdr *hdr) | 1804 | struct ieee80211_hdr_4addr *hdr) |
1805 | { | 1805 | { |
1806 | struct net_device *dev = local->dev; | 1806 | struct net_device *dev = local->dev; |
1807 | struct sta_info *sta; | 1807 | struct sta_info *sta; |
@@ -1860,7 +1860,7 @@ static void pspoll_send_buffered(local_info_t *local, struct sta_info *sta, | |||
1860 | 1860 | ||
1861 | /* Called only as a scheduled task for pending AP frames. */ | 1861 | /* Called only as a scheduled task for pending AP frames. */ |
1862 | static void handle_pspoll(local_info_t *local, | 1862 | static void handle_pspoll(local_info_t *local, |
1863 | struct ieee80211_hdr *hdr, | 1863 | struct ieee80211_hdr_4addr *hdr, |
1864 | struct hostap_80211_rx_status *rx_stats) | 1864 | struct hostap_80211_rx_status *rx_stats) |
1865 | { | 1865 | { |
1866 | struct net_device *dev = local->dev; | 1866 | struct net_device *dev = local->dev; |
@@ -1979,7 +1979,7 @@ static void handle_wds_oper_queue(void *data) | |||
1979 | static void handle_beacon(local_info_t *local, struct sk_buff *skb, | 1979 | static void handle_beacon(local_info_t *local, struct sk_buff *skb, |
1980 | struct hostap_80211_rx_status *rx_stats) | 1980 | struct hostap_80211_rx_status *rx_stats) |
1981 | { | 1981 | { |
1982 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 1982 | struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data; |
1983 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; | 1983 | char *body = skb->data + IEEE80211_MGMT_HDR_LEN; |
1984 | int len, left; | 1984 | int len, left; |
1985 | u16 *pos, beacon_int, capability; | 1985 | u16 *pos, beacon_int, capability; |
@@ -2137,11 +2137,11 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb, | |||
2137 | struct net_device *dev = local->dev; | 2137 | struct net_device *dev = local->dev; |
2138 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 2138 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
2139 | u16 fc, type, stype; | 2139 | u16 fc, type, stype; |
2140 | struct ieee80211_hdr *hdr; | 2140 | struct ieee80211_hdr_4addr *hdr; |
2141 | 2141 | ||
2142 | /* FIX: should give skb->len to handler functions and check that the | 2142 | /* FIX: should give skb->len to handler functions and check that the |
2143 | * buffer is long enough */ | 2143 | * buffer is long enough */ |
2144 | hdr = (struct ieee80211_hdr *) skb->data; | 2144 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
2145 | fc = le16_to_cpu(hdr->frame_ctl); | 2145 | fc = le16_to_cpu(hdr->frame_ctl); |
2146 | type = WLAN_FC_GET_TYPE(fc); | 2146 | type = WLAN_FC_GET_TYPE(fc); |
2147 | stype = WLAN_FC_GET_STYPE(fc); | 2147 | stype = WLAN_FC_GET_STYPE(fc); |
@@ -2258,7 +2258,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb, | |||
2258 | struct hostap_interface *iface; | 2258 | struct hostap_interface *iface; |
2259 | local_info_t *local; | 2259 | local_info_t *local; |
2260 | u16 fc; | 2260 | u16 fc; |
2261 | struct ieee80211_hdr *hdr; | 2261 | struct ieee80211_hdr_4addr *hdr; |
2262 | 2262 | ||
2263 | iface = netdev_priv(dev); | 2263 | iface = netdev_priv(dev); |
2264 | local = iface->local; | 2264 | local = iface->local; |
@@ -2268,7 +2268,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb, | |||
2268 | 2268 | ||
2269 | local->stats.rx_packets++; | 2269 | local->stats.rx_packets++; |
2270 | 2270 | ||
2271 | hdr = (struct ieee80211_hdr *) skb->data; | 2271 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
2272 | fc = le16_to_cpu(hdr->frame_ctl); | 2272 | fc = le16_to_cpu(hdr->frame_ctl); |
2273 | 2273 | ||
2274 | if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && | 2274 | if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && |
@@ -2289,7 +2289,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb, | |||
2289 | static void schedule_packet_send(local_info_t *local, struct sta_info *sta) | 2289 | static void schedule_packet_send(local_info_t *local, struct sta_info *sta) |
2290 | { | 2290 | { |
2291 | struct sk_buff *skb; | 2291 | struct sk_buff *skb; |
2292 | struct ieee80211_hdr *hdr; | 2292 | struct ieee80211_hdr_4addr *hdr; |
2293 | struct hostap_80211_rx_status rx_stats; | 2293 | struct hostap_80211_rx_status rx_stats; |
2294 | 2294 | ||
2295 | if (skb_queue_empty(&sta->tx_buf)) | 2295 | if (skb_queue_empty(&sta->tx_buf)) |
@@ -2302,7 +2302,7 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta) | |||
2302 | return; | 2302 | return; |
2303 | } | 2303 | } |
2304 | 2304 | ||
2305 | hdr = (struct ieee80211_hdr *) skb_put(skb, 16); | 2305 | hdr = (struct ieee80211_hdr_4addr *) skb_put(skb, 16); |
2306 | 2306 | ||
2307 | /* Generate a fake pspoll frame to start packet delivery */ | 2307 | /* Generate a fake pspoll frame to start packet delivery */ |
2308 | hdr->frame_ctl = __constant_cpu_to_le16( | 2308 | hdr->frame_ctl = __constant_cpu_to_le16( |
@@ -2349,7 +2349,7 @@ static int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], | |||
2349 | qual[count].noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); | 2349 | qual[count].noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); |
2350 | qual[count].updated = sta->last_rx_updated; | 2350 | qual[count].updated = sta->last_rx_updated; |
2351 | 2351 | ||
2352 | sta->last_rx_updated = 0; | 2352 | sta->last_rx_updated = IW_QUAL_DBM; |
2353 | 2353 | ||
2354 | count++; | 2354 | count++; |
2355 | if (count >= buf_size) | 2355 | if (count >= buf_size) |
@@ -2467,7 +2467,7 @@ static int prism2_ap_translate_scan(struct net_device *dev, char *buffer) | |||
2467 | } | 2467 | } |
2468 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 2468 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
2469 | 2469 | ||
2470 | sta->last_rx_updated = 0; | 2470 | sta->last_rx_updated = IW_QUAL_DBM; |
2471 | 2471 | ||
2472 | /* To be continued, we should make good use of IWEVCUSTOM */ | 2472 | /* To be continued, we should make good use of IWEVCUSTOM */ |
2473 | } | 2473 | } |
@@ -2685,7 +2685,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx) | |||
2685 | struct sta_info *sta = NULL; | 2685 | struct sta_info *sta = NULL; |
2686 | struct sk_buff *skb = tx->skb; | 2686 | struct sk_buff *skb = tx->skb; |
2687 | int set_tim, ret; | 2687 | int set_tim, ret; |
2688 | struct ieee80211_hdr *hdr; | 2688 | struct ieee80211_hdr_4addr *hdr; |
2689 | struct hostap_skb_tx_data *meta; | 2689 | struct hostap_skb_tx_data *meta; |
2690 | 2690 | ||
2691 | meta = (struct hostap_skb_tx_data *) skb->cb; | 2691 | meta = (struct hostap_skb_tx_data *) skb->cb; |
@@ -2694,7 +2694,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx) | |||
2694 | meta->iface->type == HOSTAP_INTERFACE_STA) | 2694 | meta->iface->type == HOSTAP_INTERFACE_STA) |
2695 | goto out; | 2695 | goto out; |
2696 | 2696 | ||
2697 | hdr = (struct ieee80211_hdr *) skb->data; | 2697 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
2698 | 2698 | ||
2699 | if (hdr->addr1[0] & 0x01) { | 2699 | if (hdr->addr1[0] & 0x01) { |
2700 | /* broadcast/multicast frame - no AP related processing */ | 2700 | /* broadcast/multicast frame - no AP related processing */ |
@@ -2821,10 +2821,10 @@ void hostap_handle_sta_release(void *ptr) | |||
2821 | void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb) | 2821 | void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb) |
2822 | { | 2822 | { |
2823 | struct sta_info *sta; | 2823 | struct sta_info *sta; |
2824 | struct ieee80211_hdr *hdr; | 2824 | struct ieee80211_hdr_4addr *hdr; |
2825 | struct hostap_skb_tx_data *meta; | 2825 | struct hostap_skb_tx_data *meta; |
2826 | 2826 | ||
2827 | hdr = (struct ieee80211_hdr *) skb->data; | 2827 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
2828 | meta = (struct hostap_skb_tx_data *) skb->cb; | 2828 | meta = (struct hostap_skb_tx_data *) skb->cb; |
2829 | 2829 | ||
2830 | spin_lock(&local->ap->sta_table_lock); | 2830 | spin_lock(&local->ap->sta_table_lock); |
@@ -2892,7 +2892,7 @@ static void hostap_update_sta_ps2(local_info_t *local, struct sta_info *sta, | |||
2892 | 2892 | ||
2893 | /* Called only as a tasklet (software IRQ). Called for each RX frame to update | 2893 | /* Called only as a tasklet (software IRQ). Called for each RX frame to update |
2894 | * STA power saving state. pwrmgt is a flag from 802.11 frame_ctl field. */ | 2894 | * STA power saving state. pwrmgt is a flag from 802.11 frame_ctl field. */ |
2895 | int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr) | 2895 | int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr_4addr *hdr) |
2896 | { | 2896 | { |
2897 | struct sta_info *sta; | 2897 | struct sta_info *sta; |
2898 | u16 fc; | 2898 | u16 fc; |
@@ -2925,12 +2925,12 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, | |||
2925 | int ret; | 2925 | int ret; |
2926 | struct sta_info *sta; | 2926 | struct sta_info *sta; |
2927 | u16 fc, type, stype; | 2927 | u16 fc, type, stype; |
2928 | struct ieee80211_hdr *hdr; | 2928 | struct ieee80211_hdr_4addr *hdr; |
2929 | 2929 | ||
2930 | if (local->ap == NULL) | 2930 | if (local->ap == NULL) |
2931 | return AP_RX_CONTINUE; | 2931 | return AP_RX_CONTINUE; |
2932 | 2932 | ||
2933 | hdr = (struct ieee80211_hdr *) skb->data; | 2933 | hdr = (struct ieee80211_hdr_4addr *) skb->data; |
2934 | 2934 | ||
2935 | fc = le16_to_cpu(hdr->frame_ctl); | 2935 | fc = le16_to_cpu(hdr->frame_ctl); |
2936 | type = WLAN_FC_GET_TYPE(fc); | 2936 | type = WLAN_FC_GET_TYPE(fc); |
@@ -3058,7 +3058,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, | |||
3058 | 3058 | ||
3059 | /* Called only as a tasklet (software IRQ) */ | 3059 | /* Called only as a tasklet (software IRQ) */ |
3060 | int hostap_handle_sta_crypto(local_info_t *local, | 3060 | int hostap_handle_sta_crypto(local_info_t *local, |
3061 | struct ieee80211_hdr *hdr, | 3061 | struct ieee80211_hdr_4addr *hdr, |
3062 | struct ieee80211_crypt_data **crypt, | 3062 | struct ieee80211_crypt_data **crypt, |
3063 | void **sta_ptr) | 3063 | void **sta_ptr) |
3064 | { | 3064 | { |
@@ -3160,7 +3160,7 @@ int hostap_add_sta(struct ap_data *ap, u8 *sta_addr) | |||
3160 | 3160 | ||
3161 | /* Called only as a tasklet (software IRQ) */ | 3161 | /* Called only as a tasklet (software IRQ) */ |
3162 | int hostap_update_rx_stats(struct ap_data *ap, | 3162 | int hostap_update_rx_stats(struct ap_data *ap, |
3163 | struct ieee80211_hdr *hdr, | 3163 | struct ieee80211_hdr_4addr *hdr, |
3164 | struct hostap_80211_rx_status *rx_stats) | 3164 | struct hostap_80211_rx_status *rx_stats) |
3165 | { | 3165 | { |
3166 | struct sta_info *sta; | 3166 | struct sta_info *sta; |
@@ -3174,7 +3174,7 @@ int hostap_update_rx_stats(struct ap_data *ap, | |||
3174 | sta->last_rx_silence = rx_stats->noise; | 3174 | sta->last_rx_silence = rx_stats->noise; |
3175 | sta->last_rx_signal = rx_stats->signal; | 3175 | sta->last_rx_signal = rx_stats->signal; |
3176 | sta->last_rx_rate = rx_stats->rate; | 3176 | sta->last_rx_rate = rx_stats->rate; |
3177 | sta->last_rx_updated = 7; | 3177 | sta->last_rx_updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; |
3178 | if (rx_stats->rate == 10) | 3178 | if (rx_stats->rate == 10) |
3179 | sta->rx_count[0]++; | 3179 | sta->rx_count[0]++; |
3180 | else if (rx_stats->rate == 20) | 3180 | else if (rx_stats->rate == 20) |
diff --git a/drivers/net/wireless/hostap/hostap_ap.h b/drivers/net/wireless/hostap/hostap_ap.h index 816a52bcea8f..6d00df69c2e3 100644 --- a/drivers/net/wireless/hostap/hostap_ap.h +++ b/drivers/net/wireless/hostap/hostap_ap.h | |||
@@ -233,7 +233,7 @@ struct hostap_tx_data { | |||
233 | ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx); | 233 | ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx); |
234 | void hostap_handle_sta_release(void *ptr); | 234 | void hostap_handle_sta_release(void *ptr); |
235 | void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb); | 235 | void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb); |
236 | int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr); | 236 | int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr_4addr *hdr); |
237 | typedef enum { | 237 | typedef enum { |
238 | AP_RX_CONTINUE, AP_RX_DROP, AP_RX_EXIT, AP_RX_CONTINUE_NOT_AUTHORIZED | 238 | AP_RX_CONTINUE, AP_RX_DROP, AP_RX_EXIT, AP_RX_CONTINUE_NOT_AUTHORIZED |
239 | } ap_rx_ret; | 239 | } ap_rx_ret; |
@@ -241,13 +241,13 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, | |||
241 | struct sk_buff *skb, | 241 | struct sk_buff *skb, |
242 | struct hostap_80211_rx_status *rx_stats, | 242 | struct hostap_80211_rx_status *rx_stats, |
243 | int wds); | 243 | int wds); |
244 | int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr *hdr, | 244 | int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr_4addr *hdr, |
245 | struct ieee80211_crypt_data **crypt, | 245 | struct ieee80211_crypt_data **crypt, |
246 | void **sta_ptr); | 246 | void **sta_ptr); |
247 | int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr); | 247 | int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr); |
248 | int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr); | 248 | int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr); |
249 | int hostap_add_sta(struct ap_data *ap, u8 *sta_addr); | 249 | int hostap_add_sta(struct ap_data *ap, u8 *sta_addr); |
250 | int hostap_update_rx_stats(struct ap_data *ap, struct ieee80211_hdr *hdr, | 250 | int hostap_update_rx_stats(struct ap_data *ap, struct ieee80211_hdr_4addr *hdr, |
251 | struct hostap_80211_rx_status *rx_stats); | 251 | struct hostap_80211_rx_status *rx_stats); |
252 | void hostap_update_rates(local_info_t *local); | 252 | void hostap_update_rates(local_info_t *local); |
253 | void hostap_add_wds_links(local_info_t *local); | 253 | void hostap_add_wds_links(local_info_t *local); |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index faa83badf0a1..2643976a6677 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -492,42 +492,10 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | |||
492 | } | 492 | } |
493 | 493 | ||
494 | 494 | ||
495 | static int prism2_pccard_dev_open(local_info_t *local) | ||
496 | { | ||
497 | struct hostap_cs_priv *hw_priv = local->hw_priv; | ||
498 | hw_priv->link->open++; | ||
499 | return 0; | ||
500 | } | ||
501 | |||
502 | |||
503 | static int prism2_pccard_dev_close(local_info_t *local) | ||
504 | { | ||
505 | struct hostap_cs_priv *hw_priv; | ||
506 | |||
507 | if (local == NULL || local->hw_priv == NULL) | ||
508 | return 1; | ||
509 | hw_priv = local->hw_priv; | ||
510 | if (hw_priv->link == NULL) | ||
511 | return 1; | ||
512 | |||
513 | if (!hw_priv->link->open) { | ||
514 | printk(KERN_WARNING "%s: prism2_pccard_dev_close(): " | ||
515 | "link not open?!\n", local->dev->name); | ||
516 | return 1; | ||
517 | } | ||
518 | |||
519 | hw_priv->link->open--; | ||
520 | |||
521 | return 0; | ||
522 | } | ||
523 | |||
524 | |||
525 | static struct prism2_helper_functions prism2_pccard_funcs = | 495 | static struct prism2_helper_functions prism2_pccard_funcs = |
526 | { | 496 | { |
527 | .card_present = prism2_pccard_card_present, | 497 | .card_present = prism2_pccard_card_present, |
528 | .cor_sreset = prism2_pccard_cor_sreset, | 498 | .cor_sreset = prism2_pccard_cor_sreset, |
529 | .dev_open = prism2_pccard_dev_open, | ||
530 | .dev_close = prism2_pccard_dev_close, | ||
531 | .genesis_reset = prism2_pccard_genesis_reset, | 499 | .genesis_reset = prism2_pccard_genesis_reset, |
532 | .hw_type = HOSTAP_HW_PCCARD, | 500 | .hw_type = HOSTAP_HW_PCCARD, |
533 | }; | 501 | }; |
@@ -597,13 +565,14 @@ static void prism2_detach(dev_link_t *link) | |||
597 | *linkp = link->next; | 565 | *linkp = link->next; |
598 | /* release net devices */ | 566 | /* release net devices */ |
599 | if (link->priv) { | 567 | if (link->priv) { |
568 | struct hostap_cs_priv *hw_priv; | ||
600 | struct net_device *dev; | 569 | struct net_device *dev; |
601 | struct hostap_interface *iface; | 570 | struct hostap_interface *iface; |
602 | dev = link->priv; | 571 | dev = link->priv; |
603 | iface = netdev_priv(dev); | 572 | iface = netdev_priv(dev); |
604 | kfree(iface->local->hw_priv); | 573 | hw_priv = iface->local->hw_priv; |
605 | iface->local->hw_priv = NULL; | ||
606 | prism2_free_local_data(dev); | 574 | prism2_free_local_data(dev); |
575 | kfree(hw_priv); | ||
607 | } | 576 | } |
608 | kfree(link); | 577 | kfree(link); |
609 | } | 578 | } |
@@ -883,6 +852,13 @@ static int prism2_event(event_t event, int priority, | |||
883 | { | 852 | { |
884 | dev_link_t *link = args->client_data; | 853 | dev_link_t *link = args->client_data; |
885 | struct net_device *dev = (struct net_device *) link->priv; | 854 | struct net_device *dev = (struct net_device *) link->priv; |
855 | int dev_open = 0; | ||
856 | |||
857 | if (link->state & DEV_CONFIG) { | ||
858 | struct hostap_interface *iface = netdev_priv(dev); | ||
859 | if (iface && iface->local) | ||
860 | dev_open = iface->local->num_dev_open > 0; | ||
861 | } | ||
886 | 862 | ||
887 | switch (event) { | 863 | switch (event) { |
888 | case CS_EVENT_CARD_INSERTION: | 864 | case CS_EVENT_CARD_INSERTION: |
@@ -911,7 +887,7 @@ static int prism2_event(event_t event, int priority, | |||
911 | case CS_EVENT_RESET_PHYSICAL: | 887 | case CS_EVENT_RESET_PHYSICAL: |
912 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_RESET_PHYSICAL\n", dev_info); | 888 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_RESET_PHYSICAL\n", dev_info); |
913 | if (link->state & DEV_CONFIG) { | 889 | if (link->state & DEV_CONFIG) { |
914 | if (link->open) { | 890 | if (dev_open) { |
915 | netif_stop_queue(dev); | 891 | netif_stop_queue(dev); |
916 | netif_device_detach(dev); | 892 | netif_device_detach(dev); |
917 | } | 893 | } |
@@ -931,8 +907,8 @@ static int prism2_event(event_t event, int priority, | |||
931 | pcmcia_request_configuration(link->handle, | 907 | pcmcia_request_configuration(link->handle, |
932 | &link->conf); | 908 | &link->conf); |
933 | prism2_hw_shutdown(dev, 1); | 909 | prism2_hw_shutdown(dev, 1); |
934 | prism2_hw_config(dev, link->open ? 0 : 1); | 910 | prism2_hw_config(dev, dev_open ? 0 : 1); |
935 | if (link->open) { | 911 | if (dev_open) { |
936 | netif_device_attach(dev); | 912 | netif_device_attach(dev); |
937 | netif_start_queue(dev); | 913 | netif_start_queue(dev); |
938 | } | 914 | } |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index e533a663deda..59fc15572395 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -3322,6 +3322,18 @@ static void prism2_free_local_data(struct net_device *dev) | |||
3322 | iface = netdev_priv(dev); | 3322 | iface = netdev_priv(dev); |
3323 | local = iface->local; | 3323 | local = iface->local; |
3324 | 3324 | ||
3325 | /* Unregister all netdevs before freeing local data. */ | ||
3326 | list_for_each_safe(ptr, n, &local->hostap_interfaces) { | ||
3327 | iface = list_entry(ptr, struct hostap_interface, list); | ||
3328 | if (iface->type == HOSTAP_INTERFACE_MASTER) { | ||
3329 | /* special handling for this interface below */ | ||
3330 | continue; | ||
3331 | } | ||
3332 | hostap_remove_interface(iface->dev, 0, 1); | ||
3333 | } | ||
3334 | |||
3335 | unregister_netdev(local->dev); | ||
3336 | |||
3325 | flush_scheduled_work(); | 3337 | flush_scheduled_work(); |
3326 | 3338 | ||
3327 | if (timer_pending(&local->crypt_deinit_timer)) | 3339 | if (timer_pending(&local->crypt_deinit_timer)) |
@@ -3382,15 +3394,6 @@ static void prism2_free_local_data(struct net_device *dev) | |||
3382 | prism2_download_free_data(local->dl_sec); | 3394 | prism2_download_free_data(local->dl_sec); |
3383 | #endif /* PRISM2_DOWNLOAD_SUPPORT */ | 3395 | #endif /* PRISM2_DOWNLOAD_SUPPORT */ |
3384 | 3396 | ||
3385 | list_for_each_safe(ptr, n, &local->hostap_interfaces) { | ||
3386 | iface = list_entry(ptr, struct hostap_interface, list); | ||
3387 | if (iface->type == HOSTAP_INTERFACE_MASTER) { | ||
3388 | /* special handling for this interface below */ | ||
3389 | continue; | ||
3390 | } | ||
3391 | hostap_remove_interface(iface->dev, 0, 1); | ||
3392 | } | ||
3393 | |||
3394 | prism2_clear_set_tim_queue(local); | 3397 | prism2_clear_set_tim_queue(local); |
3395 | 3398 | ||
3396 | list_for_each_safe(ptr, n, &local->bss_list) { | 3399 | list_for_each_safe(ptr, n, &local->bss_list) { |
@@ -3403,7 +3406,6 @@ static void prism2_free_local_data(struct net_device *dev) | |||
3403 | kfree(local->last_scan_results); | 3406 | kfree(local->last_scan_results); |
3404 | kfree(local->generic_elem); | 3407 | kfree(local->generic_elem); |
3405 | 3408 | ||
3406 | unregister_netdev(local->dev); | ||
3407 | free_netdev(local->dev); | 3409 | free_netdev(local->dev); |
3408 | } | 3410 | } |
3409 | 3411 | ||
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index e720369a3515..53f5246c40aa 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c | |||
@@ -50,7 +50,8 @@ static struct iw_statistics *hostap_get_wireless_stats(struct net_device *dev) | |||
50 | #endif /* in_atomic */ | 50 | #endif /* in_atomic */ |
51 | 51 | ||
52 | if (update && prism2_update_comms_qual(dev) == 0) | 52 | if (update && prism2_update_comms_qual(dev) == 0) |
53 | wstats->qual.updated = 7; | 53 | wstats->qual.updated = IW_QUAL_ALL_UPDATED | |
54 | IW_QUAL_DBM; | ||
54 | 55 | ||
55 | wstats->qual.qual = local->comms_qual; | 56 | wstats->qual.qual = local->comms_qual; |
56 | wstats->qual.level = local->avg_signal; | 57 | wstats->qual.level = local->avg_signal; |
@@ -59,7 +60,7 @@ static struct iw_statistics *hostap_get_wireless_stats(struct net_device *dev) | |||
59 | wstats->qual.qual = 0; | 60 | wstats->qual.qual = 0; |
60 | wstats->qual.level = 0; | 61 | wstats->qual.level = 0; |
61 | wstats->qual.noise = 0; | 62 | wstats->qual.noise = 0; |
62 | wstats->qual.updated = 0; | 63 | wstats->qual.updated = IW_QUAL_ALL_INVALID; |
63 | } | 64 | } |
64 | 65 | ||
65 | return wstats; | 66 | return wstats; |
@@ -1827,13 +1828,6 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1827 | iwe.cmd = SIOCGIWAP; | 1828 | iwe.cmd = SIOCGIWAP; |
1828 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | 1829 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; |
1829 | memcpy(iwe.u.ap_addr.sa_data, bssid, ETH_ALEN); | 1830 | memcpy(iwe.u.ap_addr.sa_data, bssid, ETH_ALEN); |
1830 | /* FIX: | ||
1831 | * I do not know how this is possible, but iwe_stream_add_event | ||
1832 | * seems to re-order memcpy execution so that len is set only | ||
1833 | * after copying.. Pre-setting len here "fixes" this, but real | ||
1834 | * problems should be solved (after which these iwe.len | ||
1835 | * settings could be removed from this function). */ | ||
1836 | iwe.len = IW_EV_ADDR_LEN; | ||
1837 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1831 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, |
1838 | IW_EV_ADDR_LEN); | 1832 | IW_EV_ADDR_LEN); |
1839 | 1833 | ||
@@ -1843,7 +1837,6 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1843 | iwe.cmd = SIOCGIWESSID; | 1837 | iwe.cmd = SIOCGIWESSID; |
1844 | iwe.u.data.length = ssid_len; | 1838 | iwe.u.data.length = ssid_len; |
1845 | iwe.u.data.flags = 1; | 1839 | iwe.u.data.flags = 1; |
1846 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; | ||
1847 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ssid); | 1840 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ssid); |
1848 | 1841 | ||
1849 | memset(&iwe, 0, sizeof(iwe)); | 1842 | memset(&iwe, 0, sizeof(iwe)); |
@@ -1859,7 +1852,6 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1859 | iwe.u.mode = IW_MODE_MASTER; | 1852 | iwe.u.mode = IW_MODE_MASTER; |
1860 | else | 1853 | else |
1861 | iwe.u.mode = IW_MODE_ADHOC; | 1854 | iwe.u.mode = IW_MODE_ADHOC; |
1862 | iwe.len = IW_EV_UINT_LEN; | ||
1863 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1855 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, |
1864 | IW_EV_UINT_LEN); | 1856 | IW_EV_UINT_LEN); |
1865 | } | 1857 | } |
@@ -1877,7 +1869,6 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1877 | if (chan > 0) { | 1869 | if (chan > 0) { |
1878 | iwe.u.freq.m = freq_list[le16_to_cpu(chan - 1)] * 100000; | 1870 | iwe.u.freq.m = freq_list[le16_to_cpu(chan - 1)] * 100000; |
1879 | iwe.u.freq.e = 1; | 1871 | iwe.u.freq.e = 1; |
1880 | iwe.len = IW_EV_FREQ_LEN; | ||
1881 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1872 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, |
1882 | IW_EV_FREQ_LEN); | 1873 | IW_EV_FREQ_LEN); |
1883 | } | 1874 | } |
@@ -1894,7 +1885,10 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1894 | iwe.u.qual.noise = | 1885 | iwe.u.qual.noise = |
1895 | HFA384X_LEVEL_TO_dBm(le16_to_cpu(scan->anl)); | 1886 | HFA384X_LEVEL_TO_dBm(le16_to_cpu(scan->anl)); |
1896 | } | 1887 | } |
1897 | iwe.len = IW_EV_QUAL_LEN; | 1888 | iwe.u.qual.updated = IW_QUAL_LEVEL_UPDATED |
1889 | | IW_QUAL_NOISE_UPDATED | ||
1890 | | IW_QUAL_QUAL_INVALID | ||
1891 | | IW_QUAL_DBM; | ||
1898 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, | 1892 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, |
1899 | IW_EV_QUAL_LEN); | 1893 | IW_EV_QUAL_LEN); |
1900 | } | 1894 | } |
@@ -1906,7 +1900,6 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1906 | else | 1900 | else |
1907 | iwe.u.data.flags = IW_ENCODE_DISABLED; | 1901 | iwe.u.data.flags = IW_ENCODE_DISABLED; |
1908 | iwe.u.data.length = 0; | 1902 | iwe.u.data.length = 0; |
1909 | iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; | ||
1910 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ""); | 1903 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, ""); |
1911 | 1904 | ||
1912 | /* TODO: add SuppRates into BSS table */ | 1905 | /* TODO: add SuppRates into BSS table */ |
@@ -1930,7 +1923,7 @@ static char * __prism2_translate_scan(local_info_t *local, | |||
1930 | } | 1923 | } |
1931 | 1924 | ||
1932 | /* TODO: add BeaconInt,resp_rate,atim into BSS table */ | 1925 | /* TODO: add BeaconInt,resp_rate,atim into BSS table */ |
1933 | buf = kmalloc(MAX_WPA_IE_LEN * 2 + 30, GFP_KERNEL); | 1926 | buf = kmalloc(MAX_WPA_IE_LEN * 2 + 30, GFP_ATOMIC); |
1934 | if (buf && scan) { | 1927 | if (buf && scan) { |
1935 | memset(&iwe, 0, sizeof(iwe)); | 1928 | memset(&iwe, 0, sizeof(iwe)); |
1936 | iwe.cmd = IWEVCUSTOM; | 1929 | iwe.cmd = IWEVCUSTOM; |
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index 025f8cdb5566..da0c80fb941c 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c | |||
@@ -59,11 +59,13 @@ static struct pci_device_id prism2_pci_id_table[] __devinitdata = { | |||
59 | static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v) | 59 | static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v) |
60 | { | 60 | { |
61 | struct hostap_interface *iface; | 61 | struct hostap_interface *iface; |
62 | struct hostap_pci_priv *hw_priv; | ||
62 | local_info_t *local; | 63 | local_info_t *local; |
63 | unsigned long flags; | 64 | unsigned long flags; |
64 | 65 | ||
65 | iface = netdev_priv(dev); | 66 | iface = netdev_priv(dev); |
66 | local = iface->local; | 67 | local = iface->local; |
68 | hw_priv = local->hw_priv; | ||
67 | 69 | ||
68 | spin_lock_irqsave(&local->lock, flags); | 70 | spin_lock_irqsave(&local->lock, flags); |
69 | prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v); | 71 | prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v); |
@@ -74,12 +76,14 @@ static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v) | |||
74 | static inline u8 hfa384x_inb_debug(struct net_device *dev, int a) | 76 | static inline u8 hfa384x_inb_debug(struct net_device *dev, int a) |
75 | { | 77 | { |
76 | struct hostap_interface *iface; | 78 | struct hostap_interface *iface; |
79 | struct hostap_pci_priv *hw_priv; | ||
77 | local_info_t *local; | 80 | local_info_t *local; |
78 | unsigned long flags; | 81 | unsigned long flags; |
79 | u8 v; | 82 | u8 v; |
80 | 83 | ||
81 | iface = netdev_priv(dev); | 84 | iface = netdev_priv(dev); |
82 | local = iface->local; | 85 | local = iface->local; |
86 | hw_priv = local->hw_priv; | ||
83 | 87 | ||
84 | spin_lock_irqsave(&local->lock, flags); | 88 | spin_lock_irqsave(&local->lock, flags); |
85 | v = readb(hw_priv->mem_start + a); | 89 | v = readb(hw_priv->mem_start + a); |
@@ -91,11 +95,13 @@ static inline u8 hfa384x_inb_debug(struct net_device *dev, int a) | |||
91 | static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v) | 95 | static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v) |
92 | { | 96 | { |
93 | struct hostap_interface *iface; | 97 | struct hostap_interface *iface; |
98 | struct hostap_pci_priv *hw_priv; | ||
94 | local_info_t *local; | 99 | local_info_t *local; |
95 | unsigned long flags; | 100 | unsigned long flags; |
96 | 101 | ||
97 | iface = netdev_priv(dev); | 102 | iface = netdev_priv(dev); |
98 | local = iface->local; | 103 | local = iface->local; |
104 | hw_priv = local->hw_priv; | ||
99 | 105 | ||
100 | spin_lock_irqsave(&local->lock, flags); | 106 | spin_lock_irqsave(&local->lock, flags); |
101 | prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v); | 107 | prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v); |
@@ -106,12 +112,14 @@ static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v) | |||
106 | static inline u16 hfa384x_inw_debug(struct net_device *dev, int a) | 112 | static inline u16 hfa384x_inw_debug(struct net_device *dev, int a) |
107 | { | 113 | { |
108 | struct hostap_interface *iface; | 114 | struct hostap_interface *iface; |
115 | struct hostap_pci_priv *hw_priv; | ||
109 | local_info_t *local; | 116 | local_info_t *local; |
110 | unsigned long flags; | 117 | unsigned long flags; |
111 | u16 v; | 118 | u16 v; |
112 | 119 | ||
113 | iface = netdev_priv(dev); | 120 | iface = netdev_priv(dev); |
114 | local = iface->local; | 121 | local = iface->local; |
122 | hw_priv = local->hw_priv; | ||
115 | 123 | ||
116 | spin_lock_irqsave(&local->lock, flags); | 124 | spin_lock_irqsave(&local->lock, flags); |
117 | v = readw(hw_priv->mem_start + a); | 125 | v = readw(hw_priv->mem_start + a); |
@@ -277,8 +285,6 @@ static struct prism2_helper_functions prism2_pci_funcs = | |||
277 | { | 285 | { |
278 | .card_present = NULL, | 286 | .card_present = NULL, |
279 | .cor_sreset = prism2_pci_cor_sreset, | 287 | .cor_sreset = prism2_pci_cor_sreset, |
280 | .dev_open = NULL, | ||
281 | .dev_close = NULL, | ||
282 | .genesis_reset = prism2_pci_genesis_reset, | 288 | .genesis_reset = prism2_pci_genesis_reset, |
283 | .hw_type = HOSTAP_HW_PCI, | 289 | .hw_type = HOSTAP_HW_PCI, |
284 | }; | 290 | }; |
@@ -352,8 +358,6 @@ static int prism2_pci_probe(struct pci_dev *pdev, | |||
352 | return hostap_hw_ready(dev); | 358 | return hostap_hw_ready(dev); |
353 | 359 | ||
354 | fail: | 360 | fail: |
355 | kfree(hw_priv); | ||
356 | |||
357 | if (irq_registered && dev) | 361 | if (irq_registered && dev) |
358 | free_irq(dev->irq, dev); | 362 | free_irq(dev->irq, dev); |
359 | 363 | ||
@@ -364,10 +368,8 @@ static int prism2_pci_probe(struct pci_dev *pdev, | |||
364 | 368 | ||
365 | err_out_disable: | 369 | err_out_disable: |
366 | pci_disable_device(pdev); | 370 | pci_disable_device(pdev); |
367 | kfree(hw_priv); | ||
368 | if (local) | ||
369 | local->hw_priv = NULL; | ||
370 | prism2_free_local_data(dev); | 371 | prism2_free_local_data(dev); |
372 | kfree(hw_priv); | ||
371 | 373 | ||
372 | return -ENODEV; | 374 | return -ENODEV; |
373 | } | 375 | } |
@@ -392,9 +394,8 @@ static void prism2_pci_remove(struct pci_dev *pdev) | |||
392 | free_irq(dev->irq, dev); | 394 | free_irq(dev->irq, dev); |
393 | 395 | ||
394 | mem_start = hw_priv->mem_start; | 396 | mem_start = hw_priv->mem_start; |
395 | kfree(hw_priv); | ||
396 | iface->local->hw_priv = NULL; | ||
397 | prism2_free_local_data(dev); | 397 | prism2_free_local_data(dev); |
398 | kfree(hw_priv); | ||
398 | 399 | ||
399 | iounmap(mem_start); | 400 | iounmap(mem_start); |
400 | 401 | ||
@@ -441,7 +442,7 @@ static int prism2_pci_resume(struct pci_dev *pdev) | |||
441 | MODULE_DEVICE_TABLE(pci, prism2_pci_id_table); | 442 | MODULE_DEVICE_TABLE(pci, prism2_pci_id_table); |
442 | 443 | ||
443 | static struct pci_driver prism2_pci_drv_id = { | 444 | static struct pci_driver prism2_pci_drv_id = { |
444 | .name = "prism2_pci", | 445 | .name = "hostap_pci", |
445 | .id_table = prism2_pci_id_table, | 446 | .id_table = prism2_pci_id_table, |
446 | .probe = prism2_pci_probe, | 447 | .probe = prism2_pci_probe, |
447 | .remove = prism2_pci_remove, | 448 | .remove = prism2_pci_remove, |
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c index 474ef83d813e..78d67b408b2f 100644 --- a/drivers/net/wireless/hostap/hostap_plx.c +++ b/drivers/net/wireless/hostap/hostap_plx.c | |||
@@ -328,8 +328,6 @@ static struct prism2_helper_functions prism2_plx_funcs = | |||
328 | { | 328 | { |
329 | .card_present = NULL, | 329 | .card_present = NULL, |
330 | .cor_sreset = prism2_plx_cor_sreset, | 330 | .cor_sreset = prism2_plx_cor_sreset, |
331 | .dev_open = NULL, | ||
332 | .dev_close = NULL, | ||
333 | .genesis_reset = prism2_plx_genesis_reset, | 331 | .genesis_reset = prism2_plx_genesis_reset, |
334 | .hw_type = HOSTAP_HW_PLX, | 332 | .hw_type = HOSTAP_HW_PLX, |
335 | }; | 333 | }; |
@@ -570,10 +568,8 @@ static int prism2_plx_probe(struct pci_dev *pdev, | |||
570 | return hostap_hw_ready(dev); | 568 | return hostap_hw_ready(dev); |
571 | 569 | ||
572 | fail: | 570 | fail: |
573 | kfree(hw_priv); | ||
574 | if (local) | ||
575 | local->hw_priv = NULL; | ||
576 | prism2_free_local_data(dev); | 571 | prism2_free_local_data(dev); |
572 | kfree(hw_priv); | ||
577 | 573 | ||
578 | if (irq_registered && dev) | 574 | if (irq_registered && dev) |
579 | free_irq(dev->irq, dev); | 575 | free_irq(dev->irq, dev); |
@@ -606,9 +602,8 @@ static void prism2_plx_remove(struct pci_dev *pdev) | |||
606 | if (dev->irq) | 602 | if (dev->irq) |
607 | free_irq(dev->irq, dev); | 603 | free_irq(dev->irq, dev); |
608 | 604 | ||
609 | kfree(iface->local->hw_priv); | ||
610 | iface->local->hw_priv = NULL; | ||
611 | prism2_free_local_data(dev); | 605 | prism2_free_local_data(dev); |
606 | kfree(hw_priv); | ||
612 | pci_disable_device(pdev); | 607 | pci_disable_device(pdev); |
613 | } | 608 | } |
614 | 609 | ||
@@ -616,7 +611,7 @@ static void prism2_plx_remove(struct pci_dev *pdev) | |||
616 | MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); | 611 | MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); |
617 | 612 | ||
618 | static struct pci_driver prism2_plx_drv_id = { | 613 | static struct pci_driver prism2_plx_drv_id = { |
619 | .name = "prism2_plx", | 614 | .name = "hostap_plx", |
620 | .id_table = prism2_plx_id_table, | 615 | .id_table = prism2_plx_id_table, |
621 | .probe = prism2_plx_probe, | 616 | .probe = prism2_plx_probe, |
622 | .remove = prism2_plx_remove, | 617 | .remove = prism2_plx_remove, |
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h index cc061e1560d3..cfd801559492 100644 --- a/drivers/net/wireless/hostap/hostap_wlan.h +++ b/drivers/net/wireless/hostap/hostap_wlan.h | |||
@@ -552,8 +552,6 @@ struct prism2_helper_functions { | |||
552 | * (hostap_{cs,plx,pci}.c */ | 552 | * (hostap_{cs,plx,pci}.c */ |
553 | int (*card_present)(local_info_t *local); | 553 | int (*card_present)(local_info_t *local); |
554 | void (*cor_sreset)(local_info_t *local); | 554 | void (*cor_sreset)(local_info_t *local); |
555 | int (*dev_open)(local_info_t *local); | ||
556 | int (*dev_close)(local_info_t *local); | ||
557 | void (*genesis_reset)(local_info_t *local, int hcr); | 555 | void (*genesis_reset)(local_info_t *local, int hcr); |
558 | 556 | ||
559 | /* the following functions are from hostap_hw.c, but they may have some | 557 | /* the following functions are from hostap_hw.c, but they may have some |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 2414e6493aa5..ad7f8cd76db9 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -800,8 +800,7 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv, | |||
800 | * doesn't seem to have as many firmware restart cycles... | 800 | * doesn't seem to have as many firmware restart cycles... |
801 | * | 801 | * |
802 | * As a test, we're sticking in a 1/100s delay here */ | 802 | * As a test, we're sticking in a 1/100s delay here */ |
803 | set_current_state(TASK_UNINTERRUPTIBLE); | 803 | schedule_timeout_uninterruptible(msecs_to_jiffies(10)); |
804 | schedule_timeout(HZ / 100); | ||
805 | 804 | ||
806 | return 0; | 805 | return 0; |
807 | 806 | ||
@@ -1256,8 +1255,7 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv) | |||
1256 | IPW_DEBUG_FW("Waiting for f/w initialization to complete...\n"); | 1255 | IPW_DEBUG_FW("Waiting for f/w initialization to complete...\n"); |
1257 | i = 5000; | 1256 | i = 5000; |
1258 | do { | 1257 | do { |
1259 | set_current_state(TASK_UNINTERRUPTIBLE); | 1258 | schedule_timeout_uninterruptible(msecs_to_jiffies(40)); |
1260 | schedule_timeout(40 * HZ / 1000); | ||
1261 | /* Todo... wait for sync command ... */ | 1259 | /* Todo... wait for sync command ... */ |
1262 | 1260 | ||
1263 | read_register(priv->net_dev, IPW_REG_INTA, &inta); | 1261 | read_register(priv->net_dev, IPW_REG_INTA, &inta); |
@@ -1411,8 +1409,7 @@ static int ipw2100_hw_phy_off(struct ipw2100_priv *priv) | |||
1411 | (val2 & IPW2100_COMMAND_PHY_OFF)) | 1409 | (val2 & IPW2100_COMMAND_PHY_OFF)) |
1412 | return 0; | 1410 | return 0; |
1413 | 1411 | ||
1414 | set_current_state(TASK_UNINTERRUPTIBLE); | 1412 | schedule_timeout_uninterruptible(HW_PHY_OFF_LOOP_DELAY); |
1415 | schedule_timeout(HW_PHY_OFF_LOOP_DELAY); | ||
1416 | } | 1413 | } |
1417 | 1414 | ||
1418 | return -EIO; | 1415 | return -EIO; |
@@ -1466,7 +1463,7 @@ fail_up: | |||
1466 | 1463 | ||
1467 | static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) | 1464 | static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) |
1468 | { | 1465 | { |
1469 | #define HW_POWER_DOWN_DELAY (HZ / 10) | 1466 | #define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) |
1470 | 1467 | ||
1471 | struct host_command cmd = { | 1468 | struct host_command cmd = { |
1472 | .host_command = HOST_PRE_POWER_DOWN, | 1469 | .host_command = HOST_PRE_POWER_DOWN, |
@@ -1520,10 +1517,8 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) | |||
1520 | printk(KERN_WARNING DRV_NAME ": " | 1517 | printk(KERN_WARNING DRV_NAME ": " |
1521 | "%s: Power down command failed: Error %d\n", | 1518 | "%s: Power down command failed: Error %d\n", |
1522 | priv->net_dev->name, err); | 1519 | priv->net_dev->name, err); |
1523 | else { | 1520 | else |
1524 | set_current_state(TASK_UNINTERRUPTIBLE); | 1521 | schedule_timeout_uninterruptible(HW_POWER_DOWN_DELAY); |
1525 | schedule_timeout(HW_POWER_DOWN_DELAY); | ||
1526 | } | ||
1527 | } | 1522 | } |
1528 | 1523 | ||
1529 | priv->status &= ~STATUS_ENABLED; | 1524 | priv->status &= ~STATUS_ENABLED; |
@@ -2953,7 +2948,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
2953 | int next = txq->next; | 2948 | int next = txq->next; |
2954 | int i = 0; | 2949 | int i = 0; |
2955 | struct ipw2100_data_header *ipw_hdr; | 2950 | struct ipw2100_data_header *ipw_hdr; |
2956 | struct ieee80211_hdr *hdr; | 2951 | struct ieee80211_hdr_3addr *hdr; |
2957 | 2952 | ||
2958 | while (!list_empty(&priv->tx_pend_list)) { | 2953 | while (!list_empty(&priv->tx_pend_list)) { |
2959 | /* if there isn't enough space in TBD queue, then | 2954 | /* if there isn't enough space in TBD queue, then |
@@ -2989,7 +2984,7 @@ static void ipw2100_tx_send_data(struct ipw2100_priv *priv) | |||
2989 | packet->index = txq->next; | 2984 | packet->index = txq->next; |
2990 | 2985 | ||
2991 | ipw_hdr = packet->info.d_struct.data; | 2986 | ipw_hdr = packet->info.d_struct.data; |
2992 | hdr = (struct ieee80211_hdr *)packet->info.d_struct.txb-> | 2987 | hdr = (struct ieee80211_hdr_3addr *)packet->info.d_struct.txb-> |
2993 | fragments[0]->data; | 2988 | fragments[0]->data; |
2994 | 2989 | ||
2995 | if (priv->ieee->iw_mode == IW_MODE_INFRA) { | 2990 | if (priv->ieee->iw_mode == IW_MODE_INFRA) { |
@@ -3274,7 +3269,8 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data, | |||
3274 | return IRQ_NONE; | 3269 | return IRQ_NONE; |
3275 | } | 3270 | } |
3276 | 3271 | ||
3277 | static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev) | 3272 | static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev, |
3273 | int pri) | ||
3278 | { | 3274 | { |
3279 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 3275 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
3280 | struct list_head *element; | 3276 | struct list_head *element; |
diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index 2a3cdbd50168..c9e99ce15d66 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h | |||
@@ -808,7 +808,7 @@ struct ipw2100_priv { | |||
808 | struct ipw2100_rx { | 808 | struct ipw2100_rx { |
809 | union { | 809 | union { |
810 | unsigned char payload[IPW_RX_NIC_BUFFER_LENGTH]; | 810 | unsigned char payload[IPW_RX_NIC_BUFFER_LENGTH]; |
811 | struct ieee80211_hdr header; | 811 | struct ieee80211_hdr_4addr header; |
812 | u32 status; | 812 | u32 status; |
813 | struct ipw2100_notification notification; | 813 | struct ipw2100_notification notification; |
814 | struct ipw2100_cmd_header command; | 814 | struct ipw2100_cmd_header command; |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index b7f275c00de3..de4e6c23e4b8 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -4904,7 +4904,7 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4904 | { | 4904 | { |
4905 | struct ipw_rx_mem_buffer *rxb; | 4905 | struct ipw_rx_mem_buffer *rxb; |
4906 | struct ipw_rx_packet *pkt; | 4906 | struct ipw_rx_packet *pkt; |
4907 | struct ieee80211_hdr *header; | 4907 | struct ieee80211_hdr_4addr *header; |
4908 | u32 r, w, i; | 4908 | u32 r, w, i; |
4909 | u8 network_packet; | 4909 | u8 network_packet; |
4910 | 4910 | ||
@@ -4967,8 +4967,9 @@ static void ipw_rx(struct ipw_priv *priv) | |||
4967 | #endif | 4967 | #endif |
4968 | 4968 | ||
4969 | header = | 4969 | header = |
4970 | (struct ieee80211_hdr *)(rxb->skb->data + | 4970 | (struct ieee80211_hdr_4addr *)(rxb->skb-> |
4971 | IPW_RX_FRAME_SIZE); | 4971 | data + |
4972 | IPW_RX_FRAME_SIZE); | ||
4972 | /* TODO: Check Ad-Hoc dest/source and make sure | 4973 | /* TODO: Check Ad-Hoc dest/source and make sure |
4973 | * that we are actually parsing these packets | 4974 | * that we are actually parsing these packets |
4974 | * correctly -- we should probably use the | 4975 | * correctly -- we should probably use the |
@@ -5317,8 +5318,6 @@ static int ipw_wx_set_freq(struct net_device *dev, | |||
5317 | 5318 | ||
5318 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); | 5319 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); |
5319 | return ipw_set_channel(priv, (u8) fwrq->m); | 5320 | return ipw_set_channel(priv, (u8) fwrq->m); |
5320 | |||
5321 | return 0; | ||
5322 | } | 5321 | } |
5323 | 5322 | ||
5324 | static int ipw_wx_get_freq(struct net_device *dev, | 5323 | static int ipw_wx_get_freq(struct net_device *dev, |
@@ -6010,12 +6009,12 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
6010 | } | 6009 | } |
6011 | 6010 | ||
6012 | if (priv->adapter == IPW_2915ABG) { | 6011 | if (priv->adapter == IPW_2915ABG) { |
6013 | priv->ieee->abg_ture = 1; | 6012 | priv->ieee->abg_true = 1; |
6014 | if (mode & IEEE_A) { | 6013 | if (mode & IEEE_A) { |
6015 | band |= IEEE80211_52GHZ_BAND; | 6014 | band |= IEEE80211_52GHZ_BAND; |
6016 | modulation |= IEEE80211_OFDM_MODULATION; | 6015 | modulation |= IEEE80211_OFDM_MODULATION; |
6017 | } else | 6016 | } else |
6018 | priv->ieee->abg_ture = 0; | 6017 | priv->ieee->abg_true = 0; |
6019 | } else { | 6018 | } else { |
6020 | if (mode & IEEE_A) { | 6019 | if (mode & IEEE_A) { |
6021 | IPW_WARNING("Attempt to set 2200BG into " | 6020 | IPW_WARNING("Attempt to set 2200BG into " |
@@ -6023,20 +6022,20 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
6023 | return -EINVAL; | 6022 | return -EINVAL; |
6024 | } | 6023 | } |
6025 | 6024 | ||
6026 | priv->ieee->abg_ture = 0; | 6025 | priv->ieee->abg_true = 0; |
6027 | } | 6026 | } |
6028 | 6027 | ||
6029 | if (mode & IEEE_B) { | 6028 | if (mode & IEEE_B) { |
6030 | band |= IEEE80211_24GHZ_BAND; | 6029 | band |= IEEE80211_24GHZ_BAND; |
6031 | modulation |= IEEE80211_CCK_MODULATION; | 6030 | modulation |= IEEE80211_CCK_MODULATION; |
6032 | } else | 6031 | } else |
6033 | priv->ieee->abg_ture = 0; | 6032 | priv->ieee->abg_true = 0; |
6034 | 6033 | ||
6035 | if (mode & IEEE_G) { | 6034 | if (mode & IEEE_G) { |
6036 | band |= IEEE80211_24GHZ_BAND; | 6035 | band |= IEEE80211_24GHZ_BAND; |
6037 | modulation |= IEEE80211_OFDM_MODULATION; | 6036 | modulation |= IEEE80211_OFDM_MODULATION; |
6038 | } else | 6037 | } else |
6039 | priv->ieee->abg_ture = 0; | 6038 | priv->ieee->abg_true = 0; |
6040 | 6039 | ||
6041 | priv->ieee->mode = mode; | 6040 | priv->ieee->mode = mode; |
6042 | priv->ieee->freq_band = band; | 6041 | priv->ieee->freq_band = band; |
@@ -6325,7 +6324,7 @@ we need to heavily modify the ieee80211_skb_to_txb. | |||
6325 | 6324 | ||
6326 | static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | 6325 | static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) |
6327 | { | 6326 | { |
6328 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) | 6327 | struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *) |
6329 | txb->fragments[0]->data; | 6328 | txb->fragments[0]->data; |
6330 | int i = 0; | 6329 | int i = 0; |
6331 | struct tfd_frame *tfd; | 6330 | struct tfd_frame *tfd; |
@@ -6448,7 +6447,7 @@ static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb) | |||
6448 | } | 6447 | } |
6449 | 6448 | ||
6450 | static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, | 6449 | static int ipw_net_hard_start_xmit(struct ieee80211_txb *txb, |
6451 | struct net_device *dev) | 6450 | struct net_device *dev, int pri) |
6452 | { | 6451 | { |
6453 | struct ipw_priv *priv = ieee80211_priv(dev); | 6452 | struct ipw_priv *priv = ieee80211_priv(dev); |
6454 | unsigned long flags; | 6453 | unsigned long flags; |
@@ -7108,7 +7107,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7108 | printk(KERN_INFO DRV_NAME | 7107 | printk(KERN_INFO DRV_NAME |
7109 | ": Detected Intel PRO/Wireless 2915ABG Network " | 7108 | ": Detected Intel PRO/Wireless 2915ABG Network " |
7110 | "Connection\n"); | 7109 | "Connection\n"); |
7111 | priv->ieee->abg_ture = 1; | 7110 | priv->ieee->abg_true = 1; |
7112 | band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; | 7111 | band = IEEE80211_52GHZ_BAND | IEEE80211_24GHZ_BAND; |
7113 | modulation = IEEE80211_OFDM_MODULATION | | 7112 | modulation = IEEE80211_OFDM_MODULATION | |
7114 | IEEE80211_CCK_MODULATION; | 7113 | IEEE80211_CCK_MODULATION; |
@@ -7124,7 +7123,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7124 | ": Detected Intel PRO/Wireless 2200BG Network " | 7123 | ": Detected Intel PRO/Wireless 2200BG Network " |
7125 | "Connection\n"); | 7124 | "Connection\n"); |
7126 | 7125 | ||
7127 | priv->ieee->abg_ture = 0; | 7126 | priv->ieee->abg_true = 0; |
7128 | band = IEEE80211_24GHZ_BAND; | 7127 | band = IEEE80211_24GHZ_BAND; |
7129 | modulation = IEEE80211_OFDM_MODULATION | | 7128 | modulation = IEEE80211_OFDM_MODULATION | |
7130 | IEEE80211_CCK_MODULATION; | 7129 | IEEE80211_CCK_MODULATION; |
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index 5b00882133f9..e9cf32bf3e31 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h | |||
@@ -1654,12 +1654,12 @@ static const long ipw_frequencies[] = { | |||
1654 | 1654 | ||
1655 | #define IPW_MAX_CONFIG_RETRIES 10 | 1655 | #define IPW_MAX_CONFIG_RETRIES 10 |
1656 | 1656 | ||
1657 | static inline u32 frame_hdr_len(struct ieee80211_hdr *hdr) | 1657 | static inline u32 frame_hdr_len(struct ieee80211_hdr_4addr *hdr) |
1658 | { | 1658 | { |
1659 | u32 retval; | 1659 | u32 retval; |
1660 | u16 fc; | 1660 | u16 fc; |
1661 | 1661 | ||
1662 | retval = sizeof(struct ieee80211_hdr); | 1662 | retval = sizeof(struct ieee80211_hdr_3addr); |
1663 | fc = le16_to_cpu(hdr->frame_ctl); | 1663 | fc = le16_to_cpu(hdr->frame_ctl); |
1664 | 1664 | ||
1665 | /* | 1665 | /* |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index ca6c03c89926..92793b958e32 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -57,9 +57,7 @@ | |||
57 | #include <linux/bitops.h> | 57 | #include <linux/bitops.h> |
58 | #ifdef CONFIG_NET_RADIO | 58 | #ifdef CONFIG_NET_RADIO |
59 | #include <linux/wireless.h> | 59 | #include <linux/wireless.h> |
60 | #if WIRELESS_EXT > 12 | ||
61 | #include <net/iw_handler.h> | 60 | #include <net/iw_handler.h> |
62 | #endif /* WIRELESS_EXT > 12 */ | ||
63 | #endif | 61 | #endif |
64 | 62 | ||
65 | #include <pcmcia/cs_types.h> | 63 | #include <pcmcia/cs_types.h> |
@@ -225,10 +223,7 @@ static void update_stats(struct net_device *dev); | |||
225 | static struct net_device_stats *netwave_get_stats(struct net_device *dev); | 223 | static struct net_device_stats *netwave_get_stats(struct net_device *dev); |
226 | 224 | ||
227 | /* Wireless extensions */ | 225 | /* Wireless extensions */ |
228 | #ifdef WIRELESS_EXT | ||
229 | static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev); | 226 | static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev); |
230 | #endif | ||
231 | static int netwave_ioctl(struct net_device *, struct ifreq *, int); | ||
232 | 227 | ||
233 | static void set_multicast_list(struct net_device *dev); | 228 | static void set_multicast_list(struct net_device *dev); |
234 | 229 | ||
@@ -260,26 +255,7 @@ static dev_link_t *dev_list; | |||
260 | because they generally can't be allocated dynamically. | 255 | because they generally can't be allocated dynamically. |
261 | */ | 256 | */ |
262 | 257 | ||
263 | #if WIRELESS_EXT <= 12 | ||
264 | /* Wireless extensions backward compatibility */ | ||
265 | |||
266 | /* Part of iw_handler prototype we need */ | ||
267 | struct iw_request_info | ||
268 | { | ||
269 | __u16 cmd; /* Wireless Extension command */ | ||
270 | __u16 flags; /* More to come ;-) */ | ||
271 | }; | ||
272 | |||
273 | /* Wireless Extension Backward compatibility - Jean II | ||
274 | * If the new wireless device private ioctl range is not defined, | ||
275 | * default to standard device private ioctl range */ | ||
276 | #ifndef SIOCIWFIRSTPRIV | ||
277 | #define SIOCIWFIRSTPRIV SIOCDEVPRIVATE | ||
278 | #endif /* SIOCIWFIRSTPRIV */ | ||
279 | |||
280 | #else /* WIRELESS_EXT <= 12 */ | ||
281 | static const struct iw_handler_def netwave_handler_def; | 258 | static const struct iw_handler_def netwave_handler_def; |
282 | #endif /* WIRELESS_EXT <= 12 */ | ||
283 | 259 | ||
284 | #define SIOCGIPSNAP SIOCIWFIRSTPRIV + 1 /* Site Survey Snapshot */ | 260 | #define SIOCGIPSNAP SIOCIWFIRSTPRIV + 1 /* Site Survey Snapshot */ |
285 | 261 | ||
@@ -319,9 +295,7 @@ typedef struct netwave_private { | |||
319 | struct timer_list watchdog; /* To avoid blocking state */ | 295 | struct timer_list watchdog; /* To avoid blocking state */ |
320 | struct site_survey nss; | 296 | struct site_survey nss; |
321 | struct net_device_stats stats; | 297 | struct net_device_stats stats; |
322 | #ifdef WIRELESS_EXT | ||
323 | struct iw_statistics iw_stats; /* Wireless stats */ | 298 | struct iw_statistics iw_stats; /* Wireless stats */ |
324 | #endif | ||
325 | } netwave_private; | 299 | } netwave_private; |
326 | 300 | ||
327 | #ifdef NETWAVE_STATS | 301 | #ifdef NETWAVE_STATS |
@@ -353,7 +327,6 @@ static inline void wait_WOC(unsigned int iobase) | |||
353 | while ((inb(iobase + NETWAVE_REG_ASR) & 0x8) != 0x8) ; | 327 | while ((inb(iobase + NETWAVE_REG_ASR) & 0x8) != 0x8) ; |
354 | } | 328 | } |
355 | 329 | ||
356 | #ifdef WIRELESS_EXT | ||
357 | static void netwave_snapshot(netwave_private *priv, u_char __iomem *ramBase, | 330 | static void netwave_snapshot(netwave_private *priv, u_char __iomem *ramBase, |
358 | kio_addr_t iobase) { | 331 | kio_addr_t iobase) { |
359 | u_short resultBuffer; | 332 | u_short resultBuffer; |
@@ -376,9 +349,7 @@ static void netwave_snapshot(netwave_private *priv, u_char __iomem *ramBase, | |||
376 | sizeof(struct site_survey)); | 349 | sizeof(struct site_survey)); |
377 | } | 350 | } |
378 | } | 351 | } |
379 | #endif | ||
380 | 352 | ||
381 | #ifdef WIRELESS_EXT | ||
382 | /* | 353 | /* |
383 | * Function netwave_get_wireless_stats (dev) | 354 | * Function netwave_get_wireless_stats (dev) |
384 | * | 355 | * |
@@ -411,7 +382,6 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev) | |||
411 | 382 | ||
412 | return &priv->iw_stats; | 383 | return &priv->iw_stats; |
413 | } | 384 | } |
414 | #endif | ||
415 | 385 | ||
416 | /* | 386 | /* |
417 | * Function netwave_attach (void) | 387 | * Function netwave_attach (void) |
@@ -471,13 +441,7 @@ static dev_link_t *netwave_attach(void) | |||
471 | dev->get_stats = &netwave_get_stats; | 441 | dev->get_stats = &netwave_get_stats; |
472 | dev->set_multicast_list = &set_multicast_list; | 442 | dev->set_multicast_list = &set_multicast_list; |
473 | /* wireless extensions */ | 443 | /* wireless extensions */ |
474 | #if WIRELESS_EXT <= 16 | ||
475 | dev->get_wireless_stats = &netwave_get_wireless_stats; | ||
476 | #endif /* WIRELESS_EXT <= 16 */ | ||
477 | #if WIRELESS_EXT > 12 | ||
478 | dev->wireless_handlers = (struct iw_handler_def *)&netwave_handler_def; | 444 | dev->wireless_handlers = (struct iw_handler_def *)&netwave_handler_def; |
479 | #endif /* WIRELESS_EXT > 12 */ | ||
480 | dev->do_ioctl = &netwave_ioctl; | ||
481 | 445 | ||
482 | dev->tx_timeout = &netwave_watchdog; | 446 | dev->tx_timeout = &netwave_watchdog; |
483 | dev->watchdog_timeo = TX_TIMEOUT; | 447 | dev->watchdog_timeo = TX_TIMEOUT; |
@@ -576,13 +540,8 @@ static int netwave_set_nwid(struct net_device *dev, | |||
576 | /* Disable interrupts & save flags */ | 540 | /* Disable interrupts & save flags */ |
577 | spin_lock_irqsave(&priv->spinlock, flags); | 541 | spin_lock_irqsave(&priv->spinlock, flags); |
578 | 542 | ||
579 | #if WIRELESS_EXT > 8 | ||
580 | if(!wrqu->nwid.disabled) { | 543 | if(!wrqu->nwid.disabled) { |
581 | domain = wrqu->nwid.value; | 544 | domain = wrqu->nwid.value; |
582 | #else /* WIRELESS_EXT > 8 */ | ||
583 | if(wrqu->nwid.on) { | ||
584 | domain = wrqu->nwid.nwid; | ||
585 | #endif /* WIRELESS_EXT > 8 */ | ||
586 | printk( KERN_DEBUG "Setting domain to 0x%x%02x\n", | 545 | printk( KERN_DEBUG "Setting domain to 0x%x%02x\n", |
587 | (domain >> 8) & 0x01, domain & 0xff); | 546 | (domain >> 8) & 0x01, domain & 0xff); |
588 | wait_WOC(iobase); | 547 | wait_WOC(iobase); |
@@ -606,15 +565,9 @@ static int netwave_get_nwid(struct net_device *dev, | |||
606 | union iwreq_data *wrqu, | 565 | union iwreq_data *wrqu, |
607 | char *extra) | 566 | char *extra) |
608 | { | 567 | { |
609 | #if WIRELESS_EXT > 8 | ||
610 | wrqu->nwid.value = domain; | 568 | wrqu->nwid.value = domain; |
611 | wrqu->nwid.disabled = 0; | 569 | wrqu->nwid.disabled = 0; |
612 | wrqu->nwid.fixed = 1; | 570 | wrqu->nwid.fixed = 1; |
613 | #else /* WIRELESS_EXT > 8 */ | ||
614 | wrqu->nwid.nwid = domain; | ||
615 | wrqu->nwid.on = 1; | ||
616 | #endif /* WIRELESS_EXT > 8 */ | ||
617 | |||
618 | return 0; | 571 | return 0; |
619 | } | 572 | } |
620 | 573 | ||
@@ -657,17 +610,11 @@ static int netwave_get_scramble(struct net_device *dev, | |||
657 | { | 610 | { |
658 | key[1] = scramble_key & 0xff; | 611 | key[1] = scramble_key & 0xff; |
659 | key[0] = (scramble_key>>8) & 0xff; | 612 | key[0] = (scramble_key>>8) & 0xff; |
660 | #if WIRELESS_EXT > 8 | ||
661 | wrqu->encoding.flags = IW_ENCODE_ENABLED; | 613 | wrqu->encoding.flags = IW_ENCODE_ENABLED; |
662 | wrqu->encoding.length = 2; | 614 | wrqu->encoding.length = 2; |
663 | #else /* WIRELESS_EXT > 8 */ | ||
664 | wrqu->encoding.method = 1; | ||
665 | #endif /* WIRELESS_EXT > 8 */ | ||
666 | |||
667 | return 0; | 615 | return 0; |
668 | } | 616 | } |
669 | 617 | ||
670 | #if WIRELESS_EXT > 8 | ||
671 | /* | 618 | /* |
672 | * Wireless Handler : get mode | 619 | * Wireless Handler : get mode |
673 | */ | 620 | */ |
@@ -683,7 +630,6 @@ static int netwave_get_mode(struct net_device *dev, | |||
683 | 630 | ||
684 | return 0; | 631 | return 0; |
685 | } | 632 | } |
686 | #endif /* WIRELESS_EXT > 8 */ | ||
687 | 633 | ||
688 | /* | 634 | /* |
689 | * Wireless Handler : get range info | 635 | * Wireless Handler : get range info |
@@ -702,11 +648,9 @@ static int netwave_get_range(struct net_device *dev, | |||
702 | /* Set all the info we don't care or don't know about to zero */ | 648 | /* Set all the info we don't care or don't know about to zero */ |
703 | memset(range, 0, sizeof(struct iw_range)); | 649 | memset(range, 0, sizeof(struct iw_range)); |
704 | 650 | ||
705 | #if WIRELESS_EXT > 10 | ||
706 | /* Set the Wireless Extension versions */ | 651 | /* Set the Wireless Extension versions */ |
707 | range->we_version_compiled = WIRELESS_EXT; | 652 | range->we_version_compiled = WIRELESS_EXT; |
708 | range->we_version_source = 9; /* Nothing for us in v10 and v11 */ | 653 | range->we_version_source = 9; /* Nothing for us in v10 and v11 */ |
709 | #endif /* WIRELESS_EXT > 10 */ | ||
710 | 654 | ||
711 | /* Set information in the range struct */ | 655 | /* Set information in the range struct */ |
712 | range->throughput = 450 * 1000; /* don't argue on this ! */ | 656 | range->throughput = 450 * 1000; /* don't argue on this ! */ |
@@ -720,16 +664,12 @@ static int netwave_get_range(struct net_device *dev, | |||
720 | range->max_qual.level = 255; | 664 | range->max_qual.level = 255; |
721 | range->max_qual.noise = 0; | 665 | range->max_qual.noise = 0; |
722 | 666 | ||
723 | #if WIRELESS_EXT > 7 | ||
724 | range->num_bitrates = 1; | 667 | range->num_bitrates = 1; |
725 | range->bitrate[0] = 1000000; /* 1 Mb/s */ | 668 | range->bitrate[0] = 1000000; /* 1 Mb/s */ |
726 | #endif /* WIRELESS_EXT > 7 */ | ||
727 | 669 | ||
728 | #if WIRELESS_EXT > 8 | ||
729 | range->encoding_size[0] = 2; /* 16 bits scrambling */ | 670 | range->encoding_size[0] = 2; /* 16 bits scrambling */ |
730 | range->num_encoding_sizes = 1; | 671 | range->num_encoding_sizes = 1; |
731 | range->max_encoding_tokens = 1; /* Only one key possible */ | 672 | range->max_encoding_tokens = 1; /* Only one key possible */ |
732 | #endif /* WIRELESS_EXT > 8 */ | ||
733 | 673 | ||
734 | return ret; | 674 | return ret; |
735 | } | 675 | } |
@@ -775,8 +715,6 @@ static const struct iw_priv_args netwave_private_args[] = { | |||
775 | "getsitesurvey" }, | 715 | "getsitesurvey" }, |
776 | }; | 716 | }; |
777 | 717 | ||
778 | #if WIRELESS_EXT > 12 | ||
779 | |||
780 | static const iw_handler netwave_handler[] = | 718 | static const iw_handler netwave_handler[] = |
781 | { | 719 | { |
782 | NULL, /* SIOCSIWNAME */ | 720 | NULL, /* SIOCSIWNAME */ |
@@ -839,131 +777,8 @@ static const struct iw_handler_def netwave_handler_def = | |||
839 | .standard = (iw_handler *) netwave_handler, | 777 | .standard = (iw_handler *) netwave_handler, |
840 | .private = (iw_handler *) netwave_private_handler, | 778 | .private = (iw_handler *) netwave_private_handler, |
841 | .private_args = (struct iw_priv_args *) netwave_private_args, | 779 | .private_args = (struct iw_priv_args *) netwave_private_args, |
842 | #if WIRELESS_EXT > 16 | ||
843 | .get_wireless_stats = netwave_get_wireless_stats, | 780 | .get_wireless_stats = netwave_get_wireless_stats, |
844 | #endif /* WIRELESS_EXT > 16 */ | ||
845 | }; | 781 | }; |
846 | #endif /* WIRELESS_EXT > 12 */ | ||
847 | |||
848 | /* | ||
849 | * Function netwave_ioctl (dev, rq, cmd) | ||
850 | * | ||
851 | * Perform ioctl : config & info stuff | ||
852 | * This is the stuff that are treated the wireless extensions (iwconfig) | ||
853 | * | ||
854 | */ | ||
855 | static int netwave_ioctl(struct net_device *dev, /* ioctl device */ | ||
856 | struct ifreq *rq, /* Data passed */ | ||
857 | int cmd) /* Ioctl number */ | ||
858 | { | ||
859 | int ret = 0; | ||
860 | #ifdef WIRELESS_EXT | ||
861 | #if WIRELESS_EXT <= 12 | ||
862 | struct iwreq *wrq = (struct iwreq *) rq; | ||
863 | #endif | ||
864 | #endif | ||
865 | |||
866 | DEBUG(0, "%s: ->netwave_ioctl(cmd=0x%X)\n", dev->name, cmd); | ||
867 | |||
868 | /* Look what is the request */ | ||
869 | switch(cmd) { | ||
870 | /* --------------- WIRELESS EXTENSIONS --------------- */ | ||
871 | #ifdef WIRELESS_EXT | ||
872 | #if WIRELESS_EXT <= 12 | ||
873 | case SIOCGIWNAME: | ||
874 | netwave_get_name(dev, NULL, &(wrq->u), NULL); | ||
875 | break; | ||
876 | case SIOCSIWNWID: | ||
877 | ret = netwave_set_nwid(dev, NULL, &(wrq->u), NULL); | ||
878 | break; | ||
879 | case SIOCGIWNWID: | ||
880 | ret = netwave_get_nwid(dev, NULL, &(wrq->u), NULL); | ||
881 | break; | ||
882 | #if WIRELESS_EXT > 8 /* Note : The API did change... */ | ||
883 | case SIOCGIWENCODE: | ||
884 | /* Get scramble key */ | ||
885 | if(wrq->u.encoding.pointer != (caddr_t) 0) | ||
886 | { | ||
887 | char key[2]; | ||
888 | ret = netwave_get_scramble(dev, NULL, &(wrq->u), key); | ||
889 | if(copy_to_user(wrq->u.encoding.pointer, key, 2)) | ||
890 | ret = -EFAULT; | ||
891 | } | ||
892 | break; | ||
893 | case SIOCSIWENCODE: | ||
894 | /* Set scramble key */ | ||
895 | if(wrq->u.encoding.pointer != (caddr_t) 0) | ||
896 | { | ||
897 | char key[2]; | ||
898 | if(copy_from_user(key, wrq->u.encoding.pointer, 2)) | ||
899 | { | ||
900 | ret = -EFAULT; | ||
901 | break; | ||
902 | } | ||
903 | ret = netwave_set_scramble(dev, NULL, &(wrq->u), key); | ||
904 | } | ||
905 | break; | ||
906 | case SIOCGIWMODE: | ||
907 | /* Mode of operation */ | ||
908 | ret = netwave_get_mode(dev, NULL, &(wrq->u), NULL); | ||
909 | break; | ||
910 | #else /* WIRELESS_EXT > 8 */ | ||
911 | case SIOCGIWENCODE: | ||
912 | /* Get scramble key */ | ||
913 | ret = netwave_get_scramble(dev, NULL, &(wrq->u), | ||
914 | (char *) &wrq->u.encoding.code); | ||
915 | break; | ||
916 | case SIOCSIWENCODE: | ||
917 | /* Set scramble key */ | ||
918 | ret = netwave_set_scramble(dev, NULL, &(wrq->u), | ||
919 | (char *) &wrq->u.encoding.code); | ||
920 | break; | ||
921 | #endif /* WIRELESS_EXT > 8 */ | ||
922 | case SIOCGIWRANGE: | ||
923 | /* Basic checking... */ | ||
924 | if(wrq->u.data.pointer != (caddr_t) 0) { | ||
925 | struct iw_range range; | ||
926 | ret = netwave_get_range(dev, NULL, &(wrq->u), (char *) &range); | ||
927 | if (copy_to_user(wrq->u.data.pointer, &range, | ||
928 | sizeof(struct iw_range))) | ||
929 | ret = -EFAULT; | ||
930 | } | ||
931 | break; | ||
932 | case SIOCGIWPRIV: | ||
933 | /* Basic checking... */ | ||
934 | if(wrq->u.data.pointer != (caddr_t) 0) { | ||
935 | /* Set the number of ioctl available */ | ||
936 | wrq->u.data.length = sizeof(netwave_private_args) / sizeof(netwave_private_args[0]); | ||
937 | |||
938 | /* Copy structure to the user buffer */ | ||
939 | if(copy_to_user(wrq->u.data.pointer, | ||
940 | (u_char *) netwave_private_args, | ||
941 | sizeof(netwave_private_args))) | ||
942 | ret = -EFAULT; | ||
943 | } | ||
944 | break; | ||
945 | case SIOCGIPSNAP: | ||
946 | if(wrq->u.data.pointer != (caddr_t) 0) { | ||
947 | char buffer[sizeof( struct site_survey)]; | ||
948 | ret = netwave_get_snap(dev, NULL, &(wrq->u), buffer); | ||
949 | /* Copy structure to the user buffer */ | ||
950 | if(copy_to_user(wrq->u.data.pointer, | ||
951 | buffer, | ||
952 | sizeof( struct site_survey))) | ||
953 | { | ||
954 | printk(KERN_DEBUG "Bad buffer!\n"); | ||
955 | break; | ||
956 | } | ||
957 | } | ||
958 | break; | ||
959 | #endif /* WIRELESS_EXT <= 12 */ | ||
960 | #endif /* WIRELESS_EXT */ | ||
961 | default: | ||
962 | ret = -EOPNOTSUPP; | ||
963 | } | ||
964 | |||
965 | return ret; | ||
966 | } | ||
967 | 782 | ||
968 | /* | 783 | /* |
969 | * Function netwave_pcmcia_config (link) | 784 | * Function netwave_pcmcia_config (link) |
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index cf3daaa1b369..d3d4ec9e242e 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -77,30 +77,16 @@ | |||
77 | #define DRIVER_NAME "orinoco" | 77 | #define DRIVER_NAME "orinoco" |
78 | 78 | ||
79 | #include <linux/config.h> | 79 | #include <linux/config.h> |
80 | |||
81 | #include <linux/module.h> | 80 | #include <linux/module.h> |
82 | #include <linux/kernel.h> | 81 | #include <linux/kernel.h> |
83 | #include <linux/init.h> | 82 | #include <linux/init.h> |
84 | #include <linux/ptrace.h> | ||
85 | #include <linux/slab.h> | ||
86 | #include <linux/string.h> | ||
87 | #include <linux/timer.h> | ||
88 | #include <linux/ioport.h> | ||
89 | #include <linux/netdevice.h> | 83 | #include <linux/netdevice.h> |
90 | #include <linux/if_arp.h> | ||
91 | #include <linux/etherdevice.h> | 84 | #include <linux/etherdevice.h> |
92 | #include <linux/ethtool.h> | 85 | #include <linux/ethtool.h> |
93 | #include <linux/wireless.h> | 86 | #include <linux/wireless.h> |
94 | #include <net/iw_handler.h> | 87 | #include <net/iw_handler.h> |
95 | #include <net/ieee80211.h> | 88 | #include <net/ieee80211.h> |
96 | 89 | ||
97 | #include <net/ieee80211.h> | ||
98 | |||
99 | #include <asm/uaccess.h> | ||
100 | #include <asm/io.h> | ||
101 | #include <asm/system.h> | ||
102 | |||
103 | #include "hermes.h" | ||
104 | #include "hermes_rid.h" | 90 | #include "hermes_rid.h" |
105 | #include "orinoco.h" | 91 | #include "orinoco.h" |
106 | 92 | ||
@@ -137,7 +123,7 @@ MODULE_PARM_DESC(force_monitor, "Allow monitor mode for all firmware versions"); | |||
137 | 123 | ||
138 | /* We do this this way to avoid ifdefs in the actual code */ | 124 | /* We do this this way to avoid ifdefs in the actual code */ |
139 | #ifdef WIRELESS_SPY | 125 | #ifdef WIRELESS_SPY |
140 | #define SPY_NUMBER(priv) (priv->spy_number) | 126 | #define SPY_NUMBER(priv) (priv->spy_data.spy_number) |
141 | #else | 127 | #else |
142 | #define SPY_NUMBER(priv) 0 | 128 | #define SPY_NUMBER(priv) 0 |
143 | #endif /* WIRELESS_SPY */ | 129 | #endif /* WIRELESS_SPY */ |
@@ -216,31 +202,32 @@ static struct { | |||
216 | /********************************************************************/ | 202 | /********************************************************************/ |
217 | 203 | ||
218 | /* Used in Event handling. | 204 | /* Used in Event handling. |
219 | * We avoid nested structres as they break on ARM -- Moustafa */ | 205 | * We avoid nested structures as they break on ARM -- Moustafa */ |
220 | struct hermes_tx_descriptor_802_11 { | 206 | struct hermes_tx_descriptor_802_11 { |
221 | /* hermes_tx_descriptor */ | 207 | /* hermes_tx_descriptor */ |
222 | u16 status; | 208 | __le16 status; |
223 | u16 reserved1; | 209 | __le16 reserved1; |
224 | u16 reserved2; | 210 | __le16 reserved2; |
225 | u32 sw_support; | 211 | __le32 sw_support; |
226 | u8 retry_count; | 212 | u8 retry_count; |
227 | u8 tx_rate; | 213 | u8 tx_rate; |
228 | u16 tx_control; | 214 | __le16 tx_control; |
229 | 215 | ||
230 | /* ieee802_11_hdr */ | 216 | /* ieee80211_hdr */ |
231 | u16 frame_ctl; | 217 | __le16 frame_ctl; |
232 | u16 duration_id; | 218 | __le16 duration_id; |
233 | u8 addr1[ETH_ALEN]; | 219 | u8 addr1[ETH_ALEN]; |
234 | u8 addr2[ETH_ALEN]; | 220 | u8 addr2[ETH_ALEN]; |
235 | u8 addr3[ETH_ALEN]; | 221 | u8 addr3[ETH_ALEN]; |
236 | u16 seq_ctl; | 222 | __le16 seq_ctl; |
237 | u8 addr4[ETH_ALEN]; | 223 | u8 addr4[ETH_ALEN]; |
238 | u16 data_len; | 224 | |
225 | __le16 data_len; | ||
239 | 226 | ||
240 | /* ethhdr */ | 227 | /* ethhdr */ |
241 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ | 228 | u8 h_dest[ETH_ALEN]; /* destination eth addr */ |
242 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ | 229 | u8 h_source[ETH_ALEN]; /* source ether addr */ |
243 | unsigned short h_proto; /* packet type ID field */ | 230 | __be16 h_proto; /* packet type ID field */ |
244 | 231 | ||
245 | /* p8022_hdr */ | 232 | /* p8022_hdr */ |
246 | u8 dsap; | 233 | u8 dsap; |
@@ -248,31 +235,31 @@ struct hermes_tx_descriptor_802_11 { | |||
248 | u8 ctrl; | 235 | u8 ctrl; |
249 | u8 oui[3]; | 236 | u8 oui[3]; |
250 | 237 | ||
251 | u16 ethertype; | 238 | __be16 ethertype; |
252 | } __attribute__ ((packed)); | 239 | } __attribute__ ((packed)); |
253 | 240 | ||
254 | /* Rx frame header except compatibility 802.3 header */ | 241 | /* Rx frame header except compatibility 802.3 header */ |
255 | struct hermes_rx_descriptor { | 242 | struct hermes_rx_descriptor { |
256 | /* Control */ | 243 | /* Control */ |
257 | u16 status; | 244 | __le16 status; |
258 | u32 time; | 245 | __le32 time; |
259 | u8 silence; | 246 | u8 silence; |
260 | u8 signal; | 247 | u8 signal; |
261 | u8 rate; | 248 | u8 rate; |
262 | u8 rxflow; | 249 | u8 rxflow; |
263 | u32 reserved; | 250 | __le32 reserved; |
264 | 251 | ||
265 | /* 802.11 header */ | 252 | /* 802.11 header */ |
266 | u16 frame_ctl; | 253 | __le16 frame_ctl; |
267 | u16 duration_id; | 254 | __le16 duration_id; |
268 | u8 addr1[ETH_ALEN]; | 255 | u8 addr1[ETH_ALEN]; |
269 | u8 addr2[ETH_ALEN]; | 256 | u8 addr2[ETH_ALEN]; |
270 | u8 addr3[ETH_ALEN]; | 257 | u8 addr3[ETH_ALEN]; |
271 | u16 seq_ctl; | 258 | __le16 seq_ctl; |
272 | u8 addr4[ETH_ALEN]; | 259 | u8 addr4[ETH_ALEN]; |
273 | 260 | ||
274 | /* Data length */ | 261 | /* Data length */ |
275 | u16 data_len; | 262 | __le16 data_len; |
276 | } __attribute__ ((packed)); | 263 | } __attribute__ ((packed)); |
277 | 264 | ||
278 | /********************************************************************/ | 265 | /********************************************************************/ |
@@ -396,14 +383,14 @@ static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev) | |||
396 | /* If a spy address is defined, we report stats of the | 383 | /* If a spy address is defined, we report stats of the |
397 | * first spy address - Jean II */ | 384 | * first spy address - Jean II */ |
398 | if (SPY_NUMBER(priv)) { | 385 | if (SPY_NUMBER(priv)) { |
399 | wstats->qual.qual = priv->spy_stat[0].qual; | 386 | wstats->qual.qual = priv->spy_data.spy_stat[0].qual; |
400 | wstats->qual.level = priv->spy_stat[0].level; | 387 | wstats->qual.level = priv->spy_data.spy_stat[0].level; |
401 | wstats->qual.noise = priv->spy_stat[0].noise; | 388 | wstats->qual.noise = priv->spy_data.spy_stat[0].noise; |
402 | wstats->qual.updated = priv->spy_stat[0].updated; | 389 | wstats->qual.updated = priv->spy_data.spy_stat[0].updated; |
403 | } | 390 | } |
404 | } else { | 391 | } else { |
405 | struct { | 392 | struct { |
406 | u16 qual, signal, noise; | 393 | __le16 qual, signal, noise; |
407 | } __attribute__ ((packed)) cq; | 394 | } __attribute__ ((packed)) cq; |
408 | 395 | ||
409 | err = HERMES_READ_RECORD(hw, USER_BAP, | 396 | err = HERMES_READ_RECORD(hw, USER_BAP, |
@@ -505,11 +492,9 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
505 | 492 | ||
506 | /* Check packet length, pad short packets, round up odd length */ | 493 | /* Check packet length, pad short packets, round up odd length */ |
507 | len = max_t(int, ALIGN(skb->len, 2), ETH_ZLEN); | 494 | len = max_t(int, ALIGN(skb->len, 2), ETH_ZLEN); |
508 | if (skb->len < len) { | 495 | skb = skb_padto(skb, len); |
509 | skb = skb_padto(skb, len); | 496 | if (skb == NULL) |
510 | if (skb == NULL) | 497 | goto fail; |
511 | goto fail; | ||
512 | } | ||
513 | len -= ETH_HLEN; | 498 | len -= ETH_HLEN; |
514 | 499 | ||
515 | eh = (struct ethhdr *)skb->data; | 500 | eh = (struct ethhdr *)skb->data; |
@@ -578,8 +563,9 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
578 | txfid, NULL); | 563 | txfid, NULL); |
579 | if (err) { | 564 | if (err) { |
580 | netif_start_queue(dev); | 565 | netif_start_queue(dev); |
581 | printk(KERN_ERR "%s: Error %d transmitting packet\n", | 566 | if (net_ratelimit()) |
582 | dev->name, err); | 567 | printk(KERN_ERR "%s: Error %d transmitting packet\n", |
568 | dev->name, err); | ||
583 | stats->tx_errors++; | 569 | stats->tx_errors++; |
584 | goto fail; | 570 | goto fail; |
585 | } | 571 | } |
@@ -633,16 +619,17 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw) | |||
633 | struct orinoco_private *priv = netdev_priv(dev); | 619 | struct orinoco_private *priv = netdev_priv(dev); |
634 | struct net_device_stats *stats = &priv->stats; | 620 | struct net_device_stats *stats = &priv->stats; |
635 | u16 fid = hermes_read_regn(hw, TXCOMPLFID); | 621 | u16 fid = hermes_read_regn(hw, TXCOMPLFID); |
622 | u16 status; | ||
636 | struct hermes_tx_descriptor_802_11 hdr; | 623 | struct hermes_tx_descriptor_802_11 hdr; |
637 | int err = 0; | 624 | int err = 0; |
638 | 625 | ||
639 | if (fid == DUMMY_FID) | 626 | if (fid == DUMMY_FID) |
640 | return; /* Nothing's really happened */ | 627 | return; /* Nothing's really happened */ |
641 | 628 | ||
642 | /* Read the frame header */ | 629 | /* Read part of the frame header - we need status and addr1 */ |
643 | err = hermes_bap_pread(hw, IRQ_BAP, &hdr, | 630 | err = hermes_bap_pread(hw, IRQ_BAP, &hdr, |
644 | sizeof(struct hermes_tx_descriptor) + | 631 | offsetof(struct hermes_tx_descriptor_802_11, |
645 | sizeof(struct ieee80211_hdr), | 632 | addr2), |
646 | fid, 0); | 633 | fid, 0); |
647 | 634 | ||
648 | hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); | 635 | hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); |
@@ -662,8 +649,8 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw) | |||
662 | * exceeded, because that's the only status that really mean | 649 | * exceeded, because that's the only status that really mean |
663 | * that this particular node went away. | 650 | * that this particular node went away. |
664 | * Other errors means that *we* screwed up. - Jean II */ | 651 | * Other errors means that *we* screwed up. - Jean II */ |
665 | hdr.status = le16_to_cpu(hdr.status); | 652 | status = le16_to_cpu(hdr.status); |
666 | if (hdr.status & (HERMES_TXSTAT_RETRYERR | HERMES_TXSTAT_AGEDERR)) { | 653 | if (status & (HERMES_TXSTAT_RETRYERR | HERMES_TXSTAT_AGEDERR)) { |
667 | union iwreq_data wrqu; | 654 | union iwreq_data wrqu; |
668 | 655 | ||
669 | /* Copy 802.11 dest address. | 656 | /* Copy 802.11 dest address. |
@@ -722,18 +709,13 @@ static inline int is_ethersnap(void *_hdr) | |||
722 | static inline void orinoco_spy_gather(struct net_device *dev, u_char *mac, | 709 | static inline void orinoco_spy_gather(struct net_device *dev, u_char *mac, |
723 | int level, int noise) | 710 | int level, int noise) |
724 | { | 711 | { |
725 | struct orinoco_private *priv = netdev_priv(dev); | 712 | struct iw_quality wstats; |
726 | int i; | 713 | wstats.level = level - 0x95; |
727 | 714 | wstats.noise = noise - 0x95; | |
728 | /* Gather wireless spy statistics: for each packet, compare the | 715 | wstats.qual = (level > noise) ? (level - noise) : 0; |
729 | * source address with out list, and if match, get the stats... */ | 716 | wstats.updated = 7; |
730 | for (i = 0; i < priv->spy_number; i++) | 717 | /* Update spy records */ |
731 | if (!memcmp(mac, priv->spy_address[i], ETH_ALEN)) { | 718 | wireless_spy_update(dev, mac, &wstats); |
732 | priv->spy_stat[i].level = level - 0x95; | ||
733 | priv->spy_stat[i].noise = noise - 0x95; | ||
734 | priv->spy_stat[i].qual = (level > noise) ? (level - noise) : 0; | ||
735 | priv->spy_stat[i].updated = 7; | ||
736 | } | ||
737 | } | 719 | } |
738 | 720 | ||
739 | static void orinoco_stat_gather(struct net_device *dev, | 721 | static void orinoco_stat_gather(struct net_device *dev, |
@@ -1054,7 +1036,7 @@ static void orinoco_join_ap(struct net_device *dev) | |||
1054 | unsigned long flags; | 1036 | unsigned long flags; |
1055 | struct join_req { | 1037 | struct join_req { |
1056 | u8 bssid[ETH_ALEN]; | 1038 | u8 bssid[ETH_ALEN]; |
1057 | u16 channel; | 1039 | __le16 channel; |
1058 | } __attribute__ ((packed)) req; | 1040 | } __attribute__ ((packed)) req; |
1059 | const int atom_len = offsetof(struct prism2_scan_apinfo, atim); | 1041 | const int atom_len = offsetof(struct prism2_scan_apinfo, atim); |
1060 | struct prism2_scan_apinfo *atom = NULL; | 1042 | struct prism2_scan_apinfo *atom = NULL; |
@@ -1069,7 +1051,7 @@ static void orinoco_join_ap(struct net_device *dev) | |||
1069 | return; | 1051 | return; |
1070 | 1052 | ||
1071 | if (orinoco_lock(priv, &flags) != 0) | 1053 | if (orinoco_lock(priv, &flags) != 0) |
1072 | goto out; | 1054 | goto fail_lock; |
1073 | 1055 | ||
1074 | /* Sanity checks in case user changed something in the meantime */ | 1056 | /* Sanity checks in case user changed something in the meantime */ |
1075 | if (! priv->bssid_fixed) | 1057 | if (! priv->bssid_fixed) |
@@ -1114,8 +1096,10 @@ static void orinoco_join_ap(struct net_device *dev) | |||
1114 | printk(KERN_ERR "%s: Error issuing join request\n", dev->name); | 1096 | printk(KERN_ERR "%s: Error issuing join request\n", dev->name); |
1115 | 1097 | ||
1116 | out: | 1098 | out: |
1117 | kfree(buf); | ||
1118 | orinoco_unlock(priv, &flags); | 1099 | orinoco_unlock(priv, &flags); |
1100 | |||
1101 | fail_lock: | ||
1102 | kfree(buf); | ||
1119 | } | 1103 | } |
1120 | 1104 | ||
1121 | /* Send new BSSID to userspace */ | 1105 | /* Send new BSSID to userspace */ |
@@ -1133,12 +1117,14 @@ static void orinoco_send_wevents(struct net_device *dev) | |||
1133 | err = hermes_read_ltv(hw, IRQ_BAP, HERMES_RID_CURRENTBSSID, | 1117 | err = hermes_read_ltv(hw, IRQ_BAP, HERMES_RID_CURRENTBSSID, |
1134 | ETH_ALEN, NULL, wrqu.ap_addr.sa_data); | 1118 | ETH_ALEN, NULL, wrqu.ap_addr.sa_data); |
1135 | if (err != 0) | 1119 | if (err != 0) |
1136 | return; | 1120 | goto out; |
1137 | 1121 | ||
1138 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 1122 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
1139 | 1123 | ||
1140 | /* Send event to user space */ | 1124 | /* Send event to user space */ |
1141 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); | 1125 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); |
1126 | |||
1127 | out: | ||
1142 | orinoco_unlock(priv, &flags); | 1128 | orinoco_unlock(priv, &flags); |
1143 | } | 1129 | } |
1144 | 1130 | ||
@@ -1147,8 +1133,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1147 | struct orinoco_private *priv = netdev_priv(dev); | 1133 | struct orinoco_private *priv = netdev_priv(dev); |
1148 | u16 infofid; | 1134 | u16 infofid; |
1149 | struct { | 1135 | struct { |
1150 | u16 len; | 1136 | __le16 len; |
1151 | u16 type; | 1137 | __le16 type; |
1152 | } __attribute__ ((packed)) info; | 1138 | } __attribute__ ((packed)) info; |
1153 | int len, type; | 1139 | int len, type; |
1154 | int err; | 1140 | int err; |
@@ -2463,6 +2449,10 @@ struct net_device *alloc_orinocodev(int sizeof_card, | |||
2463 | dev->get_stats = orinoco_get_stats; | 2449 | dev->get_stats = orinoco_get_stats; |
2464 | dev->ethtool_ops = &orinoco_ethtool_ops; | 2450 | dev->ethtool_ops = &orinoco_ethtool_ops; |
2465 | dev->wireless_handlers = (struct iw_handler_def *)&orinoco_handler_def; | 2451 | dev->wireless_handlers = (struct iw_handler_def *)&orinoco_handler_def; |
2452 | #ifdef WIRELESS_SPY | ||
2453 | priv->wireless_data.spy_data = &priv->spy_data; | ||
2454 | dev->wireless_data = &priv->wireless_data; | ||
2455 | #endif | ||
2466 | dev->change_mtu = orinoco_change_mtu; | 2456 | dev->change_mtu = orinoco_change_mtu; |
2467 | dev->set_multicast_list = orinoco_set_multicast_list; | 2457 | dev->set_multicast_list = orinoco_set_multicast_list; |
2468 | /* we use the default eth_mac_addr for setting the MAC addr */ | 2458 | /* we use the default eth_mac_addr for setting the MAC addr */ |
@@ -2834,7 +2824,7 @@ static int orinoco_ioctl_getiwrange(struct net_device *dev, | |||
2834 | } | 2824 | } |
2835 | } | 2825 | } |
2836 | 2826 | ||
2837 | if ((priv->iw_mode == IW_MODE_ADHOC) && (priv->spy_number == 0)){ | 2827 | if ((priv->iw_mode == IW_MODE_ADHOC) && (!SPY_NUMBER(priv))){ |
2838 | /* Quality stats meaningless in ad-hoc mode */ | 2828 | /* Quality stats meaningless in ad-hoc mode */ |
2839 | } else { | 2829 | } else { |
2840 | range->max_qual.qual = 0x8b - 0x2f; | 2830 | range->max_qual.qual = 0x8b - 0x2f; |
@@ -2881,6 +2871,14 @@ static int orinoco_ioctl_getiwrange(struct net_device *dev, | |||
2881 | range->min_r_time = 0; | 2871 | range->min_r_time = 0; |
2882 | range->max_r_time = 65535 * 1000; /* ??? */ | 2872 | range->max_r_time = 65535 * 1000; /* ??? */ |
2883 | 2873 | ||
2874 | /* Event capability (kernel) */ | ||
2875 | IW_EVENT_CAPA_SET_KERNEL(range->event_capa); | ||
2876 | /* Event capability (driver) */ | ||
2877 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY); | ||
2878 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); | ||
2879 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); | ||
2880 | IW_EVENT_CAPA_SET(range->event_capa, IWEVTXDROP); | ||
2881 | |||
2884 | TRACE_EXIT(dev->name); | 2882 | TRACE_EXIT(dev->name); |
2885 | 2883 | ||
2886 | return 0; | 2884 | return 0; |
@@ -3840,92 +3838,6 @@ static int orinoco_ioctl_getrid(struct net_device *dev, | |||
3840 | return err; | 3838 | return err; |
3841 | } | 3839 | } |
3842 | 3840 | ||
3843 | /* Spy is used for link quality/strength measurements in Ad-Hoc mode | ||
3844 | * Jean II */ | ||
3845 | static int orinoco_ioctl_setspy(struct net_device *dev, | ||
3846 | struct iw_request_info *info, | ||
3847 | struct iw_point *srq, | ||
3848 | char *extra) | ||
3849 | |||
3850 | { | ||
3851 | struct orinoco_private *priv = netdev_priv(dev); | ||
3852 | struct sockaddr *address = (struct sockaddr *) extra; | ||
3853 | int number = srq->length; | ||
3854 | int i; | ||
3855 | unsigned long flags; | ||
3856 | |||
3857 | /* Make sure nobody mess with the structure while we do */ | ||
3858 | if (orinoco_lock(priv, &flags) != 0) | ||
3859 | return -EBUSY; | ||
3860 | |||
3861 | /* orinoco_lock() doesn't disable interrupts, so make sure the | ||
3862 | * interrupt rx path don't get confused while we copy */ | ||
3863 | priv->spy_number = 0; | ||
3864 | |||
3865 | if (number > 0) { | ||
3866 | /* Extract the addresses */ | ||
3867 | for (i = 0; i < number; i++) | ||
3868 | memcpy(priv->spy_address[i], address[i].sa_data, | ||
3869 | ETH_ALEN); | ||
3870 | /* Reset stats */ | ||
3871 | memset(priv->spy_stat, 0, | ||
3872 | sizeof(struct iw_quality) * IW_MAX_SPY); | ||
3873 | /* Set number of addresses */ | ||
3874 | priv->spy_number = number; | ||
3875 | } | ||
3876 | |||
3877 | /* Now, let the others play */ | ||
3878 | orinoco_unlock(priv, &flags); | ||
3879 | |||
3880 | /* Do NOT call commit handler */ | ||
3881 | return 0; | ||
3882 | } | ||
3883 | |||
3884 | static int orinoco_ioctl_getspy(struct net_device *dev, | ||
3885 | struct iw_request_info *info, | ||
3886 | struct iw_point *srq, | ||
3887 | char *extra) | ||
3888 | { | ||
3889 | struct orinoco_private *priv = netdev_priv(dev); | ||
3890 | struct sockaddr *address = (struct sockaddr *) extra; | ||
3891 | int number; | ||
3892 | int i; | ||
3893 | unsigned long flags; | ||
3894 | |||
3895 | if (orinoco_lock(priv, &flags) != 0) | ||
3896 | return -EBUSY; | ||
3897 | |||
3898 | number = priv->spy_number; | ||
3899 | /* Create address struct */ | ||
3900 | for (i = 0; i < number; i++) { | ||
3901 | memcpy(address[i].sa_data, priv->spy_address[i], ETH_ALEN); | ||
3902 | address[i].sa_family = AF_UNIX; | ||
3903 | } | ||
3904 | if (number > 0) { | ||
3905 | /* Create address struct */ | ||
3906 | for (i = 0; i < number; i++) { | ||
3907 | memcpy(address[i].sa_data, priv->spy_address[i], | ||
3908 | ETH_ALEN); | ||
3909 | address[i].sa_family = AF_UNIX; | ||
3910 | } | ||
3911 | /* Copy stats */ | ||
3912 | /* In theory, we should disable irqs while copying the stats | ||
3913 | * because the rx path might update it in the middle... | ||
3914 | * Bah, who care ? - Jean II */ | ||
3915 | memcpy(extra + (sizeof(struct sockaddr) * number), | ||
3916 | priv->spy_stat, sizeof(struct iw_quality) * number); | ||
3917 | } | ||
3918 | /* Reset updated flags. */ | ||
3919 | for (i = 0; i < number; i++) | ||
3920 | priv->spy_stat[i].updated = 0; | ||
3921 | |||
3922 | orinoco_unlock(priv, &flags); | ||
3923 | |||
3924 | srq->length = number; | ||
3925 | |||
3926 | return 0; | ||
3927 | } | ||
3928 | |||
3929 | /* Trigger a scan (look for other cells in the vicinity */ | 3841 | /* Trigger a scan (look for other cells in the vicinity */ |
3930 | static int orinoco_ioctl_setscan(struct net_device *dev, | 3842 | static int orinoco_ioctl_setscan(struct net_device *dev, |
3931 | struct iw_request_info *info, | 3843 | struct iw_request_info *info, |
@@ -3998,7 +3910,7 @@ static int orinoco_ioctl_setscan(struct net_device *dev, | |||
3998 | HERMES_HOSTSCAN_SYMBOL_BCAST); | 3910 | HERMES_HOSTSCAN_SYMBOL_BCAST); |
3999 | break; | 3911 | break; |
4000 | case FIRMWARE_TYPE_INTERSIL: { | 3912 | case FIRMWARE_TYPE_INTERSIL: { |
4001 | u16 req[3]; | 3913 | __le16 req[3]; |
4002 | 3914 | ||
4003 | req[0] = cpu_to_le16(0x3fff); /* All channels */ | 3915 | req[0] = cpu_to_le16(0x3fff); /* All channels */ |
4004 | req[1] = cpu_to_le16(0x0001); /* rate 1 Mbps */ | 3916 | req[1] = cpu_to_le16(0x0001); /* rate 1 Mbps */ |
@@ -4072,7 +3984,7 @@ static inline int orinoco_translate_scan(struct net_device *dev, | |||
4072 | case FIRMWARE_TYPE_INTERSIL: | 3984 | case FIRMWARE_TYPE_INTERSIL: |
4073 | offset = 4; | 3985 | offset = 4; |
4074 | if (priv->has_hostscan) { | 3986 | if (priv->has_hostscan) { |
4075 | atom_len = le16_to_cpup((u16 *)scan); | 3987 | atom_len = le16_to_cpup((__le16 *)scan); |
4076 | /* Sanity check for atom_len */ | 3988 | /* Sanity check for atom_len */ |
4077 | if (atom_len < sizeof(struct prism2_scan_apinfo)) { | 3989 | if (atom_len < sizeof(struct prism2_scan_apinfo)) { |
4078 | printk(KERN_ERR "%s: Invalid atom_len in scan data: %d\n", | 3990 | printk(KERN_ERR "%s: Invalid atom_len in scan data: %d\n", |
@@ -4356,8 +4268,10 @@ static const iw_handler orinoco_handler[] = { | |||
4356 | [SIOCSIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setsens, | 4268 | [SIOCSIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setsens, |
4357 | [SIOCGIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getsens, | 4269 | [SIOCGIWSENS -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getsens, |
4358 | [SIOCGIWRANGE -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getiwrange, | 4270 | [SIOCGIWRANGE -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getiwrange, |
4359 | [SIOCSIWSPY -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setspy, | 4271 | [SIOCSIWSPY -SIOCIWFIRST] = (iw_handler) iw_handler_set_spy, |
4360 | [SIOCGIWSPY -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getspy, | 4272 | [SIOCGIWSPY -SIOCIWFIRST] = (iw_handler) iw_handler_get_spy, |
4273 | [SIOCSIWTHRSPY-SIOCIWFIRST] = (iw_handler) iw_handler_set_thrspy, | ||
4274 | [SIOCGIWTHRSPY-SIOCIWFIRST] = (iw_handler) iw_handler_get_thrspy, | ||
4361 | [SIOCSIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setwap, | 4275 | [SIOCSIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setwap, |
4362 | [SIOCGIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getwap, | 4276 | [SIOCGIWAP -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_getwap, |
4363 | [SIOCSIWSCAN -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setscan, | 4277 | [SIOCSIWSCAN -SIOCIWFIRST] = (iw_handler) orinoco_ioctl_setscan, |
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h index 2f213a7103fe..7a17bb31fc89 100644 --- a/drivers/net/wireless/orinoco.h +++ b/drivers/net/wireless/orinoco.h | |||
@@ -7,12 +7,11 @@ | |||
7 | #ifndef _ORINOCO_H | 7 | #ifndef _ORINOCO_H |
8 | #define _ORINOCO_H | 8 | #define _ORINOCO_H |
9 | 9 | ||
10 | #define DRIVER_VERSION "0.15rc2" | 10 | #define DRIVER_VERSION "0.15rc3" |
11 | 11 | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/spinlock.h> | ||
14 | #include <linux/netdevice.h> | 12 | #include <linux/netdevice.h> |
15 | #include <linux/wireless.h> | 13 | #include <linux/wireless.h> |
14 | #include <net/iw_handler.h> | ||
16 | #include <linux/version.h> | 15 | #include <linux/version.h> |
17 | 16 | ||
18 | #include "hermes.h" | 17 | #include "hermes.h" |
@@ -28,7 +27,7 @@ | |||
28 | #define ORINOCO_MAX_KEYS 4 | 27 | #define ORINOCO_MAX_KEYS 4 |
29 | 28 | ||
30 | struct orinoco_key { | 29 | struct orinoco_key { |
31 | u16 len; /* always stored as little-endian */ | 30 | __le16 len; /* always stored as little-endian */ |
32 | char data[ORINOCO_MAX_KEY_SIZE]; | 31 | char data[ORINOCO_MAX_KEY_SIZE]; |
33 | } __attribute__ ((packed)); | 32 | } __attribute__ ((packed)); |
34 | 33 | ||
@@ -36,14 +35,14 @@ struct header_struct { | |||
36 | /* 802.3 */ | 35 | /* 802.3 */ |
37 | u8 dest[ETH_ALEN]; | 36 | u8 dest[ETH_ALEN]; |
38 | u8 src[ETH_ALEN]; | 37 | u8 src[ETH_ALEN]; |
39 | u16 len; | 38 | __be16 len; |
40 | /* 802.2 */ | 39 | /* 802.2 */ |
41 | u8 dsap; | 40 | u8 dsap; |
42 | u8 ssap; | 41 | u8 ssap; |
43 | u8 ctrl; | 42 | u8 ctrl; |
44 | /* SNAP */ | 43 | /* SNAP */ |
45 | u8 oui[3]; | 44 | u8 oui[3]; |
46 | u16 ethertype; | 45 | unsigned short ethertype; |
47 | } __attribute__ ((packed)); | 46 | } __attribute__ ((packed)); |
48 | 47 | ||
49 | typedef enum { | 48 | typedef enum { |
@@ -112,9 +111,8 @@ struct orinoco_private { | |||
112 | u16 pm_on, pm_mcast, pm_period, pm_timeout; | 111 | u16 pm_on, pm_mcast, pm_period, pm_timeout; |
113 | u16 preamble; | 112 | u16 preamble; |
114 | #ifdef WIRELESS_SPY | 113 | #ifdef WIRELESS_SPY |
115 | int spy_number; | 114 | struct iw_spy_data spy_data; /* iwspy support */ |
116 | u_char spy_address[IW_MAX_SPY][ETH_ALEN]; | 115 | struct iw_public_data wireless_data; |
117 | struct iw_quality spy_stat[IW_MAX_SPY]; | ||
118 | #endif | 116 | #endif |
119 | 117 | ||
120 | /* Configuration dependent variables */ | 118 | /* Configuration dependent variables */ |
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index bedd7f9f23e4..dc1128a00971 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -14,33 +14,16 @@ | |||
14 | #define PFX DRIVER_NAME ": " | 14 | #define PFX DRIVER_NAME ": " |
15 | 15 | ||
16 | #include <linux/config.h> | 16 | #include <linux/config.h> |
17 | #ifdef __IN_PCMCIA_PACKAGE__ | ||
18 | #include <pcmcia/k_compat.h> | ||
19 | #endif /* __IN_PCMCIA_PACKAGE__ */ | ||
20 | |||
21 | #include <linux/module.h> | 17 | #include <linux/module.h> |
22 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
23 | #include <linux/init.h> | 19 | #include <linux/init.h> |
24 | #include <linux/sched.h> | 20 | #include <linux/delay.h> |
25 | #include <linux/ptrace.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/string.h> | ||
28 | #include <linux/ioport.h> | ||
29 | #include <linux/netdevice.h> | ||
30 | #include <linux/if_arp.h> | ||
31 | #include <linux/etherdevice.h> | ||
32 | #include <linux/wireless.h> | ||
33 | |||
34 | #include <pcmcia/cs_types.h> | 21 | #include <pcmcia/cs_types.h> |
35 | #include <pcmcia/cs.h> | 22 | #include <pcmcia/cs.h> |
36 | #include <pcmcia/cistpl.h> | 23 | #include <pcmcia/cistpl.h> |
37 | #include <pcmcia/cisreg.h> | 24 | #include <pcmcia/cisreg.h> |
38 | #include <pcmcia/ds.h> | 25 | #include <pcmcia/ds.h> |
39 | 26 | ||
40 | #include <asm/uaccess.h> | ||
41 | #include <asm/io.h> | ||
42 | #include <asm/system.h> | ||
43 | |||
44 | #include "orinoco.h" | 27 | #include "orinoco.h" |
45 | 28 | ||
46 | /********************************************************************/ | 29 | /********************************************************************/ |
@@ -97,17 +80,8 @@ static dev_link_t *dev_list; /* = NULL */ | |||
97 | /* Function prototypes */ | 80 | /* Function prototypes */ |
98 | /********************************************************************/ | 81 | /********************************************************************/ |
99 | 82 | ||
100 | /* device methods */ | 83 | static void orinoco_cs_release(dev_link_t *link); |
101 | static int orinoco_cs_hard_reset(struct orinoco_private *priv); | 84 | static void orinoco_cs_detach(dev_link_t *link); |
102 | |||
103 | /* PCMCIA gumpf */ | ||
104 | static void orinoco_cs_config(dev_link_t * link); | ||
105 | static void orinoco_cs_release(dev_link_t * link); | ||
106 | static int orinoco_cs_event(event_t event, int priority, | ||
107 | event_callback_args_t * args); | ||
108 | |||
109 | static dev_link_t *orinoco_cs_attach(void); | ||
110 | static void orinoco_cs_detach(dev_link_t *); | ||
111 | 85 | ||
112 | /********************************************************************/ | 86 | /********************************************************************/ |
113 | /* Device methods */ | 87 | /* Device methods */ |
@@ -603,49 +577,85 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION | |||
603 | "Pavel Roskin <proski@gnu.org>, et al)"; | 577 | "Pavel Roskin <proski@gnu.org>, et al)"; |
604 | 578 | ||
605 | static struct pcmcia_device_id orinoco_cs_ids[] = { | 579 | static struct pcmcia_device_id orinoco_cs_ids[] = { |
606 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), | 580 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), /* SonicWALL Long Range Wireless Card */ |
607 | PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), | 581 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), /* Sohoware NCP110, Philips 802.11b */ |
608 | PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), | 582 | PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0002), /* AnyPoint(TM) Wireless II PC Card */ |
609 | PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), | 583 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */ |
610 | PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), | 584 | PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), /* PROXIM RangeLAN-DS/LAN PC CARD */ |
611 | PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), | 585 | PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), /* Compaq WL100 11 Mbps Wireless Adapter */ |
612 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), | 586 | PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), /* Lucent Orinoco and old Intersil */ |
613 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), | 587 | PCMCIA_DEVICE_MANF_CARD(0x016b, 0x0001), /* Ericsson WLAN Card C11 */ |
614 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), | 588 | PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), /* Nortel Networks eMobility 802.11 Wireless Adapter */ |
615 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), | 589 | PCMCIA_DEVICE_MANF_CARD(0x01ff, 0x0008), /* Intermec MobileLAN 11Mbps 802.11b WLAN Card */ |
616 | PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), | 590 | PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */ |
617 | PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), | 591 | PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */ |
618 | PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), | 592 | PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */ |
619 | PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), | 593 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */ |
620 | PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), | 594 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */ |
621 | PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), | 595 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */ |
622 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), | 596 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), /* Compaq HNW-100 11 Mbps Wireless Adapter */ |
623 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), | 597 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), /* Linksys WCF12 Wireless CompactFlash Card */ |
598 | PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), /* ASUS SpaceLink WL-100 */ | ||
599 | PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), /* SpeedStream SS1021 Wireless Adapter */ | ||
600 | PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), /* PLANEX RoadLannerWave GW-NS11H */ | ||
601 | PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), /* Airvast WN-100 */ | ||
602 | PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), /* Adaptec Ultra Wireless ANW-8030 */ | ||
603 | PCMCIA_DEVICE_MANF_CARD(0xc001, 0x0008), /* CONTEC FLEXSCAN/FX-DDS110-PCC */ | ||
604 | PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), /* Conceptronic CON11Cpro, EMTAC A2424i */ | ||
605 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), /* Safeway 802.11b, ZCOMAX AirRunner/XI-300 */ | ||
606 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), /* D-Link DCF660, Sandisk Connect SDWCFB-000 */ | ||
607 | PCMCIA_DEVICE_PROD_ID12(" ", "IEEE 802.11 Wireless LAN/PC Card", 0x3b6e20c8, 0xefccafe9), | ||
624 | PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), | 608 | PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), |
625 | PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0), | ||
626 | PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5), | 609 | PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5), |
610 | PCMCIA_DEVICE_PROD_ID12("Addtron", "AWP-100 Wireless PCMCIA", 0xe6ec52ce, 0x08649af2), | ||
611 | PCMCIA_DEVICE_PROD_ID123("AIRVAST", "IEEE 802.11b Wireless PCMCIA Card", "HFA3863", 0xea569531, 0x4bcb9645, 0x355cb092), | ||
612 | PCMCIA_DEVICE_PROD_ID12("Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 0x5cd01705, 0x4271660f), | ||
613 | PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842), | ||
614 | PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11B_CF_CARD_25", 0x78fc06ee, 0x45a50c1e), | ||
627 | PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169), | 615 | PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169), |
616 | PCMCIA_DEVICE_PROD_ID12("BENQ", "AWL100 PCMCIA ADAPTER", 0x35dadc74, 0x01f7fedb), | ||
628 | PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3), | 617 | PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3), |
618 | PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", 0x2decece3, 0x82067c18), | ||
629 | PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90), | 619 | PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90), |
620 | PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card", 0x54f7c49c, 0x15a75e5b), | ||
621 | PCMCIA_DEVICE_PROD_ID123("corega", "WL PCCL-11", "ISL37300P", 0x0a21501a, 0x59868926, 0xc9049a39), | ||
630 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584), | 622 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584), |
631 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9), | 623 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9), |
632 | PCMCIA_DEVICE_PROD_ID12("corega_K.K.", "Wireless_LAN_PCCB-11", 0x29e33311, 0xee7a27ae), | 624 | PCMCIA_DEVICE_PROD_ID12("corega_K.K.", "Wireless_LAN_PCCB-11", 0x29e33311, 0xee7a27ae), |
633 | PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac), | 625 | PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac), |
634 | PCMCIA_DEVICE_PROD_ID12("D", "Link DWL-650 11Mbps WLAN Card", 0x71b18589, 0xb6f1b0ab), | 626 | PCMCIA_DEVICE_PROD_ID12("D", "Link DWL-650 11Mbps WLAN Card", 0x71b18589, 0xb6f1b0ab), |
627 | PCMCIA_DEVICE_PROD_ID12("D-Link Corporation", "D-Link DWL-650H 11Mbps WLAN Adapter", 0xef544d24, 0xcd8ea916), | ||
628 | PCMCIA_DEVICE_PROD_ID12("Digital Data Communications", "WPC-0100", 0xfdd73470, 0xe0b6f146), | ||
635 | PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3), | 629 | PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3), |
636 | PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c), | 630 | PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c), |
631 | PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0), | ||
632 | PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless 2011 LAN PC Card", 0x816cc815, 0x07f58077), | ||
637 | PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18), | 633 | PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18), |
634 | PCMCIA_DEVICE_PROD_ID12("INTERSIL", "I-GATE 11M PC Card / PC Card plus", 0x74c5e40d, 0x8304ff77), | ||
635 | PCMCIA_DEVICE_PROD_ID12("Intersil", "PRISM 2_5 PCMCIA ADAPTER", 0x4b801a17, 0x6345a0bf), | ||
636 | PCMCIA_DEVICE_PROD_ID123("Intersil", "PRISM Freedom PCMCIA Adapter", "ISL37100P", 0x4b801a17, 0xf222ec2d, 0x630d52b2), | ||
637 | PCMCIA_DEVICE_PROD_ID12("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", 0x7e3b326a, 0x49893e92), | ||
638 | PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card", 0x0733cc81, 0x0c52f395), | ||
638 | PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a), | 639 | PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a), |
639 | PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410), | 640 | PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410), |
640 | PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3), | 641 | PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3), |
641 | PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01), | 642 | PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01), |
642 | PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a), | 643 | PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a), |
644 | PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401 Wireless PC", "Card", 0xa37434e9, 0x9762e8f1), | ||
643 | PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1), | 645 | PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1), |
646 | PCMCIA_DEVICE_PROD_ID12("Nortel Networks", "emobility 802.11 Wireless LAN PC Card", 0x2d617ea0, 0x88cd5767), | ||
647 | PCMCIA_DEVICE_PROD_ID12("OEM", "PRISM2 IEEE 802.11 PC-Card", 0xfea54c90, 0x48f2bdd6), | ||
648 | PCMCIA_DEVICE_PROD_ID12("OTC", "Wireless AirEZY 2411-PCC WLAN Card", 0x4ac44287, 0x235a6bed), | ||
649 | PCMCIA_DEVICE_PROD_ID123("PCMCIA", "11M WLAN Card v2.5", "ISL37300P", 0x281f1c5d, 0x6e440487, 0xc9049a39), | ||
644 | PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264), | 650 | PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264), |
651 | PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-NS110", 0x209f40ab, 0x46263178), | ||
645 | PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9), | 652 | PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9), |
646 | PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26), | 653 | PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26), |
647 | PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b), | 654 | PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b), |
648 | PCMCIA_DEVICE_PROD_ID1("Symbol Technologies", 0x3f02b4d6), | 655 | PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2632W", 0xc4f8b18b, 0x474a1f2a), |
656 | PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e), | ||
657 | PCMCIA_DEVICE_PROD_ID123("The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", 0xa5f472c2, 0x590eb502, 0xc9049a39), | ||
658 | PCMCIA_DEVICE_PROD_ID12("ZoomAir 11Mbps High", "Rate wireless Networking", 0x273fe3db, 0x32a1eaee), | ||
649 | PCMCIA_DEVICE_NULL, | 659 | PCMCIA_DEVICE_NULL, |
650 | }; | 660 | }; |
651 | MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids); | 661 | MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids); |
@@ -656,8 +666,8 @@ static struct pcmcia_driver orinoco_driver = { | |||
656 | .name = DRIVER_NAME, | 666 | .name = DRIVER_NAME, |
657 | }, | 667 | }, |
658 | .attach = orinoco_cs_attach, | 668 | .attach = orinoco_cs_attach, |
659 | .event = orinoco_cs_event, | ||
660 | .detach = orinoco_cs_detach, | 669 | .detach = orinoco_cs_detach, |
670 | .event = orinoco_cs_event, | ||
661 | .id_table = orinoco_cs_ids, | 671 | .id_table = orinoco_cs_ids, |
662 | }; | 672 | }; |
663 | 673 | ||
diff --git a/drivers/net/wireless/orinoco_nortel.c b/drivers/net/wireless/orinoco_nortel.c index 86fa58e5cfac..d8afd51ff8a5 100644 --- a/drivers/net/wireless/orinoco_nortel.c +++ b/drivers/net/wireless/orinoco_nortel.c | |||
@@ -40,29 +40,13 @@ | |||
40 | #define PFX DRIVER_NAME ": " | 40 | #define PFX DRIVER_NAME ": " |
41 | 41 | ||
42 | #include <linux/config.h> | 42 | #include <linux/config.h> |
43 | |||
44 | #include <linux/module.h> | 43 | #include <linux/module.h> |
45 | #include <linux/kernel.h> | 44 | #include <linux/kernel.h> |
46 | #include <linux/init.h> | 45 | #include <linux/init.h> |
47 | #include <linux/sched.h> | 46 | #include <linux/delay.h> |
48 | #include <linux/ptrace.h> | ||
49 | #include <linux/slab.h> | ||
50 | #include <linux/string.h> | ||
51 | #include <linux/timer.h> | ||
52 | #include <linux/ioport.h> | ||
53 | #include <asm/uaccess.h> | ||
54 | #include <asm/io.h> | ||
55 | #include <asm/system.h> | ||
56 | #include <linux/netdevice.h> | ||
57 | #include <linux/if_arp.h> | ||
58 | #include <linux/etherdevice.h> | ||
59 | #include <linux/list.h> | ||
60 | #include <linux/pci.h> | 47 | #include <linux/pci.h> |
61 | #include <linux/fcntl.h> | ||
62 | |||
63 | #include <pcmcia/cisreg.h> | 48 | #include <pcmcia/cisreg.h> |
64 | 49 | ||
65 | #include "hermes.h" | ||
66 | #include "orinoco.h" | 50 | #include "orinoco.h" |
67 | 51 | ||
68 | #define COR_OFFSET (0xe0) /* COR attribute offset of Prism2 PC card */ | 52 | #define COR_OFFSET (0xe0) /* COR attribute offset of Prism2 PC card */ |
@@ -108,7 +92,7 @@ static int nortel_pci_cor_reset(struct orinoco_private *priv) | |||
108 | return 0; | 92 | return 0; |
109 | } | 93 | } |
110 | 94 | ||
111 | int nortel_pci_hw_init(struct nortel_pci_card *card) | 95 | static int nortel_pci_hw_init(struct nortel_pci_card *card) |
112 | { | 96 | { |
113 | int i; | 97 | int i; |
114 | u32 reg; | 98 | u32 reg; |
diff --git a/drivers/net/wireless/orinoco_pci.c b/drivers/net/wireless/orinoco_pci.c index 42e03438291b..5362c214fc8e 100644 --- a/drivers/net/wireless/orinoco_pci.c +++ b/drivers/net/wireless/orinoco_pci.c | |||
@@ -93,28 +93,12 @@ | |||
93 | #define PFX DRIVER_NAME ": " | 93 | #define PFX DRIVER_NAME ": " |
94 | 94 | ||
95 | #include <linux/config.h> | 95 | #include <linux/config.h> |
96 | |||
97 | #include <linux/module.h> | 96 | #include <linux/module.h> |
98 | #include <linux/kernel.h> | 97 | #include <linux/kernel.h> |
99 | #include <linux/init.h> | 98 | #include <linux/init.h> |
100 | #include <linux/sched.h> | 99 | #include <linux/delay.h> |
101 | #include <linux/ptrace.h> | ||
102 | #include <linux/slab.h> | ||
103 | #include <linux/string.h> | ||
104 | #include <linux/timer.h> | ||
105 | #include <linux/ioport.h> | ||
106 | #include <linux/netdevice.h> | ||
107 | #include <linux/if_arp.h> | ||
108 | #include <linux/etherdevice.h> | ||
109 | #include <linux/list.h> | ||
110 | #include <linux/pci.h> | 100 | #include <linux/pci.h> |
111 | #include <linux/fcntl.h> | ||
112 | |||
113 | #include <asm/uaccess.h> | ||
114 | #include <asm/io.h> | ||
115 | #include <asm/system.h> | ||
116 | 101 | ||
117 | #include "hermes.h" | ||
118 | #include "orinoco.h" | 102 | #include "orinoco.h" |
119 | 103 | ||
120 | /* All the magic there is from wlan-ng */ | 104 | /* All the magic there is from wlan-ng */ |
diff --git a/drivers/net/wireless/orinoco_plx.c b/drivers/net/wireless/orinoco_plx.c index 7ab05b89fb3f..210e73776545 100644 --- a/drivers/net/wireless/orinoco_plx.c +++ b/drivers/net/wireless/orinoco_plx.c | |||
@@ -117,29 +117,13 @@ | |||
117 | #define PFX DRIVER_NAME ": " | 117 | #define PFX DRIVER_NAME ": " |
118 | 118 | ||
119 | #include <linux/config.h> | 119 | #include <linux/config.h> |
120 | |||
121 | #include <linux/module.h> | 120 | #include <linux/module.h> |
122 | #include <linux/kernel.h> | 121 | #include <linux/kernel.h> |
123 | #include <linux/init.h> | 122 | #include <linux/init.h> |
124 | #include <linux/sched.h> | 123 | #include <linux/delay.h> |
125 | #include <linux/ptrace.h> | ||
126 | #include <linux/slab.h> | ||
127 | #include <linux/string.h> | ||
128 | #include <linux/timer.h> | ||
129 | #include <linux/ioport.h> | ||
130 | #include <asm/uaccess.h> | ||
131 | #include <asm/io.h> | ||
132 | #include <asm/system.h> | ||
133 | #include <linux/netdevice.h> | ||
134 | #include <linux/if_arp.h> | ||
135 | #include <linux/etherdevice.h> | ||
136 | #include <linux/list.h> | ||
137 | #include <linux/pci.h> | 124 | #include <linux/pci.h> |
138 | #include <linux/fcntl.h> | ||
139 | |||
140 | #include <pcmcia/cisreg.h> | 125 | #include <pcmcia/cisreg.h> |
141 | 126 | ||
142 | #include "hermes.h" | ||
143 | #include "orinoco.h" | 127 | #include "orinoco.h" |
144 | 128 | ||
145 | #define COR_OFFSET (0x3e0) /* COR attribute offset of Prism2 PC card */ | 129 | #define COR_OFFSET (0x3e0) /* COR attribute offset of Prism2 PC card */ |
diff --git a/drivers/net/wireless/orinoco_tmd.c b/drivers/net/wireless/orinoco_tmd.c index 85893f42445b..5e68b7026186 100644 --- a/drivers/net/wireless/orinoco_tmd.c +++ b/drivers/net/wireless/orinoco_tmd.c | |||
@@ -53,29 +53,13 @@ | |||
53 | #define PFX DRIVER_NAME ": " | 53 | #define PFX DRIVER_NAME ": " |
54 | 54 | ||
55 | #include <linux/config.h> | 55 | #include <linux/config.h> |
56 | |||
57 | #include <linux/module.h> | 56 | #include <linux/module.h> |
58 | #include <linux/kernel.h> | 57 | #include <linux/kernel.h> |
59 | #include <linux/init.h> | 58 | #include <linux/init.h> |
60 | #include <linux/sched.h> | 59 | #include <linux/delay.h> |
61 | #include <linux/ptrace.h> | ||
62 | #include <linux/slab.h> | ||
63 | #include <linux/string.h> | ||
64 | #include <linux/timer.h> | ||
65 | #include <linux/ioport.h> | ||
66 | #include <asm/uaccess.h> | ||
67 | #include <asm/io.h> | ||
68 | #include <asm/system.h> | ||
69 | #include <linux/netdevice.h> | ||
70 | #include <linux/if_arp.h> | ||
71 | #include <linux/etherdevice.h> | ||
72 | #include <linux/list.h> | ||
73 | #include <linux/pci.h> | 60 | #include <linux/pci.h> |
74 | #include <linux/fcntl.h> | ||
75 | |||
76 | #include <pcmcia/cisreg.h> | 61 | #include <pcmcia/cisreg.h> |
77 | 62 | ||
78 | #include "hermes.h" | ||
79 | #include "orinoco.h" | 63 | #include "orinoco.h" |
80 | 64 | ||
81 | #define COR_VALUE (COR_LEVEL_REQ | COR_FUNC_ENA) /* Enable PC card with interrupt in level trigger */ | 65 | #define COR_VALUE (COR_LEVEL_REQ | COR_FUNC_ENA) /* Enable PC card with interrupt in level trigger */ |
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 9a8790e3580c..5c1a1adf1ff8 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -462,14 +462,12 @@ prism54_get_range(struct net_device *ndev, struct iw_request_info *info, | |||
462 | /* txpower is supported in dBm's */ | 462 | /* txpower is supported in dBm's */ |
463 | range->txpower_capa = IW_TXPOW_DBM; | 463 | range->txpower_capa = IW_TXPOW_DBM; |
464 | 464 | ||
465 | #if WIRELESS_EXT > 16 | ||
466 | /* Event capability (kernel + driver) */ | 465 | /* Event capability (kernel + driver) */ |
467 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | | 466 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | |
468 | IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | | 467 | IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | |
469 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); | 468 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); |
470 | range->event_capa[1] = IW_EVENT_CAPA_K_1; | 469 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
471 | range->event_capa[4] = IW_EVENT_CAPA_MASK(IWEVCUSTOM); | 470 | range->event_capa[4] = IW_EVENT_CAPA_MASK(IWEVCUSTOM); |
472 | #endif /* WIRELESS_EXT > 16 */ | ||
473 | 471 | ||
474 | if (islpci_get_state(priv) < PRV_STATE_INIT) | 472 | if (islpci_get_state(priv) < PRV_STATE_INIT) |
475 | return 0; | 473 | return 0; |
@@ -693,14 +691,13 @@ prism54_get_scan(struct net_device *ndev, struct iw_request_info *info, | |||
693 | extra + dwrq->length, | 691 | extra + dwrq->length, |
694 | &(bsslist->bsslist[i]), | 692 | &(bsslist->bsslist[i]), |
695 | noise); | 693 | noise); |
696 | #if WIRELESS_EXT > 16 | 694 | |
697 | /* Check if there is space for one more entry */ | 695 | /* Check if there is space for one more entry */ |
698 | if((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { | 696 | if((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { |
699 | /* Ask user space to try again with a bigger buffer */ | 697 | /* Ask user space to try again with a bigger buffer */ |
700 | rvalue = -E2BIG; | 698 | rvalue = -E2BIG; |
701 | break; | 699 | break; |
702 | } | 700 | } |
703 | #endif /* WIRELESS_EXT > 16 */ | ||
704 | } | 701 | } |
705 | 702 | ||
706 | kfree(bsslist); | 703 | kfree(bsslist); |
@@ -2727,12 +2724,7 @@ const struct iw_handler_def prism54_handler_def = { | |||
2727 | .standard = (iw_handler *) prism54_handler, | 2724 | .standard = (iw_handler *) prism54_handler, |
2728 | .private = (iw_handler *) prism54_private_handler, | 2725 | .private = (iw_handler *) prism54_private_handler, |
2729 | .private_args = (struct iw_priv_args *) prism54_private_args, | 2726 | .private_args = (struct iw_priv_args *) prism54_private_args, |
2730 | #if WIRELESS_EXT > 16 | ||
2731 | .get_wireless_stats = prism54_get_wireless_stats, | 2727 | .get_wireless_stats = prism54_get_wireless_stats, |
2732 | #endif /* WIRELESS_EXT > 16 */ | ||
2733 | #if WIRELESS_EXT == 16 | ||
2734 | .spy_offset = offsetof(islpci_private, spy_data), | ||
2735 | #endif /* WIRELESS_EXT == 16 */ | ||
2736 | }; | 2728 | }; |
2737 | 2729 | ||
2738 | /* For wpa_supplicant */ | 2730 | /* For wpa_supplicant */ |
diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c index 6f13d4a8e2d3..6c9584a9f284 100644 --- a/drivers/net/wireless/prism54/islpci_dev.c +++ b/drivers/net/wireless/prism54/islpci_dev.c | |||
@@ -439,8 +439,7 @@ prism54_bring_down(islpci_private *priv) | |||
439 | wmb(); | 439 | wmb(); |
440 | 440 | ||
441 | /* wait a while for the device to reset */ | 441 | /* wait a while for the device to reset */ |
442 | set_current_state(TASK_UNINTERRUPTIBLE); | 442 | schedule_timeout_uninterruptible(msecs_to_jiffies(50)); |
443 | schedule_timeout(50*HZ/1000); | ||
444 | 443 | ||
445 | return 0; | 444 | return 0; |
446 | } | 445 | } |
@@ -491,8 +490,7 @@ islpci_reset_if(islpci_private *priv) | |||
491 | /* The software reset acknowledge needs about 220 msec here. | 490 | /* The software reset acknowledge needs about 220 msec here. |
492 | * Be conservative and wait for up to one second. */ | 491 | * Be conservative and wait for up to one second. */ |
493 | 492 | ||
494 | set_current_state(TASK_UNINTERRUPTIBLE); | 493 | remaining = schedule_timeout_uninterruptible(HZ); |
495 | remaining = schedule_timeout(HZ); | ||
496 | 494 | ||
497 | if(remaining > 0) { | 495 | if(remaining > 0) { |
498 | result = 0; | 496 | result = 0; |
@@ -839,13 +837,9 @@ islpci_setup(struct pci_dev *pdev) | |||
839 | priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) ? | 837 | priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) ? |
840 | priv->monitor_type : ARPHRD_ETHER; | 838 | priv->monitor_type : ARPHRD_ETHER; |
841 | 839 | ||
842 | #if WIRELESS_EXT > 16 | ||
843 | /* Add pointers to enable iwspy support. */ | 840 | /* Add pointers to enable iwspy support. */ |
844 | priv->wireless_data.spy_data = &priv->spy_data; | 841 | priv->wireless_data.spy_data = &priv->spy_data; |
845 | ndev->wireless_data = &priv->wireless_data; | 842 | ndev->wireless_data = &priv->wireless_data; |
846 | #else /* WIRELESS_EXT > 16 */ | ||
847 | ndev->get_wireless_stats = &prism54_get_wireless_stats; | ||
848 | #endif /* WIRELESS_EXT > 16 */ | ||
849 | 843 | ||
850 | /* save the start and end address of the PCI memory area */ | 844 | /* save the start and end address of the PCI memory area */ |
851 | ndev->mem_start = (unsigned long) priv->device_base; | 845 | ndev->mem_start = (unsigned long) priv->device_base; |
diff --git a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h index 32a1019f1b36..efbed4397951 100644 --- a/drivers/net/wireless/prism54/islpci_dev.h +++ b/drivers/net/wireless/prism54/islpci_dev.h | |||
@@ -100,9 +100,7 @@ typedef struct { | |||
100 | 100 | ||
101 | struct iw_spy_data spy_data; /* iwspy support */ | 101 | struct iw_spy_data spy_data; /* iwspy support */ |
102 | 102 | ||
103 | #if WIRELESS_EXT > 16 | ||
104 | struct iw_public_data wireless_data; | 103 | struct iw_public_data wireless_data; |
105 | #endif /* WIRELESS_EXT > 16 */ | ||
106 | 104 | ||
107 | int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */ | 105 | int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */ |
108 | 106 | ||
diff --git a/drivers/net/wireless/prism54/islpci_mgt.c b/drivers/net/wireless/prism54/islpci_mgt.c index b6f2e5a223be..4937a5ad4b2c 100644 --- a/drivers/net/wireless/prism54/islpci_mgt.c +++ b/drivers/net/wireless/prism54/islpci_mgt.c | |||
@@ -455,7 +455,7 @@ islpci_mgt_transaction(struct net_device *ndev, | |||
455 | struct islpci_mgmtframe **recvframe) | 455 | struct islpci_mgmtframe **recvframe) |
456 | { | 456 | { |
457 | islpci_private *priv = netdev_priv(ndev); | 457 | islpci_private *priv = netdev_priv(ndev); |
458 | const long wait_cycle_jiffies = (ISL38XX_WAIT_CYCLE * 10 * HZ) / 1000; | 458 | const long wait_cycle_jiffies = msecs_to_jiffies(ISL38XX_WAIT_CYCLE * 10); |
459 | long timeout_left = ISL38XX_MAX_WAIT_CYCLES * wait_cycle_jiffies; | 459 | long timeout_left = ISL38XX_MAX_WAIT_CYCLES * wait_cycle_jiffies; |
460 | int err; | 460 | int err; |
461 | DEFINE_WAIT(wait); | 461 | DEFINE_WAIT(wait); |
@@ -475,8 +475,7 @@ islpci_mgt_transaction(struct net_device *ndev, | |||
475 | int timeleft; | 475 | int timeleft; |
476 | struct islpci_mgmtframe *frame; | 476 | struct islpci_mgmtframe *frame; |
477 | 477 | ||
478 | set_current_state(TASK_UNINTERRUPTIBLE); | 478 | timeleft = schedule_timeout_uninterruptible(wait_cycle_jiffies); |
479 | timeleft = schedule_timeout(wait_cycle_jiffies); | ||
480 | frame = xchg(&priv->mgmt_received, NULL); | 479 | frame = xchg(&priv->mgmt_received, NULL); |
481 | if (frame) { | 480 | if (frame) { |
482 | if (frame->header->oid == oid) { | 481 | if (frame->header->oid == oid) { |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index e9c5ea0f5535..70fd6fd8feb9 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -1649,28 +1649,28 @@ static iw_stats * ray_get_wireless_stats(struct net_device * dev) | |||
1649 | */ | 1649 | */ |
1650 | 1650 | ||
1651 | static const iw_handler ray_handler[] = { | 1651 | static const iw_handler ray_handler[] = { |
1652 | [SIOCSIWCOMMIT-SIOCIWFIRST] (iw_handler) ray_commit, | 1652 | [SIOCSIWCOMMIT-SIOCIWFIRST] = (iw_handler) ray_commit, |
1653 | [SIOCGIWNAME -SIOCIWFIRST] (iw_handler) ray_get_name, | 1653 | [SIOCGIWNAME -SIOCIWFIRST] = (iw_handler) ray_get_name, |
1654 | [SIOCSIWFREQ -SIOCIWFIRST] (iw_handler) ray_set_freq, | 1654 | [SIOCSIWFREQ -SIOCIWFIRST] = (iw_handler) ray_set_freq, |
1655 | [SIOCGIWFREQ -SIOCIWFIRST] (iw_handler) ray_get_freq, | 1655 | [SIOCGIWFREQ -SIOCIWFIRST] = (iw_handler) ray_get_freq, |
1656 | [SIOCSIWMODE -SIOCIWFIRST] (iw_handler) ray_set_mode, | 1656 | [SIOCSIWMODE -SIOCIWFIRST] = (iw_handler) ray_set_mode, |
1657 | [SIOCGIWMODE -SIOCIWFIRST] (iw_handler) ray_get_mode, | 1657 | [SIOCGIWMODE -SIOCIWFIRST] = (iw_handler) ray_get_mode, |
1658 | [SIOCGIWRANGE -SIOCIWFIRST] (iw_handler) ray_get_range, | 1658 | [SIOCGIWRANGE -SIOCIWFIRST] = (iw_handler) ray_get_range, |
1659 | #ifdef WIRELESS_SPY | 1659 | #ifdef WIRELESS_SPY |
1660 | [SIOCSIWSPY -SIOCIWFIRST] (iw_handler) iw_handler_set_spy, | 1660 | [SIOCSIWSPY -SIOCIWFIRST] = (iw_handler) iw_handler_set_spy, |
1661 | [SIOCGIWSPY -SIOCIWFIRST] (iw_handler) iw_handler_get_spy, | 1661 | [SIOCGIWSPY -SIOCIWFIRST] = (iw_handler) iw_handler_get_spy, |
1662 | [SIOCSIWTHRSPY-SIOCIWFIRST] (iw_handler) iw_handler_set_thrspy, | 1662 | [SIOCSIWTHRSPY-SIOCIWFIRST] = (iw_handler) iw_handler_set_thrspy, |
1663 | [SIOCGIWTHRSPY-SIOCIWFIRST] (iw_handler) iw_handler_get_thrspy, | 1663 | [SIOCGIWTHRSPY-SIOCIWFIRST] = (iw_handler) iw_handler_get_thrspy, |
1664 | #endif /* WIRELESS_SPY */ | 1664 | #endif /* WIRELESS_SPY */ |
1665 | [SIOCGIWAP -SIOCIWFIRST] (iw_handler) ray_get_wap, | 1665 | [SIOCGIWAP -SIOCIWFIRST] = (iw_handler) ray_get_wap, |
1666 | [SIOCSIWESSID -SIOCIWFIRST] (iw_handler) ray_set_essid, | 1666 | [SIOCSIWESSID -SIOCIWFIRST] = (iw_handler) ray_set_essid, |
1667 | [SIOCGIWESSID -SIOCIWFIRST] (iw_handler) ray_get_essid, | 1667 | [SIOCGIWESSID -SIOCIWFIRST] = (iw_handler) ray_get_essid, |
1668 | [SIOCSIWRATE -SIOCIWFIRST] (iw_handler) ray_set_rate, | 1668 | [SIOCSIWRATE -SIOCIWFIRST] = (iw_handler) ray_set_rate, |
1669 | [SIOCGIWRATE -SIOCIWFIRST] (iw_handler) ray_get_rate, | 1669 | [SIOCGIWRATE -SIOCIWFIRST] = (iw_handler) ray_get_rate, |
1670 | [SIOCSIWRTS -SIOCIWFIRST] (iw_handler) ray_set_rts, | 1670 | [SIOCSIWRTS -SIOCIWFIRST] = (iw_handler) ray_set_rts, |
1671 | [SIOCGIWRTS -SIOCIWFIRST] (iw_handler) ray_get_rts, | 1671 | [SIOCGIWRTS -SIOCIWFIRST] = (iw_handler) ray_get_rts, |
1672 | [SIOCSIWFRAG -SIOCIWFIRST] (iw_handler) ray_set_frag, | 1672 | [SIOCSIWFRAG -SIOCIWFIRST] = (iw_handler) ray_set_frag, |
1673 | [SIOCGIWFRAG -SIOCIWFIRST] (iw_handler) ray_get_frag, | 1673 | [SIOCGIWFRAG -SIOCIWFIRST] = (iw_handler) ray_get_frag, |
1674 | }; | 1674 | }; |
1675 | 1675 | ||
1676 | #define SIOCSIPFRAMING SIOCIWFIRSTPRIV /* Set framing mode */ | 1676 | #define SIOCSIPFRAMING SIOCIWFIRSTPRIV /* Set framing mode */ |
@@ -1678,9 +1678,9 @@ static const iw_handler ray_handler[] = { | |||
1678 | #define SIOCGIPCOUNTRY SIOCIWFIRSTPRIV + 3 /* Get country code */ | 1678 | #define SIOCGIPCOUNTRY SIOCIWFIRSTPRIV + 3 /* Get country code */ |
1679 | 1679 | ||
1680 | static const iw_handler ray_private_handler[] = { | 1680 | static const iw_handler ray_private_handler[] = { |
1681 | [0] (iw_handler) ray_set_framing, | 1681 | [0] = (iw_handler) ray_set_framing, |
1682 | [1] (iw_handler) ray_get_framing, | 1682 | [1] = (iw_handler) ray_get_framing, |
1683 | [3] (iw_handler) ray_get_country, | 1683 | [3] = (iw_handler) ray_get_country, |
1684 | }; | 1684 | }; |
1685 | 1685 | ||
1686 | static const struct iw_priv_args ray_private_args[] = { | 1686 | static const struct iw_priv_args ray_private_args[] = { |
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 39c6cdf7f3f7..b1bbc8e8e91f 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -22,58 +22,23 @@ | |||
22 | #define PFX DRIVER_NAME ": " | 22 | #define PFX DRIVER_NAME ": " |
23 | 23 | ||
24 | #include <linux/config.h> | 24 | #include <linux/config.h> |
25 | #ifdef __IN_PCMCIA_PACKAGE__ | ||
26 | #include <pcmcia/k_compat.h> | ||
27 | #endif /* __IN_PCMCIA_PACKAGE__ */ | ||
28 | |||
29 | #include <linux/module.h> | 25 | #include <linux/module.h> |
30 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
31 | #include <linux/init.h> | 27 | #include <linux/init.h> |
32 | #include <linux/sched.h> | 28 | #include <linux/delay.h> |
33 | #include <linux/ptrace.h> | 29 | #include <linux/firmware.h> |
34 | #include <linux/slab.h> | ||
35 | #include <linux/string.h> | ||
36 | #include <linux/ioport.h> | ||
37 | #include <linux/netdevice.h> | ||
38 | #include <linux/if_arp.h> | ||
39 | #include <linux/etherdevice.h> | ||
40 | #include <linux/wireless.h> | ||
41 | |||
42 | #include <pcmcia/cs_types.h> | 30 | #include <pcmcia/cs_types.h> |
43 | #include <pcmcia/cs.h> | 31 | #include <pcmcia/cs.h> |
44 | #include <pcmcia/cistpl.h> | 32 | #include <pcmcia/cistpl.h> |
45 | #include <pcmcia/cisreg.h> | 33 | #include <pcmcia/cisreg.h> |
46 | #include <pcmcia/ds.h> | 34 | #include <pcmcia/ds.h> |
47 | 35 | ||
48 | #include <asm/uaccess.h> | ||
49 | #include <asm/io.h> | ||
50 | #include <asm/system.h> | ||
51 | |||
52 | #include "orinoco.h" | 36 | #include "orinoco.h" |
53 | 37 | ||
54 | /* | ||
55 | * If SPECTRUM_FW_INCLUDED is defined, the firmware is hardcoded into | ||
56 | * the driver. Use get_symbol_fw script to generate spectrum_fw.h and | ||
57 | * copy it to the same directory as spectrum_cs.c. | ||
58 | * | ||
59 | * If SPECTRUM_FW_INCLUDED is not defined, the firmware is loaded at the | ||
60 | * runtime using hotplug. Use the same get_symbol_fw script to generate | ||
61 | * files symbol_sp24t_prim_fw symbol_sp24t_sec_fw, copy them to the | ||
62 | * hotplug firmware directory (typically /usr/lib/hotplug/firmware) and | ||
63 | * make sure that you have hotplug installed and enabled in the kernel. | ||
64 | */ | ||
65 | /* #define SPECTRUM_FW_INCLUDED 1 */ | ||
66 | |||
67 | #ifdef SPECTRUM_FW_INCLUDED | ||
68 | /* Header with the firmware */ | ||
69 | #include "spectrum_fw.h" | ||
70 | #else /* !SPECTRUM_FW_INCLUDED */ | ||
71 | #include <linux/firmware.h> | ||
72 | static unsigned char *primsym; | 38 | static unsigned char *primsym; |
73 | static unsigned char *secsym; | 39 | static unsigned char *secsym; |
74 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; | 40 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; |
75 | static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; | 41 | static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; |
76 | #endif /* !SPECTRUM_FW_INCLUDED */ | ||
77 | 42 | ||
78 | /********************************************************************/ | 43 | /********************************************************************/ |
79 | /* Module stuff */ | 44 | /* Module stuff */ |
@@ -124,17 +89,8 @@ static dev_link_t *dev_list; /* = NULL */ | |||
124 | /* Function prototypes */ | 89 | /* Function prototypes */ |
125 | /********************************************************************/ | 90 | /********************************************************************/ |
126 | 91 | ||
127 | /* device methods */ | 92 | static void spectrum_cs_release(dev_link_t *link); |
128 | static int spectrum_cs_hard_reset(struct orinoco_private *priv); | 93 | static void spectrum_cs_detach(dev_link_t *link); |
129 | |||
130 | /* PCMCIA gumpf */ | ||
131 | static void spectrum_cs_config(dev_link_t * link); | ||
132 | static void spectrum_cs_release(dev_link_t * link); | ||
133 | static int spectrum_cs_event(event_t event, int priority, | ||
134 | event_callback_args_t * args); | ||
135 | |||
136 | static dev_link_t *spectrum_cs_attach(void); | ||
137 | static void spectrum_cs_detach(dev_link_t *); | ||
138 | 94 | ||
139 | /********************************************************************/ | 95 | /********************************************************************/ |
140 | /* Firmware downloader */ | 96 | /* Firmware downloader */ |
@@ -182,8 +138,8 @@ static void spectrum_cs_detach(dev_link_t *); | |||
182 | * Each block has the following structure. | 138 | * Each block has the following structure. |
183 | */ | 139 | */ |
184 | struct dblock { | 140 | struct dblock { |
185 | u32 _addr; /* adapter address where to write the block */ | 141 | __le32 _addr; /* adapter address where to write the block */ |
186 | u16 _len; /* length of the data only, in bytes */ | 142 | __le16 _len; /* length of the data only, in bytes */ |
187 | char data[0]; /* data to be written */ | 143 | char data[0]; /* data to be written */ |
188 | } __attribute__ ((packed)); | 144 | } __attribute__ ((packed)); |
189 | 145 | ||
@@ -193,9 +149,9 @@ struct dblock { | |||
193 | * items with matching ID should be written. | 149 | * items with matching ID should be written. |
194 | */ | 150 | */ |
195 | struct pdr { | 151 | struct pdr { |
196 | u32 _id; /* record ID */ | 152 | __le32 _id; /* record ID */ |
197 | u32 _addr; /* adapter address where to write the data */ | 153 | __le32 _addr; /* adapter address where to write the data */ |
198 | u32 _len; /* expected length of the data, in bytes */ | 154 | __le32 _len; /* expected length of the data, in bytes */ |
199 | char next[0]; /* next PDR starts here */ | 155 | char next[0]; /* next PDR starts here */ |
200 | } __attribute__ ((packed)); | 156 | } __attribute__ ((packed)); |
201 | 157 | ||
@@ -206,8 +162,8 @@ struct pdr { | |||
206 | * be plugged into the secondary firmware. | 162 | * be plugged into the secondary firmware. |
207 | */ | 163 | */ |
208 | struct pdi { | 164 | struct pdi { |
209 | u16 _len; /* length of ID and data, in words */ | 165 | __le16 _len; /* length of ID and data, in words */ |
210 | u16 _id; /* record ID */ | 166 | __le16 _id; /* record ID */ |
211 | char data[0]; /* plug data */ | 167 | char data[0]; /* plug data */ |
212 | } __attribute__ ((packed));; | 168 | } __attribute__ ((packed));; |
213 | 169 | ||
@@ -414,7 +370,7 @@ spectrum_plug_pdi(hermes_t *hw, struct pdr *first_pdr, struct pdi *pdi) | |||
414 | 370 | ||
415 | /* Read PDA from the adapter */ | 371 | /* Read PDA from the adapter */ |
416 | static int | 372 | static int |
417 | spectrum_read_pda(hermes_t *hw, u16 *pda, int pda_len) | 373 | spectrum_read_pda(hermes_t *hw, __le16 *pda, int pda_len) |
418 | { | 374 | { |
419 | int ret; | 375 | int ret; |
420 | int pda_size; | 376 | int pda_size; |
@@ -445,7 +401,7 @@ spectrum_read_pda(hermes_t *hw, u16 *pda, int pda_len) | |||
445 | /* Parse PDA and write the records into the adapter */ | 401 | /* Parse PDA and write the records into the adapter */ |
446 | static int | 402 | static int |
447 | spectrum_apply_pda(hermes_t *hw, const struct dblock *first_block, | 403 | spectrum_apply_pda(hermes_t *hw, const struct dblock *first_block, |
448 | u16 *pda) | 404 | __le16 *pda) |
449 | { | 405 | { |
450 | int ret; | 406 | int ret; |
451 | struct pdi *pdi; | 407 | struct pdi *pdi; |
@@ -511,7 +467,7 @@ spectrum_dl_image(hermes_t *hw, dev_link_t *link, | |||
511 | const struct dblock *first_block; | 467 | const struct dblock *first_block; |
512 | 468 | ||
513 | /* Plug Data Area (PDA) */ | 469 | /* Plug Data Area (PDA) */ |
514 | u16 pda[PDA_WORDS]; | 470 | __le16 pda[PDA_WORDS]; |
515 | 471 | ||
516 | /* Binary block begins after the 0x1A marker */ | 472 | /* Binary block begins after the 0x1A marker */ |
517 | ptr = image; | 473 | ptr = image; |
@@ -571,8 +527,6 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link) | |||
571 | { | 527 | { |
572 | int ret; | 528 | int ret; |
573 | client_handle_t handle = link->handle; | 529 | client_handle_t handle = link->handle; |
574 | |||
575 | #ifndef SPECTRUM_FW_INCLUDED | ||
576 | const struct firmware *fw_entry; | 530 | const struct firmware *fw_entry; |
577 | 531 | ||
578 | if (request_firmware(&fw_entry, primary_fw_name, | 532 | if (request_firmware(&fw_entry, primary_fw_name, |
@@ -592,7 +546,6 @@ spectrum_dl_firmware(hermes_t *hw, dev_link_t *link) | |||
592 | secondary_fw_name); | 546 | secondary_fw_name); |
593 | return -ENOENT; | 547 | return -ENOENT; |
594 | } | 548 | } |
595 | #endif | ||
596 | 549 | ||
597 | /* Load primary firmware */ | 550 | /* Load primary firmware */ |
598 | ret = spectrum_dl_image(hw, link, primsym); | 551 | ret = spectrum_dl_image(hw, link, primsym); |
@@ -1085,7 +1038,7 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION | |||
1085 | static struct pcmcia_device_id spectrum_cs_ids[] = { | 1038 | static struct pcmcia_device_id spectrum_cs_ids[] = { |
1086 | PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4100 */ | 1039 | PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4100 */ |
1087 | PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ | 1040 | PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ |
1088 | PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0001), /* Intel PRO/Wireless 2011B */ | 1041 | PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless LAN PC Card", 0x816cc815, 0x6fbf459a), /* 2011B, not 2011 */ |
1089 | PCMCIA_DEVICE_NULL, | 1042 | PCMCIA_DEVICE_NULL, |
1090 | }; | 1043 | }; |
1091 | MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids); | 1044 | MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids); |
@@ -1096,8 +1049,8 @@ static struct pcmcia_driver orinoco_driver = { | |||
1096 | .name = DRIVER_NAME, | 1049 | .name = DRIVER_NAME, |
1097 | }, | 1050 | }, |
1098 | .attach = spectrum_cs_attach, | 1051 | .attach = spectrum_cs_attach, |
1099 | .event = spectrum_cs_event, | ||
1100 | .detach = spectrum_cs_detach, | 1052 | .detach = spectrum_cs_detach, |
1053 | .event = spectrum_cs_event, | ||
1101 | .id_table = spectrum_cs_ids, | 1054 | .id_table = spectrum_cs_ids, |
1102 | }; | 1055 | }; |
1103 | 1056 | ||
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c index 7a5e20a17890..b0d8b5b03152 100644 --- a/drivers/net/wireless/wavelan.c +++ b/drivers/net/wireless/wavelan.c | |||
@@ -430,7 +430,6 @@ static void fee_read(unsigned long ioaddr, /* I/O port of the card */ | |||
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
433 | #ifdef WIRELESS_EXT /* if the wireless extension exists in the kernel */ | ||
434 | 433 | ||
435 | /*------------------------------------------------------------------*/ | 434 | /*------------------------------------------------------------------*/ |
436 | /* | 435 | /* |
@@ -514,7 +513,6 @@ static void fee_write(unsigned long ioaddr, /* I/O port of the card */ | |||
514 | fee_wait(ioaddr, 10, 100); | 513 | fee_wait(ioaddr, 10, 100); |
515 | #endif /* EEPROM_IS_PROTECTED */ | 514 | #endif /* EEPROM_IS_PROTECTED */ |
516 | } | 515 | } |
517 | #endif /* WIRELESS_EXT */ | ||
518 | 516 | ||
519 | /************************ I82586 SUBROUTINES *************************/ | 517 | /************************ I82586 SUBROUTINES *************************/ |
520 | /* | 518 | /* |
@@ -973,11 +971,9 @@ static void wv_mmc_show(struct net_device * dev) | |||
973 | mmc_read(ioaddr, 0, (u8 *) & m, sizeof(m)); | 971 | mmc_read(ioaddr, 0, (u8 *) & m, sizeof(m)); |
974 | mmc_out(ioaddr, mmwoff(0, mmw_freeze), 0); | 972 | mmc_out(ioaddr, mmwoff(0, mmw_freeze), 0); |
975 | 973 | ||
976 | #ifdef WIRELESS_EXT /* if wireless extension exists in the kernel */ | ||
977 | /* Don't forget to update statistics */ | 974 | /* Don't forget to update statistics */ |
978 | lp->wstats.discard.nwid += | 975 | lp->wstats.discard.nwid += |
979 | (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l; | 976 | (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l; |
980 | #endif /* WIRELESS_EXT */ | ||
981 | 977 | ||
982 | printk(KERN_DEBUG "##### WaveLAN modem status registers: #####\n"); | 978 | printk(KERN_DEBUG "##### WaveLAN modem status registers: #####\n"); |
983 | #ifdef DEBUG_SHOW_UNUSED | 979 | #ifdef DEBUG_SHOW_UNUSED |
@@ -1499,7 +1495,6 @@ static int wavelan_set_mac_address(struct net_device * dev, void *addr) | |||
1499 | } | 1495 | } |
1500 | #endif /* SET_MAC_ADDRESS */ | 1496 | #endif /* SET_MAC_ADDRESS */ |
1501 | 1497 | ||
1502 | #ifdef WIRELESS_EXT /* if wireless extensions exist in the kernel */ | ||
1503 | 1498 | ||
1504 | /*------------------------------------------------------------------*/ | 1499 | /*------------------------------------------------------------------*/ |
1505 | /* | 1500 | /* |
@@ -2473,7 +2468,6 @@ static iw_stats *wavelan_get_wireless_stats(struct net_device * dev) | |||
2473 | #endif | 2468 | #endif |
2474 | return &lp->wstats; | 2469 | return &lp->wstats; |
2475 | } | 2470 | } |
2476 | #endif /* WIRELESS_EXT */ | ||
2477 | 2471 | ||
2478 | /************************* PACKET RECEPTION *************************/ | 2472 | /************************* PACKET RECEPTION *************************/ |
2479 | /* | 2473 | /* |
@@ -4194,11 +4188,9 @@ static int __init wavelan_config(struct net_device *dev, unsigned short ioaddr) | |||
4194 | dev->set_mac_address = &wavelan_set_mac_address; | 4188 | dev->set_mac_address = &wavelan_set_mac_address; |
4195 | #endif /* SET_MAC_ADDRESS */ | 4189 | #endif /* SET_MAC_ADDRESS */ |
4196 | 4190 | ||
4197 | #ifdef WIRELESS_EXT /* if wireless extension exists in the kernel */ | ||
4198 | dev->wireless_handlers = &wavelan_handler_def; | 4191 | dev->wireless_handlers = &wavelan_handler_def; |
4199 | lp->wireless_data.spy_data = &lp->spy_data; | 4192 | lp->wireless_data.spy_data = &lp->spy_data; |
4200 | dev->wireless_data = &lp->wireless_data; | 4193 | dev->wireless_data = &lp->wireless_data; |
4201 | #endif | ||
4202 | 4194 | ||
4203 | dev->mtu = WAVELAN_MTU; | 4195 | dev->mtu = WAVELAN_MTU; |
4204 | 4196 | ||
diff --git a/drivers/net/wireless/wavelan.p.h b/drivers/net/wireless/wavelan.p.h index 509ff22a6caa..166e28b9a4f7 100644 --- a/drivers/net/wireless/wavelan.p.h +++ b/drivers/net/wireless/wavelan.p.h | |||
@@ -409,11 +409,9 @@ | |||
409 | #define MULTICAST_AVOID /* Avoid extra multicast (I'm sceptical). */ | 409 | #define MULTICAST_AVOID /* Avoid extra multicast (I'm sceptical). */ |
410 | #undef SET_MAC_ADDRESS /* Experimental */ | 410 | #undef SET_MAC_ADDRESS /* Experimental */ |
411 | 411 | ||
412 | #ifdef WIRELESS_EXT /* If wireless extensions exist in the kernel */ | ||
413 | /* Warning: this stuff will slow down the driver. */ | 412 | /* Warning: this stuff will slow down the driver. */ |
414 | #define WIRELESS_SPY /* Enable spying addresses. */ | 413 | #define WIRELESS_SPY /* Enable spying addresses. */ |
415 | #undef HISTOGRAM /* Enable histogram of signal level. */ | 414 | #undef HISTOGRAM /* Enable histogram of signal level. */ |
416 | #endif | ||
417 | 415 | ||
418 | /****************************** DEBUG ******************************/ | 416 | /****************************** DEBUG ******************************/ |
419 | 417 | ||
@@ -506,12 +504,10 @@ struct net_local | |||
506 | u_short tx_first_free; | 504 | u_short tx_first_free; |
507 | u_short tx_first_in_use; | 505 | u_short tx_first_in_use; |
508 | 506 | ||
509 | #ifdef WIRELESS_EXT | ||
510 | iw_stats wstats; /* Wireless-specific statistics */ | 507 | iw_stats wstats; /* Wireless-specific statistics */ |
511 | 508 | ||
512 | struct iw_spy_data spy_data; | 509 | struct iw_spy_data spy_data; |
513 | struct iw_public_data wireless_data; | 510 | struct iw_public_data wireless_data; |
514 | #endif | ||
515 | 511 | ||
516 | #ifdef HISTOGRAM | 512 | #ifdef HISTOGRAM |
517 | int his_number; /* number of intervals */ | 513 | int his_number; /* number of intervals */ |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 183c4732ef65..4b3c98f5c564 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -415,7 +415,6 @@ fee_read(u_long base, /* i/o port of the card */ | |||
415 | } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | #ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */ | ||
419 | 418 | ||
420 | /*------------------------------------------------------------------*/ | 419 | /*------------------------------------------------------------------*/ |
421 | /* | 420 | /* |
@@ -500,7 +499,6 @@ fee_write(u_long base, /* i/o port of the card */ | |||
500 | fee_wait(base, 10, 100); | 499 | fee_wait(base, 10, 100); |
501 | #endif /* EEPROM_IS_PROTECTED */ | 500 | #endif /* EEPROM_IS_PROTECTED */ |
502 | } | 501 | } |
503 | #endif /* WIRELESS_EXT */ | ||
504 | 502 | ||
505 | /******************* WaveLAN Roaming routines... ********************/ | 503 | /******************* WaveLAN Roaming routines... ********************/ |
506 | 504 | ||
@@ -1161,10 +1159,8 @@ wv_mmc_show(struct net_device * dev) | |||
1161 | mmc_read(base, 0, (u_char *)&m, sizeof(m)); | 1159 | mmc_read(base, 0, (u_char *)&m, sizeof(m)); |
1162 | mmc_out(base, mmwoff(0, mmw_freeze), 0); | 1160 | mmc_out(base, mmwoff(0, mmw_freeze), 0); |
1163 | 1161 | ||
1164 | #ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */ | ||
1165 | /* Don't forget to update statistics */ | 1162 | /* Don't forget to update statistics */ |
1166 | lp->wstats.discard.nwid += (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l; | 1163 | lp->wstats.discard.nwid += (m.mmr_wrong_nwid_h << 8) | m.mmr_wrong_nwid_l; |
1167 | #endif /* WIRELESS_EXT */ | ||
1168 | 1164 | ||
1169 | spin_unlock_irqrestore(&lp->spinlock, flags); | 1165 | spin_unlock_irqrestore(&lp->spinlock, flags); |
1170 | 1166 | ||
@@ -1550,7 +1546,6 @@ wavelan_set_mac_address(struct net_device * dev, | |||
1550 | } | 1546 | } |
1551 | #endif /* SET_MAC_ADDRESS */ | 1547 | #endif /* SET_MAC_ADDRESS */ |
1552 | 1548 | ||
1553 | #ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */ | ||
1554 | 1549 | ||
1555 | /*------------------------------------------------------------------*/ | 1550 | /*------------------------------------------------------------------*/ |
1556 | /* | 1551 | /* |
@@ -2793,7 +2788,6 @@ wavelan_get_wireless_stats(struct net_device * dev) | |||
2793 | #endif | 2788 | #endif |
2794 | return &lp->wstats; | 2789 | return &lp->wstats; |
2795 | } | 2790 | } |
2796 | #endif /* WIRELESS_EXT */ | ||
2797 | 2791 | ||
2798 | /************************* PACKET RECEPTION *************************/ | 2792 | /************************* PACKET RECEPTION *************************/ |
2799 | /* | 2793 | /* |
@@ -4679,11 +4673,9 @@ wavelan_attach(void) | |||
4679 | dev->watchdog_timeo = WATCHDOG_JIFFIES; | 4673 | dev->watchdog_timeo = WATCHDOG_JIFFIES; |
4680 | SET_ETHTOOL_OPS(dev, &ops); | 4674 | SET_ETHTOOL_OPS(dev, &ops); |
4681 | 4675 | ||
4682 | #ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */ | ||
4683 | dev->wireless_handlers = &wavelan_handler_def; | 4676 | dev->wireless_handlers = &wavelan_handler_def; |
4684 | lp->wireless_data.spy_data = &lp->spy_data; | 4677 | lp->wireless_data.spy_data = &lp->spy_data; |
4685 | dev->wireless_data = &lp->wireless_data; | 4678 | dev->wireless_data = &lp->wireless_data; |
4686 | #endif | ||
4687 | 4679 | ||
4688 | /* Other specific data */ | 4680 | /* Other specific data */ |
4689 | dev->mtu = WAVELAN_MTU; | 4681 | dev->mtu = WAVELAN_MTU; |
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h index 01d882be8790..724a715089c9 100644 --- a/drivers/net/wireless/wavelan_cs.p.h +++ b/drivers/net/wireless/wavelan_cs.p.h | |||
@@ -472,11 +472,9 @@ | |||
472 | #define MULTICAST_AVOID /* Avoid extra multicast (I'm sceptical) */ | 472 | #define MULTICAST_AVOID /* Avoid extra multicast (I'm sceptical) */ |
473 | #undef SET_MAC_ADDRESS /* Experimental */ | 473 | #undef SET_MAC_ADDRESS /* Experimental */ |
474 | 474 | ||
475 | #ifdef WIRELESS_EXT /* If wireless extension exist in the kernel */ | ||
476 | /* Warning : these stuff will slow down the driver... */ | 475 | /* Warning : these stuff will slow down the driver... */ |
477 | #define WIRELESS_SPY /* Enable spying addresses */ | 476 | #define WIRELESS_SPY /* Enable spying addresses */ |
478 | #undef HISTOGRAM /* Enable histogram of sig level... */ | 477 | #undef HISTOGRAM /* Enable histogram of sig level... */ |
479 | #endif | ||
480 | 478 | ||
481 | /****************************** DEBUG ******************************/ | 479 | /****************************** DEBUG ******************************/ |
482 | 480 | ||
@@ -624,12 +622,10 @@ struct net_local | |||
624 | int rfp; /* Last DMA machine receive pointer */ | 622 | int rfp; /* Last DMA machine receive pointer */ |
625 | int overrunning; /* Receiver overrun flag */ | 623 | int overrunning; /* Receiver overrun flag */ |
626 | 624 | ||
627 | #ifdef WIRELESS_EXT | ||
628 | iw_stats wstats; /* Wireless specific stats */ | 625 | iw_stats wstats; /* Wireless specific stats */ |
629 | 626 | ||
630 | struct iw_spy_data spy_data; | 627 | struct iw_spy_data spy_data; |
631 | struct iw_public_data wireless_data; | 628 | struct iw_public_data wireless_data; |
632 | #endif | ||
633 | 629 | ||
634 | #ifdef HISTOGRAM | 630 | #ifdef HISTOGRAM |
635 | int his_number; /* Number of intervals */ | 631 | int his_number; /* Number of intervals */ |
diff --git a/drivers/net/wireless/wl3501.h b/drivers/net/wireless/wl3501.h index 7fcbe589c3f2..4303c50c2ab6 100644 --- a/drivers/net/wireless/wl3501.h +++ b/drivers/net/wireless/wl3501.h | |||
@@ -548,7 +548,7 @@ struct wl3501_80211_tx_plcp_hdr { | |||
548 | 548 | ||
549 | struct wl3501_80211_tx_hdr { | 549 | struct wl3501_80211_tx_hdr { |
550 | struct wl3501_80211_tx_plcp_hdr pclp_hdr; | 550 | struct wl3501_80211_tx_plcp_hdr pclp_hdr; |
551 | struct ieee80211_hdr mac_hdr; | 551 | struct ieee80211_hdr_4addr mac_hdr; |
552 | } __attribute__ ((packed)); | 552 | } __attribute__ ((packed)); |
553 | 553 | ||
554 | /* | 554 | /* |
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index 0e98a9d9834c..a3bd91a61827 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c | |||
@@ -836,7 +836,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, size_t size, | |||
836 | * This function implements the pci_alloc_consistent function. | 836 | * This function implements the pci_alloc_consistent function. |
837 | */ | 837 | */ |
838 | static void * | 838 | static void * |
839 | ccio_alloc_consistent(struct device *dev, size_t size, dma_addr_t *dma_handle, int flag) | 839 | ccio_alloc_consistent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag) |
840 | { | 840 | { |
841 | void *ret; | 841 | void *ret; |
842 | #if 0 | 842 | #if 0 |
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index 82ea68b55df4..bd8b3e5a5cd7 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c | |||
@@ -986,7 +986,7 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size, | |||
986 | * See Documentation/DMA-mapping.txt | 986 | * See Documentation/DMA-mapping.txt |
987 | */ | 987 | */ |
988 | static void *sba_alloc_consistent(struct device *hwdev, size_t size, | 988 | static void *sba_alloc_consistent(struct device *hwdev, size_t size, |
989 | dma_addr_t *dma_handle, int gfp) | 989 | dma_addr_t *dma_handle, gfp_t gfp) |
990 | { | 990 | { |
991 | void *ret; | 991 | void *ret; |
992 | 992 | ||
diff --git a/drivers/pci/.gitignore b/drivers/pci/.gitignore new file mode 100644 index 000000000000..f297ca8d313e --- /dev/null +++ b/drivers/pci/.gitignore | |||
@@ -0,0 +1,4 @@ | |||
1 | classlist.h | ||
2 | devlist.h | ||
3 | gen-devlist | ||
4 | |||
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index a6a630a950d0..7992bc8cc6a4 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -241,7 +241,8 @@ static void __devinit quirk_s3_64M(struct pci_dev *dev) | |||
241 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_868, quirk_s3_64M ); | 241 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_868, quirk_s3_64M ); |
242 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_968, quirk_s3_64M ); | 242 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_968, quirk_s3_64M ); |
243 | 243 | ||
244 | static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region, unsigned size, int nr) | 244 | static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region, |
245 | unsigned size, int nr, const char *name) | ||
245 | { | 246 | { |
246 | region &= ~(size-1); | 247 | region &= ~(size-1); |
247 | if (region) { | 248 | if (region) { |
@@ -259,6 +260,7 @@ static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region, unsi | |||
259 | pcibios_bus_to_resource(dev, res, &bus_region); | 260 | pcibios_bus_to_resource(dev, res, &bus_region); |
260 | 261 | ||
261 | pci_claim_resource(dev, nr); | 262 | pci_claim_resource(dev, nr); |
263 | printk("PCI quirk: region %04x-%04x claimed by %s\n", region, region + size - 1, name); | ||
262 | } | 264 | } |
263 | } | 265 | } |
264 | 266 | ||
@@ -291,25 +293,98 @@ static void __devinit quirk_ali7101_acpi(struct pci_dev *dev) | |||
291 | u16 region; | 293 | u16 region; |
292 | 294 | ||
293 | pci_read_config_word(dev, 0xE0, ®ion); | 295 | pci_read_config_word(dev, 0xE0, ®ion); |
294 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES); | 296 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI"); |
295 | pci_read_config_word(dev, 0xE2, ®ion); | 297 | pci_read_config_word(dev, 0xE2, ®ion); |
296 | quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1); | 298 | quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB"); |
297 | } | 299 | } |
298 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, quirk_ali7101_acpi ); | 300 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, quirk_ali7101_acpi ); |
299 | 301 | ||
302 | static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable) | ||
303 | { | ||
304 | u32 devres; | ||
305 | u32 mask, size, base; | ||
306 | |||
307 | pci_read_config_dword(dev, port, &devres); | ||
308 | if ((devres & enable) != enable) | ||
309 | return; | ||
310 | mask = (devres >> 16) & 15; | ||
311 | base = devres & 0xffff; | ||
312 | size = 16; | ||
313 | for (;;) { | ||
314 | unsigned bit = size >> 1; | ||
315 | if ((bit & mask) == bit) | ||
316 | break; | ||
317 | size = bit; | ||
318 | } | ||
319 | /* | ||
320 | * For now we only print it out. Eventually we'll want to | ||
321 | * reserve it (at least if it's in the 0x1000+ range), but | ||
322 | * let's get enough confirmation reports first. | ||
323 | */ | ||
324 | base &= -size; | ||
325 | printk("%s PIO at %04x-%04x\n", name, base, base + size - 1); | ||
326 | } | ||
327 | |||
328 | static void piix4_mem_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable) | ||
329 | { | ||
330 | u32 devres; | ||
331 | u32 mask, size, base; | ||
332 | |||
333 | pci_read_config_dword(dev, port, &devres); | ||
334 | if ((devres & enable) != enable) | ||
335 | return; | ||
336 | base = devres & 0xffff0000; | ||
337 | mask = (devres & 0x3f) << 16; | ||
338 | size = 128 << 16; | ||
339 | for (;;) { | ||
340 | unsigned bit = size >> 1; | ||
341 | if ((bit & mask) == bit) | ||
342 | break; | ||
343 | size = bit; | ||
344 | } | ||
345 | /* | ||
346 | * For now we only print it out. Eventually we'll want to | ||
347 | * reserve it, but let's get enough confirmation reports first. | ||
348 | */ | ||
349 | base &= -size; | ||
350 | printk("%s MMIO at %04x-%04x\n", name, base, base + size - 1); | ||
351 | } | ||
352 | |||
300 | /* | 353 | /* |
301 | * PIIX4 ACPI: Two IO regions pointed to by longwords at | 354 | * PIIX4 ACPI: Two IO regions pointed to by longwords at |
302 | * 0x40 (64 bytes of ACPI registers) | 355 | * 0x40 (64 bytes of ACPI registers) |
303 | * 0x90 (32 bytes of SMB registers) | 356 | * 0x90 (32 bytes of SMB registers) |
357 | * and a few strange programmable PIIX4 device resources. | ||
304 | */ | 358 | */ |
305 | static void __devinit quirk_piix4_acpi(struct pci_dev *dev) | 359 | static void __devinit quirk_piix4_acpi(struct pci_dev *dev) |
306 | { | 360 | { |
307 | u32 region; | 361 | u32 region, res_a; |
308 | 362 | ||
309 | pci_read_config_dword(dev, 0x40, ®ion); | 363 | pci_read_config_dword(dev, 0x40, ®ion); |
310 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES); | 364 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "PIIX4 ACPI"); |
311 | pci_read_config_dword(dev, 0x90, ®ion); | 365 | pci_read_config_dword(dev, 0x90, ®ion); |
312 | quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1); | 366 | quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1, "PIIX4 SMB"); |
367 | |||
368 | /* Device resource A has enables for some of the other ones */ | ||
369 | pci_read_config_dword(dev, 0x5c, &res_a); | ||
370 | |||
371 | piix4_io_quirk(dev, "PIIX4 devres B", 0x60, 3 << 21); | ||
372 | piix4_io_quirk(dev, "PIIX4 devres C", 0x64, 3 << 21); | ||
373 | |||
374 | /* Device resource D is just bitfields for static resources */ | ||
375 | |||
376 | /* Device 12 enabled? */ | ||
377 | if (res_a & (1 << 29)) { | ||
378 | piix4_io_quirk(dev, "PIIX4 devres E", 0x68, 1 << 20); | ||
379 | piix4_mem_quirk(dev, "PIIX4 devres F", 0x6c, 1 << 7); | ||
380 | } | ||
381 | /* Device 13 enabled? */ | ||
382 | if (res_a & (1 << 30)) { | ||
383 | piix4_io_quirk(dev, "PIIX4 devres G", 0x70, 1 << 20); | ||
384 | piix4_mem_quirk(dev, "PIIX4 devres H", 0x74, 1 << 7); | ||
385 | } | ||
386 | piix4_io_quirk(dev, "PIIX4 devres I", 0x78, 1 << 20); | ||
387 | piix4_io_quirk(dev, "PIIX4 devres J", 0x7c, 1 << 20); | ||
313 | } | 388 | } |
314 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi ); | 389 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi ); |
315 | 390 | ||
@@ -323,10 +398,10 @@ static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev) | |||
323 | u32 region; | 398 | u32 region; |
324 | 399 | ||
325 | pci_read_config_dword(dev, 0x40, ®ion); | 400 | pci_read_config_dword(dev, 0x40, ®ion); |
326 | quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES); | 401 | quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES, "ICH4 ACPI/GPIO/TCO"); |
327 | 402 | ||
328 | pci_read_config_dword(dev, 0x58, ®ion); | 403 | pci_read_config_dword(dev, 0x58, ®ion); |
329 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1); | 404 | quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1, "ICH4 GPIO"); |
330 | } | 405 | } |
331 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi ); | 406 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi ); |
332 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi ); | 407 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi ); |
@@ -352,7 +427,7 @@ static void __devinit quirk_vt82c586_acpi(struct pci_dev *dev) | |||
352 | if (rev & 0x10) { | 427 | if (rev & 0x10) { |
353 | pci_read_config_dword(dev, 0x48, ®ion); | 428 | pci_read_config_dword(dev, 0x48, ®ion); |
354 | region &= PCI_BASE_ADDRESS_IO_MASK; | 429 | region &= PCI_BASE_ADDRESS_IO_MASK; |
355 | quirk_io_region(dev, region, 256, PCI_BRIDGE_RESOURCES); | 430 | quirk_io_region(dev, region, 256, PCI_BRIDGE_RESOURCES, "vt82c586 ACPI"); |
356 | } | 431 | } |
357 | } | 432 | } |
358 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_vt82c586_acpi ); | 433 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_vt82c586_acpi ); |
@@ -372,11 +447,11 @@ static void __devinit quirk_vt82c686_acpi(struct pci_dev *dev) | |||
372 | 447 | ||
373 | pci_read_config_word(dev, 0x70, &hm); | 448 | pci_read_config_word(dev, 0x70, &hm); |
374 | hm &= PCI_BASE_ADDRESS_IO_MASK; | 449 | hm &= PCI_BASE_ADDRESS_IO_MASK; |
375 | quirk_io_region(dev, hm, 128, PCI_BRIDGE_RESOURCES + 1); | 450 | quirk_io_region(dev, hm, 128, PCI_BRIDGE_RESOURCES + 1, "vt82c868 HW-mon"); |
376 | 451 | ||
377 | pci_read_config_dword(dev, 0x90, &smb); | 452 | pci_read_config_dword(dev, 0x90, &smb); |
378 | smb &= PCI_BASE_ADDRESS_IO_MASK; | 453 | smb &= PCI_BASE_ADDRESS_IO_MASK; |
379 | quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 2); | 454 | quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 2, "vt82c868 SMB"); |
380 | } | 455 | } |
381 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi ); | 456 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi ); |
382 | 457 | ||
@@ -391,11 +466,11 @@ static void __devinit quirk_vt8235_acpi(struct pci_dev *dev) | |||
391 | 466 | ||
392 | pci_read_config_word(dev, 0x88, &pm); | 467 | pci_read_config_word(dev, 0x88, &pm); |
393 | pm &= PCI_BASE_ADDRESS_IO_MASK; | 468 | pm &= PCI_BASE_ADDRESS_IO_MASK; |
394 | quirk_io_region(dev, pm, 128, PCI_BRIDGE_RESOURCES); | 469 | quirk_io_region(dev, pm, 128, PCI_BRIDGE_RESOURCES, "vt8235 PM"); |
395 | 470 | ||
396 | pci_read_config_word(dev, 0xd0, &smb); | 471 | pci_read_config_word(dev, 0xd0, &smb); |
397 | smb &= PCI_BASE_ADDRESS_IO_MASK; | 472 | smb &= PCI_BASE_ADDRESS_IO_MASK; |
398 | quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 1); | 473 | quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 1, "vt8235 SMB"); |
399 | } | 474 | } |
400 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi); | 475 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi); |
401 | 476 | ||
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 657be948baf7..28ce3a7ee434 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -40,7 +40,7 @@ | |||
40 | * FIXME: IO should be max 256 bytes. However, since we may | 40 | * FIXME: IO should be max 256 bytes. However, since we may |
41 | * have a P2P bridge below a cardbus bridge, we need 4K. | 41 | * have a P2P bridge below a cardbus bridge, we need 4K. |
42 | */ | 42 | */ |
43 | #define CARDBUS_IO_SIZE (4*1024) | 43 | #define CARDBUS_IO_SIZE (256) |
44 | #define CARDBUS_MEM_SIZE (32*1024*1024) | 44 | #define CARDBUS_MEM_SIZE (32*1024*1024) |
45 | 45 | ||
46 | static void __devinit | 46 | static void __devinit |
diff --git a/drivers/s390/net/fsm.c b/drivers/s390/net/fsm.c index fa09440d82e5..38f50b7129a2 100644 --- a/drivers/s390/net/fsm.c +++ b/drivers/s390/net/fsm.c | |||
@@ -16,7 +16,7 @@ MODULE_LICENSE("GPL"); | |||
16 | 16 | ||
17 | fsm_instance * | 17 | fsm_instance * |
18 | init_fsm(char *name, const char **state_names, const char **event_names, int nr_states, | 18 | init_fsm(char *name, const char **state_names, const char **event_names, int nr_states, |
19 | int nr_events, const fsm_node *tmpl, int tmpl_len, int order) | 19 | int nr_events, const fsm_node *tmpl, int tmpl_len, gfp_t order) |
20 | { | 20 | { |
21 | int i; | 21 | int i; |
22 | fsm_instance *this; | 22 | fsm_instance *this; |
diff --git a/drivers/s390/net/fsm.h b/drivers/s390/net/fsm.h index f9a011001eb6..1b8a7e7c34f3 100644 --- a/drivers/s390/net/fsm.h +++ b/drivers/s390/net/fsm.h | |||
@@ -110,7 +110,7 @@ extern fsm_instance * | |||
110 | init_fsm(char *name, const char **state_names, | 110 | init_fsm(char *name, const char **state_names, |
111 | const char **event_names, | 111 | const char **event_names, |
112 | int nr_states, int nr_events, const fsm_node *tmpl, | 112 | int nr_states, int nr_events, const fsm_node *tmpl, |
113 | int tmpl_len, int order); | 113 | int tmpl_len, gfp_t order); |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * Releases an FSM | 116 | * Releases an FSM |
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h index 9963479ba89f..38a2441564d7 100644 --- a/drivers/s390/net/qeth.h +++ b/drivers/s390/net/qeth.h | |||
@@ -275,6 +275,10 @@ qeth_is_ipa_enabled(struct qeth_ipa_info *ipa, enum qeth_ipa_funcs func) | |||
275 | QETH_IDX_FUNC_LEVEL_IQD_ENA_IPAT, \ | 275 | QETH_IDX_FUNC_LEVEL_IQD_ENA_IPAT, \ |
276 | QETH_IDX_FUNC_LEVEL_IQD_DIS_IPAT, \ | 276 | QETH_IDX_FUNC_LEVEL_IQD_DIS_IPAT, \ |
277 | QETH_MAX_QUEUES,0x103}, \ | 277 | QETH_MAX_QUEUES,0x103}, \ |
278 | {0x1731,0x06,0x1732,0x06,QETH_CARD_TYPE_OSN,0, \ | ||
279 | QETH_IDX_FUNC_LEVEL_OSAE_ENA_IPAT, \ | ||
280 | QETH_IDX_FUNC_LEVEL_OSAE_DIS_IPAT, \ | ||
281 | QETH_MAX_QUEUES,0}, \ | ||
278 | {0,0,0,0,0,0,0,0,0}} | 282 | {0,0,0,0,0,0,0,0,0}} |
279 | 283 | ||
280 | #define QETH_REAL_CARD 1 | 284 | #define QETH_REAL_CARD 1 |
@@ -363,10 +367,22 @@ struct qeth_hdr_layer2 { | |||
363 | __u8 reserved2[16]; | 367 | __u8 reserved2[16]; |
364 | } __attribute__ ((packed)); | 368 | } __attribute__ ((packed)); |
365 | 369 | ||
370 | struct qeth_hdr_osn { | ||
371 | __u8 id; | ||
372 | __u8 reserved; | ||
373 | __u16 seq_no; | ||
374 | __u16 reserved2; | ||
375 | __u16 control_flags; | ||
376 | __u16 pdu_length; | ||
377 | __u8 reserved3[18]; | ||
378 | __u32 ccid; | ||
379 | } __attribute__ ((packed)); | ||
380 | |||
366 | struct qeth_hdr { | 381 | struct qeth_hdr { |
367 | union { | 382 | union { |
368 | struct qeth_hdr_layer2 l2; | 383 | struct qeth_hdr_layer2 l2; |
369 | struct qeth_hdr_layer3 l3; | 384 | struct qeth_hdr_layer3 l3; |
385 | struct qeth_hdr_osn osn; | ||
370 | } hdr; | 386 | } hdr; |
371 | } __attribute__ ((packed)); | 387 | } __attribute__ ((packed)); |
372 | 388 | ||
@@ -413,6 +429,7 @@ enum qeth_header_ids { | |||
413 | QETH_HEADER_TYPE_LAYER3 = 0x01, | 429 | QETH_HEADER_TYPE_LAYER3 = 0x01, |
414 | QETH_HEADER_TYPE_LAYER2 = 0x02, | 430 | QETH_HEADER_TYPE_LAYER2 = 0x02, |
415 | QETH_HEADER_TYPE_TSO = 0x03, | 431 | QETH_HEADER_TYPE_TSO = 0x03, |
432 | QETH_HEADER_TYPE_OSN = 0x04, | ||
416 | }; | 433 | }; |
417 | /* flags for qeth_hdr.ext_flags */ | 434 | /* flags for qeth_hdr.ext_flags */ |
418 | #define QETH_HDR_EXT_VLAN_FRAME 0x01 | 435 | #define QETH_HDR_EXT_VLAN_FRAME 0x01 |
@@ -582,7 +599,6 @@ enum qeth_card_states { | |||
582 | * Protocol versions | 599 | * Protocol versions |
583 | */ | 600 | */ |
584 | enum qeth_prot_versions { | 601 | enum qeth_prot_versions { |
585 | QETH_PROT_SNA = 0x0001, | ||
586 | QETH_PROT_IPV4 = 0x0004, | 602 | QETH_PROT_IPV4 = 0x0004, |
587 | QETH_PROT_IPV6 = 0x0006, | 603 | QETH_PROT_IPV6 = 0x0006, |
588 | }; | 604 | }; |
@@ -761,6 +777,11 @@ enum qeth_threads { | |||
761 | QETH_RECOVER_THREAD = 2, | 777 | QETH_RECOVER_THREAD = 2, |
762 | }; | 778 | }; |
763 | 779 | ||
780 | struct qeth_osn_info { | ||
781 | int (*assist_cb)(struct net_device *dev, void *data); | ||
782 | int (*data_cb)(struct sk_buff *skb); | ||
783 | }; | ||
784 | |||
764 | struct qeth_card { | 785 | struct qeth_card { |
765 | struct list_head list; | 786 | struct list_head list; |
766 | enum qeth_card_states state; | 787 | enum qeth_card_states state; |
@@ -803,6 +824,7 @@ struct qeth_card { | |||
803 | int use_hard_stop; | 824 | int use_hard_stop; |
804 | int (*orig_hard_header)(struct sk_buff *,struct net_device *, | 825 | int (*orig_hard_header)(struct sk_buff *,struct net_device *, |
805 | unsigned short,void *,void *,unsigned); | 826 | unsigned short,void *,void *,unsigned); |
827 | struct qeth_osn_info osn_info; | ||
806 | }; | 828 | }; |
807 | 829 | ||
808 | struct qeth_card_list_struct { | 830 | struct qeth_card_list_struct { |
@@ -916,10 +938,12 @@ qeth_get_hlen(__u8 link_type) | |||
916 | static inline unsigned short | 938 | static inline unsigned short |
917 | qeth_get_netdev_flags(struct qeth_card *card) | 939 | qeth_get_netdev_flags(struct qeth_card *card) |
918 | { | 940 | { |
919 | if (card->options.layer2) | 941 | if (card->options.layer2 && |
942 | (card->info.type == QETH_CARD_TYPE_OSAE)) | ||
920 | return 0; | 943 | return 0; |
921 | switch (card->info.type) { | 944 | switch (card->info.type) { |
922 | case QETH_CARD_TYPE_IQD: | 945 | case QETH_CARD_TYPE_IQD: |
946 | case QETH_CARD_TYPE_OSN: | ||
923 | return IFF_NOARP; | 947 | return IFF_NOARP; |
924 | #ifdef CONFIG_QETH_IPV6 | 948 | #ifdef CONFIG_QETH_IPV6 |
925 | default: | 949 | default: |
@@ -956,9 +980,10 @@ static inline int | |||
956 | qeth_get_max_mtu_for_card(int cardtype) | 980 | qeth_get_max_mtu_for_card(int cardtype) |
957 | { | 981 | { |
958 | switch (cardtype) { | 982 | switch (cardtype) { |
983 | |||
959 | case QETH_CARD_TYPE_UNKNOWN: | 984 | case QETH_CARD_TYPE_UNKNOWN: |
960 | return 61440; | ||
961 | case QETH_CARD_TYPE_OSAE: | 985 | case QETH_CARD_TYPE_OSAE: |
986 | case QETH_CARD_TYPE_OSN: | ||
962 | return 61440; | 987 | return 61440; |
963 | case QETH_CARD_TYPE_IQD: | 988 | case QETH_CARD_TYPE_IQD: |
964 | return 57344; | 989 | return 57344; |
@@ -1004,6 +1029,7 @@ qeth_mtu_is_valid(struct qeth_card * card, int mtu) | |||
1004 | case QETH_CARD_TYPE_IQD: | 1029 | case QETH_CARD_TYPE_IQD: |
1005 | return ((mtu >= 576) && | 1030 | return ((mtu >= 576) && |
1006 | (mtu <= card->info.max_mtu + 4096 - 32)); | 1031 | (mtu <= card->info.max_mtu + 4096 - 32)); |
1032 | case QETH_CARD_TYPE_OSN: | ||
1007 | case QETH_CARD_TYPE_UNKNOWN: | 1033 | case QETH_CARD_TYPE_UNKNOWN: |
1008 | default: | 1034 | default: |
1009 | return 1; | 1035 | return 1; |
@@ -1015,6 +1041,7 @@ qeth_get_arphdr_type(int cardtype, int linktype) | |||
1015 | { | 1041 | { |
1016 | switch (cardtype) { | 1042 | switch (cardtype) { |
1017 | case QETH_CARD_TYPE_OSAE: | 1043 | case QETH_CARD_TYPE_OSAE: |
1044 | case QETH_CARD_TYPE_OSN: | ||
1018 | switch (linktype) { | 1045 | switch (linktype) { |
1019 | case QETH_LINK_TYPE_LANE_TR: | 1046 | case QETH_LINK_TYPE_LANE_TR: |
1020 | case QETH_LINK_TYPE_HSTR: | 1047 | case QETH_LINK_TYPE_HSTR: |
@@ -1182,4 +1209,16 @@ qeth_fill_header(struct qeth_card *, struct qeth_hdr *, | |||
1182 | extern void | 1209 | extern void |
1183 | qeth_flush_buffers(struct qeth_qdio_out_q *, int, int, int); | 1210 | qeth_flush_buffers(struct qeth_qdio_out_q *, int, int, int); |
1184 | 1211 | ||
1212 | extern int | ||
1213 | qeth_osn_assist(struct net_device *, void *, int); | ||
1214 | |||
1215 | extern int | ||
1216 | qeth_osn_register(unsigned char *read_dev_no, | ||
1217 | struct net_device **, | ||
1218 | int (*assist_cb)(struct net_device *, void *), | ||
1219 | int (*data_cb)(struct sk_buff *)); | ||
1220 | |||
1221 | extern void | ||
1222 | qeth_osn_deregister(struct net_device *); | ||
1223 | |||
1185 | #endif /* __QETH_H__ */ | 1224 | #endif /* __QETH_H__ */ |
diff --git a/drivers/s390/net/qeth_fs.h b/drivers/s390/net/qeth_fs.h index 5c9a51ce91b6..c0b4c8d82c45 100644 --- a/drivers/s390/net/qeth_fs.h +++ b/drivers/s390/net/qeth_fs.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #ifndef __QETH_FS_H__ | 12 | #ifndef __QETH_FS_H__ |
13 | #define __QETH_FS_H__ | 13 | #define __QETH_FS_H__ |
14 | 14 | ||
15 | #define VERSION_QETH_FS_H "$Revision: 1.9 $" | 15 | #define VERSION_QETH_FS_H "$Revision: 1.10 $" |
16 | 16 | ||
17 | extern const char *VERSION_QETH_PROC_C; | 17 | extern const char *VERSION_QETH_PROC_C; |
18 | extern const char *VERSION_QETH_SYS_C; | 18 | extern const char *VERSION_QETH_SYS_C; |
@@ -43,6 +43,12 @@ extern void | |||
43 | qeth_remove_device_attributes(struct device *dev); | 43 | qeth_remove_device_attributes(struct device *dev); |
44 | 44 | ||
45 | extern int | 45 | extern int |
46 | qeth_create_device_attributes_osn(struct device *dev); | ||
47 | |||
48 | extern void | ||
49 | qeth_remove_device_attributes_osn(struct device *dev); | ||
50 | |||
51 | extern int | ||
46 | qeth_create_driver_attributes(void); | 52 | qeth_create_driver_attributes(void); |
47 | 53 | ||
48 | extern void | 54 | extern void |
@@ -108,6 +114,8 @@ qeth_get_cardname(struct qeth_card *card) | |||
108 | return " OSD Express"; | 114 | return " OSD Express"; |
109 | case QETH_CARD_TYPE_IQD: | 115 | case QETH_CARD_TYPE_IQD: |
110 | return " HiperSockets"; | 116 | return " HiperSockets"; |
117 | case QETH_CARD_TYPE_OSN: | ||
118 | return " OSN QDIO"; | ||
111 | default: | 119 | default: |
112 | return " unknown"; | 120 | return " unknown"; |
113 | } | 121 | } |
@@ -153,6 +161,8 @@ qeth_get_cardname_short(struct qeth_card *card) | |||
153 | } | 161 | } |
154 | case QETH_CARD_TYPE_IQD: | 162 | case QETH_CARD_TYPE_IQD: |
155 | return "HiperSockets"; | 163 | return "HiperSockets"; |
164 | case QETH_CARD_TYPE_OSN: | ||
165 | return "OSN"; | ||
156 | default: | 166 | default: |
157 | return "unknown"; | 167 | return "unknown"; |
158 | } | 168 | } |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index bd28e2438d7f..692003c9f896 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -196,7 +196,6 @@ qeth_notifier_register(struct task_struct *p, int signum) | |||
196 | { | 196 | { |
197 | struct qeth_notify_list_struct *n_entry; | 197 | struct qeth_notify_list_struct *n_entry; |
198 | 198 | ||
199 | |||
200 | /*check first if entry already exists*/ | 199 | /*check first if entry already exists*/ |
201 | spin_lock(&qeth_notify_lock); | 200 | spin_lock(&qeth_notify_lock); |
202 | list_for_each_entry(n_entry, &qeth_notify_list, list) { | 201 | list_for_each_entry(n_entry, &qeth_notify_list, list) { |
@@ -1024,7 +1023,10 @@ qeth_set_intial_options(struct qeth_card *card) | |||
1024 | card->options.fake_broadcast = 0; | 1023 | card->options.fake_broadcast = 0; |
1025 | card->options.add_hhlen = DEFAULT_ADD_HHLEN; | 1024 | card->options.add_hhlen = DEFAULT_ADD_HHLEN; |
1026 | card->options.fake_ll = 0; | 1025 | card->options.fake_ll = 0; |
1027 | card->options.layer2 = 0; | 1026 | if (card->info.type == QETH_CARD_TYPE_OSN) |
1027 | card->options.layer2 = 1; | ||
1028 | else | ||
1029 | card->options.layer2 = 0; | ||
1028 | } | 1030 | } |
1029 | 1031 | ||
1030 | /** | 1032 | /** |
@@ -1113,19 +1115,20 @@ qeth_determine_card_type(struct qeth_card *card) | |||
1113 | 1115 | ||
1114 | QETH_DBF_TEXT(setup, 2, "detcdtyp"); | 1116 | QETH_DBF_TEXT(setup, 2, "detcdtyp"); |
1115 | 1117 | ||
1118 | card->qdio.do_prio_queueing = QETH_PRIOQ_DEFAULT; | ||
1119 | card->qdio.default_out_queue = QETH_DEFAULT_QUEUE; | ||
1116 | while (known_devices[i][4]) { | 1120 | while (known_devices[i][4]) { |
1117 | if ((CARD_RDEV(card)->id.dev_type == known_devices[i][2]) && | 1121 | if ((CARD_RDEV(card)->id.dev_type == known_devices[i][2]) && |
1118 | (CARD_RDEV(card)->id.dev_model == known_devices[i][3])) { | 1122 | (CARD_RDEV(card)->id.dev_model == known_devices[i][3])) { |
1119 | card->info.type = known_devices[i][4]; | 1123 | card->info.type = known_devices[i][4]; |
1124 | card->qdio.no_out_queues = known_devices[i][8]; | ||
1125 | card->info.is_multicast_different = known_devices[i][9]; | ||
1120 | if (is_1920_device(card)) { | 1126 | if (is_1920_device(card)) { |
1121 | PRINT_INFO("Priority Queueing not able " | 1127 | PRINT_INFO("Priority Queueing not able " |
1122 | "due to hardware limitations!\n"); | 1128 | "due to hardware limitations!\n"); |
1123 | card->qdio.no_out_queues = 1; | 1129 | card->qdio.no_out_queues = 1; |
1124 | card->qdio.default_out_queue = 0; | 1130 | card->qdio.default_out_queue = 0; |
1125 | } else { | 1131 | } |
1126 | card->qdio.no_out_queues = known_devices[i][8]; | ||
1127 | } | ||
1128 | card->info.is_multicast_different = known_devices[i][9]; | ||
1129 | return 0; | 1132 | return 0; |
1130 | } | 1133 | } |
1131 | i++; | 1134 | i++; |
@@ -1149,6 +1152,8 @@ qeth_probe_device(struct ccwgroup_device *gdev) | |||
1149 | if (!get_device(dev)) | 1152 | if (!get_device(dev)) |
1150 | return -ENODEV; | 1153 | return -ENODEV; |
1151 | 1154 | ||
1155 | QETH_DBF_TEXT_(setup, 2, "%s", gdev->dev.bus_id); | ||
1156 | |||
1152 | card = qeth_alloc_card(); | 1157 | card = qeth_alloc_card(); |
1153 | if (!card) { | 1158 | if (!card) { |
1154 | put_device(dev); | 1159 | put_device(dev); |
@@ -1158,28 +1163,27 @@ qeth_probe_device(struct ccwgroup_device *gdev) | |||
1158 | card->read.ccwdev = gdev->cdev[0]; | 1163 | card->read.ccwdev = gdev->cdev[0]; |
1159 | card->write.ccwdev = gdev->cdev[1]; | 1164 | card->write.ccwdev = gdev->cdev[1]; |
1160 | card->data.ccwdev = gdev->cdev[2]; | 1165 | card->data.ccwdev = gdev->cdev[2]; |
1161 | |||
1162 | if ((rc = qeth_setup_card(card))){ | ||
1163 | QETH_DBF_TEXT_(setup, 2, "2err%d", rc); | ||
1164 | put_device(dev); | ||
1165 | qeth_free_card(card); | ||
1166 | return rc; | ||
1167 | } | ||
1168 | gdev->dev.driver_data = card; | 1166 | gdev->dev.driver_data = card; |
1169 | card->gdev = gdev; | 1167 | card->gdev = gdev; |
1170 | gdev->cdev[0]->handler = qeth_irq; | 1168 | gdev->cdev[0]->handler = qeth_irq; |
1171 | gdev->cdev[1]->handler = qeth_irq; | 1169 | gdev->cdev[1]->handler = qeth_irq; |
1172 | gdev->cdev[2]->handler = qeth_irq; | 1170 | gdev->cdev[2]->handler = qeth_irq; |
1173 | 1171 | ||
1174 | rc = qeth_create_device_attributes(dev); | 1172 | if ((rc = qeth_determine_card_type(card))){ |
1175 | if (rc) { | 1173 | PRINT_WARN("%s: not a valid card type\n", __func__); |
1174 | QETH_DBF_TEXT_(setup, 2, "3err%d", rc); | ||
1175 | put_device(dev); | ||
1176 | qeth_free_card(card); | ||
1177 | return rc; | ||
1178 | } | ||
1179 | if ((rc = qeth_setup_card(card))){ | ||
1180 | QETH_DBF_TEXT_(setup, 2, "2err%d", rc); | ||
1176 | put_device(dev); | 1181 | put_device(dev); |
1177 | qeth_free_card(card); | 1182 | qeth_free_card(card); |
1178 | return rc; | 1183 | return rc; |
1179 | } | 1184 | } |
1180 | if ((rc = qeth_determine_card_type(card))){ | 1185 | rc = qeth_create_device_attributes(dev); |
1181 | PRINT_WARN("%s: not a valid card type\n", __func__); | 1186 | if (rc) { |
1182 | QETH_DBF_TEXT_(setup, 2, "3err%d", rc); | ||
1183 | put_device(dev); | 1187 | put_device(dev); |
1184 | qeth_free_card(card); | 1188 | qeth_free_card(card); |
1185 | return rc; | 1189 | return rc; |
@@ -1660,6 +1664,8 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) | |||
1660 | netif_carrier_on(card->dev); | 1664 | netif_carrier_on(card->dev); |
1661 | qeth_schedule_recovery(card); | 1665 | qeth_schedule_recovery(card); |
1662 | return NULL; | 1666 | return NULL; |
1667 | case IPA_CMD_MODCCID: | ||
1668 | return cmd; | ||
1663 | case IPA_CMD_REGISTER_LOCAL_ADDR: | 1669 | case IPA_CMD_REGISTER_LOCAL_ADDR: |
1664 | QETH_DBF_TEXT(trace,3, "irla"); | 1670 | QETH_DBF_TEXT(trace,3, "irla"); |
1665 | break; | 1671 | break; |
@@ -1721,6 +1727,14 @@ qeth_send_control_data_cb(struct qeth_channel *channel, | |||
1721 | cmd = qeth_check_ipa_data(card, iob); | 1727 | cmd = qeth_check_ipa_data(card, iob); |
1722 | if ((cmd == NULL) && (card->state != CARD_STATE_DOWN)) | 1728 | if ((cmd == NULL) && (card->state != CARD_STATE_DOWN)) |
1723 | goto out; | 1729 | goto out; |
1730 | /*in case of OSN : check if cmd is set */ | ||
1731 | if (card->info.type == QETH_CARD_TYPE_OSN && | ||
1732 | cmd && | ||
1733 | cmd->hdr.command != IPA_CMD_STARTLAN && | ||
1734 | card->osn_info.assist_cb != NULL) { | ||
1735 | card->osn_info.assist_cb(card->dev, cmd); | ||
1736 | goto out; | ||
1737 | } | ||
1724 | 1738 | ||
1725 | spin_lock_irqsave(&card->lock, flags); | 1739 | spin_lock_irqsave(&card->lock, flags); |
1726 | list_for_each_entry_safe(reply, r, &card->cmd_waiter_list, list) { | 1740 | list_for_each_entry_safe(reply, r, &card->cmd_waiter_list, list) { |
@@ -1737,8 +1751,7 @@ qeth_send_control_data_cb(struct qeth_channel *channel, | |||
1737 | keep_reply = reply->callback(card, | 1751 | keep_reply = reply->callback(card, |
1738 | reply, | 1752 | reply, |
1739 | (unsigned long)cmd); | 1753 | (unsigned long)cmd); |
1740 | } | 1754 | } else |
1741 | else | ||
1742 | keep_reply = reply->callback(card, | 1755 | keep_reply = reply->callback(card, |
1743 | reply, | 1756 | reply, |
1744 | (unsigned long)iob); | 1757 | (unsigned long)iob); |
@@ -1768,6 +1781,24 @@ out: | |||
1768 | qeth_release_buffer(channel,iob); | 1781 | qeth_release_buffer(channel,iob); |
1769 | } | 1782 | } |
1770 | 1783 | ||
1784 | static inline void | ||
1785 | qeth_prepare_control_data(struct qeth_card *card, int len, | ||
1786 | struct qeth_cmd_buffer *iob) | ||
1787 | { | ||
1788 | qeth_setup_ccw(&card->write,iob->data,len); | ||
1789 | iob->callback = qeth_release_buffer; | ||
1790 | |||
1791 | memcpy(QETH_TRANSPORT_HEADER_SEQ_NO(iob->data), | ||
1792 | &card->seqno.trans_hdr, QETH_SEQ_NO_LENGTH); | ||
1793 | card->seqno.trans_hdr++; | ||
1794 | memcpy(QETH_PDU_HEADER_SEQ_NO(iob->data), | ||
1795 | &card->seqno.pdu_hdr, QETH_SEQ_NO_LENGTH); | ||
1796 | card->seqno.pdu_hdr++; | ||
1797 | memcpy(QETH_PDU_HEADER_ACK_SEQ_NO(iob->data), | ||
1798 | &card->seqno.pdu_hdr_ack, QETH_SEQ_NO_LENGTH); | ||
1799 | QETH_DBF_HEX(control, 2, iob->data, QETH_DBF_CONTROL_LEN); | ||
1800 | } | ||
1801 | |||
1771 | static int | 1802 | static int |
1772 | qeth_send_control_data(struct qeth_card *card, int len, | 1803 | qeth_send_control_data(struct qeth_card *card, int len, |
1773 | struct qeth_cmd_buffer *iob, | 1804 | struct qeth_cmd_buffer *iob, |
@@ -1778,24 +1809,11 @@ qeth_send_control_data(struct qeth_card *card, int len, | |||
1778 | { | 1809 | { |
1779 | int rc; | 1810 | int rc; |
1780 | unsigned long flags; | 1811 | unsigned long flags; |
1781 | struct qeth_reply *reply; | 1812 | struct qeth_reply *reply = NULL; |
1782 | struct timer_list timer; | 1813 | struct timer_list timer; |
1783 | 1814 | ||
1784 | QETH_DBF_TEXT(trace, 2, "sendctl"); | 1815 | QETH_DBF_TEXT(trace, 2, "sendctl"); |
1785 | 1816 | ||
1786 | qeth_setup_ccw(&card->write,iob->data,len); | ||
1787 | |||
1788 | memcpy(QETH_TRANSPORT_HEADER_SEQ_NO(iob->data), | ||
1789 | &card->seqno.trans_hdr, QETH_SEQ_NO_LENGTH); | ||
1790 | card->seqno.trans_hdr++; | ||
1791 | |||
1792 | memcpy(QETH_PDU_HEADER_SEQ_NO(iob->data), | ||
1793 | &card->seqno.pdu_hdr, QETH_SEQ_NO_LENGTH); | ||
1794 | card->seqno.pdu_hdr++; | ||
1795 | memcpy(QETH_PDU_HEADER_ACK_SEQ_NO(iob->data), | ||
1796 | &card->seqno.pdu_hdr_ack, QETH_SEQ_NO_LENGTH); | ||
1797 | iob->callback = qeth_release_buffer; | ||
1798 | |||
1799 | reply = qeth_alloc_reply(card); | 1817 | reply = qeth_alloc_reply(card); |
1800 | if (!reply) { | 1818 | if (!reply) { |
1801 | PRINT_WARN("Could no alloc qeth_reply!\n"); | 1819 | PRINT_WARN("Could no alloc qeth_reply!\n"); |
@@ -1810,10 +1828,6 @@ qeth_send_control_data(struct qeth_card *card, int len, | |||
1810 | init_timer(&timer); | 1828 | init_timer(&timer); |
1811 | timer.function = qeth_cmd_timeout; | 1829 | timer.function = qeth_cmd_timeout; |
1812 | timer.data = (unsigned long) reply; | 1830 | timer.data = (unsigned long) reply; |
1813 | if (IS_IPA(iob->data)) | ||
1814 | timer.expires = jiffies + QETH_IPA_TIMEOUT; | ||
1815 | else | ||
1816 | timer.expires = jiffies + QETH_TIMEOUT; | ||
1817 | init_waitqueue_head(&reply->wait_q); | 1831 | init_waitqueue_head(&reply->wait_q); |
1818 | spin_lock_irqsave(&card->lock, flags); | 1832 | spin_lock_irqsave(&card->lock, flags); |
1819 | list_add_tail(&reply->list, &card->cmd_waiter_list); | 1833 | list_add_tail(&reply->list, &card->cmd_waiter_list); |
@@ -1821,6 +1835,11 @@ qeth_send_control_data(struct qeth_card *card, int len, | |||
1821 | QETH_DBF_HEX(control, 2, iob->data, QETH_DBF_CONTROL_LEN); | 1835 | QETH_DBF_HEX(control, 2, iob->data, QETH_DBF_CONTROL_LEN); |
1822 | wait_event(card->wait_q, | 1836 | wait_event(card->wait_q, |
1823 | atomic_compare_and_swap(0,1,&card->write.irq_pending) == 0); | 1837 | atomic_compare_and_swap(0,1,&card->write.irq_pending) == 0); |
1838 | qeth_prepare_control_data(card, len, iob); | ||
1839 | if (IS_IPA(iob->data)) | ||
1840 | timer.expires = jiffies + QETH_IPA_TIMEOUT; | ||
1841 | else | ||
1842 | timer.expires = jiffies + QETH_TIMEOUT; | ||
1824 | QETH_DBF_TEXT(trace, 6, "noirqpnd"); | 1843 | QETH_DBF_TEXT(trace, 6, "noirqpnd"); |
1825 | spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); | 1844 | spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); |
1826 | rc = ccw_device_start(card->write.ccwdev, &card->write.ccw, | 1845 | rc = ccw_device_start(card->write.ccwdev, &card->write.ccw, |
@@ -1848,6 +1867,62 @@ qeth_send_control_data(struct qeth_card *card, int len, | |||
1848 | } | 1867 | } |
1849 | 1868 | ||
1850 | static int | 1869 | static int |
1870 | qeth_osn_send_control_data(struct qeth_card *card, int len, | ||
1871 | struct qeth_cmd_buffer *iob) | ||
1872 | { | ||
1873 | unsigned long flags; | ||
1874 | int rc = 0; | ||
1875 | |||
1876 | QETH_DBF_TEXT(trace, 5, "osndctrd"); | ||
1877 | |||
1878 | wait_event(card->wait_q, | ||
1879 | atomic_compare_and_swap(0,1,&card->write.irq_pending) == 0); | ||
1880 | qeth_prepare_control_data(card, len, iob); | ||
1881 | QETH_DBF_TEXT(trace, 6, "osnoirqp"); | ||
1882 | spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); | ||
1883 | rc = ccw_device_start(card->write.ccwdev, &card->write.ccw, | ||
1884 | (addr_t) iob, 0, 0); | ||
1885 | spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags); | ||
1886 | if (rc){ | ||
1887 | PRINT_WARN("qeth_osn_send_control_data: " | ||
1888 | "ccw_device_start rc = %i\n", rc); | ||
1889 | QETH_DBF_TEXT_(trace, 2, " err%d", rc); | ||
1890 | qeth_release_buffer(iob->channel, iob); | ||
1891 | atomic_set(&card->write.irq_pending, 0); | ||
1892 | wake_up(&card->wait_q); | ||
1893 | } | ||
1894 | return rc; | ||
1895 | } | ||
1896 | |||
1897 | static inline void | ||
1898 | qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | ||
1899 | char prot_type) | ||
1900 | { | ||
1901 | memcpy(iob->data, IPA_PDU_HEADER, IPA_PDU_HEADER_SIZE); | ||
1902 | memcpy(QETH_IPA_CMD_PROT_TYPE(iob->data),&prot_type,1); | ||
1903 | memcpy(QETH_IPA_CMD_DEST_ADDR(iob->data), | ||
1904 | &card->token.ulp_connection_r, QETH_MPC_TOKEN_LENGTH); | ||
1905 | } | ||
1906 | |||
1907 | static int | ||
1908 | qeth_osn_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | ||
1909 | int data_len) | ||
1910 | { | ||
1911 | u16 s1, s2; | ||
1912 | |||
1913 | QETH_DBF_TEXT(trace,4,"osndipa"); | ||
1914 | |||
1915 | qeth_prepare_ipa_cmd(card, iob, QETH_PROT_OSN2); | ||
1916 | s1 = (u16)(IPA_PDU_HEADER_SIZE + data_len); | ||
1917 | s2 = (u16)data_len; | ||
1918 | memcpy(QETH_IPA_PDU_LEN_TOTAL(iob->data), &s1, 2); | ||
1919 | memcpy(QETH_IPA_PDU_LEN_PDU1(iob->data), &s2, 2); | ||
1920 | memcpy(QETH_IPA_PDU_LEN_PDU2(iob->data), &s2, 2); | ||
1921 | memcpy(QETH_IPA_PDU_LEN_PDU3(iob->data), &s2, 2); | ||
1922 | return qeth_osn_send_control_data(card, s1, iob); | ||
1923 | } | ||
1924 | |||
1925 | static int | ||
1851 | qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | 1926 | qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, |
1852 | int (*reply_cb) | 1927 | int (*reply_cb) |
1853 | (struct qeth_card *,struct qeth_reply*, unsigned long), | 1928 | (struct qeth_card *,struct qeth_reply*, unsigned long), |
@@ -1858,17 +1933,14 @@ qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, | |||
1858 | 1933 | ||
1859 | QETH_DBF_TEXT(trace,4,"sendipa"); | 1934 | QETH_DBF_TEXT(trace,4,"sendipa"); |
1860 | 1935 | ||
1861 | memcpy(iob->data, IPA_PDU_HEADER, IPA_PDU_HEADER_SIZE); | ||
1862 | |||
1863 | if (card->options.layer2) | 1936 | if (card->options.layer2) |
1864 | prot_type = QETH_PROT_LAYER2; | 1937 | if (card->info.type == QETH_CARD_TYPE_OSN) |
1938 | prot_type = QETH_PROT_OSN2; | ||
1939 | else | ||
1940 | prot_type = QETH_PROT_LAYER2; | ||
1865 | else | 1941 | else |
1866 | prot_type = QETH_PROT_TCPIP; | 1942 | prot_type = QETH_PROT_TCPIP; |
1867 | 1943 | qeth_prepare_ipa_cmd(card,iob,prot_type); | |
1868 | memcpy(QETH_IPA_CMD_PROT_TYPE(iob->data),&prot_type,1); | ||
1869 | memcpy(QETH_IPA_CMD_DEST_ADDR(iob->data), | ||
1870 | &card->token.ulp_connection_r, QETH_MPC_TOKEN_LENGTH); | ||
1871 | |||
1872 | rc = qeth_send_control_data(card, IPA_CMD_LENGTH, iob, | 1944 | rc = qeth_send_control_data(card, IPA_CMD_LENGTH, iob, |
1873 | reply_cb, reply_param); | 1945 | reply_cb, reply_param); |
1874 | return rc; | 1946 | return rc; |
@@ -2010,7 +2082,10 @@ qeth_ulp_enable(struct qeth_card *card) | |||
2010 | *(QETH_ULP_ENABLE_LINKNUM(iob->data)) = | 2082 | *(QETH_ULP_ENABLE_LINKNUM(iob->data)) = |
2011 | (__u8) card->info.portno; | 2083 | (__u8) card->info.portno; |
2012 | if (card->options.layer2) | 2084 | if (card->options.layer2) |
2013 | prot_type = QETH_PROT_LAYER2; | 2085 | if (card->info.type == QETH_CARD_TYPE_OSN) |
2086 | prot_type = QETH_PROT_OSN2; | ||
2087 | else | ||
2088 | prot_type = QETH_PROT_LAYER2; | ||
2014 | else | 2089 | else |
2015 | prot_type = QETH_PROT_TCPIP; | 2090 | prot_type = QETH_PROT_TCPIP; |
2016 | 2091 | ||
@@ -2100,15 +2175,21 @@ qeth_check_for_inbound_error(struct qeth_qdio_buffer *buf, | |||
2100 | } | 2175 | } |
2101 | 2176 | ||
2102 | static inline struct sk_buff * | 2177 | static inline struct sk_buff * |
2103 | qeth_get_skb(unsigned int length) | 2178 | qeth_get_skb(unsigned int length, struct qeth_hdr *hdr) |
2104 | { | 2179 | { |
2105 | struct sk_buff* skb; | 2180 | struct sk_buff* skb; |
2181 | int add_len; | ||
2182 | |||
2183 | add_len = 0; | ||
2184 | if (hdr->hdr.osn.id == QETH_HEADER_TYPE_OSN) | ||
2185 | add_len = sizeof(struct qeth_hdr); | ||
2106 | #ifdef CONFIG_QETH_VLAN | 2186 | #ifdef CONFIG_QETH_VLAN |
2107 | if ((skb = dev_alloc_skb(length + VLAN_HLEN))) | 2187 | else |
2108 | skb_reserve(skb, VLAN_HLEN); | 2188 | add_len = VLAN_HLEN; |
2109 | #else | ||
2110 | skb = dev_alloc_skb(length); | ||
2111 | #endif | 2189 | #endif |
2190 | skb = dev_alloc_skb(length + add_len); | ||
2191 | if (skb && add_len) | ||
2192 | skb_reserve(skb, add_len); | ||
2112 | return skb; | 2193 | return skb; |
2113 | } | 2194 | } |
2114 | 2195 | ||
@@ -2138,7 +2219,10 @@ qeth_get_next_skb(struct qeth_card *card, struct qdio_buffer *buffer, | |||
2138 | 2219 | ||
2139 | offset += sizeof(struct qeth_hdr); | 2220 | offset += sizeof(struct qeth_hdr); |
2140 | if (card->options.layer2) | 2221 | if (card->options.layer2) |
2141 | skb_len = (*hdr)->hdr.l2.pkt_length; | 2222 | if (card->info.type == QETH_CARD_TYPE_OSN) |
2223 | skb_len = (*hdr)->hdr.osn.pdu_length; | ||
2224 | else | ||
2225 | skb_len = (*hdr)->hdr.l2.pkt_length; | ||
2142 | else | 2226 | else |
2143 | skb_len = (*hdr)->hdr.l3.length; | 2227 | skb_len = (*hdr)->hdr.l3.length; |
2144 | 2228 | ||
@@ -2146,15 +2230,15 @@ qeth_get_next_skb(struct qeth_card *card, struct qdio_buffer *buffer, | |||
2146 | return NULL; | 2230 | return NULL; |
2147 | if (card->options.fake_ll){ | 2231 | if (card->options.fake_ll){ |
2148 | if(card->dev->type == ARPHRD_IEEE802_TR){ | 2232 | if(card->dev->type == ARPHRD_IEEE802_TR){ |
2149 | if (!(skb = qeth_get_skb(skb_len+QETH_FAKE_LL_LEN_TR))) | 2233 | if (!(skb = qeth_get_skb(skb_len+QETH_FAKE_LL_LEN_TR, *hdr))) |
2150 | goto no_mem; | 2234 | goto no_mem; |
2151 | skb_reserve(skb,QETH_FAKE_LL_LEN_TR); | 2235 | skb_reserve(skb,QETH_FAKE_LL_LEN_TR); |
2152 | } else { | 2236 | } else { |
2153 | if (!(skb = qeth_get_skb(skb_len+QETH_FAKE_LL_LEN_ETH))) | 2237 | if (!(skb = qeth_get_skb(skb_len+QETH_FAKE_LL_LEN_ETH, *hdr))) |
2154 | goto no_mem; | 2238 | goto no_mem; |
2155 | skb_reserve(skb,QETH_FAKE_LL_LEN_ETH); | 2239 | skb_reserve(skb,QETH_FAKE_LL_LEN_ETH); |
2156 | } | 2240 | } |
2157 | } else if (!(skb = qeth_get_skb(skb_len))) | 2241 | } else if (!(skb = qeth_get_skb(skb_len, *hdr))) |
2158 | goto no_mem; | 2242 | goto no_mem; |
2159 | data_ptr = element->addr + offset; | 2243 | data_ptr = element->addr + offset; |
2160 | while (skb_len) { | 2244 | while (skb_len) { |
@@ -2453,8 +2537,12 @@ qeth_process_inbound_buffer(struct qeth_card *card, | |||
2453 | skb->dev = card->dev; | 2537 | skb->dev = card->dev; |
2454 | if (hdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2) | 2538 | if (hdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2) |
2455 | vlan_tag = qeth_layer2_rebuild_skb(card, skb, hdr); | 2539 | vlan_tag = qeth_layer2_rebuild_skb(card, skb, hdr); |
2456 | else | 2540 | else if (hdr->hdr.l3.id == QETH_HEADER_TYPE_LAYER3) |
2457 | qeth_rebuild_skb(card, skb, hdr); | 2541 | qeth_rebuild_skb(card, skb, hdr); |
2542 | else { /*in case of OSN*/ | ||
2543 | skb_push(skb, sizeof(struct qeth_hdr)); | ||
2544 | memcpy(skb->data, hdr, sizeof(struct qeth_hdr)); | ||
2545 | } | ||
2458 | /* is device UP ? */ | 2546 | /* is device UP ? */ |
2459 | if (!(card->dev->flags & IFF_UP)){ | 2547 | if (!(card->dev->flags & IFF_UP)){ |
2460 | dev_kfree_skb_any(skb); | 2548 | dev_kfree_skb_any(skb); |
@@ -2465,7 +2553,10 @@ qeth_process_inbound_buffer(struct qeth_card *card, | |||
2465 | vlan_hwaccel_rx(skb, card->vlangrp, vlan_tag); | 2553 | vlan_hwaccel_rx(skb, card->vlangrp, vlan_tag); |
2466 | else | 2554 | else |
2467 | #endif | 2555 | #endif |
2468 | rxrc = netif_rx(skb); | 2556 | if (card->info.type == QETH_CARD_TYPE_OSN) |
2557 | rxrc = card->osn_info.data_cb(skb); | ||
2558 | else | ||
2559 | rxrc = netif_rx(skb); | ||
2469 | card->dev->last_rx = jiffies; | 2560 | card->dev->last_rx = jiffies; |
2470 | card->stats.rx_packets++; | 2561 | card->stats.rx_packets++; |
2471 | card->stats.rx_bytes += skb->len; | 2562 | card->stats.rx_bytes += skb->len; |
@@ -3150,8 +3241,6 @@ qeth_init_qdio_info(struct qeth_card *card) | |||
3150 | INIT_LIST_HEAD(&card->qdio.in_buf_pool.entry_list); | 3241 | INIT_LIST_HEAD(&card->qdio.in_buf_pool.entry_list); |
3151 | INIT_LIST_HEAD(&card->qdio.init_pool.entry_list); | 3242 | INIT_LIST_HEAD(&card->qdio.init_pool.entry_list); |
3152 | /* outbound */ | 3243 | /* outbound */ |
3153 | card->qdio.do_prio_queueing = QETH_PRIOQ_DEFAULT; | ||
3154 | card->qdio.default_out_queue = QETH_DEFAULT_QUEUE; | ||
3155 | } | 3244 | } |
3156 | 3245 | ||
3157 | static int | 3246 | static int |
@@ -3466,7 +3555,7 @@ qeth_mpc_initialize(struct qeth_card *card) | |||
3466 | 3555 | ||
3467 | return 0; | 3556 | return 0; |
3468 | out_qdio: | 3557 | out_qdio: |
3469 | qeth_qdio_clear_card(card, card->info.type==QETH_CARD_TYPE_OSAE); | 3558 | qeth_qdio_clear_card(card, card->info.type!=QETH_CARD_TYPE_IQD); |
3470 | return rc; | 3559 | return rc; |
3471 | } | 3560 | } |
3472 | 3561 | ||
@@ -3491,6 +3580,9 @@ qeth_get_netdevice(enum qeth_card_types type, enum qeth_link_types linktype) | |||
3491 | case QETH_CARD_TYPE_IQD: | 3580 | case QETH_CARD_TYPE_IQD: |
3492 | dev = alloc_netdev(0, "hsi%d", ether_setup); | 3581 | dev = alloc_netdev(0, "hsi%d", ether_setup); |
3493 | break; | 3582 | break; |
3583 | case QETH_CARD_TYPE_OSN: | ||
3584 | dev = alloc_netdev(0, "osn%d", ether_setup); | ||
3585 | break; | ||
3494 | default: | 3586 | default: |
3495 | dev = alloc_etherdev(0); | 3587 | dev = alloc_etherdev(0); |
3496 | } | 3588 | } |
@@ -3655,7 +3747,8 @@ qeth_open(struct net_device *dev) | |||
3655 | if (card->state != CARD_STATE_SOFTSETUP) | 3747 | if (card->state != CARD_STATE_SOFTSETUP) |
3656 | return -ENODEV; | 3748 | return -ENODEV; |
3657 | 3749 | ||
3658 | if ( (card->options.layer2) && | 3750 | if ( (card->info.type != QETH_CARD_TYPE_OSN) && |
3751 | (card->options.layer2) && | ||
3659 | (!card->info.layer2_mac_registered)) { | 3752 | (!card->info.layer2_mac_registered)) { |
3660 | QETH_DBF_TEXT(trace,4,"nomacadr"); | 3753 | QETH_DBF_TEXT(trace,4,"nomacadr"); |
3661 | return -EPERM; | 3754 | return -EPERM; |
@@ -3693,6 +3786,9 @@ qeth_get_cast_type(struct qeth_card *card, struct sk_buff *skb) | |||
3693 | { | 3786 | { |
3694 | int cast_type = RTN_UNSPEC; | 3787 | int cast_type = RTN_UNSPEC; |
3695 | 3788 | ||
3789 | if (card->info.type == QETH_CARD_TYPE_OSN) | ||
3790 | return cast_type; | ||
3791 | |||
3696 | if (skb->dst && skb->dst->neighbour){ | 3792 | if (skb->dst && skb->dst->neighbour){ |
3697 | cast_type = skb->dst->neighbour->type; | 3793 | cast_type = skb->dst->neighbour->type; |
3698 | if ((cast_type == RTN_BROADCAST) || | 3794 | if ((cast_type == RTN_BROADCAST) || |
@@ -3782,13 +3878,16 @@ static inline int | |||
3782 | qeth_prepare_skb(struct qeth_card *card, struct sk_buff **skb, | 3878 | qeth_prepare_skb(struct qeth_card *card, struct sk_buff **skb, |
3783 | struct qeth_hdr **hdr, int ipv) | 3879 | struct qeth_hdr **hdr, int ipv) |
3784 | { | 3880 | { |
3785 | int rc; | 3881 | int rc = 0; |
3786 | #ifdef CONFIG_QETH_VLAN | 3882 | #ifdef CONFIG_QETH_VLAN |
3787 | u16 *tag; | 3883 | u16 *tag; |
3788 | #endif | 3884 | #endif |
3789 | 3885 | ||
3790 | QETH_DBF_TEXT(trace, 6, "prepskb"); | 3886 | QETH_DBF_TEXT(trace, 6, "prepskb"); |
3791 | 3887 | if (card->info.type == QETH_CARD_TYPE_OSN) { | |
3888 | *hdr = (struct qeth_hdr *)(*skb)->data; | ||
3889 | return rc; | ||
3890 | } | ||
3792 | rc = qeth_realloc_headroom(card, skb, sizeof(struct qeth_hdr)); | 3891 | rc = qeth_realloc_headroom(card, skb, sizeof(struct qeth_hdr)); |
3793 | if (rc) | 3892 | if (rc) |
3794 | return rc; | 3893 | return rc; |
@@ -4291,8 +4390,14 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4291 | } | 4390 | } |
4292 | } | 4391 | } |
4293 | } | 4392 | } |
4393 | if ((card->info.type == QETH_CARD_TYPE_OSN) && | ||
4394 | (skb->protocol == htons(ETH_P_IPV6))) { | ||
4395 | dev_kfree_skb_any(skb); | ||
4396 | return 0; | ||
4397 | } | ||
4294 | cast_type = qeth_get_cast_type(card, skb); | 4398 | cast_type = qeth_get_cast_type(card, skb); |
4295 | if ((cast_type == RTN_BROADCAST) && (card->info.broadcast_capable == 0)){ | 4399 | if ((cast_type == RTN_BROADCAST) && |
4400 | (card->info.broadcast_capable == 0)){ | ||
4296 | card->stats.tx_dropped++; | 4401 | card->stats.tx_dropped++; |
4297 | card->stats.tx_errors++; | 4402 | card->stats.tx_errors++; |
4298 | dev_kfree_skb_any(skb); | 4403 | dev_kfree_skb_any(skb); |
@@ -4320,7 +4425,8 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4320 | QETH_DBF_TEXT_(trace, 4, "pskbe%d", rc); | 4425 | QETH_DBF_TEXT_(trace, 4, "pskbe%d", rc); |
4321 | return rc; | 4426 | return rc; |
4322 | } | 4427 | } |
4323 | qeth_fill_header(card, hdr, skb, ipv, cast_type); | 4428 | if (card->info.type != QETH_CARD_TYPE_OSN) |
4429 | qeth_fill_header(card, hdr, skb, ipv, cast_type); | ||
4324 | } | 4430 | } |
4325 | 4431 | ||
4326 | if (large_send == QETH_LARGE_SEND_EDDP) { | 4432 | if (large_send == QETH_LARGE_SEND_EDDP) { |
@@ -4381,6 +4487,7 @@ qeth_mdio_read(struct net_device *dev, int phy_id, int regnum) | |||
4381 | case MII_BMCR: /* Basic mode control register */ | 4487 | case MII_BMCR: /* Basic mode control register */ |
4382 | rc = BMCR_FULLDPLX; | 4488 | rc = BMCR_FULLDPLX; |
4383 | if ((card->info.link_type != QETH_LINK_TYPE_GBIT_ETH)&& | 4489 | if ((card->info.link_type != QETH_LINK_TYPE_GBIT_ETH)&& |
4490 | (card->info.link_type != QETH_LINK_TYPE_OSN) && | ||
4384 | (card->info.link_type != QETH_LINK_TYPE_10GBIT_ETH)) | 4491 | (card->info.link_type != QETH_LINK_TYPE_10GBIT_ETH)) |
4385 | rc |= BMCR_SPEED100; | 4492 | rc |= BMCR_SPEED100; |
4386 | break; | 4493 | break; |
@@ -5004,6 +5111,9 @@ qeth_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
5004 | (card->state != CARD_STATE_SOFTSETUP)) | 5111 | (card->state != CARD_STATE_SOFTSETUP)) |
5005 | return -ENODEV; | 5112 | return -ENODEV; |
5006 | 5113 | ||
5114 | if (card->info.type == QETH_CARD_TYPE_OSN) | ||
5115 | return -EPERM; | ||
5116 | |||
5007 | switch (cmd){ | 5117 | switch (cmd){ |
5008 | case SIOC_QETH_ARP_SET_NO_ENTRIES: | 5118 | case SIOC_QETH_ARP_SET_NO_ENTRIES: |
5009 | if ( !capable(CAP_NET_ADMIN) || | 5119 | if ( !capable(CAP_NET_ADMIN) || |
@@ -5329,6 +5439,9 @@ qeth_set_multicast_list(struct net_device *dev) | |||
5329 | { | 5439 | { |
5330 | struct qeth_card *card = (struct qeth_card *) dev->priv; | 5440 | struct qeth_card *card = (struct qeth_card *) dev->priv; |
5331 | 5441 | ||
5442 | if (card->info.type == QETH_CARD_TYPE_OSN) | ||
5443 | return ; | ||
5444 | |||
5332 | QETH_DBF_TEXT(trace,3,"setmulti"); | 5445 | QETH_DBF_TEXT(trace,3,"setmulti"); |
5333 | qeth_delete_mc_addresses(card); | 5446 | qeth_delete_mc_addresses(card); |
5334 | qeth_add_multicast_ipv4(card); | 5447 | qeth_add_multicast_ipv4(card); |
@@ -5370,6 +5483,94 @@ qeth_get_addr_buffer(enum qeth_prot_versions prot) | |||
5370 | return addr; | 5483 | return addr; |
5371 | } | 5484 | } |
5372 | 5485 | ||
5486 | int | ||
5487 | qeth_osn_assist(struct net_device *dev, | ||
5488 | void *data, | ||
5489 | int data_len) | ||
5490 | { | ||
5491 | struct qeth_cmd_buffer *iob; | ||
5492 | struct qeth_card *card; | ||
5493 | int rc; | ||
5494 | |||
5495 | QETH_DBF_TEXT(trace, 2, "osnsdmc"); | ||
5496 | if (!dev) | ||
5497 | return -ENODEV; | ||
5498 | card = (struct qeth_card *)dev->priv; | ||
5499 | if (!card) | ||
5500 | return -ENODEV; | ||
5501 | if ((card->state != CARD_STATE_UP) && | ||
5502 | (card->state != CARD_STATE_SOFTSETUP)) | ||
5503 | return -ENODEV; | ||
5504 | iob = qeth_wait_for_buffer(&card->write); | ||
5505 | memcpy(iob->data+IPA_PDU_HEADER_SIZE, data, data_len); | ||
5506 | rc = qeth_osn_send_ipa_cmd(card, iob, data_len); | ||
5507 | return rc; | ||
5508 | } | ||
5509 | |||
5510 | static struct net_device * | ||
5511 | qeth_netdev_by_devno(unsigned char *read_dev_no) | ||
5512 | { | ||
5513 | struct qeth_card *card; | ||
5514 | struct net_device *ndev; | ||
5515 | unsigned char *readno; | ||
5516 | __u16 temp_dev_no, card_dev_no; | ||
5517 | char *endp; | ||
5518 | unsigned long flags; | ||
5519 | |||
5520 | ndev = NULL; | ||
5521 | memcpy(&temp_dev_no, read_dev_no, 2); | ||
5522 | read_lock_irqsave(&qeth_card_list.rwlock, flags); | ||
5523 | list_for_each_entry(card, &qeth_card_list.list, list) { | ||
5524 | readno = CARD_RDEV_ID(card); | ||
5525 | readno += (strlen(readno) - 4); | ||
5526 | card_dev_no = simple_strtoul(readno, &endp, 16); | ||
5527 | if (card_dev_no == temp_dev_no) { | ||
5528 | ndev = card->dev; | ||
5529 | break; | ||
5530 | } | ||
5531 | } | ||
5532 | read_unlock_irqrestore(&qeth_card_list.rwlock, flags); | ||
5533 | return ndev; | ||
5534 | } | ||
5535 | |||
5536 | int | ||
5537 | qeth_osn_register(unsigned char *read_dev_no, | ||
5538 | struct net_device **dev, | ||
5539 | int (*assist_cb)(struct net_device *, void *), | ||
5540 | int (*data_cb)(struct sk_buff *)) | ||
5541 | { | ||
5542 | struct qeth_card * card; | ||
5543 | |||
5544 | QETH_DBF_TEXT(trace, 2, "osnreg"); | ||
5545 | *dev = qeth_netdev_by_devno(read_dev_no); | ||
5546 | if (*dev == NULL) | ||
5547 | return -ENODEV; | ||
5548 | card = (struct qeth_card *)(*dev)->priv; | ||
5549 | if (!card) | ||
5550 | return -ENODEV; | ||
5551 | if ((assist_cb == NULL) || (data_cb == NULL)) | ||
5552 | return -EINVAL; | ||
5553 | card->osn_info.assist_cb = assist_cb; | ||
5554 | card->osn_info.data_cb = data_cb; | ||
5555 | return 0; | ||
5556 | } | ||
5557 | |||
5558 | void | ||
5559 | qeth_osn_deregister(struct net_device * dev) | ||
5560 | { | ||
5561 | struct qeth_card *card; | ||
5562 | |||
5563 | QETH_DBF_TEXT(trace, 2, "osndereg"); | ||
5564 | if (!dev) | ||
5565 | return; | ||
5566 | card = (struct qeth_card *)dev->priv; | ||
5567 | if (!card) | ||
5568 | return; | ||
5569 | card->osn_info.assist_cb = NULL; | ||
5570 | card->osn_info.data_cb = NULL; | ||
5571 | return; | ||
5572 | } | ||
5573 | |||
5373 | static void | 5574 | static void |
5374 | qeth_delete_mc_addresses(struct qeth_card *card) | 5575 | qeth_delete_mc_addresses(struct qeth_card *card) |
5375 | { | 5576 | { |
@@ -5700,6 +5901,12 @@ qeth_layer2_set_mac_address(struct net_device *dev, void *p) | |||
5700 | QETH_DBF_TEXT(trace, 3, "setmcLY3"); | 5901 | QETH_DBF_TEXT(trace, 3, "setmcLY3"); |
5701 | return -EOPNOTSUPP; | 5902 | return -EOPNOTSUPP; |
5702 | } | 5903 | } |
5904 | if (card->info.type == QETH_CARD_TYPE_OSN) { | ||
5905 | PRINT_WARN("Setting MAC address on %s is not supported.\n", | ||
5906 | dev->name); | ||
5907 | QETH_DBF_TEXT(trace, 3, "setmcOSN"); | ||
5908 | return -EOPNOTSUPP; | ||
5909 | } | ||
5703 | QETH_DBF_TEXT_(trace, 3, "%s", CARD_BUS_ID(card)); | 5910 | QETH_DBF_TEXT_(trace, 3, "%s", CARD_BUS_ID(card)); |
5704 | QETH_DBF_HEX(trace, 3, addr->sa_data, OSA_ADDR_LEN); | 5911 | QETH_DBF_HEX(trace, 3, addr->sa_data, OSA_ADDR_LEN); |
5705 | rc = qeth_layer2_send_delmac(card, &card->dev->dev_addr[0]); | 5912 | rc = qeth_layer2_send_delmac(card, &card->dev->dev_addr[0]); |
@@ -6076,9 +6283,8 @@ qeth_netdev_init(struct net_device *dev) | |||
6076 | qeth_get_hlen(card->info.link_type) + card->options.add_hhlen; | 6283 | qeth_get_hlen(card->info.link_type) + card->options.add_hhlen; |
6077 | dev->addr_len = OSA_ADDR_LEN; | 6284 | dev->addr_len = OSA_ADDR_LEN; |
6078 | dev->mtu = card->info.initial_mtu; | 6285 | dev->mtu = card->info.initial_mtu; |
6079 | 6286 | if (card->info.type != QETH_CARD_TYPE_OSN) | |
6080 | SET_ETHTOOL_OPS(dev, &qeth_ethtool_ops); | 6287 | SET_ETHTOOL_OPS(dev, &qeth_ethtool_ops); |
6081 | |||
6082 | SET_MODULE_OWNER(dev); | 6288 | SET_MODULE_OWNER(dev); |
6083 | return 0; | 6289 | return 0; |
6084 | } | 6290 | } |
@@ -6095,6 +6301,7 @@ qeth_init_func_level(struct qeth_card *card) | |||
6095 | QETH_IDX_FUNC_LEVEL_OSAE_ENA_IPAT; | 6301 | QETH_IDX_FUNC_LEVEL_OSAE_ENA_IPAT; |
6096 | } else { | 6302 | } else { |
6097 | if (card->info.type == QETH_CARD_TYPE_IQD) | 6303 | if (card->info.type == QETH_CARD_TYPE_IQD) |
6304 | /*FIXME:why do we have same values for dis and ena for osae??? */ | ||
6098 | card->info.func_level = | 6305 | card->info.func_level = |
6099 | QETH_IDX_FUNC_LEVEL_IQD_DIS_IPAT; | 6306 | QETH_IDX_FUNC_LEVEL_IQD_DIS_IPAT; |
6100 | else | 6307 | else |
@@ -6124,7 +6331,7 @@ retry: | |||
6124 | ccw_device_set_online(CARD_WDEV(card)); | 6331 | ccw_device_set_online(CARD_WDEV(card)); |
6125 | ccw_device_set_online(CARD_DDEV(card)); | 6332 | ccw_device_set_online(CARD_DDEV(card)); |
6126 | } | 6333 | } |
6127 | rc = qeth_qdio_clear_card(card,card->info.type==QETH_CARD_TYPE_OSAE); | 6334 | rc = qeth_qdio_clear_card(card,card->info.type!=QETH_CARD_TYPE_IQD); |
6128 | if (rc == -ERESTARTSYS) { | 6335 | if (rc == -ERESTARTSYS) { |
6129 | QETH_DBF_TEXT(setup, 2, "break1"); | 6336 | QETH_DBF_TEXT(setup, 2, "break1"); |
6130 | return rc; | 6337 | return rc; |
@@ -6176,8 +6383,8 @@ retry: | |||
6176 | card->dev = qeth_get_netdevice(card->info.type, | 6383 | card->dev = qeth_get_netdevice(card->info.type, |
6177 | card->info.link_type); | 6384 | card->info.link_type); |
6178 | if (!card->dev){ | 6385 | if (!card->dev){ |
6179 | qeth_qdio_clear_card(card, card->info.type == | 6386 | qeth_qdio_clear_card(card, card->info.type != |
6180 | QETH_CARD_TYPE_OSAE); | 6387 | QETH_CARD_TYPE_IQD); |
6181 | rc = -ENODEV; | 6388 | rc = -ENODEV; |
6182 | QETH_DBF_TEXT_(setup, 2, "6err%d", rc); | 6389 | QETH_DBF_TEXT_(setup, 2, "6err%d", rc); |
6183 | goto out; | 6390 | goto out; |
@@ -7084,6 +7291,8 @@ qeth_softsetup_card(struct qeth_card *card) | |||
7084 | return rc; | 7291 | return rc; |
7085 | } else | 7292 | } else |
7086 | card->lan_online = 1; | 7293 | card->lan_online = 1; |
7294 | if (card->info.type==QETH_CARD_TYPE_OSN) | ||
7295 | goto out; | ||
7087 | if (card->options.layer2) { | 7296 | if (card->options.layer2) { |
7088 | card->dev->features |= | 7297 | card->dev->features |= |
7089 | NETIF_F_HW_VLAN_FILTER | | 7298 | NETIF_F_HW_VLAN_FILTER | |
@@ -7255,7 +7464,8 @@ qeth_stop_card(struct qeth_card *card, int recovery_mode) | |||
7255 | if (card->read.state == CH_STATE_UP && | 7464 | if (card->read.state == CH_STATE_UP && |
7256 | card->write.state == CH_STATE_UP && | 7465 | card->write.state == CH_STATE_UP && |
7257 | (card->state == CARD_STATE_UP)) { | 7466 | (card->state == CARD_STATE_UP)) { |
7258 | if(recovery_mode) { | 7467 | if (recovery_mode && |
7468 | card->info.type != QETH_CARD_TYPE_OSN) { | ||
7259 | qeth_stop(card->dev); | 7469 | qeth_stop(card->dev); |
7260 | } else { | 7470 | } else { |
7261 | rtnl_lock(); | 7471 | rtnl_lock(); |
@@ -7437,7 +7647,8 @@ qeth_start_again(struct qeth_card *card, int recovery_mode) | |||
7437 | { | 7647 | { |
7438 | QETH_DBF_TEXT(setup ,2, "startag"); | 7648 | QETH_DBF_TEXT(setup ,2, "startag"); |
7439 | 7649 | ||
7440 | if(recovery_mode) { | 7650 | if (recovery_mode && |
7651 | card->info.type != QETH_CARD_TYPE_OSN) { | ||
7441 | qeth_open(card->dev); | 7652 | qeth_open(card->dev); |
7442 | } else { | 7653 | } else { |
7443 | rtnl_lock(); | 7654 | rtnl_lock(); |
@@ -7469,33 +7680,36 @@ qeth_start_again(struct qeth_card *card, int recovery_mode) | |||
7469 | static void qeth_make_parameters_consistent(struct qeth_card *card) | 7680 | static void qeth_make_parameters_consistent(struct qeth_card *card) |
7470 | { | 7681 | { |
7471 | 7682 | ||
7472 | if (card->options.layer2) { | 7683 | if (card->options.layer2 == 0) |
7473 | if (card->info.type == QETH_CARD_TYPE_IQD) { | 7684 | return; |
7474 | PRINT_ERR("Device %s does not support " \ | 7685 | if (card->info.type == QETH_CARD_TYPE_OSN) |
7475 | "layer 2 functionality. " \ | 7686 | return; |
7476 | "Ignoring layer2 option.\n",CARD_BUS_ID(card)); | 7687 | if (card->info.type == QETH_CARD_TYPE_IQD) { |
7477 | } | 7688 | PRINT_ERR("Device %s does not support layer 2 functionality." \ |
7478 | IGNORE_PARAM_NEQ(route4.type, NO_ROUTER, NO_ROUTER, | 7689 | " Ignoring layer2 option.\n",CARD_BUS_ID(card)); |
7479 | "Routing options are"); | 7690 | card->options.layer2 = 0; |
7691 | return; | ||
7692 | } | ||
7693 | IGNORE_PARAM_NEQ(route4.type, NO_ROUTER, NO_ROUTER, | ||
7694 | "Routing options are"); | ||
7480 | #ifdef CONFIG_QETH_IPV6 | 7695 | #ifdef CONFIG_QETH_IPV6 |
7481 | IGNORE_PARAM_NEQ(route6.type, NO_ROUTER, NO_ROUTER, | 7696 | IGNORE_PARAM_NEQ(route6.type, NO_ROUTER, NO_ROUTER, |
7482 | "Routing options are"); | 7697 | "Routing options are"); |
7483 | #endif | 7698 | #endif |
7484 | IGNORE_PARAM_EQ(checksum_type, HW_CHECKSUMMING, | 7699 | IGNORE_PARAM_EQ(checksum_type, HW_CHECKSUMMING, |
7485 | QETH_CHECKSUM_DEFAULT, | 7700 | QETH_CHECKSUM_DEFAULT, |
7486 | "Checksumming options are"); | 7701 | "Checksumming options are"); |
7487 | IGNORE_PARAM_NEQ(broadcast_mode, QETH_TR_BROADCAST_ALLRINGS, | 7702 | IGNORE_PARAM_NEQ(broadcast_mode, QETH_TR_BROADCAST_ALLRINGS, |
7488 | QETH_TR_BROADCAST_ALLRINGS, | 7703 | QETH_TR_BROADCAST_ALLRINGS, |
7489 | "Broadcast mode options are"); | 7704 | "Broadcast mode options are"); |
7490 | IGNORE_PARAM_NEQ(macaddr_mode, QETH_TR_MACADDR_NONCANONICAL, | 7705 | IGNORE_PARAM_NEQ(macaddr_mode, QETH_TR_MACADDR_NONCANONICAL, |
7491 | QETH_TR_MACADDR_NONCANONICAL, | 7706 | QETH_TR_MACADDR_NONCANONICAL, |
7492 | "Canonical MAC addr options are"); | 7707 | "Canonical MAC addr options are"); |
7493 | IGNORE_PARAM_NEQ(fake_broadcast, 0, 0, | 7708 | IGNORE_PARAM_NEQ(fake_broadcast, 0, 0, |
7494 | "Broadcast faking options are"); | 7709 | "Broadcast faking options are"); |
7495 | IGNORE_PARAM_NEQ(add_hhlen, DEFAULT_ADD_HHLEN, | 7710 | IGNORE_PARAM_NEQ(add_hhlen, DEFAULT_ADD_HHLEN, |
7496 | DEFAULT_ADD_HHLEN,"Option add_hhlen is"); | 7711 | DEFAULT_ADD_HHLEN,"Option add_hhlen is"); |
7497 | IGNORE_PARAM_NEQ(fake_ll, 0, 0,"Option fake_ll is"); | 7712 | IGNORE_PARAM_NEQ(fake_ll, 0, 0,"Option fake_ll is"); |
7498 | } | ||
7499 | } | 7713 | } |
7500 | 7714 | ||
7501 | 7715 | ||
@@ -7525,8 +7739,7 @@ __qeth_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
7525 | return -EIO; | 7739 | return -EIO; |
7526 | } | 7740 | } |
7527 | 7741 | ||
7528 | if (card->options.layer2) | 7742 | qeth_make_parameters_consistent(card); |
7529 | qeth_make_parameters_consistent(card); | ||
7530 | 7743 | ||
7531 | if ((rc = qeth_hardsetup_card(card))){ | 7744 | if ((rc = qeth_hardsetup_card(card))){ |
7532 | QETH_DBF_TEXT_(setup, 2, "2err%d", rc); | 7745 | QETH_DBF_TEXT_(setup, 2, "2err%d", rc); |
@@ -7585,6 +7798,7 @@ qeth_set_online(struct ccwgroup_device *gdev) | |||
7585 | static struct ccw_device_id qeth_ids[] = { | 7798 | static struct ccw_device_id qeth_ids[] = { |
7586 | {CCW_DEVICE(0x1731, 0x01), driver_info:QETH_CARD_TYPE_OSAE}, | 7799 | {CCW_DEVICE(0x1731, 0x01), driver_info:QETH_CARD_TYPE_OSAE}, |
7587 | {CCW_DEVICE(0x1731, 0x05), driver_info:QETH_CARD_TYPE_IQD}, | 7800 | {CCW_DEVICE(0x1731, 0x05), driver_info:QETH_CARD_TYPE_IQD}, |
7801 | {CCW_DEVICE(0x1731, 0x06), driver_info:QETH_CARD_TYPE_OSN}, | ||
7588 | {}, | 7802 | {}, |
7589 | }; | 7803 | }; |
7590 | MODULE_DEVICE_TABLE(ccw, qeth_ids); | 7804 | MODULE_DEVICE_TABLE(ccw, qeth_ids); |
@@ -8329,6 +8543,9 @@ again: | |||
8329 | printk("qeth: removed\n"); | 8543 | printk("qeth: removed\n"); |
8330 | } | 8544 | } |
8331 | 8545 | ||
8546 | EXPORT_SYMBOL(qeth_osn_register); | ||
8547 | EXPORT_SYMBOL(qeth_osn_deregister); | ||
8548 | EXPORT_SYMBOL(qeth_osn_assist); | ||
8332 | module_init(qeth_init); | 8549 | module_init(qeth_init); |
8333 | module_exit(qeth_exit); | 8550 | module_exit(qeth_exit); |
8334 | MODULE_AUTHOR("Frank Pavlic <pavlic@de.ibm.com>"); | 8551 | MODULE_AUTHOR("Frank Pavlic <pavlic@de.ibm.com>"); |
diff --git a/drivers/s390/net/qeth_mpc.c b/drivers/s390/net/qeth_mpc.c index f685ecc7da99..30e053d3cac2 100644 --- a/drivers/s390/net/qeth_mpc.c +++ b/drivers/s390/net/qeth_mpc.c | |||
@@ -11,7 +11,7 @@ | |||
11 | #include <asm/cio.h> | 11 | #include <asm/cio.h> |
12 | #include "qeth_mpc.h" | 12 | #include "qeth_mpc.h" |
13 | 13 | ||
14 | const char *VERSION_QETH_MPC_C = "$Revision: 1.11 $"; | 14 | const char *VERSION_QETH_MPC_C = "$Revision: 1.12 $"; |
15 | 15 | ||
16 | unsigned char IDX_ACTIVATE_READ[]={ | 16 | unsigned char IDX_ACTIVATE_READ[]={ |
17 | 0x00,0x00,0x80,0x00, 0x00,0x00,0x00,0x00, | 17 | 0x00,0x00,0x80,0x00, 0x00,0x00,0x00,0x00, |
@@ -138,7 +138,9 @@ unsigned char IPA_PDU_HEADER[]={ | |||
138 | sizeof(struct qeth_ipa_cmd)%256, | 138 | sizeof(struct qeth_ipa_cmd)%256, |
139 | 0x00, | 139 | 0x00, |
140 | sizeof(struct qeth_ipa_cmd)/256, | 140 | sizeof(struct qeth_ipa_cmd)/256, |
141 | sizeof(struct qeth_ipa_cmd),0x05, 0x77,0x77,0x77,0x77, | 141 | sizeof(struct qeth_ipa_cmd)%256, |
142 | 0x05, | ||
143 | 0x77,0x77,0x77,0x77, | ||
142 | 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, | 144 | 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, |
143 | 0x01,0x00, | 145 | 0x01,0x00, |
144 | sizeof(struct qeth_ipa_cmd)/256, | 146 | sizeof(struct qeth_ipa_cmd)/256, |
diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h index 3d916b5c5d09..7edc5f1fc0d2 100644 --- a/drivers/s390/net/qeth_mpc.h +++ b/drivers/s390/net/qeth_mpc.h | |||
@@ -46,13 +46,16 @@ extern unsigned char IPA_PDU_HEADER[]; | |||
46 | /* IP Assist related definitions */ | 46 | /* IP Assist related definitions */ |
47 | /*****************************************************************************/ | 47 | /*****************************************************************************/ |
48 | #define IPA_CMD_INITIATOR_HOST 0x00 | 48 | #define IPA_CMD_INITIATOR_HOST 0x00 |
49 | #define IPA_CMD_INITIATOR_HYDRA 0x01 | 49 | #define IPA_CMD_INITIATOR_OSA 0x01 |
50 | #define IPA_CMD_INITIATOR_HOST_REPLY 0x80 | ||
51 | #define IPA_CMD_INITIATOR_OSA_REPLY 0x81 | ||
50 | #define IPA_CMD_PRIM_VERSION_NO 0x01 | 52 | #define IPA_CMD_PRIM_VERSION_NO 0x01 |
51 | 53 | ||
52 | enum qeth_card_types { | 54 | enum qeth_card_types { |
53 | QETH_CARD_TYPE_UNKNOWN = 0, | 55 | QETH_CARD_TYPE_UNKNOWN = 0, |
54 | QETH_CARD_TYPE_OSAE = 10, | 56 | QETH_CARD_TYPE_OSAE = 10, |
55 | QETH_CARD_TYPE_IQD = 1234, | 57 | QETH_CARD_TYPE_IQD = 1234, |
58 | QETH_CARD_TYPE_OSN = 11, | ||
56 | }; | 59 | }; |
57 | 60 | ||
58 | #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18 | 61 | #define QETH_MPC_DIFINFO_LEN_INDICATES_LINK_TYPE 0x18 |
@@ -61,6 +64,7 @@ enum qeth_link_types { | |||
61 | QETH_LINK_TYPE_FAST_ETH = 0x01, | 64 | QETH_LINK_TYPE_FAST_ETH = 0x01, |
62 | QETH_LINK_TYPE_HSTR = 0x02, | 65 | QETH_LINK_TYPE_HSTR = 0x02, |
63 | QETH_LINK_TYPE_GBIT_ETH = 0x03, | 66 | QETH_LINK_TYPE_GBIT_ETH = 0x03, |
67 | QETH_LINK_TYPE_OSN = 0x04, | ||
64 | QETH_LINK_TYPE_10GBIT_ETH = 0x10, | 68 | QETH_LINK_TYPE_10GBIT_ETH = 0x10, |
65 | QETH_LINK_TYPE_LANE_ETH100 = 0x81, | 69 | QETH_LINK_TYPE_LANE_ETH100 = 0x81, |
66 | QETH_LINK_TYPE_LANE_TR = 0x82, | 70 | QETH_LINK_TYPE_LANE_TR = 0x82, |
@@ -111,6 +115,9 @@ enum qeth_ipa_cmds { | |||
111 | IPA_CMD_DELGMAC = 0x24, | 115 | IPA_CMD_DELGMAC = 0x24, |
112 | IPA_CMD_SETVLAN = 0x25, | 116 | IPA_CMD_SETVLAN = 0x25, |
113 | IPA_CMD_DELVLAN = 0x26, | 117 | IPA_CMD_DELVLAN = 0x26, |
118 | IPA_CMD_SETCCID = 0x41, | ||
119 | IPA_CMD_DELCCID = 0x42, | ||
120 | IPA_CMD_MODCCID = 0x43, | ||
114 | IPA_CMD_SETIP = 0xb1, | 121 | IPA_CMD_SETIP = 0xb1, |
115 | IPA_CMD_DELIP = 0xb7, | 122 | IPA_CMD_DELIP = 0xb7, |
116 | IPA_CMD_QIPASSIST = 0xb2, | 123 | IPA_CMD_QIPASSIST = 0xb2, |
@@ -437,8 +444,9 @@ enum qeth_ipa_arp_return_codes { | |||
437 | #define QETH_ARP_DATA_SIZE 3968 | 444 | #define QETH_ARP_DATA_SIZE 3968 |
438 | #define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8) | 445 | #define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8) |
439 | /* Helper functions */ | 446 | /* Helper functions */ |
440 | #define IS_IPA_REPLY(cmd) (cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) | 447 | #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \ |
441 | 448 | (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY)) | |
449 | |||
442 | /*****************************************************************************/ | 450 | /*****************************************************************************/ |
443 | /* END OF IP Assist related definitions */ | 451 | /* END OF IP Assist related definitions */ |
444 | /*****************************************************************************/ | 452 | /*****************************************************************************/ |
@@ -483,6 +491,7 @@ extern unsigned char ULP_ENABLE[]; | |||
483 | /* Layer 2 defintions */ | 491 | /* Layer 2 defintions */ |
484 | #define QETH_PROT_LAYER2 0x08 | 492 | #define QETH_PROT_LAYER2 0x08 |
485 | #define QETH_PROT_TCPIP 0x03 | 493 | #define QETH_PROT_TCPIP 0x03 |
494 | #define QETH_PROT_OSN2 0x0a | ||
486 | #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer+0x50) | 495 | #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer+0x50) |
487 | #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer+0x19) | 496 | #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer+0x19) |
488 | 497 | ||
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index dda105b73063..f91a02db5743 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.54 $) | 3 | * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.55 $) |
4 | * | 4 | * |
5 | * Linux on zSeries OSA Express and HiperSockets support | 5 | * Linux on zSeries OSA Express and HiperSockets support |
6 | * This file contains code related to sysfs. | 6 | * This file contains code related to sysfs. |
@@ -20,7 +20,7 @@ | |||
20 | #include "qeth_mpc.h" | 20 | #include "qeth_mpc.h" |
21 | #include "qeth_fs.h" | 21 | #include "qeth_fs.h" |
22 | 22 | ||
23 | const char *VERSION_QETH_SYS_C = "$Revision: 1.54 $"; | 23 | const char *VERSION_QETH_SYS_C = "$Revision: 1.55 $"; |
24 | 24 | ||
25 | /*****************************************************************************/ | 25 | /*****************************************************************************/ |
26 | /* */ | 26 | /* */ |
@@ -937,6 +937,19 @@ static struct attribute_group qeth_device_attr_group = { | |||
937 | .attrs = (struct attribute **)qeth_device_attrs, | 937 | .attrs = (struct attribute **)qeth_device_attrs, |
938 | }; | 938 | }; |
939 | 939 | ||
940 | static struct device_attribute * qeth_osn_device_attrs[] = { | ||
941 | &dev_attr_state, | ||
942 | &dev_attr_chpid, | ||
943 | &dev_attr_if_name, | ||
944 | &dev_attr_card_type, | ||
945 | &dev_attr_buffer_count, | ||
946 | &dev_attr_recover, | ||
947 | NULL, | ||
948 | }; | ||
949 | |||
950 | static struct attribute_group qeth_osn_device_attr_group = { | ||
951 | .attrs = (struct attribute **)qeth_osn_device_attrs, | ||
952 | }; | ||
940 | 953 | ||
941 | #define QETH_DEVICE_ATTR(_id,_name,_mode,_show,_store) \ | 954 | #define QETH_DEVICE_ATTR(_id,_name,_mode,_show,_store) \ |
942 | struct device_attribute dev_attr_##_id = { \ | 955 | struct device_attribute dev_attr_##_id = { \ |
@@ -1667,7 +1680,12 @@ int | |||
1667 | qeth_create_device_attributes(struct device *dev) | 1680 | qeth_create_device_attributes(struct device *dev) |
1668 | { | 1681 | { |
1669 | int ret; | 1682 | int ret; |
1683 | struct qeth_card *card = dev->driver_data; | ||
1670 | 1684 | ||
1685 | if (card->info.type == QETH_CARD_TYPE_OSN) | ||
1686 | return sysfs_create_group(&dev->kobj, | ||
1687 | &qeth_osn_device_attr_group); | ||
1688 | |||
1671 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_attr_group))) | 1689 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_attr_group))) |
1672 | return ret; | 1690 | return ret; |
1673 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_ipato_group))){ | 1691 | if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_ipato_group))){ |
@@ -1693,6 +1711,12 @@ qeth_create_device_attributes(struct device *dev) | |||
1693 | void | 1711 | void |
1694 | qeth_remove_device_attributes(struct device *dev) | 1712 | qeth_remove_device_attributes(struct device *dev) |
1695 | { | 1713 | { |
1714 | struct qeth_card *card = dev->driver_data; | ||
1715 | |||
1716 | if (card->info.type == QETH_CARD_TYPE_OSN) | ||
1717 | return sysfs_remove_group(&dev->kobj, | ||
1718 | &qeth_osn_device_attr_group); | ||
1719 | |||
1696 | sysfs_remove_group(&dev->kobj, &qeth_device_attr_group); | 1720 | sysfs_remove_group(&dev->kobj, &qeth_device_attr_group); |
1697 | sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group); | 1721 | sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group); |
1698 | sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group); | 1722 | sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group); |
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index d40ba0bd68a3..23392ae7df8b 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c | |||
@@ -91,7 +91,7 @@ | |||
91 | #ifndef NDEBUG | 91 | #ifndef NDEBUG |
92 | #define NDEBUG 0 | 92 | #define NDEBUG 0 |
93 | #endif | 93 | #endif |
94 | #ifndef NDEBUG | 94 | #ifndef NDEBUG_ABORT |
95 | #define NDEBUG_ABORT 0 | 95 | #define NDEBUG_ABORT 0 |
96 | #endif | 96 | #endif |
97 | 97 | ||
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 4a99d2f000f4..d54b1cc88d0d 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #define AAC_MAX_LUN (8) | 19 | #define AAC_MAX_LUN (8) |
20 | 20 | ||
21 | #define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff) | 21 | #define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff) |
22 | #define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)512) | 22 | #define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)256) |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * These macros convert from physical channels to virtual channels | 25 | * These macros convert from physical channels to virtual channels |
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index f0d8f89b5d40..cbab5868ffdf 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -216,7 +216,7 @@ static Scsi_Host_Template ahci_sht = { | |||
216 | .ordered_flush = 1, | 216 | .ordered_flush = 1, |
217 | }; | 217 | }; |
218 | 218 | ||
219 | static struct ata_port_operations ahci_ops = { | 219 | static const struct ata_port_operations ahci_ops = { |
220 | .port_disable = ata_port_disable, | 220 | .port_disable = ata_port_disable, |
221 | 221 | ||
222 | .check_status = ahci_check_status, | 222 | .check_status = ahci_check_status, |
@@ -415,7 +415,7 @@ static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in) | |||
415 | return 0xffffffffU; | 415 | return 0xffffffffU; |
416 | } | 416 | } |
417 | 417 | ||
418 | return readl((void *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 418 | return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); |
419 | } | 419 | } |
420 | 420 | ||
421 | 421 | ||
@@ -433,7 +433,7 @@ static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg_in, | |||
433 | return; | 433 | return; |
434 | } | 434 | } |
435 | 435 | ||
436 | writel(val, (void *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 436 | writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); |
437 | } | 437 | } |
438 | 438 | ||
439 | static void ahci_phy_reset(struct ata_port *ap) | 439 | static void ahci_phy_reset(struct ata_port *ap) |
@@ -461,14 +461,14 @@ static void ahci_phy_reset(struct ata_port *ap) | |||
461 | 461 | ||
462 | static u8 ahci_check_status(struct ata_port *ap) | 462 | static u8 ahci_check_status(struct ata_port *ap) |
463 | { | 463 | { |
464 | void *mmio = (void *) ap->ioaddr.cmd_addr; | 464 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr; |
465 | 465 | ||
466 | return readl(mmio + PORT_TFDATA) & 0xFF; | 466 | return readl(mmio + PORT_TFDATA) & 0xFF; |
467 | } | 467 | } |
468 | 468 | ||
469 | static u8 ahci_check_err(struct ata_port *ap) | 469 | static u8 ahci_check_err(struct ata_port *ap) |
470 | { | 470 | { |
471 | void *mmio = (void *) ap->ioaddr.cmd_addr; | 471 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr; |
472 | 472 | ||
473 | return (readl(mmio + PORT_TFDATA) >> 8) & 0xFF; | 473 | return (readl(mmio + PORT_TFDATA) >> 8) & 0xFF; |
474 | } | 474 | } |
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index d71cef767cec..be021478f416 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -147,7 +147,7 @@ static Scsi_Host_Template piix_sht = { | |||
147 | .ordered_flush = 1, | 147 | .ordered_flush = 1, |
148 | }; | 148 | }; |
149 | 149 | ||
150 | static struct ata_port_operations piix_pata_ops = { | 150 | static const struct ata_port_operations piix_pata_ops = { |
151 | .port_disable = ata_port_disable, | 151 | .port_disable = ata_port_disable, |
152 | .set_piomode = piix_set_piomode, | 152 | .set_piomode = piix_set_piomode, |
153 | .set_dmamode = piix_set_dmamode, | 153 | .set_dmamode = piix_set_dmamode, |
@@ -177,7 +177,7 @@ static struct ata_port_operations piix_pata_ops = { | |||
177 | .host_stop = ata_host_stop, | 177 | .host_stop = ata_host_stop, |
178 | }; | 178 | }; |
179 | 179 | ||
180 | static struct ata_port_operations piix_sata_ops = { | 180 | static const struct ata_port_operations piix_sata_ops = { |
181 | .port_disable = ata_port_disable, | 181 | .port_disable = ata_port_disable, |
182 | 182 | ||
183 | .tf_load = ata_tf_load, | 183 | .tf_load = ata_tf_load, |
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index c10e45b94b62..3d13fdee4fc2 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c | |||
@@ -1357,7 +1357,7 @@ static int port_detect(unsigned long port_base, unsigned int j, | |||
1357 | 1357 | ||
1358 | for (i = 0; i < shost->can_queue; i++) { | 1358 | for (i = 0; i < shost->can_queue; i++) { |
1359 | size_t sz = shost->sg_tablesize *sizeof(struct sg_list); | 1359 | size_t sz = shost->sg_tablesize *sizeof(struct sg_list); |
1360 | unsigned int gfp_mask = (shost->unchecked_isa_dma ? GFP_DMA : 0) | GFP_ATOMIC; | 1360 | gfp_t gfp_mask = (shost->unchecked_isa_dma ? GFP_DMA : 0) | GFP_ATOMIC; |
1361 | ha->cp[i].sglist = kmalloc(sz, gfp_mask); | 1361 | ha->cp[i].sglist = kmalloc(sz, gfp_mask); |
1362 | if (!ha->cp[i].sglist) { | 1362 | if (!ha->cp[i].sglist) { |
1363 | printk | 1363 | printk |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 02fe371b0ab8..f24d84538fd5 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -287,7 +287,8 @@ static void scsi_host_dev_release(struct device *dev) | |||
287 | struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) | 287 | struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) |
288 | { | 288 | { |
289 | struct Scsi_Host *shost; | 289 | struct Scsi_Host *shost; |
290 | int gfp_mask = GFP_KERNEL, rval; | 290 | gfp_t gfp_mask = GFP_KERNEL; |
291 | int rval; | ||
291 | 292 | ||
292 | if (sht->unchecked_isa_dma && privsize) | 293 | if (sht->unchecked_isa_dma && privsize) |
293 | gfp_mask |= __GFP_DMA; | 294 | gfp_mask |= __GFP_DMA; |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index c5e663fefdf7..64f30bf59315 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -67,9 +67,9 @@ static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev); | |||
67 | static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev); | 67 | static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev); |
68 | static void ata_set_mode(struct ata_port *ap); | 68 | static void ata_set_mode(struct ata_port *ap); |
69 | static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); | 69 | static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); |
70 | static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift); | 70 | static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift); |
71 | static int fgb(u32 bitmap); | 71 | static int fgb(u32 bitmap); |
72 | static int ata_choose_xfer_mode(struct ata_port *ap, | 72 | static int ata_choose_xfer_mode(const struct ata_port *ap, |
73 | u8 *xfer_mode_out, | 73 | u8 *xfer_mode_out, |
74 | unsigned int *xfer_shift_out); | 74 | unsigned int *xfer_shift_out); |
75 | static void __ata_qc_complete(struct ata_queued_cmd *qc); | 75 | static void __ata_qc_complete(struct ata_queued_cmd *qc); |
@@ -87,7 +87,7 @@ MODULE_LICENSE("GPL"); | |||
87 | MODULE_VERSION(DRV_VERSION); | 87 | MODULE_VERSION(DRV_VERSION); |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * ata_tf_load - send taskfile registers to host controller | 90 | * ata_tf_load_pio - send taskfile registers to host controller |
91 | * @ap: Port to which output is sent | 91 | * @ap: Port to which output is sent |
92 | * @tf: ATA taskfile register set | 92 | * @tf: ATA taskfile register set |
93 | * | 93 | * |
@@ -97,7 +97,7 @@ MODULE_VERSION(DRV_VERSION); | |||
97 | * Inherited from caller. | 97 | * Inherited from caller. |
98 | */ | 98 | */ |
99 | 99 | ||
100 | static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf) | 100 | static void ata_tf_load_pio(struct ata_port *ap, const struct ata_taskfile *tf) |
101 | { | 101 | { |
102 | struct ata_ioports *ioaddr = &ap->ioaddr; | 102 | struct ata_ioports *ioaddr = &ap->ioaddr; |
103 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | 103 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; |
@@ -155,7 +155,7 @@ static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf) | |||
155 | * Inherited from caller. | 155 | * Inherited from caller. |
156 | */ | 156 | */ |
157 | 157 | ||
158 | static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) | 158 | static void ata_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
159 | { | 159 | { |
160 | struct ata_ioports *ioaddr = &ap->ioaddr; | 160 | struct ata_ioports *ioaddr = &ap->ioaddr; |
161 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | 161 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; |
@@ -224,7 +224,7 @@ static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) | |||
224 | * LOCKING: | 224 | * LOCKING: |
225 | * Inherited from caller. | 225 | * Inherited from caller. |
226 | */ | 226 | */ |
227 | void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) | 227 | void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) |
228 | { | 228 | { |
229 | if (ap->flags & ATA_FLAG_MMIO) | 229 | if (ap->flags & ATA_FLAG_MMIO) |
230 | ata_tf_load_mmio(ap, tf); | 230 | ata_tf_load_mmio(ap, tf); |
@@ -244,7 +244,7 @@ void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) | |||
244 | * spin_lock_irqsave(host_set lock) | 244 | * spin_lock_irqsave(host_set lock) |
245 | */ | 245 | */ |
246 | 246 | ||
247 | static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf) | 247 | static void ata_exec_command_pio(struct ata_port *ap, const struct ata_taskfile *tf) |
248 | { | 248 | { |
249 | DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); | 249 | DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); |
250 | 250 | ||
@@ -265,7 +265,7 @@ static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf) | |||
265 | * spin_lock_irqsave(host_set lock) | 265 | * spin_lock_irqsave(host_set lock) |
266 | */ | 266 | */ |
267 | 267 | ||
268 | static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) | 268 | static void ata_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
269 | { | 269 | { |
270 | DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); | 270 | DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); |
271 | 271 | ||
@@ -285,7 +285,7 @@ static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) | |||
285 | * LOCKING: | 285 | * LOCKING: |
286 | * spin_lock_irqsave(host_set lock) | 286 | * spin_lock_irqsave(host_set lock) |
287 | */ | 287 | */ |
288 | void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf) | 288 | void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf) |
289 | { | 289 | { |
290 | if (ap->flags & ATA_FLAG_MMIO) | 290 | if (ap->flags & ATA_FLAG_MMIO) |
291 | ata_exec_command_mmio(ap, tf); | 291 | ata_exec_command_mmio(ap, tf); |
@@ -305,7 +305,7 @@ void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf) | |||
305 | * Obtains host_set lock. | 305 | * Obtains host_set lock. |
306 | */ | 306 | */ |
307 | 307 | ||
308 | static inline void ata_exec(struct ata_port *ap, struct ata_taskfile *tf) | 308 | static inline void ata_exec(struct ata_port *ap, const struct ata_taskfile *tf) |
309 | { | 309 | { |
310 | unsigned long flags; | 310 | unsigned long flags; |
311 | 311 | ||
@@ -328,7 +328,7 @@ static inline void ata_exec(struct ata_port *ap, struct ata_taskfile *tf) | |||
328 | * Obtains host_set lock. | 328 | * Obtains host_set lock. |
329 | */ | 329 | */ |
330 | 330 | ||
331 | static void ata_tf_to_host(struct ata_port *ap, struct ata_taskfile *tf) | 331 | static void ata_tf_to_host(struct ata_port *ap, const struct ata_taskfile *tf) |
332 | { | 332 | { |
333 | ap->ops->tf_load(ap, tf); | 333 | ap->ops->tf_load(ap, tf); |
334 | 334 | ||
@@ -348,7 +348,7 @@ static void ata_tf_to_host(struct ata_port *ap, struct ata_taskfile *tf) | |||
348 | * spin_lock_irqsave(host_set lock) | 348 | * spin_lock_irqsave(host_set lock) |
349 | */ | 349 | */ |
350 | 350 | ||
351 | void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf) | 351 | void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf) |
352 | { | 352 | { |
353 | ap->ops->tf_load(ap, tf); | 353 | ap->ops->tf_load(ap, tf); |
354 | ap->ops->exec_command(ap, tf); | 354 | ap->ops->exec_command(ap, tf); |
@@ -558,7 +558,7 @@ u8 ata_chk_err(struct ata_port *ap) | |||
558 | * Inherited from caller. | 558 | * Inherited from caller. |
559 | */ | 559 | */ |
560 | 560 | ||
561 | void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp) | 561 | void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp) |
562 | { | 562 | { |
563 | fis[0] = 0x27; /* Register - Host to Device FIS */ | 563 | fis[0] = 0x27; /* Register - Host to Device FIS */ |
564 | fis[1] = (pmp & 0xf) | (1 << 7); /* Port multiplier number, | 564 | fis[1] = (pmp & 0xf) | (1 << 7); /* Port multiplier number, |
@@ -599,7 +599,7 @@ void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp) | |||
599 | * Inherited from caller. | 599 | * Inherited from caller. |
600 | */ | 600 | */ |
601 | 601 | ||
602 | void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf) | 602 | void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf) |
603 | { | 603 | { |
604 | tf->command = fis[2]; /* status */ | 604 | tf->command = fis[2]; /* status */ |
605 | tf->feature = fis[3]; /* error */ | 605 | tf->feature = fis[3]; /* error */ |
@@ -845,7 +845,7 @@ static unsigned int ata_devchk(struct ata_port *ap, | |||
845 | * the event of failure. | 845 | * the event of failure. |
846 | */ | 846 | */ |
847 | 847 | ||
848 | unsigned int ata_dev_classify(struct ata_taskfile *tf) | 848 | unsigned int ata_dev_classify(const struct ata_taskfile *tf) |
849 | { | 849 | { |
850 | /* Apple's open source Darwin code hints that some devices only | 850 | /* Apple's open source Darwin code hints that some devices only |
851 | * put a proper signature into the LBA mid/high registers, | 851 | * put a proper signature into the LBA mid/high registers, |
@@ -937,7 +937,7 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device) | |||
937 | * caller. | 937 | * caller. |
938 | */ | 938 | */ |
939 | 939 | ||
940 | void ata_dev_id_string(u16 *id, unsigned char *s, | 940 | void ata_dev_id_string(const u16 *id, unsigned char *s, |
941 | unsigned int ofs, unsigned int len) | 941 | unsigned int ofs, unsigned int len) |
942 | { | 942 | { |
943 | unsigned int c; | 943 | unsigned int c; |
@@ -1054,7 +1054,7 @@ void ata_dev_select(struct ata_port *ap, unsigned int device, | |||
1054 | * caller. | 1054 | * caller. |
1055 | */ | 1055 | */ |
1056 | 1056 | ||
1057 | static inline void ata_dump_id(struct ata_device *dev) | 1057 | static inline void ata_dump_id(const struct ata_device *dev) |
1058 | { | 1058 | { |
1059 | DPRINTK("49==0x%04x " | 1059 | DPRINTK("49==0x%04x " |
1060 | "53==0x%04x " | 1060 | "53==0x%04x " |
@@ -1082,6 +1082,31 @@ static inline void ata_dump_id(struct ata_device *dev) | |||
1082 | dev->id[93]); | 1082 | dev->id[93]); |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | /* | ||
1086 | * Compute the PIO modes available for this device. This is not as | ||
1087 | * trivial as it seems if we must consider early devices correctly. | ||
1088 | * | ||
1089 | * FIXME: pre IDE drive timing (do we care ?). | ||
1090 | */ | ||
1091 | |||
1092 | static unsigned int ata_pio_modes(const struct ata_device *adev) | ||
1093 | { | ||
1094 | u16 modes; | ||
1095 | |||
1096 | /* Usual case. Word 53 indicates word 88 is valid */ | ||
1097 | if (adev->id[ATA_ID_FIELD_VALID] & (1 << 2)) { | ||
1098 | modes = adev->id[ATA_ID_PIO_MODES] & 0x03; | ||
1099 | modes <<= 3; | ||
1100 | modes |= 0x7; | ||
1101 | return modes; | ||
1102 | } | ||
1103 | |||
1104 | /* If word 88 isn't valid then Word 51 holds the PIO timing number | ||
1105 | for the maximum. Turn it into a mask and return it */ | ||
1106 | modes = (2 << (adev->id[ATA_ID_OLD_PIO_MODES] & 0xFF)) - 1 ; | ||
1107 | return modes; | ||
1108 | } | ||
1109 | |||
1085 | /** | 1110 | /** |
1086 | * ata_dev_identify - obtain IDENTIFY x DEVICE page | 1111 | * ata_dev_identify - obtain IDENTIFY x DEVICE page |
1087 | * @ap: port on which device we wish to probe resides | 1112 | * @ap: port on which device we wish to probe resides |
@@ -1215,10 +1240,8 @@ retry: | |||
1215 | xfer_modes = dev->id[ATA_ID_UDMA_MODES]; | 1240 | xfer_modes = dev->id[ATA_ID_UDMA_MODES]; |
1216 | if (!xfer_modes) | 1241 | if (!xfer_modes) |
1217 | xfer_modes = (dev->id[ATA_ID_MWDMA_MODES]) << ATA_SHIFT_MWDMA; | 1242 | xfer_modes = (dev->id[ATA_ID_MWDMA_MODES]) << ATA_SHIFT_MWDMA; |
1218 | if (!xfer_modes) { | 1243 | if (!xfer_modes) |
1219 | xfer_modes = (dev->id[ATA_ID_PIO_MODES]) << (ATA_SHIFT_PIO + 3); | 1244 | xfer_modes = ata_pio_modes(dev); |
1220 | xfer_modes |= (0x7 << ATA_SHIFT_PIO); | ||
1221 | } | ||
1222 | 1245 | ||
1223 | ata_dump_id(dev); | 1246 | ata_dump_id(dev); |
1224 | 1247 | ||
@@ -1329,7 +1352,7 @@ err_out: | |||
1329 | } | 1352 | } |
1330 | 1353 | ||
1331 | 1354 | ||
1332 | static inline u8 ata_dev_knobble(struct ata_port *ap) | 1355 | static inline u8 ata_dev_knobble(const struct ata_port *ap) |
1333 | { | 1356 | { |
1334 | return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id))); | 1357 | return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id))); |
1335 | } | 1358 | } |
@@ -1515,7 +1538,153 @@ void ata_port_disable(struct ata_port *ap) | |||
1515 | ap->flags |= ATA_FLAG_PORT_DISABLED; | 1538 | ap->flags |= ATA_FLAG_PORT_DISABLED; |
1516 | } | 1539 | } |
1517 | 1540 | ||
1518 | static struct { | 1541 | /* |
1542 | * This mode timing computation functionality is ported over from | ||
1543 | * drivers/ide/ide-timing.h and was originally written by Vojtech Pavlik | ||
1544 | */ | ||
1545 | /* | ||
1546 | * PIO 0-5, MWDMA 0-2 and UDMA 0-6 timings (in nanoseconds). | ||
1547 | * These were taken from ATA/ATAPI-6 standard, rev 0a, except | ||
1548 | * for PIO 5, which is a nonstandard extension and UDMA6, which | ||
1549 | * is currently supported only by Maxtor drives. | ||
1550 | */ | ||
1551 | |||
1552 | static const struct ata_timing ata_timing[] = { | ||
1553 | |||
1554 | { XFER_UDMA_6, 0, 0, 0, 0, 0, 0, 0, 15 }, | ||
1555 | { XFER_UDMA_5, 0, 0, 0, 0, 0, 0, 0, 20 }, | ||
1556 | { XFER_UDMA_4, 0, 0, 0, 0, 0, 0, 0, 30 }, | ||
1557 | { XFER_UDMA_3, 0, 0, 0, 0, 0, 0, 0, 45 }, | ||
1558 | |||
1559 | { XFER_UDMA_2, 0, 0, 0, 0, 0, 0, 0, 60 }, | ||
1560 | { XFER_UDMA_1, 0, 0, 0, 0, 0, 0, 0, 80 }, | ||
1561 | { XFER_UDMA_0, 0, 0, 0, 0, 0, 0, 0, 120 }, | ||
1562 | |||
1563 | /* { XFER_UDMA_SLOW, 0, 0, 0, 0, 0, 0, 0, 150 }, */ | ||
1564 | |||
1565 | { XFER_MW_DMA_2, 25, 0, 0, 0, 70, 25, 120, 0 }, | ||
1566 | { XFER_MW_DMA_1, 45, 0, 0, 0, 80, 50, 150, 0 }, | ||
1567 | { XFER_MW_DMA_0, 60, 0, 0, 0, 215, 215, 480, 0 }, | ||
1568 | |||
1569 | { XFER_SW_DMA_2, 60, 0, 0, 0, 120, 120, 240, 0 }, | ||
1570 | { XFER_SW_DMA_1, 90, 0, 0, 0, 240, 240, 480, 0 }, | ||
1571 | { XFER_SW_DMA_0, 120, 0, 0, 0, 480, 480, 960, 0 }, | ||
1572 | |||
1573 | /* { XFER_PIO_5, 20, 50, 30, 100, 50, 30, 100, 0 }, */ | ||
1574 | { XFER_PIO_4, 25, 70, 25, 120, 70, 25, 120, 0 }, | ||
1575 | { XFER_PIO_3, 30, 80, 70, 180, 80, 70, 180, 0 }, | ||
1576 | |||
1577 | { XFER_PIO_2, 30, 290, 40, 330, 100, 90, 240, 0 }, | ||
1578 | { XFER_PIO_1, 50, 290, 93, 383, 125, 100, 383, 0 }, | ||
1579 | { XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0 }, | ||
1580 | |||
1581 | /* { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 960, 0 }, */ | ||
1582 | |||
1583 | { 0xFF } | ||
1584 | }; | ||
1585 | |||
1586 | #define ENOUGH(v,unit) (((v)-1)/(unit)+1) | ||
1587 | #define EZ(v,unit) ((v)?ENOUGH(v,unit):0) | ||
1588 | |||
1589 | static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT) | ||
1590 | { | ||
1591 | q->setup = EZ(t->setup * 1000, T); | ||
1592 | q->act8b = EZ(t->act8b * 1000, T); | ||
1593 | q->rec8b = EZ(t->rec8b * 1000, T); | ||
1594 | q->cyc8b = EZ(t->cyc8b * 1000, T); | ||
1595 | q->active = EZ(t->active * 1000, T); | ||
1596 | q->recover = EZ(t->recover * 1000, T); | ||
1597 | q->cycle = EZ(t->cycle * 1000, T); | ||
1598 | q->udma = EZ(t->udma * 1000, UT); | ||
1599 | } | ||
1600 | |||
1601 | void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b, | ||
1602 | struct ata_timing *m, unsigned int what) | ||
1603 | { | ||
1604 | if (what & ATA_TIMING_SETUP ) m->setup = max(a->setup, b->setup); | ||
1605 | if (what & ATA_TIMING_ACT8B ) m->act8b = max(a->act8b, b->act8b); | ||
1606 | if (what & ATA_TIMING_REC8B ) m->rec8b = max(a->rec8b, b->rec8b); | ||
1607 | if (what & ATA_TIMING_CYC8B ) m->cyc8b = max(a->cyc8b, b->cyc8b); | ||
1608 | if (what & ATA_TIMING_ACTIVE ) m->active = max(a->active, b->active); | ||
1609 | if (what & ATA_TIMING_RECOVER) m->recover = max(a->recover, b->recover); | ||
1610 | if (what & ATA_TIMING_CYCLE ) m->cycle = max(a->cycle, b->cycle); | ||
1611 | if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma); | ||
1612 | } | ||
1613 | |||
1614 | static const struct ata_timing* ata_timing_find_mode(unsigned short speed) | ||
1615 | { | ||
1616 | const struct ata_timing *t; | ||
1617 | |||
1618 | for (t = ata_timing; t->mode != speed; t++) | ||
1619 | if (t->mode == 0xFF) | ||
1620 | return NULL; | ||
1621 | return t; | ||
1622 | } | ||
1623 | |||
1624 | int ata_timing_compute(struct ata_device *adev, unsigned short speed, | ||
1625 | struct ata_timing *t, int T, int UT) | ||
1626 | { | ||
1627 | const struct ata_timing *s; | ||
1628 | struct ata_timing p; | ||
1629 | |||
1630 | /* | ||
1631 | * Find the mode. | ||
1632 | */ | ||
1633 | |||
1634 | if (!(s = ata_timing_find_mode(speed))) | ||
1635 | return -EINVAL; | ||
1636 | |||
1637 | /* | ||
1638 | * If the drive is an EIDE drive, it can tell us it needs extended | ||
1639 | * PIO/MW_DMA cycle timing. | ||
1640 | */ | ||
1641 | |||
1642 | if (adev->id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */ | ||
1643 | memset(&p, 0, sizeof(p)); | ||
1644 | if(speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) { | ||
1645 | if (speed <= XFER_PIO_2) p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO]; | ||
1646 | else p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO_IORDY]; | ||
1647 | } else if(speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) { | ||
1648 | p.cycle = adev->id[ATA_ID_EIDE_DMA_MIN]; | ||
1649 | } | ||
1650 | ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B); | ||
1651 | } | ||
1652 | |||
1653 | /* | ||
1654 | * Convert the timing to bus clock counts. | ||
1655 | */ | ||
1656 | |||
1657 | ata_timing_quantize(s, t, T, UT); | ||
1658 | |||
1659 | /* | ||
1660 | * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T | ||
1661 | * and some other commands. We have to ensure that the DMA cycle timing is | ||
1662 | * slower/equal than the fastest PIO timing. | ||
1663 | */ | ||
1664 | |||
1665 | if (speed > XFER_PIO_4) { | ||
1666 | ata_timing_compute(adev, adev->pio_mode, &p, T, UT); | ||
1667 | ata_timing_merge(&p, t, t, ATA_TIMING_ALL); | ||
1668 | } | ||
1669 | |||
1670 | /* | ||
1671 | * Lenghten active & recovery time so that cycle time is correct. | ||
1672 | */ | ||
1673 | |||
1674 | if (t->act8b + t->rec8b < t->cyc8b) { | ||
1675 | t->act8b += (t->cyc8b - (t->act8b + t->rec8b)) / 2; | ||
1676 | t->rec8b = t->cyc8b - t->act8b; | ||
1677 | } | ||
1678 | |||
1679 | if (t->active + t->recover < t->cycle) { | ||
1680 | t->active += (t->cycle - (t->active + t->recover)) / 2; | ||
1681 | t->recover = t->cycle - t->active; | ||
1682 | } | ||
1683 | |||
1684 | return 0; | ||
1685 | } | ||
1686 | |||
1687 | static const struct { | ||
1519 | unsigned int shift; | 1688 | unsigned int shift; |
1520 | u8 base; | 1689 | u8 base; |
1521 | } xfer_mode_classes[] = { | 1690 | } xfer_mode_classes[] = { |
@@ -1924,7 +2093,8 @@ err_out: | |||
1924 | DPRINTK("EXIT\n"); | 2093 | DPRINTK("EXIT\n"); |
1925 | } | 2094 | } |
1926 | 2095 | ||
1927 | static void ata_pr_blacklisted(struct ata_port *ap, struct ata_device *dev) | 2096 | static void ata_pr_blacklisted(const struct ata_port *ap, |
2097 | const struct ata_device *dev) | ||
1928 | { | 2098 | { |
1929 | printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, disabling DMA\n", | 2099 | printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, disabling DMA\n", |
1930 | ap->id, dev->devno); | 2100 | ap->id, dev->devno); |
@@ -1962,7 +2132,7 @@ static const char * ata_dma_blacklist [] = { | |||
1962 | "_NEC DV5800A", | 2132 | "_NEC DV5800A", |
1963 | }; | 2133 | }; |
1964 | 2134 | ||
1965 | static int ata_dma_blacklisted(struct ata_port *ap, struct ata_device *dev) | 2135 | static int ata_dma_blacklisted(const struct ata_device *dev) |
1966 | { | 2136 | { |
1967 | unsigned char model_num[40]; | 2137 | unsigned char model_num[40]; |
1968 | char *s; | 2138 | char *s; |
@@ -1987,9 +2157,9 @@ static int ata_dma_blacklisted(struct ata_port *ap, struct ata_device *dev) | |||
1987 | return 0; | 2157 | return 0; |
1988 | } | 2158 | } |
1989 | 2159 | ||
1990 | static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift) | 2160 | static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift) |
1991 | { | 2161 | { |
1992 | struct ata_device *master, *slave; | 2162 | const struct ata_device *master, *slave; |
1993 | unsigned int mask; | 2163 | unsigned int mask; |
1994 | 2164 | ||
1995 | master = &ap->device[0]; | 2165 | master = &ap->device[0]; |
@@ -2001,14 +2171,14 @@ static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift) | |||
2001 | mask = ap->udma_mask; | 2171 | mask = ap->udma_mask; |
2002 | if (ata_dev_present(master)) { | 2172 | if (ata_dev_present(master)) { |
2003 | mask &= (master->id[ATA_ID_UDMA_MODES] & 0xff); | 2173 | mask &= (master->id[ATA_ID_UDMA_MODES] & 0xff); |
2004 | if (ata_dma_blacklisted(ap, master)) { | 2174 | if (ata_dma_blacklisted(master)) { |
2005 | mask = 0; | 2175 | mask = 0; |
2006 | ata_pr_blacklisted(ap, master); | 2176 | ata_pr_blacklisted(ap, master); |
2007 | } | 2177 | } |
2008 | } | 2178 | } |
2009 | if (ata_dev_present(slave)) { | 2179 | if (ata_dev_present(slave)) { |
2010 | mask &= (slave->id[ATA_ID_UDMA_MODES] & 0xff); | 2180 | mask &= (slave->id[ATA_ID_UDMA_MODES] & 0xff); |
2011 | if (ata_dma_blacklisted(ap, slave)) { | 2181 | if (ata_dma_blacklisted(slave)) { |
2012 | mask = 0; | 2182 | mask = 0; |
2013 | ata_pr_blacklisted(ap, slave); | 2183 | ata_pr_blacklisted(ap, slave); |
2014 | } | 2184 | } |
@@ -2018,14 +2188,14 @@ static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift) | |||
2018 | mask = ap->mwdma_mask; | 2188 | mask = ap->mwdma_mask; |
2019 | if (ata_dev_present(master)) { | 2189 | if (ata_dev_present(master)) { |
2020 | mask &= (master->id[ATA_ID_MWDMA_MODES] & 0x07); | 2190 | mask &= (master->id[ATA_ID_MWDMA_MODES] & 0x07); |
2021 | if (ata_dma_blacklisted(ap, master)) { | 2191 | if (ata_dma_blacklisted(master)) { |
2022 | mask = 0; | 2192 | mask = 0; |
2023 | ata_pr_blacklisted(ap, master); | 2193 | ata_pr_blacklisted(ap, master); |
2024 | } | 2194 | } |
2025 | } | 2195 | } |
2026 | if (ata_dev_present(slave)) { | 2196 | if (ata_dev_present(slave)) { |
2027 | mask &= (slave->id[ATA_ID_MWDMA_MODES] & 0x07); | 2197 | mask &= (slave->id[ATA_ID_MWDMA_MODES] & 0x07); |
2028 | if (ata_dma_blacklisted(ap, slave)) { | 2198 | if (ata_dma_blacklisted(slave)) { |
2029 | mask = 0; | 2199 | mask = 0; |
2030 | ata_pr_blacklisted(ap, slave); | 2200 | ata_pr_blacklisted(ap, slave); |
2031 | } | 2201 | } |
@@ -2089,7 +2259,7 @@ static int fgb(u32 bitmap) | |||
2089 | * Zero on success, negative on error. | 2259 | * Zero on success, negative on error. |
2090 | */ | 2260 | */ |
2091 | 2261 | ||
2092 | static int ata_choose_xfer_mode(struct ata_port *ap, | 2262 | static int ata_choose_xfer_mode(const struct ata_port *ap, |
2093 | u8 *xfer_mode_out, | 2263 | u8 *xfer_mode_out, |
2094 | unsigned int *xfer_shift_out) | 2264 | unsigned int *xfer_shift_out) |
2095 | { | 2265 | { |
@@ -2613,13 +2783,13 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
2613 | 2783 | ||
2614 | /** | 2784 | /** |
2615 | * ata_pio_poll - | 2785 | * ata_pio_poll - |
2616 | * @ap: | 2786 | * @ap: the target ata_port |
2617 | * | 2787 | * |
2618 | * LOCKING: | 2788 | * LOCKING: |
2619 | * None. (executing in kernel thread context) | 2789 | * None. (executing in kernel thread context) |
2620 | * | 2790 | * |
2621 | * RETURNS: | 2791 | * RETURNS: |
2622 | * | 2792 | * timeout value to use |
2623 | */ | 2793 | */ |
2624 | 2794 | ||
2625 | static unsigned long ata_pio_poll(struct ata_port *ap) | 2795 | static unsigned long ata_pio_poll(struct ata_port *ap) |
@@ -2660,8 +2830,8 @@ static unsigned long ata_pio_poll(struct ata_port *ap) | |||
2660 | } | 2830 | } |
2661 | 2831 | ||
2662 | /** | 2832 | /** |
2663 | * ata_pio_complete - | 2833 | * ata_pio_complete - check if drive is busy or idle |
2664 | * @ap: | 2834 | * @ap: the target ata_port |
2665 | * | 2835 | * |
2666 | * LOCKING: | 2836 | * LOCKING: |
2667 | * None. (executing in kernel thread context) | 2837 | * None. (executing in kernel thread context) |
@@ -2713,7 +2883,7 @@ static int ata_pio_complete (struct ata_port *ap) | |||
2713 | 2883 | ||
2714 | 2884 | ||
2715 | /** | 2885 | /** |
2716 | * swap_buf_le16 - | 2886 | * swap_buf_le16 - swap halves of 16-words in place |
2717 | * @buf: Buffer to swap | 2887 | * @buf: Buffer to swap |
2718 | * @buf_words: Number of 16-bit words in buffer. | 2888 | * @buf_words: Number of 16-bit words in buffer. |
2719 | * | 2889 | * |
@@ -2722,6 +2892,7 @@ static int ata_pio_complete (struct ata_port *ap) | |||
2722 | * vice-versa. | 2892 | * vice-versa. |
2723 | * | 2893 | * |
2724 | * LOCKING: | 2894 | * LOCKING: |
2895 | * Inherited from caller. | ||
2725 | */ | 2896 | */ |
2726 | void swap_buf_le16(u16 *buf, unsigned int buf_words) | 2897 | void swap_buf_le16(u16 *buf, unsigned int buf_words) |
2727 | { | 2898 | { |
@@ -2744,7 +2915,6 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
2744 | * | 2915 | * |
2745 | * LOCKING: | 2916 | * LOCKING: |
2746 | * Inherited from caller. | 2917 | * Inherited from caller. |
2747 | * | ||
2748 | */ | 2918 | */ |
2749 | 2919 | ||
2750 | static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf, | 2920 | static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf, |
@@ -2790,7 +2960,6 @@ static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf, | |||
2790 | * | 2960 | * |
2791 | * LOCKING: | 2961 | * LOCKING: |
2792 | * Inherited from caller. | 2962 | * Inherited from caller. |
2793 | * | ||
2794 | */ | 2963 | */ |
2795 | 2964 | ||
2796 | static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf, | 2965 | static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf, |
@@ -2830,7 +2999,6 @@ static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf, | |||
2830 | * | 2999 | * |
2831 | * LOCKING: | 3000 | * LOCKING: |
2832 | * Inherited from caller. | 3001 | * Inherited from caller. |
2833 | * | ||
2834 | */ | 3002 | */ |
2835 | 3003 | ||
2836 | static void ata_data_xfer(struct ata_port *ap, unsigned char *buf, | 3004 | static void ata_data_xfer(struct ata_port *ap, unsigned char *buf, |
@@ -2983,7 +3151,6 @@ next_sg: | |||
2983 | * | 3151 | * |
2984 | * LOCKING: | 3152 | * LOCKING: |
2985 | * Inherited from caller. | 3153 | * Inherited from caller. |
2986 | * | ||
2987 | */ | 3154 | */ |
2988 | 3155 | ||
2989 | static void atapi_pio_bytes(struct ata_queued_cmd *qc) | 3156 | static void atapi_pio_bytes(struct ata_queued_cmd *qc) |
@@ -3019,8 +3186,8 @@ err_out: | |||
3019 | } | 3186 | } |
3020 | 3187 | ||
3021 | /** | 3188 | /** |
3022 | * ata_pio_sector - | 3189 | * ata_pio_block - start PIO on a block |
3023 | * @ap: | 3190 | * @ap: the target ata_port |
3024 | * | 3191 | * |
3025 | * LOCKING: | 3192 | * LOCKING: |
3026 | * None. (executing in kernel thread context) | 3193 | * None. (executing in kernel thread context) |
@@ -3032,7 +3199,7 @@ static void ata_pio_block(struct ata_port *ap) | |||
3032 | u8 status; | 3199 | u8 status; |
3033 | 3200 | ||
3034 | /* | 3201 | /* |
3035 | * This is purely hueristic. This is a fast path. | 3202 | * This is purely heuristic. This is a fast path. |
3036 | * Sometimes when we enter, BSY will be cleared in | 3203 | * Sometimes when we enter, BSY will be cleared in |
3037 | * a chk-status or two. If not, the drive is probably seeking | 3204 | * a chk-status or two. If not, the drive is probably seeking |
3038 | * or something. Snooze for a couple msecs, then | 3205 | * or something. Snooze for a couple msecs, then |
@@ -3352,7 +3519,6 @@ static void __ata_qc_complete(struct ata_queued_cmd *qc) | |||
3352 | * | 3519 | * |
3353 | * LOCKING: | 3520 | * LOCKING: |
3354 | * spin_lock_irqsave(host_set lock) | 3521 | * spin_lock_irqsave(host_set lock) |
3355 | * | ||
3356 | */ | 3522 | */ |
3357 | void ata_qc_free(struct ata_queued_cmd *qc) | 3523 | void ata_qc_free(struct ata_queued_cmd *qc) |
3358 | { | 3524 | { |
@@ -3372,7 +3538,6 @@ void ata_qc_free(struct ata_queued_cmd *qc) | |||
3372 | * | 3538 | * |
3373 | * LOCKING: | 3539 | * LOCKING: |
3374 | * spin_lock_irqsave(host_set lock) | 3540 | * spin_lock_irqsave(host_set lock) |
3375 | * | ||
3376 | */ | 3541 | */ |
3377 | 3542 | ||
3378 | void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | 3543 | void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) |
@@ -3866,7 +4031,6 @@ idle_irq: | |||
3866 | * | 4031 | * |
3867 | * RETURNS: | 4032 | * RETURNS: |
3868 | * IRQ_NONE or IRQ_HANDLED. | 4033 | * IRQ_NONE or IRQ_HANDLED. |
3869 | * | ||
3870 | */ | 4034 | */ |
3871 | 4035 | ||
3872 | irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs) | 4036 | irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs) |
@@ -3978,6 +4142,7 @@ err_out: | |||
3978 | * May be used as the port_start() entry in ata_port_operations. | 4142 | * May be used as the port_start() entry in ata_port_operations. |
3979 | * | 4143 | * |
3980 | * LOCKING: | 4144 | * LOCKING: |
4145 | * Inherited from caller. | ||
3981 | */ | 4146 | */ |
3982 | 4147 | ||
3983 | int ata_port_start (struct ata_port *ap) | 4148 | int ata_port_start (struct ata_port *ap) |
@@ -4009,6 +4174,7 @@ int ata_port_start (struct ata_port *ap) | |||
4009 | * May be used as the port_stop() entry in ata_port_operations. | 4174 | * May be used as the port_stop() entry in ata_port_operations. |
4010 | * | 4175 | * |
4011 | * LOCKING: | 4176 | * LOCKING: |
4177 | * Inherited from caller. | ||
4012 | */ | 4178 | */ |
4013 | 4179 | ||
4014 | void ata_port_stop (struct ata_port *ap) | 4180 | void ata_port_stop (struct ata_port *ap) |
@@ -4032,6 +4198,7 @@ void ata_host_stop (struct ata_host_set *host_set) | |||
4032 | * @do_unregister: 1 if we fully unregister, 0 to just stop the port | 4198 | * @do_unregister: 1 if we fully unregister, 0 to just stop the port |
4033 | * | 4199 | * |
4034 | * LOCKING: | 4200 | * LOCKING: |
4201 | * Inherited from caller. | ||
4035 | */ | 4202 | */ |
4036 | 4203 | ||
4037 | static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister) | 4204 | static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister) |
@@ -4059,12 +4226,11 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister) | |||
4059 | * | 4226 | * |
4060 | * LOCKING: | 4227 | * LOCKING: |
4061 | * Inherited from caller. | 4228 | * Inherited from caller. |
4062 | * | ||
4063 | */ | 4229 | */ |
4064 | 4230 | ||
4065 | static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, | 4231 | static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, |
4066 | struct ata_host_set *host_set, | 4232 | struct ata_host_set *host_set, |
4067 | struct ata_probe_ent *ent, unsigned int port_no) | 4233 | const struct ata_probe_ent *ent, unsigned int port_no) |
4068 | { | 4234 | { |
4069 | unsigned int i; | 4235 | unsigned int i; |
4070 | 4236 | ||
@@ -4120,10 +4286,9 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, | |||
4120 | * | 4286 | * |
4121 | * RETURNS: | 4287 | * RETURNS: |
4122 | * New ata_port on success, for NULL on error. | 4288 | * New ata_port on success, for NULL on error. |
4123 | * | ||
4124 | */ | 4289 | */ |
4125 | 4290 | ||
4126 | static struct ata_port * ata_host_add(struct ata_probe_ent *ent, | 4291 | static struct ata_port * ata_host_add(const struct ata_probe_ent *ent, |
4127 | struct ata_host_set *host_set, | 4292 | struct ata_host_set *host_set, |
4128 | unsigned int port_no) | 4293 | unsigned int port_no) |
4129 | { | 4294 | { |
@@ -4168,10 +4333,9 @@ err_out: | |||
4168 | * | 4333 | * |
4169 | * RETURNS: | 4334 | * RETURNS: |
4170 | * Number of ports registered. Zero on error (no ports registered). | 4335 | * Number of ports registered. Zero on error (no ports registered). |
4171 | * | ||
4172 | */ | 4336 | */ |
4173 | 4337 | ||
4174 | int ata_device_add(struct ata_probe_ent *ent) | 4338 | int ata_device_add(const struct ata_probe_ent *ent) |
4175 | { | 4339 | { |
4176 | unsigned int count = 0, i; | 4340 | unsigned int count = 0, i; |
4177 | struct device *dev = ent->dev; | 4341 | struct device *dev = ent->dev; |
@@ -4300,7 +4464,6 @@ err_out: | |||
4300 | * Inherited from calling layer (may sleep). | 4464 | * Inherited from calling layer (may sleep). |
4301 | */ | 4465 | */ |
4302 | 4466 | ||
4303 | |||
4304 | void ata_host_set_remove(struct ata_host_set *host_set) | 4467 | void ata_host_set_remove(struct ata_host_set *host_set) |
4305 | { | 4468 | { |
4306 | struct ata_port *ap; | 4469 | struct ata_port *ap; |
@@ -4390,7 +4553,7 @@ void ata_std_ports(struct ata_ioports *ioaddr) | |||
4390 | } | 4553 | } |
4391 | 4554 | ||
4392 | static struct ata_probe_ent * | 4555 | static struct ata_probe_ent * |
4393 | ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port) | 4556 | ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port) |
4394 | { | 4557 | { |
4395 | struct ata_probe_ent *probe_ent; | 4558 | struct ata_probe_ent *probe_ent; |
4396 | 4559 | ||
@@ -4490,7 +4653,6 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru | |||
4490 | if (!probe_ent) | 4653 | if (!probe_ent) |
4491 | return NULL; | 4654 | return NULL; |
4492 | 4655 | ||
4493 | |||
4494 | probe_ent->legacy_mode = 1; | 4656 | probe_ent->legacy_mode = 1; |
4495 | probe_ent->n_ports = 1; | 4657 | probe_ent->n_ports = 1; |
4496 | probe_ent->hard_port_no = port_num; | 4658 | probe_ent->hard_port_no = port_num; |
@@ -4534,7 +4696,6 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru | |||
4534 | * | 4696 | * |
4535 | * RETURNS: | 4697 | * RETURNS: |
4536 | * Zero on success, negative on errno-based value on error. | 4698 | * Zero on success, negative on errno-based value on error. |
4537 | * | ||
4538 | */ | 4699 | */ |
4539 | 4700 | ||
4540 | int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | 4701 | int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, |
@@ -4682,7 +4843,7 @@ err_out: | |||
4682 | * @pdev: PCI device that was removed | 4843 | * @pdev: PCI device that was removed |
4683 | * | 4844 | * |
4684 | * PCI layer indicates to libata via this hook that | 4845 | * PCI layer indicates to libata via this hook that |
4685 | * hot-unplug or module unload event has occured. | 4846 | * hot-unplug or module unload event has occurred. |
4686 | * Handle this by unregistering all objects associated | 4847 | * Handle this by unregistering all objects associated |
4687 | * with this PCI device. Free those objects. Then finally | 4848 | * with this PCI device. Free those objects. Then finally |
4688 | * release PCI resources and disable device. | 4849 | * release PCI resources and disable device. |
@@ -4703,7 +4864,7 @@ void ata_pci_remove_one (struct pci_dev *pdev) | |||
4703 | } | 4864 | } |
4704 | 4865 | ||
4705 | /* move to PCI subsystem */ | 4866 | /* move to PCI subsystem */ |
4706 | int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits) | 4867 | int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits) |
4707 | { | 4868 | { |
4708 | unsigned long tmp = 0; | 4869 | unsigned long tmp = 0; |
4709 | 4870 | ||
@@ -4830,6 +4991,9 @@ EXPORT_SYMBOL_GPL(ata_dev_id_string); | |||
4830 | EXPORT_SYMBOL_GPL(ata_dev_config); | 4991 | EXPORT_SYMBOL_GPL(ata_dev_config); |
4831 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); | 4992 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); |
4832 | 4993 | ||
4994 | EXPORT_SYMBOL_GPL(ata_timing_compute); | ||
4995 | EXPORT_SYMBOL_GPL(ata_timing_merge); | ||
4996 | |||
4833 | #ifdef CONFIG_PCI | 4997 | #ifdef CONFIG_PCI |
4834 | EXPORT_SYMBOL_GPL(pci_test_config_bits); | 4998 | EXPORT_SYMBOL_GPL(pci_test_config_bits); |
4835 | EXPORT_SYMBOL_GPL(ata_pci_host_stop); | 4999 | EXPORT_SYMBOL_GPL(ata_pci_host_stop); |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 9944adbe5a1d..a68c0341dc82 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -44,9 +44,9 @@ | |||
44 | 44 | ||
45 | #include "libata.h" | 45 | #include "libata.h" |
46 | 46 | ||
47 | typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, u8 *scsicmd); | 47 | typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, const u8 *scsicmd); |
48 | static struct ata_device * | 48 | static struct ata_device * |
49 | ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev); | 49 | ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev); |
50 | 50 | ||
51 | 51 | ||
52 | static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, | 52 | static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, |
@@ -428,7 +428,7 @@ int ata_scsi_error(struct Scsi_Host *host) | |||
428 | */ | 428 | */ |
429 | 429 | ||
430 | static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc, | 430 | static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc, |
431 | u8 *scsicmd) | 431 | const u8 *scsicmd) |
432 | { | 432 | { |
433 | struct ata_taskfile *tf = &qc->tf; | 433 | struct ata_taskfile *tf = &qc->tf; |
434 | 434 | ||
@@ -495,7 +495,7 @@ invalid_fld: | |||
495 | * Zero on success, non-zero on error. | 495 | * Zero on success, non-zero on error. |
496 | */ | 496 | */ |
497 | 497 | ||
498 | static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | 498 | static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd) |
499 | { | 499 | { |
500 | struct ata_taskfile *tf = &qc->tf; | 500 | struct ata_taskfile *tf = &qc->tf; |
501 | 501 | ||
@@ -522,7 +522,7 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | |||
522 | * @plen: the transfer length | 522 | * @plen: the transfer length |
523 | */ | 523 | */ |
524 | 524 | ||
525 | static void scsi_6_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) | 525 | static void scsi_6_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen) |
526 | { | 526 | { |
527 | u64 lba = 0; | 527 | u64 lba = 0; |
528 | u32 len = 0; | 528 | u32 len = 0; |
@@ -549,7 +549,7 @@ static void scsi_6_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) | |||
549 | * @plen: the transfer length | 549 | * @plen: the transfer length |
550 | */ | 550 | */ |
551 | 551 | ||
552 | static void scsi_10_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) | 552 | static void scsi_10_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen) |
553 | { | 553 | { |
554 | u64 lba = 0; | 554 | u64 lba = 0; |
555 | u32 len = 0; | 555 | u32 len = 0; |
@@ -579,7 +579,7 @@ static void scsi_10_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) | |||
579 | * @plen: the transfer length | 579 | * @plen: the transfer length |
580 | */ | 580 | */ |
581 | 581 | ||
582 | static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) | 582 | static void scsi_16_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen) |
583 | { | 583 | { |
584 | u64 lba = 0; | 584 | u64 lba = 0; |
585 | u32 len = 0; | 585 | u32 len = 0; |
@@ -618,7 +618,7 @@ static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) | |||
618 | * Zero on success, non-zero on error. | 618 | * Zero on success, non-zero on error. |
619 | */ | 619 | */ |
620 | 620 | ||
621 | static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | 621 | static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd) |
622 | { | 622 | { |
623 | struct ata_taskfile *tf = &qc->tf; | 623 | struct ata_taskfile *tf = &qc->tf; |
624 | struct ata_device *dev = qc->dev; | 624 | struct ata_device *dev = qc->dev; |
@@ -744,7 +744,7 @@ nothing_to_do: | |||
744 | * Zero on success, non-zero on error. | 744 | * Zero on success, non-zero on error. |
745 | */ | 745 | */ |
746 | 746 | ||
747 | static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | 747 | static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd) |
748 | { | 748 | { |
749 | struct ata_taskfile *tf = &qc->tf; | 749 | struct ata_taskfile *tf = &qc->tf; |
750 | struct ata_device *dev = qc->dev; | 750 | struct ata_device *dev = qc->dev; |
@@ -1698,7 +1698,7 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
1698 | * Zero on success, non-zero on failure. | 1698 | * Zero on success, non-zero on failure. |
1699 | */ | 1699 | */ |
1700 | 1700 | ||
1701 | static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | 1701 | static unsigned int atapi_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd) |
1702 | { | 1702 | { |
1703 | struct scsi_cmnd *cmd = qc->scsicmd; | 1703 | struct scsi_cmnd *cmd = qc->scsicmd; |
1704 | struct ata_device *dev = qc->dev; | 1704 | struct ata_device *dev = qc->dev; |
@@ -1767,7 +1767,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) | |||
1767 | */ | 1767 | */ |
1768 | 1768 | ||
1769 | static struct ata_device * | 1769 | static struct ata_device * |
1770 | ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev) | 1770 | ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev) |
1771 | { | 1771 | { |
1772 | struct ata_device *dev; | 1772 | struct ata_device *dev; |
1773 | 1773 | ||
@@ -1924,7 +1924,7 @@ void ata_scsi_simulate(u16 *id, | |||
1924 | void (*done)(struct scsi_cmnd *)) | 1924 | void (*done)(struct scsi_cmnd *)) |
1925 | { | 1925 | { |
1926 | struct ata_scsi_args args; | 1926 | struct ata_scsi_args args; |
1927 | u8 *scsicmd = cmd->cmnd; | 1927 | const u8 *scsicmd = cmd->cmnd; |
1928 | 1928 | ||
1929 | args.id = id; | 1929 | args.id = id; |
1930 | args.cmd = cmd; | 1930 | args.cmd = cmd; |
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index 67d752ca8ae2..3d60190584ba 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -48,7 +48,7 @@ extern int ata_qc_issue(struct ata_queued_cmd *qc); | |||
48 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); | 48 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); |
49 | extern void ata_dev_select(struct ata_port *ap, unsigned int device, | 49 | extern void ata_dev_select(struct ata_port *ap, unsigned int device, |
50 | unsigned int wait, unsigned int can_sleep); | 50 | unsigned int wait, unsigned int can_sleep); |
51 | extern void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf); | 51 | extern void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf); |
52 | extern void swap_buf_le16(u16 *buf, unsigned int buf_words); | 52 | extern void swap_buf_le16(u16 *buf, unsigned int buf_words); |
53 | 53 | ||
54 | 54 | ||
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c index 0aba13ceaacf..352df47bcaca 100644 --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #define LPFC_MEM_POOL_SIZE 64 /* max elem in non-DMA safety pool */ | 39 | #define LPFC_MEM_POOL_SIZE 64 /* max elem in non-DMA safety pool */ |
40 | 40 | ||
41 | static void * | 41 | static void * |
42 | lpfc_pool_kmalloc(unsigned int gfp_flags, void *data) | 42 | lpfc_pool_kmalloc(gfp_t gfp_flags, void *data) |
43 | { | 43 | { |
44 | return kmalloc((unsigned long)data, gfp_flags); | 44 | return kmalloc((unsigned long)data, gfp_flags); |
45 | } | 45 | } |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 3f2f2464fa63..af1133104b3f 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -5146,7 +5146,8 @@ static long osst_compat_ioctl(struct file * file, unsigned int cmd_in, unsigned | |||
5146 | /* Try to allocate a new tape buffer skeleton. Caller must not hold os_scsi_tapes_lock */ | 5146 | /* Try to allocate a new tape buffer skeleton. Caller must not hold os_scsi_tapes_lock */ |
5147 | static struct osst_buffer * new_tape_buffer( int from_initialization, int need_dma, int max_sg ) | 5147 | static struct osst_buffer * new_tape_buffer( int from_initialization, int need_dma, int max_sg ) |
5148 | { | 5148 | { |
5149 | int i, priority; | 5149 | int i; |
5150 | gfp_t priority; | ||
5150 | struct osst_buffer *tb; | 5151 | struct osst_buffer *tb; |
5151 | 5152 | ||
5152 | if (from_initialization) | 5153 | if (from_initialization) |
@@ -5178,7 +5179,8 @@ static struct osst_buffer * new_tape_buffer( int from_initialization, int need_d | |||
5178 | /* Try to allocate a temporary (while a user has the device open) enlarged tape buffer */ | 5179 | /* Try to allocate a temporary (while a user has the device open) enlarged tape buffer */ |
5179 | static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma) | 5180 | static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma) |
5180 | { | 5181 | { |
5181 | int segs, nbr, max_segs, b_size, priority, order, got; | 5182 | int segs, nbr, max_segs, b_size, order, got; |
5183 | gfp_t priority; | ||
5182 | 5184 | ||
5183 | if (STbuffer->buffer_size >= OS_FRAME_SIZE) | 5185 | if (STbuffer->buffer_size >= OS_FRAME_SIZE) |
5184 | return 1; | 5186 | return 1; |
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c index c6825da6ae20..85ec5b1d7aa9 100644 --- a/drivers/scsi/pdc_adma.c +++ b/drivers/scsi/pdc_adma.c | |||
@@ -158,7 +158,7 @@ static Scsi_Host_Template adma_ata_sht = { | |||
158 | .bios_param = ata_std_bios_param, | 158 | .bios_param = ata_std_bios_param, |
159 | }; | 159 | }; |
160 | 160 | ||
161 | static struct ata_port_operations adma_ata_ops = { | 161 | static const struct ata_port_operations adma_ata_ops = { |
162 | .port_disable = ata_port_disable, | 162 | .port_disable = ata_port_disable, |
163 | .tf_load = ata_tf_load, | 163 | .tf_load = ata_tf_load, |
164 | .tf_read = ata_tf_read, | 164 | .tf_read = ata_tf_read, |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 1ed32e7b5472..e451941ad81d 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -52,7 +52,7 @@ extern int qla2x00_load_risc(struct scsi_qla_host *, uint32_t *); | |||
52 | extern int qla24xx_load_risc_flash(scsi_qla_host_t *, uint32_t *); | 52 | extern int qla24xx_load_risc_flash(scsi_qla_host_t *, uint32_t *); |
53 | extern int qla24xx_load_risc_hotplug(scsi_qla_host_t *, uint32_t *); | 53 | extern int qla24xx_load_risc_hotplug(scsi_qla_host_t *, uint32_t *); |
54 | 54 | ||
55 | extern fc_port_t *qla2x00_alloc_fcport(scsi_qla_host_t *, int); | 55 | extern fc_port_t *qla2x00_alloc_fcport(scsi_qla_host_t *, gfp_t); |
56 | 56 | ||
57 | extern int qla2x00_loop_resync(scsi_qla_host_t *); | 57 | extern int qla2x00_loop_resync(scsi_qla_host_t *); |
58 | 58 | ||
@@ -277,7 +277,7 @@ extern int qla2x00_fdmi_register(scsi_qla_host_t *); | |||
277 | /* | 277 | /* |
278 | * Global Function Prototypes in qla_rscn.c source file. | 278 | * Global Function Prototypes in qla_rscn.c source file. |
279 | */ | 279 | */ |
280 | extern fc_port_t *qla2x00_alloc_rscn_fcport(scsi_qla_host_t *, int); | 280 | extern fc_port_t *qla2x00_alloc_rscn_fcport(scsi_qla_host_t *, gfp_t); |
281 | extern int qla2x00_handle_port_rscn(scsi_qla_host_t *, uint32_t, fc_port_t *, | 281 | extern int qla2x00_handle_port_rscn(scsi_qla_host_t *, uint32_t, fc_port_t *, |
282 | int); | 282 | int); |
283 | extern void qla2x00_process_iodesc(scsi_qla_host_t *, struct mbx_entry *); | 283 | extern void qla2x00_process_iodesc(scsi_qla_host_t *, struct mbx_entry *); |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 23d095d3817b..fbb6feee40cf 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -1685,7 +1685,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) | |||
1685 | * Returns a pointer to the allocated fcport, or NULL, if none available. | 1685 | * Returns a pointer to the allocated fcport, or NULL, if none available. |
1686 | */ | 1686 | */ |
1687 | fc_port_t * | 1687 | fc_port_t * |
1688 | qla2x00_alloc_fcport(scsi_qla_host_t *ha, int flags) | 1688 | qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags) |
1689 | { | 1689 | { |
1690 | fc_port_t *fcport; | 1690 | fc_port_t *fcport; |
1691 | 1691 | ||
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 8982978c42fd..7aec93f9d423 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -1325,6 +1325,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1325 | ha->brd_info = brd_info; | 1325 | ha->brd_info = brd_info; |
1326 | sprintf(ha->host_str, "%s_%ld", ha->brd_info->drv_name, ha->host_no); | 1326 | sprintf(ha->host_str, "%s_%ld", ha->brd_info->drv_name, ha->host_no); |
1327 | 1327 | ||
1328 | ha->dpc_pid = -1; | ||
1329 | |||
1328 | /* Configure PCI I/O space */ | 1330 | /* Configure PCI I/O space */ |
1329 | ret = qla2x00_iospace_config(ha); | 1331 | ret = qla2x00_iospace_config(ha); |
1330 | if (ret) | 1332 | if (ret) |
@@ -1448,7 +1450,6 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1448 | */ | 1450 | */ |
1449 | spin_lock_init(&ha->mbx_reg_lock); | 1451 | spin_lock_init(&ha->mbx_reg_lock); |
1450 | 1452 | ||
1451 | ha->dpc_pid = -1; | ||
1452 | init_completion(&ha->dpc_inited); | 1453 | init_completion(&ha->dpc_inited); |
1453 | init_completion(&ha->dpc_exited); | 1454 | init_completion(&ha->dpc_exited); |
1454 | 1455 | ||
diff --git a/drivers/scsi/qla2xxx/qla_rscn.c b/drivers/scsi/qla2xxx/qla_rscn.c index 1eba98828636..7534efcc8918 100644 --- a/drivers/scsi/qla2xxx/qla_rscn.c +++ b/drivers/scsi/qla2xxx/qla_rscn.c | |||
@@ -1066,7 +1066,7 @@ qla2x00_send_login_iocb_cb(scsi_qla_host_t *ha, struct io_descriptor *iodesc, | |||
1066 | * Returns a pointer to the allocated RSCN fcport, or NULL, if none available. | 1066 | * Returns a pointer to the allocated RSCN fcport, or NULL, if none available. |
1067 | */ | 1067 | */ |
1068 | fc_port_t * | 1068 | fc_port_t * |
1069 | qla2x00_alloc_rscn_fcport(scsi_qla_host_t *ha, int flags) | 1069 | qla2x00_alloc_rscn_fcport(scsi_qla_host_t *ha, gfp_t flags) |
1070 | { | 1070 | { |
1071 | fc_port_t *fcport; | 1071 | fc_port_t *fcport; |
1072 | 1072 | ||
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index be7c378dcd36..1d6d0c9e76f6 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <asm/io.h> | 35 | #include <asm/io.h> |
36 | 36 | ||
37 | #define DRV_NAME "sata_mv" | 37 | #define DRV_NAME "sata_mv" |
38 | #define DRV_VERSION "0.24" | 38 | #define DRV_VERSION "0.25" |
39 | 39 | ||
40 | enum { | 40 | enum { |
41 | /* BAR's are enumerated in terms of pci_resource_start() terms */ | 41 | /* BAR's are enumerated in terms of pci_resource_start() terms */ |
@@ -290,7 +290,7 @@ static Scsi_Host_Template mv_sht = { | |||
290 | .ordered_flush = 1, | 290 | .ordered_flush = 1, |
291 | }; | 291 | }; |
292 | 292 | ||
293 | static struct ata_port_operations mv_ops = { | 293 | static const struct ata_port_operations mv_ops = { |
294 | .port_disable = ata_port_disable, | 294 | .port_disable = ata_port_disable, |
295 | 295 | ||
296 | .tf_load = ata_tf_load, | 296 | .tf_load = ata_tf_load, |
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c index 9fa2535dd937..1a56d6c79ddd 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/scsi/sata_nv.c | |||
@@ -238,7 +238,7 @@ static Scsi_Host_Template nv_sht = { | |||
238 | .ordered_flush = 1, | 238 | .ordered_flush = 1, |
239 | }; | 239 | }; |
240 | 240 | ||
241 | static struct ata_port_operations nv_ops = { | 241 | static const struct ata_port_operations nv_ops = { |
242 | .port_disable = ata_port_disable, | 242 | .port_disable = ata_port_disable, |
243 | .tf_load = ata_tf_load, | 243 | .tf_load = ata_tf_load, |
244 | .tf_read = ata_tf_read, | 244 | .tf_read = ata_tf_read, |
@@ -331,7 +331,7 @@ static u32 nv_scr_read (struct ata_port *ap, unsigned int sc_reg) | |||
331 | return 0xffffffffU; | 331 | return 0xffffffffU; |
332 | 332 | ||
333 | if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) | 333 | if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) |
334 | return readl((void*)ap->ioaddr.scr_addr + (sc_reg * 4)); | 334 | return readl((void __iomem *)ap->ioaddr.scr_addr + (sc_reg * 4)); |
335 | else | 335 | else |
336 | return inl(ap->ioaddr.scr_addr + (sc_reg * 4)); | 336 | return inl(ap->ioaddr.scr_addr + (sc_reg * 4)); |
337 | } | 337 | } |
@@ -345,7 +345,7 @@ static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | |||
345 | return; | 345 | return; |
346 | 346 | ||
347 | if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) | 347 | if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) |
348 | writel(val, (void*)ap->ioaddr.scr_addr + (sc_reg * 4)); | 348 | writel(val, (void __iomem *)ap->ioaddr.scr_addr + (sc_reg * 4)); |
349 | else | 349 | else |
350 | outl(val, ap->ioaddr.scr_addr + (sc_reg * 4)); | 350 | outl(val, ap->ioaddr.scr_addr + (sc_reg * 4)); |
351 | } | 351 | } |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index def7e0d9dacb..eee93b0016df 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -87,8 +87,8 @@ static void pdc_port_stop(struct ata_port *ap); | |||
87 | static void pdc_pata_phy_reset(struct ata_port *ap); | 87 | static void pdc_pata_phy_reset(struct ata_port *ap); |
88 | static void pdc_sata_phy_reset(struct ata_port *ap); | 88 | static void pdc_sata_phy_reset(struct ata_port *ap); |
89 | static void pdc_qc_prep(struct ata_queued_cmd *qc); | 89 | static void pdc_qc_prep(struct ata_queued_cmd *qc); |
90 | static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); | 90 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
91 | static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); | 91 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
92 | static void pdc_irq_clear(struct ata_port *ap); | 92 | static void pdc_irq_clear(struct ata_port *ap); |
93 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); | 93 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); |
94 | 94 | ||
@@ -113,7 +113,7 @@ static Scsi_Host_Template pdc_ata_sht = { | |||
113 | .ordered_flush = 1, | 113 | .ordered_flush = 1, |
114 | }; | 114 | }; |
115 | 115 | ||
116 | static struct ata_port_operations pdc_sata_ops = { | 116 | static const struct ata_port_operations pdc_sata_ops = { |
117 | .port_disable = ata_port_disable, | 117 | .port_disable = ata_port_disable, |
118 | .tf_load = pdc_tf_load_mmio, | 118 | .tf_load = pdc_tf_load_mmio, |
119 | .tf_read = ata_tf_read, | 119 | .tf_read = ata_tf_read, |
@@ -136,7 +136,7 @@ static struct ata_port_operations pdc_sata_ops = { | |||
136 | .host_stop = ata_pci_host_stop, | 136 | .host_stop = ata_pci_host_stop, |
137 | }; | 137 | }; |
138 | 138 | ||
139 | static struct ata_port_operations pdc_pata_ops = { | 139 | static const struct ata_port_operations pdc_pata_ops = { |
140 | .port_disable = ata_port_disable, | 140 | .port_disable = ata_port_disable, |
141 | .tf_load = pdc_tf_load_mmio, | 141 | .tf_load = pdc_tf_load_mmio, |
142 | .tf_read = ata_tf_read, | 142 | .tf_read = ata_tf_read, |
@@ -324,7 +324,7 @@ static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) | |||
324 | { | 324 | { |
325 | if (sc_reg > SCR_CONTROL) | 325 | if (sc_reg > SCR_CONTROL) |
326 | return 0xffffffffU; | 326 | return 0xffffffffU; |
327 | return readl((void *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 327 | return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); |
328 | } | 328 | } |
329 | 329 | ||
330 | 330 | ||
@@ -333,7 +333,7 @@ static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, | |||
333 | { | 333 | { |
334 | if (sc_reg > SCR_CONTROL) | 334 | if (sc_reg > SCR_CONTROL) |
335 | return; | 335 | return; |
336 | writel(val, (void *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 336 | writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); |
337 | } | 337 | } |
338 | 338 | ||
339 | static void pdc_qc_prep(struct ata_queued_cmd *qc) | 339 | static void pdc_qc_prep(struct ata_queued_cmd *qc) |
@@ -523,8 +523,8 @@ static inline void pdc_packet_start(struct ata_queued_cmd *qc) | |||
523 | 523 | ||
524 | pp->pkt[2] = seq; | 524 | pp->pkt[2] = seq; |
525 | wmb(); /* flush PRD, pkt writes */ | 525 | wmb(); /* flush PRD, pkt writes */ |
526 | writel(pp->pkt_dma, (void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); | 526 | writel(pp->pkt_dma, (void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); |
527 | readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ | 527 | readl((void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ |
528 | } | 528 | } |
529 | 529 | ||
530 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc) | 530 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc) |
@@ -546,7 +546,7 @@ static int pdc_qc_issue_prot(struct ata_queued_cmd *qc) | |||
546 | return ata_qc_issue_prot(qc); | 546 | return ata_qc_issue_prot(qc); |
547 | } | 547 | } |
548 | 548 | ||
549 | static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) | 549 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
550 | { | 550 | { |
551 | WARN_ON (tf->protocol == ATA_PROT_DMA || | 551 | WARN_ON (tf->protocol == ATA_PROT_DMA || |
552 | tf->protocol == ATA_PROT_NODATA); | 552 | tf->protocol == ATA_PROT_NODATA); |
@@ -554,7 +554,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) | |||
554 | } | 554 | } |
555 | 555 | ||
556 | 556 | ||
557 | static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) | 557 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
558 | { | 558 | { |
559 | WARN_ON (tf->protocol == ATA_PROT_DMA || | 559 | WARN_ON (tf->protocol == ATA_PROT_DMA || |
560 | tf->protocol == ATA_PROT_NODATA); | 560 | tf->protocol == ATA_PROT_NODATA); |
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index 69a9b1cf6f9c..de3f266d67b3 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c | |||
@@ -51,8 +51,6 @@ enum { | |||
51 | QS_PRD_BYTES = QS_MAX_PRD * 16, | 51 | QS_PRD_BYTES = QS_MAX_PRD * 16, |
52 | QS_PKT_BYTES = QS_CPB_BYTES + QS_PRD_BYTES, | 52 | QS_PKT_BYTES = QS_CPB_BYTES + QS_PRD_BYTES, |
53 | 53 | ||
54 | QS_DMA_BOUNDARY = ~0UL, | ||
55 | |||
56 | /* global register offsets */ | 54 | /* global register offsets */ |
57 | QS_HCF_CNFG3 = 0x0003, /* host configuration offset */ | 55 | QS_HCF_CNFG3 = 0x0003, /* host configuration offset */ |
58 | QS_HID_HPHY = 0x0004, /* host physical interface info */ | 56 | QS_HID_HPHY = 0x0004, /* host physical interface info */ |
@@ -101,6 +99,10 @@ enum { | |||
101 | board_2068_idx = 0, /* QStor 4-port SATA/RAID */ | 99 | board_2068_idx = 0, /* QStor 4-port SATA/RAID */ |
102 | }; | 100 | }; |
103 | 101 | ||
102 | enum { | ||
103 | QS_DMA_BOUNDARY = ~0UL | ||
104 | }; | ||
105 | |||
104 | typedef enum { qs_state_idle, qs_state_pkt, qs_state_mmio } qs_state_t; | 106 | typedef enum { qs_state_idle, qs_state_pkt, qs_state_mmio } qs_state_t; |
105 | 107 | ||
106 | struct qs_port_priv { | 108 | struct qs_port_priv { |
@@ -145,7 +147,7 @@ static Scsi_Host_Template qs_ata_sht = { | |||
145 | .bios_param = ata_std_bios_param, | 147 | .bios_param = ata_std_bios_param, |
146 | }; | 148 | }; |
147 | 149 | ||
148 | static struct ata_port_operations qs_ata_ops = { | 150 | static const struct ata_port_operations qs_ata_ops = { |
149 | .port_disable = ata_port_disable, | 151 | .port_disable = ata_port_disable, |
150 | .tf_load = ata_tf_load, | 152 | .tf_load = ata_tf_load, |
151 | .tf_read = ata_tf_read, | 153 | .tf_read = ata_tf_read, |
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index ba98a175ee3a..3a056173fb95 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c | |||
@@ -150,7 +150,7 @@ static Scsi_Host_Template sil_sht = { | |||
150 | .ordered_flush = 1, | 150 | .ordered_flush = 1, |
151 | }; | 151 | }; |
152 | 152 | ||
153 | static struct ata_port_operations sil_ops = { | 153 | static const struct ata_port_operations sil_ops = { |
154 | .port_disable = ata_port_disable, | 154 | .port_disable = ata_port_disable, |
155 | .dev_config = sil_dev_config, | 155 | .dev_config = sil_dev_config, |
156 | .tf_load = ata_tf_load, | 156 | .tf_load = ata_tf_load, |
@@ -289,7 +289,7 @@ static inline unsigned long sil_scr_addr(struct ata_port *ap, unsigned int sc_re | |||
289 | 289 | ||
290 | static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg) | 290 | static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg) |
291 | { | 291 | { |
292 | void *mmio = (void *) sil_scr_addr(ap, sc_reg); | 292 | void __iomem *mmio = (void __iomem *) sil_scr_addr(ap, sc_reg); |
293 | if (mmio) | 293 | if (mmio) |
294 | return readl(mmio); | 294 | return readl(mmio); |
295 | return 0xffffffffU; | 295 | return 0xffffffffU; |
@@ -297,7 +297,7 @@ static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg) | |||
297 | 297 | ||
298 | static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | 298 | static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) |
299 | { | 299 | { |
300 | void *mmio = (void *) sil_scr_addr(ap, sc_reg); | 300 | void *mmio = (void __iomem *) sil_scr_addr(ap, sc_reg); |
301 | if (mmio) | 301 | if (mmio) |
302 | writel(val, mmio); | 302 | writel(val, mmio); |
303 | } | 303 | } |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index e16d1815cda0..e0d27a0fbad0 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -275,7 +275,7 @@ static Scsi_Host_Template sil24_sht = { | |||
275 | .ordered_flush = 1, /* NCQ not supported yet */ | 275 | .ordered_flush = 1, /* NCQ not supported yet */ |
276 | }; | 276 | }; |
277 | 277 | ||
278 | static struct ata_port_operations sil24_ops = { | 278 | static const struct ata_port_operations sil24_ops = { |
279 | .port_disable = ata_port_disable, | 279 | .port_disable = ata_port_disable, |
280 | 280 | ||
281 | .check_status = sil24_check_status, | 281 | .check_status = sil24_check_status, |
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c index 0761a3234fcf..057f7b98b6c4 100644 --- a/drivers/scsi/sata_sis.c +++ b/drivers/scsi/sata_sis.c | |||
@@ -102,7 +102,7 @@ static Scsi_Host_Template sis_sht = { | |||
102 | .ordered_flush = 1, | 102 | .ordered_flush = 1, |
103 | }; | 103 | }; |
104 | 104 | ||
105 | static struct ata_port_operations sis_ops = { | 105 | static const struct ata_port_operations sis_ops = { |
106 | .port_disable = ata_port_disable, | 106 | .port_disable = ata_port_disable, |
107 | .tf_load = ata_tf_load, | 107 | .tf_load = ata_tf_load, |
108 | .tf_read = ata_tf_read, | 108 | .tf_read = ata_tf_read, |
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index d89d968bedac..e0f9570bc6dd 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c | |||
@@ -102,7 +102,7 @@ static void k2_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, | |||
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
105 | static void k2_sata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) | 105 | static void k2_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) |
106 | { | 106 | { |
107 | struct ata_ioports *ioaddr = &ap->ioaddr; | 107 | struct ata_ioports *ioaddr = &ap->ioaddr; |
108 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | 108 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; |
@@ -297,7 +297,7 @@ static Scsi_Host_Template k2_sata_sht = { | |||
297 | }; | 297 | }; |
298 | 298 | ||
299 | 299 | ||
300 | static struct ata_port_operations k2_sata_ops = { | 300 | static const struct ata_port_operations k2_sata_ops = { |
301 | .port_disable = ata_port_disable, | 301 | .port_disable = ata_port_disable, |
302 | .tf_load = k2_sata_tf_load, | 302 | .tf_load = k2_sata_tf_load, |
303 | .tf_read = k2_sata_tf_read, | 303 | .tf_read = k2_sata_tf_read, |
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index 79fdbbab513e..8710d0f14f93 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -137,7 +137,7 @@ struct pdc_port_priv { | |||
137 | }; | 137 | }; |
138 | 138 | ||
139 | struct pdc_host_priv { | 139 | struct pdc_host_priv { |
140 | void *dimm_mmio; | 140 | void __iomem *dimm_mmio; |
141 | 141 | ||
142 | unsigned int doing_hdma; | 142 | unsigned int doing_hdma; |
143 | unsigned int hdma_prod; | 143 | unsigned int hdma_prod; |
@@ -157,8 +157,8 @@ static void pdc_20621_phy_reset (struct ata_port *ap); | |||
157 | static int pdc_port_start(struct ata_port *ap); | 157 | static int pdc_port_start(struct ata_port *ap); |
158 | static void pdc_port_stop(struct ata_port *ap); | 158 | static void pdc_port_stop(struct ata_port *ap); |
159 | static void pdc20621_qc_prep(struct ata_queued_cmd *qc); | 159 | static void pdc20621_qc_prep(struct ata_queued_cmd *qc); |
160 | static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); | 160 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
161 | static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); | 161 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
162 | static void pdc20621_host_stop(struct ata_host_set *host_set); | 162 | static void pdc20621_host_stop(struct ata_host_set *host_set); |
163 | static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe); | 163 | static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe); |
164 | static int pdc20621_detect_dimm(struct ata_probe_ent *pe); | 164 | static int pdc20621_detect_dimm(struct ata_probe_ent *pe); |
@@ -196,7 +196,7 @@ static Scsi_Host_Template pdc_sata_sht = { | |||
196 | .ordered_flush = 1, | 196 | .ordered_flush = 1, |
197 | }; | 197 | }; |
198 | 198 | ||
199 | static struct ata_port_operations pdc_20621_ops = { | 199 | static const struct ata_port_operations pdc_20621_ops = { |
200 | .port_disable = ata_port_disable, | 200 | .port_disable = ata_port_disable, |
201 | .tf_load = pdc_tf_load_mmio, | 201 | .tf_load = pdc_tf_load_mmio, |
202 | .tf_read = ata_tf_read, | 202 | .tf_read = ata_tf_read, |
@@ -247,7 +247,7 @@ static void pdc20621_host_stop(struct ata_host_set *host_set) | |||
247 | { | 247 | { |
248 | struct pci_dev *pdev = to_pci_dev(host_set->dev); | 248 | struct pci_dev *pdev = to_pci_dev(host_set->dev); |
249 | struct pdc_host_priv *hpriv = host_set->private_data; | 249 | struct pdc_host_priv *hpriv = host_set->private_data; |
250 | void *dimm_mmio = hpriv->dimm_mmio; | 250 | void __iomem *dimm_mmio = hpriv->dimm_mmio; |
251 | 251 | ||
252 | pci_iounmap(pdev, dimm_mmio); | 252 | pci_iounmap(pdev, dimm_mmio); |
253 | kfree(hpriv); | 253 | kfree(hpriv); |
@@ -668,8 +668,8 @@ static void pdc20621_packet_start(struct ata_queued_cmd *qc) | |||
668 | readl(mmio + PDC_20621_SEQCTL + (seq * 4)); /* flush */ | 668 | readl(mmio + PDC_20621_SEQCTL + (seq * 4)); /* flush */ |
669 | 669 | ||
670 | writel(port_ofs + PDC_DIMM_ATA_PKT, | 670 | writel(port_ofs + PDC_DIMM_ATA_PKT, |
671 | (void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); | 671 | (void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); |
672 | readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); | 672 | readl((void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); |
673 | VPRINTK("submitted ofs 0x%x (%u), seq %u\n", | 673 | VPRINTK("submitted ofs 0x%x (%u), seq %u\n", |
674 | port_ofs + PDC_DIMM_ATA_PKT, | 674 | port_ofs + PDC_DIMM_ATA_PKT, |
675 | port_ofs + PDC_DIMM_ATA_PKT, | 675 | port_ofs + PDC_DIMM_ATA_PKT, |
@@ -746,8 +746,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, | |||
746 | writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4)); | 746 | writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4)); |
747 | readl(mmio + PDC_20621_SEQCTL + (seq * 4)); | 747 | readl(mmio + PDC_20621_SEQCTL + (seq * 4)); |
748 | writel(port_ofs + PDC_DIMM_ATA_PKT, | 748 | writel(port_ofs + PDC_DIMM_ATA_PKT, |
749 | (void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); | 749 | (void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); |
750 | readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); | 750 | readl((void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); |
751 | } | 751 | } |
752 | 752 | ||
753 | /* step two - execute ATA command */ | 753 | /* step two - execute ATA command */ |
@@ -898,7 +898,7 @@ out: | |||
898 | DPRINTK("EXIT\n"); | 898 | DPRINTK("EXIT\n"); |
899 | } | 899 | } |
900 | 900 | ||
901 | static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) | 901 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
902 | { | 902 | { |
903 | WARN_ON (tf->protocol == ATA_PROT_DMA || | 903 | WARN_ON (tf->protocol == ATA_PROT_DMA || |
904 | tf->protocol == ATA_PROT_NODATA); | 904 | tf->protocol == ATA_PROT_NODATA); |
@@ -906,7 +906,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) | |||
906 | } | 906 | } |
907 | 907 | ||
908 | 908 | ||
909 | static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) | 909 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
910 | { | 910 | { |
911 | WARN_ON (tf->protocol == ATA_PROT_DMA || | 911 | WARN_ON (tf->protocol == ATA_PROT_DMA || |
912 | tf->protocol == ATA_PROT_NODATA); | 912 | tf->protocol == ATA_PROT_NODATA); |
@@ -1013,7 +1013,7 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource, | |||
1013 | idx++; | 1013 | idx++; |
1014 | dist = ((long)(s32)(window_size - (offset + size))) >= 0 ? size : | 1014 | dist = ((long)(s32)(window_size - (offset + size))) >= 0 ? size : |
1015 | (long) (window_size - offset); | 1015 | (long) (window_size - offset); |
1016 | memcpy_toio((char *) (dimm_mmio + offset / 4), (char *) psource, dist); | 1016 | memcpy_toio(dimm_mmio + offset / 4, psource, dist); |
1017 | writel(0x01, mmio + PDC_GENERAL_CTLR); | 1017 | writel(0x01, mmio + PDC_GENERAL_CTLR); |
1018 | readl(mmio + PDC_GENERAL_CTLR); | 1018 | readl(mmio + PDC_GENERAL_CTLR); |
1019 | 1019 | ||
@@ -1022,8 +1022,7 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource, | |||
1022 | for (; (long) size >= (long) window_size ;) { | 1022 | for (; (long) size >= (long) window_size ;) { |
1023 | writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); | 1023 | writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); |
1024 | readl(mmio + PDC_DIMM_WINDOW_CTLR); | 1024 | readl(mmio + PDC_DIMM_WINDOW_CTLR); |
1025 | memcpy_toio((char *) (dimm_mmio), (char *) psource, | 1025 | memcpy_toio(dimm_mmio, psource, window_size / 4); |
1026 | window_size / 4); | ||
1027 | writel(0x01, mmio + PDC_GENERAL_CTLR); | 1026 | writel(0x01, mmio + PDC_GENERAL_CTLR); |
1028 | readl(mmio + PDC_GENERAL_CTLR); | 1027 | readl(mmio + PDC_GENERAL_CTLR); |
1029 | psource += window_size; | 1028 | psource += window_size; |
@@ -1034,7 +1033,7 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource, | |||
1034 | if (size) { | 1033 | if (size) { |
1035 | writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); | 1034 | writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); |
1036 | readl(mmio + PDC_DIMM_WINDOW_CTLR); | 1035 | readl(mmio + PDC_DIMM_WINDOW_CTLR); |
1037 | memcpy_toio((char *) (dimm_mmio), (char *) psource, size / 4); | 1036 | memcpy_toio(dimm_mmio, psource, size / 4); |
1038 | writel(0x01, mmio + PDC_GENERAL_CTLR); | 1037 | writel(0x01, mmio + PDC_GENERAL_CTLR); |
1039 | readl(mmio + PDC_GENERAL_CTLR); | 1038 | readl(mmio + PDC_GENERAL_CTLR); |
1040 | } | 1039 | } |
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c index 9c06f2abe7f7..d68dc7d3422c 100644 --- a/drivers/scsi/sata_uli.c +++ b/drivers/scsi/sata_uli.c | |||
@@ -90,7 +90,7 @@ static Scsi_Host_Template uli_sht = { | |||
90 | .ordered_flush = 1, | 90 | .ordered_flush = 1, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | static struct ata_port_operations uli_ops = { | 93 | static const struct ata_port_operations uli_ops = { |
94 | .port_disable = ata_port_disable, | 94 | .port_disable = ata_port_disable, |
95 | 95 | ||
96 | .tf_load = ata_tf_load, | 96 | .tf_load = ata_tf_load, |
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c index 565872479b9a..80e291a909a9 100644 --- a/drivers/scsi/sata_via.c +++ b/drivers/scsi/sata_via.c | |||
@@ -109,7 +109,7 @@ static Scsi_Host_Template svia_sht = { | |||
109 | .ordered_flush = 1, | 109 | .ordered_flush = 1, |
110 | }; | 110 | }; |
111 | 111 | ||
112 | static struct ata_port_operations svia_sata_ops = { | 112 | static const struct ata_port_operations svia_sata_ops = { |
113 | .port_disable = ata_port_disable, | 113 | .port_disable = ata_port_disable, |
114 | 114 | ||
115 | .tf_load = ata_tf_load, | 115 | .tf_load = ata_tf_load, |
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index cf94e0158a8d..5af05fdf8544 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c | |||
@@ -86,7 +86,7 @@ static u32 vsc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) | |||
86 | { | 86 | { |
87 | if (sc_reg > SCR_CONTROL) | 87 | if (sc_reg > SCR_CONTROL) |
88 | return 0xffffffffU; | 88 | return 0xffffffffU; |
89 | return readl((void *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 89 | return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); |
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
@@ -95,16 +95,16 @@ static void vsc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, | |||
95 | { | 95 | { |
96 | if (sc_reg > SCR_CONTROL) | 96 | if (sc_reg > SCR_CONTROL) |
97 | return; | 97 | return; |
98 | writel(val, (void *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 98 | writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl) | 102 | static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl) |
103 | { | 103 | { |
104 | unsigned long mask_addr; | 104 | void __iomem *mask_addr; |
105 | u8 mask; | 105 | u8 mask; |
106 | 106 | ||
107 | mask_addr = (unsigned long) ap->host_set->mmio_base + | 107 | mask_addr = ap->host_set->mmio_base + |
108 | VSC_SATA_INT_MASK_OFFSET + ap->port_no; | 108 | VSC_SATA_INT_MASK_OFFSET + ap->port_no; |
109 | mask = readb(mask_addr); | 109 | mask = readb(mask_addr); |
110 | if (ctl & ATA_NIEN) | 110 | if (ctl & ATA_NIEN) |
@@ -115,7 +115,7 @@ static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl) | |||
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | static void vsc_sata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) | 118 | static void vsc_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) |
119 | { | 119 | { |
120 | struct ata_ioports *ioaddr = &ap->ioaddr; | 120 | struct ata_ioports *ioaddr = &ap->ioaddr; |
121 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | 121 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; |
@@ -231,7 +231,7 @@ static Scsi_Host_Template vsc_sata_sht = { | |||
231 | }; | 231 | }; |
232 | 232 | ||
233 | 233 | ||
234 | static struct ata_port_operations vsc_sata_ops = { | 234 | static const struct ata_port_operations vsc_sata_ops = { |
235 | .port_disable = ata_port_disable, | 235 | .port_disable = ata_port_disable, |
236 | .tf_load = vsc_sata_tf_load, | 236 | .tf_load = vsc_sata_tf_load, |
237 | .tf_read = vsc_sata_tf_read, | 237 | .tf_read = vsc_sata_tf_read, |
@@ -283,7 +283,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d | |||
283 | struct ata_probe_ent *probe_ent = NULL; | 283 | struct ata_probe_ent *probe_ent = NULL; |
284 | unsigned long base; | 284 | unsigned long base; |
285 | int pci_dev_busy = 0; | 285 | int pci_dev_busy = 0; |
286 | void *mmio_base; | 286 | void __iomem *mmio_base; |
287 | int rc; | 287 | int rc; |
288 | 288 | ||
289 | if (!printed_version++) | 289 | if (!printed_version++) |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 1f0ebabf6d47..a5711d545d71 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -130,7 +130,7 @@ EXPORT_SYMBOL(scsi_device_types); | |||
130 | * Returns: Pointer to request block. | 130 | * Returns: Pointer to request block. |
131 | */ | 131 | */ |
132 | struct scsi_request *scsi_allocate_request(struct scsi_device *sdev, | 132 | struct scsi_request *scsi_allocate_request(struct scsi_device *sdev, |
133 | int gfp_mask) | 133 | gfp_t gfp_mask) |
134 | { | 134 | { |
135 | const int offset = ALIGN(sizeof(struct scsi_request), 4); | 135 | const int offset = ALIGN(sizeof(struct scsi_request), 4); |
136 | const int size = offset + sizeof(struct request); | 136 | const int size = offset + sizeof(struct request); |
@@ -196,7 +196,7 @@ struct scsi_host_cmd_pool { | |||
196 | unsigned int users; | 196 | unsigned int users; |
197 | char *name; | 197 | char *name; |
198 | unsigned int slab_flags; | 198 | unsigned int slab_flags; |
199 | unsigned int gfp_mask; | 199 | gfp_t gfp_mask; |
200 | }; | 200 | }; |
201 | 201 | ||
202 | static struct scsi_host_cmd_pool scsi_cmd_pool = { | 202 | static struct scsi_host_cmd_pool scsi_cmd_pool = { |
@@ -213,7 +213,7 @@ static struct scsi_host_cmd_pool scsi_cmd_dma_pool = { | |||
213 | static DECLARE_MUTEX(host_cmd_pool_mutex); | 213 | static DECLARE_MUTEX(host_cmd_pool_mutex); |
214 | 214 | ||
215 | static struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, | 215 | static struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, |
216 | int gfp_mask) | 216 | gfp_t gfp_mask) |
217 | { | 217 | { |
218 | struct scsi_cmnd *cmd; | 218 | struct scsi_cmnd *cmd; |
219 | 219 | ||
@@ -245,7 +245,7 @@ static struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, | |||
245 | * | 245 | * |
246 | * Returns: The allocated scsi command structure. | 246 | * Returns: The allocated scsi command structure. |
247 | */ | 247 | */ |
248 | struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask) | 248 | struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, gfp_t gfp_mask) |
249 | { | 249 | { |
250 | struct scsi_cmnd *cmd; | 250 | struct scsi_cmnd *cmd; |
251 | 251 | ||
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 64fc9e21f35b..e69477d1889b 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -185,6 +185,7 @@ static struct { | |||
185 | {"PIONEER", "CD-ROM DRM-600", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 185 | {"PIONEER", "CD-ROM DRM-600", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
186 | {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 186 | {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
187 | {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 187 | {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
188 | {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | ||
188 | {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, | 189 | {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, |
189 | {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, | 190 | {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, |
190 | {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ | 191 | {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index ad5342165079..52b348c36d56 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -1645,6 +1645,8 @@ int scsi_error_handler(void *data) | |||
1645 | set_current_state(TASK_INTERRUPTIBLE); | 1645 | set_current_state(TASK_INTERRUPTIBLE); |
1646 | } | 1646 | } |
1647 | 1647 | ||
1648 | __set_current_state(TASK_RUNNING); | ||
1649 | |||
1648 | SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler scsi_eh_%d" | 1650 | SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler scsi_eh_%d" |
1649 | " exiting\n",shost->host_no)); | 1651 | " exiting\n",shost->host_no)); |
1650 | 1652 | ||
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index de7f98cc38fe..6a3f6aae8a97 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c | |||
@@ -205,7 +205,8 @@ int scsi_ioctl_send_command(struct scsi_device *sdev, | |||
205 | unsigned int inlen, outlen, cmdlen; | 205 | unsigned int inlen, outlen, cmdlen; |
206 | unsigned int needed, buf_needed; | 206 | unsigned int needed, buf_needed; |
207 | int timeout, retries, result; | 207 | int timeout, retries, result; |
208 | int data_direction, gfp_mask = GFP_KERNEL; | 208 | int data_direction; |
209 | gfp_t gfp_mask = GFP_KERNEL; | ||
209 | 210 | ||
210 | if (!sic) | 211 | if (!sic) |
211 | return -EINVAL; | 212 | return -EINVAL; |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index dc9c772bc874..3ff538809786 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -97,7 +97,6 @@ int scsi_insert_special_req(struct scsi_request *sreq, int at_head) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | static void scsi_run_queue(struct request_queue *q); | 99 | static void scsi_run_queue(struct request_queue *q); |
100 | static void scsi_release_buffers(struct scsi_cmnd *cmd); | ||
101 | 100 | ||
102 | /* | 101 | /* |
103 | * Function: scsi_unprep_request() | 102 | * Function: scsi_unprep_request() |
@@ -678,7 +677,7 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int uptodate, | |||
678 | return NULL; | 677 | return NULL; |
679 | } | 678 | } |
680 | 679 | ||
681 | static struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, int gfp_mask) | 680 | static struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask) |
682 | { | 681 | { |
683 | struct scsi_host_sg_pool *sgp; | 682 | struct scsi_host_sg_pool *sgp; |
684 | struct scatterlist *sgl; | 683 | struct scatterlist *sgl; |
@@ -1040,8 +1039,10 @@ static int scsi_init_io(struct scsi_cmnd *cmd) | |||
1040 | * if sg table allocation fails, requeue request later. | 1039 | * if sg table allocation fails, requeue request later. |
1041 | */ | 1040 | */ |
1042 | sgpnt = scsi_alloc_sgtable(cmd, GFP_ATOMIC); | 1041 | sgpnt = scsi_alloc_sgtable(cmd, GFP_ATOMIC); |
1043 | if (unlikely(!sgpnt)) | 1042 | if (unlikely(!sgpnt)) { |
1043 | scsi_unprep_request(req); | ||
1044 | return BLKPREP_DEFER; | 1044 | return BLKPREP_DEFER; |
1045 | } | ||
1045 | 1046 | ||
1046 | cmd->request_buffer = (char *) sgpnt; | 1047 | cmd->request_buffer = (char *) sgpnt; |
1047 | cmd->request_bufflen = req->nr_sectors << 9; | 1048 | cmd->request_bufflen = req->nr_sectors << 9; |
@@ -1245,8 +1246,8 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req) | |||
1245 | */ | 1246 | */ |
1246 | ret = scsi_init_io(cmd); | 1247 | ret = scsi_init_io(cmd); |
1247 | switch(ret) { | 1248 | switch(ret) { |
1249 | /* For BLKPREP_KILL/DEFER the cmd was released */ | ||
1248 | case BLKPREP_KILL: | 1250 | case BLKPREP_KILL: |
1249 | /* BLKPREP_KILL return also releases the command */ | ||
1250 | goto kill; | 1251 | goto kill; |
1251 | case BLKPREP_DEFER: | 1252 | case BLKPREP_DEFER: |
1252 | goto defer; | 1253 | goto defer; |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 2cab556b6e82..771e97ef136e 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -819,12 +819,15 @@ show_fc_private_host_tgtid_bind_type(struct class_device *cdev, char *buf) | |||
819 | return snprintf(buf, FC_BINDTYPE_MAX_NAMELEN, "%s\n", name); | 819 | return snprintf(buf, FC_BINDTYPE_MAX_NAMELEN, "%s\n", name); |
820 | } | 820 | } |
821 | 821 | ||
822 | #define get_list_head_entry(pos, head, member) \ | ||
823 | pos = list_entry((head)->next, typeof(*pos), member) | ||
824 | |||
822 | static ssize_t | 825 | static ssize_t |
823 | store_fc_private_host_tgtid_bind_type(struct class_device *cdev, | 826 | store_fc_private_host_tgtid_bind_type(struct class_device *cdev, |
824 | const char *buf, size_t count) | 827 | const char *buf, size_t count) |
825 | { | 828 | { |
826 | struct Scsi_Host *shost = transport_class_to_shost(cdev); | 829 | struct Scsi_Host *shost = transport_class_to_shost(cdev); |
827 | struct fc_rport *rport, *next_rport; | 830 | struct fc_rport *rport; |
828 | enum fc_tgtid_binding_type val; | 831 | enum fc_tgtid_binding_type val; |
829 | unsigned long flags; | 832 | unsigned long flags; |
830 | 833 | ||
@@ -834,9 +837,13 @@ store_fc_private_host_tgtid_bind_type(struct class_device *cdev, | |||
834 | /* if changing bind type, purge all unused consistent bindings */ | 837 | /* if changing bind type, purge all unused consistent bindings */ |
835 | if (val != fc_host_tgtid_bind_type(shost)) { | 838 | if (val != fc_host_tgtid_bind_type(shost)) { |
836 | spin_lock_irqsave(shost->host_lock, flags); | 839 | spin_lock_irqsave(shost->host_lock, flags); |
837 | list_for_each_entry_safe(rport, next_rport, | 840 | while (!list_empty(&fc_host_rport_bindings(shost))) { |
838 | &fc_host_rport_bindings(shost), peers) | 841 | get_list_head_entry(rport, |
842 | &fc_host_rport_bindings(shost), peers); | ||
843 | spin_unlock_irqrestore(shost->host_lock, flags); | ||
839 | fc_rport_terminate(rport); | 844 | fc_rport_terminate(rport); |
845 | spin_lock_irqsave(shost->host_lock, flags); | ||
846 | } | ||
840 | spin_unlock_irqrestore(shost->host_lock, flags); | 847 | spin_unlock_irqrestore(shost->host_lock, flags); |
841 | } | 848 | } |
842 | 849 | ||
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index ad94367df430..fd56b7ec88b6 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -2644,7 +2644,7 @@ static char * | |||
2644 | sg_page_malloc(int rqSz, int lowDma, int *retSzp) | 2644 | sg_page_malloc(int rqSz, int lowDma, int *retSzp) |
2645 | { | 2645 | { |
2646 | char *resp = NULL; | 2646 | char *resp = NULL; |
2647 | int page_mask; | 2647 | gfp_t page_mask; |
2648 | int order, a_size; | 2648 | int order, a_size; |
2649 | int resSz = rqSz; | 2649 | int resSz = rqSz; |
2650 | 2650 | ||
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index d001c046551b..927d700f0073 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -3577,7 +3577,8 @@ static long st_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a | |||
3577 | static struct st_buffer * | 3577 | static struct st_buffer * |
3578 | new_tape_buffer(int from_initialization, int need_dma, int max_sg) | 3578 | new_tape_buffer(int from_initialization, int need_dma, int max_sg) |
3579 | { | 3579 | { |
3580 | int i, priority, got = 0, segs = 0; | 3580 | int i, got = 0, segs = 0; |
3581 | gfp_t priority; | ||
3581 | struct st_buffer *tb; | 3582 | struct st_buffer *tb; |
3582 | 3583 | ||
3583 | if (from_initialization) | 3584 | if (from_initialization) |
@@ -3610,7 +3611,8 @@ static struct st_buffer * | |||
3610 | /* Try to allocate enough space in the tape buffer */ | 3611 | /* Try to allocate enough space in the tape buffer */ |
3611 | static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dma) | 3612 | static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dma) |
3612 | { | 3613 | { |
3613 | int segs, nbr, max_segs, b_size, priority, order, got; | 3614 | int segs, nbr, max_segs, b_size, order, got; |
3615 | gfp_t priority; | ||
3614 | 3616 | ||
3615 | if (new_size <= STbuffer->buffer_size) | 3617 | if (new_size <= STbuffer->buffer_size) |
3616 | return 1; | 3618 | return 1; |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 0e21f583690e..5c3c03932d6d 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -152,6 +152,7 @@ static int __devinit pci_hp_diva_init(struct pci_dev *dev) | |||
152 | rc = 4; | 152 | rc = 4; |
153 | break; | 153 | break; |
154 | case PCI_DEVICE_ID_HP_DIVA_POWERBAR: | 154 | case PCI_DEVICE_ID_HP_DIVA_POWERBAR: |
155 | case PCI_DEVICE_ID_HP_DIVA_HURRICANE: | ||
155 | rc = 1; | 156 | rc = 1; |
156 | break; | 157 | break; |
157 | } | 158 | } |
@@ -226,8 +227,10 @@ static int __devinit pci_plx9050_init(struct pci_dev *dev) | |||
226 | } | 227 | } |
227 | 228 | ||
228 | irq_config = 0x41; | 229 | irq_config = 0x41; |
229 | if (dev->vendor == PCI_VENDOR_ID_PANACOM) | 230 | if (dev->vendor == PCI_VENDOR_ID_PANACOM || |
231 | dev->subsystem_vendor == PCI_SUBVENDOR_ID_EXSYS) { | ||
230 | irq_config = 0x43; | 232 | irq_config = 0x43; |
233 | } | ||
231 | if ((dev->vendor == PCI_VENDOR_ID_PLX) && | 234 | if ((dev->vendor == PCI_VENDOR_ID_PLX) && |
232 | (dev->device == PCI_DEVICE_ID_PLX_ROMULUS)) { | 235 | (dev->device == PCI_DEVICE_ID_PLX_ROMULUS)) { |
233 | /* | 236 | /* |
@@ -664,6 +667,15 @@ static struct pci_serial_quirk pci_serial_quirks[] = { | |||
664 | { | 667 | { |
665 | .vendor = PCI_VENDOR_ID_PLX, | 668 | .vendor = PCI_VENDOR_ID_PLX, |
666 | .device = PCI_DEVICE_ID_PLX_9050, | 669 | .device = PCI_DEVICE_ID_PLX_9050, |
670 | .subvendor = PCI_SUBVENDOR_ID_EXSYS, | ||
671 | .subdevice = PCI_SUBDEVICE_ID_EXSYS_4055, | ||
672 | .init = pci_plx9050_init, | ||
673 | .setup = pci_default_setup, | ||
674 | .exit = __devexit_p(pci_plx9050_exit), | ||
675 | }, | ||
676 | { | ||
677 | .vendor = PCI_VENDOR_ID_PLX, | ||
678 | .device = PCI_DEVICE_ID_PLX_9050, | ||
667 | .subvendor = PCI_SUBVENDOR_ID_KEYSPAN, | 679 | .subvendor = PCI_SUBVENDOR_ID_KEYSPAN, |
668 | .subdevice = PCI_SUBDEVICE_ID_KEYSPAN_SX2, | 680 | .subdevice = PCI_SUBDEVICE_ID_KEYSPAN_SX2, |
669 | .init = pci_plx9050_init, | 681 | .init = pci_plx9050_init, |
@@ -927,6 +939,7 @@ enum pci_board_num_t { | |||
927 | pbn_panacom, | 939 | pbn_panacom, |
928 | pbn_panacom2, | 940 | pbn_panacom2, |
929 | pbn_panacom4, | 941 | pbn_panacom4, |
942 | pbn_exsys_4055, | ||
930 | pbn_plx_romulus, | 943 | pbn_plx_romulus, |
931 | pbn_oxsemi, | 944 | pbn_oxsemi, |
932 | pbn_intel_i960, | 945 | pbn_intel_i960, |
@@ -1292,6 +1305,13 @@ static struct pciserial_board pci_boards[] __devinitdata = { | |||
1292 | .reg_shift = 7, | 1305 | .reg_shift = 7, |
1293 | }, | 1306 | }, |
1294 | 1307 | ||
1308 | [pbn_exsys_4055] = { | ||
1309 | .flags = FL_BASE2, | ||
1310 | .num_ports = 4, | ||
1311 | .base_baud = 115200, | ||
1312 | .uart_offset = 8, | ||
1313 | }, | ||
1314 | |||
1295 | /* I think this entry is broken - the first_offset looks wrong --rmk */ | 1315 | /* I think this entry is broken - the first_offset looks wrong --rmk */ |
1296 | [pbn_plx_romulus] = { | 1316 | [pbn_plx_romulus] = { |
1297 | .flags = FL_BASE2, | 1317 | .flags = FL_BASE2, |
@@ -1853,6 +1873,10 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
1853 | PCI_SUBVENDOR_ID_CHASE_PCIRAS, | 1873 | PCI_SUBVENDOR_ID_CHASE_PCIRAS, |
1854 | PCI_SUBDEVICE_ID_CHASE_PCIRAS8, 0, 0, | 1874 | PCI_SUBDEVICE_ID_CHASE_PCIRAS8, 0, 0, |
1855 | pbn_b2_8_460800 }, | 1875 | pbn_b2_8_460800 }, |
1876 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | ||
1877 | PCI_SUBVENDOR_ID_EXSYS, | ||
1878 | PCI_SUBDEVICE_ID_EXSYS_4055, 0, 0, | ||
1879 | pbn_exsys_4055 }, | ||
1856 | /* | 1880 | /* |
1857 | * Megawolf Romulus PCI Serial Card, from Mike Hudson | 1881 | * Megawolf Romulus PCI Serial Card, from Mike Hudson |
1858 | * (Exoray@isys.ca) | 1882 | * (Exoray@isys.ca) |
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index c2786fc41cc5..5d8660a42b77 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
@@ -276,6 +276,8 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
276 | { "SUP1620", 0 }, | 276 | { "SUP1620", 0 }, |
277 | /* SupraExpress 33.6 Data/Fax PnP modem */ | 277 | /* SupraExpress 33.6 Data/Fax PnP modem */ |
278 | { "SUP1760", 0 }, | 278 | { "SUP1760", 0 }, |
279 | /* SupraExpress 56i Sp Intl */ | ||
280 | { "SUP2171", 0 }, | ||
279 | /* Phoebe Micro */ | 281 | /* Phoebe Micro */ |
280 | /* Phoebe Micro 33.6 Data Fax 1433VQH Plug & Play */ | 282 | /* Phoebe Micro 33.6 Data Fax 1433VQH Plug & Play */ |
281 | { "TEX0011", 0 }, | 283 | { "TEX0011", 0 }, |
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index fc15b4acc8af..57e800ac3cee 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c | |||
@@ -106,7 +106,7 @@ void hcd_buffer_destroy (struct usb_hcd *hcd) | |||
106 | void *hcd_buffer_alloc ( | 106 | void *hcd_buffer_alloc ( |
107 | struct usb_bus *bus, | 107 | struct usb_bus *bus, |
108 | size_t size, | 108 | size_t size, |
109 | unsigned mem_flags, | 109 | gfp_t mem_flags, |
110 | dma_addr_t *dma | 110 | dma_addr_t *dma |
111 | ) | 111 | ) |
112 | { | 112 | { |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 1017a97a418b..ff19d64041b5 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1112,7 +1112,7 @@ static void urb_unlink (struct urb *urb) | |||
1112 | * expects usb_submit_urb() to have sanity checked and conditioned all | 1112 | * expects usb_submit_urb() to have sanity checked and conditioned all |
1113 | * inputs in the urb | 1113 | * inputs in the urb |
1114 | */ | 1114 | */ |
1115 | static int hcd_submit_urb (struct urb *urb, unsigned mem_flags) | 1115 | static int hcd_submit_urb (struct urb *urb, gfp_t mem_flags) |
1116 | { | 1116 | { |
1117 | int status; | 1117 | int status; |
1118 | struct usb_hcd *hcd = urb->dev->bus->hcpriv; | 1118 | struct usb_hcd *hcd = urb->dev->bus->hcpriv; |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index ac451fa7e4d2..1f1ed6211af8 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -142,12 +142,12 @@ struct hcd_timeout { /* timeouts we allocate */ | |||
142 | 142 | ||
143 | struct usb_operations { | 143 | struct usb_operations { |
144 | int (*get_frame_number) (struct usb_device *usb_dev); | 144 | int (*get_frame_number) (struct usb_device *usb_dev); |
145 | int (*submit_urb) (struct urb *urb, unsigned mem_flags); | 145 | int (*submit_urb) (struct urb *urb, gfp_t mem_flags); |
146 | int (*unlink_urb) (struct urb *urb, int status); | 146 | int (*unlink_urb) (struct urb *urb, int status); |
147 | 147 | ||
148 | /* allocate dma-consistent buffer for URB_DMA_NOMAPPING */ | 148 | /* allocate dma-consistent buffer for URB_DMA_NOMAPPING */ |
149 | void *(*buffer_alloc)(struct usb_bus *bus, size_t size, | 149 | void *(*buffer_alloc)(struct usb_bus *bus, size_t size, |
150 | unsigned mem_flags, | 150 | gfp_t mem_flags, |
151 | dma_addr_t *dma); | 151 | dma_addr_t *dma); |
152 | void (*buffer_free)(struct usb_bus *bus, size_t size, | 152 | void (*buffer_free)(struct usb_bus *bus, size_t size, |
153 | void *addr, dma_addr_t dma); | 153 | void *addr, dma_addr_t dma); |
@@ -200,7 +200,7 @@ struct hc_driver { | |||
200 | int (*urb_enqueue) (struct usb_hcd *hcd, | 200 | int (*urb_enqueue) (struct usb_hcd *hcd, |
201 | struct usb_host_endpoint *ep, | 201 | struct usb_host_endpoint *ep, |
202 | struct urb *urb, | 202 | struct urb *urb, |
203 | unsigned mem_flags); | 203 | gfp_t mem_flags); |
204 | int (*urb_dequeue) (struct usb_hcd *hcd, struct urb *urb); | 204 | int (*urb_dequeue) (struct usb_hcd *hcd, struct urb *urb); |
205 | 205 | ||
206 | /* hw synch, freeing endpoint resources that urb_dequeue can't */ | 206 | /* hw synch, freeing endpoint resources that urb_dequeue can't */ |
@@ -247,7 +247,7 @@ int hcd_buffer_create (struct usb_hcd *hcd); | |||
247 | void hcd_buffer_destroy (struct usb_hcd *hcd); | 247 | void hcd_buffer_destroy (struct usb_hcd *hcd); |
248 | 248 | ||
249 | void *hcd_buffer_alloc (struct usb_bus *bus, size_t size, | 249 | void *hcd_buffer_alloc (struct usb_bus *bus, size_t size, |
250 | unsigned mem_flags, dma_addr_t *dma); | 250 | gfp_t mem_flags, dma_addr_t *dma); |
251 | void hcd_buffer_free (struct usb_bus *bus, size_t size, | 251 | void hcd_buffer_free (struct usb_bus *bus, size_t size, |
252 | void *addr, dma_addr_t dma); | 252 | void *addr, dma_addr_t dma); |
253 | 253 | ||
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index f1fb67fe22a8..f9a81e84dbdf 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -321,7 +321,7 @@ int usb_sg_init ( | |||
321 | struct scatterlist *sg, | 321 | struct scatterlist *sg, |
322 | int nents, | 322 | int nents, |
323 | size_t length, | 323 | size_t length, |
324 | unsigned mem_flags | 324 | gfp_t mem_flags |
325 | ) | 325 | ) |
326 | { | 326 | { |
327 | int i; | 327 | int i; |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index c846fefb7386..b32898e0a27d 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -60,7 +60,7 @@ void usb_init_urb(struct urb *urb) | |||
60 | * | 60 | * |
61 | * The driver must call usb_free_urb() when it is finished with the urb. | 61 | * The driver must call usb_free_urb() when it is finished with the urb. |
62 | */ | 62 | */ |
63 | struct urb *usb_alloc_urb(int iso_packets, unsigned mem_flags) | 63 | struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags) |
64 | { | 64 | { |
65 | struct urb *urb; | 65 | struct urb *urb; |
66 | 66 | ||
@@ -224,7 +224,7 @@ struct urb * usb_get_urb(struct urb *urb) | |||
224 | * GFP_NOIO, unless b) or c) apply | 224 | * GFP_NOIO, unless b) or c) apply |
225 | * | 225 | * |
226 | */ | 226 | */ |
227 | int usb_submit_urb(struct urb *urb, unsigned mem_flags) | 227 | int usb_submit_urb(struct urb *urb, gfp_t mem_flags) |
228 | { | 228 | { |
229 | int pipe, temp, max; | 229 | int pipe, temp, max; |
230 | struct usb_device *dev; | 230 | struct usb_device *dev; |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 7d131509e419..4c57f3f649ed 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -1147,7 +1147,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, | |||
1147 | void *usb_buffer_alloc ( | 1147 | void *usb_buffer_alloc ( |
1148 | struct usb_device *dev, | 1148 | struct usb_device *dev, |
1149 | size_t size, | 1149 | size_t size, |
1150 | unsigned mem_flags, | 1150 | gfp_t mem_flags, |
1151 | dma_addr_t *dma | 1151 | dma_addr_t *dma |
1152 | ) | 1152 | ) |
1153 | { | 1153 | { |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 583db7c38cf1..8d9d8ee89554 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -470,7 +470,7 @@ static int dummy_disable (struct usb_ep *_ep) | |||
470 | } | 470 | } |
471 | 471 | ||
472 | static struct usb_request * | 472 | static struct usb_request * |
473 | dummy_alloc_request (struct usb_ep *_ep, unsigned mem_flags) | 473 | dummy_alloc_request (struct usb_ep *_ep, gfp_t mem_flags) |
474 | { | 474 | { |
475 | struct dummy_ep *ep; | 475 | struct dummy_ep *ep; |
476 | struct dummy_request *req; | 476 | struct dummy_request *req; |
@@ -507,7 +507,7 @@ dummy_alloc_buffer ( | |||
507 | struct usb_ep *_ep, | 507 | struct usb_ep *_ep, |
508 | unsigned bytes, | 508 | unsigned bytes, |
509 | dma_addr_t *dma, | 509 | dma_addr_t *dma, |
510 | unsigned mem_flags | 510 | gfp_t mem_flags |
511 | ) { | 511 | ) { |
512 | char *retval; | 512 | char *retval; |
513 | struct dummy_ep *ep; | 513 | struct dummy_ep *ep; |
@@ -541,7 +541,7 @@ fifo_complete (struct usb_ep *ep, struct usb_request *req) | |||
541 | 541 | ||
542 | static int | 542 | static int |
543 | dummy_queue (struct usb_ep *_ep, struct usb_request *_req, | 543 | dummy_queue (struct usb_ep *_ep, struct usb_request *_req, |
544 | unsigned mem_flags) | 544 | gfp_t mem_flags) |
545 | { | 545 | { |
546 | struct dummy_ep *ep; | 546 | struct dummy_ep *ep; |
547 | struct dummy_request *req; | 547 | struct dummy_request *req; |
@@ -999,7 +999,7 @@ static int dummy_urb_enqueue ( | |||
999 | struct usb_hcd *hcd, | 999 | struct usb_hcd *hcd, |
1000 | struct usb_host_endpoint *ep, | 1000 | struct usb_host_endpoint *ep, |
1001 | struct urb *urb, | 1001 | struct urb *urb, |
1002 | unsigned mem_flags | 1002 | gfp_t mem_flags |
1003 | ) { | 1003 | ) { |
1004 | struct dummy *dum; | 1004 | struct dummy *dum; |
1005 | struct urbp *urbp; | 1005 | struct urbp *urbp; |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 49459e33e952..f1024e804d5c 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -945,11 +945,11 @@ config_buf (enum usb_device_speed speed, | |||
945 | 945 | ||
946 | /*-------------------------------------------------------------------------*/ | 946 | /*-------------------------------------------------------------------------*/ |
947 | 947 | ||
948 | static void eth_start (struct eth_dev *dev, unsigned gfp_flags); | 948 | static void eth_start (struct eth_dev *dev, gfp_t gfp_flags); |
949 | static int alloc_requests (struct eth_dev *dev, unsigned n, unsigned gfp_flags); | 949 | static int alloc_requests (struct eth_dev *dev, unsigned n, gfp_t gfp_flags); |
950 | 950 | ||
951 | static int | 951 | static int |
952 | set_ether_config (struct eth_dev *dev, unsigned gfp_flags) | 952 | set_ether_config (struct eth_dev *dev, gfp_t gfp_flags) |
953 | { | 953 | { |
954 | int result = 0; | 954 | int result = 0; |
955 | struct usb_gadget *gadget = dev->gadget; | 955 | struct usb_gadget *gadget = dev->gadget; |
@@ -1081,7 +1081,7 @@ static void eth_reset_config (struct eth_dev *dev) | |||
1081 | * that returns config descriptors, and altsetting code. | 1081 | * that returns config descriptors, and altsetting code. |
1082 | */ | 1082 | */ |
1083 | static int | 1083 | static int |
1084 | eth_set_config (struct eth_dev *dev, unsigned number, unsigned gfp_flags) | 1084 | eth_set_config (struct eth_dev *dev, unsigned number, gfp_t gfp_flags) |
1085 | { | 1085 | { |
1086 | int result = 0; | 1086 | int result = 0; |
1087 | struct usb_gadget *gadget = dev->gadget; | 1087 | struct usb_gadget *gadget = dev->gadget; |
@@ -1598,7 +1598,7 @@ static void defer_kevent (struct eth_dev *dev, int flag) | |||
1598 | static void rx_complete (struct usb_ep *ep, struct usb_request *req); | 1598 | static void rx_complete (struct usb_ep *ep, struct usb_request *req); |
1599 | 1599 | ||
1600 | static int | 1600 | static int |
1601 | rx_submit (struct eth_dev *dev, struct usb_request *req, unsigned gfp_flags) | 1601 | rx_submit (struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags) |
1602 | { | 1602 | { |
1603 | struct sk_buff *skb; | 1603 | struct sk_buff *skb; |
1604 | int retval = -ENOMEM; | 1604 | int retval = -ENOMEM; |
@@ -1724,7 +1724,7 @@ clean: | |||
1724 | } | 1724 | } |
1725 | 1725 | ||
1726 | static int prealloc (struct list_head *list, struct usb_ep *ep, | 1726 | static int prealloc (struct list_head *list, struct usb_ep *ep, |
1727 | unsigned n, unsigned gfp_flags) | 1727 | unsigned n, gfp_t gfp_flags) |
1728 | { | 1728 | { |
1729 | unsigned i; | 1729 | unsigned i; |
1730 | struct usb_request *req; | 1730 | struct usb_request *req; |
@@ -1763,7 +1763,7 @@ extra: | |||
1763 | return 0; | 1763 | return 0; |
1764 | } | 1764 | } |
1765 | 1765 | ||
1766 | static int alloc_requests (struct eth_dev *dev, unsigned n, unsigned gfp_flags) | 1766 | static int alloc_requests (struct eth_dev *dev, unsigned n, gfp_t gfp_flags) |
1767 | { | 1767 | { |
1768 | int status; | 1768 | int status; |
1769 | 1769 | ||
@@ -1779,7 +1779,7 @@ fail: | |||
1779 | return status; | 1779 | return status; |
1780 | } | 1780 | } |
1781 | 1781 | ||
1782 | static void rx_fill (struct eth_dev *dev, unsigned gfp_flags) | 1782 | static void rx_fill (struct eth_dev *dev, gfp_t gfp_flags) |
1783 | { | 1783 | { |
1784 | struct usb_request *req; | 1784 | struct usb_request *req; |
1785 | unsigned long flags; | 1785 | unsigned long flags; |
@@ -1962,7 +1962,7 @@ drop: | |||
1962 | * normally just one notification will be queued. | 1962 | * normally just one notification will be queued. |
1963 | */ | 1963 | */ |
1964 | 1964 | ||
1965 | static struct usb_request *eth_req_alloc (struct usb_ep *, unsigned, unsigned); | 1965 | static struct usb_request *eth_req_alloc (struct usb_ep *, unsigned, gfp_t); |
1966 | static void eth_req_free (struct usb_ep *ep, struct usb_request *req); | 1966 | static void eth_req_free (struct usb_ep *ep, struct usb_request *req); |
1967 | 1967 | ||
1968 | static void | 1968 | static void |
@@ -2024,7 +2024,7 @@ static int rndis_control_ack (struct net_device *net) | |||
2024 | 2024 | ||
2025 | #endif /* RNDIS */ | 2025 | #endif /* RNDIS */ |
2026 | 2026 | ||
2027 | static void eth_start (struct eth_dev *dev, unsigned gfp_flags) | 2027 | static void eth_start (struct eth_dev *dev, gfp_t gfp_flags) |
2028 | { | 2028 | { |
2029 | DEBUG (dev, "%s\n", __FUNCTION__); | 2029 | DEBUG (dev, "%s\n", __FUNCTION__); |
2030 | 2030 | ||
@@ -2092,7 +2092,7 @@ static int eth_stop (struct net_device *net) | |||
2092 | /*-------------------------------------------------------------------------*/ | 2092 | /*-------------------------------------------------------------------------*/ |
2093 | 2093 | ||
2094 | static struct usb_request * | 2094 | static struct usb_request * |
2095 | eth_req_alloc (struct usb_ep *ep, unsigned size, unsigned gfp_flags) | 2095 | eth_req_alloc (struct usb_ep *ep, unsigned size, gfp_t gfp_flags) |
2096 | { | 2096 | { |
2097 | struct usb_request *req; | 2097 | struct usb_request *req; |
2098 | 2098 | ||
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index eaab26f4ed37..b0f3cd63e3b9 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
@@ -269,7 +269,7 @@ static int goku_ep_disable(struct usb_ep *_ep) | |||
269 | /*-------------------------------------------------------------------------*/ | 269 | /*-------------------------------------------------------------------------*/ |
270 | 270 | ||
271 | static struct usb_request * | 271 | static struct usb_request * |
272 | goku_alloc_request(struct usb_ep *_ep, unsigned gfp_flags) | 272 | goku_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags) |
273 | { | 273 | { |
274 | struct goku_request *req; | 274 | struct goku_request *req; |
275 | 275 | ||
@@ -327,7 +327,7 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req) | |||
327 | */ | 327 | */ |
328 | static void * | 328 | static void * |
329 | goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | 329 | goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, |
330 | dma_addr_t *dma, unsigned gfp_flags) | 330 | dma_addr_t *dma, gfp_t gfp_flags) |
331 | { | 331 | { |
332 | void *retval; | 332 | void *retval; |
333 | struct goku_ep *ep; | 333 | struct goku_ep *ep; |
@@ -789,7 +789,7 @@ finished: | |||
789 | /*-------------------------------------------------------------------------*/ | 789 | /*-------------------------------------------------------------------------*/ |
790 | 790 | ||
791 | static int | 791 | static int |
792 | goku_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) | 792 | goku_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) |
793 | { | 793 | { |
794 | struct goku_request *req; | 794 | struct goku_request *req; |
795 | struct goku_ep *ep; | 795 | struct goku_ep *ep; |
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c index 4842577789c9..012d1e5f1524 100644 --- a/drivers/usb/gadget/lh7a40x_udc.c +++ b/drivers/usb/gadget/lh7a40x_udc.c | |||
@@ -71,13 +71,13 @@ static char *state_names[] = { | |||
71 | static int lh7a40x_ep_enable(struct usb_ep *ep, | 71 | static int lh7a40x_ep_enable(struct usb_ep *ep, |
72 | const struct usb_endpoint_descriptor *); | 72 | const struct usb_endpoint_descriptor *); |
73 | static int lh7a40x_ep_disable(struct usb_ep *ep); | 73 | static int lh7a40x_ep_disable(struct usb_ep *ep); |
74 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, int); | 74 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, gfp_t); |
75 | static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *); | 75 | static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *); |
76 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned, dma_addr_t *, | 76 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned, dma_addr_t *, |
77 | int); | 77 | gfp_t); |
78 | static void lh7a40x_free_buffer(struct usb_ep *ep, void *, dma_addr_t, | 78 | static void lh7a40x_free_buffer(struct usb_ep *ep, void *, dma_addr_t, |
79 | unsigned); | 79 | unsigned); |
80 | static int lh7a40x_queue(struct usb_ep *ep, struct usb_request *, int); | 80 | static int lh7a40x_queue(struct usb_ep *ep, struct usb_request *, gfp_t); |
81 | static int lh7a40x_dequeue(struct usb_ep *ep, struct usb_request *); | 81 | static int lh7a40x_dequeue(struct usb_ep *ep, struct usb_request *); |
82 | static int lh7a40x_set_halt(struct usb_ep *ep, int); | 82 | static int lh7a40x_set_halt(struct usb_ep *ep, int); |
83 | static int lh7a40x_fifo_status(struct usb_ep *ep); | 83 | static int lh7a40x_fifo_status(struct usb_ep *ep); |
@@ -1106,7 +1106,7 @@ static int lh7a40x_ep_disable(struct usb_ep *_ep) | |||
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, | 1108 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, |
1109 | unsigned gfp_flags) | 1109 | gfp_t gfp_flags) |
1110 | { | 1110 | { |
1111 | struct lh7a40x_request *req; | 1111 | struct lh7a40x_request *req; |
1112 | 1112 | ||
@@ -1134,7 +1134,7 @@ static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *_req) | |||
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned bytes, | 1136 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned bytes, |
1137 | dma_addr_t * dma, unsigned gfp_flags) | 1137 | dma_addr_t * dma, gfp_t gfp_flags) |
1138 | { | 1138 | { |
1139 | char *retval; | 1139 | char *retval; |
1140 | 1140 | ||
@@ -1158,7 +1158,7 @@ static void lh7a40x_free_buffer(struct usb_ep *ep, void *buf, dma_addr_t dma, | |||
1158 | * NOTE: Sets INDEX register | 1158 | * NOTE: Sets INDEX register |
1159 | */ | 1159 | */ |
1160 | static int lh7a40x_queue(struct usb_ep *_ep, struct usb_request *_req, | 1160 | static int lh7a40x_queue(struct usb_ep *_ep, struct usb_request *_req, |
1161 | unsigned gfp_flags) | 1161 | gfp_t gfp_flags) |
1162 | { | 1162 | { |
1163 | struct lh7a40x_request *req; | 1163 | struct lh7a40x_request *req; |
1164 | struct lh7a40x_ep *ep; | 1164 | struct lh7a40x_ep *ep; |
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 477fab2e74d1..c32e1f7476da 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -376,7 +376,7 @@ static int net2280_disable (struct usb_ep *_ep) | |||
376 | /*-------------------------------------------------------------------------*/ | 376 | /*-------------------------------------------------------------------------*/ |
377 | 377 | ||
378 | static struct usb_request * | 378 | static struct usb_request * |
379 | net2280_alloc_request (struct usb_ep *_ep, unsigned gfp_flags) | 379 | net2280_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) |
380 | { | 380 | { |
381 | struct net2280_ep *ep; | 381 | struct net2280_ep *ep; |
382 | struct net2280_request *req; | 382 | struct net2280_request *req; |
@@ -463,7 +463,7 @@ net2280_alloc_buffer ( | |||
463 | struct usb_ep *_ep, | 463 | struct usb_ep *_ep, |
464 | unsigned bytes, | 464 | unsigned bytes, |
465 | dma_addr_t *dma, | 465 | dma_addr_t *dma, |
466 | unsigned gfp_flags | 466 | gfp_t gfp_flags |
467 | ) | 467 | ) |
468 | { | 468 | { |
469 | void *retval; | 469 | void *retval; |
@@ -897,7 +897,7 @@ done (struct net2280_ep *ep, struct net2280_request *req, int status) | |||
897 | /*-------------------------------------------------------------------------*/ | 897 | /*-------------------------------------------------------------------------*/ |
898 | 898 | ||
899 | static int | 899 | static int |
900 | net2280_queue (struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) | 900 | net2280_queue (struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) |
901 | { | 901 | { |
902 | struct net2280_request *req; | 902 | struct net2280_request *req; |
903 | struct net2280_ep *ep; | 903 | struct net2280_ep *ep; |
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index ff5533e69560..287c5900fb13 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -269,7 +269,7 @@ static int omap_ep_disable(struct usb_ep *_ep) | |||
269 | /*-------------------------------------------------------------------------*/ | 269 | /*-------------------------------------------------------------------------*/ |
270 | 270 | ||
271 | static struct usb_request * | 271 | static struct usb_request * |
272 | omap_alloc_request(struct usb_ep *ep, unsigned gfp_flags) | 272 | omap_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) |
273 | { | 273 | { |
274 | struct omap_req *req; | 274 | struct omap_req *req; |
275 | 275 | ||
@@ -298,7 +298,7 @@ omap_alloc_buffer( | |||
298 | struct usb_ep *_ep, | 298 | struct usb_ep *_ep, |
299 | unsigned bytes, | 299 | unsigned bytes, |
300 | dma_addr_t *dma, | 300 | dma_addr_t *dma, |
301 | unsigned gfp_flags | 301 | gfp_t gfp_flags |
302 | ) | 302 | ) |
303 | { | 303 | { |
304 | void *retval; | 304 | void *retval; |
@@ -937,7 +937,7 @@ static void dma_channel_release(struct omap_ep *ep) | |||
937 | /*-------------------------------------------------------------------------*/ | 937 | /*-------------------------------------------------------------------------*/ |
938 | 938 | ||
939 | static int | 939 | static int |
940 | omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) | 940 | omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) |
941 | { | 941 | { |
942 | struct omap_ep *ep = container_of(_ep, struct omap_ep, ep); | 942 | struct omap_ep *ep = container_of(_ep, struct omap_ep, ep); |
943 | struct omap_req *req = container_of(_req, struct omap_req, req); | 943 | struct omap_req *req = container_of(_req, struct omap_req, req); |
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 73f8c9404156..6e545393cfff 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -332,7 +332,7 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep) | |||
332 | * pxa2xx_ep_alloc_request - allocate a request data structure | 332 | * pxa2xx_ep_alloc_request - allocate a request data structure |
333 | */ | 333 | */ |
334 | static struct usb_request * | 334 | static struct usb_request * |
335 | pxa2xx_ep_alloc_request (struct usb_ep *_ep, unsigned gfp_flags) | 335 | pxa2xx_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) |
336 | { | 336 | { |
337 | struct pxa2xx_request *req; | 337 | struct pxa2xx_request *req; |
338 | 338 | ||
@@ -367,7 +367,7 @@ pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) | |||
367 | */ | 367 | */ |
368 | static void * | 368 | static void * |
369 | pxa2xx_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | 369 | pxa2xx_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes, |
370 | dma_addr_t *dma, unsigned gfp_flags) | 370 | dma_addr_t *dma, gfp_t gfp_flags) |
371 | { | 371 | { |
372 | char *retval; | 372 | char *retval; |
373 | 373 | ||
@@ -874,7 +874,7 @@ done: | |||
874 | /*-------------------------------------------------------------------------*/ | 874 | /*-------------------------------------------------------------------------*/ |
875 | 875 | ||
876 | static int | 876 | static int |
877 | pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) | 877 | pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) |
878 | { | 878 | { |
879 | struct pxa2xx_request *req; | 879 | struct pxa2xx_request *req; |
880 | struct pxa2xx_ep *ep; | 880 | struct pxa2xx_ep *ep; |
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index c925d9222f53..b35ac6d334f8 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -300,18 +300,18 @@ static int gs_build_config_buf(u8 *buf, enum usb_device_speed speed, | |||
300 | u8 type, unsigned int index, int is_otg); | 300 | u8 type, unsigned int index, int is_otg); |
301 | 301 | ||
302 | static struct usb_request *gs_alloc_req(struct usb_ep *ep, unsigned int len, | 302 | static struct usb_request *gs_alloc_req(struct usb_ep *ep, unsigned int len, |
303 | unsigned kmalloc_flags); | 303 | gfp_t kmalloc_flags); |
304 | static void gs_free_req(struct usb_ep *ep, struct usb_request *req); | 304 | static void gs_free_req(struct usb_ep *ep, struct usb_request *req); |
305 | 305 | ||
306 | static struct gs_req_entry *gs_alloc_req_entry(struct usb_ep *ep, unsigned len, | 306 | static struct gs_req_entry *gs_alloc_req_entry(struct usb_ep *ep, unsigned len, |
307 | unsigned kmalloc_flags); | 307 | gfp_t kmalloc_flags); |
308 | static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req); | 308 | static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req); |
309 | 309 | ||
310 | static int gs_alloc_ports(struct gs_dev *dev, unsigned kmalloc_flags); | 310 | static int gs_alloc_ports(struct gs_dev *dev, gfp_t kmalloc_flags); |
311 | static void gs_free_ports(struct gs_dev *dev); | 311 | static void gs_free_ports(struct gs_dev *dev); |
312 | 312 | ||
313 | /* circular buffer */ | 313 | /* circular buffer */ |
314 | static struct gs_buf *gs_buf_alloc(unsigned int size, unsigned kmalloc_flags); | 314 | static struct gs_buf *gs_buf_alloc(unsigned int size, gfp_t kmalloc_flags); |
315 | static void gs_buf_free(struct gs_buf *gb); | 315 | static void gs_buf_free(struct gs_buf *gb); |
316 | static void gs_buf_clear(struct gs_buf *gb); | 316 | static void gs_buf_clear(struct gs_buf *gb); |
317 | static unsigned int gs_buf_data_avail(struct gs_buf *gb); | 317 | static unsigned int gs_buf_data_avail(struct gs_buf *gb); |
@@ -2091,7 +2091,7 @@ static int gs_build_config_buf(u8 *buf, enum usb_device_speed speed, | |||
2091 | * usb_request or NULL if there is an error. | 2091 | * usb_request or NULL if there is an error. |
2092 | */ | 2092 | */ |
2093 | static struct usb_request * | 2093 | static struct usb_request * |
2094 | gs_alloc_req(struct usb_ep *ep, unsigned int len, unsigned kmalloc_flags) | 2094 | gs_alloc_req(struct usb_ep *ep, unsigned int len, gfp_t kmalloc_flags) |
2095 | { | 2095 | { |
2096 | struct usb_request *req; | 2096 | struct usb_request *req; |
2097 | 2097 | ||
@@ -2132,7 +2132,7 @@ static void gs_free_req(struct usb_ep *ep, struct usb_request *req) | |||
2132 | * endpoint, buffer len, and kmalloc flags. | 2132 | * endpoint, buffer len, and kmalloc flags. |
2133 | */ | 2133 | */ |
2134 | static struct gs_req_entry * | 2134 | static struct gs_req_entry * |
2135 | gs_alloc_req_entry(struct usb_ep *ep, unsigned len, unsigned kmalloc_flags) | 2135 | gs_alloc_req_entry(struct usb_ep *ep, unsigned len, gfp_t kmalloc_flags) |
2136 | { | 2136 | { |
2137 | struct gs_req_entry *req; | 2137 | struct gs_req_entry *req; |
2138 | 2138 | ||
@@ -2173,7 +2173,7 @@ static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req) | |||
2173 | * | 2173 | * |
2174 | * The device lock is normally held when calling this function. | 2174 | * The device lock is normally held when calling this function. |
2175 | */ | 2175 | */ |
2176 | static int gs_alloc_ports(struct gs_dev *dev, unsigned kmalloc_flags) | 2176 | static int gs_alloc_ports(struct gs_dev *dev, gfp_t kmalloc_flags) |
2177 | { | 2177 | { |
2178 | int i; | 2178 | int i; |
2179 | struct gs_port *port; | 2179 | struct gs_port *port; |
@@ -2255,7 +2255,7 @@ static void gs_free_ports(struct gs_dev *dev) | |||
2255 | * | 2255 | * |
2256 | * Allocate a circular buffer and all associated memory. | 2256 | * Allocate a circular buffer and all associated memory. |
2257 | */ | 2257 | */ |
2258 | static struct gs_buf *gs_buf_alloc(unsigned int size, unsigned kmalloc_flags) | 2258 | static struct gs_buf *gs_buf_alloc(unsigned int size, gfp_t kmalloc_flags) |
2259 | { | 2259 | { |
2260 | struct gs_buf *gb; | 2260 | struct gs_buf *gb; |
2261 | 2261 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 6890e773b2a2..ec9c424f1d97 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -612,7 +612,7 @@ static void source_sink_complete (struct usb_ep *ep, struct usb_request *req) | |||
612 | } | 612 | } |
613 | 613 | ||
614 | static struct usb_request * | 614 | static struct usb_request * |
615 | source_sink_start_ep (struct usb_ep *ep, unsigned gfp_flags) | 615 | source_sink_start_ep (struct usb_ep *ep, gfp_t gfp_flags) |
616 | { | 616 | { |
617 | struct usb_request *req; | 617 | struct usb_request *req; |
618 | int status; | 618 | int status; |
@@ -640,7 +640,7 @@ source_sink_start_ep (struct usb_ep *ep, unsigned gfp_flags) | |||
640 | } | 640 | } |
641 | 641 | ||
642 | static int | 642 | static int |
643 | set_source_sink_config (struct zero_dev *dev, unsigned gfp_flags) | 643 | set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags) |
644 | { | 644 | { |
645 | int result = 0; | 645 | int result = 0; |
646 | struct usb_ep *ep; | 646 | struct usb_ep *ep; |
@@ -744,7 +744,7 @@ static void loopback_complete (struct usb_ep *ep, struct usb_request *req) | |||
744 | } | 744 | } |
745 | 745 | ||
746 | static int | 746 | static int |
747 | set_loopback_config (struct zero_dev *dev, unsigned gfp_flags) | 747 | set_loopback_config (struct zero_dev *dev, gfp_t gfp_flags) |
748 | { | 748 | { |
749 | int result = 0; | 749 | int result = 0; |
750 | struct usb_ep *ep; | 750 | struct usb_ep *ep; |
@@ -845,7 +845,7 @@ static void zero_reset_config (struct zero_dev *dev) | |||
845 | * by limiting configuration choices (like the pxa2xx). | 845 | * by limiting configuration choices (like the pxa2xx). |
846 | */ | 846 | */ |
847 | static int | 847 | static int |
848 | zero_set_config (struct zero_dev *dev, unsigned number, unsigned gfp_flags) | 848 | zero_set_config (struct zero_dev *dev, unsigned number, gfp_t gfp_flags) |
849 | { | 849 | { |
850 | int result = 0; | 850 | int result = 0; |
851 | struct usb_gadget *gadget = dev->gadget; | 851 | struct usb_gadget *gadget = dev->gadget; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index b948ffd94f45..f5eb9e7b5b18 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -983,7 +983,7 @@ static int ehci_urb_enqueue ( | |||
983 | struct usb_hcd *hcd, | 983 | struct usb_hcd *hcd, |
984 | struct usb_host_endpoint *ep, | 984 | struct usb_host_endpoint *ep, |
985 | struct urb *urb, | 985 | struct urb *urb, |
986 | unsigned mem_flags | 986 | gfp_t mem_flags |
987 | ) { | 987 | ) { |
988 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 988 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
989 | struct list_head qtd_list; | 989 | struct list_head qtd_list; |
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c index 5c38ad869485..91c2ab43cbcc 100644 --- a/drivers/usb/host/ehci-mem.c +++ b/drivers/usb/host/ehci-mem.c | |||
@@ -45,7 +45,7 @@ static inline void ehci_qtd_init (struct ehci_qtd *qtd, dma_addr_t dma) | |||
45 | INIT_LIST_HEAD (&qtd->qtd_list); | 45 | INIT_LIST_HEAD (&qtd->qtd_list); |
46 | } | 46 | } |
47 | 47 | ||
48 | static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, int flags) | 48 | static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, gfp_t flags) |
49 | { | 49 | { |
50 | struct ehci_qtd *qtd; | 50 | struct ehci_qtd *qtd; |
51 | dma_addr_t dma; | 51 | dma_addr_t dma; |
@@ -79,7 +79,7 @@ static void qh_destroy (struct kref *kref) | |||
79 | dma_pool_free (ehci->qh_pool, qh, qh->qh_dma); | 79 | dma_pool_free (ehci->qh_pool, qh, qh->qh_dma); |
80 | } | 80 | } |
81 | 81 | ||
82 | static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags) | 82 | static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags) |
83 | { | 83 | { |
84 | struct ehci_qh *qh; | 84 | struct ehci_qh *qh; |
85 | dma_addr_t dma; | 85 | dma_addr_t dma; |
@@ -161,7 +161,7 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci) | |||
161 | } | 161 | } |
162 | 162 | ||
163 | /* remember to add cleanup code (above) if you add anything here */ | 163 | /* remember to add cleanup code (above) if you add anything here */ |
164 | static int ehci_mem_init (struct ehci_hcd *ehci, int flags) | 164 | static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags) |
165 | { | 165 | { |
166 | int i; | 166 | int i; |
167 | 167 | ||
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 940d38ca7d91..5bb872c3496d 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -477,7 +477,7 @@ qh_urb_transaction ( | |||
477 | struct ehci_hcd *ehci, | 477 | struct ehci_hcd *ehci, |
478 | struct urb *urb, | 478 | struct urb *urb, |
479 | struct list_head *head, | 479 | struct list_head *head, |
480 | int flags | 480 | gfp_t flags |
481 | ) { | 481 | ) { |
482 | struct ehci_qtd *qtd, *qtd_prev; | 482 | struct ehci_qtd *qtd, *qtd_prev; |
483 | dma_addr_t buf; | 483 | dma_addr_t buf; |
@@ -629,7 +629,7 @@ static struct ehci_qh * | |||
629 | qh_make ( | 629 | qh_make ( |
630 | struct ehci_hcd *ehci, | 630 | struct ehci_hcd *ehci, |
631 | struct urb *urb, | 631 | struct urb *urb, |
632 | int flags | 632 | gfp_t flags |
633 | ) { | 633 | ) { |
634 | struct ehci_qh *qh = ehci_qh_alloc (ehci, flags); | 634 | struct ehci_qh *qh = ehci_qh_alloc (ehci, flags); |
635 | u32 info1 = 0, info2 = 0; | 635 | u32 info1 = 0, info2 = 0; |
@@ -906,7 +906,7 @@ submit_async ( | |||
906 | struct usb_host_endpoint *ep, | 906 | struct usb_host_endpoint *ep, |
907 | struct urb *urb, | 907 | struct urb *urb, |
908 | struct list_head *qtd_list, | 908 | struct list_head *qtd_list, |
909 | unsigned mem_flags | 909 | gfp_t mem_flags |
910 | ) { | 910 | ) { |
911 | struct ehci_qtd *qtd; | 911 | struct ehci_qtd *qtd; |
912 | int epnum; | 912 | int epnum; |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index ccc7300baa6d..f0c8aa1ccd5d 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -589,7 +589,7 @@ static int intr_submit ( | |||
589 | struct usb_host_endpoint *ep, | 589 | struct usb_host_endpoint *ep, |
590 | struct urb *urb, | 590 | struct urb *urb, |
591 | struct list_head *qtd_list, | 591 | struct list_head *qtd_list, |
592 | unsigned mem_flags | 592 | gfp_t mem_flags |
593 | ) { | 593 | ) { |
594 | unsigned epnum; | 594 | unsigned epnum; |
595 | unsigned long flags; | 595 | unsigned long flags; |
@@ -634,7 +634,7 @@ done: | |||
634 | /* ehci_iso_stream ops work with both ITD and SITD */ | 634 | /* ehci_iso_stream ops work with both ITD and SITD */ |
635 | 635 | ||
636 | static struct ehci_iso_stream * | 636 | static struct ehci_iso_stream * |
637 | iso_stream_alloc (unsigned mem_flags) | 637 | iso_stream_alloc (gfp_t mem_flags) |
638 | { | 638 | { |
639 | struct ehci_iso_stream *stream; | 639 | struct ehci_iso_stream *stream; |
640 | 640 | ||
@@ -851,7 +851,7 @@ iso_stream_find (struct ehci_hcd *ehci, struct urb *urb) | |||
851 | /* ehci_iso_sched ops can be ITD-only or SITD-only */ | 851 | /* ehci_iso_sched ops can be ITD-only or SITD-only */ |
852 | 852 | ||
853 | static struct ehci_iso_sched * | 853 | static struct ehci_iso_sched * |
854 | iso_sched_alloc (unsigned packets, unsigned mem_flags) | 854 | iso_sched_alloc (unsigned packets, gfp_t mem_flags) |
855 | { | 855 | { |
856 | struct ehci_iso_sched *iso_sched; | 856 | struct ehci_iso_sched *iso_sched; |
857 | int size = sizeof *iso_sched; | 857 | int size = sizeof *iso_sched; |
@@ -924,7 +924,7 @@ itd_urb_transaction ( | |||
924 | struct ehci_iso_stream *stream, | 924 | struct ehci_iso_stream *stream, |
925 | struct ehci_hcd *ehci, | 925 | struct ehci_hcd *ehci, |
926 | struct urb *urb, | 926 | struct urb *urb, |
927 | unsigned mem_flags | 927 | gfp_t mem_flags |
928 | ) | 928 | ) |
929 | { | 929 | { |
930 | struct ehci_itd *itd; | 930 | struct ehci_itd *itd; |
@@ -1418,7 +1418,7 @@ itd_complete ( | |||
1418 | /*-------------------------------------------------------------------------*/ | 1418 | /*-------------------------------------------------------------------------*/ |
1419 | 1419 | ||
1420 | static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, | 1420 | static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, |
1421 | unsigned mem_flags) | 1421 | gfp_t mem_flags) |
1422 | { | 1422 | { |
1423 | int status = -EINVAL; | 1423 | int status = -EINVAL; |
1424 | unsigned long flags; | 1424 | unsigned long flags; |
@@ -1529,7 +1529,7 @@ sitd_urb_transaction ( | |||
1529 | struct ehci_iso_stream *stream, | 1529 | struct ehci_iso_stream *stream, |
1530 | struct ehci_hcd *ehci, | 1530 | struct ehci_hcd *ehci, |
1531 | struct urb *urb, | 1531 | struct urb *urb, |
1532 | unsigned mem_flags | 1532 | gfp_t mem_flags |
1533 | ) | 1533 | ) |
1534 | { | 1534 | { |
1535 | struct ehci_sitd *sitd; | 1535 | struct ehci_sitd *sitd; |
@@ -1779,7 +1779,7 @@ sitd_complete ( | |||
1779 | 1779 | ||
1780 | 1780 | ||
1781 | static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb, | 1781 | static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb, |
1782 | unsigned mem_flags) | 1782 | gfp_t mem_flags) |
1783 | { | 1783 | { |
1784 | int status = -EINVAL; | 1784 | int status = -EINVAL; |
1785 | unsigned long flags; | 1785 | unsigned long flags; |
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index e142056b0d2c..2548d94fcd72 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c | |||
@@ -694,7 +694,7 @@ static int balance(struct isp116x *isp116x, u16 period, u16 load) | |||
694 | 694 | ||
695 | static int isp116x_urb_enqueue(struct usb_hcd *hcd, | 695 | static int isp116x_urb_enqueue(struct usb_hcd *hcd, |
696 | struct usb_host_endpoint *hep, struct urb *urb, | 696 | struct usb_host_endpoint *hep, struct urb *urb, |
697 | unsigned mem_flags) | 697 | gfp_t mem_flags) |
698 | { | 698 | { |
699 | struct isp116x *isp116x = hcd_to_isp116x(hcd); | 699 | struct isp116x *isp116x = hcd_to_isp116x(hcd); |
700 | struct usb_device *udev = urb->dev; | 700 | struct usb_device *udev = urb->dev; |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 67c1aa5eb1c1..f8da8c7af7c6 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -180,7 +180,7 @@ static int ohci_urb_enqueue ( | |||
180 | struct usb_hcd *hcd, | 180 | struct usb_hcd *hcd, |
181 | struct usb_host_endpoint *ep, | 181 | struct usb_host_endpoint *ep, |
182 | struct urb *urb, | 182 | struct urb *urb, |
183 | unsigned mem_flags | 183 | gfp_t mem_flags |
184 | ) { | 184 | ) { |
185 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 185 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
186 | struct ed *ed; | 186 | struct ed *ed; |
diff --git a/drivers/usb/host/ohci-mem.c b/drivers/usb/host/ohci-mem.c index fd3c4d3714bd..9fb83dfb1eb4 100644 --- a/drivers/usb/host/ohci-mem.c +++ b/drivers/usb/host/ohci-mem.c | |||
@@ -84,7 +84,7 @@ dma_to_td (struct ohci_hcd *hc, dma_addr_t td_dma) | |||
84 | 84 | ||
85 | /* TDs ... */ | 85 | /* TDs ... */ |
86 | static struct td * | 86 | static struct td * |
87 | td_alloc (struct ohci_hcd *hc, unsigned mem_flags) | 87 | td_alloc (struct ohci_hcd *hc, gfp_t mem_flags) |
88 | { | 88 | { |
89 | dma_addr_t dma; | 89 | dma_addr_t dma; |
90 | struct td *td; | 90 | struct td *td; |
@@ -118,7 +118,7 @@ td_free (struct ohci_hcd *hc, struct td *td) | |||
118 | 118 | ||
119 | /* EDs ... */ | 119 | /* EDs ... */ |
120 | static struct ed * | 120 | static struct ed * |
121 | ed_alloc (struct ohci_hcd *hc, unsigned mem_flags) | 121 | ed_alloc (struct ohci_hcd *hc, gfp_t mem_flags) |
122 | { | 122 | { |
123 | dma_addr_t dma; | 123 | dma_addr_t dma; |
124 | struct ed *ed; | 124 | struct ed *ed; |
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index d42a15d10a46..cad858575cea 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -818,7 +818,7 @@ static int sl811h_urb_enqueue( | |||
818 | struct usb_hcd *hcd, | 818 | struct usb_hcd *hcd, |
819 | struct usb_host_endpoint *hep, | 819 | struct usb_host_endpoint *hep, |
820 | struct urb *urb, | 820 | struct urb *urb, |
821 | unsigned mem_flags | 821 | gfp_t mem_flags |
822 | ) { | 822 | ) { |
823 | struct sl811 *sl811 = hcd_to_sl811(hcd); | 823 | struct sl811 *sl811 = hcd_to_sl811(hcd); |
824 | struct usb_device *udev = urb->dev; | 824 | struct usb_device *udev = urb->dev; |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index ea0d168a8c67..4e0fbe2c1a9a 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -1164,7 +1164,7 @@ static struct urb *uhci_find_urb_ep(struct uhci_hcd *uhci, struct urb *urb) | |||
1164 | 1164 | ||
1165 | static int uhci_urb_enqueue(struct usb_hcd *hcd, | 1165 | static int uhci_urb_enqueue(struct usb_hcd *hcd, |
1166 | struct usb_host_endpoint *ep, | 1166 | struct usb_host_endpoint *ep, |
1167 | struct urb *urb, unsigned mem_flags) | 1167 | struct urb *urb, gfp_t mem_flags) |
1168 | { | 1168 | { |
1169 | int ret; | 1169 | int ret; |
1170 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); | 1170 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); |
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 03fb70ef2eb3..0592cb5e6c4d 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -137,7 +137,7 @@ static void async_complete(struct urb *urb, struct pt_regs *ptregs) | |||
137 | 137 | ||
138 | static struct uss720_async_request *submit_async_request(struct parport_uss720_private *priv, | 138 | static struct uss720_async_request *submit_async_request(struct parport_uss720_private *priv, |
139 | __u8 request, __u8 requesttype, __u16 value, __u16 index, | 139 | __u8 request, __u8 requesttype, __u16 value, __u16 index, |
140 | unsigned int mem_flags) | 140 | gfp_t mem_flags) |
141 | { | 141 | { |
142 | struct usb_device *usbdev; | 142 | struct usb_device *usbdev; |
143 | struct uss720_async_request *rq; | 143 | struct uss720_async_request *rq; |
@@ -204,7 +204,7 @@ static unsigned int kill_all_async_requests_priv(struct parport_uss720_private * | |||
204 | 204 | ||
205 | /* --------------------------------------------------------------------- */ | 205 | /* --------------------------------------------------------------------- */ |
206 | 206 | ||
207 | static int get_1284_register(struct parport *pp, unsigned char reg, unsigned char *val, unsigned int mem_flags) | 207 | static int get_1284_register(struct parport *pp, unsigned char reg, unsigned char *val, gfp_t mem_flags) |
208 | { | 208 | { |
209 | struct parport_uss720_private *priv; | 209 | struct parport_uss720_private *priv; |
210 | struct uss720_async_request *rq; | 210 | struct uss720_async_request *rq; |
@@ -238,7 +238,7 @@ static int get_1284_register(struct parport *pp, unsigned char reg, unsigned cha | |||
238 | return -EIO; | 238 | return -EIO; |
239 | } | 239 | } |
240 | 240 | ||
241 | static int set_1284_register(struct parport *pp, unsigned char reg, unsigned char val, unsigned int mem_flags) | 241 | static int set_1284_register(struct parport *pp, unsigned char reg, unsigned char val, gfp_t mem_flags) |
242 | { | 242 | { |
243 | struct parport_uss720_private *priv; | 243 | struct parport_uss720_private *priv; |
244 | struct uss720_async_request *rq; | 244 | struct uss720_async_request *rq; |
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c index 861f00a43750..252a34fbb42c 100644 --- a/drivers/usb/net/asix.c +++ b/drivers/usb/net/asix.c | |||
@@ -753,7 +753,7 @@ static int ax88772_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
753 | } | 753 | } |
754 | 754 | ||
755 | static struct sk_buff *ax88772_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | 755 | static struct sk_buff *ax88772_tx_fixup(struct usbnet *dev, struct sk_buff *skb, |
756 | unsigned flags) | 756 | gfp_t flags) |
757 | { | 757 | { |
758 | int padlen; | 758 | int padlen; |
759 | int headroom = skb_headroom(skb); | 759 | int headroom = skb_headroom(skb); |
diff --git a/drivers/usb/net/gl620a.c b/drivers/usb/net/gl620a.c index c8763ae33c73..c0f263b202a6 100644 --- a/drivers/usb/net/gl620a.c +++ b/drivers/usb/net/gl620a.c | |||
@@ -301,7 +301,7 @@ static int genelink_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
301 | } | 301 | } |
302 | 302 | ||
303 | static struct sk_buff * | 303 | static struct sk_buff * |
304 | genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, unsigned flags) | 304 | genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) |
305 | { | 305 | { |
306 | int padlen; | 306 | int padlen; |
307 | int length = skb->len; | 307 | int length = skb->len; |
diff --git a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c index e04b0ce3611a..c82655d3d448 100644 --- a/drivers/usb/net/kaweth.c +++ b/drivers/usb/net/kaweth.c | |||
@@ -477,13 +477,13 @@ static int kaweth_reset(struct kaweth_device *kaweth) | |||
477 | } | 477 | } |
478 | 478 | ||
479 | static void kaweth_usb_receive(struct urb *, struct pt_regs *regs); | 479 | static void kaweth_usb_receive(struct urb *, struct pt_regs *regs); |
480 | static int kaweth_resubmit_rx_urb(struct kaweth_device *, unsigned); | 480 | static int kaweth_resubmit_rx_urb(struct kaweth_device *, gfp_t); |
481 | 481 | ||
482 | /**************************************************************** | 482 | /**************************************************************** |
483 | int_callback | 483 | int_callback |
484 | *****************************************************************/ | 484 | *****************************************************************/ |
485 | 485 | ||
486 | static void kaweth_resubmit_int_urb(struct kaweth_device *kaweth, int mf) | 486 | static void kaweth_resubmit_int_urb(struct kaweth_device *kaweth, gfp_t mf) |
487 | { | 487 | { |
488 | int status; | 488 | int status; |
489 | 489 | ||
@@ -550,7 +550,7 @@ static void kaweth_resubmit_tl(void *d) | |||
550 | * kaweth_resubmit_rx_urb | 550 | * kaweth_resubmit_rx_urb |
551 | ****************************************************************/ | 551 | ****************************************************************/ |
552 | static int kaweth_resubmit_rx_urb(struct kaweth_device *kaweth, | 552 | static int kaweth_resubmit_rx_urb(struct kaweth_device *kaweth, |
553 | unsigned mem_flags) | 553 | gfp_t mem_flags) |
554 | { | 554 | { |
555 | int result; | 555 | int result; |
556 | 556 | ||
diff --git a/drivers/usb/net/net1080.c b/drivers/usb/net/net1080.c index a4309c4a491b..cee55f8cf64f 100644 --- a/drivers/usb/net/net1080.c +++ b/drivers/usb/net/net1080.c | |||
@@ -500,7 +500,7 @@ static int net1080_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
500 | } | 500 | } |
501 | 501 | ||
502 | static struct sk_buff * | 502 | static struct sk_buff * |
503 | net1080_tx_fixup(struct usbnet *dev, struct sk_buff *skb, unsigned flags) | 503 | net1080_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) |
504 | { | 504 | { |
505 | int padlen; | 505 | int padlen; |
506 | struct sk_buff *skb2; | 506 | struct sk_buff *skb2; |
diff --git a/drivers/usb/net/rndis_host.c b/drivers/usb/net/rndis_host.c index 2ed2e5fb7778..b5a925dc1beb 100644 --- a/drivers/usb/net/rndis_host.c +++ b/drivers/usb/net/rndis_host.c | |||
@@ -517,7 +517,7 @@ static int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
517 | } | 517 | } |
518 | 518 | ||
519 | static struct sk_buff * | 519 | static struct sk_buff * |
520 | rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, unsigned flags) | 520 | rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) |
521 | { | 521 | { |
522 | struct rndis_data_hdr *hdr; | 522 | struct rndis_data_hdr *hdr; |
523 | struct sk_buff *skb2; | 523 | struct sk_buff *skb2; |
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index 6c460918d54f..fce81d738933 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c | |||
@@ -288,7 +288,7 @@ EXPORT_SYMBOL_GPL(usbnet_defer_kevent); | |||
288 | 288 | ||
289 | static void rx_complete (struct urb *urb, struct pt_regs *regs); | 289 | static void rx_complete (struct urb *urb, struct pt_regs *regs); |
290 | 290 | ||
291 | static void rx_submit (struct usbnet *dev, struct urb *urb, unsigned flags) | 291 | static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) |
292 | { | 292 | { |
293 | struct sk_buff *skb; | 293 | struct sk_buff *skb; |
294 | struct skb_data *entry; | 294 | struct skb_data *entry; |
diff --git a/drivers/usb/net/usbnet.h b/drivers/usb/net/usbnet.h index 7aa0abd1a9bd..89fc4958eecf 100644 --- a/drivers/usb/net/usbnet.h +++ b/drivers/usb/net/usbnet.h | |||
@@ -107,7 +107,7 @@ struct driver_info { | |||
107 | 107 | ||
108 | /* fixup tx packet (add framing) */ | 108 | /* fixup tx packet (add framing) */ |
109 | struct sk_buff *(*tx_fixup)(struct usbnet *dev, | 109 | struct sk_buff *(*tx_fixup)(struct usbnet *dev, |
110 | struct sk_buff *skb, unsigned flags); | 110 | struct sk_buff *skb, gfp_t flags); |
111 | 111 | ||
112 | /* for new devices, use the descriptor-reading code instead */ | 112 | /* for new devices, use the descriptor-reading code instead */ |
113 | int in; /* rx endpoint */ | 113 | int in; /* rx endpoint */ |
diff --git a/drivers/usb/net/zaurus.c b/drivers/usb/net/zaurus.c index ee3b892aeabc..5d4b7d55b097 100644 --- a/drivers/usb/net/zaurus.c +++ b/drivers/usb/net/zaurus.c | |||
@@ -62,7 +62,7 @@ | |||
62 | */ | 62 | */ |
63 | 63 | ||
64 | static struct sk_buff * | 64 | static struct sk_buff * |
65 | zaurus_tx_fixup(struct usbnet *dev, struct sk_buff *skb, unsigned flags) | 65 | zaurus_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) |
66 | { | 66 | { |
67 | int padlen; | 67 | int padlen; |
68 | struct sk_buff *skb2; | 68 | struct sk_buff *skb2; |
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c index c4e479ee926a..2f52261c7cc1 100644 --- a/drivers/usb/net/zd1201.c +++ b/drivers/usb/net/zd1201.c | |||
@@ -521,7 +521,7 @@ static int zd1201_setconfig(struct zd1201 *zd, int rid, void *buf, int len, int | |||
521 | int reqlen; | 521 | int reqlen; |
522 | char seq=0; | 522 | char seq=0; |
523 | struct urb *urb; | 523 | struct urb *urb; |
524 | unsigned int gfp_mask = wait ? GFP_NOIO : GFP_ATOMIC; | 524 | gfp_t gfp_mask = wait ? GFP_NOIO : GFP_ATOMIC; |
525 | 525 | ||
526 | len += 4; /* first 4 are for header */ | 526 | len += 4; /* first 4 are for header */ |
527 | 527 | ||
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index 1147b899f007..007c8e9b2b39 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c | |||
@@ -242,6 +242,13 @@ static ssize_t show_virtual(struct class_device *class_device, char *buf) | |||
242 | fb_info->var.yres_virtual); | 242 | fb_info->var.yres_virtual); |
243 | } | 243 | } |
244 | 244 | ||
245 | static ssize_t show_stride(struct class_device *class_device, char *buf) | ||
246 | { | ||
247 | struct fb_info *fb_info = | ||
248 | (struct fb_info *)class_get_devdata(class_device); | ||
249 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->fix.line_length); | ||
250 | } | ||
251 | |||
245 | /* Format for cmap is "%02x%c%4x%4x%4x\n" */ | 252 | /* Format for cmap is "%02x%c%4x%4x%4x\n" */ |
246 | /* %02x entry %c transp %4x red %4x blue %4x green \n */ | 253 | /* %02x entry %c transp %4x red %4x blue %4x green \n */ |
247 | /* 256 rows at 16 chars equals 4096, the normal page size */ | 254 | /* 256 rows at 16 chars equals 4096, the normal page size */ |
@@ -432,6 +439,7 @@ static struct class_device_attribute class_device_attrs[] = { | |||
432 | __ATTR(pan, S_IRUGO|S_IWUSR, show_pan, store_pan), | 439 | __ATTR(pan, S_IRUGO|S_IWUSR, show_pan, store_pan), |
433 | __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual), | 440 | __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual), |
434 | __ATTR(name, S_IRUGO, show_name, NULL), | 441 | __ATTR(name, S_IRUGO, show_name, NULL), |
442 | __ATTR(stride, S_IRUGO, show_stride, NULL), | ||
435 | }; | 443 | }; |
436 | 444 | ||
437 | int fb_init_class_device(struct fb_info *fb_info) | 445 | int fb_init_class_device(struct fb_info *fb_info) |
diff --git a/drivers/video/logo/.gitignore b/drivers/video/logo/.gitignore new file mode 100644 index 000000000000..e48355f538fa --- /dev/null +++ b/drivers/video/logo/.gitignore | |||
@@ -0,0 +1,7 @@ | |||
1 | # | ||
2 | # Generated files | ||
3 | # | ||
4 | *_mono.c | ||
5 | *_vga16.c | ||
6 | *_clut224.c | ||
7 | *_gray256.c | ||
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 1ca80264c7b0..b1243da55fc5 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
@@ -96,14 +96,14 @@ static int vesafb_blank(int blank, struct fb_info *info) | |||
96 | int loop = 10000; | 96 | int loop = 10000; |
97 | u8 seq = 0, crtc17 = 0; | 97 | u8 seq = 0, crtc17 = 0; |
98 | 98 | ||
99 | err = 0; | 99 | if (blank == FB_BLANK_POWERDOWN) { |
100 | |||
101 | if (blank) { | ||
102 | seq = 0x20; | 100 | seq = 0x20; |
103 | crtc17 = 0x00; | 101 | crtc17 = 0x00; |
102 | err = 0; | ||
104 | } else { | 103 | } else { |
105 | seq = 0x00; | 104 | seq = 0x00; |
106 | crtc17 = 0x80; | 105 | crtc17 = 0x80; |
106 | err = (blank == FB_BLANK_UNBLANK) ? 0 : -EINVAL; | ||
107 | } | 107 | } |
108 | 108 | ||
109 | vga_wseq(NULL, 0x00, 0x01); | 109 | vga_wseq(NULL, 0x00, 0x01); |