diff mbox

[dpdk-dev,v2] ixgbe: fix icc issue with mbuf initializer

Message ID B6059B2012717B4390714544B1F509E110DC8F6E@SHSMSX103.ccr.corp.intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Cao, Min Nov. 28, 2014, 8:52 a.m. UTC
Tested-by: Min Cao <min.cao@intel.com>

Patch name: 		[dpdk-dev] [PATCH v2] ixgbe: fix icc issue with mbuf initializer
Test Flag: 			Tested-by
Tester name: 		min.cao@intel.com
ICC version:            13.1.2
ICC package:            l_ccompxe_2013.4.183.tgz
Result summary:		total 6 cases, 6 passed, 0 failed

Test Case 1:		
Name:				l2fwd
Environment:		OS: Fedora20 3.11.10-301.fc20.x86_64
				CPU: Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz
				NIC: Fortville eagle/spirit 
Test result(32bit):	PASSED
Test result(64bit):	PASSED

Test Case 2:		
Name:				l3fwd
Environment:		OS: Fedora20 3.11.10-301.fc20.x86_64
				CPU: Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz
				NIC: Fortville eagle/spirit 
Test result(32bit):	PASSED
Test result(64bit):	PASSED
Test Case 3:		
Name:				pmd
Environment:		OS: Fedora20 3.11.10-301.fc20.x86_64
				CPU: Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz
				NIC: Fortville eagle/spirit 
Test result(32bit):	PASSED
Test result(64bit):	PASSED

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bruce Richardson
Sent: Tuesday, November 04, 2014 1:01 AM
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2] ixgbe: fix icc issue with mbuf initializer

When using Intel C++ compiler(icc) 14.0.1.106 or the older icc 13.x
version, the mbuf initializer variable was not getting configured
correctly, as the mb_def variable was not set correctly. This is due
to an issue with icc (DPD200249565 which already been fixed in
icc 14.0.2 and newer compiler release) where it incorrectly calculates
the field offsets with initializers when zero-sized fields
are used in a structure.
To work around this, the code in ixgbe_rxq_vec_setup does not setup the
fields using an initializer, but instead assigns the values individually
in code
NOTE: There is no performance impact to this change as the queue
setup functions are not data-plane APIs, but are only used at app
initialization.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

---
V2 change: use rte_mbuf_refcnt_set to update reference count

---
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
index e813e43..42c0f60 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
@@ -730,16 +730,13 @@  static struct ixgbe_txq_ops vec_txq_ops = {
 int
 ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq)
 {
-	struct rte_mbuf mb_def = {
-		.nb_segs = 1,
-		.data_off = RTE_PKTMBUF_HEADROOM,
-#ifdef RTE_MBUF_REFCNT
-		{ .refcnt = 1, }
-#endif
-	};
+	struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
 
+	mb_def.nb_segs = 1;
+	mb_def.data_off = RTE_PKTMBUF_HEADROOM;
 	mb_def.buf_len = rxq->mb_pool->elt_size - sizeof(struct rte_mbuf);
 	mb_def.port = rxq->port_id;
+	rte_mbuf_refcnt_set(&mb_def, 1);
 	rxq->mbuf_initializer = *((uint64_t *)&mb_def.rearm_data);
 	return 0;
 }