From bf3c5027e0c63d3cd53bcf3f13a565ecdfdf79c4 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 21 Nov 2017 16:05:56 +0000 Subject: [PATCH] i40e: Build for 32-bit targets again Apply the upstream patches that removed the use of cmpxchg64(). --- debian/changelog | 4 + .../i40e-build-for-64-bit-targets-only.patch | 26 --- .../all/i40e-fix-flags-declaration.patch | 32 +++ ...organize-and-re-number-feature-flags.patch | 203 ++++++++++++++++++ debian/patches/series | 3 +- 5 files changed, 241 insertions(+), 27 deletions(-) delete mode 100644 debian/patches/bugfix/all/i40e-build-for-64-bit-targets-only.patch create mode 100644 debian/patches/bugfix/all/i40e-fix-flags-declaration.patch create mode 100644 debian/patches/bugfix/all/i40e-i40evf-organize-and-re-number-feature-flags.patch diff --git a/debian/changelog b/debian/changelog index 3bbaa5470..a89ee0cdf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,10 @@ linux (4.14-1~exp2) UNRELEASED; urgency=medium * [rt] Update to 4.14-rt1 and reenable (Closes: #882192) + * i40e: Build for 32-bit targets again + - i40e/i40evf: organize and re-number feature flags + - i40e: fix flags declaration + - Revert "i40e: Build for 64-bit targets only" -- Ben Hutchings Mon, 20 Nov 2017 14:16:28 +0000 diff --git a/debian/patches/bugfix/all/i40e-build-for-64-bit-targets-only.patch b/debian/patches/bugfix/all/i40e-build-for-64-bit-targets-only.patch deleted file mode 100644 index e976be47f..000000000 --- a/debian/patches/bugfix/all/i40e-build-for-64-bit-targets-only.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Ben Hutchings -Date: Wed, 4 Oct 2017 02:46:53 +0100 -Subject: i40e: Build for 64-bit targets only - -i40e now uses cmpxchg64(), which only works on a 64-bit (or non-SMP) -system. It seems reasonable to expect that 40G hardware is not used -on 32-bit systems. - -Fixes: 841c950d67c6 ("i40e/i40evf: use cmpxchg64 when updating private ...") -Signed-off-by: Ben Hutchings ---- - drivers/net/ethernet/intel/Kconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig -index 1feb54b6d92e..dd17bdf5561e 100644 ---- a/drivers/net/ethernet/intel/Kconfig -+++ b/drivers/net/ethernet/intel/Kconfig -@@ -215,6 +215,7 @@ config I40E - tristate "Intel(R) Ethernet Controller XL710 Family support" - imply PTP_1588_CLOCK - depends on PCI -+ depends on 64BIT - ---help--- - This driver supports Intel(R) Ethernet Controller XL710 Family of - devices. For more information on how to identify your adapter, go diff --git a/debian/patches/bugfix/all/i40e-fix-flags-declaration.patch b/debian/patches/bugfix/all/i40e-fix-flags-declaration.patch new file mode 100644 index 000000000..070e4074a --- /dev/null +++ b/debian/patches/bugfix/all/i40e-fix-flags-declaration.patch @@ -0,0 +1,32 @@ +From: Jacob Keller +Date: Thu, 7 Sep 2017 15:19:12 -0700 +Subject: i40e: fix flags declaration +Origin: https://git.kernel.org/linus/b48be9978e4b21b28b7349f57574dae21378ddd5 + +Since we don't yet have more than 32 flags, we'll use a u32 for both the +hw_features and flag field. Should we gain more flags in the future, we +may need to convert to a u64 or separate flags out into two fields. + +This was overlooked in the previous commit 2781de2134c4 ("i40e/i40evf: +organize and re-number feature flags"), where the feature flag was not +converted form u64 to u32. + +Signed-off-by: Jacob Keller +Reviewed-by: Mitch Williams +Tested-by: Andrew Bowers +Signed-off-by: Jeff Kirsher +--- + drivers/net/ethernet/intel/i40e/i40e.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/intel/i40e/i40e.h ++++ b/drivers/net/ethernet/intel/i40e/i40e.h +@@ -422,7 +422,7 @@ struct i40e_pf { + #define I40E_HW_PORT_ID_VALID BIT(17) + #define I40E_HW_RESTART_AUTONEG BIT(18) + +- u64 flags; ++ u32 flags; + #define I40E_FLAG_RX_CSUM_ENABLED BIT(0) + #define I40E_FLAG_MSI_ENABLED BIT(1) + #define I40E_FLAG_MSIX_ENABLED BIT(2) diff --git a/debian/patches/bugfix/all/i40e-i40evf-organize-and-re-number-feature-flags.patch b/debian/patches/bugfix/all/i40e-i40evf-organize-and-re-number-feature-flags.patch new file mode 100644 index 000000000..d7477b672 --- /dev/null +++ b/debian/patches/bugfix/all/i40e-i40evf-organize-and-re-number-feature-flags.patch @@ -0,0 +1,203 @@ +From: Jacob Keller +Date: Fri, 1 Sep 2017 13:54:07 -0700 +Subject: i40e/i40evf: organize and re-number feature flags +Origin: https://git.kernel.org/linus/b74f571f59a8a3dae998e3b95e0f88fac39bfef3 + +Now that we've reduced the number of flags, organize similar flags +together and re-number them accordingly. + +Since we don't yet have more than 32 flags, we'll use a u32 for both the +hw_features and flag field. Should we gain more flags in the future, we +may need to convert to a u64 or separate flags out into two fields. + +One alternative approach considered, but not implemented here, was to +use an enumeration for the flag variables, and create a macro +I40E_FLAG() which used string concatenation to generate BIT_ULL values. +This has the advantage of making the actual bit values compile-time +dynamic so that we do not need to worry about matching the order to the +bit value. However, this does produce a high level of code churn, and +makes it more difficult to read a dumped flags value when debugging. + +Change-ID: I8653fff69453cd547d6fe98d29dfa9d8710387d1 +Signed-off-by: Jacob Keller +Reviewed-by: Mitch Williams +Tested-by: Andrew Bowers +Signed-off-by: Jeff Kirsher +[bwh: Backported to 4.14: leave out I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED, + I40E_FLAG_SOURCE_PRUNING_DISABLED, I40EVF_FLAG_REINIT_ITR_NEEDED] +--- + drivers/net/ethernet/intel/i40e/i40e.h | 98 +++++++++++++------------- + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 6 +- + drivers/net/ethernet/intel/i40evf/i40evf.h | 32 ++++----- + 3 files changed, 68 insertions(+), 68 deletions(-) + +--- a/drivers/net/ethernet/intel/i40e/i40e.h ++++ b/drivers/net/ethernet/intel/i40e/i40e.h +@@ -401,55 +401,55 @@ struct i40e_pf { + struct timer_list service_timer; + struct work_struct service_task; + +- u64 hw_features; +-#define I40E_HW_RSS_AQ_CAPABLE BIT_ULL(0) +-#define I40E_HW_128_QP_RSS_CAPABLE BIT_ULL(1) +-#define I40E_HW_ATR_EVICT_CAPABLE BIT_ULL(2) +-#define I40E_HW_WB_ON_ITR_CAPABLE BIT_ULL(3) +-#define I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE BIT_ULL(4) +-#define I40E_HW_NO_PCI_LINK_CHECK BIT_ULL(5) +-#define I40E_HW_100M_SGMII_CAPABLE BIT_ULL(6) +-#define I40E_HW_NO_DCB_SUPPORT BIT_ULL(7) +-#define I40E_HW_USE_SET_LLDP_MIB BIT_ULL(8) +-#define I40E_HW_GENEVE_OFFLOAD_CAPABLE BIT_ULL(9) +-#define I40E_HW_PTP_L4_CAPABLE BIT_ULL(10) +-#define I40E_HW_WOL_MC_MAGIC_PKT_WAKE BIT_ULL(11) +-#define I40E_HW_MPLS_HDR_OFFLOAD_CAPABLE BIT_ULL(12) +-#define I40E_HW_HAVE_CRT_RETIMER BIT_ULL(13) +-#define I40E_HW_OUTER_UDP_CSUM_CAPABLE BIT_ULL(14) +-#define I40E_HW_PHY_CONTROLS_LEDS BIT_ULL(15) +-#define I40E_HW_STOP_FW_LLDP BIT_ULL(16) +-#define I40E_HW_PORT_ID_VALID BIT_ULL(17) +-#define I40E_HW_RESTART_AUTONEG BIT_ULL(18) ++ u32 hw_features; ++#define I40E_HW_RSS_AQ_CAPABLE BIT(0) ++#define I40E_HW_128_QP_RSS_CAPABLE BIT(1) ++#define I40E_HW_ATR_EVICT_CAPABLE BIT(2) ++#define I40E_HW_WB_ON_ITR_CAPABLE BIT(3) ++#define I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE BIT(4) ++#define I40E_HW_NO_PCI_LINK_CHECK BIT(5) ++#define I40E_HW_100M_SGMII_CAPABLE BIT(6) ++#define I40E_HW_NO_DCB_SUPPORT BIT(7) ++#define I40E_HW_USE_SET_LLDP_MIB BIT(8) ++#define I40E_HW_GENEVE_OFFLOAD_CAPABLE BIT(9) ++#define I40E_HW_PTP_L4_CAPABLE BIT(10) ++#define I40E_HW_WOL_MC_MAGIC_PKT_WAKE BIT(11) ++#define I40E_HW_MPLS_HDR_OFFLOAD_CAPABLE BIT(12) ++#define I40E_HW_HAVE_CRT_RETIMER BIT(13) ++#define I40E_HW_OUTER_UDP_CSUM_CAPABLE BIT(14) ++#define I40E_HW_PHY_CONTROLS_LEDS BIT(15) ++#define I40E_HW_STOP_FW_LLDP BIT(16) ++#define I40E_HW_PORT_ID_VALID BIT(17) ++#define I40E_HW_RESTART_AUTONEG BIT(18) + + u64 flags; +-#define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(1) +-#define I40E_FLAG_MSI_ENABLED BIT_ULL(2) +-#define I40E_FLAG_MSIX_ENABLED BIT_ULL(3) +-#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT_ULL(4) +-#define I40E_FLAG_RSS_ENABLED BIT_ULL(6) +-#define I40E_FLAG_VMDQ_ENABLED BIT_ULL(7) +-#define I40E_FLAG_IWARP_ENABLED BIT_ULL(10) +-#define I40E_FLAG_FILTER_SYNC BIT_ULL(15) +-#define I40E_FLAG_SERVICE_CLIENT_REQUESTED BIT_ULL(16) +-#define I40E_FLAG_SRIOV_ENABLED BIT_ULL(19) +-#define I40E_FLAG_DCB_ENABLED BIT_ULL(20) +-#define I40E_FLAG_FD_SB_ENABLED BIT_ULL(21) +-#define I40E_FLAG_FD_ATR_ENABLED BIT_ULL(22) +-#define I40E_FLAG_FD_SB_AUTO_DISABLED BIT_ULL(23) +-#define I40E_FLAG_FD_ATR_AUTO_DISABLED BIT_ULL(24) +-#define I40E_FLAG_PTP BIT_ULL(25) +-#define I40E_FLAG_MFP_ENABLED BIT_ULL(26) +-#define I40E_FLAG_UDP_FILTER_SYNC BIT_ULL(27) +-#define I40E_FLAG_DCB_CAPABLE BIT_ULL(29) +-#define I40E_FLAG_VEB_STATS_ENABLED BIT_ULL(37) +-#define I40E_FLAG_LINK_POLLING_ENABLED BIT_ULL(39) +-#define I40E_FLAG_VEB_MODE_ENABLED BIT_ULL(40) +-#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT_ULL(51) +-#define I40E_FLAG_CLIENT_RESET BIT_ULL(54) +-#define I40E_FLAG_TEMP_LINK_POLLING BIT_ULL(55) +-#define I40E_FLAG_CLIENT_L2_CHANGE BIT_ULL(56) +-#define I40E_FLAG_LEGACY_RX BIT_ULL(58) ++#define I40E_FLAG_RX_CSUM_ENABLED BIT(0) ++#define I40E_FLAG_MSI_ENABLED BIT(1) ++#define I40E_FLAG_MSIX_ENABLED BIT(2) ++#define I40E_FLAG_RSS_ENABLED BIT(3) ++#define I40E_FLAG_VMDQ_ENABLED BIT(4) ++#define I40E_FLAG_FILTER_SYNC BIT(5) ++#define I40E_FLAG_SRIOV_ENABLED BIT(6) ++#define I40E_FLAG_DCB_CAPABLE BIT(7) ++#define I40E_FLAG_DCB_ENABLED BIT(8) ++#define I40E_FLAG_FD_SB_ENABLED BIT(9) ++#define I40E_FLAG_FD_ATR_ENABLED BIT(10) ++#define I40E_FLAG_FD_SB_AUTO_DISABLED BIT(11) ++#define I40E_FLAG_FD_ATR_AUTO_DISABLED BIT(12) ++#define I40E_FLAG_MFP_ENABLED BIT(13) ++#define I40E_FLAG_UDP_FILTER_SYNC BIT(14) ++#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT(15) ++#define I40E_FLAG_VEB_MODE_ENABLED BIT(16) ++#define I40E_FLAG_VEB_STATS_ENABLED BIT(17) ++#define I40E_FLAG_LINK_POLLING_ENABLED BIT(18) ++#define I40E_FLAG_TRUE_PROMISC_SUPPORT BIT(19) ++#define I40E_FLAG_TEMP_LINK_POLLING BIT(20) ++#define I40E_FLAG_LEGACY_RX BIT(21) ++#define I40E_FLAG_PTP BIT(22) ++#define I40E_FLAG_IWARP_ENABLED BIT(23) ++#define I40E_FLAG_SERVICE_CLIENT_REQUESTED BIT(24) ++#define I40E_FLAG_CLIENT_L2_CHANGE BIT(25) ++#define I40E_FLAG_CLIENT_RESET BIT(26) + + struct i40e_client_instance *cinst; + bool stat_offsets_loaded; +--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +@@ -4090,7 +4090,7 @@ static int i40e_set_priv_flags(struct ne + struct i40e_netdev_priv *np = netdev_priv(dev); + struct i40e_vsi *vsi = np->vsi; + struct i40e_pf *pf = vsi->back; +- u64 orig_flags, new_flags, changed_flags; ++ u32 orig_flags, new_flags, changed_flags; + u32 i, j; + + orig_flags = READ_ONCE(pf->flags); +@@ -4142,12 +4142,12 @@ flags_complete: + return -EOPNOTSUPP; + + /* Compare and exchange the new flags into place. If we failed, that +- * is if cmpxchg64 returns anything but the old value, this means that ++ * is if cmpxchg returns anything but the old value, this means that + * something else has modified the flags variable since we copied it + * originally. We'll just punt with an error and log something in the + * message buffer. + */ +- if (cmpxchg64(&pf->flags, orig_flags, new_flags) != orig_flags) { ++ if (cmpxchg(&pf->flags, orig_flags, new_flags) != orig_flags) { + dev_warn(&pf->pdev->dev, + "Unable to update pf->flags as it was modified by another thread...\n"); + return -EAGAIN; +--- a/drivers/net/ethernet/intel/i40evf/i40evf.h ++++ b/drivers/net/ethernet/intel/i40evf/i40evf.h +@@ -220,21 +220,21 @@ struct i40evf_adapter { + + u32 flags; + #define I40EVF_FLAG_RX_CSUM_ENABLED BIT(0) +-#define I40EVF_FLAG_IMIR_ENABLED BIT(5) +-#define I40EVF_FLAG_MQ_CAPABLE BIT(6) +-#define I40EVF_FLAG_PF_COMMS_FAILED BIT(8) +-#define I40EVF_FLAG_RESET_PENDING BIT(9) +-#define I40EVF_FLAG_RESET_NEEDED BIT(10) +-#define I40EVF_FLAG_WB_ON_ITR_CAPABLE BIT(11) +-#define I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE BIT(12) +-#define I40EVF_FLAG_ADDR_SET_BY_PF BIT(13) +-#define I40EVF_FLAG_SERVICE_CLIENT_REQUESTED BIT(14) +-#define I40EVF_FLAG_CLIENT_NEEDS_OPEN BIT(15) +-#define I40EVF_FLAG_CLIENT_NEEDS_CLOSE BIT(16) +-#define I40EVF_FLAG_CLIENT_NEEDS_L2_PARAMS BIT(17) +-#define I40EVF_FLAG_PROMISC_ON BIT(18) +-#define I40EVF_FLAG_ALLMULTI_ON BIT(19) +-#define I40EVF_FLAG_LEGACY_RX BIT(20) ++#define I40EVF_FLAG_IMIR_ENABLED BIT(1) ++#define I40EVF_FLAG_MQ_CAPABLE BIT(2) ++#define I40EVF_FLAG_PF_COMMS_FAILED BIT(3) ++#define I40EVF_FLAG_RESET_PENDING BIT(4) ++#define I40EVF_FLAG_RESET_NEEDED BIT(5) ++#define I40EVF_FLAG_WB_ON_ITR_CAPABLE BIT(6) ++#define I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE BIT(7) ++#define I40EVF_FLAG_ADDR_SET_BY_PF BIT(8) ++#define I40EVF_FLAG_SERVICE_CLIENT_REQUESTED BIT(9) ++#define I40EVF_FLAG_CLIENT_NEEDS_OPEN BIT(10) ++#define I40EVF_FLAG_CLIENT_NEEDS_CLOSE BIT(11) ++#define I40EVF_FLAG_CLIENT_NEEDS_L2_PARAMS BIT(12) ++#define I40EVF_FLAG_PROMISC_ON BIT(13) ++#define I40EVF_FLAG_ALLMULTI_ON BIT(14) ++#define I40EVF_FLAG_LEGACY_RX BIT(15) + /* duplicates for common code */ + #define I40E_FLAG_DCB_ENABLED 0 + #define I40E_FLAG_RX_CSUM_ENABLED I40EVF_FLAG_RX_CSUM_ENABLED diff --git a/debian/patches/series b/debian/patches/series index 925a4a50e..d4cc18bda 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -76,7 +76,8 @@ bugfix/all/disable-some-marvell-phys.patch bugfix/all/fs-add-module_softdep-declarations-for-hard-coded-cr.patch bugfix/all/partially-revert-usb-kconfig-using-select-for-usb_co.patch bugfix/all/kbuild-include-addtree-remove-quotes-before-matching-path.patch -bugfix/all/i40e-build-for-64-bit-targets-only.patch +bugfix/all/i40e-i40evf-organize-and-re-number-feature-flags.patch +bugfix/all/i40e-fix-flags-declaration.patch # Miscellaneous features