direct-io.hg

view linux-2.6.11-xen-sparse/drivers/xen/netback/control.c @ 4959:2c0074c64c33

bitkeeper revision 1.1159.258.134 (428a2efbVjatsyWzpCT8mcdj0YbvXw)

Do not build netfront/netback loopback by default.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue May 17 17:50:51 2005 +0000 (2005-05-17)
parents cff0d3baf599
children db5a30a327e6 0dc3b8b8c298
line source
1 /******************************************************************************
2 * arch/xen/drivers/netif/backend/control.c
3 *
4 * Routines for interfacing with the control plane.
5 *
6 * Copyright (c) 2004, Keir Fraser
7 */
9 #include "common.h"
11 static void netif_ctrlif_rx(ctrl_msg_t *msg, unsigned long id)
12 {
13 switch ( msg->subtype )
14 {
15 case CMSG_NETIF_BE_CREATE:
16 if ( msg->length != sizeof(netif_be_create_t) )
17 goto parse_error;
18 netif_create((netif_be_create_t *)&msg->msg[0]);
19 break;
20 case CMSG_NETIF_BE_DESTROY:
21 if ( msg->length != sizeof(netif_be_destroy_t) )
22 goto parse_error;
23 netif_destroy((netif_be_destroy_t *)&msg->msg[0]);
24 break;
25 case CMSG_NETIF_BE_CONNECT:
26 if ( msg->length != sizeof(netif_be_connect_t) )
27 goto parse_error;
28 netif_connect((netif_be_connect_t *)&msg->msg[0]);
29 break;
30 case CMSG_NETIF_BE_DISCONNECT:
31 if ( msg->length != sizeof(netif_be_disconnect_t) )
32 goto parse_error;
33 if ( !netif_disconnect((netif_be_disconnect_t *)&msg->msg[0],msg->id) )
34 return; /* Sending the response is deferred until later. */
35 break;
36 default:
37 goto parse_error;
38 }
40 ctrl_if_send_response(msg);
41 return;
43 parse_error:
44 DPRINTK("Parse error while reading message subtype %d, len %d\n",
45 msg->subtype, msg->length);
46 msg->length = 0;
47 ctrl_if_send_response(msg);
48 }
50 void netif_ctrlif_init(void)
51 {
52 ctrl_msg_t cmsg;
53 netif_be_driver_status_t st;
55 (void)ctrl_if_register_receiver(CMSG_NETIF_BE, netif_ctrlif_rx,
56 CALLBACK_IN_BLOCKING_CONTEXT);
58 /* Send a driver-UP notification to the domain controller. */
59 cmsg.type = CMSG_NETIF_BE;
60 cmsg.subtype = CMSG_NETIF_BE_DRIVER_STATUS;
61 cmsg.length = sizeof(netif_be_driver_status_t);
62 st.status = NETIF_DRIVER_STATUS_UP;
63 memcpy(cmsg.msg, &st, sizeof(st));
64 ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
65 }