AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec, struct stat.st_mtimensec],
[], [], [[#include <sys/stat.h>]])
AC_CHECK_FUNCS([mlockall strnlen strsignal getloadavg statvfs setmntent])
-AC_CHECK_HEADERS([mntent.h sys/statvfs.h])
+AC_CHECK_HEADERS([mntent.h sys/statvfs.h linux/types.h])
OVS_CHECK_PKIDIR
OVS_CHECK_RUNDIR
+include include/linux/automake.mk
include include/openflow/automake.mk
include include/openvswitch/automake.mk
include include/sparse/automake.mk
--- /dev/null
+noinst_HEADERS += include/linux/types.h
--- /dev/null
+/*
+ * Copyright (c) 2011 Nicira Networks.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LINUX_TYPES_H
+#define LINUX_TYPES_H 1
+
+/* On Linux, this header file just includes <linux/types.h>.
+ *
+ * On other platforms, this header file implements just enough of
+ * <linux/types.h> to allow datapath-protocol.h to work, that is, it defines
+ * the __u<N> and __be<N> types. */
+
+#if __KERNEL__ || HAVE_LINUX_TYPES_H
+#include_next <linux/types.h>
+#else /* no <linux/types.h> */
+#include <stdint.h>
+
+#ifdef __CHECKER__
+#define __bitwise__ __attribute__((bitwise))
+#else
+#define __bitwise__
+#endif
+
+typedef uint8_t __u8;
+typedef uint16_t __u16;
+typedef uint32_t __u32;
+typedef uint64_t __u64;
+
+typedef uint16_t __bitwise__ __be16;
+typedef uint32_t __bitwise__ __be32;
+typedef uint64_t __bitwise__ __be64;
+#endif /* no <linux/types.h> */
+
+#endif /* <linux/types.h> */
#ifndef OPENVSWITCH_DATAPATH_PROTOCOL_H
#define OPENVSWITCH_DATAPATH_PROTOCOL_H 1
-#ifdef __KERNEL__
#include <linux/types.h>
-#define ovs_be16 __be16
-#define ovs_be32 __be32
-#define ovs_be64 __be64
-#else
-#include "openvswitch/types.h"
-#endif
-\f
+
/* datapaths. */
#define OVS_DATAPATH_FAMILY "ovs_datapath"
};
struct ovs_dp_stats {
- uint64_t n_frags; /* Number of dropped IP fragments. */
- uint64_t n_hit; /* Number of flow table matches. */
- uint64_t n_missed; /* Number of flow table misses. */
- uint64_t n_lost; /* Number of misses not sent to userspace. */
- uint64_t n_flows; /* Number of flows present */
+ __u64 n_frags; /* Number of dropped IP fragments. */
+ __u64 n_hit; /* Number of flow table matches. */
+ __u64 n_missed; /* Number of flow table misses. */
+ __u64 n_lost; /* Number of misses not sent to userspace. */
+ __u64 n_flows; /* Number of flows present */
};
struct ovs_vport_stats {
- uint64_t rx_packets; /* total packets received */
- uint64_t tx_packets; /* total packets transmitted */
- uint64_t rx_bytes; /* total bytes received */
- uint64_t tx_bytes; /* total bytes transmitted */
- uint64_t rx_errors; /* bad packets received */
- uint64_t tx_errors; /* packet transmit problems */
- uint64_t rx_dropped; /* no space in linux buffers */
- uint64_t tx_dropped; /* no space available in linux */
+ __u64 rx_packets; /* total packets received */
+ __u64 tx_packets; /* total packets transmitted */
+ __u64 rx_bytes; /* total bytes received */
+ __u64 tx_bytes; /* total bytes transmitted */
+ __u64 rx_errors; /* bad packets received */
+ __u64 tx_errors; /* packet transmit problems */
+ __u64 rx_dropped; /* no space in linux buffers */
+ __u64 tx_dropped; /* no space available in linux */
};
/* Logical ports. */
-#define OVSP_LOCAL ((uint16_t)0)
+#define OVSP_LOCAL ((__u16)0)
\f
#define OVS_PACKET_FAMILY "ovs_packet"
};
struct ovs_flow_stats {
- uint64_t n_packets; /* Number of matched packets. */
- uint64_t n_bytes; /* Number of matched bytes. */
+ __u64 n_packets; /* Number of matched packets. */
+ __u64 n_bytes; /* Number of matched bytes. */
};
enum ovs_key_attr {
#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
struct ovs_key_ethernet {
- uint8_t eth_src[6];
- uint8_t eth_dst[6];
+ __u8 eth_src[6];
+ __u8 eth_dst[6];
};
struct ovs_key_8021q {
- ovs_be16 q_tpid;
- ovs_be16 q_tci;
+ __be16 q_tpid;
+ __be16 q_tci;
};
struct ovs_key_ipv4 {
- ovs_be32 ipv4_src;
- ovs_be32 ipv4_dst;
- uint8_t ipv4_proto;
- uint8_t ipv4_tos;
+ __be32 ipv4_src;
+ __be32 ipv4_dst;
+ __u8 ipv4_proto;
+ __u8 ipv4_tos;
};
struct ovs_key_ipv6 {
- ovs_be32 ipv6_src[4];
- ovs_be32 ipv6_dst[4];
- uint8_t ipv6_proto;
- uint8_t ipv6_tos;
+ __be32 ipv6_src[4];
+ __be32 ipv6_dst[4];
+ __u8 ipv6_proto;
+ __u8 ipv6_tos;
};
struct ovs_key_tcp {
- ovs_be16 tcp_src;
- ovs_be16 tcp_dst;
+ __be16 tcp_src;
+ __be16 tcp_dst;
};
struct ovs_key_udp {
- ovs_be16 udp_src;
- ovs_be16 udp_dst;
+ __be16 udp_src;
+ __be16 udp_dst;
};
struct ovs_key_icmp {
- uint8_t icmp_type;
- uint8_t icmp_code;
+ __u8 icmp_type;
+ __u8 icmp_code;
};
struct ovs_key_icmpv6 {
- uint8_t icmpv6_type;
- uint8_t icmpv6_code;
+ __u8 icmpv6_type;
+ __u8 icmpv6_code;
};
struct ovs_key_arp {
- ovs_be32 arp_sip;
- ovs_be32 arp_tip;
- ovs_be16 arp_op;
- uint8_t arp_sha[6];
- uint8_t arp_tha[6];
+ __be32 arp_sip;
+ __be32 arp_tip;
+ __be16 arp_op;
+ __u8 arp_sha[6];
+ __u8 arp_tha[6];
};
struct ovs_key_nd {
- uint32_t nd_target[4];
- uint8_t nd_sll[6];
- uint8_t nd_tll[6];
+ __u32 nd_target[4];
+ __u8 nd_sll[6];
+ __u8 nd_tll[6];
};
/**
#ifndef OPENVSWITCH_TYPES_H
#define OPENVSWITCH_TYPES_H 1
+#include <linux/types.h>
#include <sys/types.h>
#include <stdint.h>
/* The ovs_be<N> types indicate that an object is in big-endian, not
* native-endian, byte order. They are otherwise equivalent to uint<N>_t.
*
- * The OVS_BITWISE annotation allows the sparse checker to issue warnings
- * for incorrect use of values in network byte order. */
-typedef uint16_t OVS_BITWISE ovs_be16;
-typedef uint32_t OVS_BITWISE ovs_be32;
-typedef uint64_t OVS_BITWISE ovs_be64;
+ * We bootstrap these from the Linux __be<N> types. If we instead define our
+ * own independently then __be<N> and ovs_be<N> become mutually
+ * incompatible. */
+typedef __be16 ovs_be16;
+typedef __be32 ovs_be32;
+typedef __be64 ovs_be64;
\f
/* Netlink and OpenFlow both contain 64-bit values that are only guaranteed to
* be aligned on 32-bit boundaries. These types help.
#define DPIF_LINUX_H 1
#include <stdbool.h>
+#include <stddef.h>
#include <stdint.h>
#include "openvswitch/datapath-protocol.h"