From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 99A06558B for ; Fri, 18 Nov 2016 13:23:40 +0100 (CET) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP; 18 Nov 2016 04:23:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,509,1473145200"; d="scan'208";a="32794965" Received: from sivswdev02.ir.intel.com ([10.237.217.46]) by orsmga005.jf.intel.com with ESMTP; 18 Nov 2016 04:23:38 -0800 From: Ferruh Yigit To: stable@dpdk.org Cc: Ferruh Yigit Date: Fri, 18 Nov 2016 12:23:26 +0000 Message-Id: <20161118122326.24442-2-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20161118122326.24442-1-ferruh.yigit@intel.com> References: <20161115135814.GC5048@yliu-dev.sh.intel.com> <20161118122326.24442-1-ferruh.yigit@intel.com> Subject: [dpdk-stable] [PATCH 2/2] kni: fix build with kernel 4.9 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2016 12:23:41 -0000 [ backported from upstream commit 6445198f802d993c73f4b246353b2ceb2dfafc32 ] compile error: CC [M] .../lib/librte_eal/linuxapp/kni/igb_main.o .../lib/librte_eal/linuxapp/kni/igb_main.c:2317:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .ndo_set_vf_vlan = igb_ndo_set_vf_vlan, ^~~~~~~~~~~~~~~~~~~ Linux kernel 4.9 updates API for ndo_set_vf_vlan: Linux: 79aab093a0b5 ("net: Update API for VF vlan protocol 802.1ad support") Use new API for Linux kernels >= 4.9 Signed-off-by: Ferruh Yigit Tested-by: Pablo de Lara --- lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 19 +++++++++++++++++++ lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c index efd39c6..f1dcc95 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c @@ -195,7 +195,11 @@ static void igb_process_mdd_event(struct igb_adapter *); #ifdef IFLA_VF_MAX static int igb_ndo_set_vf_mac( struct net_device *netdev, int vf, u8 *mac); static int igb_ndo_set_vf_vlan(struct net_device *netdev, +#ifdef HAVE_VF_VLAN_PROTO + int vf, u16 vlan, u8 qos, __be16 vlan_proto); +#else int vf, u16 vlan, u8 qos); +#endif #ifdef HAVE_VF_SPOOFCHK_CONFIGURE static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting); @@ -6411,7 +6415,11 @@ static void igb_set_vmvir(struct igb_adapter *adapter, u32 vid, u32 vf) } static int igb_ndo_set_vf_vlan(struct net_device *netdev, +#ifdef HAVE_VF_VLAN_PROTO + int vf, u16 vlan, u8 qos, __be16 vlan_proto) +#else int vf, u16 vlan, u8 qos) +#endif { int err = 0; struct igb_adapter *adapter = netdev_priv(netdev); @@ -6419,6 +6427,12 @@ static int igb_ndo_set_vf_vlan(struct net_device *netdev, /* VLAN IDs accepted range 0-4094 */ if ((vf >= adapter->vfs_allocated_count) || (vlan > VLAN_VID_MASK-1) || (qos > 7)) return -EINVAL; + +#ifdef HAVE_VF_VLAN_PROTO + if (vlan_proto != htons(ETH_P_8021Q)) + return -EPROTONOSUPPORT; +#endif + if (vlan || qos) { err = igb_vlvf_set(adapter, vlan, !!vlan, vf); if (err) @@ -6579,7 +6593,12 @@ static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf) if (adapter->vf_data[vf].pf_vlan) igb_ndo_set_vf_vlan(adapter->netdev, vf, adapter->vf_data[vf].pf_vlan, +#ifdef HAVE_VF_VLAN_PROTO + adapter->vf_data[vf].pf_qos, + htons(ETH_P_8021Q)); +#else adapter->vf_data[vf].pf_qos); +#endif else igb_clear_vf_vfta(adapter, vf); #endif diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h index e2cf71e..de3b8dc 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h @@ -3915,4 +3915,9 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type) /* ndo_bridge_getlink adds new filter_mask and vlan_fill parameters */ #define HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK_VLAN_FILL #endif /* >= 4.2.0 */ + +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0) ) +#define HAVE_VF_VLAN_PROTO +#endif /* >= 4.9.0 */ + #endif /* _KCOMPAT_H_ */ -- 2.9.3