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: Mon, 8 Apr 2013 09:32:18 -0400	[thread overview]
Message-ID: <20130408133218.GH27445@phenom.dumpdata.com> (raw)
In-Reply-To: <CA+ePHTDaC6VLXnCPUg3ByW5VTzbzqiRQ8-4qtUB3OJsUM=ztrg@mail.gmail.com>

On Mon, Apr 08, 2013 at 04:10:49PM +0800, 马磊 wrote:
> Hi,
>     there is a macro in io/ring.h as follows:
> 
> 211#define RING_HAS_UNCONSUMED_REQUESTS(_r) ({
> \                                         |
> 212    unsigned int req = (_r)->sring->req_prod - (_r)->req_cons;
>  \
> 213    unsigned int rsp = RING_SIZE(_r) -
>  \
> 214        ((_r)->req_cons - (_r)->rsp_prod_pvt);
>  \
> 215    req < rsp ? req : rsp;
>  \
> 216})
> 
> Anyone could explain this?

Which part are you unclear about?

I might be easier if you deconstruct the macro and write out
inthe code. That should give you an idea of what it does.
<hint: Figure out first what RING_SIZE comes out to>

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


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

  reply	other threads:[~2013-04-08 13:32 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 [this message]
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
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=20130408133218.GH27445@phenom.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.