mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
Merge pull request #313941 from kiike/refactor/ena
linuxPackages.ena: 2.12.0 -> 2.12.3; general maintenance
This commit is contained in:
commit
f763682a41
@ -0,0 +1,82 @@
|
||||
From 4ff06a845979bd65e672ff4ab09f5310c681e13b Mon Sep 17 00:00:00 2001
|
||||
From: Arthur Kiyanovski <akiyano@amazon.com>
|
||||
Date: Tue, 30 Jul 2024 05:06:14 +0000
|
||||
Subject: [PATCH] workaround patch for kernel 6.10
|
||||
|
||||
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
|
||||
---
|
||||
kernel/linux/ena/config/test_defs.sh | 12 ++++++++++++
|
||||
kernel/linux/ena/ena_xdp.c | 5 ++---
|
||||
kernel/linux/ena/kcompat.h | 12 +++++++++++-
|
||||
3 files changed, 25 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/kernel/linux/ena/config/test_defs.sh b/kernel/linux/ena/config/test_defs.sh
|
||||
index f8951c3..0cf366b 100755
|
||||
--- a/kernel/linux/ena/config/test_defs.sh
|
||||
+++ b/kernel/linux/ena/config/test_defs.sh
|
||||
@@ -60,3 +60,15 @@ try_compile_async "#include <linux/etherdevice.h>" \
|
||||
"ENA_HAVE_ETH_HW_ADDR_SET" \
|
||||
"" \
|
||||
"5.15.0 <= LINUX_VERSION_CODE"
|
||||
+
|
||||
+try_compile_async "#include <net/xdp_sock_drv.h>" \
|
||||
+ "xsk_buff_dma_sync_for_cpu(NULL);" \
|
||||
+ "ENA_XSK_BUFF_DMA_SYNC_SINGLE_ARG" \
|
||||
+ "" \
|
||||
+ "6.10.0 <= LINUX_VERSION_CODE"
|
||||
+
|
||||
+try_compile_async "#include <linux/skbuff.h>" \
|
||||
+ "__napi_alloc_skb(NULL, 0, 0);" \
|
||||
+ "ENA_NAPI_ALLOC_SKB_EXPLICIT_GFP_MASK" \
|
||||
+ "" \
|
||||
+ "6.10.0 > LINUX_VERSION_CODE"
|
||||
diff --git a/kernel/linux/ena/ena_xdp.c b/kernel/linux/ena/ena_xdp.c
|
||||
index 204389f..ecbaa9f 100644
|
||||
--- a/kernel/linux/ena/ena_xdp.c
|
||||
+++ b/kernel/linux/ena/ena_xdp.c
|
||||
@@ -746,9 +746,8 @@ static struct sk_buff *ena_xdp_rx_skb_zc(struct ena_ring *rx_ring, struct xdp_bu
|
||||
data_addr = xdp->data;
|
||||
|
||||
/* allocate a skb to store the frags */
|
||||
- skb = __napi_alloc_skb(rx_ring->napi,
|
||||
- headroom + data_len,
|
||||
- GFP_ATOMIC | __GFP_NOWARN);
|
||||
+ skb = napi_alloc_skb(rx_ring->napi,
|
||||
+ headroom + data_len);
|
||||
if (unlikely(!skb)) {
|
||||
ena_increase_stat(&rx_ring->rx_stats.skb_alloc_fail, 1,
|
||||
&rx_ring->syncp);
|
||||
diff --git a/kernel/linux/ena/kcompat.h b/kernel/linux/ena/kcompat.h
|
||||
index 6d5a069..7511087 100644
|
||||
--- a/kernel/linux/ena/kcompat.h
|
||||
+++ b/kernel/linux/ena/kcompat.h
|
||||
@@ -998,10 +998,11 @@ static inline bool ktime_after(const ktime_t cmp1, const ktime_t cmp2)
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)) && \
|
||||
!(RHEL_RELEASE_CODE && \
|
||||
(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 2)))
|
||||
+#define ENA_KCOMAPT_NAPI_ALLOC_SKB
|
||||
static inline struct sk_buff *napi_alloc_skb(struct napi_struct *napi,
|
||||
unsigned int length)
|
||||
{
|
||||
- return netdev_alloc_skb_ip_align(napi->dev, length);
|
||||
+ return __netdev_alloc_skb_ip_align(napi->dev, length, GFP_ATOMIC | __GFP_NOWARN);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1150,4 +1151,13 @@ static inline int irq_update_affinity_hint(unsigned int irq, const struct cpumas
|
||||
#define ethtool_puts ethtool_sprintf
|
||||
#endif /* ENA_HAVE_ETHTOOL_PUTS */
|
||||
|
||||
+#ifdef ENA_XSK_BUFF_DMA_SYNC_SINGLE_ARG
|
||||
+#include <net/xdp_sock_drv.h>
|
||||
+#define xsk_buff_dma_sync_for_cpu(xdp, xsk_pool) xsk_buff_dma_sync_for_cpu(xdp)
|
||||
+#endif /* ENA_XSK_BUFF_DMA_SYNC_SINGLE_ARG */
|
||||
+
|
||||
+#if defined(ENA_NAPI_ALLOC_SKB_EXPLICIT_GFP_MASK) && !defined(ENA_KCOMAPT_NAPI_ALLOC_SKB)
|
||||
+#define napi_alloc_skb(napi, len) __napi_alloc_skb(napi, len, GFP_ATOMIC | __GFP_NOWARN)
|
||||
+#endif /* ENA_NAPI_ALLOC_SKB_EXPLICIT_GFP_MASK && !ENA_KCOMAPT_NAPI_ALLOC_SKB*/
|
||||
+
|
||||
#endif /* _KCOMPAT_H_ */
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,14 +1,19 @@
|
||||
{ lib, stdenv, fetchFromGitHub, kernel }:
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
kernel,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "2.12.0";
|
||||
version = "2.12.3";
|
||||
name = "ena-${version}-${kernel.version}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "amzn";
|
||||
repo = "amzn-drivers";
|
||||
rev = "ena_linux_${version}";
|
||||
hash = "sha256-Z/eeIUY7Yl2l/IqK3Z2nxPhn+JLvP976IZ9ZXPBqoSo=";
|
||||
hash = "sha256-F8vDPPwO0PnGXhqt0EeT4m/+d8w/rjMHWRV3RYC/wVQ=";
|
||||
};
|
||||
|
||||
hardeningDisable = [ "pic" ];
|
||||
@ -16,20 +21,17 @@ stdenv.mkDerivation rec {
|
||||
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||
makeFlags = kernel.makeFlags;
|
||||
|
||||
# linux 3.12
|
||||
env.NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
|
||||
env.KERNEL_BUILD_DIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
||||
|
||||
patches = [
|
||||
# Use kernel version checks instead of API feature detection
|
||||
# See https://github.com/NixOS/nixpkgs/pull/310680
|
||||
./override-features-api-detection.patch
|
||||
# https://github.com/amzn/amzn-drivers/issues/313
|
||||
./0001-workaround-patch-for-kernel-6.10.patch
|
||||
];
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
cd kernel/linux/ena
|
||||
export ENA_PHC_INCLUDE=1
|
||||
substituteInPlace Makefile --replace '/lib/modules/$(BUILD_KERNEL)' ${kernel.dev}/lib/modules/${kernel.modDirVersion}
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
@ -47,7 +49,11 @@ stdenv.mkDerivation rec {
|
||||
description = "Amazon Elastic Network Adapter (ENA) driver for Linux";
|
||||
homepage = "https://github.com/amzn/amzn-drivers";
|
||||
license = licenses.gpl2Only;
|
||||
maintainers = with maintainers; [ eelco sielicki ];
|
||||
maintainers = with maintainers; [
|
||||
eelco
|
||||
sielicki
|
||||
arianvp
|
||||
];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
|
@ -1,55 +0,0 @@
|
||||
diff --git a/kernel/linux/ena/kcompat.h b/kernel/linux/ena/kcompat.h
|
||||
index 32a9cc5..8d39362 100644
|
||||
--- a/kernel/linux/ena/kcompat.h
|
||||
+++ b/kernel/linux/ena/kcompat.h
|
||||
@@ -888,21 +888,6 @@ xdp_prepare_buff(struct xdp_buff *xdp, unsigned char *hard_start,
|
||||
#define ENA_XDP_XMIT_FREES_FAILED_DESCS_INTERNALLY
|
||||
#endif
|
||||
|
||||
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && \
|
||||
- !(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 188) && \
|
||||
- LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)) && \
|
||||
- !(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 251) && \
|
||||
- LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))) && \
|
||||
- !(defined(RHEL_RELEASE_CODE) && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 6)) && \
|
||||
- !(defined(SUSE_VERSION) && (SUSE_VERSION == 15 && SUSE_PATCHLEVEL >= 4)) && \
|
||||
- !(defined(SUSE_VERSION) && (SUSE_VERSION == 15 && SUSE_PATCHLEVEL == 3) && \
|
||||
- ENA_KERNEL_VERSION_GTE(5, 3, 18, 150300, 59, 43))
|
||||
-static inline void eth_hw_addr_set(struct net_device *dev, const u8 *addr)
|
||||
-{
|
||||
- memcpy(dev->dev_addr, addr, ETH_ALEN);
|
||||
-}
|
||||
-#endif
|
||||
-
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) || \
|
||||
(defined(RHEL_RELEASE_CODE) && \
|
||||
RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 6) && \
|
||||
@@ -1112,7 +1097,7 @@ static inline void ena_dma_unmap_page_attrs(struct device *dev,
|
||||
#define pci_dev_id(pdev) ((((u16)(pdev->bus->number)) << 8) | (pdev->devfn))
|
||||
#endif /* ENA_HAVE_PCI_DEV_ID */
|
||||
|
||||
-#ifndef ENA_HAVE_XDP_DO_FLUSH
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
|
||||
#define xdp_do_flush xdp_do_flush_map
|
||||
#endif /* ENA_HAVE_XDP_DO_FLUSH */
|
||||
|
||||
@@ -1147,15 +1132,15 @@ static inline unsigned int cpumask_local_spread(unsigned int i, int node)
|
||||
}
|
||||
#endif /* ENA_HAVE_CPUMASK_LOCAL_SPREAD */
|
||||
|
||||
-#ifndef ENA_HAVE_UPDATE_AFFINITY_HINT
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
|
||||
static inline int irq_update_affinity_hint(unsigned int irq, const struct cpumask *m)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
-#endif /* ENA_HAVE_UPDATE_AFFINITY_HINT */
|
||||
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5.17.0) */
|
||||
|
||||
-#ifndef ENA_HAVE_ETHTOOL_PUTS
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
|
||||
#define ethtool_puts ethtool_sprintf
|
||||
-#endif /* ENA_HAVE_ETHTOOL_PUTS */
|
||||
+#endif
|
||||
|
||||
#endif /* _KCOMPAT_H_ */
|
Loading…
Reference in New Issue
Block a user