From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by dpdk.org (Postfix) with ESMTP id 48D1F5949 for ; Mon, 29 Jul 2013 14:44:46 +0200 (CEST) Received: by mail-wi0-f182.google.com with SMTP id hi8so1076010wib.9 for ; Mon, 29 Jul 2013 05:45:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=Zo9OiSLYBCxFIWEXYRmG3KNa9QMcdYgLn/x31BjM7BA=; b=i0XTBDcu6OAi7eh2U+/U+fGhEziS0+yHwxeB49ZmChqgLnUvUkSqw8Ea/X6EPM9a9/ x8w6ATJvgSSkif7UVAvTOJzI4JOAc37HqiN2StZfQhaLX0vmUzp8LdLB3FZ2mGXiyRiq y7ld2lhTaN+Xls9yNtNdbprEo4PtQ8Nn7SIse87WM4gM+ffZZGm4zRPLHrLlJSPQrCPZ erQl0y6SRoGNqPKKf9PCleuwk9dnbjQ5hLxEiUnd7YrzMa3Te/0AItUAJ+UI0cWQMvIw QAVIHAUYfosxOqJuPTmOQfejMTUFetK2GaocSkgtYA1gtD4v/We3Ahu4ZPRfFGfbogjQ yKAg== X-Received: by 10.180.38.37 with SMTP id d5mr7092015wik.37.1375101909908; Mon, 29 Jul 2013 05:45:09 -0700 (PDT) Received: from 6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id hb2sm22275923wib.0.2013.07.29.05.45.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 29 Jul 2013 05:45:09 -0700 (PDT) Received: by 6wind.com (sSMTP sendmail emulation); Mon, 29 Jul 2013 14:45:06 +0200 From: Thomas Monjalon To: dev@dpdk.org Date: Mon, 29 Jul 2013 14:44:54 +0200 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQm9/yuHwy/X7nQ+PLsjGkGmt/nhDrYq/RSQNUbqxTgmbBR11ZHjGIEPAu+GUrUfGCXs2ueh Subject: [dpdk-dev] [PATCH 3/4] kni: fix build with kernel 3.10 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jul 2013 12:44:46 -0000 - The flags NETIF_F_HW_VLAN_* have been renamed to NETIF_F_HW_VLAN_CTAG_*. See Linux commit f646968f8f7c624587de729115d802372b9063dd. - The VLAN protocol must be specified. See Linux commits 86a9bad3ab6b6f858fd4443b48738cabbb6d094c and 80d5c3689b886308247da295a228a54df49a44f6. Signed-off-by: Thomas Monjalon --- lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 47 +++++++++++++------- lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 26 ++++++++++- lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h | 6 +-- .../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c | 2 +- .../linuxapp/kni/ethtool/ixgbe/ixgbe_main.c | 16 +++---- .../linuxapp/kni/ethtool/ixgbe/kcompat.h | 12 ++++- 6 files changed, 79 insertions(+), 30 deletions(-) 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 4462464..d687412 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c @@ -148,7 +148,10 @@ static void igb_reset_task(struct work_struct *); #ifdef HAVE_VLAN_RX_REGISTER static void igb_vlan_mode(struct net_device *, struct vlan_group *); #endif -#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID +#ifdef HAVE_VLAN_PROTO +static int igb_vlan_rx_add_vid(struct net_device *, __be16, u16); +static int igb_vlan_rx_kill_vid(struct net_device *, __be16, u16); +#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID static int igb_vlan_rx_add_vid(struct net_device *, u16); static int igb_vlan_rx_kill_vid(struct net_device *, u16); #else @@ -1807,8 +1810,8 @@ static kni_netdev_features_t igb_fix_features(struct net_device *netdev, * Since there is no support for separate tx vlan accel * enabled make sure tx flag is cleared if rx is. */ - if (!(features & NETIF_F_HW_VLAN_RX)) - features &= ~NETIF_F_HW_VLAN_TX; + if (!(features & NETIF_F_HW_VLAN_CTAG_RX)) + features &= ~NETIF_F_HW_VLAN_CTAG_TX; /* If Rx checksum is disabled, then LRO should also be disabled */ if (!(features & NETIF_F_RXCSUM)) @@ -1822,7 +1825,7 @@ static int igb_set_features(struct net_device *netdev, { u32 changed = netdev->features ^ features; - if (changed & NETIF_F_HW_VLAN_RX) + if (changed & NETIF_F_HW_VLAN_CTAG_RX) igb_vlan_mode(netdev, features); return 0; @@ -1898,7 +1901,7 @@ void igb_assign_vmdq_netdev_ops(struct net_device *vnetdev) #ifdef HAVE_TX_TIMEOUT dev->tx_timeout = &igb_vmdq_tx_timeout; #endif -#ifdef NETIF_F_HW_VLAN_TX +#ifdef NETIF_F_HW_VLAN_CTAG_TX dev->vlan_rx_register = &igb_vmdq_vlan_rx_register; dev->vlan_rx_add_vid = &igb_vmdq_vlan_rx_add_vid; dev->vlan_rx_kill_vid = &igb_vmdq_vlan_rx_kill_vid; @@ -2138,8 +2141,8 @@ static int __devinit igb_probe(struct pci_dev *pdev, #ifdef HAVE_NDO_SET_FEATURES NETIF_F_RXCSUM | #endif - NETIF_F_HW_VLAN_RX | - NETIF_F_HW_VLAN_TX; + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX; #ifdef HAVE_NDO_SET_FEATURES /* copy netdev features into list of user selectable features */ @@ -2158,7 +2161,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, #endif /* set this bit last since it cannot be part of hw_features */ - netdev->features |= NETIF_F_HW_VLAN_FILTER; + netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; #ifdef HAVE_NETDEV_VLAN_FEATURES netdev->vlan_features |= NETIF_F_TSO | @@ -6409,7 +6412,7 @@ static void igb_rx_vlan(struct igb_ring *ring, } else { IGB_CB(skb)->vid = 0; #else - __vlan_hwaccel_put_tag(skb, vid); + __kc__vlan_hwaccel_put_tag(skb, vid); #endif } } @@ -7271,7 +7274,7 @@ void igb_vlan_mode(struct net_device *netdev, u32 features) if (!test_bit(__IGB_DOWN, &adapter->state)) igb_irq_enable(adapter); #else - bool enable = !!(features & NETIF_F_HW_VLAN_RX); + bool enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX); #endif if (enable) { @@ -7311,7 +7314,7 @@ void igb_vlan_mode(struct net_device *netdev, u32 features) #else struct net_device *vnetdev; vnetdev = adapter->vmdq_netdev[i-1]; - enable = !!(vnetdev->features & NETIF_F_HW_VLAN_RX); + enable = !!(vnetdev->features & NETIF_F_HW_VLAN_CTAG_RX); #endif igb_set_vf_vlan_strip(adapter, adapter->vfs_allocated_count + i, @@ -7322,7 +7325,9 @@ void igb_vlan_mode(struct net_device *netdev, u32 features) igb_rlpml_set(adapter); } -#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID +#ifdef HAVE_VLAN_PROTO +static int igb_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid) +#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID static int igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid) #else static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid) @@ -7361,7 +7366,9 @@ static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid) #endif } -#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID +#ifdef HAVE_VLAN_PROTO +static int igb_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid) +#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID static int igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) #else static void igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) @@ -7405,7 +7412,11 @@ static void igb_restore_vlan(struct igb_adapter *adapter) for (vid = 0; vid < VLAN_N_VID; vid++) { if (!vlan_group_get_device(adapter->vlgrp, vid)) continue; +#ifdef HAVE_VLAN_PROTO + igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid); +#else igb_vlan_rx_add_vid(adapter->netdev, vid); +#endif } } #else @@ -7414,8 +7425,12 @@ static void igb_restore_vlan(struct igb_adapter *adapter) igb_vlan_mode(adapter->netdev, adapter->netdev->features); for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID) +#ifdef HAVE_VLAN_PROTO + igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid); +#else igb_vlan_rx_add_vid(adapter->netdev, vid); #endif +#endif } int igb_set_spd_dplx(struct igb_adapter *adapter, u16 spddplx) @@ -8404,8 +8419,8 @@ int igb_kni_probe(struct pci_dev *pdev, #ifdef HAVE_NDO_SET_FEATURES NETIF_F_RXCSUM | #endif - NETIF_F_HW_VLAN_RX | - NETIF_F_HW_VLAN_TX; + NETIF_F_HW_VLAN_CTAG_RX | + NETIF_F_HW_VLAN_CTAG_TX; #ifdef HAVE_NDO_SET_FEATURES /* copy netdev features into list of user selectable features */ @@ -8424,7 +8439,7 @@ int igb_kni_probe(struct pci_dev *pdev, #endif /* set this bit last since it cannot be part of hw_features */ - netdev->features |= NETIF_F_HW_VLAN_FILTER; + netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; #ifdef HAVE_NETDEV_VLAN_FEATURES netdev->vlan_features |= NETIF_F_TSO | diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h index 8af7e22..5b33e90 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h @@ -287,7 +287,17 @@ struct msix_entry { #define IS_ALIGNED(x,a) (((x) % ((typeof(x))(a))) == 0) #endif -#ifndef NETIF_F_HW_VLAN_TX +#if !defined NETIF_F_HW_VLAN_CTAG_TX && defined NETIF_F_HW_VLAN_TX +#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX +#endif +#if !defined NETIF_F_HW_VLAN_CTAG_RX && defined NETIF_F_HW_VLAN_RX +#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX +#endif +#if !defined NETIF_F_HW_VLAN_CTAG_FILTER && defined NETIF_F_HW_VLAN_FILTER +#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER +#endif + +#ifndef NETIF_F_HW_VLAN_CTAG_TX struct _kc_vlan_ethhdr { unsigned char h_dest[ETH_ALEN]; unsigned char h_source[ETH_ALEN]; @@ -3060,4 +3070,18 @@ typedef netdev_features_t kni_netdev_features_t; #define __devexit_p #endif +/*****************************************************************************/ +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) ) + +#define __kc__vlan_hwaccel_put_tag(skb, vlan_tci) \ + __vlan_hwaccel_put_tag(skb, vlan_tci) + +#else + +#define HAVE_VLAN_PROTO +#define __kc__vlan_hwaccel_put_tag(skb, vlan_tci) \ + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci) + +#endif /* < 3.10.0 */ + #endif /* _KCOMPAT_H_ */ diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h index 222c2c7..eb15858 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h +++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h @@ -42,7 +42,7 @@ #ifdef SIOCETHTOOL #include #endif -#ifdef NETIF_F_HW_VLAN_TX +#ifdef NETIF_F_HW_VLAN_CTAG_TX #include #endif #if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE) @@ -549,13 +549,13 @@ struct ixgbe_therm_proc_data { /* board specific private data structure */ struct ixgbe_adapter { -#ifdef NETIF_F_HW_VLAN_TX +#ifdef NETIF_F_HW_VLAN_CTAG_TX #ifdef HAVE_VLAN_RX_REGISTER struct vlan_group *vlgrp; /* must be first, see ixgbe_receive_skb */ #else unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; #endif -#endif /* NETIF_F_HW_VLAN_TX */ +#endif /* NETIF_F_HW_VLAN_CTAG_TX */ /* OS defined structs */ struct net_device *netdev; struct pci_dev *pdev; diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c index fcff294..4bda1fb 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c +++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c @@ -2162,7 +2162,7 @@ static int ixgbe_set_tso(struct net_device *netdev, u32 data) #endif } else { #ifndef HAVE_NETDEV_VLAN_FEATURES -#ifdef NETIF_F_HW_VLAN_TX +#ifdef NETIF_F_HW_VLAN_CTAG_TX struct ixgbe_adapter *adapter = netdev_priv(netdev); /* disable TSO on all VLANs if they're present */ if (adapter->vlgrp) { diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c index 947be44..1f7c9f2 100755 --- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c +++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c @@ -331,7 +331,7 @@ void ixgbe_vlan_mode(struct net_device *netdev, u32 features) #ifdef HAVE_VLAN_RX_REGISTER enable = (grp || (adapter->flags & IXGBE_FLAG_DCB_ENABLED)); #else - enable = !!(features & NETIF_F_HW_VLAN_RX); + enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX); #endif if (enable) /* enable VLAN tag insert/strip */ @@ -629,7 +629,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev) vmolr |= IXGBE_VMOLR_ROMPE; } } -#ifdef NETIF_F_HW_VLAN_TX +#ifdef NETIF_F_HW_VLAN_CTAG_TX /* enable hardware vlan filtering */ vlnctrl |= IXGBE_VLNCTRL_VFE; #endif @@ -812,7 +812,7 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter) ixgbe_configure_dcb(adapter); ixgbe_set_rx_mode(adapter->netdev); -#ifdef NETIF_F_HW_VLAN_TX +#ifdef NETIF_F_HW_VLAN_CTAG_TX ixgbe_restore_vlan(adapter); #endif @@ -2514,9 +2514,9 @@ int ixgbe_kni_probe(struct pci_dev *pdev, netdev->features |= NETIF_F_IPV6_CSUM; #endif -#ifdef NETIF_F_HW_VLAN_TX - netdev->features |= NETIF_F_HW_VLAN_TX | - NETIF_F_HW_VLAN_RX; +#ifdef NETIF_F_HW_VLAN_CTAG_TX + netdev->features |= NETIF_F_HW_VLAN_CTAG_TX | + NETIF_F_HW_VLAN_CTAG_RX; #endif #ifdef NETIF_F_TSO netdev->features |= NETIF_F_TSO; @@ -2548,9 +2548,9 @@ int ixgbe_kni_probe(struct pci_dev *pdev, #endif /* NETIF_F_GRO */ #endif -#ifdef NETIF_F_HW_VLAN_TX +#ifdef NETIF_F_HW_VLAN_CTAG_TX /* set this bit last since it cannot be part of hw_features */ - netdev->features |= NETIF_F_HW_VLAN_FILTER; + netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; #endif switch (adapter->hw.mac.type) { case ixgbe_mac_82599EB: diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h index 925beeb..740579e 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h +++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h @@ -304,7 +304,17 @@ struct msix_entry { #define IS_ALIGNED(x,a) (((x) % ((typeof(x))(a))) == 0) #endif -#ifndef NETIF_F_HW_VLAN_TX +#if !defined NETIF_F_HW_VLAN_CTAG_TX && defined NETIF_F_HW_VLAN_TX +#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX +#endif +#if !defined NETIF_F_HW_VLAN_CTAG_RX && defined NETIF_F_HW_VLAN_RX +#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX +#endif +#if !defined NETIF_F_HW_VLAN_CTAG_FILTER && defined NETIF_F_HW_VLAN_FILTER +#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER +#endif + +#ifndef NETIF_F_HW_VLAN_CTAG_TX struct _kc_vlan_ethhdr { unsigned char h_dest[ETH_ALEN]; unsigned char h_source[ETH_ALEN]; -- 1.7.10.4