2011-04-07 09:44:11 +02:00
|
|
|
#ifndef __LWIP_DRIVER_H_
|
|
|
|
#define __LWIP_DRIVER_H_
|
|
|
|
|
|
|
|
#include <minix/endpoint.h>
|
|
|
|
#include <minix/ds.h>
|
|
|
|
|
|
|
|
#include <lwip/pbuf.h>
|
|
|
|
|
|
|
|
#define NIC_NAME_LEN 6
|
|
|
|
#define DRV_NAME_LEN DS_MAX_KEYLEN
|
|
|
|
|
|
|
|
#define TX_IOVEC_NUM 16 /* something the drivers assume */
|
|
|
|
|
|
|
|
struct packet_q {
|
|
|
|
struct packet_q * next;
|
2013-04-11 22:37:30 +02:00
|
|
|
unsigned int buf_len;
|
2011-04-07 09:44:11 +02:00
|
|
|
char buf[];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DRV_IDLE 0
|
|
|
|
#define DRV_SENDING 1
|
|
|
|
#define DRV_RECEIVING 2
|
|
|
|
|
|
|
|
struct nic {
|
2013-04-11 22:37:30 +02:00
|
|
|
unsigned int flags;
|
2011-04-07 09:44:11 +02:00
|
|
|
char name[NIC_NAME_LEN];
|
|
|
|
char drv_name[DRV_NAME_LEN];
|
|
|
|
endpoint_t drv_ep;
|
|
|
|
int is_default;
|
|
|
|
int state;
|
|
|
|
cp_grant_id_t rx_iogrant;
|
|
|
|
iovec_s_t rx_iovec[1];
|
|
|
|
struct pbuf * rx_pbuf;
|
|
|
|
cp_grant_id_t tx_iogrant;
|
|
|
|
iovec_s_t tx_iovec[TX_IOVEC_NUM];
|
|
|
|
struct packet_q * tx_head;
|
|
|
|
struct packet_q * tx_tail;
|
|
|
|
void * tx_buffer;
|
|
|
|
struct netif netif;
|
2013-04-11 22:37:30 +02:00
|
|
|
unsigned int max_pkt_sz;
|
|
|
|
unsigned int min_pkt_sz;
|
2011-04-07 09:44:11 +02:00
|
|
|
struct socket * raw_socket;
|
|
|
|
};
|
|
|
|
|
|
|
|
int driver_tx_enqueue(struct nic * nic, struct pbuf * pbuf);
|
|
|
|
void driver_tx_dequeue(struct nic * nic);
|
|
|
|
struct packet_q * driver_tx_head(struct nic * nic);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Transmit the next packet in the TX queue of this device. Returns 1 if
|
|
|
|
* success, 0 otherwise.
|
|
|
|
*/
|
|
|
|
int driver_tx(struct nic * nic);
|
|
|
|
int raw_socket_input(struct pbuf * pbuf, struct nic * nic);
|
|
|
|
|
|
|
|
#endif /* __LWIP_DRIVER_H_ */
|