mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-07-23 07:12:25 +00:00
Introduce new eth_receive routine
The purpose of this routine is receiving a single network frame, outside of U-Boot's NetLoop(). Exporting it to standalone programs that run on top of U-Boot will let them utilise networking facilities. For sending a raw frame the already existing eth_send() can be used. The direct consumer of this routine is the newly introduced API layer for external applications (enabled with CONFIG_API). Signed-off-by: Rafal Jaworowski <raj@semihalf.com> Signed-off-by: Piotr Kruszynski <ppk@semihalf.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
This commit is contained in:
parent
5c740711f0
commit
f85b607105
3 changed files with 71 additions and 0 deletions
10
net/net.c
10
net/net.c
|
@ -137,6 +137,9 @@ uchar NetBcastAddr[6] = /* Ethernet bcast address */
|
|||
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
uchar NetEtherNullAddr[6] =
|
||||
{ 0, 0, 0, 0, 0, 0 };
|
||||
#ifdef CONFIG_API
|
||||
void (*push_packet)(volatile void *, int len) = 0;
|
||||
#endif
|
||||
#if defined(CONFIG_CMD_CDP)
|
||||
uchar NetCDPAddr[6] = /* Ethernet bcast address */
|
||||
{ 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc };
|
||||
|
@ -1161,6 +1164,13 @@ NetReceive(volatile uchar * inpkt, int len)
|
|||
if (len < ETHER_HDR_SIZE)
|
||||
return;
|
||||
|
||||
#ifdef CONFIG_API
|
||||
if (push_packet) {
|
||||
(*push_packet)(inpkt, len);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CMD_CDP)
|
||||
/* keep track if packet is CDP */
|
||||
iscdp = memcmp(et->et_dest, NetCDPAddr, 6) == 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue