qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 4/9] virtio: Teach virtio-net about DO_UPCAST
Date: Thu, 18 Mar 2010 09:29:50 +0200	[thread overview]
Message-ID: <20100318072950.GF16973@redhat.com> (raw)
In-Reply-To: <3514a89848cd2a07ac988d819210c245ddea1094.1268765204.git.quintela@redhat.com>

On Tue, Mar 16, 2010 at 07:51:20PM +0100, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Sent a replacement patch for this.

> ---
>  hw/virtio-net.c |   21 ++++++++-------------
>  1 files changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
> index 5c0093e..c0537c8 100644
> --- a/hw/virtio-net.c
> +++ b/hw/virtio-net.c
> @@ -61,14 +61,9 @@ typedef struct VirtIONet
>   * - we could suppress RX interrupt if we were so inclined.
>   */
> 
> -static VirtIONet *to_virtio_net(VirtIODevice *vdev)
> -{
> -    return (VirtIONet *)vdev;
> -}
> -
>  static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
>  {
> -    VirtIONet *n = to_virtio_net(vdev);
> +    VirtIONet *n = DO_UPCAST(VirtIONet, vdev, vdev);
>      struct virtio_net_config netcfg;
> 
>      netcfg.status = n->status;
> @@ -78,7 +73,7 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
> 
>  static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config)
>  {
> -    VirtIONet *n = to_virtio_net(vdev);
> +    VirtIONet *n = DO_UPCAST(VirtIONet, vdev, vdev);
>      struct virtio_net_config netcfg;
> 
>      memcpy(&netcfg, config, sizeof(netcfg));
> @@ -105,7 +100,7 @@ static void virtio_net_set_link_status(VLANClientState *nc)
> 
>  static void virtio_net_reset(VirtIODevice *vdev)
>  {
> -    VirtIONet *n = to_virtio_net(vdev);
> +    VirtIONet *n = DO_UPCAST(VirtIONet, vdev, vdev);
> 
>      /* Reset back to compatibility mode */
>      n->promisc = 1;
> @@ -149,7 +144,7 @@ static int peer_has_ufo(VirtIONet *n)
> 
>  static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features)
>  {
> -    VirtIONet *n = to_virtio_net(vdev);
> +    VirtIONet *n = DO_UPCAST(VirtIONet, vdev, vdev);
> 
>      features |= (1 << VIRTIO_NET_F_MAC);
> 
> @@ -192,7 +187,7 @@ static uint32_t virtio_net_bad_features(VirtIODevice *vdev)
> 
>  static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)
>  {
> -    VirtIONet *n = to_virtio_net(vdev);
> +    VirtIONet *n = DO_UPCAST(VirtIONet, vdev, vdev);
> 
>      n->mergeable_rx_bufs = !!(features & (1 << VIRTIO_NET_F_MRG_RXBUF));
> 
> @@ -315,7 +310,7 @@ static int virtio_net_handle_vlan_table(VirtIONet *n, uint8_t cmd,
> 
>  static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
>  {
> -    VirtIONet *n = to_virtio_net(vdev);
> +    VirtIONet *n = DO_UPCAST(VirtIONet, vdev, vdev);
>      struct virtio_net_ctrl_hdr ctrl;
>      virtio_net_ctrl_ack status = VIRTIO_NET_ERR;
>      VirtQueueElement elem;
> @@ -353,7 +348,7 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
> 
>  static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
>  {
> -    VirtIONet *n = to_virtio_net(vdev);
> +    VirtIONet *n = DO_UPCAST(VirtIONet, vdev, vdev);
> 
>      qemu_flush_queued_packets(&n->nic->nc);
> 
> @@ -665,7 +660,7 @@ static void virtio_net_flush_tx(VirtIONet *n, VirtQueue *vq)
> 
>  static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq)
>  {
> -    VirtIONet *n = to_virtio_net(vdev);
> +    VirtIONet *n = DO_UPCAST(VirtIONet, vdev, vdev);
> 
>      if (n->tx_timer_active) {
>          virtio_queue_set_notification(vq, 1);
> -- 
> 1.6.6.1
> 
> 

  reply	other threads:[~2010-03-18  7:33 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16 18:51 [Qemu-devel] [PATCH 0/9] Virtio cleanups Juan Quintela
2010-03-16 18:51 ` [Qemu-devel] [PATCH 1/9] qemu/pci: document msix_entries_nr field Juan Quintela
2010-03-16 18:51 ` [Qemu-devel] [PATCH 2/9] virtio: Teach virtio-balloon about DO_UPCAST Juan Quintela
2010-03-18  7:29   ` [Qemu-devel] " Michael S. Tsirkin
2010-03-16 18:51 ` [Qemu-devel] [PATCH 3/9] virtio: Teach virtio-blk " Juan Quintela
2010-03-18  7:29   ` [Qemu-devel] " Michael S. Tsirkin
2010-03-16 18:51 ` [Qemu-devel] [PATCH 4/9] virtio: Teach virtio-net " Juan Quintela
2010-03-18  7:29   ` Michael S. Tsirkin [this message]
2010-03-16 18:51 ` [Qemu-devel] [PATCH 5/9] virtio: Use DO_UPCAST instead of a cast Juan Quintela
2010-03-18  7:30   ` [Qemu-devel] " Michael S. Tsirkin
2010-03-16 18:51 ` [Qemu-devel] [PATCH 6/9] virtio-pci: Remove duplicate test Juan Quintela
2010-03-18  7:25   ` [Qemu-devel] " Michael S. Tsirkin
2010-03-18  8:26     ` Juan Quintela
2010-03-18  8:47       ` Michael S. Tsirkin
2010-03-18  8:59         ` Juan Quintela
2010-03-18  9:11           ` Michael S. Tsirkin
2010-03-18 11:40             ` Juan Quintela
2010-03-18 13:24               ` Michael S. Tsirkin
2010-03-18 13:47                 ` Juan Quintela
2010-03-16 18:51 ` [Qemu-devel] [PATCH 7/9] QLIST: Introduce QLIST_COPY_HEAD Juan Quintela
2010-03-16 18:51 ` [Qemu-devel] [PATCH 8/9] virtio-blk: change rq type to VirtIOBlockReq Juan Quintela
2010-03-18  7:27   ` [Qemu-devel] " Michael S. Tsirkin
2010-03-16 18:51 ` [Qemu-devel] [PATCH 9/9] virtio-blk: use QLIST for the list of requests Juan Quintela
2010-03-18  6:40 ` [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups Michael S. Tsirkin
2010-03-18  7:36   ` Juan Quintela
2010-03-18  7:42     ` Michael S. Tsirkin
2010-03-18  8:36       ` Juan Quintela
2010-03-18  9:07         ` Michael S. Tsirkin
2010-03-18 11:53           ` Juan Quintela
2010-03-18 12:33             ` Michael S. Tsirkin
2010-03-18 13:43               ` Juan Quintela
2010-03-18 13:47                 ` Michael S. Tsirkin
2010-03-18 14:21                   ` Juan Quintela
2010-03-18 17:13                     ` Michael S. Tsirkin
2010-03-19  1:41             ` Jamie Lokier
2010-03-21 14:31               ` Michael S. Tsirkin
2010-03-21 18:11                 ` Jamie Lokier
2010-03-21 19:16                   ` Michael S. Tsirkin
2010-03-22  1:06                     ` Juan Quintela
2010-03-22  2:51                       ` Anthony Liguori
2010-03-22 13:30                         ` Paul Brook
2010-03-22 14:49                           ` Anthony Liguori
2010-03-22 14:50                             ` Michael S. Tsirkin
2010-03-22 15:03                               ` Anthony Liguori
2010-03-22 15:17                                 ` Michael S. Tsirkin
2010-03-22 15:50                                   ` Anthony Liguori
2010-03-22 16:16                                     ` Paul Brook
2010-03-22 18:48                                       ` Anthony Liguori
2010-03-22 21:00                                         ` Paul Brook
2010-03-23  1:13                                           ` Anthony Liguori
2010-03-22 15:51                                   ` Paul Brook
2010-03-22 17:19                                     ` Michael S. Tsirkin
2010-03-22 22:16                                       ` Juan Quintela
2010-03-23  0:49                                         ` Paul Brook
2010-03-23  1:16                                           ` Anthony Liguori
2010-03-23 10:47                                             ` Michael S. Tsirkin
2010-03-23 11:11                                               ` Gerd Hoffmann
2010-03-23 11:40                                               ` Paul Brook
2010-03-23 11:58                                                 ` Michael S. Tsirkin
2010-03-23 12:32                                                   ` Juan Quintela
2010-03-21 19:57                   ` Michael S. Tsirkin
2010-03-22  1:13                     ` Juan Quintela
2010-03-22  8:37                       ` Michael S. Tsirkin
2010-03-18 10:05         ` Michael S. Tsirkin
2010-03-18 15:43     ` Gerd Hoffmann
2010-03-18 16:20       ` Juan Quintela
2010-03-18 16:36         ` Gerd Hoffmann
2010-03-18 17:08           ` Juan Quintela
2010-03-18 17:21             ` Michael S. Tsirkin
2010-03-18 19:37               ` Juan Quintela
2010-03-18 20:07           ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100318072950.GF16973@redhat.com \
    --to=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).