From 63c9729a1306ee3fed54923f53b20ce769884a81 Mon Sep 17 00:00:00 2001 From: Joe Hershberger Date: Fri, 3 Apr 2015 20:09:46 -0500 Subject: dm: eth: Provide a way for drivers to manage packet buffers Some drivers need a chance to manage their receive buffers after the packet has been handled by the network stack. Add an operation that will allow the driver to be called in that case. Reported-by: Simon Glass Signed-off-by: Joe Hershberger Acked-by: Simon Glass Tested-by: Simon Glass Tested-on: pcduino3 --- net/eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'net') diff --git a/net/eth.c b/net/eth.c index 13b7723bb4..05411f1cec 100644 --- a/net/eth.c +++ b/net/eth.c @@ -344,7 +344,9 @@ int eth_rx(void) ret = eth_get_ops(current)->recv(current, &packet); if (ret > 0) net_process_received_packet(packet, ret); - else + if (ret >= 0 && eth_get_ops(current)->free_pkt) + eth_get_ops(current)->free_pkt(current, packet, ret); + if (ret <= 0) break; } if (ret == -EAGAIN) -- cgit v1.2.3