From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <chaozhu@linux.vnet.ibm.com>
Received: from e23smtp09.au.ibm.com (e23smtp09.au.ibm.com [202.81.31.142])
 by dpdk.org (Postfix) with ESMTP id 157DB7EB0
 for <dev@dpdk.org>; Thu,  4 Dec 2014 11:14:12 +0100 (CET)
Received: from /spool/local
 by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only!
 Violators will be prosecuted
 for <dev@dpdk.org> from <chaozhu@linux.vnet.ibm.com>;
 Thu, 4 Dec 2014 20:14:10 +1000
Received: from d23dlp03.au.ibm.com (202.81.31.214)
 by e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway:
 Authorized Use Only! Violators will be prosecuted; 
 Thu, 4 Dec 2014 20:14:08 +1000
Received: from d23relay06.au.ibm.com (d23relay06.au.ibm.com [9.185.63.219])
 by d23dlp03.au.ibm.com (Postfix) with ESMTP id 2EA273578053
 for <dev@dpdk.org>; Thu,  4 Dec 2014 21:14:08 +1100 (EST)
Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138])
 by d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id
 sB4AE7ft25886832 for <dev@dpdk.org>; Thu, 4 Dec 2014 21:14:08 +1100
Received: from d23av02.au.ibm.com (localhost [127.0.0.1])
 by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id
 sB4AE7CC032346 for <dev@dpdk.org>; Thu, 4 Dec 2014 21:14:07 +1100
Received: from os_controller.crl.ibm.com ([9.186.57.58])
 by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id
 sB4AE5Hw032311 for <dev@dpdk.org>; Thu, 4 Dec 2014 21:14:07 +1100
From: Chao Zhu <chaozhu@linux.vnet.ibm.com>
To: dev@dpdk.org
Date: Thu,  4 Dec 2014 18:14:08 +0800
Message-Id: <1417688048-23076-2-git-send-email-chaozhu@linux.vnet.ibm.com>
X-Mailer: git-send-email 1.7.1
In-Reply-To: <1417688048-23076-1-git-send-email-chaozhu@linux.vnet.ibm.com>
References: <1417688048-23076-1-git-send-email-chaozhu@linux.vnet.ibm.com>
X-TM-AS-MML: disable
X-Content-Scanned: Fidelis XPS MAILER
x-cbid: 14120410-0033-0000-0000-000000AA7D4C
Subject: [dpdk-dev] [PATCH] Fix KNI compiling issue on IBM Power
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 04 Dec 2014 10:14:15 -0000

Because of different cache line size, the alignment of struct
rte_kni_mbuf in rte_kni_common.h doesn't work on IBM Power. This patch
changed from 64 to RTE_CACHE_LINE_SIZE micro to do the alignment.

Signed-off-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
---
 .../linuxapp/eal/include/exec-env/rte_kni_common.h |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
index e548161..6fc6442 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
@@ -67,6 +67,9 @@
  * KNI name is part of memzone name.
  */
 #define RTE_KNI_NAMESIZE 32
+#ifndef RTE_CACHE_LINE_SIZE
+#define RTE_CACHE_LINE_SIZE 64                  /**< Cache line size. */
+#endif
 
 /*
  * Request id.
@@ -108,7 +111,7 @@ struct rte_kni_fifo {
  * Padding is necessary to assure the offsets of these fields
  */
 struct rte_kni_mbuf {
-	void *buf_addr __attribute__((__aligned__(64)));
+	void *buf_addr __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)));
 	char pad0[10];
 	uint16_t data_off;      /**< Start address of data in segment buffer. */
 	char pad1[4];
@@ -118,7 +121,7 @@ struct rte_kni_mbuf {
 	uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
 
 	/* fields on second cache line */
-	char pad3[8] __attribute__((__aligned__(64)));
+	char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)));
 	void *pool;
 	void *next;
 };
-- 
1.7.1