Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nic/include/nic.h

    r77a69ea r00d7e1b  
    4242#include <ddf/driver.h>
    4343#include <device/hw_res_parsed.h>
     44#include <net/packet.h>
    4445#include <ops/nic.h>
    45 
    46 #define DEVICE_CATEGORY_NIC "nic"
    4746
    4847struct nic;
     
    6261
    6362/**
    64  * Simple structure for sending lists of frames.
     63 * Simple structure for sending the allocated frames (packets) in a list.
    6564 */
    6665typedef struct {
    6766        link_t link;
    68         void *data;
    69         size_t size;
     67        packet_t *packet;
    7068} nic_frame_t;
    7169
     
    7371
    7472/**
    75  * Handler for writing frame data to the NIC device.
    76  * The function is responsible for releasing the frame.
     73 * Handler for writing packet data to the NIC device.
     74 * The function is responsible for releasing the packet.
    7775 * It does not return anything, if some error is detected the function just
    7876 * silently fails (logging on debug level is suggested).
    7977 *
    8078 * @param nic_data
    81  * @param data          Pointer to frame data
    82  * @param size          Size of frame data in bytes
    83  */
    84 typedef void (*send_frame_handler)(nic_t *, void *, size_t);
     79 * @param packet        Pointer to the packet to be sent
     80 */
     81typedef void (*write_packet_handler)(nic_t *, packet_t *);
    8582/**
    8683 * The handler for transitions between driver states.
     
    160157 * @return ENOTSUP      If this filter cannot work on this NIC (e.g. the NIC
    161158 *                                      cannot run in promiscuous node or the limit of WOL
    162  *                                      frames' specifications was reached).
     159 *                                      packets' specifications was reached).
    163160 * @return ELIMIT       If this filter must implemented in HW but currently the
    164161 *                                      limit of these HW filters was reached.
     
    206203/* Functions called in add_device */
    207204extern int nic_connect_to_services(nic_t *);
     205extern int nic_register_as_ddf_fun(nic_t *, ddf_dev_ops_t *);
    208206extern int nic_get_resources(nic_t *, hw_res_list_parsed_t *);
    209207extern void nic_set_specific(nic_t *, void *);
    210 extern void nic_set_send_frame_handler(nic_t *, send_frame_handler);
     208extern void nic_set_write_packet_handler(nic_t *, write_packet_handler);
    211209extern void nic_set_state_change_handlers(nic_t *,
    212210        state_change_handler, state_change_handler, state_change_handler);
     
    220218        poll_mode_change_handler, poll_request_handler);
    221219
     220/* Functions called in device_added */
     221extern int nic_ready(nic_t *);
     222
    222223/* General driver functions */
    223224extern ddf_dev_t *nic_get_ddf_dev(nic_t *);
    224225extern ddf_fun_t *nic_get_ddf_fun(nic_t *);
    225 extern void nic_set_ddf_fun(nic_t *, ddf_fun_t *);
    226226extern nic_t *nic_get_from_ddf_dev(ddf_dev_t *);
    227227extern nic_t *nic_get_from_ddf_fun(ddf_fun_t *);
     
    232232extern int nic_report_poll_mode(nic_t *, nic_poll_mode_t, struct timeval *);
    233233extern void nic_query_address(nic_t *, nic_address_t *);
    234 extern void nic_received_noneth_frame(nic_t *, void *, size_t);
     234extern void nic_received_packet(nic_t *, packet_t *);
     235extern void nic_received_noneth_packet(nic_t *, packet_t *);
    235236extern void nic_received_frame(nic_t *, nic_frame_t *);
    236237extern void nic_received_frame_list(nic_t *, nic_frame_list_t *);
     
    246247extern void nic_report_collisions(nic_t *, unsigned);
    247248
    248 /* Frame / frame list allocation and deallocation */
     249/* Packet / frame / frame list allocation and deallocation */
     250extern packet_t *nic_alloc_packet(nic_t *, size_t);
     251extern void nic_release_packet(nic_t *, packet_t *);
    249252extern nic_frame_t *nic_alloc_frame(nic_t *, size_t);
    250253extern nic_frame_list_t *nic_alloc_frame_list(void);
     
    271274extern void nic_sw_period_stop(nic_t *);
    272275
     276/* Packet DMA lock */
     277extern void * nic_dma_lock_packet(packet_t * packet);
     278extern void nic_dma_unlock_packet(packet_t * packet);
     279
    273280#endif // __NIC_H__
    274281
Note: See TracChangeset for help on using the changeset viewer.