> -----Original Message-----
> From: qemu-devel-bounces+chen.zhang=intel....@nongnu.org <qemu-
> devel-bounces+chen.zhang=intel....@nongnu.org> On Behalf Of Akihiko
> Odaki
> Sent: Monday, October 30, 2023 1:12 PM
> Cc: qemu-devel@nongnu.org; Yuri Benditovich
> <yuri.benditov...@daynix.com>; Andrew Melnychenko
> <and...@daynix.com>; Michael S . Tsirkin <m...@redhat.com>; Jason Wang
> <jasow...@redhat.com>; Akihiko Odaki <akihiko.od...@daynix.com>
> Subject: [PATCH v6 05/21] tap: Remove tap_receive()
>
> The receive member of NetClientInfo is only for legacy clients and the
> receive_iov member is always used when it is set.
Under normal circumstances we still need to maintain compatibility.
It seems that there is no need to remove the tap_receive here.
You just need to optimize the tap_receive to call the tap_receive_iov.
In the history, we can see a large number of devices still keep this interface,
For example, e1000_receive can directly call the e1000_receive_iov.
Thanks
Chen
>
> Signed-off-by: Akihiko Odaki <akihiko.od...@daynix.com>
> ---
> net/tap.c | 36 ------------------------------------
> 1 file changed, 36 deletions(-)
>
> diff --git a/net/tap.c b/net/tap.c
> index d54e90f184..ab4e5a0e91 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -133,41 +133,6 @@ static ssize_t tap_receive_iov(NetClientState *nc,
> const struct iovec *iov,
> return tap_write_packet(s, iovp, iovcnt); }
>
> -static ssize_t tap_receive_raw(NetClientState *nc, const uint8_t *buf, size_t
> size) -{
> - TAPState *s = DO_UPCAST(TAPState, nc, nc);
> - struct iovec iov[2];
> - int iovcnt = 0;
> - struct virtio_net_hdr_mrg_rxbuf hdr = { };
> -
> - if (s->host_vnet_hdr_len) {
> - iov[iovcnt].iov_base = &hdr;
> - iov[iovcnt].iov_len = s->host_vnet_hdr_len;
> - iovcnt++;
> - }
> -
> - iov[iovcnt].iov_base = (char *)buf;
> - iov[iovcnt].iov_len = size;
> - iovcnt++;
> -
> - return tap_write_packet(s, iov, iovcnt);
> -}
> -
> -static ssize_t tap_receive(NetClientState *nc, const uint8_t *buf, size_t
> size) -{
> - TAPState *s = DO_UPCAST(TAPState, nc, nc);
> - struct iovec iov[1];
> -
> - if (s->host_vnet_hdr_len && !s->using_vnet_hdr) {
> - return tap_receive_raw(nc, buf, size);
> - }
> -
> - iov[0].iov_base = (char *)buf;
> - iov[0].iov_len = size;
> -
> - return tap_write_packet(s, iov, 1);
> -}
> -
> #ifndef __sun__
> ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen) { @@ -366,7
> +331,6 @@ int tap_get_fd(NetClientState *nc) static NetClientInfo
> net_tap_info = {
> .type = NET_CLIENT_DRIVER_TAP,
> .size = sizeof(TAPState),
> - .receive = tap_receive,
> .receive_iov = tap_receive_iov,
> .poll = tap_poll,
> .cleanup = tap_cleanup,
> --
> 2.42.0
>