net/ixgbe/base: update annotations
[dpdk.git] / lib / librte_vhost / virtio_net.c
index 38796b3..cd304f6 100644 (file)
@@ -159,6 +159,11 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr)
                net_hdr->gso_size = m_buf->tso_segsz;
                net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len
                                        + m_buf->l4_len;
+       } else if (m_buf->ol_flags & PKT_TX_UDP_SEG) {
+               net_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP;
+               net_hdr->gso_size = m_buf->tso_segsz;
+               net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len +
+                       m_buf->l4_len;
        } else {
                ASSIGN_UNLESS_EQUAL(net_hdr->gso_type, 0);
                ASSIGN_UNLESS_EQUAL(net_hdr->gso_size, 0);
@@ -379,13 +384,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
                offsetof(struct vring_used, idx),
                sizeof(vq->used->idx));
 
-       /* flush used->idx update before we read avail->flags. */
-       rte_mb();
-
-       /* Kick the guest if necessary. */
-       if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
-                       && (vq->callfd >= 0))
-               eventfd_write(vq->callfd, (eventfd_t)1);
+       vhost_vring_call(vq);
 out:
        if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
                vhost_user_iotlb_rd_unlock(vq);
@@ -672,14 +671,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id,
 
        if (likely(vq->shadow_used_idx)) {
                flush_shadow_used_ring(dev, vq);
-
-               /* flush used->idx update before we read avail->flags. */
-               rte_mb();
-
-               /* Kick the guest if necessary. */
-               if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
-                               && (vq->callfd >= 0))
-                       eventfd_write(vq->callfd, (eventfd_t)1);
+               vhost_vring_call(vq);
        }
 
 out:
@@ -805,6 +797,11 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m)
                        m->tso_segsz = hdr->gso_size;
                        m->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;
                        break;
+               case VIRTIO_NET_HDR_GSO_UDP:
+                       m->ol_flags |= PKT_TX_UDP_SEG;
+                       m->tso_segsz = hdr->gso_size;
+                       m->l4_len = sizeof(struct udp_hdr);
+                       break;
                default:
                        RTE_LOG(WARNING, VHOST_DATA,
                                "unsupported gso type %u.\n", hdr->gso_type);
@@ -1078,11 +1075,7 @@ update_used_idx(struct virtio_net *dev, struct vhost_virtqueue *vq,
        vq->used->idx += count;
        vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx),
                        sizeof(vq->used->idx));
-
-       /* Kick guest if required. */
-       if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
-                       && (vq->callfd >= 0))
-               eventfd_write(vq->callfd, (eventfd_t)1);
+       vhost_vring_call(vq);
 }
 
 static __rte_always_inline struct zcopy_mbuf *