win-pvdrivers

changeset 1079:a60d401aa020

Tidy up asserts in xennet. Add a few new ones.
author James Harper <james.harper@bendigoit.com.au>
date Mon Dec 09 13:33:26 2013 +1100 (2013-12-09)
parents d4ebb1bd1c2b
children e86ea7c3d8a4
files xennet/xennet_common.c xennet/xennet_tx.c
line diff
     1.1 --- a/xennet/xennet_common.c	Mon Dec 09 13:32:44 2013 +1100
     1.2 +++ b/xennet/xennet_common.c	Mon Dec 09 13:33:26 2013 +1100
     1.3 @@ -41,7 +41,7 @@ XenNet_BuildHeader(packet_info_t *pi, PU
     1.4    }
     1.5  
     1.6    if (header == pi->first_mdl_virtual) {
     1.7 -    ASSERT(new_header_size <= PAGE_SIZE);
     1.8 +    XN_ASSERT(new_header_size <= PAGE_SIZE);
     1.9      /* still working in the first buffer */
    1.10      if (new_header_size <= pi->first_mdl_length) {
    1.11        /* Trivially expand header_length */
    1.12 @@ -59,8 +59,6 @@ XenNet_BuildHeader(packet_info_t *pi, PU
    1.13          pi->curr_mdl_offset = (USHORT)new_header_size;
    1.14        }
    1.15      }
    1.16 -  } else {
    1.17 -    ASSERT(new_header_size <= MAX_LOOKAHEAD_LENGTH + MAX_ETH_HEADER_LENGTH);
    1.18    }
    1.19    
    1.20    bytes_remaining = new_header_size - pi->header_length;
     2.1 --- a/xennet/xennet_tx.c	Mon Dec 09 13:32:44 2013 +1100
     2.2 +++ b/xennet/xennet_tx.c	Mon Dec 09 13:33:26 2013 +1100
     2.3 @@ -45,6 +45,7 @@ XenNet_PutCbOnRing(struct xennet_info *x
     2.4    struct netif_tx_request *tx;
     2.5    tx = RING_GET_REQUEST(&xi->tx_ring, xi->tx_ring.req_prod_pvt);
     2.6    xi->tx_ring.req_prod_pvt++;
     2.7 +  XN_ASSERT(xi->tx_ring_free);
     2.8    xi->tx_ring_free--;
     2.9    tx->id = get_id_from_freelist(xi);
    2.10    XN_ASSERT(xi->tx_shadows[tx->id].gref == INVALID_GRANT_REF);
    2.11 @@ -257,6 +258,7 @@ XenNet_HWSendPacket(struct xennet_info *
    2.12      ei = (struct netif_extra_info *)RING_GET_REQUEST(&xi->tx_ring, xi->tx_ring.req_prod_pvt);
    2.13      //KdPrint((__DRIVER_NAME "     pos = %d\n", xi->tx_ring.req_prod_pvt));
    2.14      xi->tx_ring.req_prod_pvt++;
    2.15 +    XN_ASSERT(xi->tx_ring_free);
    2.16      xi->tx_ring_free--;
    2.17      ei->type = XEN_NETIF_EXTRA_TYPE_GSO;
    2.18      ei->flags = 0;
    2.19 @@ -328,14 +330,15 @@ XenNet_HWSendPacket(struct xennet_info *
    2.20        }
    2.21        txN = RING_GET_REQUEST(&xi->tx_ring, xi->tx_ring.req_prod_pvt);
    2.22        xi->tx_ring.req_prod_pvt++;
    2.23 +      XN_ASSERT(xi->tx_ring_free);
    2.24        xi->tx_ring_free--;
    2.25        txN->id = get_id_from_freelist(xi);
    2.26 +      XN_ASSERT(xi->tx_shadows[txN->id].gref == INVALID_GRANT_REF);
    2.27        XN_ASSERT(!xi->tx_shadows[txN->id].cb);
    2.28        offset = MmGetMdlByteOffset(pi.curr_mdl) + pi.curr_mdl_offset;
    2.29        pfn = MmGetMdlPfnArray(pi.curr_mdl)[offset >> PAGE_SHIFT];
    2.30        txN->offset = (USHORT)offset & (PAGE_SIZE - 1);
    2.31        txN->gref = XnGrantAccess(xi->handle, (ULONG)pfn, FALSE, gref, (ULONG)'XNTX');
    2.32 -      XN_ASSERT(xi->tx_shadows[txN->id].gref == INVALID_GRANT_REF);
    2.33        xi->tx_shadows[txN->id].gref = txN->gref;
    2.34        //ASSERT(sg->Elements[sg_element].Length > sg_offset);
    2.35        txN->size = (USHORT)length;
    2.36 @@ -521,6 +524,8 @@ XenNet_TxBufferGC(struct xennet_info *xi
    2.37          shadow->packet = NULL;
    2.38          tx_packets++;
    2.39        }
    2.40 +      XN_ASSERT(xi->tx_shadows[txrsp->id].gref == INVALID_GRANT_REF);
    2.41 +      XN_ASSERT(!xi->tx_shadows[txrsp->id].cb);
    2.42        put_id_on_freelist(xi, txrsp->id);
    2.43      }
    2.44