commit: 0deab1e144a0472a21613080eb6204eb7d850026 Author: Jay Faulkner <jay <AT> jvf <DOT> cc> AuthorDate: Sat Nov 12 05:31:04 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sat Nov 12 05:52:15 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0deab1e1
net-misc/r8152: New package r8152 is the driver for many Realtek USB Ethernet NICs. Signed-off-by: Jay Faulkner <jay <AT> jvf.cc> Closes: https://github.com/gentoo/gentoo/pull/28238 Signed-off-by: Sam James <sam <AT> gentoo.org> net-misc/r8152/Manifest | 1 + .../r8152/files/r8152-2.16.3-kernel-5.19-fix.patch | 43 +++++++++++++++++++ net-misc/r8152/metadata.xml | 17 ++++++++ net-misc/r8152/r8152-2.16.3.ebuild | 49 ++++++++++++++++++++++ 4 files changed, 110 insertions(+) diff --git a/net-misc/r8152/Manifest b/net-misc/r8152/Manifest new file mode 100644 index 000000000000..1ea2813cb410 --- /dev/null +++ b/net-misc/r8152/Manifest @@ -0,0 +1 @@ +DIST r8152-2.16.3.tar.bz2 73331 BLAKE2B 9e22ee6d9d0197def782f77bfd0c88a2d8827d4f8cc0bbb1a6583ab67533cd07ba79a16cd9350272ed18c733fe809ea1ff70596627abdc65d452bdf817628bc8 SHA512 c37bf5199d3a857c9a7a12f3aa4ecfe9c04b49413aea862a053ebee24c137cd35769e5d5cc7e2bb7dd3bf9057f51ffada0b4e0c53cb3d417e05c8e3fc830705c diff --git a/net-misc/r8152/files/r8152-2.16.3-kernel-5.19-fix.patch b/net-misc/r8152/files/r8152-2.16.3-kernel-5.19-fix.patch new file mode 100644 index 000000000000..076d78f46062 --- /dev/null +++ b/net-misc/r8152/files/r8152-2.16.3-kernel-5.19-fix.patch @@ -0,0 +1,43 @@ +From: https://github.com/wget/realtek-r8152-linux/commit/6ffb3760c34a904467d70830ac9c10211e8f5d3a +From: Hyacinthe Cartiaux <hyacinthe.carti...@free.fr> +Date: Wed, 14 Sep 2022 15:13:31 +0200 +Subject: [PATCH] Fix for linux 5.19 without breaking older kernel + compatibility + +--- a/r8152.c ++++ b/r8152.c +@@ -20458,9 +20458,13 @@ static ssize_t sg_en_store(struct device *dev, struct device_attribute *attr, + return -EINVAL; + } + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) ++/* LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) */ ++ netif_set_tso_max_size(netdev, tso_size); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) ++/* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) */ + netif_set_gso_max_size(netdev, tso_size); +-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) */ ++#endif + + return count; + } +@@ -20620,12 +20624,16 @@ static int rtl8152_probe(struct usb_interface *intf, + rtl_get_mapt_ver(tp); + + netdev->ethtool_ops = &ops; +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) ++/* LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) */ ++ netif_set_tso_max_size(netdev, RTL_LIMITED_TSO_SIZE); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) ++/* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) */ + if (!tp->sg_use) + netif_set_gso_max_size(netdev, RTL_LIMITED_TSO_SIZE); + #else + netdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6); +-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) */ ++#endif + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) + /* MTU range: 68 - 1500 or 9194 */ diff --git a/net-misc/r8152/metadata.xml b/net-misc/r8152/metadata.xml new file mode 100644 index 000000000000..b840941c9ce9 --- /dev/null +++ b/net-misc/r8152/metadata.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person" proxied="yes"> + <email>j...@jvf.cc</email> + <name>Jay Faulkner</name> + </maintainer> + <maintainer type="project" proxied="proxy"> + <email>proxy-ma...@gentoo.org</email> + <name>Proxy Maintainers</name> + </maintainer> + <longdescription>Official Realtek r8152 linux driver. The following cards are currently supported: +RTL8156 RTL8156B(S)(G) RTL8153 RTL8153B RTL8154 RTL8154B RTL8152B</longdescription> + <use> + <flag name="center-tap-short">Enable support for center tap short</flag> + </use> +</pkgmetadata> diff --git a/net-misc/r8152/r8152-2.16.3.ebuild b/net-misc/r8152/r8152-2.16.3.ebuild new file mode 100644 index 000000000000..bb0eb2cef113 --- /dev/null +++ b/net-misc/r8152/r8152-2.16.3.ebuild @@ -0,0 +1,49 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit udev linux-info linux-mod + +DESCRIPTION="r8152 driver for Realtek USB FE / GBE / 2.5G Gaming Ethernet Family Controller" +HOMEPAGE="https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-usb-3-0-software" + +SRC_URI="http://rtitwww.realtek.com/rtdrivers/cn/nic1/${P}.tar.bz2" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +RDEPEND="virtual/udev" +DEPEND="${RDEPEND}" + +MODULE_NAMES="r8152(net/usb:${S})" +BUILD_TARGETS="modules" +IUSE="+center-tap-short" + +# https://github.com/wget/realtek-r8152-linux/ keeps reasonably up to date +# with kernel support patches. It appears to be used by the AUR maintainer. +PATCHES=( + "${FILESDIR}"/${PN}-2.16.3-kernel-5.19-fix.patch +) + +pkg_setup() { + linux-mod_pkg_setup + BUILD_PARAMS="KERNELDIR=${KV_DIR}" + BUILD_PARAMS+=" CONFIG_CTAP_SHORT=$(usex center-tap-short on off)" +} + +src_install() { + linux-mod_src_install + einstalldocs + udev_dorules 50-usb-realtek-net.rules +} + +pkg_postinst() { + linux-mod_pkg_postinst + udev_reload +} + +pkg_postrm() { + linux-mod_pkg_postrm + udev_reload +}