net-misc/r8168: add 8.050.02

Also fix build with kernel 5.18

Thanks-to: Peter Levine
Closes: https://bugs.gentoo.org/847154
Signed-off-by: Pacho Ramos <pacho@gentoo.org>
This commit is contained in:
Pacho Ramos
2022-05-26 11:23:50 +02:00
parent ce17c634eb
commit ae9bc85fa8
3 changed files with 92 additions and 0 deletions

View File

@@ -1,2 +1,3 @@
DIST r8168-8.049.02.tar.bz2 113195 BLAKE2B ee34ac7249d732a867384fdd2c87321a513e7b2770c79d0c13666edca7d4bf752d853d7f91554d7ee716b3f30ec5f3a69aed96221a79a60282f0b6d2f70f05d6 SHA512 8ccb69ab533cde6ff88f0e8af2dd66f7e6ce9467020a727d47748c5109b64d6d14eee6bc151db5ddbe70a476a2def5f2faf3871902b335074f43dd05484d39e0
DIST r8168-8.050.00.tar.bz2 115418 BLAKE2B b3e24d0548494f1904b5d3341994bdda35a05a71dce85a64c9e87cbde7f40807b0b1bcd78401928ff7625e67606918d5c844e8254cbbab62ed3f8e8058a3f15b SHA512 04043fd01ea877ea9f422b8f2319630b8664a49b41363039fc725ed382dc5afb732dda59ba63021a94c50b12ed2f0b3585cd668d969bc06fdc40d08420dbdb95
DIST r8168-8.050.02.tar.bz2 115331 BLAKE2B 37690019e6b8642929e167df426e1a5e3c4d805ab812541018fa950084061ad971648b867dc5723e611c43fecb0f04d5915bb8199006ac50640aef5a9c2eb41c SHA512 54d7080b598933c7d24ca513019c6c971f7472320d474ab4ed4148d859886f942e52896d0b98046a780319f708847596e6bc081a88a9c11e075593c97eb831b2

View File

@@ -0,0 +1,51 @@
Functions like 'pci_dma_sync_single_for_device', 'pci_set_dma_mask', and 'pci_set_consistent_dma_mask'
no longer exist in 5.18.0.
Fix similar to https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2238850.html
--- a/src/r8168_n.c
+++ b/src/r8168_n.c
@@ -3698,7 +3698,11 @@
txd->opts2 = 0;
while (1) {
memset(tmpAddr, pattern++, len - 14);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
pci_dma_sync_single_for_device(tp->pci_dev,
+#else
+ dma_sync_single_for_device(&tp->pci_dev->dev,
+#endif
le64_to_cpu(mapping),
len, DMA_TO_DEVICE);
txd->opts1 = cpu_to_le32(DescOwn | FirstFrag | LastFrag | len);
@@ -3726,7 +3730,11 @@
if (rx_len == len) {
dma_sync_single_for_cpu(tp_to_dev(tp), le64_to_cpu(rxd->addr), tp->rx_buf_sz, DMA_FROM_DEVICE);
i = memcmp(skb->data, rx_skb->data, rx_len);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
pci_dma_sync_single_for_device(tp->pci_dev, le64_to_cpu(rxd->addr), tp->rx_buf_sz, DMA_FROM_DEVICE);
+#else
+ dma_sync_single_for_device(&tp->pci_dev->dev, le64_to_cpu(rxd->addr), tp->rx_buf_sz, DMA_FROM_DEVICE);
+#endif
if (i == 0) {
// dev_printk(KERN_INFO, tp_to_dev(tp), "loopback test finished\n",rx_len,len);
break;
@@ -26408,11 +26416,20 @@
if ((sizeof(dma_addr_t) > 4) &&
use_dac &&
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
!pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
+#else
+ !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) &&
+ !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
+#endif
dev->features |= NETIF_F_HIGHDMA;
} else {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+#else
+ rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+#endif
if (rc < 0) {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
if (netif_msg_probe(tp))

View File

@@ -0,0 +1,40 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit linux-info linux-mod
DESCRIPTION="r8168 driver for Realtek 8111/8168 PCI-E NICs"
HOMEPAGE="https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software"
# "GBE Ethernet LINUX driver r8168 for kernel up to 5.17" from above link,
# we need to mirror it to avoid users from needing to fill a captcha to
# download
SRC_URI="https://dev.gentoo.org/~pacho/${PN}/${P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
MODULE_NAMES="r8168(net:${S}/src)"
BUILD_TARGETS="modules"
IUSE="use-firmware"
CONFIG_CHECK="~!R8169"
WARNING_R8169="CONFIG_R8169 is enabled. ${P} will not be loaded unless kernel driver Realtek 8169 PCI Gigabit Ethernet (CONFIG_R8169) is DISABLED."
PATCHES=(
"${FILESDIR}/r8168-8.050.02-5.18-fix.patch"
)
pkg_setup() {
linux-mod_pkg_setup
BUILD_PARAMS="KERNELDIR=${KV_DIR}"
BUILD_PARAMS+=" ENABLE_USE_FIRMWARE_FILE=$(usex use-firmware y n)"
}
src_install() {
linux-mod_src_install
einstalldocs
}