From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com
 [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 498364C99
 for <dev@dpdk.org>; Fri, 26 Oct 2018 23:40:28 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id DE35321E71;
 Fri, 26 Oct 2018 17:40:27 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute1.internal (MEProxy); Fri, 26 Oct 2018 17:40:27 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:mime-version:content-type
 :content-transfer-encoding; s=mesmtp; bh=tF0VPvMD5Tz/rqaK81PiL/e
 m4dMoQCgkzpMxi4YxhzA=; b=e6aALWhjr+k4JI2OU7jsu5UaQk4y485y2o92VD/
 CslokdoUekxfRCO0n0WbZ7H6c9Q/lERejuUj+b/eEgFTQ5ijqT7MJgOExfZ75lMs
 vPYx4IsjYt6d4634kWgQIRfY81f347GJCOqxZPls77DeFZUCySn8MEIl0BbpOoHS
 3ef0=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:message-id:mime-version:subject:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=tF0VPv
 MD5Tz/rqaK81PiL/em4dMoQCgkzpMxi4YxhzA=; b=pp849v508+hRDUREvT3X3M
 r04kaSFLI2BuVHaAhOvUhqseAYi5MrtH3mpkDQ1DrFlpia1SvfoVotE06B+3Tcjw
 1B0qWX8obm8AuJv75o9jI+t32TIfHs0RPramdq+/kUSRU3Q0hnUaE3pdAqcW2Nkh
 REU6hRunHC7k71bdRs7iTezAMEkSLuSs9dtHBOwd7p3NI+2WYafGC//XHyvH7JO9
 UfCUcZ1W0ul7Fhxhp7tE+mDPPRX2StwnjSHQKrZuB29tHMKvjTQa+Z+BdqAI8BkT
 0Tl2nkB1Ak+T4VR18CVFE2f425W1CDG4qdhCHp5T0z5lmvAV3dzBUmINRHSsv4Ew
 ==
X-ME-Sender: <xms:y4nTW3kEo8-EiKIVCIcerqWxVE2Q8cquz62BueefPost9LRIZ1oDzA>
X-ME-Proxy: <xmx:y4nTW2fVIqEN3dj3KI8YKsUj9nRIVBsT_I-3M5DfS06Tqzdi5kD00Q>
 <xmx:y4nTWw_D1HiNsfcDAg229ELq5xfU0qNHehu5TMpvC4LwwGaNq0Ks7g>
 <xmx:y4nTW5VVII0XccY1FlSRLL4xFhjLy6i5GsdYEjrYE1jen1OT23AStw>
 <xmx:y4nTW6Q9b6D3iFyxsf5YvfVZ9fI72nCD3USdCHbttXimyZWgh82gIA>
 <xmx:y4nTW93xhfMgkibsMykQwuPFvbX1TLO4BQbTCULP01waU24iDQeWRA>
 <xmx:y4nTW72TlIe4_i4_BPcc0KhNMljvaVypY5TxqaPbxcESN20NKp4QXw>
Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id C13A6102EC;
 Fri, 26 Oct 2018 17:40:26 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org,
	phil.yang@arm.com,
	gavin.hu@arm.com
Date: Fri, 26 Oct 2018 23:40:27 +0200
Message-Id: <20181026214027.29465-1-thomas@monjalon.net>
X-Mailer: git-send-email 2.19.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH] kni: fix build on Linux < 3.14
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 26 Oct 2018 21:40:28 -0000

The atomic functions smp_load_acquire() and smp_store_release()
were introduced in Linux 3.14. Older kernels miss the functions:

kni_fifo.h:19:2: error:
	implicit declaration of function ‘smp_load_acquire’
kni_fifo.h:30:2: error:
	implicit declaration of function ‘smp_store_release’

The fallback is to drop the atomic barrier, as it was before
the commit below.

Fixes: 711859cd0d07 ("kni: fix kernel FIFO synchronization")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 kernel/linux/kni/kni_fifo.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/linux/kni/kni_fifo.h b/kernel/linux/kni/kni_fifo.h
index 2cb3a4a7b..3c0be311f 100644
--- a/kernel/linux/kni/kni_fifo.h
+++ b/kernel/linux/kni/kni_fifo.h
@@ -8,6 +8,13 @@
 
 #include <exec-env/rte_kni_common.h>
 
+#ifndef smp_load_acquire
+#define smp_load_acquire(a) (*(a))
+#endif
+#ifndef smp_store_release
+#define smp_store_release(a, b) *(a) = (b)
+#endif
+
 /**
  * Adds num elements into the fifo. Return the number actually written
  */
-- 
2.19.0