summaryrefslogtreecommitdiff
path: root/ethtool-util.h
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2011-05-04 11:41:40 -0700
committerBen Hutchings <bhutchings@solarflare.com>2011-05-13 01:04:58 +0100
commit8a7c0708b6fb7be245c21e9f6aabb0d8fd968a03 (patch)
tree688afc9d16112e07040948e5834d59fa9f933042 /ethtool-util.h
parent00b20bcd0d2ec976941783a160d9f3cb3ddfa361 (diff)
downloadethtool-8a7c0708b6fb7be245c21e9f6aabb0d8fd968a03.tar.gz
Cleanup defines and header includes to address several issues
This change is meant to address several issues. First it moves the check for ethtool-config.h into ethtool-util.h the reason for this change is so that any references to ethtool-util.h outside of ethtool.c will use the correct defines for the endian types. In addition I have pulled several headers that will be common to both ethtool.c and rxclass.c into the ethtool-util.h header file. I am also centralizing several macros that will be needed across multiple files when I implement the network flow classifier rules. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'ethtool-util.h')
-rw-r--r--ethtool-util.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/ethtool-util.h b/ethtool-util.h
index f053028..6a4f3f4 100644
--- a/ethtool-util.h
+++ b/ethtool-util.h
@@ -3,8 +3,13 @@
#ifndef ETHTOOL_UTIL_H__
#define ETHTOOL_UTIL_H__
+#ifdef HAVE_CONFIG_H
+#include "ethtool-config.h"
+#endif
#include <sys/types.h>
#include <endian.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
/* ethtool.h expects these to be defined by <linux/types.h> */
#ifndef HAVE_BE_TYPES
@@ -12,14 +17,14 @@ typedef __uint16_t __be16;
typedef __uint32_t __be32;
#endif
-#include "ethtool-copy.h"
-
typedef unsigned long long u64;
typedef __uint32_t u32;
typedef __uint16_t u16;
typedef __uint8_t u8;
typedef __int32_t s32;
+#include "ethtool-copy.h"
+
#if __BYTE_ORDER == __BIG_ENDIAN
static inline u16 cpu_to_be16(u16 value)
{
@@ -40,6 +45,14 @@ static inline u32 cpu_to_be32(u32 value)
}
#endif
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
+#ifndef SIOCETHTOOL
+#define SIOCETHTOOL 0x8946
+#endif
+
/* National Semiconductor DP83815, DP83816 */
int natsemi_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
int natsemi_dump_eeprom(struct ethtool_drvinfo *info,