From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id A0B3F5946 for ; Mon, 29 Jul 2013 14:44:42 +0200 (CEST) Received: by mail-wg0-f47.google.com with SMTP id j13so4758928wgh.2 for ; Mon, 29 Jul 2013 05:45:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=dGAlOEAYMsDWd01zuRzjCasoyQcvKZ9mNbvxgBxSv8s=; b=JyEaheekU52XjRxw9w74o7DR8iEAH6rLAaQTdcgdKi05UuW0qzWNhGxUK5fx6+Orcg PBWlC/z9sBGZiyZzqaQ0TLv1r6kZBKPXp++vL9uetyG/M1C1vEHDjHBC/AqfqqzUakgt 5z1+rnFZ7ZqVGP/B98+/E7efIov5xhXZ1yBlyHXBEBY/Ublq9laFIAwGkV8vCDv3BpId SaHJjTtlAIXdzU5RbuVApWzG1wpnqkQbnyvQ+gddjs7Ypxd7uCJ5jed4ROsl2NYs7gq0 CQUSueiB93f4aqkL/D0nnHfsSx96lDZvMG+xYwJzPNYI/QbZuBlsRh+a+yFgYVIndZlb dAjg== X-Received: by 10.180.73.103 with SMTP id k7mr7061938wiv.24.1375101906304; Mon, 29 Jul 2013 05:45:06 -0700 (PDT) Received: from 6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id hb2sm22277360wib.0.2013.07.29.05.45.03 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 29 Jul 2013 05:45:05 -0700 (PDT) Received: by 6wind.com (sSMTP sendmail emulation); Mon, 29 Jul 2013 14:45:02 +0200 From: Thomas Monjalon To: dev@dpdk.org Date: Mon, 29 Jul 2013 14:44:53 +0200 Message-Id: <97597bb012c4142e522f2e127b8e10dd3b59f331.1375101416.git.thomas.monjalon@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQmh4a6SGG0YQ+QxH5oddqiGrdg7SGp+TpX3dcBW+4AA4CV/9cKlwQhoKcmlAObcDzz6pi3H Subject: [dpdk-dev] [PATCH 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: Mon, 29 Jul 2013 12:44:43 -0000 hlist API has changes. See Linux commit b67bfe0d42cac56c512dd5da4b1b347a23f4b70a. Signed-off-by: Thomas Monjalon --- .../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