All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] virtio-net: share receive_*() and add_recvbuf_*() with virtio-vsock
@ 2019-07-10 15:37 Stefano Garzarella
  2019-07-11  7:37 ` Jason Wang
  2019-07-11  7:37 ` Jason Wang
  0 siblings, 2 replies; 26+ messages in thread
From: Stefano Garzarella @ 2019-07-10 15:37 UTC (permalink / raw)
  To: Michael S. Tsirkin, Jason Wang, Stefan Hajnoczi; +Cc: virtualization, netdev

Hi,
as Jason suggested some months ago, I looked better at the virtio-net driver to
understand if we can reuse some parts also in the virtio-vsock driver, since we
have similar challenges (mergeable buffers, page allocation, small
packets, etc.).

Initially, I would add the skbuff in the virtio-vsock in order to re-use
receive_*() functions.
Then I would move receive_[small, big, mergeable]() and
add_recvbuf_[small, big, mergeable]() outside of virtio-net driver, in order to
call them also from virtio-vsock. I need to do some refactoring (e.g. leave the
XDP part on the virtio-net driver), but I think it is feasible.

The idea is to create a virtio-skb.[h,c] where put these functions and a new
object where stores some attributes needed (e.g. hdr_len ) and status (e.g.
some fields of struct receive_queue). This is an idea of virtio-skb.h that
I have in mind:
    struct virtskb;

    struct sk_buff *virtskb_receive_small(struct virtskb *vs, ...);
    struct sk_buff *virtskb_receive_big(struct virtskb *vs, ...);
    struct sk_buff *virtskb_receive_mergeable(struct virtskb *vs, ...);

    int virtskb_add_recvbuf_small(struct virtskb*vs, ...);
    int virtskb_add_recvbuf_big(struct virtskb *vs, ...);
    int virtskb_add_recvbuf_mergeable(struct virtskb *vs, ...);

For the Guest->Host path it should be easier, so maybe I can add a
"virtskb_send(struct virtskb *vs, struct sk_buff *skb)" with a part of the code
of xmit_skb().

Let me know if you have in mind better names or if I should put these function
in another place.

I would like to leave the control part completely separate, so, for example,
the two drivers will negotiate the features independently and they will call
the right virtskb_receive_*() function based on the negotiation.

I already started to work on it, but before to do more steps and send an RFC
patch, I would like to hear your opinion.
Do you think that makes sense?
Do you see any issue or a better solution?

Thanks in advance,
Stefano

^ permalink raw reply	[flat|nested] 26+ messages in thread
* [RFC] virtio-net: share receive_*() and add_recvbuf_*() with virtio-vsock
@ 2019-07-10 15:37 Stefano Garzarella
  0 siblings, 0 replies; 26+ messages in thread
From: Stefano Garzarella @ 2019-07-10 15:37 UTC (permalink / raw)
  To: Michael S. Tsirkin, Jason Wang, Stefan Hajnoczi; +Cc: netdev, virtualization

Hi,
as Jason suggested some months ago, I looked better at the virtio-net driver to
understand if we can reuse some parts also in the virtio-vsock driver, since we
have similar challenges (mergeable buffers, page allocation, small
packets, etc.).

Initially, I would add the skbuff in the virtio-vsock in order to re-use
receive_*() functions.
Then I would move receive_[small, big, mergeable]() and
add_recvbuf_[small, big, mergeable]() outside of virtio-net driver, in order to
call them also from virtio-vsock. I need to do some refactoring (e.g. leave the
XDP part on the virtio-net driver), but I think it is feasible.

The idea is to create a virtio-skb.[h,c] where put these functions and a new
object where stores some attributes needed (e.g. hdr_len ) and status (e.g.
some fields of struct receive_queue). This is an idea of virtio-skb.h that
I have in mind:
    struct virtskb;

    struct sk_buff *virtskb_receive_small(struct virtskb *vs, ...);
    struct sk_buff *virtskb_receive_big(struct virtskb *vs, ...);
    struct sk_buff *virtskb_receive_mergeable(struct virtskb *vs, ...);

    int virtskb_add_recvbuf_small(struct virtskb*vs, ...);
    int virtskb_add_recvbuf_big(struct virtskb *vs, ...);
    int virtskb_add_recvbuf_mergeable(struct virtskb *vs, ...);

For the Guest->Host path it should be easier, so maybe I can add a
"virtskb_send(struct virtskb *vs, struct sk_buff *skb)" with a part of the code
of xmit_skb().

Let me know if you have in mind better names or if I should put these function
in another place.

I would like to leave the control part completely separate, so, for example,
the two drivers will negotiate the features independently and they will call
the right virtskb_receive_*() function based on the negotiation.

I already started to work on it, but before to do more steps and send an RFC
patch, I would like to hear your opinion.
Do you think that makes sense?
Do you see any issue or a better solution?

Thanks in advance,
Stefano

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2019-07-16 10:22 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10 15:37 [RFC] virtio-net: share receive_*() and add_recvbuf_*() with virtio-vsock Stefano Garzarella
2019-07-11  7:37 ` Jason Wang
2019-07-11 11:41   ` Stefano Garzarella
2019-07-11 19:52     ` Michael S. Tsirkin
2019-07-11 19:52     ` Michael S. Tsirkin
2019-07-12 10:00       ` Stefano Garzarella
2019-07-12 10:00       ` Stefano Garzarella
2019-07-12 10:14         ` Jason Wang
2019-07-12 10:14         ` Jason Wang
2019-07-15  7:44           ` Stefano Garzarella
2019-07-15  9:16             ` Jason Wang
2019-07-15  9:16             ` Jason Wang
2019-07-15 10:42               ` Stefano Garzarella
2019-07-15 10:42                 ` Stefano Garzarella
2019-07-15 17:50             ` Michael S. Tsirkin
2019-07-15 17:50             ` Michael S. Tsirkin
2019-07-16  9:40               ` Stefano Garzarella
2019-07-16  9:40               ` Stefano Garzarella
2019-07-16 10:01                 ` Michael S. Tsirkin
2019-07-16 10:01                 ` Michael S. Tsirkin
2019-07-16 10:22                   ` Stefano Garzarella
2019-07-16 10:22                     ` Stefano Garzarella
2019-07-15  7:44           ` Stefano Garzarella
2019-07-11 11:41   ` Stefano Garzarella
2019-07-11  7:37 ` Jason Wang
2019-07-10 15:37 Stefano Garzarella

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.