da8fb057e5
The current read from network is working from up to down - we have some protocol needing the data from the network, so we build the buffer space for that protocol, add the extra space for headers and pass this buffer down to be filled by nif get call in hope, we have guessed the incoming packet size right. Amazingly enough this approach mostly does work, but not always... So, this update does work from down to up - we allocate buffer (based on MTU or frame size info), fill it up, and pass on for upper layers. The obvious problem is that when we should free the buffer - if at all. In the current implementation the upper layer will free the packet on error or when the packet is no longer needed. While working on the issue, the additional issue did pop up - the bios implementation does not have generic get/put interface but is using pxe udpsend/udpreceive instead. So the udp calls are gone and undi interface is implemented instead. Which in turn means slight other changes as we do not need to have duplicated pxe implementation and can just use dev_net. To align packet content, the actual read from nic is using shifted buffer by ETHER_ALIGN (2). Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10232
66 lines
1.5 KiB
C
66 lines
1.5 KiB
C
/* $NetBSD: netif.h,v 1.4 1995/09/14 23:45:30 pk Exp $ */
|
|
|
|
/* $FreeBSD$ */
|
|
|
|
#ifndef __SYS_LIBNETBOOT_NETIF_H
|
|
#define __SYS_LIBNETBOOT_NETIF_H
|
|
#include "iodesc.h"
|
|
|
|
struct netif_driver {
|
|
const char *netif_bname;
|
|
int (*netif_match)(struct netif *, void *);
|
|
int (*netif_probe)(struct netif *, void *);
|
|
void (*netif_init)(struct iodesc *, void *);
|
|
ssize_t (*netif_get)(struct iodesc *, void **, time_t);
|
|
ssize_t (*netif_put)(struct iodesc *, void *, size_t);
|
|
void (*netif_end)(struct netif *);
|
|
struct netif_dif *netif_ifs;
|
|
int netif_nifs;
|
|
};
|
|
|
|
struct netif_dif {
|
|
int dif_unit;
|
|
int dif_nsel;
|
|
struct netif_stats *dif_stats;
|
|
void *dif_private;
|
|
/* the following fields are used internally by the netif layer */
|
|
u_long dif_used;
|
|
};
|
|
|
|
struct netif_stats {
|
|
int collisions;
|
|
int collision_error;
|
|
int missed;
|
|
int sent;
|
|
int received;
|
|
int deferred;
|
|
int overflow;
|
|
};
|
|
|
|
struct netif {
|
|
struct netif_driver *nif_driver;
|
|
int nif_unit;
|
|
int nif_sel;
|
|
void *nif_devdata;
|
|
};
|
|
|
|
extern struct netif_driver *netif_drivers[]; /* machdep */
|
|
extern int n_netif_drivers;
|
|
|
|
extern int netif_debug;
|
|
|
|
void netif_init(void);
|
|
struct netif *netif_select(void *);
|
|
int netif_probe(struct netif *, void *);
|
|
void netif_attach(struct netif *, struct iodesc *, void *);
|
|
void netif_detach(struct netif *);
|
|
ssize_t netif_get(struct iodesc *, void **, time_t);
|
|
ssize_t netif_put(struct iodesc *, void *, size_t);
|
|
|
|
int netif_open(void *);
|
|
int netif_close(int);
|
|
|
|
struct iodesc *socktodesc(int);
|
|
|
|
#endif /* __SYS_LIBNETBOOT_NETIF_H */
|