direct-io.hg

changeset 13635:baf1d6ebf29c

minios : netfront driver fixes.

- Handle returned backend==NULL || mac==NULL, this leads sometimes to a crash.
- Remove unnecessary (and bogus) initialisation of np->rx.req_prod_pvt

Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@localhost.localdomain
date Fri Jan 26 13:51:00 2007 +0000 (2007-01-26)
parents 5d440c35a784
children 82b21d942ef9
files extras/mini-os/netfront.c
line diff
     1.1 --- a/extras/mini-os/netfront.c	Fri Jan 26 13:46:29 2007 +0000
     1.2 +++ b/extras/mini-os/netfront.c	Fri Jan 26 13:51:00 2007 +0000
     1.3 @@ -324,6 +324,14 @@ done:
     1.4      msg = xenbus_read(XBT_NIL, "device/vif/0/backend", &backend);
     1.5      msg = xenbus_read(XBT_NIL, "device/vif/0/mac", &mac);
     1.6  
     1.7 +    if ((backend == NULL) || (mac == NULL)) {
     1.8 +        struct evtchn_close op = { info->local_port };
     1.9 +        printk("%s: backend/mac failed\n", __func__);
    1.10 +        unbind_evtchn(info->local_port);
    1.11 +        HYPERVISOR_event_channel_op(EVTCHNOP_close, &op);
    1.12 +        return;
    1.13 +    }
    1.14 +
    1.15      printk("backend at %s\n",backend);
    1.16      printk("mac is %s\n",mac);
    1.17  
    1.18 @@ -383,10 +391,7 @@ void init_rx_buffers(void)
    1.19      netif_rx_request_t *req;
    1.20      int notify;
    1.21  
    1.22 -    np->rx.req_prod_pvt = requeue_idx;
    1.23 -
    1.24 -
    1.25 -    /* Step 2: Rebuild the RX buffer freelist and the RX ring itself. */
    1.26 +    /* Rebuild the RX buffer freelist and the RX ring itself. */
    1.27      for (requeue_idx = 0, i = 0; i < NET_RX_RING_SIZE; i++) 
    1.28      {
    1.29          struct net_buffer* buf = &rx_buffers[requeue_idx];
    1.30 @@ -402,16 +407,12 @@ void init_rx_buffers(void)
    1.31  
    1.32      np->rx.req_prod_pvt = requeue_idx;
    1.33  
    1.34 -
    1.35 -
    1.36      RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&np->rx, notify);
    1.37  
    1.38 -    if(notify) 
    1.39 +    if (notify) 
    1.40          notify_remote_via_evtchn(np->evtchn);
    1.41  
    1.42      np->rx.sring->rsp_event = np->rx.rsp_cons + 1;
    1.43 -
    1.44 -
    1.45  }
    1.46  
    1.47