[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] make protocol specific usage of shared sring explicit
I don't think protocol specific data't really belongs in this header but since it is already there and we seem to be stuck with it lets at least make the users explicit lest people get caught out by future new fields moving the pad field around. This is the kernel portion of this change. The Xen portion was sent separately. There is no dependency between the two. I was unable to find the netfront portion of the smartpoll code in the merge branches. Looks like it is in the xen/netfront branch but not merged anywhere. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx> Cc: Daniel Stodden <daniel.stodden@xxxxxxxxxx> Cc: Dongxiao Xu <dongxiao.xu@xxxxxxxxx> --- drivers/xen/blktap/ring.c | 4 ++-- drivers/xen/blktap/sysfs.c | 3 ++- drivers/xen/netback/netback.c | 13 ++++++------- include/xen/interface/io/ring.h | 12 ++++++++++-- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/xen/blktap/ring.c b/drivers/xen/blktap/ring.c index b49c478..d7d0c79 100644 --- a/drivers/xen/blktap/ring.c +++ b/drivers/xen/blktap/ring.c @@ -335,7 +335,7 @@ blktap_ring_set_message(struct blktap *tap, int msg) struct blktap_ring *ring = &tap->ring; if (ring->ring.sring) - ring->ring.sring->pad[0] = msg; + ring->ring.sring->private.tapif_user.msg = msg; } static int @@ -400,7 +400,7 @@ static unsigned int blktap_ring_poll(struct file *filp, poll_table *wait) up_read(¤t->mm->mmap_sem); if (work || - ring->ring.sring->pad[0]) + ring->ring.sring->private.tapif_user.msg) return POLLIN | POLLRDNORM; return 0; diff --git a/drivers/xen/blktap/sysfs.c b/drivers/xen/blktap/sysfs.c index 49f5e67..53f3b95 100644 --- a/drivers/xen/blktap/sysfs.c +++ b/drivers/xen/blktap/sysfs.c @@ -97,6 +97,7 @@ blktap_sysfs_remove_device(struct device *dev, const char *buf, size_t size) { struct blktap *tap = (struct blktap *)dev_get_drvdata(dev); + struct blktap_ring *ring = &tap->ring; if (!tap->ring.dev) return size; @@ -105,7 +106,7 @@ blktap_sysfs_remove_device(struct device *dev, return -EBUSY; BTDBG("sending tapdisk close message\n"); - tap->ring.ring.sring->pad[0] = BLKTAP2_RING_MESSAGE_CLOSE; + ring->sring->private.tapif_user.msg = BLKTAP2_RING_MESSAGE_CLOSE; blktap_ring_kick_user(tap); wait_event_interruptible(tap->wq, !test_bit(BLKTAP_CONTROL, &tap->dev_inuse)); diff --git a/drivers/xen/netback/netback.c b/drivers/xen/netback/netback.c index 9a7ada2..29b60c8 100644 --- a/drivers/xen/netback/netback.c +++ b/drivers/xen/netback/netback.c @@ -729,11 +729,10 @@ static void net_rx_action(unsigned long data) * netfront_smartpoll_active indicates whether * netfront timer is active. */ - if ((netif->smart_poll == 1)) { - if (!(netif->rx.sring->netfront_smartpoll_active)) { - notify_remote_via_irq(irq); - netif->rx.sring->netfront_smartpoll_active = 1; - } + if ((netif->smart_poll == 1) && + !(netif->rx.sring->private.netif.smartpoll_active)) { + notify_remote_via_irq(irq); + netif->rx.sring->private.netif.smartpoll_active = 1; } netif_put(netif); @@ -1612,9 +1611,9 @@ static void make_tx_response(struct xen_netif *netif, * is active. */ if ((netif->smart_poll == 1)) { - if (!(netif->rx.sring->netfront_smartpoll_active)) { + if (!(netif->rx.sring->private.netif.smartpoll_active)) { notify_remote_via_irq(netif->irq); - netif->rx.sring->netfront_smartpoll_active = 1; + netif->rx.sring->private.netif.smartpoll_active = 1; } } else if (notify) notify_remote_via_irq(netif->irq); diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h index 865dcf0..7b301fa 100644 --- a/include/xen/interface/io/ring.h +++ b/include/xen/interface/io/ring.h @@ -73,8 +73,16 @@ union __name##_sring_entry { \ struct __name##_sring { \ RING_IDX req_prod, req_event; \ RING_IDX rsp_prod, rsp_event; \ - uint8_t netfront_smartpoll_active; \ - uint8_t pad[47]; \ + union { \ + struct { \ + uint8_t smartpoll_active; \ + } netif; \ + struct { \ + uint8_t msg; \ + } tapif_user; \ + uint8_t pvt_pad[4]; \ + } private; \ + uint8_t pad[44]; \ union __name##_sring_entry ring[1]; /* variable-length */ \ }; \ \ -- 1.5.6.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |