Changeset cfb79747 in mainline for uspace/drv/nic/ne2k
- Timestamp:
- 2012-02-14T22:06:15Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a31aad1
- Parents:
- 199112e4 (diff), e10d41a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/drv/nic/ne2k
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ne2k/dp8390.c
r199112e4 rcfb79747 59 59 #include <stdio.h> 60 60 #include <libarch/ddi.h> 61 #include <net/packet.h>62 #include <packet_client.h>63 61 #include "dp8390.h" 64 62 … … 76 74 uint8_t status; 77 75 78 /** Pointer to next packet*/76 /** Pointer to next frame */ 79 77 uint8_t next; 80 78 … … 393 391 /* 394 392 * Reset the transmit ring. If we were transmitting a frame, 395 * we pretend that the packetis processed. Higher layers will396 * retransmit if the packetwasn't actually sent.393 * we pretend that the frame is processed. Higher layers will 394 * retransmit if the frame wasn't actually sent. 397 395 */ 398 396 ne2k->sq.dirty = false; … … 448 446 return NULL; 449 447 450 void *buf = packet_suffix(frame->packet, length); 451 bzero(buf, length); 448 bzero(frame->data, length); 452 449 uint8_t last = page + length / DP_PAGE; 453 450 … … 455 452 size_t left = (ne2k->stop_page - page) * DP_PAGE 456 453 - sizeof(recv_header_t); 457 ne2k_download(ne2k, buf, page * DP_PAGE + sizeof(recv_header_t),454 ne2k_download(ne2k, frame->data, page * DP_PAGE + sizeof(recv_header_t), 458 455 left); 459 ne2k_download(ne2k, buf+ left, ne2k->start_page * DP_PAGE,456 ne2k_download(ne2k, frame->data + left, ne2k->start_page * DP_PAGE, 460 457 length - left); 461 458 } else { 462 ne2k_download(ne2k, buf, page * DP_PAGE + sizeof(recv_header_t),459 ne2k_download(ne2k, frame->data, page * DP_PAGE + sizeof(recv_header_t), 463 460 length); 464 461 } … … 541 538 * Update the boundary pointer 542 539 * to the value of the page 543 * prior to the next packetto540 * prior to the next frame to 544 541 * be processed. 545 542 */ … … 584 581 fibril_mutex_lock(&ne2k->sq_mutex); 585 582 if (ne2k->sq.dirty) { 586 /* Prepare the buffer for next packet*/583 /* Prepare the buffer for next frame */ 587 584 ne2k->sq.dirty = false; 588 585 ne2k->sq.size = 0; -
uspace/drv/nic/ne2k/dp8390.h
r199112e4 rcfb79747 264 264 extern void ne2k_send(nic_t *, void *, size_t); 265 265 extern void ne2k_interrupt(nic_t *, uint8_t, uint8_t); 266 extern packet_t *ne2k_alloc_packet(nic_t *, size_t);267 266 268 267 extern void ne2k_set_accept_mcast(ne2k_t *, int); -
uspace/drv/nic/ne2k/ne2k.c
r199112e4 rcfb79747 286 286 /* Note: some frame with previous physical address may slip to NIL here 287 287 * (for a moment the filtering is not exact), but ethernet should be OK with 288 * that. Some packetmay also be lost, but this is not a problem.288 * that. Some frames may also be lost, but this is not a problem. 289 289 */ 290 290 ne2k_set_physical_address((ne2k_t *) nic_get_specific(nic_data), address); … … 363 363 static int ne2k_dev_add(ddf_dev_t *dev) 364 364 { 365 ddf_fun_t *fun; 366 365 367 /* Allocate driver data for the device. */ 366 368 nic_t *nic_data = nic_create_and_bind(dev); … … 396 398 } 397 399 398 rc = nic_ register_as_ddf_fun(nic_data, &ne2k_dev_ops);400 rc = nic_connect_to_services(nic_data); 399 401 if (rc != EOK) { 400 402 ne2k_dev_cleanup(dev); … … 402 404 } 403 405 404 rc = nic_connect_to_services(nic_data);405 if ( rc != EOK) {406 fun = ddf_fun_create(nic_get_ddf_dev(nic_data), fun_exposed, "port0"); 407 if (fun == NULL) { 406 408 ne2k_dev_cleanup(dev); 409 return ENOMEM; 410 } 411 nic_set_ddf_fun(nic_data, fun); 412 fun->ops = &ne2k_dev_ops; 413 fun->driver_data = nic_data; 414 415 rc = ddf_fun_bind(fun); 416 if (rc != EOK) { 417 ddf_fun_destroy(fun); 418 ne2k_dev_cleanup(dev); 419 return rc; 420 } 421 422 rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC); 423 if (rc != EOK) { 424 ddf_fun_unbind(fun); 425 ddf_fun_destroy(fun); 407 426 return rc; 408 427 }
Note:
See TracChangeset
for help on using the changeset viewer.