1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan 2023-07-24 14:54:48 +08:00
parent 5e7c65e221
commit fbad2cb368
27 changed files with 0 additions and 840 deletions

View file

@ -1,19 +0,0 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI for Zerotier
LUCI_DEPENDS:=+zerotier
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-zerotier
PKG_VERSION:=1.0
PKG_RELEASE:=21
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View file

@ -1,24 +0,0 @@
module("luci.controller.zerotier", package.seeall)
function index()
if not nixio.fs.access("/etc/config/zerotier") then
return
end
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
entry({"admin", "vpn", "zerotier"}, alias("admin", "vpn", "zerotier", "general"), _("ZeroTier"), 99)
entry({"admin", "vpn", "zerotier", "general"}, cbi("zerotier/settings"), _("Base Setting"), 1)
entry({"admin", "vpn", "zerotier", "log"}, form("zerotier/info"), _("Interface Info"), 2)
entry({"admin", "vpn", "zerotier", "manual"}, cbi("zerotier/manual"), _("Manual Config"), 3)
entry({"admin", "vpn", "zerotier", "status"}, call("act_status"))
end
function act_status()
local e = {}
e.running = luci.sys.call("pgrep /usr/bin/zerotier-one >/dev/null") == 0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View file

@ -1,15 +0,0 @@
local fs = require "nixio.fs"
local conffile = "/tmp/zero.info"
f = SimpleForm("logview")
t = f:field(TextValue, "conf")
t.rmempty = true
t.rows = 19
function t.cfgvalue()
luci.sys.exec("for i in $(ifconfig | grep 'zt' | awk '{print $1}'); do ifconfig $i; done > /tmp/zero.info")
return fs.readfile(conffile) or ""
end
t.readonly = "readonly"
return f

View file

@ -1,26 +0,0 @@
local m, s, o
local fs = require "nixio.fs"
local jsonc = require "luci.jsonc" or nil
m = Map("zerotier")
s = m:section(NamedSection, "sample_config", "zerotier")
s.anonymous = true
s.addremove = false
o = s:option(TextValue, "manualconfig")
o.rows = 20
o.wrap = "soft"
o.rmempty = true
o.cfgvalue = function(self, section)
return fs.readfile("/etc/config/zero/local.conf")
end
o.write = function(self, section, value)
fs.writefile("/etc/config/zero/local.conf", value:gsub("\r\n", "\n"))
end
o.validate = function(self, value)
if jsonc == nil or jsonc.parse(value) ~= nil then
return value
end
return nil
end
o.description =
'<a href="https://www.zerotier.com/manual/" target="_blank">https://www.zerotier.com/manual/</a><br><a href="https://github.com/zerotier/ZeroTierOne/blob/dev/service/README.md" target="_blank">https://github.com/zerotier/ZeroTierOne/blob/dev/service/README.md</a>'
return m

View file

@ -1,37 +0,0 @@
a = Map("zerotier")
a.title = translate("ZeroTier")
a.description = translate("Zerotier is an open source, cross-platform and easy to use virtual LAN")
a:section(SimpleSection).template = "zerotier/zerotier_status"
t = a:section(NamedSection, "sample_config", "zerotier")
t.anonymous = true
t.addremove = false
e = t:option(Flag, "enabled", translate("Enable"))
e.default = 0
e.rmempty = false
e = t:option(DynamicList, "join", translate('ZeroTier Network ID'))
e.password = true
e.rmempty = false
e = t:option(Flag, "nat", translate("Auto NAT Clients"))
e.description = translate("Allow zerotier clients access your LAN network")
e.default = 0
e.rmempty = false
e = t:option(MultiValue, "access", translate("Zerotier Access Control"))
e.default = "lanfwzt ztfwwan ztfwlan"
e.rmempty = false
e:value("lanfwzt", translate("LAN Access Zerotier"))
e:value("wanfwzt", translate("WAN Access Zerotier"))
e:value("ztfwwan", translate("Remote Access WAN"))
e:value("ztfwlan", translate("Remote Access LAN"))
e.widget = "checkbox"
e = t:option(DummyValue, "opennewwindow", translate(
"<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"Zerotier.com\" onclick=\"window.open('https://my.zerotier.com/network')\" />"))
e.description = translate("Create or manage your zerotier network, and auth clients who could access")
return a

