Skip to contentSkip to conversation

vsock/virtio: remove unnecessary call to `virtio_transport_get_ops`

PATCH Superseded Luigi Leonardi 5 participants 7 messages Apr 7 – Apr 8

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vsock/virtio: remove unnecessary call to `virtio_transport_get_ops`

virtio_transport_send_pkt_info gets all the transport information from the parameter t_ops. There is no need to call virtio_transport_get_ops().

Remove it.

Fixes 581512a6dc93 ("vsock/virtio: MSG_ZEROCOPY flag support")

---
I marked this as net-next material, but honsetly I'm not sure if I should have targeted net. It's not a bug after all, it's just a cleanup.

---
 net/vmw_vsock/virtio_transport_common.c | 2 --
 1 file changed, 2 deletions(-)
net/vmw_vsock/virtio_transport_common.c +0 -2
index 8a9fb23c6e85..a152a9e208d0 100644
@@ -60,8 +60,6 @@ static bool virtio_transport_can_zcopy(const struct virtio_transport *t_ops,
 		return false;
 
 	/* Check that transport can send data in zerocopy mode. */
-	t_ops = virtio_transport_get_ops(info->vsk);
-
 	if (t_ops->can_msgzerocopy) {
 		int pages_to_send = iov_iter_npages(iov_iter, MAX_SKB_FRAGS);
 

---
base-commit: bfe62a454542cfad3379f6ef5680b125f41e20f4
change-id: 20260407-remove_parameter-f61a3e40cf90

Best regards,

Signature · 1 line
Luigi Leonardi <[email protected]>
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Luigi Leonardi

virtio_transport_send_pkt_info gets all the transport information from the parameter t_ops. There is no need to call virtio_transport_get_ops().

Remove it.

Fixes 581512a6dc93 ("vsock/virtio: MSG_ZEROCOPY flag support")

but I think we should drop the Fixes tag.

Quoted 28 lines

---
I marked this as net-next material, but honsetly I'm not sure if I should have targeted net. It's not a bug after all, it's just a cleanup.

---
 net/vmw_vsock/virtio_transport_common.c | 2 --
 1 file changed, 2 deletions(-)
net/vmw_vsock/virtio_transport_common.c +0 -3
index 8a9fb23c6e85..a152a9e208d0 100644
@@ -60,8 +60,6 @@ static bool virtio_transport_can_zcopy(const struct virtio_transport *t_ops,
 		return false;
 
 	/* Check that transport can send data in zerocopy mode. */
-	t_ops = virtio_transport_get_ops(info->vsk);
-
 	if (t_ops->can_msgzerocopy) {
 		int pages_to_send = iov_iter_npages(iov_iter, MAX_SKB_FRAGS);
 
 
---

base-commit: bfe62a454542cfad3379f6ef5680b125f41e20f4
change-id: 20260407-remove_parameter-f61a3e40cf90

Best regards,

Signature · 1 line
Luigi Leonardi <[email protected]>
#2 lore raw
Quoted 5 lines · Michael S. Tsirkin
Quoted 4 lines · Luigi Leonardi

virtio_transport_send_pkt_info gets all the transport information from the parameter t_ops. There is no need to call virtio_transport_get_ops().

Quoted 8 lines
Quoted 4 lines

Remove it.

Fixes 581512a6dc93 ("vsock/virtio: MSG_ZEROCOPY flag support")

but I think we should drop the Fixes tag.

ok, should I send a v2 without the tag?

Thanks,
Luigi

Acked-by on v1 1/1
#4 lore raw
In reply to Luigi Leonardi
Quoted 3 lines · Luigi Leonardi

virtio_transport_send_pkt_info gets all the transport information from the parameter t_ops. There is no need to call virtio_transport_get_ops().

Hm, one more suggestion, but not in this patch: may be we can also remove 'struct vsock_sock *vsk' argument from 'virtio_transport_send_pkt_info()', because it is also included in 'virtio_vsock_pkt_info *info' ?

Thanks

Quoted 30 lines

Remove it.

Fixes 581512a6dc93 ("vsock/virtio: MSG_ZEROCOPY flag support")

---
I marked this as net-next material, but honsetly I'm not sure if I should have targeted net. It's not a bug after all, it's just a cleanup.

---
 net/vmw_vsock/virtio_transport_common.c | 2 --
 1 file changed, 2 deletions(-)
net/vmw_vsock/virtio_transport_common.c +0 -3
index 8a9fb23c6e85..a152a9e208d0 100644
@@ -60,8 +60,6 @@ static bool virtio_transport_can_zcopy(const struct virtio_transport *t_ops,
 		return false;
 
 	/* Check that transport can send data in zerocopy mode. */
-	t_ops = virtio_transport_get_ops(info->vsk);
-
 	if (t_ops->can_msgzerocopy) {
 		int pages_to_send = iov_iter_npages(iov_iter, MAX_SKB_FRAGS);
 
 
---

base-commit: bfe62a454542cfad3379f6ef5680b125f41e20f4
change-id: 20260407-remove_parameter-f61a3e40cf90

Quoted 1 line

Best regards,

#5 lore raw
Quoted 11 lines · Arseniy Krasnov
Quoted 3 lines · Luigi Leonardi

virtio_transport_send_pkt_info gets all the transport information from the parameter t_ops. There is no need to call virtio_transport_get_ops().

Hm, one more suggestion, but not in this patch: may be we can also remove 'struct vsock_sock *vsk' argument from 'virtio_transport_send_pkt_info()', because it is also included in 'virtio_vsock_pkt_info *info' ?

Yep, good catch!

Thanks,
Luigi

#6 lore raw
In reply to Luigi Leonardi
Quoted 11 lines · Luigi Leonardi

virtio_transport_send_pkt_info gets all the transport information from the parameter t_ops. There is no need to call virtio_transport_get_ops().

Remove it.

Fixes 581512a6dc93 ("vsock/virtio: MSG_ZEROCOPY flag support")

---
I marked this as net-next material, but honsetly I'm not sure if I should have targeted net. It's not a bug after all, it's just a cleanup.

The patch LGTM, but as Michael and Jakub pointed out, better to remove Fixes tag if this is not a bug fix.

Thanks,
Stefano

Quoted 26 lines

---
net/vmw_vsock/virtio_transport_common.c | 2 --

1 file changed, 2 deletions(-)
net/vmw_vsock/virtio_transport_common.c +0 -3
index 8a9fb23c6e85..a152a9e208d0 100644
@@ -60,8 +60,6 @@ static bool virtio_transport_can_zcopy(const struct virtio_transport *t_ops,
 		return false;
 
 	/* Check that transport can send data in zerocopy mode. */
-	t_ops = virtio_transport_get_ops(info->vsk);
-
 	if (t_ops->can_msgzerocopy) {
 		int pages_to_send = iov_iter_npages(iov_iter, MAX_SKB_FRAGS);
 
 
---

base-commit: bfe62a454542cfad3379f6ef5680b125f41e20f4
change-id: 20260407-remove_parameter-f61a3e40cf90

Best regards,

Signature · 1 line
Luigi Leonardi <[email protected]>