From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id E1E18A0096
	for <public@inbox.dpdk.org>; Mon,  8 Apr 2019 16:22:34 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id AF6A24F98;
	Mon,  8 Apr 2019 16:22:34 +0200 (CEST)
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id C5E2C2C24;
 Mon,  8 Apr 2019 16:22:29 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 08 Apr 2019 07:22:29 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,325,1549958400"; d="scan'208";a="147494678"
Received: from silpixa00399752.ir.intel.com (HELO
 silpixa00399752.ger.corp.intel.com) ([10.237.222.212])
 by FMSMGA003.fm.intel.com with ESMTP; 08 Apr 2019 07:22:28 -0700
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org,
	stable@dpdk.org
Date: Mon,  8 Apr 2019 15:22:26 +0100
Message-Id: <20190408142226.88179-1-ferruh.yigit@intel.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] [PATCH] kni: fix build for ndo_fdb_add in Linux 5.1
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Build error seen with Linux kernel 5.1 and
when CONFIG_RTE_KNI_KMOD_ETHTOOL is enabled.

Build error:
.../dpdk/build/build/kernel/linux/kni/igb_main.c:2352:18:
  error: initialization of ... from incompatible pointer type ...
  [-Werror=incompatible-pointer-types]
    .ndo_fdb_add  = igb_ndo_fdb_add,
                      ^~~~~~~~~~~~~~~

ndo_fdb_add() is changed in Linux kernel version 5.1 and now requires
a new parameter, 'struct netlink_ext_ack *extack':
Linux Commit 87b0984ebfab ("net: Add extack argument to ndo_fdb_add()")

ndo_fdb_add() parameter updated with compile time Linux kernel version
check.

Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 kernel/linux/kni/ethtool/igb/igb_main.c | 6 ++++++
 kernel/linux/kni/ethtool/igb/kcompat.h  | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/kernel/linux/kni/ethtool/igb/igb_main.c b/kernel/linux/kni/ethtool/igb/igb_main.c
index 0b4faeae5..cda2b063d 100644
--- a/kernel/linux/kni/ethtool/igb/igb_main.c
+++ b/kernel/linux/kni/ethtool/igb/igb_main.c
@@ -2112,7 +2112,13 @@ static int igb_ndo_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 #ifdef HAVE_NDO_FDB_ADD_VID
 			   u16 vid,
 #endif
+#ifdef HAVE_NDO_FDB_ADD_EXTACK
+			   u16 flags,
+			   struct netlink_ext_ack *extack)
+#else
 			   u16 flags)
+#endif
+
 #else
 static int igb_ndo_fdb_add(struct ndmsg *ndm,
 			   struct net_device *dev,
diff --git a/kernel/linux/kni/ethtool/igb/kcompat.h b/kernel/linux/kni/ethtool/igb/kcompat.h
index 11b15f3a9..649a69c81 100644
--- a/kernel/linux/kni/ethtool/igb/kcompat.h
+++ b/kernel/linux/kni/ethtool/igb/kcompat.h
@@ -3945,6 +3945,10 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
 #define HAVE_NDO_BRIDGE_SETLINK_EXTACK
 #endif /* >= 5.0.0 */
 
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0) )
+#define HAVE_NDO_FDB_ADD_EXTACK
+#endif /* >= 5.1.0 */
+
 #if defined(timer_setup) && defined(from_timer)
 #define HAVE_TIMER_SETUP
 #endif
-- 
2.20.1