2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2009, Lei Xia <lxia@northwestern.edu>
11 * Copyright (c) 2009, Yuan Tang <ytang@northwestern.edu>
12 * Copyright (c) 2009, Jack Lange <jarusl@cs.northwestern.edu>
13 * Copyright (c) 2009, Peter Dinda <pdinda@northwestern.edu
14 * Copyright (c) 2009, The V3VEE Project <http://www.v3vee.org>
15 * All rights reserved.
17 * Author: Lei Xia <lxia@northwestern.edu>
18 * Yuan Tang <ytang@northwestern.edu>
20 * This is free software. You are permitted to use,
21 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
27 #include <palacios/vmm.h>
28 #include <palacios/vmm_string.h>
29 #include <palacios/vmm_types.h>
30 #include <palacios/vmm_queue.h>
31 #include <palacios/vmm_hashtable.h>
32 #include <palacios/vmm_sprintf.h>
34 #define ETHERNET_HEADER_LEN 14
35 #define ETHERNET_DATA_MIN 46
36 #define ETHERNET_DATA_MAX 1500
37 #define ETHERNET_PACKET_LEN (ETHERNET_HEADER_LEN + ETHERNET_DATA_MAX)
39 typedef enum {MAC_ANY, MAC_NOT, MAC_NONE, MAC_EMPTY} mac_type_t; //for 'src_mac_qual' and 'dst_mac_qual'
40 typedef enum {LINK_INTERFACE, LINK_EDGE, LINK_ANY} link_type_t; //for 'type' and 'src_type' in struct routing
41 typedef enum {TCP_TYPE, UDP_TYPE, NONE_TYPE} prot_type_t;
51 int link_idx; //link[dest] is the link to be used to send pkt
52 link_type_t link_type; //EDGE|INTERFACE|ANY
55 link_type_t src_type; //EDGE|INTERFACE|ANY
56 }__attribute__((packed));
59 struct vnet_if_device {
62 struct vm_device *dev;
64 int (*input)(uchar_t *data, uint32_t len, void *private_data);
67 }__attribute__((packed));
70 #define VNET_HEADER_LEN 64
72 prot_type_t pro_type; //protocal type of this link
73 unsigned long dest_ip;
76 uchar_t vnet_header[VNET_HEADER_LEN]; //header applied to the packet in/out from this link
79 int (*input)(uchar_t *data, uint32_t len, void *private_data);
82 }__attribute__((packed));
90 struct vnet_if_device *dst_dev;
91 struct vnet_if_link *dst_link;
92 } __attribute__((packed));
95 }__attribute__((packed));
98 int v3_vnet_send_pkt(uchar_t *buf, int length);
99 int vnet_register_device(struct vm_device *vdev,
102 int (*netif_input)(uchar_t * pkt, uint_t size, void *private_data),
104 int vnet_unregister_device(char *dev_name);
106 int v3_vnet_pkt_process();
108 void v3_vnet_init(struct guest_info *vm);