[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <551D1F86.8050200@fokus.fraunhofer.de>
Date: Thu, 2 Apr 2015 12:52:54 +0200
From: Mathias Kretschmer <mathias.kretschmer@...us.fraunhofer.de>
To: <netdev@...r.kernel.org>
Subject: af_packet / TX_RING not fully non-blocking (w/ MSG_DONTWAIT)
Dear all,
we have encountered a problem where the send(MSG_DONTWAIT) call on a TX_RING is not
fully non-blocking in cases where the device's sndBuf is full (i.e. we are trying to
write faster than the device can handle).
This is on a WLAN radio (so it's not that hard to achieve :).
Comparing the TX_RING send() handler to the regular send() handler, the difference
seems to be in the sock_alloc_send_skb() call where, the regular handler passes a
(flags & MSG_DONTWAIT), while the TX_RING handler always passes a 0 (block).
The attached patch changes this behavior by
a) also passing (flags & MSG_DONTWAIT)
b) adjusting the return code so that -ENOBUFS is returned if no frame could be sent
or to return the number of bytes sent, if frame(s) could be sent within this call.
The proposed modification works fine for us and has been tested extensively with
WLAN and Ethernet device.
Feel free to apply this patch if you agree with this solution.
Of course, we're also open to other solutions / proposals / ideas.
Cheers,
Mathias
--
Dr. Mathias Kretschmer, Head of Competence Center
Fraunhofer FOKUS Network Research
A Schloss Birlinghoven, 53754 Sankt Augustin, Germany
T +49-2241-14-3466, F +49-2241-14-1050
E mathias.kretschmer@...us.fraunhofer.de
W http://www.fokus.fraunhofer.de/en/net
View attachment "005-af_packet_no_block_tx.patch" of type "text/x-patch" (1039 bytes)
Powered by blists - more mailing lists