diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2011-05-04 11:41:46 -0700 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2011-05-13 01:04:59 +0100 |
commit | 9a7baa6c15344dee34d5a9dd0308dc43fc29c488 (patch) | |
tree | 918662021bbc43c575b1f20b3a83f337e20e1a26 /ethtool-util.h | |
parent | 8a7c0708b6fb7be245c21e9f6aabb0d8fd968a03 (diff) | |
download | ethtool-9a7baa6c15344dee34d5a9dd0308dc43fc29c488.tar.gz |
Add support for __be64 and bitops, centralize several needed macros
This change is meant to add support for __be64 values and bitops to
ethtool. In addition the patch pulls the SIOCETHTOOL define and the
ARRAY_SIZE define into ethtool-util.h for later use by the rxclass files.
These changes will be needed in order to support network flow
classifier rule configuration.
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.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ethtool-util.h b/ethtool-util.h index 6a4f3f4..d8b621c 100644 --- a/ethtool-util.h +++ b/ethtool-util.h @@ -15,6 +15,7 @@ #ifndef HAVE_BE_TYPES typedef __uint16_t __be16; typedef __uint32_t __be32; +typedef unsigned long long __be64; #endif typedef unsigned long long u64; @@ -28,11 +29,15 @@ typedef __int32_t s32; #if __BYTE_ORDER == __BIG_ENDIAN static inline u16 cpu_to_be16(u16 value) { - return value; + return value; } static inline u32 cpu_to_be32(u32 value) { - return value; + return value; +} +static inline u64 cpu_to_be64(u64 value) +{ + return value; } #else static inline u16 cpu_to_be16(u16 value) @@ -43,8 +48,15 @@ static inline u32 cpu_to_be32(u32 value) { return cpu_to_be16(value >> 16) | (cpu_to_be16(value) << 16); } +static inline u64 cpu_to_be64(u64 value) +{ + return cpu_to_be32(value >> 32) | ((u64)cpu_to_be32(value) << 32); +} #endif +#define ntohll cpu_to_be64 +#define htonll cpu_to_be64 + #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #endif |