View file

@ -1,29 +0,0 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[vpn]], [[zerotier]], [[status]])%>', null,
function (x, data) {
var tb = document.getElementById('zerotier_status');
if (data && tb) {
if (data.running) {
var links = '<em><b><font color=green>Zerotier <%:RUNNING%></font></b></em>';
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>Zerotier <%:NOT RUNNING%></font></b></em>';
}
}
}
);
//]]>
</script>
<style>
.mar-10 {
margin-left: 50px;
margin-right: 10px;
}
</style>
<fieldset class="cbi-section">
<p id="zerotier_status">
<em>
<%:Collecting data...%>
</em>
</p>
</fieldset>

View file

@ -1,35 +0,0 @@
msgid "Zerotier is an open source, cross-platform and easy to use virtual LAN"
msgstr "Zerotier 是一个开源,跨平台,而且适合内网穿透互联的傻瓜配置虚拟 VPN LAN"
msgid "Auto NAT Clients"
msgstr "自动允许客户端 NAT"
msgid "Allow zerotier clients access your LAN network"
msgstr "允许 Zerotier 的拨入客户端访问路由器 LAN 资源(需要在 Zerotier 管理页面设定到 LAN 网段的路由表)"
msgid "Create or manage your zerotier network, and auth clients who could access"
msgstr "点击跳转到 Zerotier 官网管理平台,新建或者管理网络,并允许客户端接入访问你私人网路(新接入的节点默认不允许访问)"
msgid "Base Setting"
msgstr "基本设置"
msgid "Interface Info"
msgstr "接口信息"
msgid "Zerotier Access Control"
msgstr "Zerotier 准入控制"
msgid "LAN Access Zerotier"
msgstr "LAN 可接入 Zerotier"
msgid "WAN Access Zerotier"
msgstr "WAN 可接入 Zerotier"
msgid "Remote Access WAN"
msgstr "外部访问可接入 WAN"
msgid "Remote Access LAN"
msgstr "外部访问可接入 LAN"
msgid "Manual Config"
msgstr "手动设置"

View file

@ -1 +0,0 @@
zh-cn

View file

