Changes in uspace/drv/nic/rtl8139/driver.c [f0b74b2:6d8455d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/rtl8139/driver.c
rf0b74b2 r6d8455d 389 389 static int rtl8139_on_activated(nic_t *nic_data); 390 390 static int rtl8139_on_stopped(nic_t *nic_data); 391 static void rtl8139_ write_packet(nic_t *nic_data, packet_t *packet);391 static void rtl8139_send_frame(nic_t *nic_data, void *data, size_t size); 392 392 393 393 /** Check if the transmit buffer is busy */ … … 399 399 * 400 400 * @param nic_data The nic driver data structure 401 * @param packet The packet to send 401 * @param data Frame data 402 * @param size Frame size in bytes 402 403 * 403 404 * @return EOK if succeed, error code in the case of error 404 405 */ 405 static void rtl8139_ write_packet(nic_t *nic_data, packet_t *packet)406 static void rtl8139_send_frame(nic_t *nic_data, void *data, size_t size) 406 407 { 407 408 assert(nic_data); … … 409 410 rtl8139_t *rtl8139 = nic_get_specific(nic_data); 410 411 assert(rtl8139); 411 ddf_msg(LVL_DEBUG, "Sending packet"); 412 413 /* Get the packet data and check if it can be send */ 414 size_t packet_length = packet_get_data_length(packet); 415 void *packet_data = packet_get_data(packet); 416 417 assert(packet_data); 418 419 if ((packet_length > RTL8139_PACKET_MAX_LENGTH) || !packet_data) { 420 ddf_msg(LVL_ERROR, "Write packet length error: data %p, length %z", 421 packet_data, packet_length); 412 ddf_msg(LVL_DEBUG, "Sending frame"); 413 414 if (size > RTL8139_PACKET_MAX_LENGTH) { 415 ddf_msg(LVL_ERROR, "Send frame: frame too long, %zu bytes", 416 size); 422 417 nic_report_send_error(rtl8139->nic_data, NIC_SEC_OTHER, 1); 423 418 goto err_size; 424 419 } 425 420 426 assert(( packet_length & TSD_SIZE_MASK) == packet_length);421 assert((size & TSD_SIZE_MASK) == size); 427 422 428 423 /* Lock transmitter structure for obtaining next buffer */ … … 449 444 assert(!rtl8139_tbuf_busy(tsd)); 450 445 451 /* Write packetdata to the buffer, set the size to TSD and clear OWN bit */452 memcpy(buf_addr, packet_data, packet_length);446 /* Write frame data to the buffer, set the size to TSD and clear OWN bit */ 447 memcpy(buf_addr, data, size); 453 448 454 449 /* Set size of the data to send */ 455 450 uint32_t tsd_value = pio_read_32(tsd); 456 tsd_value = rtl8139_tsd_set_size(tsd_value, packet_length);451 tsd_value = rtl8139_tsd_set_size(tsd_value, size); 457 452 pio_write_32(tsd, tsd_value); 458 453 … … 462 457 tsd_value &= ~(uint32_t)TSD_OWN; 463 458 pio_write_32(tsd, tsd_value); 464 nic_release_packet(nic_data, packet);465 459 return; 466 460 467 461 err_busy_no_inc: 468 462 err_size: 469 nic_release_packet(nic_data, packet);470 463 return; 471 464 }; … … 1022 1015 rtl8139->nic_data = nic_data; 1023 1016 nic_set_specific(nic_data, rtl8139); 1024 nic_set_ write_packet_handler(nic_data, rtl8139_write_packet);1017 nic_set_send_frame_handler(nic_data, rtl8139_send_frame); 1025 1018 nic_set_state_change_handlers(nic_data, 1026 1019 rtl8139_on_activated, NULL, rtl8139_on_stopped);
Note:
See TracChangeset
for help on using the changeset viewer.