[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [Problem] about src/xen/include/public/io/ring.h






On Thu, Apr 11, 2013 at 9:20 PM, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> wrote:
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 ?


Assume X = (_r)->req_cons - (_r)->rsp_prod_pvt and Y = number of free ring buffers for responder(backend driver), they are equal in amount, is that?
Then rsp = RING_SIZE(r) - (X - Y), ÂI can't figure out this and the return value `Âreq < rsp ? req : rsp` ?
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.