@ -1,113 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
PROG=/usr/bin/zerotier-one
CONFIG_PATH=/var/lib/zerotier-one
service_triggers() {
procd_add_reload_trigger "zerotier"
procd_add_interface_trigger "interface.*.up" wan /etc/init.d/zerotier restart
}
section_enabled() {
config_get_bool enabled "$1" 'enabled' 0
[ $enabled -gt 0 ]
}
start_instance() {
local cfg="$1"
local port secret config_path
local ARGS=""
if ! section_enabled "$cfg"; then
echo "disabled in config"
return 1
fi
[ -d /etc/config/zero ] || mkdir -p /etc/config/zero
config_path=/etc/config/zero
config_get_bool port $cfg 'port'
config_get secret $cfg 'secret'
# Remove existing link or folder
rm -rf $CONFIG_PATH
# Create link from CONFIG_PATH to config_path
if [ -n "$config_path" -a "$config_path" != $CONFIG_PATH ]; then
if [ ! -d "$config_path" ]; then
echo "ZeroTier config_path does not exist: $config_path"
return
fi
ln -s $config_path $CONFIG_PATH
fi
mkdir -p $CONFIG_PATH/networks.d
if [ -n "$port" ]; then
ARGS="$ARGS -p$port"
fi
if [ "$secret" = "generate" ]; then
echo "Generate secret - please wait..."
local sf="/tmp/zt.$cfg.secret"
zerotier-idtool generate "$sf" > /dev/null
[ $? -ne 0 ] && return 1
secret="$(cat $sf)"
rm "$sf"
uci set zerotier.$cfg.secret="$secret"
uci commit zerotier
fi
if [ -n "$secret" ]; then
echo "$secret" > $CONFIG_PATH/identity.secret
# make sure there is not previous identity.public
rm -f $CONFIG_PATH/identity.public
fi
add_join() {
# an (empty) config file will cause ZT to join a network
touch $CONFIG_PATH/networks.d/$1.conf
}
config_list_foreach $cfg 'join' add_join
procd_open_instance
procd_set_param command $PROG $ARGS $CONFIG_PATH
procd_set_param stderr 1
procd_close_instance
}
start_service() {
config_load 'zerotier'
config_foreach start_instance 'zerotier'
touch /tmp/zero.log && /etc/zerotier.start > /tmp/zero.log 2>&1 &
}
stop_instance() {
rm -f /tmp/zero.log
local cfg="$1"
/etc/zerotier.stop > /tmp/zero.log 2>&1 &
# Remove existing link or folder
rm -f $CONFIG_PATH/networks.d/*.conf
rm -rf $CONFIG_PATH
}
stop_service() {
config_load 'zerotier'
config_foreach stop_instance 'zerotier'
}
reload_service() {
stop
start
}

View file

@ -1,18 +0,0 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@zerotier[-1]
add ucitrack zerotier
set ucitrack.@zerotier[-1].init=zerotier
commit ucitrack
delete firewall.zerotier
set firewall.zerotier=include
set firewall.zerotier.type=script
set firewall.zerotier.path=/etc/zerotier.start
set firewall.zerotier.reload=1
commit firewall
EOF
rm -f /tmp/luci-indexcache
exit 0

View file

@ -1,28 +0,0 @@
#!/bin/sh
zero_enable="$(uci get zerotier.sample_config.enabled)"
[ "${zero_enable}" -ne "1" ] && exit 0
[ -f "/tmp/zero.log" ] && {
while [ "$(ifconfig | grep 'zt' | awk '{print $1}')" = "" ]
do
sleep 1
done
}
nat_enable="$(uci get zerotier.sample_config.nat)"
zt0="$(ifconfig | grep 'zt' | awk '{print $1}')"
echo "${zt0}" > "/tmp/zt.nif"
[ "${nat_enable}" -eq "1" ] && {
for i in ${zt0}
do
ip_segment=""
iptables -I FORWARD -i "$i" -j ACCEPT
iptables -I FORWARD -o "$i" -j ACCEPT
iptables -t nat -I POSTROUTING -o "$i" -j MASQUERADE
ip_segment="$(ip route | grep "dev $i proto kernel" | awk '{print $1}')"
iptables -t nat -I POSTROUTING -s "${ip_segment}" -j MASQUERADE
done
}

View file

@ -1,15 +0,0 @@
#!/bin/sh
zt0="$(ifconfig | grep 'zt' | awk '{print $1}')"
[ -z "${zt0}" ] && zt0="$(cat "/tmp/zt.nif")"
for i in ${zt0}
do
ip_segment=""
iptables -D FORWARD -i "$i" -j ACCEPT 2>/dev/null
iptables -D FORWARD -o "$i" -j ACCEPT 2>/dev/null
iptables -t nat -D POSTROUTING -o "$i" -j MASQUERADE 2>/dev/null
ip_segment="$(ip route | grep "dev $i proto" | awk '{print $1}')"
iptables -t nat -D POSTROUTING -s "${ip_segment}" -j MASQUERADE 2>/dev/null
echo "zt interface $i is stopped!"
done

View file

@ -1,37 +0,0 @@
# Attribution: https://gist.github.com/lenew/9b41ba901c3393047ede0766760f9d55
#Put this source to 'package/lean/r8125' folder of OpenWRT/LEDE SDK
#Build(make menuconfig, make defconfig, make)
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=r8125
PKG_VERSION:=9.010.01-1
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/awesometic/realtek-r8125-dkms/tar.gz/$(PKG_VERSION)?
PKG_HASH:=81fb9a100e6cefb421557639b476fd03af61a99c55bc8fb03c6e396532bd0944
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/realtek-$(PKG_NAME)-dkms-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define KernelPackage/r8125
TITLE:=Driver for Realtek r8125 chipsets
SUBMENU:=Network Devices
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
FILES:= $(PKG_BUILD_DIR)/src/r8125.ko
AUTOLOAD:=$(call AutoProbe,r8125)
endef
define Package/r8125/description
This package contains a driver for Realtek r8125 chipsets.
endef
define Build/Compile
+$(KERNEL_MAKE) M=$(PKG_BUILD_DIR)/src modules
endef
$(eval $(call KernelPackage,r8125))

View file

@ -1,22 +0,0 @@
--- a/src/Makefile
+++ b/src/Makefile
@@ -35,16 +35,16 @@ ENABLE_REALWOW_SUPPORT = n
ENABLE_DASH_SUPPORT = n
ENABLE_DASH_PRINTER_SUPPORT = n
CONFIG_DOWN_SPEED_100 = n
-CONFIG_ASPM = y
+CONFIG_ASPM = n
ENABLE_S5WOL = y
ENABLE_S5_KEEP_CURR_MAC = n
ENABLE_EEE = y
ENABLE_S0_MAGIC_PACKET = n
ENABLE_TX_NO_CLOSE = y
-ENABLE_MULTIPLE_TX_QUEUE = n
+ENABLE_MULTIPLE_TX_QUEUE = y
ENABLE_PTP_SUPPORT = n
ENABLE_PTP_MASTER_MODE = n
-ENABLE_RSS_SUPPORT = n
+ENABLE_RSS_SUPPORT = y
ENABLE_LIB_SUPPORT = n
ENABLE_USE_FIRMWARE_FILE = n
DISABLE_PM_SUPPORT = n

View file

@ -1,18 +0,0 @@
--- a/src/r8125_n.c
+++ b/src/r8125_n.c
@@ -116,6 +116,15 @@
#define FIRMWARE_8168FP_3 "rtl_nic/rtl8168fp-3.fw"
#define FIRMWARE_8168FP_4 "rtl_nic/rtl8168fp-4.fw"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
+static inline void netif_set_gso_max_size(struct net_device *dev,
+ unsigned int size)
+{
+ /* dev->gso_max_size is read locklessly from sk_setup_caps() */
+ WRITE_ONCE(dev->gso_max_size, size);
+}
+#endif
+
/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
The RTL chips use a 64 element hash table based on the Ethernet CRC. */
static const int multicast_filter_limit = 32;

