2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

netdev: Send ofpbuf directly to netdev.

DPDK netdev need to access ofpbuf while sending buffer. Following
patch changes netdev_send accordingly.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
This commit is contained in:
Pravin
2014-03-20 10:56:51 -07:00
committed by Pravin B Shelar
parent df1e5a3bc7
commit 40d26f04b2
7 changed files with 37 additions and 18 deletions

View File

@@ -1054,8 +1054,11 @@ netdev_linux_rx_drain(struct netdev_rx *rx_)
* The kernel maintains a packet transmission queue, so the caller is not
* expected to do additional queuing of packets. */
static int
netdev_linux_send(struct netdev *netdev_, const void *data, size_t size)
netdev_linux_send(struct netdev *netdev_, struct ofpbuf *pkt, bool may_steal)
{
const void *data = pkt->data;
size_t size = pkt->size;
for (;;) {
ssize_t retval;
@@ -1106,6 +1109,10 @@ netdev_linux_send(struct netdev *netdev_, const void *data, size_t size)
retval = write(netdev->tap_fd, data, size);
}
if (may_steal) {
ofpbuf_delete(pkt);
}
if (retval < 0) {
/* The Linux AF_PACKET implementation never blocks waiting for room
* for packets, instead returning ENOBUFS. Translate this into