Changeset 948911d in mainline for uspace/drv/nic/ne2k/dp8390.c


Ignore:
Timestamp:
2012-01-24T02:27:43Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
230385c
Parents:
8afeb04 (diff), 2df6f6fe (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.
Message:

Mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ne2k/dp8390.c

    r8afeb04 r948911d  
    5959#include <stdio.h>
    6060#include <libarch/ddi.h>
    61 #include <net/packet.h>
    62 #include <packet_client.h>
    6361#include "dp8390.h"
    6462
     
    7674        uint8_t status;
    7775       
    78         /** Pointer to next packet */
     76        /** Pointer to next frame */
    7977        uint8_t next;
    8078       
     
    393391        /*
    394392         * Reset the transmit ring. If we were transmitting a frame,
    395          * we pretend that the packet is processed. Higher layers will
    396          * retransmit if the packet wasn't actually sent.
     393         * we pretend that the frame is processed. Higher layers will
     394         * retransmit if the frame wasn't actually sent.
    397395         */
    398396        ne2k->sq.dirty = false;
     
    404402 *
    405403 * @param[in,out] ne2k   Network interface structure.
    406  * @param[in]     packet Frame to be sent.
    407  *
    408  */
    409 void ne2k_send(nic_t *nic_data, packet_t *packet)
     404 * @param[in]     data   Pointer to frame data
     405 * @param[in]     size   Frame size in bytes
     406 *
     407 */
     408void ne2k_send(nic_t *nic_data, void *data, size_t size)
    410409{
    411410        ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
     
    419418                fibril_condvar_wait(&ne2k->sq_cv, &ne2k->sq_mutex);
    420419        }
    421         void *buf = packet_get_data(packet);
    422         size_t size = packet_get_data_length(packet);
    423420       
    424421        if ((size < ETH_MIN_PACK_SIZE) || (size > ETH_MAX_PACK_SIZE_TAGGED)) {
     
    428425
    429426        /* Upload the frame to the ethernet card */
    430         ne2k_upload(ne2k, buf, ne2k->sq.page * DP_PAGE, size);
     427        ne2k_upload(ne2k, data, ne2k->sq.page * DP_PAGE, size);
    431428        ne2k->sq.dirty = true;
    432429        ne2k->sq.size = size;
     
    438435        pio_write_8(ne2k->port + DP_CR, CR_TXP | CR_STA);
    439436        fibril_mutex_unlock(&ne2k->sq_mutex);
    440 
    441         /* Relase packet */
    442         nic_release_packet(nic_data, packet);
    443437}
    444438
     
    452446                return NULL;
    453447       
    454         void *buf = packet_suffix(frame->packet, length);
    455         bzero(buf, length);
     448        bzero(frame->data, length);
    456449        uint8_t last = page + length / DP_PAGE;
    457450       
     
    459452                size_t left = (ne2k->stop_page - page) * DP_PAGE
    460453                    - sizeof(recv_header_t);
    461                 ne2k_download(ne2k, buf, page * DP_PAGE + sizeof(recv_header_t),
     454                ne2k_download(ne2k, frame->data, page * DP_PAGE + sizeof(recv_header_t),
    462455                    left);
    463                 ne2k_download(ne2k, buf + left, ne2k->start_page * DP_PAGE,
     456                ne2k_download(ne2k, frame->data + left, ne2k->start_page * DP_PAGE,
    464457                    length - left);
    465458        } else {
    466                 ne2k_download(ne2k, buf, page * DP_PAGE + sizeof(recv_header_t),
     459                ne2k_download(ne2k, frame->data, page * DP_PAGE + sizeof(recv_header_t),
    467460                    length);
    468461        }
     
    545538                 * Update the boundary pointer
    546539                 * to the value of the page
    547                  * prior to the next packet to
     540                 * prior to the next frame to
    548541                 * be processed.
    549542                 */
     
    588581                fibril_mutex_lock(&ne2k->sq_mutex);
    589582                if (ne2k->sq.dirty) {
    590                         /* Prepare the buffer for next packet */
     583                        /* Prepare the buffer for next frame */
    591584                        ne2k->sq.dirty = false;
    592585                        ne2k->sq.size = 0;
Note: See TracChangeset for help on using the changeset viewer.