From patchwork Wed May 4 18:41:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Duyck, Alexander H" X-Patchwork-Id: 94105 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 85CD1B6F6C for ; Thu, 5 May 2011 04:41:47 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752986Ab1EDSln (ORCPT ); Wed, 4 May 2011 14:41:43 -0400 Received: from mga01.intel.com ([192.55.52.88]:29787 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751158Ab1EDSlm (ORCPT ); Wed, 4 May 2011 14:41:42 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 04 May 2011 11:41:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.64,315,1301900400"; d="scan'208";a="918033671" Received: from gitlad.jf.intel.com ([10.23.23.37]) by fmsmga001.fm.intel.com with ESMTP; 04 May 2011 11:41:42 -0700 Received: from gitlad.jf.intel.com (gitlad.jf.intel.com [127.0.0.1]) by gitlad.jf.intel.com (8.14.2/8.14.2) with ESMTP id p44IfeEP026468; Wed, 4 May 2011 11:41:40 -0700 From: Alexander Duyck Subject: [ethtool PATCH 2/4] Cleanup defines and header includes to address several issues To: davem@davemloft.net, jeffrey.t.kirsher@intel.com, dm@chelsio.com, bhutchings@solarflare.com Cc: netdev@vger.kernel.org Date: Wed, 04 May 2011 11:41:40 -0700 Message-ID: <20110504184140.26394.50230.stgit@gitlad.jf.intel.com> In-Reply-To: <20110504183752.26394.29231.stgit@gitlad.jf.intel.com> References: <20110504183752.26394.29231.stgit@gitlad.jf.intel.com> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- ethtool-util.h | 17 +++++++++++++++-- ethtool.c | 17 +---------------- 2 files changed, 16 insertions(+), 18 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 #include +#include +#include /* ethtool.h expects these to be defined by */ #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, diff --git a/ethtool.c b/ethtool.c index 9ad7000..24d4e4f 100644 --- a/ethtool.c +++ b/ethtool.c @@ -21,19 +21,12 @@ * * show settings for all devices */ -#ifdef HAVE_CONFIG_H -# include "ethtool-config.h" -#endif - -#include +#include "ethtool-util.h" #include #include -#include -#include #include #include #include -#include #include #include #include @@ -43,18 +36,10 @@ #include #include -#include "ethtool-util.h" - -#ifndef SIOCETHTOOL -#define SIOCETHTOOL 0x8946 -#endif #ifndef MAX_ADDR_LEN #define MAX_ADDR_LEN 32 #endif -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#endif #ifndef HAVE_NETIF_MSG enum {