Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen Use the same type as xen in the request des...



details:   https://anonhg.NetBSD.org/src/rev/3562a1d78812
branches:  trunk
changeset: 574726:3562a1d78812
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Mar 10 17:05:38 2005 +0000

description:
Use the same type as xen in the request descriptor.
Change the logic in the request processing loop so that we don't
think the ring is empty when is has BLKIF_RING_SIZE requests.

diffstat:

 sys/arch/xen/xen/xbdback.c |  25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diffs (46 lines):

diff -r cf3e7b425788 -r 3562a1d78812 sys/arch/xen/xen/xbdback.c
--- a/sys/arch/xen/xen/xbdback.c        Thu Mar 10 17:02:20 2005 +0000
+++ b/sys/arch/xen/xen/xbdback.c        Thu Mar 10 17:05:38 2005 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbdback.c,v 1.2 2005/03/09 22:39:21 bouyer Exp $      */
+/*      $NetBSD: xbdback.c,v 1.3 2005/03/10 17:05:38 bouyer Exp $      */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -117,9 +117,9 @@
        struct xbdback_instance *rq_xbdi; /* our xbd instance */
        /* from the request: */
        paddr_t rq_ma[BLKIF_MAX_PAGES_PER_REQUEST]; /* machine address to map */
-       int rq_nrsegments; /* number of ma entries */
-       int rq_id;
-       int rq_operation;
+       uint8_t rq_nrsegments; /* number of ma entries */
+       uint8_t rq_operation;
+       unsigned long rq_id;
 };
 
 struct pool xbdback_request_pool;
@@ -497,11 +497,18 @@
 
        req_prod = xbdi->blk_ring->req_prod;
        __insn_barrier(); /* ensure we see all requests up to req_prod */
-       req_prod = MASK_BLKIF_IDX(req_prod);
-
-       for (; xbdi->req_cons != req_prod;
-           xbdi->req_cons = MASK_BLKIF_IDX(xbdi->req_cons + 1)) {
-               req = &xbdi->blk_ring->ring[xbdi->req_cons].req;
+       /*
+        * note that we'll eventually get a full ring of request.
+        * in this case, MASK_BLKIF_IDX(req_cons) == MASK_BLKIF_IDX(req_prod)
+        */
+       for (; xbdi->req_cons != req_prod; xbdi->req_cons++) {
+               req = &xbdi->blk_ring->ring[MASK_BLKIF_IDX(xbdi->req_cons)].req;
+               XENPRINTF(("xbdback op %d req_cons 0x%x req_prod 0x%x/0x%x "
+                   "resp_prod 0x%x/0x%x\n", req->operation,
+                       xbdi->req_cons,
+                       req_prod, MASK_BLKIF_IDX(req_prod),
+                       xbdi->blk_ring->resp_prod,
+                       MASK_BLKIF_IDX(xbdi->blk_ring->resp_prod)));
                switch(req->operation) {
                case BLKIF_OP_PROBE:
                        error = xbdback_probe(xbdi, req);



Home | Main Index | Thread Index | Old Index