summaryrefslogtreecommitdiff
path: root/net/eth.c
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2015-03-22 17:09:12 -0500
committerSimon Glass <sjg@chromium.org>2015-04-18 11:11:12 -0600
commit17591405a7b932ba0a66107645f5ff5f6f36da75 (patch)
tree3fbe0d78285e324191251d90bd551cdef0435cb8 /net/eth.c
parent2a504df00652ede0316e2cf872ab065090617a8e (diff)
downloadu-boot-imx-17591405a7b932ba0a66107645f5ff5f6f36da75.zip
u-boot-imx-17591405a7b932ba0a66107645f5ff5f6f36da75.tar.gz
u-boot-imx-17591405a7b932ba0a66107645f5ff5f6f36da75.tar.bz2
dm: eth: Pass the packet pointer as a parameter to recv
Stop forcing drivers to call net_process_received_packet() - formerly called NetReceive(). Now the uclass will handle calling the driver for each packet until the driver errors or has nothing to return. The uclass will then pass the good packets off to the network stack by calling net_process_received_packet(). Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'net/eth.c')
-rw-r--r--net/eth.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/net/eth.c b/net/eth.c
index 1abf027..058c55a 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -259,6 +259,9 @@ int eth_send(void *packet, int length)
int eth_rx(void)
{
struct udevice *current;
+ uchar *packet;
+ int ret;
+ int i;
current = eth_get_dev();
if (!current)
@@ -267,7 +270,17 @@ int eth_rx(void)
if (!device_active(current))
return -EINVAL;
- return eth_get_ops(current)->recv(current);
+ /* Process up to 32 packets at one time */
+ for (i = 0; i < 32; i++) {
+ ret = eth_get_ops(current)->recv(current, &packet);
+ if (ret > 0)
+ net_process_received_packet(packet, ret);
+ else
+ break;
+ }
+ if (ret == -EAGAIN)
+ ret = 0;
+ return ret;
}
static int eth_write_hwaddr(struct udevice *dev)