ia64/xen-unstable

changeset 4134:5e1e1c6d7457

bitkeeper revision 1.1236.30.2 (423553705lFIxda6xBfLOruUqofkAQ)

xcs control channel cleanup fixes from rick cox.

Signed-off-by: andrew.warfield@cl.cam.ac.uk
author akw27@arcadians.cl.cam.ac.uk
date Mon Mar 14 09:03:44 2005 +0000 (2005-03-14)
parents 4a4b4a6ef605
children b5337b34feb7
files tools/xcs/xcs.c
line diff
     1.1 --- a/tools/xcs/xcs.c	Mon Mar 14 08:59:23 2005 +0000
     1.2 +++ b/tools/xcs/xcs.c	Mon Mar 14 09:03:44 2005 +0000
     1.3 @@ -97,7 +97,7 @@ static void map_dom_to_port(u32 dom, int
     1.4              exit(1);
     1.5          }
     1.6  
     1.7 -        for (; dom_port_map_size < dom + 10; dom_port_map_size++) {
     1.8 +        for (; dom_port_map_size < dom + 256; dom_port_map_size++) {
     1.9              dom_port_map[dom_port_map_size] = -1;
    1.10          }
    1.11      }
    1.12 @@ -123,7 +123,7 @@ static control_channel_t *add_interface(
    1.13      control_channel_t *cc=NULL, *oldcc;
    1.14      int ret;
    1.15      
    1.16 -    if (cc_list[dom_to_port(dom)] != NULL)
    1.17 +    if ((dom_to_port(dom) >= 0) && (cc_list[dom_to_port(dom)] != NULL))
    1.18      {
    1.19          return(cc_list[dom_to_port(dom)]);
    1.20      }
    1.21 @@ -155,10 +155,13 @@ static control_channel_t *add_interface(
    1.22          if ((oldcc->remote_dom != cc->remote_dom) ||
    1.23              (oldcc->remote_port != cc->remote_port))
    1.24          {
    1.25 -            DPRINTF("CC conflict! (port: %d, old dom: %u, new dom: %u)\n",
    1.26 -                    cc->local_port, oldcc->remote_dom, cc->remote_dom);
    1.27 +            DPRINTF("CC conflict! (port: %d, old dom: %u, new dom: %u, "
    1.28 +                    "old ref_count: %d)\n",
    1.29 +                    cc->local_port, oldcc->remote_dom, cc->remote_dom, 
    1.30 +                    oldcc->ref_count);
    1.31              map_dom_to_port(oldcc->remote_dom, -1);
    1.32              ctrl_chan_free(cc_list[cc->local_port]);
    1.33 +            cc_list[cc->local_port] = NULL;
    1.34          }
    1.35      }
    1.36       
    1.37 @@ -210,6 +213,8 @@ void put_interface(control_channel_t *cc
    1.38          {
    1.39              DPRINTF("Freeing cc on port %d.\n", cc->local_port);
    1.40              (void)evtchn_unbind(cc->local_port);
    1.41 +            cc_list[cc->local_port] = NULL;
    1.42 +            map_dom_to_port(cc->remote_dom, -1);
    1.43              ctrl_chan_free(cc);
    1.44          }
    1.45      }