public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Use memset(0) instead of setting cb_mode explicitly
@ 2008-01-03 15:57 Anthony Liguori
       [not found] ` <11993758341994-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony Liguori @ 2008-01-03 15:57 UTC (permalink / raw)
  To: virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Anthony Liguori

hrtimer's only have a cb_mode if CONFIG_HIGH_RES_TIMER is enabled.  This patch
memset()s the tx_timer structure to 0 which has the same effect as setting
cb_mode to HRTIMER_CB_SOFTIRQ without requiring CONFIG_HIGH_RES_TIMER to be
set.  This seems to be what other drivers do.

Signed-off-by: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 47e4fce..d11a670 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -434,9 +434,9 @@ static int virtnet_probe(struct virtio_device *vdev)
 	netif_napi_add(dev, &vi->napi, virtnet_poll, napi_weight);
 	vi->dev = dev;
 	vi->vdev = vdev;
+	memset(&vi->tx_timer, 0, sizeof(vi->tx_timer));
 	hrtimer_init(&vi->tx_timer, CLOCK_REALTIME, HRTIMER_MODE_REL);
 	vi->tx_timer.function = kick_xmit;
-	vi->tx_timer.cb_mode = HRTIMER_CB_SOFTIRQ;
 	vi->out_max = -1U;
 
 	tasklet_init(&vi->xmit_free, xmit_free, (unsigned long)vi);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* Re: [PATCH] Use memset(0) instead of setting cb_mode explicitly
       [not found] ` <11993758341994-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2008-01-04  3:03   ` Rusty Russell
  0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2008-01-04  3:03 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On Friday 04 January 2008 02:57:14 Anthony Liguori wrote:
> hrtimer's only have a cb_mode if CONFIG_HIGH_RES_TIMER is enabled.  This
> patch memset()s the tx_timer structure to 0 which has the same effect as
> setting cb_mode to HRTIMER_CB_SOFTIRQ without requiring
> CONFIG_HIGH_RES_TIMER to be set.  This seems to be what other drivers do.

Thanks, applied.

Rusty.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

end of thread, other threads:[~2008-01-04  3:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-03 15:57 [PATCH] Use memset(0) instead of setting cb_mode explicitly Anthony Liguori
     [not found] ` <11993758341994-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-01-04  3:03   ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox