ia64/xen-unstable

changeset 1703:1a6a93fdeafc

bitkeeper revision 1.1041.15.2 (40ebf599xwzX2YRHxQvVAFkLp9CM5g)

Fix disconnect handling in netif/blkif drivers.
Add debug tracing to control-interface routines.
author kaf24@scramble.cl.cam.ac.uk
date Wed Jul 07 13:07:37 2004 +0000 (2004-07-07)
parents c16292056099
children 0e23f01219c6 6235d9c48836 ab1f2db9e634 15e8dbddd2a9
files linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/interface.c linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/common.h linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/interface.c linux-2.4.26-xen-sparse/arch/xen/kernel/ctrl_if.c
line diff
     1.1 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/interface.c	Wed Jul 07 09:58:27 2004 +0000
     1.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/interface.c	Wed Jul 07 13:07:37 2004 +0000
     1.3 @@ -220,9 +220,11 @@ int blkif_disconnect(blkif_be_disconnect
     1.4          free_irq(blkif->irq, blkif);
     1.5          blkif_deschedule(blkif);
     1.6          blkif_put(blkif);
     1.7 +        return 0; /* Caller should not send response message. */
     1.8      }
     1.9  
    1.10 -    return 0; /* Caller should not send response message. */
    1.11 +    disconnect->status = BLKIF_BE_STATUS_OKAY;
    1.12 +    return 1;
    1.13  }
    1.14  
    1.15  void __init blkif_interface_init(void)
     2.1 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/common.h	Wed Jul 07 09:58:27 2004 +0000
     2.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/common.h	Wed Jul 07 13:07:37 2004 +0000
     2.3 @@ -21,7 +21,7 @@
     2.4  #define ASSERT(_p) \
     2.5      if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
     2.6      __LINE__, __FILE__); *(int*)0=0; }
     2.7 -#define DPRINTK(_f, _a...) printk("(file=%s, line=%d) " _f, \
     2.8 +#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
     2.9                             __FILE__ , __LINE__ , ## _a )
    2.10  #else
    2.11  #define ASSERT(_p) ((void)0)
     3.1 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/interface.c	Wed Jul 07 09:58:27 2004 +0000
     3.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/interface.c	Wed Jul 07 13:07:37 2004 +0000
     3.3 @@ -269,9 +269,11 @@ int netif_disconnect(netif_be_disconnect
     3.4          free_irq(netif->irq, netif);
     3.5          netif_deschedule(netif);
     3.6          netif_put(netif);
     3.7 +        return 0; /* Caller should not send response message. */
     3.8      }
     3.9  
    3.10 -    return 0; /* Caller should not send response message. */
    3.11 +    disconnect->status = NETIF_BE_STATUS_OKAY;
    3.12 +    return 1;
    3.13  }
    3.14  
    3.15  void netif_interface_init(void)
     4.1 --- a/linux-2.4.26-xen-sparse/arch/xen/kernel/ctrl_if.c	Wed Jul 07 09:58:27 2004 +0000
     4.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/kernel/ctrl_if.c	Wed Jul 07 13:07:37 2004 +0000
     4.3 @@ -17,6 +17,13 @@
     4.4  #include <asm/ctrl_if.h>
     4.5  #include <asm/evtchn.h>
     4.6  
     4.7 +#if 0
     4.8 +#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
     4.9 +                           __FILE__ , __LINE__ , ## _a )
    4.10 +#else
    4.11 +#define DPRINTK(_f, _a...) ((void)0)
    4.12 +#endif
    4.13 +
    4.14  /*
    4.15   * Only used by initial domain which must create its own control-interface
    4.16   * event channel. This value is picked up by the user-space domain controller
    4.17 @@ -86,6 +93,11 @@ static void __ctrl_if_tx_tasklet(unsigne
    4.18      {
    4.19          msg = &ctrl_if->tx_ring[MASK_CONTROL_IDX(ctrl_if_tx_resp_cons)];
    4.20  
    4.21 +        DPRINTK("Rx-Rsp %u/%u :: %d/%d\n", 
    4.22 +                ctrl_if_tx_resp_cons,
    4.23 +                ctrl_if->tx_resp_prod,
    4.24 +                msg->type, msg->subtype);
    4.25 +
    4.26          /* Execute the callback handler, if one was specified. */
    4.27          if ( msg->id != 0xFF )
    4.28          {
    4.29 @@ -131,8 +143,15 @@ static void __ctrl_if_rx_tasklet(unsigne
    4.30      {
    4.31          pmsg = &ctrl_if->rx_ring[MASK_CONTROL_IDX(ctrl_if_rx_req_cons++)];
    4.32          memcpy(&msg, pmsg, offsetof(ctrl_msg_t, msg));
    4.33 +
    4.34 +        DPRINTK("Rx-Req %u/%u :: %d/%d\n", 
    4.35 +                ctrl_if_rx_req_cons-1,
    4.36 +                ctrl_if->rx_req_prod,
    4.37 +                msg.type, msg.subtype);
    4.38 +
    4.39          if ( msg.length != 0 )
    4.40              memcpy(msg.msg, pmsg->msg, msg.length);
    4.41 +
    4.42          if ( test_bit(msg.type, &ctrl_if_rxmsg_blocking_context) )
    4.43          {
    4.44              pmsg = &ctrl_if_rxmsg_deferred[MASK_CONTROL_IDX(
    4.45 @@ -185,6 +204,11 @@ int ctrl_if_send_message_noblock(
    4.46          msg->id = i;
    4.47      }
    4.48  
    4.49 +    DPRINTK("Tx-Req %u/%u :: %d/%d\n", 
    4.50 +            ctrl_if->tx_req_prod, 
    4.51 +            ctrl_if_tx_resp_cons,
    4.52 +            msg->type, msg->subtype);
    4.53 +
    4.54      memcpy(&ctrl_if->tx_ring[MASK_CONTROL_IDX(ctrl_if->tx_req_prod)], 
    4.55             msg, sizeof(*msg));
    4.56      wmb(); /* Write the message before letting the controller peek at it. */
    4.57 @@ -262,11 +286,18 @@ void ctrl_if_send_response(ctrl_msg_t *m
    4.58       * In this situation we may have src==dst, so no copying is required.
    4.59       */
    4.60      spin_lock_irqsave(&ctrl_if_lock, flags);
    4.61 +
    4.62 +    DPRINTK("Tx-Rsp %u :: %d/%d\n", 
    4.63 +            ctrl_if->rx_resp_prod, 
    4.64 +            msg->type, msg->subtype);
    4.65 +
    4.66      dmsg = &ctrl_if->rx_ring[MASK_CONTROL_IDX(ctrl_if->rx_resp_prod)];
    4.67      if ( dmsg != msg )
    4.68          memcpy(dmsg, msg, sizeof(*msg));
    4.69 +
    4.70      wmb(); /* Write the message before letting the controller peek at it. */
    4.71      ctrl_if->rx_resp_prod++;
    4.72 +
    4.73      spin_unlock_irqrestore(&ctrl_if_lock, flags);
    4.74  
    4.75      ctrl_if_notify_controller();