View file

@ -1,14 +0,0 @@
--- a/src/r8125.h
+++ b/src/r8125.h
@@ -633,7 +633,11 @@
typedef struct napi_struct *napi_ptr;
typedef int napi_budget;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+#define RTL_NAPI_CONFIG(ndev, priv, function, weight) netif_napi_add_weight(ndev, &priv->napi, function, weight)
+#else
#define RTL_NAPI_CONFIG(ndev, priv, function, weight) netif_napi_add(ndev, &priv->napi, function, weight)
+#endif
#define RTL_NAPI_QUOTA(budget, ndev) min(budget, budget)
#define RTL_GET_PRIV(stuct_ptr, priv_struct) container_of(stuct_ptr, priv_struct, stuct_ptr)
#define RTL_GET_NETDEV(priv_ptr) struct net_device *dev = priv_ptr->dev;

View file

@ -1,43 +0,0 @@
--- a/src/r8125_n.c
+++ b/src/r8125_n.c
@@ -43,6 +43,7 @@
#include <linux/etherdevice.h>
#include <linux/delay.h>
#include <linux/mii.h>
+#include <linux/of.h>
#include <linux/if_vlan.h>
#include <linux/crc32.h>
#include <linux/interrupt.h>
@@ -10407,6 +10408,23 @@ rtl8125_setup_mqs_reg(struct rtl8125_private *tp)
}
}
+static int
+rtl8125_led_configuration(struct rtl8125_private *tp)
+{
+ u32 led_data;
+ int ret;
+
+ ret = of_property_read_u32(tp->pci_dev->dev.of_node,
+ "realtek,led-data", &led_data);
+
+ if (ret)
+ return ret;
+
+ RTL_W16(tp, CustomLED, led_data);
+
+ return 0;
+}
+
static void
rtl8125_init_software_variable(struct net_device *dev)
{
@@ -10838,6 +10856,8 @@ rtl8125_init_software_variable(struct net_device *dev)
if (tp->InitRxDescType == RX_DESC_RING_TYPE_3)
tp->rtl8125_rx_config |= EnableRxDescV3;
+ rtl8125_led_configuration(tp);
+
tp->NicCustLedValue = RTL_R16(tp, CustomLED);
tp->wol_opts = rtl8125_get_hw_wol(tp);

View file

@ -1,55 +0,0 @@
#
# Download realtek r8152 linux driver from official site:
# [https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-usb-3-0-software]
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=r8152
PKG_VERSION:=2.16.3.20220914
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/wget/realtek-r8152-linux/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=61ed7af34c8882c6028ddd1a27bb78fb5bfba41211f84dd7a06e4dc84dbe9a9a
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/realtek-$(PKG_NAME)-linux-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
include $(INCLUDE_DIR)/package.mk
define KernelPackage/usb-net-rtl8152-vendor
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
TITLE:=Kernel module for USB-to-Ethernet Realtek convertors
SUBMENU:=USB Support
DEPENDS:=+kmod-usb-net
FILES:=$(PKG_BUILD_DIR)/r8152.ko
AUTOLOAD:=$(call AutoProbe,r8152)
CONFLICTS:=kmod-usb-net-rtl8152
endef
define KernelPackage/usb-net-rtl8152-vendor/description
Kernel module for Realtek RTL8152/RTL8153 Based USB Ethernet Adapters
endef
R8152_MAKEOPTS= -C $(PKG_BUILD_DIR) \
PATH="$(TARGET_PATH)" \
ARCH="$(LINUX_KARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
TARGET="$(HAL_TARGET)" \
TOOLPREFIX="$(KERNEL_CROSS)" \
TOOLPATH="$(KERNEL_CROSS)" \
KERNELPATH="$(LINUX_DIR)" \
KERNELDIR="$(LINUX_DIR)" \
LDOPTS=" " \
DOMULTI=1
define Build/Compile
+$(MAKE) $(PKG_JOBS) $(R8152_MAKEOPTS) modules
endef
$(eval $(call KernelPackage,usb-net-rtl8152-vendor))

View file

@ -1,19 +0,0 @@
--- a/r8152.c
+++ b/r8152.c
@@ -1026,6 +1026,16 @@
#define RTL_ADVERTISED_1000_FULL BIT(5)
#define RTL_ADVERTISED_2500_FULL BIT(6)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
+static inline void netif_set_gso_max_size(struct net_device *dev,
+ unsigned int size)
+{
+ /* dev->gso_max_size is read locklessly from sk_setup_caps() */
+ WRITE_ONCE(dev->gso_max_size, size);
+}
+#endif
+
+
/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
* The RTL chips use a 64 element hash table based on the Ethernet CRC.
*/

View file

@ -1,38 +0,0 @@
--- a/compatibility.h
+++ b/compatibility.h
@@ -237,9 +237,15 @@
#define napi_disable(napi_ptr) netif_poll_disable(container_of(napi_ptr, struct r8152, napi)->netdev)
#define napi_schedule(napi_ptr) netif_rx_schedule(container_of(napi_ptr, struct r8152, napi)->netdev)
#define napi_complete(napi_ptr) netif_rx_complete(container_of(napi_ptr, struct r8152, napi)->netdev)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+ #define netif_napi_add_weight(ndev, napi_ptr, function, weight_t) \
+ ndev->poll = function; \
+ ndev->weight = weight_t;
+#else
#define netif_napi_add(ndev, napi_ptr, function, weight_t) \
ndev->poll = function; \
ndev->weight = weight_t;
+#endif
typedef unsigned long uintptr_t;
#define DMA_BIT_MASK(value) \
(value < 64 ? ((1ULL << value) - 1) : 0xFFFFFFFFFFFFFFFFULL)
--- a/r8152.c
+++ b/r8152.c
@@ -20718,10 +20718,17 @@
usb_set_intfdata(intf, tp);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+ if (tp->support_2500full)
+ netif_napi_add_weight(netdev, &tp->napi, r8152_poll, 256);
+ else
+ netif_napi_add_weight(netdev, &tp->napi, r8152_poll, 64);
+#else
if (tp->support_2500full)
netif_napi_add(netdev, &tp->napi, r8152_poll, 256);
else
netif_napi_add(netdev, &tp->napi, r8152_poll, 64);
+#endif
ret = register_netdev(netdev);
if (ret != 0) {

View file

@ -1,74 +0,0 @@
From 82985725e071f2a5735052f18e109a32aeac3a0b Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Sun, 26 Jul 2020 02:38:31 +0200
Subject: [PATCH] add LED configuration from OF
This adds the ability to configure the LED configuration register using
OF. This way, the correct value for board specific LED configuration can
be determined.
Signed-off-by: David Bauer <mail@david-bauer.net>
---
r8152.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
--- a/r8152.c
+++ b/r8152.c
@@ -18,6 +18,7 @@
#include <linux/mii.h>
#include <linux/ethtool.h>
#include <linux/usb.h>
+#include <linux/of.h>
#include <linux/crc32.h>
#include <linux/if_vlan.h>
#include <linux/uaccess.h>
@@ -9804,6 +9805,22 @@ static void rtl_tally_reset(struct r8152
ocp_write_word(tp, MCU_TYPE_PLA, PLA_RSTTALLY, ocp_data);
}
+static int r8152_led_configuration(struct r8152 *tp)
+{
+ u32 led_data;
+ int ret;
+
+ ret = of_property_read_u32(tp->udev->dev.of_node, "realtek,led-data",
+ &led_data);
+
+ if (ret)
+ return ret;
+
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_LEDSEL, led_data);
+
+ return 0;
+}
+
static void r8152b_init(struct r8152 *tp)
{
u32 ocp_data;
@@ -9865,6 +9882,8 @@ static void r8152b_init(struct r8152 *tp
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL);
ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN);
ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data);
+
+ r8152_led_configuration(tp);
}
static void r8153_init(struct r8152 *tp)
@@ -10008,6 +10027,8 @@ static void r8153_init(struct r8152 *tp)
tp->coalesce = COALESCE_SLOW;
break;
}
+
+ r8152_led_configuration(tp);
}
static void r8153b_init(struct r8152 *tp)
@@ -10098,6 +10119,8 @@ static void r8153b_init(struct r8152 *tp
rtl_tally_reset(tp);
tp->coalesce = 15000; /* 15 us */
+
+ r8152_led_configuration(tp);
}
static void r8153c_init(struct r8152 *tp)

