All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: 马磊 <aware.why@gmail.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [Problem] about src/xen/include/public/io/ring.h
Date: Thu, 11 Apr 2013 09:20:35 -0400	[thread overview]
Message-ID: <20130411132034.GA6113@konrad-lan.dumpdata.com> (raw)
In-Reply-To: <CA+ePHTBQgzYA6btJ4wHXmye6Q6tn_T5rTPunLWEPg=NRQyrwKQ@mail.gmail.com>

On Thu, Apr 11, 2013 at 03:46:25PM +0800, 马磊 wrote:
>  I means, in ring.h,
> The macro for unconsumed response is :
>  207#define RING_HAS_UNCONSUMED_RESPONSES(_r)
> \
>  208    ((_r)->sring->rsp_prod - (_r)->rsp_cons)
> 
> *Should the macro for unconsumed request be written like this:*
>  #define RING_HAS_UNCONSUMED_REQUESTS(_r)                               \
>      ((_r)->sring->req_prod - (_r)->req_cons)
> 

Please don't top post.

It is close to that in the code:

#define RING_HAS_UNCONSUMED_REQUESTS(_r)				\
    ({									\
	unsigned int req = (_r)->sring->req_prod - (_r)->req_cons;	\
	unsigned int rsp = RING_SIZE(_r) -				\
			   ((_r)->req_cons - (_r)->rsp_prod_pvt);	\
	req < rsp ? req : rsp;						\
    })

Can you figure out why it has the check against resp_cons and rsp_prod_pvt ?

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2013-04-11 13:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08  8:10 [Problem] about src/xen/include/public/io/ring.h 马磊
2013-04-08 13:32 ` Konrad Rzeszutek Wilk
2013-04-09  3:05   ` 马磊
2013-04-10 13:15     ` Konrad Rzeszutek Wilk
2013-04-11  7:46       ` 马磊
2013-04-11 13:20         ` Konrad Rzeszutek Wilk [this message]
2013-04-12  2:21           ` 马磊
2013-04-12  7:49             ` Ian Campbell
2013-04-12 10:35               ` 马磊
2013-04-12 11:14                 ` Ian Campbell
2013-04-12 11:24                   ` 马磊
2013-04-12 13:45                     ` Konrad Rzeszutek Wilk
2013-04-15  2:52                       ` 马磊
2013-04-10  6:20   ` 马磊
2013-04-10 13:15     ` Konrad Rzeszutek Wilk

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=20130411132034.GA6113@konrad-lan.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=aware.why@gmail.com \
    --cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.