diff options
author | 2017-04-25 03:31:15 -0700 | |
---|---|---|
committer | 2017-05-22 06:48:08 +0000 | |
commit | bb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch) | |
tree | ca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/include/net | |
parent | a14b48d18a9ed03ec191cf16b162206998a895ce (diff) |
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to
kvmfornfv repo and make use of the updated latest qemu for the
execution of all testcase
Change-Id: I1280af507a857675c7f81d30c95255635667bdd7
Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/include/net')
-rw-r--r-- | qemu/include/net/checksum.h | 53 | ||||
-rw-r--r-- | qemu/include/net/eth.h | 347 | ||||
-rw-r--r-- | qemu/include/net/filter.h | 79 | ||||
-rw-r--r-- | qemu/include/net/net.h | 223 | ||||
-rw-r--r-- | qemu/include/net/queue.h | 76 | ||||
-rw-r--r-- | qemu/include/net/slirp.h | 47 | ||||
-rw-r--r-- | qemu/include/net/tap.h | 41 | ||||
-rw-r--r-- | qemu/include/net/vhost-user.h | 17 | ||||
-rw-r--r-- | qemu/include/net/vhost_net.h | 34 |
9 files changed, 0 insertions, 917 deletions
diff --git a/qemu/include/net/checksum.h b/qemu/include/net/checksum.h deleted file mode 100644 index 7de1acb79..000000000 --- a/qemu/include/net/checksum.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * IP checksumming functions. - * (c) 2008 Gerd Hoffmann <kraxel@redhat.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; under version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef QEMU_NET_CHECKSUM_H -#define QEMU_NET_CHECKSUM_H - -struct iovec; - -uint32_t net_checksum_add_cont(int len, uint8_t *buf, int seq); -uint16_t net_checksum_finish(uint32_t sum); -uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto, - uint8_t *addrs, uint8_t *buf); -void net_checksum_calculate(uint8_t *data, int length); - -static inline uint32_t -net_checksum_add(int len, uint8_t *buf) -{ - return net_checksum_add_cont(len, buf, 0); -} - -static inline uint16_t -net_raw_checksum(uint8_t *data, int length) -{ - return net_checksum_finish(net_checksum_add(length, data)); -} - -/** - * net_checksum_add_iov: scatter-gather vector checksumming - * - * @iov: input scatter-gather array - * @iov_cnt: number of array elements - * @iov_off: starting iov offset for checksumming - * @size: length of data to be checksummed - */ -uint32_t net_checksum_add_iov(const struct iovec *iov, - const unsigned int iov_cnt, - uint32_t iov_off, uint32_t size); - -#endif /* QEMU_NET_CHECKSUM_H */ diff --git a/qemu/include/net/eth.h b/qemu/include/net/eth.h deleted file mode 100644 index 18d0be3b1..000000000 --- a/qemu/include/net/eth.h +++ /dev/null @@ -1,347 +0,0 @@ -/* - * QEMU network structures definitions and helper functions - * - * Copyright (c) 2012 Ravello Systems LTD (http://ravellosystems.com) - * - * Developed by Daynix Computing LTD (http://www.daynix.com) - * - * Portions developed by Free Software Foundation, Inc - * Copyright (C) 1991-1997, 2001, 2003, 2006 Free Software Foundation, Inc. - * See netinet/ip6.h and netinet/in.h (GNU C Library) - * - * Portions developed by Igor Kovalenko - * Copyright (c) 2006 Igor Kovalenko - * See hw/rtl8139.c (QEMU) - * - * Authors: - * Dmitry Fleytman <dmitry@daynix.com> - * Tamir Shomer <tamirs@daynix.com> - * Yan Vugenfirer <yan@daynix.com> - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - * - */ - -#ifndef QEMU_ETH_H -#define QEMU_ETH_H - -#include "qemu/bswap.h" -#include "qemu/iov.h" - -#define ETH_ALEN 6 -#define ETH_HLEN 14 - -struct eth_header { - uint8_t h_dest[ETH_ALEN]; /* destination eth addr */ - uint8_t h_source[ETH_ALEN]; /* source ether addr */ - uint16_t h_proto; /* packet type ID field */ -}; - -struct vlan_header { - uint16_t h_tci; /* priority and VLAN ID */ - uint16_t h_proto; /* encapsulated protocol */ -}; - -struct ip_header { - uint8_t ip_ver_len; /* version and header length */ - uint8_t ip_tos; /* type of service */ - uint16_t ip_len; /* total length */ - uint16_t ip_id; /* identification */ - uint16_t ip_off; /* fragment offset field */ - uint8_t ip_ttl; /* time to live */ - uint8_t ip_p; /* protocol */ - uint16_t ip_sum; /* checksum */ - uint32_t ip_src, ip_dst; /* source and destination address */ -}; - -typedef struct tcp_header { - uint16_t th_sport; /* source port */ - uint16_t th_dport; /* destination port */ - uint32_t th_seq; /* sequence number */ - uint32_t th_ack; /* acknowledgment number */ - uint16_t th_offset_flags; /* data offset, reserved 6 bits, */ - /* TCP protocol flags */ - uint16_t th_win; /* window */ - uint16_t th_sum; /* checksum */ - uint16_t th_urp; /* urgent pointer */ -} tcp_header; - -typedef struct udp_header { - uint16_t uh_sport; /* source port */ - uint16_t uh_dport; /* destination port */ - uint16_t uh_ulen; /* udp length */ - uint16_t uh_sum; /* udp checksum */ -} udp_header; - -typedef struct ip_pseudo_header { - uint32_t ip_src; - uint32_t ip_dst; - uint8_t zeros; - uint8_t ip_proto; - uint16_t ip_payload; -} ip_pseudo_header; - -/* IPv6 address */ -struct in6_address { - union { - uint8_t __u6_addr8[16]; - } __in6_u; -}; - -struct ip6_header { - union { - struct ip6_hdrctl { - uint32_t ip6_un1_flow; /* 4 bits version, 8 bits TC, - 20 bits flow-ID */ - uint16_t ip6_un1_plen; /* payload length */ - uint8_t ip6_un1_nxt; /* next header */ - uint8_t ip6_un1_hlim; /* hop limit */ - } ip6_un1; - uint8_t ip6_un2_vfc; /* 4 bits version, top 4 bits tclass */ - struct ip6_ecn_access { - uint8_t ip6_un3_vfc; /* 4 bits version, top 4 bits tclass */ - uint8_t ip6_un3_ecn; /* 2 bits ECN, top 6 bits payload length */ - } ip6_un3; - } ip6_ctlun; - struct in6_address ip6_src; /* source address */ - struct in6_address ip6_dst; /* destination address */ -}; - -struct ip6_ext_hdr { - uint8_t ip6r_nxt; /* next header */ - uint8_t ip6r_len; /* length in units of 8 octets */ -}; - -struct udp_hdr { - uint16_t uh_sport; /* source port */ - uint16_t uh_dport; /* destination port */ - uint16_t uh_ulen; /* udp length */ - uint16_t uh_sum; /* udp checksum */ -}; - -struct tcp_hdr { - u_short th_sport; /* source port */ - u_short th_dport; /* destination port */ - uint32_t th_seq; /* sequence number */ - uint32_t th_ack; /* acknowledgment number */ -#ifdef HOST_WORDS_BIGENDIAN - u_char th_off : 4, /* data offset */ - th_x2:4; /* (unused) */ -#else - u_char th_x2 : 4, /* (unused) */ - th_off:4; /* data offset */ -#endif - -#define TH_ELN 0x1 /* explicit loss notification */ -#define TH_ECN 0x2 /* explicit congestion notification */ -#define TH_FS 0x4 /* fast start */ - - u_char th_flags; -#define TH_FIN 0x01 -#define TH_SYN 0x02 -#define TH_RST 0x04 -#define TH_PUSH 0x08 -#define TH_ACK 0x10 -#define TH_URG 0x20 - u_short th_win; /* window */ - u_short th_sum; /* checksum */ - u_short th_urp; /* urgent pointer */ -}; - -#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt -#define ip6_ecn_acc ip6_ctlun.ip6_un3.ip6_un3_ecn - -#define PKT_GET_ETH_HDR(p) \ - ((struct eth_header *)(p)) -#define PKT_GET_VLAN_HDR(p) \ - ((struct vlan_header *) (((uint8_t *)(p)) + sizeof(struct eth_header))) -#define PKT_GET_DVLAN_HDR(p) \ - (PKT_GET_VLAN_HDR(p) + 1) -#define PKT_GET_IP_HDR(p) \ - ((struct ip_header *)(((uint8_t *)(p)) + eth_get_l2_hdr_length(p))) -#define IP_HDR_GET_LEN(p) \ - ((((struct ip_header *)p)->ip_ver_len & 0x0F) << 2) -#define PKT_GET_IP_HDR_LEN(p) \ - (IP_HDR_GET_LEN(PKT_GET_IP_HDR(p))) -#define PKT_GET_IP6_HDR(p) \ - ((struct ip6_header *) (((uint8_t *)(p)) + eth_get_l2_hdr_length(p))) -#define IP_HEADER_VERSION(ip) \ - ((ip->ip_ver_len >> 4)&0xf) - -#define ETH_P_IP (0x0800) /* Internet Protocol packet */ -#define ETH_P_ARP (0x0806) /* Address Resolution packet */ -#define ETH_P_IPV6 (0x86dd) -#define ETH_P_VLAN (0x8100) -#define ETH_P_DVLAN (0x88a8) -#define VLAN_VID_MASK 0x0fff -#define IP_HEADER_VERSION_4 (4) -#define IP_HEADER_VERSION_6 (6) -#define IP_PROTO_TCP (6) -#define IP_PROTO_UDP (17) -#define IPTOS_ECN_MASK 0x03 -#define IPTOS_ECN(x) ((x) & IPTOS_ECN_MASK) -#define IPTOS_ECN_CE 0x03 -#define IP6_ECN_MASK 0xC0 -#define IP6_ECN(x) ((x) & IP6_ECN_MASK) -#define IP6_ECN_CE 0xC0 -#define IP4_DONT_FRAGMENT_FLAG (1 << 14) - -#define IS_SPECIAL_VLAN_ID(x) \ - (((x) == 0) || ((x) == 0xFFF)) - -#define ETH_MAX_L2_HDR_LEN \ - (sizeof(struct eth_header) + 2 * sizeof(struct vlan_header)) - -#define ETH_MAX_IP4_HDR_LEN (60) -#define ETH_MAX_IP_DGRAM_LEN (0xFFFF) - -#define IP_FRAG_UNIT_SIZE (8) -#define IP_FRAG_ALIGN_SIZE(x) ((x) & ~0x7) -#define IP_RF 0x8000 /* reserved fragment flag */ -#define IP_DF 0x4000 /* don't fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - -#define IP6_EXT_GRANULARITY (8) /* Size granularity for - IPv6 extension headers */ - -/* IP6 extension header types */ -#define IP6_HOP_BY_HOP (0) -#define IP6_ROUTING (43) -#define IP6_FRAGMENT (44) -#define IP6_ESP (50) -#define IP6_AUTHENTICATION (51) -#define IP6_NONE (59) -#define IP6_DESTINATON (60) -#define IP6_MOBILITY (135) - -static inline int is_multicast_ether_addr(const uint8_t *addr) -{ - return 0x01 & addr[0]; -} - -static inline int is_broadcast_ether_addr(const uint8_t *addr) -{ - return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff; -} - -static inline int is_unicast_ether_addr(const uint8_t *addr) -{ - return !is_multicast_ether_addr(addr); -} - -typedef enum { - ETH_PKT_UCAST = 0xAABBCC00, - ETH_PKT_BCAST, - ETH_PKT_MCAST -} eth_pkt_types_e; - -static inline eth_pkt_types_e -get_eth_packet_type(const struct eth_header *ehdr) -{ - if (is_broadcast_ether_addr(ehdr->h_dest)) { - return ETH_PKT_BCAST; - } else if (is_multicast_ether_addr(ehdr->h_dest)) { - return ETH_PKT_MCAST; - } else { /* unicast */ - return ETH_PKT_UCAST; - } -} - -static inline uint32_t -eth_get_l2_hdr_length(const void *p) -{ - uint16_t proto = be16_to_cpu(PKT_GET_ETH_HDR(p)->h_proto); - struct vlan_header *hvlan = PKT_GET_VLAN_HDR(p); - switch (proto) { - case ETH_P_VLAN: - return sizeof(struct eth_header) + sizeof(struct vlan_header); - case ETH_P_DVLAN: - if (hvlan->h_proto == ETH_P_VLAN) { - return sizeof(struct eth_header) + 2 * sizeof(struct vlan_header); - } else { - return sizeof(struct eth_header) + sizeof(struct vlan_header); - } - default: - return sizeof(struct eth_header); - } -} - -static inline uint16_t -eth_get_pkt_tci(const void *p) -{ - uint16_t proto = be16_to_cpu(PKT_GET_ETH_HDR(p)->h_proto); - struct vlan_header *hvlan = PKT_GET_VLAN_HDR(p); - switch (proto) { - case ETH_P_VLAN: - case ETH_P_DVLAN: - return be16_to_cpu(hvlan->h_tci); - default: - return 0; - } -} - -static inline bool -eth_strip_vlan(const void *p, uint8_t *new_ehdr_buf, - uint16_t *payload_offset, uint16_t *tci) -{ - uint16_t proto = be16_to_cpu(PKT_GET_ETH_HDR(p)->h_proto); - struct vlan_header *hvlan = PKT_GET_VLAN_HDR(p); - struct eth_header *new_ehdr = (struct eth_header *) new_ehdr_buf; - - switch (proto) { - case ETH_P_VLAN: - case ETH_P_DVLAN: - memcpy(new_ehdr->h_source, PKT_GET_ETH_HDR(p)->h_source, ETH_ALEN); - memcpy(new_ehdr->h_dest, PKT_GET_ETH_HDR(p)->h_dest, ETH_ALEN); - new_ehdr->h_proto = hvlan->h_proto; - *tci = be16_to_cpu(hvlan->h_tci); - *payload_offset = - sizeof(struct eth_header) + sizeof(struct vlan_header); - if (be16_to_cpu(new_ehdr->h_proto) == ETH_P_VLAN) { - memcpy(PKT_GET_VLAN_HDR(new_ehdr), - PKT_GET_DVLAN_HDR(p), - sizeof(struct vlan_header)); - *payload_offset += sizeof(struct vlan_header); - } - return true; - default: - return false; - } -} - -static inline uint16_t -eth_get_l3_proto(const void *l2hdr, size_t l2hdr_len) -{ - uint8_t *proto_ptr = (uint8_t *) l2hdr + l2hdr_len - sizeof(uint16_t); - return be16_to_cpup((uint16_t *)proto_ptr); -} - -void eth_setup_vlan_headers(struct eth_header *ehdr, uint16_t vlan_tag, - bool *is_new); - -uint8_t eth_get_gso_type(uint16_t l3_proto, uint8_t *l3_hdr, uint8_t l4proto); - -void eth_get_protocols(const uint8_t *headers, - uint32_t hdr_length, - bool *isip4, bool *isip6, - bool *isudp, bool *istcp); - -void eth_setup_ip4_fragmentation(const void *l2hdr, size_t l2hdr_len, - void *l3hdr, size_t l3hdr_len, - size_t l3payload_len, - size_t frag_offset, bool more_frags); - -void -eth_fix_ip4_checksum(void *l3hdr, size_t l3hdr_len); - -uint32_t -eth_calc_pseudo_hdr_csum(struct ip_header *iphdr, uint16_t csl); - -bool -eth_parse_ipv6_hdr(struct iovec *pkt, int pkt_frags, - size_t ip6hdr_off, uint8_t *l4proto, - size_t *full_hdr_len); - -#endif diff --git a/qemu/include/net/filter.h b/qemu/include/net/filter.h deleted file mode 100644 index 0c4a2ea6c..000000000 --- a/qemu/include/net/filter.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2015 FUJITSU LIMITED - * Author: Yang Hongyang <yanghy@cn.fujitsu.com> - * - * This work is licensed under the terms of the GNU GPL, version 2 or - * later. See the COPYING file in the top-level directory. - */ - -#ifndef QEMU_NET_FILTER_H -#define QEMU_NET_FILTER_H - -#include "qom/object.h" -#include "qemu-common.h" -#include "net/queue.h" - -#define TYPE_NETFILTER "netfilter" -#define NETFILTER(obj) \ - OBJECT_CHECK(NetFilterState, (obj), TYPE_NETFILTER) -#define NETFILTER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(NetFilterClass, (obj), TYPE_NETFILTER) -#define NETFILTER_CLASS(klass) \ - OBJECT_CLASS_CHECK(NetFilterClass, (klass), TYPE_NETFILTER) - -typedef void (FilterSetup) (NetFilterState *nf, Error **errp); -typedef void (FilterCleanup) (NetFilterState *nf); -/* - * Return: - * 0: finished handling the packet, we should continue - * size: filter stolen this packet, we stop pass this packet further - */ -typedef ssize_t (FilterReceiveIOV)(NetFilterState *nc, - NetClientState *sender, - unsigned flags, - const struct iovec *iov, - int iovcnt, - NetPacketSent *sent_cb); - -typedef void (FilterStatusChanged) (NetFilterState *nf, Error **errp); - -typedef struct NetFilterClass { - ObjectClass parent_class; - - /* optional */ - FilterSetup *setup; - FilterCleanup *cleanup; - FilterStatusChanged *status_changed; - /* mandatory */ - FilterReceiveIOV *receive_iov; -} NetFilterClass; - - -struct NetFilterState { - /* private */ - Object parent; - - /* protected */ - char *netdev_id; - NetClientState *netdev; - NetFilterDirection direction; - bool on; - QTAILQ_ENTRY(NetFilterState) next; -}; - -ssize_t qemu_netfilter_receive(NetFilterState *nf, - NetFilterDirection direction, - NetClientState *sender, - unsigned flags, - const struct iovec *iov, - int iovcnt, - NetPacketSent *sent_cb); - -/* pass the packet to the next filter */ -ssize_t qemu_netfilter_pass_to_next(NetClientState *sender, - unsigned flags, - const struct iovec *iov, - int iovcnt, - void *opaque); - -#endif /* QEMU_NET_FILTER_H */ diff --git a/qemu/include/net/net.h b/qemu/include/net/net.h deleted file mode 100644 index 73e4c466e..000000000 --- a/qemu/include/net/net.h +++ /dev/null @@ -1,223 +0,0 @@ -#ifndef QEMU_NET_H -#define QEMU_NET_H - -#include "qemu/queue.h" -#include "qemu-common.h" -#include "qapi/qmp/qdict.h" -#include "qemu/option.h" -#include "net/queue.h" -#include "migration/vmstate.h" -#include "qapi-types.h" - -#define MAX_QUEUE_NUM 1024 - -/* Maximum GSO packet size (64k) plus plenty of room for - * the ethernet and virtio_net headers - */ -#define NET_BUFSIZE (4096 + 65536) - -struct MACAddr { - uint8_t a[6]; -}; - -/* qdev nic properties */ - -typedef struct NICPeers { - NetClientState *ncs[MAX_QUEUE_NUM]; - int32_t queues; -} NICPeers; - -typedef struct NICConf { - MACAddr macaddr; - NICPeers peers; - int32_t bootindex; -} NICConf; - -#define DEFINE_NIC_PROPERTIES(_state, _conf) \ - DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \ - DEFINE_PROP_VLAN("vlan", _state, _conf.peers), \ - DEFINE_PROP_NETDEV("netdev", _state, _conf.peers) - - -/* Net clients */ - -typedef void (NetPoll)(NetClientState *, bool enable); -typedef int (NetCanReceive)(NetClientState *); -typedef ssize_t (NetReceive)(NetClientState *, const uint8_t *, size_t); -typedef ssize_t (NetReceiveIOV)(NetClientState *, const struct iovec *, int); -typedef void (NetCleanup) (NetClientState *); -typedef void (LinkStatusChanged)(NetClientState *); -typedef void (NetClientDestructor)(NetClientState *); -typedef RxFilterInfo *(QueryRxFilter)(NetClientState *); -typedef bool (HasUfo)(NetClientState *); -typedef bool (HasVnetHdr)(NetClientState *); -typedef bool (HasVnetHdrLen)(NetClientState *, int); -typedef void (UsingVnetHdr)(NetClientState *, bool); -typedef void (SetOffload)(NetClientState *, int, int, int, int, int); -typedef void (SetVnetHdrLen)(NetClientState *, int); -typedef int (SetVnetLE)(NetClientState *, bool); -typedef int (SetVnetBE)(NetClientState *, bool); - -typedef struct NetClientInfo { - NetClientOptionsKind type; - size_t size; - NetReceive *receive; - NetReceive *receive_raw; - NetReceiveIOV *receive_iov; - NetCanReceive *can_receive; - NetCleanup *cleanup; - LinkStatusChanged *link_status_changed; - QueryRxFilter *query_rx_filter; - NetPoll *poll; - HasUfo *has_ufo; - HasVnetHdr *has_vnet_hdr; - HasVnetHdrLen *has_vnet_hdr_len; - UsingVnetHdr *using_vnet_hdr; - SetOffload *set_offload; - SetVnetHdrLen *set_vnet_hdr_len; - SetVnetLE *set_vnet_le; - SetVnetBE *set_vnet_be; -} NetClientInfo; - -struct NetClientState { - NetClientInfo *info; - int link_down; - QTAILQ_ENTRY(NetClientState) next; - NetClientState *peer; - NetQueue *incoming_queue; - char *model; - char *name; - char info_str[256]; - unsigned receive_disabled : 1; - NetClientDestructor *destructor; - unsigned int queue_index; - unsigned rxfilter_notify_enabled:1; - QTAILQ_HEAD(NetFilterHead, NetFilterState) filters; -}; - -typedef struct NICState { - NetClientState *ncs; - NICConf *conf; - void *opaque; - bool peer_deleted; -} NICState; - -char *qemu_mac_strdup_printf(const uint8_t *macaddr); -NetClientState *qemu_find_netdev(const char *id); -int qemu_find_net_clients_except(const char *id, NetClientState **ncs, - NetClientOptionsKind type, int max); -NetClientState *qemu_new_net_client(NetClientInfo *info, - NetClientState *peer, - const char *model, - const char *name); -NICState *qemu_new_nic(NetClientInfo *info, - NICConf *conf, - const char *model, - const char *name, - void *opaque); -void qemu_del_nic(NICState *nic); -NetClientState *qemu_get_subqueue(NICState *nic, int queue_index); -NetClientState *qemu_get_queue(NICState *nic); -NICState *qemu_get_nic(NetClientState *nc); -void *qemu_get_nic_opaque(NetClientState *nc); -void qemu_del_net_client(NetClientState *nc); -NetClientState *qemu_find_vlan_client_by_name(Monitor *mon, int vlan_id, - const char *client_str); -typedef void (*qemu_nic_foreach)(NICState *nic, void *opaque); -void qemu_foreach_nic(qemu_nic_foreach func, void *opaque); -int qemu_can_send_packet(NetClientState *nc); -ssize_t qemu_sendv_packet(NetClientState *nc, const struct iovec *iov, - int iovcnt); -ssize_t qemu_sendv_packet_async(NetClientState *nc, const struct iovec *iov, - int iovcnt, NetPacketSent *sent_cb); -void qemu_send_packet(NetClientState *nc, const uint8_t *buf, int size); -ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int size); -ssize_t qemu_send_packet_async(NetClientState *nc, const uint8_t *buf, - int size, NetPacketSent *sent_cb); -void qemu_purge_queued_packets(NetClientState *nc); -void qemu_flush_queued_packets(NetClientState *nc); -void qemu_format_nic_info_str(NetClientState *nc, uint8_t macaddr[6]); -bool qemu_has_ufo(NetClientState *nc); -bool qemu_has_vnet_hdr(NetClientState *nc); -bool qemu_has_vnet_hdr_len(NetClientState *nc, int len); -void qemu_using_vnet_hdr(NetClientState *nc, bool enable); -void qemu_set_offload(NetClientState *nc, int csum, int tso4, int tso6, - int ecn, int ufo); -void qemu_set_vnet_hdr_len(NetClientState *nc, int len); -int qemu_set_vnet_le(NetClientState *nc, bool is_le); -int qemu_set_vnet_be(NetClientState *nc, bool is_be); -void qemu_macaddr_default_if_unset(MACAddr *macaddr); -int qemu_show_nic_models(const char *arg, const char *const *models); -void qemu_check_nic_model(NICInfo *nd, const char *model); -int qemu_find_nic_model(NICInfo *nd, const char * const *models, - const char *default_model); - -ssize_t qemu_deliver_packet_iov(NetClientState *sender, - unsigned flags, - const struct iovec *iov, - int iovcnt, - void *opaque); - -void print_net_client(Monitor *mon, NetClientState *nc); -void hmp_info_network(Monitor *mon, const QDict *qdict); - -/* NIC info */ - -#define MAX_NICS 8 - -struct NICInfo { - MACAddr macaddr; - char *model; - char *name; - char *devaddr; - NetClientState *netdev; - int used; /* is this slot in nd_table[] being used? */ - int instantiated; /* does this NICInfo correspond to an instantiated NIC? */ - int nvectors; -}; - -extern int nb_nics; -extern NICInfo nd_table[MAX_NICS]; -extern int default_net; -extern const char *host_net_devices[]; - -/* from net.c */ -extern const char *legacy_tftp_prefix; -extern const char *legacy_bootp_filename; - -int net_client_init(QemuOpts *opts, int is_netdev, Error **errp); -int net_client_parse(QemuOptsList *opts_list, const char *str); -int net_init_clients(void); -void net_check_clients(void); -void net_cleanup(void); -void hmp_host_net_add(Monitor *mon, const QDict *qdict); -void hmp_host_net_remove(Monitor *mon, const QDict *qdict); -void netdev_add(QemuOpts *opts, Error **errp); -void qmp_netdev_add(QDict *qdict, QObject **ret, Error **errp); - -int net_hub_id_for_client(NetClientState *nc, int *id); -NetClientState *net_hub_port_find(int hub_id); - -#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" -#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown" -#define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper" -#define DEFAULT_BRIDGE_INTERFACE "br0" - -void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd); - -#define POLYNOMIAL 0x04c11db6 -unsigned compute_mcast_idx(const uint8_t *ep); - -#define vmstate_offset_macaddr(_state, _field) \ - vmstate_offset_array(_state, _field.a, uint8_t, \ - sizeof(typeof_field(_state, _field))) - -#define VMSTATE_MACADDR(_field, _state) { \ - .name = (stringify(_field)), \ - .size = sizeof(MACAddr), \ - .info = &vmstate_info_buffer, \ - .flags = VMS_BUFFER, \ - .offset = vmstate_offset_macaddr(_state, _field), \ -} - -#endif diff --git a/qemu/include/net/queue.h b/qemu/include/net/queue.h deleted file mode 100644 index 5469fdbea..000000000 --- a/qemu/include/net/queue.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2003-2008 Fabrice Bellard - * Copyright (c) 2009 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef QEMU_NET_QUEUE_H -#define QEMU_NET_QUEUE_H - -#include "qemu-common.h" - -typedef struct NetPacket NetPacket; -typedef struct NetQueue NetQueue; - -typedef void (NetPacketSent) (NetClientState *sender, ssize_t ret); - -#define QEMU_NET_PACKET_FLAG_NONE 0 -#define QEMU_NET_PACKET_FLAG_RAW (1<<0) - -/* Returns: - * >0 - success - * 0 - queue packet for future redelivery - * <0 - failure (discard packet) - */ -typedef ssize_t (NetQueueDeliverFunc)(NetClientState *sender, - unsigned flags, - const struct iovec *iov, - int iovcnt, - void *opaque); - -NetQueue *qemu_new_net_queue(NetQueueDeliverFunc *deliver, void *opaque); - -void qemu_net_queue_append_iov(NetQueue *queue, - NetClientState *sender, - unsigned flags, - const struct iovec *iov, - int iovcnt, - NetPacketSent *sent_cb); - -void qemu_del_net_queue(NetQueue *queue); - -ssize_t qemu_net_queue_send(NetQueue *queue, - NetClientState *sender, - unsigned flags, - const uint8_t *data, - size_t size, - NetPacketSent *sent_cb); - -ssize_t qemu_net_queue_send_iov(NetQueue *queue, - NetClientState *sender, - unsigned flags, - const struct iovec *iov, - int iovcnt, - NetPacketSent *sent_cb); - -void qemu_net_queue_purge(NetQueue *queue, NetClientState *from); -bool qemu_net_queue_flush(NetQueue *queue); - -#endif /* QEMU_NET_QUEUE_H */ diff --git a/qemu/include/net/slirp.h b/qemu/include/net/slirp.h deleted file mode 100644 index 64b795cda..000000000 --- a/qemu/include/net/slirp.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * QEMU System Emulator - * - * Copyright (c) 2003-2008 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef QEMU_NET_SLIRP_H -#define QEMU_NET_SLIRP_H - -#include "qemu-common.h" -#include "qapi/qmp/qdict.h" -#include "qemu/option.h" -#include "qapi-types.h" - -#ifdef CONFIG_SLIRP - -void hmp_hostfwd_add(Monitor *mon, const QDict *qdict); -void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict); - -int net_slirp_redir(const char *redir_str); - -int net_slirp_parse_legacy(QemuOptsList *opts_list, const char *optarg, int *ret); - -int net_slirp_smb(const char *exported_dir); - -void hmp_info_usernet(Monitor *mon, const QDict *qdict); - -#endif - -#endif /* QEMU_NET_SLIRP_H */ diff --git a/qemu/include/net/tap.h b/qemu/include/net/tap.h deleted file mode 100644 index 5da4edc69..000000000 --- a/qemu/include/net/tap.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * QEMU System Emulator - * - * Copyright (c) 2003-2008 Fabrice Bellard - * Copyright (c) 2009 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef QEMU_NET_TAP_H -#define QEMU_NET_TAP_H - -#include "qemu-common.h" -#include "qapi-types.h" -#include "standard-headers/linux/virtio_net.h" - -int tap_enable(NetClientState *nc); -int tap_disable(NetClientState *nc); - -int tap_get_fd(NetClientState *nc); - -struct vhost_net; -struct vhost_net *tap_get_vhost_net(NetClientState *nc); - -#endif /* QEMU_NET_TAP_H */ diff --git a/qemu/include/net/vhost-user.h b/qemu/include/net/vhost-user.h deleted file mode 100644 index 85109f63a..000000000 --- a/qemu/include/net/vhost-user.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * vhost-user.h - * - * Copyright (c) 2013 Virtual Open Systems Sarl. - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - * - */ - -#ifndef VHOST_USER_H_ -#define VHOST_USER_H_ - -struct vhost_net; -struct vhost_net *vhost_user_get_vhost_net(NetClientState *nc); - -#endif /* VHOST_USER_H_ */ diff --git a/qemu/include/net/vhost_net.h b/qemu/include/net/vhost_net.h deleted file mode 100644 index 3389b410d..000000000 --- a/qemu/include/net/vhost_net.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef VHOST_NET_H -#define VHOST_NET_H - -#include "net/net.h" -#include "hw/virtio/vhost-backend.h" - -struct vhost_net; -typedef struct vhost_net VHostNetState; - -typedef struct VhostNetOptions { - VhostBackendType backend_type; - NetClientState *net_backend; - void *opaque; -} VhostNetOptions; - -uint64_t vhost_net_get_max_queues(VHostNetState *net); -struct vhost_net *vhost_net_init(VhostNetOptions *options); - -int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, int total_queues); -void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, int total_queues); - -void vhost_net_cleanup(VHostNetState *net); - -uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features); -void vhost_net_ack_features(VHostNetState *net, uint64_t features); - -bool vhost_net_virtqueue_pending(VHostNetState *net, int n); -void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev, - int idx, bool mask); -int vhost_net_notify_migration_done(VHostNetState *net, char* mac_addr); -VHostNetState *get_vhost_net(NetClientState *nc); - -int vhost_set_vring_enable(NetClientState * nc, int enable); -#endif |