View file

@ -1,39 +0,0 @@
#
# Download realtek r8168 linux driver from official site:
# [https://www.realtek.com/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software]
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=r8168
PKG_VERSION:=8.051.02
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/BROBIRD/openwrt-r8168.git
PKG_SOURCE_VERSION:=4f6cfe1ca12fb772deed57f1d2d1062af041ad07
PKG_MIRROR_HASH:=6b149f5eb3b9e1dc50867a694984d253aa58d97dd5fbab30eb405d2d7b2be587
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define KernelPackage/r8168
TITLE:=Driver for Realtek r8168 chipsets
SUBMENU:=Network Devices
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
FILES:= $(PKG_BUILD_DIR)/src/r8168.ko
AUTOLOAD:=$(call AutoProbe,r8168)
CONFLICTS:=kmod-r8169
endef
define Package/r8168/description
This package contains a driver for Realtek r8168 chipsets.
endef
define Build/Compile
+$(KERNEL_MAKE) M=$(PKG_BUILD_DIR)/src modules
endef
$(eval $(call KernelPackage,r8168))

View file

@ -1,42 +0,0 @@
--- a/src/r8168_n.c
+++ b/src/r8168_n.c
@@ -47,6 +47,7 @@
#include <linux/etherdevice.h>
#include <linux/delay.h>
#include <linux/mii.h>
+#include <linux/of.h>
#include <linux/if_vlan.h>
#include <linux/crc32.h>
#include <linux/interrupt.h>
@@ -24643,6 +24644,22 @@ rtl8168_set_bios_setting(struct net_devi
}
}
+static int rtl8168_led_configuration(struct rtl8168_private *tp)
+{
+ u32 led_data;
+ int ret;
+
+ ret = of_property_read_u32(tp->pci_dev->dev.of_node,
+ "realtek,led-data", &led_data);
+
+ if (ret)
+ return ret;
+
+ RTL_W16(tp, CustomLED, led_data);
+
+ return 0;
+}
+
static void
rtl8168_init_software_variable(struct net_device *dev)
{
@@ -25206,6 +25223,8 @@ rtl8168_init_software_variable(struct ne
tp->NotWrMcuPatchCode = TRUE;
}
+ rtl8168_led_configuration(tp);
+
tp->NicCustLedValue = RTL_R16(tp, CustomLED);
rtl8168_get_hw_wol(dev);

View file

@ -1,47 +0,0 @@
--- a/src/r8168_n.c
+++ b/src/r8168_n.c
@@ -3715,7 +3715,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_to_dev(tp),
+#endif
le64_to_cpu(mapping),
len, DMA_TO_DEVICE);
txd->opts1 = cpu_to_le32(DescOwn | FirstFrag | LastFrag | len);
@@ -3743,7 +3747,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_to_dev(tp), 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;
@@ -26464,11 +26472,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

