Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[sfrench/cifs-2.6.git] / net / vmw_vsock / virtio_transport_common.c
index 081e7ae93cb19cbd4fa8b54bc4fce5f368f08c32..59ee1be5a6dd3631155d4fe47b5f9fca7d0fa716 100644 (file)
@@ -76,8 +76,12 @@ virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info,
                        goto out;
 
                if (msg_data_left(info->msg) == 0 &&
-                   info->type == VIRTIO_VSOCK_TYPE_SEQPACKET)
-                       pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR);
+                   info->type == VIRTIO_VSOCK_TYPE_SEQPACKET) {
+                       pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOM);
+
+                       if (info->msg->msg_flags & MSG_EOR)
+                               pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR);
+               }
        }
 
        trace_virtio_transport_alloc_pkt(src_cid, src_port,
@@ -457,9 +461,12 @@ static int virtio_transport_seqpacket_do_dequeue(struct vsock_sock *vsk,
                                dequeued_len += pkt_len;
                }
 
-               if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR) {
+               if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM) {
                        msg_ready = true;
                        vvs->msg_count--;
+
+                       if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR)
+                               msg->msg_flags |= MSG_EOR;
                }
 
                virtio_transport_dec_rx_pkt(vvs, pkt);
@@ -1029,7 +1036,7 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk,
                goto out;
        }
 
-       if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR)
+       if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM)
                vvs->msg_count++;
 
        /* Try to copy small packets into the buffer of last packet queued,
@@ -1044,12 +1051,12 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk,
 
                /* If there is space in the last packet queued, we copy the
                 * new packet in its buffer. We avoid this if the last packet
-                * queued has VIRTIO_VSOCK_SEQ_EOR set, because this is
-                * delimiter of SEQPACKET record, so 'pkt' is the first packet
-                * of a new record.
+                * queued has VIRTIO_VSOCK_SEQ_EOM set, because this is
+                * delimiter of SEQPACKET message, so 'pkt' is the first packet
+                * of a new message.
                 */
                if ((pkt->len <= last_pkt->buf_len - last_pkt->len) &&
-                   !(le32_to_cpu(last_pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR)) {
+                   !(le32_to_cpu(last_pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM)) {
                        memcpy(last_pkt->buf + last_pkt->len, pkt->buf,
                               pkt->len);
                        last_pkt->len += pkt->len;