WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] make protocol specific usage of shared sring exp

To: "Ian Campbell" <ian.campbell@xxxxxxxxxx>, "Keir Fraser" <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] make protocol specific usage of shared sring explicit
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Mon, 05 Jul 2010 08:06:16 +0100
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Dongxiao Xu <dongxiao.xu@xxxxxxxxx>, Daniel Stodden <daniel.stodden@xxxxxxxxxx>
Delivery-date: Mon, 05 Jul 2010 00:07:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1277976171-5785-1-git-send-email-ian.campbell@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <9fb06660a061dbb19ca0.1277976128@xxxxxxxxxxxxxxxxxxxxx> <1277976171-5785-1-git-send-email-ian.campbell@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Could we get the relevant bits (the netback part apparently needs to
be dropped) of this change also into the 2.6.18 tree please, so that
issues won't arise the next time the public headers get sync-ed over
as a whole?

Thanks, Jan

>>> On 01.07.10 at 11:22, Ian Campbell <ian.campbell@xxxxxxxxxx> wrote:
> 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.

As a side note: This isn't really true, as the patch moves the field
blktap uses, and hence tools and kernel ought to be changed at
the same time.
 
> 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(&current->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 */                
> \
>  };                                                                   \
>                                                                       \




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel