X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_ethernet.h;h=b141a59debd6f95f026717f297d5879ab8fbeb4a;hb=2f4952e76f4fadb1abd32626b57b6d9b272003cc;hp=6c879dc938684b2c589116e78c621e0909df97bb;hpb=fdb16aa5e99a19a91264ae84beaf77d3036548d5;p=palacios.git diff --git a/palacios/include/palacios/vmm_ethernet.h b/palacios/include/palacios/vmm_ethernet.h index 6c879dc..b141a59 100644 --- a/palacios/include/palacios/vmm_ethernet.h +++ b/palacios/include/palacios/vmm_ethernet.h @@ -20,18 +20,34 @@ #ifndef __ETHERNET_H__ #define __ETHERNET_H__ +#include + #define ETHERNET_HEADER_LEN 14 #define ETHERNET_MTU 1500 #define ETHERNET_PACKET_LEN (ETHERNET_HEADER_LEN + ETHERNET_MTU) #define ETH_ALEN 6 #define MIN_MTU 68 -#define MAX_MTU 65535 +#define MAX_MTU 65536 -#define MAX_PACKET_LEN (ETHERNET_HEADER_LEN + MAX_MTU) +#define MAX_PACKET_LEN (MAX_MTU + ETHERNET_HEADER_LEN) +#ifdef V3_CONFIG_VNET +extern int net_debug; +#endif -extern int v3_net_debug; +struct nic_statistics { + uint64_t tx_pkts; + uint64_t tx_bytes; + uint64_t tx_dropped; + + uint64_t rx_pkts; + uint64_t rx_bytes; + uint64_t rx_dropped; + + uint32_t tx_interrupts; + uint32_t rx_interrupts; +}; #ifdef __V3VEE__ @@ -39,7 +55,7 @@ extern int v3_net_debug; #define V3_Net_Print(level, fmt, args...) \ do { \ - if(level <= v3_net_debug) { \ + if(level <= net_debug) { \ extern struct v3_os_hooks * os_hooks; \ if ((os_hooks) && (os_hooks)->print) { \ (os_hooks)->print((fmt), ##args); \ @@ -47,19 +63,7 @@ extern int v3_net_debug; } \ } while (0) -struct nic_statistics { - uint64_t tx_pkts; - uint64_t tx_bytes; - uint64_t tx_dropped; - - uint64_t rx_pkts; - uint64_t rx_bytes; - uint64_t rx_dropped; - uint32_t tx_interrupts; - uint32_t rx_interrupts; -}; - static inline int is_multicast_ethaddr(const uint8_t * addr) { V3_ASSERT(ETH_ALEN == 6); @@ -98,9 +102,10 @@ static inline int compare_ether_hdr(const uint8_t * hdr1, const uint8_t * hdr2) /* AA:BB:CC:DD:EE:FF */ static inline int str2mac(char * macstr, uint8_t * mac){ - char hex[2], *s = macstr; + char hex[3], *s = macstr; int i = 0; + hex[2] = 0; while(s){ memcpy(hex, s, 2); mac[i++] = (char)atox(hex);