From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by dpdk.org (Postfix) with ESMTP id 54BA61F3 for ; Fri, 13 Sep 2013 16:14:00 +0200 (CEST) Received: by mail-wi0-f178.google.com with SMTP id hn9so876010wib.5 for ; Fri, 13 Sep 2013 07:14:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:in-reply-to:references:mime-version:content-type :content-transfer-encoding; bh=6jaIoS7tTHFipBszZeqicgdchUSVtzcVJGlxg18rJ84=; b=SbpEO+y9Pgg6GkGxVJs+fZf6GagF0fqy2KB6+i01SeaCPaiRsgPm84aPU3xn5+wO04 ygv+Gj1tyzWx9MXnZU2titr1YhN4fEfUUbsCiUQmbSs9qBND9ADJdsmeQ3zXrDSXB0Li o1sTOlJc9ZZjyCBcUIAPUWj+5JUflC85Cad53KKhfsXzLRVt+WL9Vdn0aZKr7BMIpTHI Ka+Xr2qzqzjfR/5jdZNFyMMB0I43IA8fM3AhvO2skCoVDOeCG5FPSeBDTYwh1qNDVvuQ 8UKfXYn2REgmuPJWcUUr2KA+Hcw2jab9zlwzlwoV4jYJZK4ToDvnbIeJoTL0R556+wfK amqg== X-Gm-Message-State: ALoCoQmrN76H6ZmIEhZTIFH2e4fQGyWt8hsz1RddZu8js+64u8y7BWdw7HGfpAhdquSgMOMJdhk8 X-Received: by 10.194.23.8 with SMTP id i8mr518006wjf.68.1379081677413; Fri, 13 Sep 2013 07:14:37 -0700 (PDT) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id q5sm3882872wiz.3.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 07:14:37 -0700 (PDT) Received: by 6wind.com (sSMTP sendmail emulation); Fri, 13 Sep 2013 16:14:35 +0200 From: Thomas Monjalon To: dev@dpdk.org Date: Fri, 13 Sep 2013 16:14:28 +0200 Message-Id: <1e0608ec75e16d14fcc549f6d4fbf218b05cd796.1379081595.git.thomas.monjalon@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 2/4] kni: fix build with kernel 3.9 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 14:14:00 -0000 hlist API has changes. See Linux commit b67bfe0d42cac56c512dd5da4b1b347a23f4b70a. Signed-off-by: Thomas Monjalon Tested-by: David Nyström Acked-by: Nicolas Dichtel --- .../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c | 12 +++--- .../linuxapp/kni/ethtool/ixgbe/kcompat.h | 39 +++++++++++++------- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c index 11472bd..fcff294 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c +++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c @@ -2294,13 +2294,13 @@ static int ixgbe_get_ethtool_fdir_entry(struct ixgbe_adapter *adapter, union ixgbe_atr_input *mask = &adapter->fdir_mask; struct ethtool_rx_flow_spec *fsp = (struct ethtool_rx_flow_spec *)&cmd->fs; - struct hlist_node *node, *node2; + struct hlist_node *node; struct ixgbe_fdir_filter *rule = NULL; /* report total rule count */ cmd->data = (1024 << adapter->fdir_pballoc) - 2; - hlist_for_each_entry_safe(rule, node, node2, + hlist_for_each_entry_safe(rule, node, &adapter->fdir_filter_list, fdir_node) { if (fsp->location <= rule->sw_idx) break; @@ -2361,14 +2361,14 @@ static int ixgbe_get_ethtool_fdir_all(struct ixgbe_adapter *adapter, struct ethtool_rxnfc *cmd, u32 *rule_locs) { - struct hlist_node *node, *node2; + struct hlist_node *node; struct ixgbe_fdir_filter *rule; int cnt = 0; /* report total rule count */ cmd->data = (1024 << adapter->fdir_pballoc) - 2; - hlist_for_each_entry_safe(rule, node, node2, + hlist_for_each_entry_safe(rule, node, &adapter->fdir_filter_list, fdir_node) { if (cnt == cmd->rule_cnt) return -EMSGSIZE; @@ -2464,14 +2464,14 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter, u16 sw_idx) { struct ixgbe_hw *hw = &adapter->hw; - struct hlist_node *node, *node2, *parent; + struct hlist_node *node, *parent; struct ixgbe_fdir_filter *rule; int err = -EINVAL; parent = NULL; rule = NULL; - hlist_for_each_entry_safe(rule, node, node2, + hlist_for_each_entry_safe(rule, node, &adapter->fdir_filter_list, fdir_node) { /* hash found, or no matching entry */ if (rule->sw_idx >= sw_idx) diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h index 6ac890a..925beeb 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h +++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h @@ -1213,19 +1213,6 @@ static inline void INIT_HLIST_NODE(struct hlist_node *h) h->next = NULL; h->pprev = NULL; } -#define hlist_entry(ptr, type, member) container_of(ptr,type,member) - -#define hlist_for_each_entry(tpos, pos, head, member) \ - for (pos = (head)->first; \ - pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) - -#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ - for (pos = (head)->first; \ - pos && ({ n = pos->next; 1; }) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = n) #ifndef might_sleep #define might_sleep() @@ -3106,4 +3093,30 @@ typedef netdev_features_t kni_netdev_features_t; #else #define HAVE_FDB_OPS #endif /* < 3.5.0 */ + +/*****************************************************************************/ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) ) + +#undef hlist_entry +#define hlist_entry(ptr, type, member) \ + container_of(ptr,type,member) + +#undef hlist_entry_safe +#define hlist_entry_safe(ptr, type, member) \ + (ptr) ? hlist_entry(ptr, type, member) : NULL + +#undef hlist_for_each_entry +#define hlist_for_each_entry(pos, head, member) \ + for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \ + pos; \ + pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) + +#undef hlist_for_each_entry_safe +#define hlist_for_each_entry_safe(pos, n, head, member) \ + for (pos = hlist_entry_safe((head)->first, typeof(*pos), member); \ + pos && ({ n = pos->member.next; 1; }); \ + pos = hlist_entry_safe(n, typeof(*pos), member)) + +#endif /* < 3.9.0 */ + #endif /* _KCOMPAT_H_ */ -- 1.7.10.4