target/i386: make cpu_get_fp80()/cpu_set_fp80() static
[qemu/ar7.git] / hw / net / rocker / rocker.h
blob7ae0495d9ec7521c5e7140f117b7f9bd7e6d96e1
1 /*
2 * QEMU rocker switch emulation
4 * Copyright (c) 2014 Scott Feldman <sfeldma@gmail.com>
5 * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
6 * Copyright (c) 2014 Neil Horman <nhorman@tuxdriver.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
19 #ifndef ROCKER_H
20 #define ROCKER_H
22 #include "qemu/sockets.h"
24 #if defined(DEBUG_ROCKER)
25 # define DPRINTF(fmt, ...) \
26 do { \
27 struct timeval tv; \
28 char timestr[64]; \
29 time_t now; \
30 gettimeofday(&tv, NULL); \
31 now = tv.tv_sec; \
32 strftime(timestr, sizeof(timestr), "%T", localtime(&now)); \
33 fprintf(stderr, "%s.%06ld ", timestr, tv.tv_usec); \
34 fprintf(stderr, "ROCKER: " fmt, ## __VA_ARGS__); \
35 } while (0)
36 #else
37 static inline GCC_FMT_ATTR(1, 2) int DPRINTF(const char *fmt, ...)
39 return 0;
41 #endif
43 #define __le16 uint16_t
44 #define __le32 uint32_t
45 #define __le64 uint64_t
47 #define __be16 uint16_t
48 #define __be32 uint32_t
49 #define __be64 uint64_t
51 static inline bool ipv4_addr_is_multicast(__be32 addr)
53 return (addr & htonl(0xf0000000)) == htonl(0xe0000000);
56 typedef struct ipv6_addr {
57 union {
58 uint8_t addr8[16];
59 __be16 addr16[8];
60 __be32 addr32[4];
62 } Ipv6Addr;
64 static inline bool ipv6_addr_is_multicast(const Ipv6Addr *addr)
66 return (addr->addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000);
69 typedef struct rocker Rocker;
70 typedef struct world World;
71 typedef struct desc_info DescInfo;
72 typedef struct desc_ring DescRing;
74 Rocker *rocker_find(const char *name);
75 uint32_t rocker_fp_ports(Rocker *r);
76 int rocker_event_link_changed(Rocker *r, uint32_t pport, bool link_up);
77 int rocker_event_mac_vlan_seen(Rocker *r, uint32_t pport, uint8_t *addr,
78 uint16_t vlan_id);
79 int rx_produce(World *world, uint32_t pport,
80 const struct iovec *iov, int iovcnt, uint8_t copy_to_cpu);
81 int rocker_port_eg(Rocker *r, uint32_t pport,
82 const struct iovec *iov, int iovcnt);
84 #endif /* ROCKER_H */