Upper layer functions are called by drivers to deliver received packets or transmission completion status back up into the network stack.
These functions are defined by the hardware independent upper layers of the networking driver support. They are present to hide the interfaces to the actual networking stack so that the hardware drivers may be used by different network stack implementations without change.
These functions require a pointer to a struct eth_drv_sc which describes the interface at a logical level. It is assumed that the low level hardware driver will keep track of this pointer so it may be passed “up” as appropriate.
void (sc->funs->eth_drv->init)( struct eth_drv_sc *sc, unsigned char *enaddr) |
void (sc->funs->eth_drv->tx_done)( struct eth_drv_sc *sc, unsigned long key, int status) |
key
value must be one of the keys provided to
HRDWR_send()
above. The value status
should be non-zero
(details currently undefined) to indicate that an error occurred during the
transmission, and zero if all was well.It should be called from the deliver function (see the Section called Deliver function) or poll function (see the Section called Poll function).
void (sc->funs->eth_drv->recv)(struct eth_drv_sc *sc, int len) |
len
has
arrived at the interface.
The callback
HRDWR_recv()
function
described above will be used to actually unload the data from the
interface into buffers used by the device independent layers.It should be called from the deliver function (see the Section called Deliver function) or poll function (see the Section called Poll function).