ia64/xen-unstable

view xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor-ifs/network.h @ 235:d7d0a23b2e07

bitkeeper revision 1.93 (3e5a4e6bkPheUp3x1uufN2MS3LAB7A)

Latest and Greatest version of XenoLinux based on the Linux-2.4.21-pre4
kernel.
author iap10@labyrinth.cl.cam.ac.uk
date Mon Feb 24 16:55:07 2003 +0000 (2003-02-24)
parents
children
line source
1 /******************************************************************************
2 * network.h
3 *
4 * ring data structures for buffering messages between hypervisor and
5 * guestos's. As it stands this is only used for network buffer exchange.
6 *
7 * This file also contains structures and interfaces for the per-domain
8 * routing/filtering tables in the hypervisor.
9 *
10 */
12 #ifndef __RING_H__
13 #define __RING_H__
15 #include <linux/types.h>
17 typedef struct tx_entry_st {
18 unsigned long addr; /* virtual address */
19 unsigned long size; /* in bytes */
20 int status; /* per descriptor status. */
21 } tx_entry_t;
23 typedef struct rx_entry_st {
24 unsigned long addr; /* virtual address */
25 unsigned long size; /* in bytes */
26 int status; /* per descriptor status. */
27 } rx_entry_t;
29 #define TX_RING_SIZE 256
30 #define RX_RING_SIZE 256
31 typedef struct net_ring_st {
32 /*
33 * Guest OS places packets into ring at tx_prod.
34 * Hypervisor removes at tx_cons.
35 * Ring is empty when tx_prod == tx_cons.
36 * Guest OS receives a DOMAIN_EVENT_NET_TX when tx_cons passes tx_event.
37 * Hypervisor may be prodded whenever tx_prod is updated, but this is
38 * only necessary when tx_cons == old_tx_prod (ie. transmitter stalled).
39 */
40 tx_entry_t *tx_ring;
41 unsigned int tx_prod, tx_cons, tx_event;
43 /*
44 * Guest OS places empty buffers into ring at rx_prod.
45 * Hypervisor fills buffers as rx_cons.
46 * Ring is empty when rx_prod == rx_cons.
47 * Guest OS receives a DOMAIN_EVENT_NET_RX when rx_cons passes rx_event.
48 * Hypervisor may be prodded whenever rx_prod is updated, but this is
49 * only necessary when rx_cons == old_rx_prod (ie. receiver stalled).
50 */
51 rx_entry_t *rx_ring;
52 unsigned int rx_prod, rx_cons, rx_event;
53 } net_ring_t;
55 /* Specify base of per-domain array. Get returned free slot in the array. */
56 /*net_ring_t *create_net_vif(int domain);*/
58 /* Packet routing/filtering code follows:
59 */
61 #define NETWORK_ACTION_ACCEPT 0
62 #define NETWORK_ACTION_COUNT 1
64 #define NETWORK_PROTO_ANY 0
65 #define NETWORK_PROTO_IP 1
66 #define NETWORK_PROTO_TCP 2
67 #define NETWORK_PROTO_UDP 3
68 #define NETWORK_PROTO_ARP 4
70 typedef struct net_rule_st
71 {
72 u32 src_addr;
73 u32 dst_addr;
74 u16 src_port;
75 u16 dst_port;
76 u32 src_addr_mask;
77 u32 dst_addr_mask;
78 u16 src_port_mask;
79 u16 dst_port_mask;
80 u16 proto;
82 int src_interface;
83 int dst_interface;
84 u16 action;
85 } net_rule_t;
87 typedef struct vif_query_st
88 {
89 unsigned int domain;
90 char *buf; // where to put the reply -- guest virtual address
91 } vif_query_t;
93 /* Network trap operations and associated structure.
94 * This presently just handles rule insertion and deletion, but will
95 * evenually have code to add and remove interfaces.
96 */
98 #define NETWORK_OP_ADDRULE 0
99 #define NETWORK_OP_DELETERULE 1
100 #define NETWORK_OP_GETRULELIST 2
101 #define NETWORK_OP_VIFQUERY 3
103 typedef struct network_op_st
104 {
105 unsigned long cmd;
106 union
107 {
108 net_rule_t net_rule;
109 vif_query_t vif_query;
110 }
111 u;
112 } network_op_t;
114 typedef struct net_rule_ent_st
115 {
116 net_rule_t r;
117 struct net_rule_ent_st *next;
118 } net_rule_ent_t;
120 /* Drop a new rule down to the network tables. */
121 int add_net_rule(net_rule_t *rule);
124 /* Descriptor status values:
125 */
127 #define RING_STATUS_OK 0 // Everything is gravy.
128 #define RING_STATUS_ERR_CFU -1 // Copy from user problems.
129 #define RING_STATUS_BAD_PAGE -2 // What they gave us was pure evil.
131 #endif