Skip to content

Commit 9af8f10

Browse files
Arseny Krasnovmstsirkin
authored andcommitted
virtio/vsock: rename 'EOR' to 'EOM' bit.
This current implemented bit is used to mark end of messages ('EOM' - end of message), not records('EOR' - end of record). Also rename 'record' to 'message' in implementation as it is different things. Signed-off-by: Arseny Krasnov <[email protected]> Reviewed-by: Stefano Garzarella <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 694a111 commit 9af8f10

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

drivers/vhost/vsock.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,15 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
178178
* small rx buffers, headers of packets in rx queue are
179179
* created dynamically and are initialized with header
180180
* of current packet(except length). But in case of
181-
* SOCK_SEQPACKET, we also must clear record delimeter
182-
* bit(VIRTIO_VSOCK_SEQ_EOR). Otherwise, instead of one
183-
* packet with delimeter(which marks end of record),
181+
* SOCK_SEQPACKET, we also must clear message delimeter
182+
* bit(VIRTIO_VSOCK_SEQ_EOM). Otherwise, instead of one
183+
* packet with delimeter(which marks end of message),
184184
* there will be sequence of packets with delimeter
185185
* bit set. After initialized header will be copied to
186186
* rx buffer, this bit will be restored.
187187
*/
188-
if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR) {
189-
pkt->hdr.flags &= ~cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR);
188+
if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM) {
189+
pkt->hdr.flags &= ~cpu_to_le32(VIRTIO_VSOCK_SEQ_EOM);
190190
restore_flag = true;
191191
}
192192
}
@@ -225,7 +225,7 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
225225
*/
226226
if (pkt->off < pkt->len) {
227227
if (restore_flag)
228-
pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR);
228+
pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOM);
229229

230230
/* We are queueing the same virtio_vsock_pkt to handle
231231
* the remaining bytes, and we want to deliver it

include/uapi/linux/virtio_vsock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ enum virtio_vsock_shutdown {
9797

9898
/* VIRTIO_VSOCK_OP_RW flags values */
9999
enum virtio_vsock_rw {
100-
VIRTIO_VSOCK_SEQ_EOR = 1,
100+
VIRTIO_VSOCK_SEQ_EOM = 1,
101101
};
102102

103103
#endif /* _UAPI_LINUX_VIRTIO_VSOCK_H */

net/vmw_vsock/virtio_transport_common.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info,
7777

7878
if (msg_data_left(info->msg) == 0 &&
7979
info->type == VIRTIO_VSOCK_TYPE_SEQPACKET)
80-
pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR);
80+
pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOM);
8181
}
8282

8383
trace_virtio_transport_alloc_pkt(src_cid, src_port,
@@ -457,7 +457,7 @@ static int virtio_transport_seqpacket_do_dequeue(struct vsock_sock *vsk,
457457
dequeued_len += pkt_len;
458458
}
459459

460-
if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR) {
460+
if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM) {
461461
msg_ready = true;
462462
vvs->msg_count--;
463463
}
@@ -1029,7 +1029,7 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk,
10291029
goto out;
10301030
}
10311031

1032-
if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR)
1032+
if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM)
10331033
vvs->msg_count++;
10341034

10351035
/* Try to copy small packets into the buffer of last packet queued,
@@ -1044,12 +1044,12 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk,
10441044

10451045
/* If there is space in the last packet queued, we copy the
10461046
* new packet in its buffer. We avoid this if the last packet
1047-
* queued has VIRTIO_VSOCK_SEQ_EOR set, because this is
1048-
* delimiter of SEQPACKET record, so 'pkt' is the first packet
1049-
* of a new record.
1047+
* queued has VIRTIO_VSOCK_SEQ_EOM set, because this is
1048+
* delimiter of SEQPACKET message, so 'pkt' is the first packet
1049+
* of a new message.
10501050
*/
10511051
if ((pkt->len <= last_pkt->buf_len - last_pkt->len) &&
1052-
!(le32_to_cpu(last_pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR)) {
1052+
!(le32_to_cpu(last_pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM)) {
10531053
memcpy(last_pkt->buf + last_pkt->len, pkt->buf,
10541054
pkt->len);
10551055
last_pkt->len += pkt->len;

0 commit comments

Comments
 (0)