@ -1,18 +0,0 @@
--- a/src/r8168_n.c
+++ b/src/r8168_n.c
@@ -116,6 +116,15 @@
#define FIRMWARE_8168FP_3 "rtl_nic/rtl8168fp-3.fw"
#define FIRMWARE_8168FP_4 "rtl_nic/rtl8168fp-4.fw"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)
+static inline void netif_set_gso_max_size(struct net_device *dev,
+ unsigned int size)
+{
+ /* dev->gso_max_size is read locklessly from sk_setup_caps() */
+ WRITE_ONCE(dev->gso_max_size, size);
+}
+#endif
+
/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
The RTL chips use a 64 element hash table based on the Ethernet CRC. */
static const int multicast_filter_limit = 32;

View file

@ -1,14 +0,0 @@
--- a/src/r8168.h
--- b/src/r8168.h
@@ -566,7 +566,11 @@
typedef struct napi_struct *napi_ptr;
typedef int napi_budget;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+#define RTL_NAPI_CONFIG(ndev, priv, function, weight) netif_napi_add_weight(ndev, &priv->napi, function, weight)
+#else
#define RTL_NAPI_CONFIG(ndev, priv, function, weight) netif_napi_add(ndev, &priv->napi, function, weight)
+#endif
#define RTL_NAPI_QUOTA(budget, ndev) min(budget, budget)
#define RTL_GET_PRIV(stuct_ptr, priv_struct) container_of(stuct_ptr, priv_struct, stuct_ptr)
#define RTL_GET_NETDEV(priv_ptr) struct net_device *dev = priv_ptr->dev;