DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/4] kni: fix build with kernel 3.9
Date: Mon, 29 Jul 2013 14:44:53 +0200	[thread overview]
Message-ID: <97597bb012c4142e522f2e127b8e10dd3b59f331.1375101416.git.thomas.monjalon@6wind.com> (raw)
In-Reply-To: <cover.1375101416.git.thomas.monjalon@6wind.com>
In-Reply-To: <cover.1375101416.git.thomas.monjalon@6wind.com>

hlist API has changes.
See Linux commit b67bfe0d42cac56c512dd5da4b1b347a23f4b70a.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 .../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

  parent reply	other threads:[~2013-07-29 12:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 12:44 [dpdk-dev] [PATCH 0/4] build fixes for recent distros Thomas Monjalon
2013-07-29 12:44 ` [dpdk-dev] [PATCH 1/4] kni: fix build with kernel 3.8 Thomas Monjalon
2013-09-12 15:30   ` Nicolas Dichtel
2013-07-29 12:44 ` Thomas Monjalon [this message]
2013-09-12 15:34   ` [dpdk-dev] [PATCH 2/4] kni: fix build with kernel 3.9 Nicolas Dichtel
2013-09-16 13:09     ` Thomas Monjalon
2013-07-29 12:44 ` [dpdk-dev] [PATCH 3/4] kni: fix build with kernel 3.10 Thomas Monjalon
2013-09-12 16:09   ` Nicolas Dichtel
2013-09-16 13:09     ` Thomas Monjalon
2013-07-29 12:44 ` [dpdk-dev] [PATCH 4/4] app: fix build with gcc 4.8 Thomas Monjalon
2013-09-12 15:59   ` Nicolas Dichtel
2013-09-13 14:14 ` [dpdk-dev] [PATCH v2 0/4] build fixes for recent distros Thomas Monjalon
2013-09-13 14:14   ` [dpdk-dev] [PATCH v2 1/4] kni: fix build with kernel 3.8 Thomas Monjalon
2013-09-16 11:21     ` Nicolas Dichtel
2013-09-13 14:14   ` [dpdk-dev] [PATCH v2 2/4] kni: fix build with kernel 3.9 Thomas Monjalon
2013-09-13 14:14   ` [dpdk-dev] [PATCH v2 3/4] kni: fix build with kernel 3.10 Thomas Monjalon
2013-09-13 14:14   ` [dpdk-dev] [PATCH v2 4/4] app: fix build with gcc 4.8 Thomas Monjalon
2013-09-16 11:22     ` Nicolas Dichtel
2013-09-16 13:10       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97597bb012c4142e522f2e127b8e10dd3b59f331.1375101416.git.thomas.monjalon@6wind.com \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).