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

[Xen-devel] RING_HAS_UNCONSUMED_REQUESTS oddness



Hi,

I was wondering for a while why this macro looks like this:

#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;                                          \
    })

I would expect to check prod - cons, like RING_HAS_UNCONSUMED_RESPONSES does:

#define RING_HAS_UNCONSUMED_RESPONSES(_r)                               \
    ((_r)->sring->rsp_prod - (_r)->rsp_cons)

By my understanding, there is no way rsp could be smaller than req, so
there is no point having this. Am I missing something?

Regards,

Zoli

_______________________________________________
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®.