commit:     d0c527c9a8df5412c72056fab28f54e06fcec8bb
Author:     Jay Faulkner <jayf <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 23 03:19:52 2025 +0000
Commit:     Jay Faulkner <jayf <AT> gentoo <DOT> org>
CommitDate: Sat Aug 23 03:21:27 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0c527c9

net-misc/r8152: add 2.20.1-r1

Fixes compilation issue on 6.16. Revbumped so that I could stablize
the other 2.20.1 without worrying about breaking folks.

Bug: https://bugs.gentoo.org/961639
Signed-off-by: Jay Faulkner <jayf <AT> gentoo.org>

 net-misc/r8152/files/r8152-2.20.1-6.16-fix.patch | 38 ++++++++++++++++
 net-misc/r8152/r8152-2.20.1-r1.ebuild            | 55 ++++++++++++++++++++++++
 2 files changed, 93 insertions(+)

diff --git a/net-misc/r8152/files/r8152-2.20.1-6.16-fix.patch 
b/net-misc/r8152/files/r8152-2.20.1-6.16-fix.patch
new file mode 100644
index 000000000000..d1fed2cda5c1
--- /dev/null
+++ b/net-misc/r8152/files/r8152-2.20.1-6.16-fix.patch
@@ -0,0 +1,38 @@
+From b4effa4f4a573f76b3a95c055d037712fa35b57d Mon Sep 17 00:00:00 2001
+From: FSE <[email protected]>
+Date: Fri, 8 Aug 2025 02:45:36 +0200
+Subject: [PATCH] Fix dev_set_mac_address() call for Linux 6.16+ API change
+
+---
+ r8152.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/r8152.c b/r8152.c
+index 1d12099..9512720 100644
+--- a/r8152.c
++++ b/r8152.c
+@@ -35,6 +35,9 @@
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,10)
+ #include <net/gso.h>
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,10) */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0)
++#include <linux/socket.h>
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0) */
+ 
+ /* Version Information */
+ #define DRIVER_SUFFIX
+@@ -26240,9 +26243,12 @@ static int rtl8152_post_reset(struct usb_interface 
*intf)
+               rtnl_lock();
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
+               dev_set_mac_address(tp->netdev, &sa);
+-#else
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(6,16,0)
+               dev_set_mac_address(tp->netdev, &sa, NULL);
+-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0) */
++#else /* >= 6.16: __kernel_sockaddr_storage API change */
++              dev_set_mac_address(tp->netdev,
++                                  (struct __kernel_sockaddr_storage *)&sa, 
NULL);
++#endif
+               rtnl_unlock();
+       }
+ 

diff --git a/net-misc/r8152/r8152-2.20.1-r1.ebuild 
b/net-misc/r8152/r8152-2.20.1-r1.ebuild
new file mode 100644
index 000000000000..6b20863f553f
--- /dev/null
+++ b/net-misc/r8152/r8152-2.20.1-r1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit linux-mod-r1 udev
+
+DESCRIPTION="r8152 driver for Realtek USB FE / GBE / 2.5G Gaming Ethernet 
Family Controller"
+# Using github readme as homepage as the realtek page has changed location 
twice in six months.
+HOMEPAGE="https://github.com/jayofdoom/realtek-r8152-unchanged";
+SRC_URI="https://github.com/jayofdoom/realtek-r8152-unchanged/archive/refs/tags/v${PV}.tar.gz
 -> ${P}.tar.gz"
+S="${WORKDIR}/realtek-r8152-unchanged-${PV}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="virtual/udev"
+DEPEND="${RDEPEND}"
+
+IUSE="+center-tap-short"
+
+# Many of the patches are sourced from pull requests to
+# https://github.com/wget/realtek-r8152-linux/ -- we do not use this repo
+# as the official upstream as it does not keep a clear deliniation between
+# shipped realtek code and patches. It is the source used by the AUR package.
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.16.3-kernel-6.4.10-fix.patch
+       "${FILESDIR}"/${PN}-2.16.3-asus-c5000-support.patch
+       "${FILESDIR}"/${PN}-2.20.1-6.16-fix.patch
+)
+
+src_compile() {
+       local modlist=( ${PN}=kernel/net/usb:. )
+       local modargs=(
+               KERNELDIR="${KV_OUT_DIR}"
+               CONFIG_CTAP_SHORT="$(usex center-tap-short on off)"
+       )
+
+       linux-mod-r1_src_compile
+}
+
+src_install() {
+       linux-mod-r1_src_install
+       udev_dorules 50-usb-realtek-net.rules
+}
+
+pkg_postinst() {
+       linux-mod-r1_pkg_postinst
+       udev_reload
+}
+
+pkg_postrm() {
+       udev_reload
+}

Reply via email to