ia64/xen-unstable

view xen-2.4.16/include/xeno/vif.h @ 97:ce656d157bbf

bitkeeper revision 1.15.1.9 (3e2fd418NdZYqL3KPr6URqd77DwnJQ)

Add shadow ring in the RX direction to protect buffers from guest
tampering once they have been passed to the hypervisor. This
is under the umbrella of eventual zero-copy network code.
author akw27@plucky.localdomain
date Thu Jan 23 11:38:00 2003 +0000 (2003-01-23)
parents 8ce741992076
children 82679de8a1ca
line source
1 /* vif.h
2 *
3 * This is the hypervisor end of the network code. The net_ring structure
4 * stored in each vif is placed on a shared page to interact with the guest VM.
5 *
6 * Copyright (c) 2002, A K Warfield and K A Fraser
7 */
9 /* virtual network interface struct and associated defines. */
10 /* net_vif_st is the larger struct that describes a virtual network interface
11 * it contains a pointer to the net_ring_t structure that needs to be on a
12 * shared page between the hypervisor and guest. The vif struct is private
13 * to the hypervisor and is used primarily as a container to allow routing
14 * and interface administration. This define should eventually be moved to
15 * a non-shared interface file, as it is of no relevance to the guest.
16 */
18 #include <hypervisor-ifs/network.h>
19 #include <xeno/skbuff.h>
21 /*
22 * shadow ring structures are used to protect the descriptors from
23 * tampering after they have been passed to the hypervisor.
24 *
25 * TX_RING_SIZE and RX_RING_SIZE are defined in the shared network.h.
26 */
28 typedef struct tx_shadow_entry_st {
29 unsigned long addr;
30 unsigned long size;
31 int status;
32 unsigned long flush_count;
33 } tx_shadow_entry_t;
35 typedef struct rx_shadow_entry_st {
36 unsigned long addr;
37 unsigned long size;
38 int status;
39 unsigned long flush_count;
40 } rx_shadow_entry_t;
42 typedef struct net_shadow_ring_st {
43 tx_shadow_entry_t *tx_ring;
44 rx_shadow_entry_t *rx_ring;
45 unsigned int rx_prod; // trying to add shadow pointers only as I need to.
46 } net_shadow_ring_t;
48 typedef struct net_vif_st {
49 net_ring_t *net_ring;
50 net_shadow_ring_t *shadow_ring;
51 int id;
52 struct sk_buff_head skb_list;
53 unsigned int domain;
54 // rules table goes here in next revision.
55 } net_vif_t;
57 /* VIF-related defines. */
58 #define MAX_GUEST_VIFS 2 // each VIF is a small overhead in task_struct
59 #define MAX_SYSTEM_VIFS 256
61 /* vif globals */
62 extern int sys_vif_count;
63 extern net_vif_t *sys_vif_list[];
65 /* vif prototypes */
66 net_vif_t *create_net_vif(int domain);
67 void destroy_net_vif(struct task_struct *p);
68 void add_default_net_rule(int vif_id, u32 ipaddr);
69 int net_get_target_vif(struct sk_buff *skb);
70 void add_default_net_rule(int vif_id, u32 ipaddr);
72 /* status fields per-descriptor:
73 */