netdev: Send ofpbuf directly to netdev.
[sliver-openvswitch.git] / lib / netdev-linux.c
index 2aa674a..5d7bfa1 100644 (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