Merge Mainline

This commit is contained in:
AmadeusGhost 2021-04-29 00:01:08 +08:00
commit ba0fa79800
40 changed files with 7573 additions and 40823 deletions

View File

@ -209,42 +209,6 @@ endef
$(eval $(call BuildPackage,cypress-firmware-43570-pcie))
# Cypress 4359 PCIe Firmware
define Package/cypress-firmware-4359-pcie
$(Package/cypress-firmware-default)
TITLE:=CYW4359 FullMac PCIe firmware
endef
define Package/cypress-firmware-4359-pcie/install
$(INSTALL_DIR) $(1)/lib/firmware/brcm
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/firmware/cyfmac4359-pcie.bin \
$(1)/lib/firmware/brcm/brcmfmac4359-pcie.bin
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/firmware/cyfmac4359-pcie.clm_blob \
$(1)/lib/firmware/brcm/brcmfmac4359-pcie.clm_blob
endef
$(eval $(call BuildPackage,cypress-firmware-4359-pcie))
# Cypress 4359 SDIO Firmware
define Package/cypress-firmware-4359-sdio
$(Package/cypress-firmware-default)
TITLE:=CYW4359 FullMac SDIO firmware
endef
define Package/cypress-firmware-4359-sdio/install
$(INSTALL_DIR) $(1)/lib/firmware/brcm
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/firmware/cyfmac4359-sdio.bin \
$(1)/lib/firmware/brcm/brcmfmac4359-sdio.bin
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/firmware/cyfmac4359-sdio.clm_blob \
$(1)/lib/firmware/brcm/brcmfmac4359-sdio.clm_blob
endef
$(eval $(call BuildPackage,cypress-firmware-4359-sdio))
# Cypress 4373 SDIO Firmware
define Package/cypress-firmware-4373-sdio
$(Package/cypress-firmware-default)
@ -299,20 +263,3 @@ endef
$(eval $(call BuildPackage,cypress-firmware-54591-pcie))
# Cypress 89459 PCIe Firmware
define Package/cypress-firmware-89459-pcie
$(Package/cypress-firmware-default)
TITLE:=CYW89459 FullMac PCIe firmware
endef
define Package/cypress-firmware-89459-pcie/install
$(INSTALL_DIR) $(1)/lib/firmware/brcm
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/firmware/cyfmac89459-pcie.bin \
$(1)/lib/firmware/brcm/brcmfmac89459-pcie.bin
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/firmware/cyfmac89459-pcie.clm_blob \
$(1)/lib/firmware/brcm/brcmfmac89459-pcie.clm_blob
endef
$(eval $(call BuildPackage,cypress-firmware-89459-pcie))

View File

@ -916,6 +916,22 @@ endef
$(eval $(call KernelPackage,macvlan))
define KernelPackage/ipvlan
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=IP-VLAN support
KCONFIG:=CONFIG_IPVLAN
FILES:=$(LINUX_DIR)/drivers/net/ipvlan/ipvlan.ko
AUTOLOAD:=$(call AutoProbe,ipvlan)
endef
define KernelPackage/ipvlan/description
A kernel module which allows one to create virtual interfaces that
map packets to or from specific IP addresses to a particular interface
endef
$(eval $(call KernelPackage,ipvlan))
define KernelPackage/tulip
TITLE:=Tulip family network device support
DEPENDS:=@PCI_SUPPORT +kmod-mii

View File

@ -3,11 +3,11 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=nat46
PKG_MIRROR_HASH:=5cc35d11ad6937734f830be5e260eb17a7b0561e37f538e5fc99026d0f2ea517
PKG_MIRROR_HASH:=aef3dae41e896c69b29d7fa3639c69f5a88db605a72dcd1133635980656a558c
PKG_SOURCE_URL:=https://github.com/ayourtch/nat46.git
PKG_SOURCE_DATE:=2020-08-17
PKG_SOURCE_DATE:=2021-04-15
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=362640b41ae52b732d9e9729e61ac555492442a3
PKG_SOURCE_VERSION:=9df230a143477e8bc86968114439ee748ac9fd21
PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
PKG_LICENSE:=GPL-2.0

View File

@ -1,8 +1,7 @@
#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]
#Unpack source file
#Replace orginal Makefile with this file
#Put this source to 'package' folder of OpenWRT/LEDE SDK
#Build(make menuconfig, make defconfig, make)
#
# 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
@ -11,8 +10,15 @@ PKG_NAME:=r8168
PKG_VERSION:=8.048.03
PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/BROBIRD/openwrt-r8168.git
PKG_SOURCE_VERSION:=93718d4ae69097a14a9e93ea8765f7767e2ddd9e
PKG_MIRROR_HASH:=d5cfe3184d84de5a686720c9855c295ab1cd1423777f70c5488eb7aa588a52e9
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
MAKE_PATH:=src
include $(INCLUDE_DIR)/package.mk
define KernelPackage/r8168
@ -20,15 +26,16 @@ define KernelPackage/r8168
SUBMENU:=Network Devices
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
DEPENDS:=@LINUX_5_4
FILES:= $(PKG_BUILD_DIR)/r8168.ko
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
R8168_MAKEOPTS= -C $(PKG_BUILD_DIR) \
R8168_MAKEOPTS= -C $(PKG_BUILD_DIR)/src \
PATH="$(TARGET_PATH)" \
ARCH="$(LINUX_KARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \

View File

@ -1,161 +0,0 @@
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2019 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
################################################################################
# This product is covered by one or more of the following patents:
# US6,570,884, US6,115,776, and US6,327,625.
################################################################################
CONFIG_SOC_LAN = n
ENABLE_FIBER_SUPPORT = n
ENABLE_REALWOW_SUPPORT = n
ENABLE_DASH_SUPPORT = n
ENABLE_DASH_PRINTER_SUPPORT = n
CONFIG_DOWN_SPEED_100 = n
CONFIG_ASPM = y
ENABLE_S5WOL = y
ENABLE_S5_KEEP_CURR_MAC = n
ENABLE_EEE = y
ENABLE_S0_MAGIC_PACKET = n
ifneq ($(KERNELRELEASE),)
obj-m := r8168.o
r8168-objs := r8168_n.o r8168_asf.o rtl_eeprom.o rtltool.o
ifeq ($(CONFIG_SOC_LAN), y)
EXTRA_CFLAGS += -DCONFIG_SOC_LAN
endif
ifeq ($(ENABLE_FIBER_SUPPORT), y)
r8168-objs += r8168_fiber.o
EXTRA_CFLAGS += -DENABLE_FIBER_SUPPORT
endif
ifeq ($(ENABLE_REALWOW_SUPPORT), y)
r8168-objs += r8168_realwow.o
EXTRA_CFLAGS += -DENABLE_REALWOW_SUPPORT
endif
ifeq ($(ENABLE_DASH_SUPPORT), y)
r8168-objs += r8168_dash.o
EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT
endif
ifeq ($(ENABLE_DASH_PRINTER_SUPPORT), y)
r8168-objs += r8168_dash.o
EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT -DENABLE_DASH_PRINTER_SUPPORT
endif
EXTRA_CFLAGS += -DCONFIG_R8168_NAPI
EXTRA_CFLAGS += -DCONFIG_R8168_VLAN
ifeq ($(CONFIG_DOWN_SPEED_100), y)
EXTRA_CFLAGS += -DCONFIG_DOWN_SPEED_100
endif
ifeq ($(CONFIG_ASPM), y)
EXTRA_CFLAGS += -DCONFIG_ASPM
endif
ifeq ($(ENABLE_S5WOL), y)
EXTRA_CFLAGS += -DENABLE_S5WOL
endif
ifeq ($(ENABLE_S5_KEEP_CURR_MAC), y)
EXTRA_CFLAGS += -DENABLE_S5_KEEP_CURR_MAC
endif
ifeq ($(ENABLE_EEE), y)
EXTRA_CFLAGS += -DENABLE_EEE
endif
ifeq ($(ENABLE_S0_MAGIC_PACKET), y)
EXTRA_CFLAGS += -DENABLE_S0_MAGIC_PACKET
endif
else
BASEDIR := /lib/modules/$(shell uname -r)
KERNELDIR ?= $(BASEDIR)/build
PWD :=$(shell pwd)
DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net/ethernet -name realtek -type d)
ifeq ($(DRIVERDIR),)
DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net -name realtek -type d)
endif
ifeq ($(DRIVERDIR),)
DRIVERDIR := $(BASEDIR)/kernel/drivers/net
endif
RTKDIR := $(subst $(BASEDIR)/,,$(DRIVERDIR))
KERNEL_GCC_VERSION := $(shell cat /proc/version | sed -n 's/.*gcc version \([[:digit:]]\.[[:digit:]]\.[[:digit:]]\).*/\1/p')
CCVERSION = $(shell $(CC) -dumpversion)
KVER = $(shell uname -r)
KMAJ = $(shell echo $(KVER) | \
sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/')
KMIN = $(shell echo $(KVER) | \
sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/')
KREV = $(shell echo $(KVER) | \
sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/')
kver_ge = $(shell \
echo test | awk '{if($(KMAJ) < $(1)) {print 0} else { \
if($(KMAJ) > $(1)) {print 1} else { \
if($(KMIN) < $(2)) {print 0} else { \
if($(KMIN) > $(2)) {print 1} else { \
if($(KREV) < $(3)) {print 0} else { print 1 } \
}}}}}' \
)
.PHONY: all
all: print_vars clean modules install
print_vars:
@echo
@echo "CC: " $(CC)
@echo "CCVERSION: " $(CCVERSION)
@echo "KERNEL_GCC_VERSION: " $(KERNEL_GCC_VERSION)
@echo "KVER: " $(KVER)
@echo "KMAJ: " $(KMAJ)
@echo "KMIN: " $(KMIN)
@echo "KREV: " $(KREV)
@echo "BASEDIR: " $(BASEDIR)
@echo "DRIVERDIR: " $(DRIVERDIR)
@echo "PWD: " $(PWD)
@echo "RTKDIR: " $(RTKDIR)
@echo
.PHONY:modules
modules:
#ifeq ($(call kver_ge,5,0,0),1)
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
#else
# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
#endif
.PHONY:clean
clean:
#ifeq ($(call kver_ge,5,0,0),1)
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
#else
# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) clean
#endif
.PHONY:install
install:
#ifeq ($(call kver_ge,5,0,0),1)
$(MAKE) -C $(KERNELDIR) M=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install
#else
# $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install
#endif
endif

View File

@ -1,74 +0,0 @@
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2019 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
################################################################################
# This product is covered by one or more of the following patents:
# US6,570,884, US6,115,776, and US6,327,625.
################################################################################
CC := gcc
LD := ld
ARCH := $(shell uname -m | sed 's/i.86/i386/')
KSRC := /lib/modules/$(shell uname -r)/build
CONFIG_FILE := $(KSRC)/include/linux/autoconf.h
KMISC := /lib/modules/$(shell uname -r)/kernel/drivers/net/
ifeq ($(ARCH),x86_64)
MODCFLAGS += -mcmodel=kernel -mno-red-zone
endif
#standard flags for module builds
MODCFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall
MODCFLAGS += -I$(KSRC)/include -I.
MODCFLAGS += -DMODVERSIONS -DEXPORT_SYMTAB -include $(KSRC)/include/linux/modversions.h
SOURCE := r8168_n.c r8168_asf.c rtl_eeprom.c rtltool.c
OBJS := $(SOURCE:.c=.o)
SMP := $(shell $(CC) $(MODCFLAGS) -E -dM $(CONFIG_FILE) | \
grep CONFIG_SMP | awk '{print $$3}')
ifneq ($(SMP),1)
SMP := 0
endif
ifeq ($(SMP),1)
MODCFLAGS += -D__SMP__
endif
modules: $(OBJS)
$(LD) -r $^ -o r8168.o
strip --strip-debug r8168.o
%.o: %.c
$(CC) $(MODCFLAGS) -c $< -o $@
clean:
rm *.o -f
install:
install -m 744 -c r8168.o $(KMISC)

File diff suppressed because it is too large Load Diff

View File

@ -1,421 +0,0 @@
/*
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
*/
/************************************************************************************
* This product is covered by one or more of the following patents:
* US6,570,884, US6,115,776, and US6,327,625.
***********************************************************************************/
#include <linux/module.h>
#include <linux/version.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/delay.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/if_vlan.h>
#include <linux/crc32.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/init.h>
#include <linux/rtnetlink.h>
#include <asm/uaccess.h>
#include "r8168.h"
#include "r8168_asf.h"
#include "rtl_eeprom.h"
int rtl8168_asf_ioctl(struct net_device *dev,
struct ifreq *ifr)
{
struct rtl8168_private *tp = netdev_priv(dev);
void *user_data = ifr->ifr_data;
struct asf_ioctl_struct asf_usrdata;
unsigned long flags;
if (tp->mcfg != CFG_METHOD_7 && tp->mcfg != CFG_METHOD_8)
return -EOPNOTSUPP;
if (copy_from_user(&asf_usrdata, user_data, sizeof(struct asf_ioctl_struct)))
return -EFAULT;
spin_lock_irqsave(&tp->lock, flags);
switch (asf_usrdata.offset) {
case HBPeriod:
rtl8168_asf_hbperiod(tp, asf_usrdata.arg, asf_usrdata.u.data);
break;
case WD8Timer:
break;
case WD16Rst:
rtl8168_asf_wd16rst(tp, asf_usrdata.arg, asf_usrdata.u.data);
break;
case WD8Rst:
rtl8168_asf_time_period(tp, asf_usrdata.arg, WD8Rst, asf_usrdata.u.data);
break;
case LSnsrPollCycle:
rtl8168_asf_time_period(tp, asf_usrdata.arg, LSnsrPollCycle, asf_usrdata.u.data);
break;
case ASFSnsrPollPrd:
rtl8168_asf_time_period(tp, asf_usrdata.arg, ASFSnsrPollPrd, asf_usrdata.u.data);
break;
case AlertReSendItvl:
rtl8168_asf_time_period(tp, asf_usrdata.arg, AlertReSendItvl, asf_usrdata.u.data);
break;
case SMBAddr:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, SMBAddr, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case ASFConfigR0:
rtl8168_asf_config_regs(tp, asf_usrdata.arg, ASFConfigR0, asf_usrdata.u.data);
break;
case ASFConfigR1:
rtl8168_asf_config_regs(tp, asf_usrdata.arg, ASFConfigR1, asf_usrdata.u.data);
break;
case ConsoleMA:
rtl8168_asf_console_mac(tp, asf_usrdata.arg, asf_usrdata.u.data);
break;
case ConsoleIP:
rtl8168_asf_ip_address(tp, asf_usrdata.arg, ConsoleIP, asf_usrdata.u.data);
break;
case IPAddr:
rtl8168_asf_ip_address(tp, asf_usrdata.arg, IPAddr, asf_usrdata.u.data);
break;
case UUID:
rtl8168_asf_rw_uuid(tp, asf_usrdata.arg, asf_usrdata.u.data);
break;
case IANA:
rtl8168_asf_rw_iana(tp, asf_usrdata.arg, asf_usrdata.u.data);
break;
case SysID:
rtl8168_asf_rw_systemid(tp, asf_usrdata.arg, asf_usrdata.u.data);
break;
case Community:
rtl8168_asf_community_string(tp, asf_usrdata.arg, asf_usrdata.u.string);
break;
case StringLength:
rtl8168_asf_community_string_len(tp, asf_usrdata.arg, asf_usrdata.u.data);
break;
case FmCapMsk:
rtl8168_asf_capability_masks(tp, asf_usrdata.arg, FmCapMsk, asf_usrdata.u.data);
break;
case SpCMDMsk:
rtl8168_asf_capability_masks(tp, asf_usrdata.arg, SpCMDMsk, asf_usrdata.u.data);
break;
case SysCapMsk:
rtl8168_asf_capability_masks(tp, asf_usrdata.arg, SysCapMsk, asf_usrdata.u.data);
break;
case RmtRstAddr:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtRstAddr, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case RmtRstCmd:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtRstCmd, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case RmtRstData:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtRstData, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case RmtPwrOffAddr:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtPwrOffAddr, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case RmtPwrOffCmd:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtPwrOffCmd, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case RmtPwrOffData:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtPwrOffData, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case RmtPwrOnAddr:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtPwrOnAddr, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case RmtPwrOnCmd:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtPwrOnCmd, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case RmtPwrOnData:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtPwrOnData, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case RmtPCRAddr:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtPCRAddr, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case RmtPCRCmd:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtPCRCmd, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case RmtPCRData:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, RmtPCRData, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case ASFSnsr0Addr:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, ASFSnsr0Addr, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case LSnsrAddr0:
rtl8168_asf_rw_hexadecimal(tp, asf_usrdata.arg, LSnsrAddr0, RW_ONE_BYTE, asf_usrdata.u.data);
break;
case KO:
/* Get/Set Key Operation */
rtl8168_asf_key_access(tp, asf_usrdata.arg, KO, asf_usrdata.u.data);
break;
case KA:
/* Get/Set Key Administrator */
rtl8168_asf_key_access(tp, asf_usrdata.arg, KA, asf_usrdata.u.data);
break;
case KG:
/* Get/Set Key Generation */
rtl8168_asf_key_access(tp, asf_usrdata.arg, KG, asf_usrdata.u.data);
break;
case KR:
/* Get/Set Key Random */
rtl8168_asf_key_access(tp, asf_usrdata.arg, KR, asf_usrdata.u.data);
break;
default:
spin_unlock_irqrestore(&tp->lock, flags);
return -EOPNOTSUPP;
}
spin_unlock_irqrestore(&tp->lock, flags);
if (copy_to_user(user_data, &asf_usrdata, sizeof(struct asf_ioctl_struct)))
return -EFAULT;
return 0;
}
void rtl8168_asf_hbperiod(struct rtl8168_private *tp, int arg, unsigned int *data)
{
if (arg == ASF_GET)
data[ASFHBPERIOD] = rtl8168_eri_read(tp, HBPeriod, RW_TWO_BYTES, ERIAR_ASF);
else if (arg == ASF_SET) {
rtl8168_eri_write(tp, HBPeriod, RW_TWO_BYTES, data[ASFHBPERIOD], ERIAR_ASF);
rtl8168_eri_write(tp, 0x1EC, RW_ONE_BYTE, 0x07, ERIAR_ASF);
}
}
void rtl8168_asf_wd16rst(struct rtl8168_private *tp, int arg, unsigned int *data)
{
data[ASFWD16RST] = rtl8168_eri_read(tp, WD16Rst, RW_TWO_BYTES, ERIAR_ASF);
}
void rtl8168_asf_console_mac(struct rtl8168_private *tp, int arg, unsigned int *data)
{
int i;
if (arg == ASF_GET) {
for (i = 0; i < 6; i++)
data[i] = rtl8168_eri_read(tp, ConsoleMA + i, RW_ONE_BYTE, ERIAR_ASF);
} else if (arg == ASF_SET) {
for (i = 0; i < 6; i++)
rtl8168_eri_write(tp, ConsoleMA + i, RW_ONE_BYTE, data[i], ERIAR_ASF);
/* write the new console MAC address to EEPROM */
rtl8168_eeprom_write_sc(tp, 70, (data[1] << 8) | data[0]);
rtl8168_eeprom_write_sc(tp, 71, (data[3] << 8) | data[2]);
rtl8168_eeprom_write_sc(tp, 72, (data[5] << 8) | data[4]);
}
}
void rtl8168_asf_ip_address(struct rtl8168_private *tp, int arg, int offset, unsigned int *data)
{
int i;
int eeprom_off = 0;
if (arg == ASF_GET) {
for (i = 0; i < 4; i++)
data[i] = rtl8168_eri_read(tp, offset + i, RW_ONE_BYTE, ERIAR_ASF);
} else if (arg == ASF_SET) {
for (i = 0; i < 4; i++)
rtl8168_eri_write(tp, offset + i, RW_ONE_BYTE, data[i], ERIAR_ASF);
if (offset == ConsoleIP)
eeprom_off = 73;
else if (offset == IPAddr)
eeprom_off = 75;
/* write the new IP address to EEPROM */
rtl8168_eeprom_write_sc(tp, eeprom_off, (data[1] << 8) | data[0]);
rtl8168_eeprom_write_sc(tp, eeprom_off + 1, (data[3] << 8) | data[2]);
}
}
void rtl8168_asf_config_regs(struct rtl8168_private *tp, int arg, int offset, unsigned int *data)
{
unsigned int value;
if (arg == ASF_GET) {
data[ASFCAPABILITY] = (rtl8168_eri_read(tp, offset, RW_ONE_BYTE, ERIAR_ASF) & data[ASFCONFIG]) ? FUNCTION_ENABLE : FUNCTION_DISABLE;
} else if (arg == ASF_SET) {
value = rtl8168_eri_read(tp, offset, RW_ONE_BYTE, ERIAR_ASF);
if (data[ASFCAPABILITY] == FUNCTION_ENABLE)
value |= data[ASFCONFIG];
else if (data[ASFCAPABILITY] == FUNCTION_DISABLE)
value &= ~data[ASFCONFIG];
rtl8168_eri_write(tp, offset, RW_ONE_BYTE, value, ERIAR_ASF);
}
}
void rtl8168_asf_capability_masks(struct rtl8168_private *tp, int arg, int offset, unsigned int *data)
{
unsigned int len, bit_mask;
bit_mask = DISABLE_MASK;
if (offset == FmCapMsk) {
/* System firmware capabilities */
len = RW_FOUR_BYTES;
if (data[ASFCAPMASK] == FUNCTION_ENABLE)
bit_mask = FMW_CAP_MASK;
} else if (offset == SpCMDMsk) {
/* Special commands */
len = RW_TWO_BYTES;
if (data[ASFCAPMASK] == FUNCTION_ENABLE)
bit_mask = SPC_CMD_MASK;
} else {
/* System capability (offset == SysCapMsk)*/
len = RW_ONE_BYTE;
if (data[ASFCAPMASK] == FUNCTION_ENABLE)
bit_mask = SYS_CAP_MASK;
}
if (arg == ASF_GET)
data[ASFCAPMASK] = rtl8168_eri_read(tp, offset, len, ERIAR_ASF) ? FUNCTION_ENABLE : FUNCTION_DISABLE;
else /* arg == ASF_SET */
rtl8168_eri_write(tp, offset, len, bit_mask, ERIAR_ASF);
}
void rtl8168_asf_community_string(struct rtl8168_private *tp, int arg, char *string)
{
int i;
if (arg == ASF_GET) {
for (i = 0; i < COMMU_STR_MAX_LEN; i++)
string[i] = rtl8168_eri_read(tp, Community + i, RW_ONE_BYTE, ERIAR_ASF);
} else { /* arg == ASF_SET */
for (i = 0; i < COMMU_STR_MAX_LEN; i++)
rtl8168_eri_write(tp, Community + i, RW_ONE_BYTE, string[i], ERIAR_ASF);
}
}
void rtl8168_asf_community_string_len(struct rtl8168_private *tp, int arg, unsigned int *data)
{
if (arg == ASF_GET)
data[ASFCOMMULEN] = rtl8168_eri_read(tp, StringLength, RW_ONE_BYTE, ERIAR_ASF);
else /* arg == ASF_SET */
rtl8168_eri_write(tp, StringLength, RW_ONE_BYTE, data[ASFCOMMULEN], ERIAR_ASF);
}
void rtl8168_asf_time_period(struct rtl8168_private *tp, int arg, int offset, unsigned int *data)
{
int pos = 0;
if (offset == WD8Rst)
pos = ASFWD8RESET;
else if (offset == LSnsrPollCycle)
pos = ASFLSNRPOLLCYC;
else if (offset == ASFSnsrPollPrd)
pos = ASFSNRPOLLCYC;
else if (offset == AlertReSendItvl)
pos = ASFALERTRESND;
if (arg == ASF_GET)
data[pos] = rtl8168_eri_read(tp, offset, RW_ONE_BYTE, ERIAR_ASF);
else /* arg == ASF_SET */
rtl8168_eri_write(tp, offset, RW_ONE_BYTE, data[pos], ERIAR_ASF);
}
void rtl8168_asf_key_access(struct rtl8168_private *tp, int arg, int offset, unsigned int *data)
{
int i, j;
int key_off = 0;
if (arg == ASF_GET) {
for (i = 0; i < KEY_LEN; i++)
data[i] = rtl8168_eri_read(tp, offset + KEY_LEN - (i + 1), RW_ONE_BYTE, ERIAR_ASF);
} else {
if (offset == KO)
key_off = 162;
else if (offset == KA)
key_off = 172;
else if (offset == KG)
key_off = 182;
else if (offset == KR)
key_off = 192;
/* arg == ASF_SET */
for (i = 0; i < KEY_LEN; i++)
rtl8168_eri_write(tp, offset + KEY_LEN - (i + 1), RW_ONE_BYTE, data[i], ERIAR_ASF);
/* write the new key to EEPROM */
for (i = 0, j = 19; i < 10; i++, j = j - 2)
rtl8168_eeprom_write_sc(tp, key_off + i, (data[j - 1] << 8) | data[j]);
}
}
void rtl8168_asf_rw_hexadecimal(struct rtl8168_private *tp, int arg, int offset, int len, unsigned int *data)
{
if (arg == ASF_GET)
data[ASFRWHEXNUM] = rtl8168_eri_read(tp, offset, len, ERIAR_ASF);
else /* arg == ASF_SET */
rtl8168_eri_write(tp, offset, len, data[ASFRWHEXNUM], ERIAR_ASF);
}
void rtl8168_asf_rw_systemid(struct rtl8168_private *tp, int arg, unsigned int *data)
{
int i;
if (arg == ASF_GET)
for (i = 0; i < SYSID_LEN ; i++)
data[i] = rtl8168_eri_read(tp, SysID + i, RW_ONE_BYTE, ERIAR_ASF);
else /* arg == ASF_SET */
for (i = 0; i < SYSID_LEN ; i++)
rtl8168_eri_write(tp, SysID + i, RW_ONE_BYTE, data[i], ERIAR_ASF);
}
void rtl8168_asf_rw_iana(struct rtl8168_private *tp, int arg, unsigned int *data)
{
int i;
if (arg == ASF_GET)
for (i = 0; i < RW_FOUR_BYTES; i++)
data[i] = rtl8168_eri_read(tp, IANA + i, RW_ONE_BYTE, ERIAR_ASF);
else /* arg == ASF_SET */
for (i = 0; i < RW_FOUR_BYTES; i++)
rtl8168_eri_write(tp, IANA + i, RW_ONE_BYTE, data[i], ERIAR_ASF);
}
void rtl8168_asf_rw_uuid(struct rtl8168_private *tp, int arg, unsigned int *data)
{
int i, j;
if (arg == ASF_GET)
for (i = UUID_LEN - 1, j = 0; i >= 0 ; i--, j++)
data[j] = rtl8168_eri_read(tp, UUID + i, RW_ONE_BYTE, ERIAR_ASF);
else /* arg == ASF_SET */
for (i = UUID_LEN - 1, j = 0; i >= 0 ; i--, j++)
rtl8168_eri_write(tp, UUID + i, RW_ONE_BYTE, data[j], ERIAR_ASF);
}

View File

@ -1,294 +0,0 @@
/*
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
*/
/************************************************************************************
* This product is covered by one or more of the following patents:
* US6,570,884, US6,115,776, and US6,327,625.
***********************************************************************************/
#define SIOCDEVPRIVATE_RTLASF SIOCDEVPRIVATE
#define FUNCTION_ENABLE 1
#define FUNCTION_DISABLE 0
#define ASFCONFIG 0
#define ASFCAPABILITY 1
#define ASFCOMMULEN 0
#define ASFHBPERIOD 0
#define ASFWD16RST 0
#define ASFCAPMASK 0
#define ASFALERTRESND 0
#define ASFLSNRPOLLCYC 0
#define ASFSNRPOLLCYC 0
#define ASFWD8RESET 0
#define ASFRWHEXNUM 0
#define FMW_CAP_MASK 0x0000F867
#define SPC_CMD_MASK 0x1F00
#define SYS_CAP_MASK 0xFF
#define DISABLE_MASK 0x00
#define MAX_DATA_LEN 200
#define MAX_STR_LEN 200
#define COMMU_STR_MAX_LEN 23
#define KEY_LEN 20
#define UUID_LEN 16
#define SYSID_LEN 2
#define RW_ONE_BYTE 1
#define RW_TWO_BYTES 2
#define RW_FOUR_BYTES 4
enum asf_registers {
HBPeriod = 0x0000,
WD8Rst = 0x0002,
WD8Timer = 0x0003,
WD16Rst = 0x0004,
LSnsrPollCycle = 0x0006,
ASFSnsrPollPrd = 0x0007,
AlertReSendCnt = 0x0008,
AlertReSendItvl = 0x0009,
SMBAddr = 0x000A,
SMBCap = 0x000B,
ASFConfigR0 = 0x000C,
ASFConfigR1 = 0x000D,
WD16Timer = 0x000E,
ConsoleMA = 0x0010,
ConsoleIP = 0x0016,
IPAddr = 0x001A,
UUID = 0x0020,
IANA = 0x0030,
SysID = 0x0034,
Community = 0x0036,
StringLength = 0x004D,
LC = 0x004E,
EntityInst = 0x004F,
FmCapMsk = 0x0050,
SpCMDMsk = 0x0054,
SysCapMsk = 0x0056,
WDSysSt = 0x0057,
RxMsgType = 0x0058,
RxSpCMD = 0x0059,
RxSpCMDPa = 0x005A,
RxBtOpMsk = 0x005C,
RmtRstAddr = 0x005E,
RmtRstCmd = 0x005F,
RmtRstData = 0x0060,
RmtPwrOffAddr = 0x0061,
RmtPwrOffCmd = 0x0062,
RmtPwrOffData = 0x0063,
RmtPwrOnAddr = 0x0064,
RmtPwrOnCmd = 0x0065,
RmtPwrOnData = 0x0066,
RmtPCRAddr = 0x0067,
RmtPCRCmd = 0x0068,
RmtPCRData = 0x0069,
RMCP_IANA = 0x006A,
RMCP_OEM = 0x006E,
ASFSnsr0Addr = 0x0070,
ASFSnsrEvSt = 0x0073,
ASFSnsrEvAlert = 0x0081,
LSnsrNo = 0x00AD,
AssrtEvntMsk = 0x00AE,
DeAssrtEvntMsk = 0x00AF,
LSnsrAddr0 = 0x00B0,
LAlertCMD0 = 0x00B1,
LAlertDataMsk0 = 0x00B2,
LAlertCmp0 = 0x00B3,
LAlertESnsrT0 = 0x00B4,
LAlertET0 = 0x00B5,
LAlertEOffset0 = 0x00B6,
LAlertES0 = 0x00B7,
LAlertSN0 = 0x00B8,
LAlertEntity0 = 0x00B9,
LAlertEI0 = 0x00BA,
LSnsrState0 = 0x00BB,
LSnsrAddr1 = 0x00BD,
LAlertCMD1 = 0x00BE,
LAlertDataMsk1 = 0x00BF,
LAlertCmp1 = 0x00C0,
LAlertESnsrT1 = 0x00C1,
LAlertET1 = 0x00C2,
LAlertEOffset1 = 0x00C3,
LAlertES1 = 0x00C4,
LAlertSN1 = 0x00C5,
LAlertEntity1 = 0x00C6,
LAlertEI1 = 0x00C7,
LSnsrState1 = 0x00C8,
LSnsrAddr2 = 0x00CA,
LAlertCMD2 = 0x00CB,
LAlertDataMsk2 = 0x00CC,
LAlertCmp2 = 0x00CD,
LAlertESnsrT2 = 0x00CE,
LAlertET2 = 0x00CF,
LAlertEOffset2 = 0x00D0,
LAlertES2 = 0x00D1,
LAlertSN2 = 0x00D2,
LAlertEntity2 = 0x00D3,
LAlertEI2 = 0x00D4,
LSnsrState2 = 0x00D5,
LSnsrAddr3 = 0x00D7,
LAlertCMD3 = 0x00D8,
LAlertDataMsk3 = 0x00D9,
LAlertCmp3 = 0x00DA,
LAlertESnsrT3 = 0x00DB,
LAlertET3 = 0x00DC,
LAlertEOffset3 = 0x00DD,
LAlertES3 = 0x00DE,
LAlertSN3 = 0x00DF,
LAlertEntity3 = 0x00E0,
LAlertEI3 = 0x00E1,
LSnsrState3 = 0x00E2,
LSnsrAddr4 = 0x00E4,
LAlertCMD4 = 0x00E5,
LAlertDataMsk4 = 0x00E6,
LAlertCmp4 = 0x00E7,
LAlertESnsrT4 = 0x00E8,
LAlertET4 = 0x00E9,
LAlertEOffset4 = 0x00EA,
LAlertES4 = 0x00EB,
LAlertSN4 = 0x00EC,
LAlertEntity4 = 0x00ED,
LAlertEI4 = 0x00EE,
LSnsrState4 = 0x00EF,
LSnsrAddr5 = 0x00F1,
LAlertCMD5 = 0x00F2,
LAlertDataMsk5 = 0x00F3,
LAlertCmp5 = 0x00F4,
LAlertESnsrT5 = 0x00F5,
LAlertET5 = 0x00F6,
LAlertEOffset5 = 0x00F7,
LAlertES5 = 0x00F8,
LAlertSN5 = 0x00F9,
LAlertEntity5 = 0x00FA,
LAlertEI5 = 0x00FB,
LSnsrState5 = 0x00FC,
LSnsrAddr6 = 0x00FE,
LAlertCMD6 = 0x00FF,
LAlertDataMsk6 = 0x0100,
LAlertCmp6 = 0x0101,
LAlertESnsrT6 = 0x0102,
LAlertET6 = 0x0103,
LAlertEOffset6 = 0x0104,
LAlertES6 = 0x0105,
LAlertSN6 = 0x0106,
LAlertEntity6 = 0x0107,
LAlertEI6 = 0x0108,
LSnsrState6 = 0x0109,
LSnsrAddr7 = 0x010B,
LAlertCMD7 = 0x010C,
LAlertDataMsk7 = 0x010D,
LAlertCmp7 = 0x010E,
LAlertESnsrT7 = 0x010F,
LAlertET7 = 0x0110,
LAlertEOffset7 = 0x0111,
LAlertES7 = 0x0112,
LAlertSN7 = 0x0113,
LAlertEntity7 = 0x0114,
LAlertEI7 = 0x0115,
LSnsrState7 = 0x0116,
LAssert = 0x0117,
LDAssert = 0x0118,
IPServiceType = 0x0119,
IPIdfr = 0x011A,
FlagFOffset = 0x011C,
TTL = 0x011E,
HbtEI = 0x011F,
MgtConSID1 = 0x0120,
MgtConSID2 = 0x0124,
MgdCltSID = 0x0128,
StCd = 0x012C,
MgtConUR = 0x012D,
MgtConUNL = 0x012E,
AuthPd = 0x0130,
IntyPd = 0x0138,
MgtConRN = 0x0140,
MgdCtlRN = 0x0150,
MgtConUN = 0x0160,
Rakp2IntCk = 0x0170,
KO = 0x017C,
KA = 0x0190,
KG = 0x01A4,
KR = 0x01B8,
CP = 0x01CC,
CQ = 0x01D0,
KC = 0x01D4,
ConsoleSid = 0x01E8,
SIK1 = 0x01FC,
SIK2 = 0x0210,
Udpsrc_port = 0x0224,
Udpdes_port = 0x0226,
Asf_debug_mux = 0x0228
};
enum asf_cmdln_opt {
ASF_GET,
ASF_SET,
ASF_HELP
};
struct asf_ioctl_struct {
unsigned int arg;
unsigned int offset;
union {
unsigned int data[MAX_DATA_LEN];
char string[MAX_STR_LEN];
} u;
};
int rtl8168_asf_ioctl(struct net_device *dev, struct ifreq *ifr);
void rtl8168_asf_hbperiod(struct rtl8168_private *tp, int arg, unsigned int *data);
void rtl8168_asf_wd16rst(struct rtl8168_private *tp, int arg, unsigned int *data);
void rtl8168_asf_console_mac(struct rtl8168_private *, int arg, unsigned int *data);
void rtl8168_asf_ip_address(struct rtl8168_private *, int arg, int offset, unsigned int *data);
void rtl8168_asf_config_regs(struct rtl8168_private *tp, int arg, int offset, unsigned int *data);
void rtl8168_asf_capability_masks(struct rtl8168_private *tp, int arg, int offset, unsigned int *data);
void rtl8168_asf_community_string(struct rtl8168_private *tp, int arg, char *string);
void rtl8168_asf_community_string_len(struct rtl8168_private *tp, int arg, unsigned int *data);
void rtl8168_asf_alert_resend_interval(struct rtl8168_private *tp, int arg, unsigned int *data);
void rtl8168_asf_time_period(struct rtl8168_private *tp, int arg, int offset, unsigned int *data);
void rtl8168_asf_key_access(struct rtl8168_private *, int arg, int offset, unsigned int *data);
void rtl8168_asf_rw_hexadecimal(struct rtl8168_private *tp, int arg, int offset, int len, unsigned int *data);
void rtl8168_asf_rw_iana(struct rtl8168_private *tp, int arg, unsigned int *data);
void rtl8168_asf_rw_uuid(struct rtl8168_private *tp, int arg, unsigned int *data);
void rtl8168_asf_rw_systemid(struct rtl8168_private *tp, int arg, unsigned int *data);

View File

@ -1,258 +0,0 @@
/*
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
*/
/************************************************************************************
* This product is covered by one or more of the following patents:
* US6,570,884, US6,115,776, and US6,327,625.
***********************************************************************************/
#ifndef _LINUX_R8168_DASH_H
#define _LINUX_R8168_DASH_H
#define SIOCDEVPRIVATE_RTLDASH SIOCDEVPRIVATE+2
enum rtl_dash_cmd {
RTL_DASH_ARP_NS_OFFLOAD = 0,
RTL_DASH_SET_OOB_IPMAC,
RTL_DASH_NOTIFY_OOB,
RTL_DASH_SEND_BUFFER_DATA_TO_DASH_FW,
RTL_DASH_CHECK_SEND_BUFFER_TO_DASH_FW_COMPLETE,
RTL_DASH_GET_RCV_FROM_FW_BUFFER_DATA,
RTL_DASH_OOB_REQ,
RTL_DASH_OOB_ACK,
RTL_DASH_DETACH_OOB_REQ,
RTL_DASH_DETACH_OOB_ACK,
RTL_FW_SET_IPV4 = 0x10,
RTL_FW_GET_IPV4,
RTL_FW_SET_IPV6,
RTL_FW_GET_IPV6,
RTL_FW_SET_EXT_SNMP,
RTL_FW_GET_EXT_SNMP,
RTL_FW_SET_WAKEUP_PATTERN,
RTL_FW_GET_WAKEUP_PATTERN,
RTL_FW_DEL_WAKEUP_PATTERN,
RTLT_DASH_COMMAND_INVALID,
};
struct rtl_dash_ip_mac {
struct sockaddr ifru_addr;
struct sockaddr ifru_netmask;
struct sockaddr ifru_hwaddr;
};
struct rtl_dash_ioctl_struct {
__u32 cmd;
__u32 offset;
__u32 len;
union {
__u32 data;
void *data_buffer;
};
};
struct settings_ipv4 {
__u32 IPv4addr;
__u32 IPv4mask;
__u32 IPv4Gateway;
};
struct settings_ipv6 {
__u32 reserved;
__u32 prefixLen;
__u16 IPv6addr[8];
__u16 IPv6Gateway[8];
};
struct settings_ext_snmp {
__u16 index;
__u16 oid_get_len;
__u8 oid_for_get[24];
__u8 reserved0[26];
__u16 value_len;
__u8 value[256];
__u8 supported;
__u8 reserved1[27];
};
struct wakeup_pattern {
__u8 index;
__u8 valid;
__u8 start;
__u8 length;
__u8 name[36];
__u8 mask[16];
__u8 pattern[128];
__u32 reserved[2];
};
typedef struct _RX_DASH_FROM_FW_DESC {
u16 length;
u8 statusLowByte;
u8 statusHighByte;
u32 resv;
u64 BufferAddress;
}
RX_DASH_FROM_FW_DESC, *PRX_DASH_FROM_FW_DESC;
typedef struct _TX_DASH_SEND_FW_DESC {
u16 length;
u8 statusLowByte;
u8 statusHighByte;
u32 resv;
u64 BufferAddress;
}
TX_DASH_SEND_FW_DESC, *PTX_DASH_SEND_FW_DESC;
typedef struct _OSOOBHdr {
u32 len;
u8 type;
u8 flag;
u8 hostReqV;
u8 res;
}
OSOOBHdr, *POSOOBHdr;
typedef struct _RX_DASH_BUFFER_TYPE_2 {
OSOOBHdr oobhdr;
u8 RxDataBuffer[0];
}
RX_DASH_BUFFER_TYPE_2, *PRX_DASH_BUFFER_TYPE_2;
#define ALIGN_8 (0x7)
#define ALIGN_16 (0xf)
#define ALIGN_32 (0x1f)
#define ALIGN_64 (0x3f)
#define ALIGN_256 (0xff)
#define ALIGN_4096 (0xfff)
#define OCP_REG_CONFIG0 (0x10)
#define OCP_REG_CONFIG0_REV_F (0xB8)
#define OCP_REG_DASH_POLL (0x30)
#define OCP_REG_HOST_REQ (0x34)
#define OCP_REG_DASH_REQ (0x35)
#define OCP_REG_CR (0x36)
#define OCP_REG_DMEMSTA (0x38)
#define OCP_REG_GPHYAR (0x60)
#define OCP_REG_CONFIG0_DASHEN BIT_15
#define OCP_REG_CONFIG0_OOBRESET BIT_14
#define OCP_REG_CONFIG0_APRDY BIT_13
#define OCP_REG_CONFIG0_FIRMWARERDY BIT_12
#define OCP_REG_CONFIG0_DRIVERRDY BIT_11
#define OCP_REG_CONFIG0_OOB_WDT BIT_9
#define OCP_REG_CONFIG0_DRV_WAIT_OOB BIT_8
#define OCP_REG_CONFIG0_TLSEN BIT_7
#define HW_DASH_SUPPORT_DASH(_M) ((_M)->HwSuppDashVer > 0)
#define HW_DASH_SUPPORT_TYPE_1(_M) ((_M)->HwSuppDashVer == 1)
#define HW_DASH_SUPPORT_TYPE_2(_M) ((_M)->HwSuppDashVer == 2)
#define HW_DASH_SUPPORT_TYPE_3(_M) ((_M)->HwSuppDashVer == 3)
#define RECV_FROM_FW_BUF_SIZE (1520)
#define SEND_TO_FW_BUF_SIZE (1520)
#define RX_DASH_FROM_FW_OWN BIT_15
#define TX_DASH_SEND_FW_OWN BIT_15
#define TX_DASH_SEND_FW_OWN_HIGHBYTE BIT_7
#define TXS_CC3_0 (BIT_0|BIT_1|BIT_2|BIT_3)
#define TXS_EXC BIT_4
#define TXS_LNKF BIT_5
#define TXS_OWC BIT_6
#define TXS_TES BIT_7
#define TXS_UNF BIT_9
#define TXS_LGSEN BIT_11
#define TXS_LS BIT_12
#define TXS_FS BIT_13
#define TXS_EOR BIT_14
#define TXS_OWN BIT_15
#define TPPool_HRDY 0x20
#define HostReqReg (0xC0)
#define SystemMasterDescStartAddrLow (0xF0)
#define SystemMasterDescStartAddrHigh (0xF4)
#define SystemSlaveDescStartAddrLow (0xF8)
#define SystemSlaveDescStartAddrHigh (0xFC)
//DASH Request Type
#define WSMANREG 0x01
#define OSPUSHDATA 0x02
#define RXS_OWN BIT_15
#define RXS_EOR BIT_14
#define RXS_FS BIT_13
#define RXS_LS BIT_12
#define ISRIMR_DP_DASH_OK BIT_15
#define ISRIMR_DP_HOST_OK BIT_13
#define ISRIMR_DP_REQSYS_OK BIT_11
#define ISRIMR_DASH_INTR_EN BIT_12
#define ISRIMR_DASH_INTR_CMAC_RESET BIT_15
#define ISRIMR_DASH_TYPE2_ROK BIT_0
#define ISRIMR_DASH_TYPE2_RDU BIT_1
#define ISRIMR_DASH_TYPE2_TOK BIT_2
#define ISRIMR_DASH_TYPE2_TDU BIT_3
#define ISRIMR_DASH_TYPE2_TX_FIFO_FULL BIT_4
#define ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE BIT_5
#define ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE BIT_6
#define CMAC_OOB_STOP 0x25
#define CMAC_OOB_INIT 0x26
#define CMAC_OOB_RESET 0x2a
#define NO_BASE_ADDRESS 0x00000000
#define RTL8168FP_OOBMAC_BASE 0xBAF70000
#define RTL8168FP_CMAC_IOBASE 0xBAF20000
#define RTL8168FP_KVM_BASE 0xBAF80400
#define CMAC_SYNC_REG 0x20
#define CMAC_RXDESC_OFFSET 0x90 //RX: 0x90 - 0x98
#define CMAC_TXDESC_OFFSET 0x98 //TX: 0x98 - 0x9F
/* cmac write/read MMIO register */
#define RTL_CMAC_W8(tp, reg, val8) writeb ((val8), tp->cmac_ioaddr + (reg))
#define RTL_CMAC_W16(tp, reg, val16) writew ((val16), tp->cmac_ioaddr + (reg))
#define RTL_CMAC_W32(tp, reg, val32) writel ((val32), tp->cmac_ioaddr + (reg))
#define RTL_CMAC_R8(tp, reg) readb (tp->cmac_ioaddr + (reg))
#define RTL_CMAC_R16(tp, reg) readw (tp->cmac_ioaddr + (reg))
#define RTL_CMAC_R32(tp, reg) ((unsigned long) readl (tp->cmac_ioaddr + (reg)))
int rtl8168_dash_ioctl(struct net_device *dev, struct ifreq *ifr);
void HandleDashInterrupt(struct net_device *dev);
int AllocateDashShareMemory(struct net_device *dev);
void FreeAllocatedDashShareMemory(struct net_device *dev);
void DashHwInit(struct net_device *dev);
#endif /* _LINUX_R8168_DASH_H */

View File

@ -1,66 +0,0 @@
/*
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
*/
/************************************************************************************
* This product is covered by one or more of the following patents:
* US6,570,884, US6,115,776, and US6,327,625.
***********************************************************************************/
#ifndef _LINUX_R8168_FIBER_H
#define _LINUX_R8168_FIBER_H
enum {
FIBER_MODE_NIC_ONLY = 0,
FIBER_MODE_RTL8168H_RTL8211FS,
FIBER_MODE_RTL8168H_MDI_SWITCH_RTL8211FS,
FIBER_MODE_MAX
};
enum {
FIBER_STAT_NOT_CHECKED = 0,
FIBER_STAT_CONNECT,
FIBER_STAT_DISCONNECT,
FIBER_STAT_MAX
};
#define HW_FIBER_MODE_ENABLED(_M) ((_M)->HwFiberModeVer > 0)
void rtl8168_hw_init_fiber_nic(struct net_device *dev);
void rtl8168_hw_fiber_nic_d3_para(struct net_device *dev);
void rtl8168_hw_fiber_phy_config(struct net_device *dev);
void rtl8168_hw_switch_mdi_to_fiber(struct net_device *dev);
void rtl8168_hw_switch_mdi_to_nic(struct net_device *dev);
unsigned int rtl8168_hw_fiber_link_ok(struct net_device *dev);
void rtl8168_check_fiber_link_status(struct net_device *dev);
void rtl8168_check_hw_fiber_mode_support(struct net_device *dev);
void rtl8168_set_fiber_mode_software_variable(struct net_device *dev);
#endif /* _LINUX_R8168_FIBER_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,117 +0,0 @@
/*
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
*/
/************************************************************************************
* This product is covered by one or more of the following patents:
* US6,570,884, US6,115,776, and US6,327,625.
***********************************************************************************/
#ifndef _LINUX_R8168_REALWOW_H
#define _LINUX_R8168_REALWOW_H
#define SIOCDEVPRIVATE_RTLREALWOW SIOCDEVPRIVATE+3
#define MAX_RealWoW_KCP_SIZE (100)
#define MAX_RealWoW_Payload (64)
#define KA_TX_PACKET_SIZE (100)
#define KA_WAKEUP_PATTERN_SIZE (120)
//HwSuppKeepAliveOffloadVer
#define HW_SUPPORT_KCP_OFFLOAD(_M) ((_M)->HwSuppKCPOffloadVer > 0)
enum rtl_realwow_cmd {
RTL_REALWOW_SET_KCP_DISABLE=0,
RTL_REALWOW_SET_KCP_INFO,
RTL_REALWOW_SET_KCP_CONTENT,
RTL_REALWOW_SET_KCP_ACKPKTINFO,
RTL_REALWOW_SET_KCP_WPINFO,
RTL_REALWOW_SET_KCPDHCP_TIMEOUT,
RTLT_REALWOW_COMMAND_INVALID
};
struct rtl_realwow_ioctl_struct {
__u32 cmd;
__u32 offset;
__u32 len;
union {
__u32 data;
void *data_buffer;
};
};
typedef struct _MP_KCPInfo {
u8 DIPv4[4];
u8 MacID[6];
u16 UdpPort[2];
u8 PKTLEN[2];
u16 ackLostCnt;
u8 KCP_WakePattern[MAX_RealWoW_Payload];
u8 KCP_AckPacket[MAX_RealWoW_Payload];
u32 KCP_interval;
u8 KCP_WakePattern_Len;
u8 KCP_AckPacket_Len;
u8 KCP_TxPacket[2][KA_TX_PACKET_SIZE];
} MP_KCP_INFO, *PMP_KCP_INFO;
typedef struct _KCPInfo {
u32 nId; // = id
u8 DIPv4[4];
u8 MacID[6];
u16 UdpPort;
u16 PKTLEN;
} KCPInfo, *PKCPInfo;
typedef struct _KCPContent {
u32 id; // = id
u32 mSec; // = msec
u32 size; // =size
u8 bPacket[MAX_RealWoW_KCP_SIZE]; // put packet here
} KCPContent, *PKCPContent;
typedef struct _RealWoWAckPktInfo {
u16 ackLostCnt;
u16 patterntSize;
u8 pattern[MAX_RealWoW_Payload];
} RealWoWAckPktInfo,*PRealWoWAckPktInfo;
typedef struct _RealWoWWPInfo {
u16 patterntSize;
u8 pattern[MAX_RealWoW_Payload];
} RealWoWWPInfo,*PRealWoWWPInfo;
int rtl8168_realwow_ioctl(struct net_device *dev, struct ifreq *ifr);
void rtl8168_realwow_hw_init(struct net_device *dev);
void rtl8168_get_realwow_hw_version(struct net_device *dev);
void rtl8168_set_realwow_d3_para(struct net_device *dev);
#endif /* _LINUX_R8168_REALWOW_H */

View File

@ -1,288 +0,0 @@
/*
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
*/
/************************************************************************************
* This product is covered by one or more of the following patents:
* US6,570,884, US6,115,776, and US6,327,625.
***********************************************************************************/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/ethtool.h>
#include <linux/netdevice.h>
#include <linux/delay.h>
#include <asm/io.h>
#include "r8168.h"
#include "rtl_eeprom.h"
//-------------------------------------------------------------------
//rtl8168_eeprom_type():
// tell the eeprom type
//return value:
// 0: the eeprom type is 93C46
// 1: the eeprom type is 93C56 or 93C66
//-------------------------------------------------------------------
void rtl8168_eeprom_type(struct rtl8168_private *tp)
{
u16 magic = 0;
if (tp->mcfg == CFG_METHOD_DEFAULT)
goto out_no_eeprom;
if(RTL_R8(tp, 0xD2)&0x04) {
//not support
//tp->eeprom_type = EEPROM_TWSI;
//tp->eeprom_len = 256;
goto out_no_eeprom;
} else if(RTL_R32(tp, RxConfig) & RxCfg_9356SEL) {
tp->eeprom_type = EEPROM_TYPE_93C56;
tp->eeprom_len = 256;
} else {
tp->eeprom_type = EEPROM_TYPE_93C46;
tp->eeprom_len = 128;
}
magic = rtl8168_eeprom_read_sc(tp, 0);
out_no_eeprom:
if ((magic != 0x8129) && (magic != 0x8128)) {
tp->eeprom_type = EEPROM_TYPE_NONE;
tp->eeprom_len = 0;
}
}
void rtl8168_eeprom_cleanup(struct rtl8168_private *tp)
{
u8 x;
x = RTL_R8(tp, Cfg9346);
x &= ~(Cfg9346_EEDI | Cfg9346_EECS);
RTL_W8(tp, Cfg9346, x);
rtl8168_raise_clock(tp, &x);
rtl8168_lower_clock(tp, &x);
}
int rtl8168_eeprom_cmd_done(struct rtl8168_private *tp)
{
u8 x;
int i;
rtl8168_stand_by(tp);
for (i = 0; i < 50000; i++) {
x = RTL_R8(tp, Cfg9346);
if (x & Cfg9346_EEDO) {
udelay(RTL_CLOCK_RATE * 2 * 3);
return 0;
}
udelay(1);
}
return -1;
}
//-------------------------------------------------------------------
//rtl8168_eeprom_read_sc():
// read one word from eeprom
//-------------------------------------------------------------------
u16 rtl8168_eeprom_read_sc(struct rtl8168_private *tp, u16 reg)
{
int addr_sz = 6;
u8 x;
u16 data;
if(tp->eeprom_type == EEPROM_TYPE_NONE) {
return -1;
}
if (tp->eeprom_type==EEPROM_TYPE_93C46)
addr_sz = 6;
else if (tp->eeprom_type==EEPROM_TYPE_93C56)
addr_sz = 8;
x = Cfg9346_EEM1 | Cfg9346_EECS;
RTL_W8(tp, Cfg9346, x);
rtl8168_shift_out_bits(tp, RTL_EEPROM_READ_OPCODE, 3);
rtl8168_shift_out_bits(tp, reg, addr_sz);
data = rtl8168_shift_in_bits(tp);
rtl8168_eeprom_cleanup(tp);
RTL_W8(tp, Cfg9346, 0);
return data;
}
//-------------------------------------------------------------------
//rtl8168_eeprom_write_sc():
// write one word to a specific address in the eeprom
//-------------------------------------------------------------------
void rtl8168_eeprom_write_sc(struct rtl8168_private *tp, u16 reg, u16 data)
{
u8 x;
int addr_sz = 6;
int w_dummy_addr = 4;
if(tp->eeprom_type == EEPROM_TYPE_NONE) {
return ;
}
if (tp->eeprom_type==EEPROM_TYPE_93C46) {
addr_sz = 6;
w_dummy_addr = 4;
} else if (tp->eeprom_type==EEPROM_TYPE_93C56) {
addr_sz = 8;
w_dummy_addr = 6;
}
x = Cfg9346_EEM1 | Cfg9346_EECS;
RTL_W8(tp, Cfg9346, x);
rtl8168_shift_out_bits(tp, RTL_EEPROM_EWEN_OPCODE, 5);
rtl8168_shift_out_bits(tp, reg, w_dummy_addr);
rtl8168_stand_by(tp);
rtl8168_shift_out_bits(tp, RTL_EEPROM_ERASE_OPCODE, 3);
rtl8168_shift_out_bits(tp, reg, addr_sz);
if (rtl8168_eeprom_cmd_done(tp) < 0) {
return;
}
rtl8168_stand_by(tp);
rtl8168_shift_out_bits(tp, RTL_EEPROM_WRITE_OPCODE, 3);
rtl8168_shift_out_bits(tp, reg, addr_sz);
rtl8168_shift_out_bits(tp, data, 16);
if (rtl8168_eeprom_cmd_done(tp) < 0) {
return;
}
rtl8168_stand_by(tp);
rtl8168_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5);
rtl8168_shift_out_bits(tp, reg, w_dummy_addr);
rtl8168_eeprom_cleanup(tp);
RTL_W8(tp, Cfg9346, 0);
}
void rtl8168_raise_clock(struct rtl8168_private *tp, u8 *x)
{
*x = *x | Cfg9346_EESK;
RTL_W8(tp, Cfg9346, *x);
udelay(RTL_CLOCK_RATE);
}
void rtl8168_lower_clock(struct rtl8168_private *tp, u8 *x)
{
*x = *x & ~Cfg9346_EESK;
RTL_W8(tp, Cfg9346, *x);
udelay(RTL_CLOCK_RATE);
}
void rtl8168_shift_out_bits(struct rtl8168_private *tp, int data, int count)
{
u8 x;
int mask;
mask = 0x01 << (count - 1);
x = RTL_R8(tp, Cfg9346);
x &= ~(Cfg9346_EEDI | Cfg9346_EEDO);
do {
if (data & mask)
x |= Cfg9346_EEDI;
else
x &= ~Cfg9346_EEDI;
RTL_W8(tp, Cfg9346, x);
udelay(RTL_CLOCK_RATE);
rtl8168_raise_clock(tp, &x);
rtl8168_lower_clock(tp, &x);
mask = mask >> 1;
} while(mask);
x &= ~Cfg9346_EEDI;
RTL_W8(tp, Cfg9346, x);
}
u16 rtl8168_shift_in_bits(struct rtl8168_private *tp)
{
u8 x;
u16 d, i;
x = RTL_R8(tp, Cfg9346);
x &= ~(Cfg9346_EEDI | Cfg9346_EEDO);
d = 0;
for (i = 0; i < 16; i++) {
d = d << 1;
rtl8168_raise_clock(tp, &x);
x = RTL_R8(tp, Cfg9346);
x &= ~Cfg9346_EEDI;
if (x & Cfg9346_EEDO)
d |= 1;
rtl8168_lower_clock(tp, &x);
}
return d;
}
void rtl8168_stand_by(struct rtl8168_private *tp)
{
u8 x;
x = RTL_R8(tp, Cfg9346);
x &= ~(Cfg9346_EECS | Cfg9346_EESK);
RTL_W8(tp, Cfg9346, x);
udelay(RTL_CLOCK_RATE);
x |= Cfg9346_EECS;
RTL_W8(tp, Cfg9346, x);
}
void rtl8168_set_eeprom_sel_low(struct rtl8168_private *tp)
{
RTL_W8(tp, Cfg9346, Cfg9346_EEM1);
RTL_W8(tp, Cfg9346, Cfg9346_EEM1 | Cfg9346_EESK);
udelay(20);
RTL_W8(tp, Cfg9346, Cfg9346_EEM1);
}

View File

@ -1,55 +0,0 @@
/*
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
*/
/************************************************************************************
* This product is covered by one or more of the following patents:
* US6,570,884, US6,115,776, and US6,327,625.
***********************************************************************************/
//EEPROM opcodes
#define RTL_EEPROM_READ_OPCODE 06
#define RTL_EEPROM_WRITE_OPCODE 05
#define RTL_EEPROM_ERASE_OPCODE 07
#define RTL_EEPROM_EWEN_OPCODE 19
#define RTL_EEPROM_EWDS_OPCODE 16
#define RTL_CLOCK_RATE 3
void rtl8168_eeprom_type(struct rtl8168_private *tp);
void rtl8168_eeprom_cleanup(struct rtl8168_private *tp);
u16 rtl8168_eeprom_read_sc(struct rtl8168_private *tp, u16 reg);
void rtl8168_eeprom_write_sc(struct rtl8168_private *tp, u16 reg, u16 data);
void rtl8168_shift_out_bits(struct rtl8168_private *tp, int data, int count);
u16 rtl8168_shift_in_bits(struct rtl8168_private *tp);
void rtl8168_raise_clock(struct rtl8168_private *tp, u8 *x);
void rtl8168_lower_clock(struct rtl8168_private *tp, u8 *x);
void rtl8168_stand_by(struct rtl8168_private *tp);
void rtl8168_set_eeprom_sel_low(struct rtl8168_private *tp);

View File

@ -1,358 +0,0 @@
/*
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
*/
/************************************************************************************
* This product is covered by one or more of the following patents:
* US6,570,884, US6,115,776, and US6,327,625.
***********************************************************************************/
#include <linux/module.h>
#include <linux/version.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/delay.h>
#include <linux/in.h>
#include <linux/ethtool.h>
#include <asm/uaccess.h>
#include "r8168.h"
#include "rtl_eeprom.h"
#include "rtltool.h"
int rtl8168_tool_ioctl(struct rtl8168_private *tp, struct ifreq *ifr)
{
struct rtltool_cmd my_cmd;
unsigned long flags;
int ret;
if (copy_from_user(&my_cmd, ifr->ifr_data, sizeof(my_cmd)))
return -EFAULT;
ret = 0;
switch (my_cmd.cmd) {
case RTLTOOL_READ_MAC:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (my_cmd.len==1)
my_cmd.data = readb(tp->mmio_addr+my_cmd.offset);
else if (my_cmd.len==2)
my_cmd.data = readw(tp->mmio_addr+(my_cmd.offset&~1));
else if (my_cmd.len==4)
my_cmd.data = readl(tp->mmio_addr+(my_cmd.offset&~3));
else {
ret = -EOPNOTSUPP;
break;
}
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
ret = -EFAULT;
break;
}
break;
case RTLTOOL_WRITE_MAC:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (my_cmd.len==1)
writeb(my_cmd.data, tp->mmio_addr+my_cmd.offset);
else if (my_cmd.len==2)
writew(my_cmd.data, tp->mmio_addr+(my_cmd.offset&~1));
else if (my_cmd.len==4)
writel(my_cmd.data, tp->mmio_addr+(my_cmd.offset&~3));
else {
ret = -EOPNOTSUPP;
break;
}
break;
case RTLTOOL_READ_PHY:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
spin_lock_irqsave(&tp->lock, flags);
my_cmd.data = rtl8168_mdio_prot_read(tp, my_cmd.offset);
spin_unlock_irqrestore(&tp->lock, flags);
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
ret = -EFAULT;
break;
}
break;
case RTLTOOL_WRITE_PHY:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
spin_lock_irqsave(&tp->lock, flags);
rtl8168_mdio_prot_write(tp, my_cmd.offset, my_cmd.data);
spin_unlock_irqrestore(&tp->lock, flags);
break;
case RTLTOOL_READ_EPHY:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
spin_lock_irqsave(&tp->lock, flags);
my_cmd.data = rtl8168_ephy_read(tp, my_cmd.offset);
spin_unlock_irqrestore(&tp->lock, flags);
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
ret = -EFAULT;
break;
}
break;
case RTLTOOL_WRITE_EPHY:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
spin_lock_irqsave(&tp->lock, flags);
rtl8168_ephy_write(tp, my_cmd.offset, my_cmd.data);
spin_unlock_irqrestore(&tp->lock, flags);
break;
case RTLTOOL_READ_ERI:
my_cmd.data = 0;
if (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) {
spin_lock_irqsave(&tp->lock, flags);
my_cmd.data = rtl8168_eri_read(tp, my_cmd.offset, my_cmd.len, ERIAR_ExGMAC);
spin_unlock_irqrestore(&tp->lock, flags);
} else {
ret = -EOPNOTSUPP;
break;
}
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
ret = -EFAULT;
break;
}
break;
case RTLTOOL_WRITE_ERI:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) {
spin_lock_irqsave(&tp->lock, flags);
rtl8168_eri_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data, ERIAR_ExGMAC);
spin_unlock_irqrestore(&tp->lock, flags);
} else {
ret = -EOPNOTSUPP;
break;
}
break;
case RTLTOOL_READ_PCI:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
my_cmd.data = 0;
if (my_cmd.len==1)
pci_read_config_byte(tp->pci_dev, my_cmd.offset,
(u8 *)&my_cmd.data);
else if (my_cmd.len==2)
pci_read_config_word(tp->pci_dev, my_cmd.offset,
(u16 *)&my_cmd.data);
else if (my_cmd.len==4)
pci_read_config_dword(tp->pci_dev, my_cmd.offset,
&my_cmd.data);
else {
ret = -EOPNOTSUPP;
break;
}
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
ret = -EFAULT;
break;
}
break;
case RTLTOOL_WRITE_PCI:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (my_cmd.len==1)
pci_write_config_byte(tp->pci_dev, my_cmd.offset,
my_cmd.data);
else if (my_cmd.len==2)
pci_write_config_word(tp->pci_dev, my_cmd.offset,
my_cmd.data);
else if (my_cmd.len==4)
pci_write_config_dword(tp->pci_dev, my_cmd.offset,
my_cmd.data);
else {
ret = -EOPNOTSUPP;
break;
}
break;
case RTLTOOL_READ_EEPROM:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
spin_lock_irqsave(&tp->lock, flags);
my_cmd.data = rtl8168_eeprom_read_sc(tp, my_cmd.offset);
spin_unlock_irqrestore(&tp->lock, flags);
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
ret = -EFAULT;
break;
}
break;
case RTLTOOL_WRITE_EEPROM:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
spin_lock_irqsave(&tp->lock, flags);
rtl8168_eeprom_write_sc(tp, my_cmd.offset, my_cmd.data);
spin_unlock_irqrestore(&tp->lock, flags);
break;
case RTL_READ_OOB_MAC:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
spin_lock_irqsave(&tp->lock, flags);
rtl8168_oob_mutex_lock(tp);
my_cmd.data = rtl8168_ocp_read(tp, my_cmd.offset, 4);
rtl8168_oob_mutex_unlock(tp);
spin_unlock_irqrestore(&tp->lock, flags);
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
ret = -EFAULT;
break;
}
break;
case RTL_WRITE_OOB_MAC:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (my_cmd.len == 0 || my_cmd.len > 4)
return -EOPNOTSUPP;
spin_lock_irqsave(&tp->lock, flags);
rtl8168_oob_mutex_lock(tp);
rtl8168_ocp_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data);
rtl8168_oob_mutex_unlock(tp);
spin_unlock_irqrestore(&tp->lock, flags);
break;
case RTL_ENABLE_PCI_DIAG:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
spin_lock_irqsave(&tp->lock, flags);
tp->rtk_enable_diag = 1;
spin_unlock_irqrestore(&tp->lock, flags);
dprintk("enable rtk diag\n");
break;
case RTL_DISABLE_PCI_DIAG:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
spin_lock_irqsave(&tp->lock, flags);
tp->rtk_enable_diag = 0;
spin_unlock_irqrestore(&tp->lock, flags);
dprintk("disable rtk diag\n");
break;
case RTL_READ_MAC_OCP:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if (my_cmd.offset % 2)
return -EOPNOTSUPP;
spin_lock_irqsave(&tp->lock, flags);
my_cmd.data = rtl8168_mac_ocp_read(tp, my_cmd.offset);
spin_unlock_irqrestore(&tp->lock, flags);
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
ret = -EFAULT;
break;
}
break;
case RTL_WRITE_MAC_OCP:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
if ((my_cmd.offset % 2) || (my_cmd.len != 2))
return -EOPNOTSUPP;
spin_lock_irqsave(&tp->lock, flags);
rtl8168_mac_ocp_write(tp, my_cmd.offset, (u16)my_cmd.data);
spin_unlock_irqrestore(&tp->lock, flags);
break;
case RTL_DIRECT_READ_PHY_OCP:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
spin_lock_irqsave(&tp->lock, flags);
my_cmd.data = rtl8168_mdio_prot_direct_read_phy_ocp(tp, my_cmd.offset);
spin_unlock_irqrestore(&tp->lock, flags);
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
ret = -EFAULT;
break;
}
break;
case RTL_DIRECT_WRITE_PHY_OCP:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
spin_lock_irqsave(&tp->lock, flags);
rtl8168_mdio_prot_direct_write_phy_ocp(tp, my_cmd.offset, my_cmd.data);
spin_unlock_irqrestore(&tp->lock, flags);
break;
default:
ret = -EOPNOTSUPP;
break;
}
return ret;
}

View File

@ -1,85 +0,0 @@
/*
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2020 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses/>.
#
# Author:
# Realtek NIC software team <nicfae@realtek.com>
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
#
################################################################################
*/
/************************************************************************************
* This product is covered by one or more of the following patents:
* US6,570,884, US6,115,776, and US6,327,625.
***********************************************************************************/
#ifndef _LINUX_RTLTOOL_H
#define _LINUX_RTLTOOL_H
#define SIOCRTLTOOL SIOCDEVPRIVATE+1
enum rtl_cmd {
RTLTOOL_READ_MAC=0,
RTLTOOL_WRITE_MAC,
RTLTOOL_READ_PHY,
RTLTOOL_WRITE_PHY,
RTLTOOL_READ_EPHY,
RTLTOOL_WRITE_EPHY,
RTLTOOL_READ_ERI,
RTLTOOL_WRITE_ERI,
RTLTOOL_READ_PCI,
RTLTOOL_WRITE_PCI,
RTLTOOL_READ_EEPROM,
RTLTOOL_WRITE_EEPROM,
RTL_READ_OOB_MAC,
RTL_WRITE_OOB_MAC,
RTL_ENABLE_PCI_DIAG,
RTL_DISABLE_PCI_DIAG,
RTL_READ_MAC_OCP,
RTL_WRITE_MAC_OCP,
RTL_DIRECT_READ_PHY_OCP,
RTL_DIRECT_WRITE_PHY_OCP,
RTLTOOL_INVALID
};
struct rtltool_cmd {
__u32 cmd;
__u32 offset;
__u32 len;
__u32 data;
};
enum mode_access {
MODE_NONE=0,
MODE_READ,
MODE_WRITE
};
#ifdef __KERNEL__
int rtl8168_tool_ioctl(struct rtl8168_private *tp, struct ifreq *ifr);
#endif
#endif /* _LINUX_RTLTOOL_H */

View File

@ -9,12 +9,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=UnblockNeteaseMusic-Go
PKG_VERSION:=0.2.9
PKG_RELEASE:=1
PKG_VERSION:=0.2.10
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/cnsilvan/UnblockNeteaseMusic/tar.gz/$(PKG_VERSION)?
PKG_HASH:=9d352a0080c33e75e39586c531f9b3b88eea1d8a9d49c9e95c19d6a7d29f1419
PKG_HASH:=2103562e399d04fcce0aa017057357e6fcec8beb6dc65c17ad1bdc06f38d6b7a
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILE:=LICENSE

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=183
PKG_RELEASE:=10
PKG_RELEASE:=11
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \

View File

@ -18,11 +18,12 @@ function index()
entry({"admin", "services", "shadowsocksr", "subscribe"}, call("subscribe"))
entry({"admin", "services", "shadowsocksr", "checkport"}, call("check_port"))
entry({"admin", "services", "shadowsocksr", "log"}, form("shadowsocksr/log"), _("Log"), 80).leaf = true
entry({"admin", "services", "shadowsocksr", "run"}, call("act_status")).leaf = true
entry({"admin", "services", "shadowsocksr", "ping"}, call("act_ping")).leaf = true
entry({"admin", "services", "shadowsocksr", "run"}, call("act_status"))
entry({"admin", "services", "shadowsocksr", "ping"}, call("act_ping"))
entry({"admin", "services", "shadowsocksr", "reset"}, call("act_reset"))
entry({"admin", "services", "shadowsocksr", "restart"}, call("act_restart"))
entry({"admin", "services", "shadowsocksr", "delete"}, call("act_delete"))
entry({"admin", "services", "shadowsocksr", "cache"}, call("act_cache"))
end
function subscribe()
@ -61,14 +62,10 @@ function act_ping()
end
function check_status()
local retstring = "1"
local set = "/usr/bin/ssr-check www." .. luci.http.formvalue("set") .. ".com 80 3 1"
sret = luci.sys.call(set)
if sret == 0 then
retstring = "0"
end
local e = {}
e.ret = luci.sys.call("/usr/bin/ssr-check www." .. luci.http.formvalue("set") .. ".com 80 3 1")
luci.http.prepare_content("application/json")
luci.http.write_json({ret = retstring})
luci.http.write_json(e)
end
function refresh_data()
@ -79,7 +76,6 @@ function refresh_data()
end
function check_port()
local set = ""
local retstring = "<br /><br />"
local s
local server_name = ""
@ -124,3 +120,10 @@ function act_delete()
luci.sys.call("/etc/init.d/shadowsocksr restart &")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers"))
end
function act_cache()
local e = {}
e.ret = luci.sys.call("/usr/bin/pdnsd-ctl -c /var/etc/ssrplus/pdnsd empty-cache >/dev/null")
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -3,9 +3,9 @@ local server_table = {}
uci:foreach("shadowsocksr", "servers", function(s)
if s.alias then
server_table[s[".name"]] = "[%s]:%s" % {string.upper(s.type), s.alias}
server_table[s[".name"]] = "[%s]:%s" % {string.upper(s.v2ray_protocol or s.type), s.alias}
elseif s.server and s.server_port then
server_table[s[".name"]] = "[%s]:%s:%s" % {string.upper(s.type), s.server, s.server_port}
server_table[s[".name"]] = "[%s]:%s:%s" % {string.upper(s.v2ray_protocol or s.type), s.server, s.server_port}
end
end)

View File

@ -150,6 +150,11 @@ if nixio.fs.access("/usr/bin/kcptun-client") then
end
end
if uci:get_first("shadowsocksr", 'global', 'pdnsd_enable', '0') == '1' then
s = m:field(DummyValue, "cache", translate("Reset pdnsd cache"))
s.template = "shadowsocksr/cache"
end
s = m:field(DummyValue, "google", translate("Google Connectivity"))
s.value = translate("No Check")
s.template = "shadowsocksr/check"

View File

@ -0,0 +1,29 @@
<%+cbi/valueheader%>
<script type="text/javascript">//<![CDATA[
function cache(btn,urlname)
{
btn.disabled = true;
btn.value = '<%:Perform reset%>';
murl=urlname;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "shadowsocksr","cache")%>',
{ set:murl },
function(x,rv)
{
var s = document.getElementById(urlname+'-status');
if (s)
{
if (rv.ret=="0")
s.innerHTML ="<font color='green'>"+"<%:Reset complete%>"+"</font>";
else
s.innerHTML ="<font color='red'>"+"<%:Reset Error%>"+"</font>";
}
btn.disabled = false;
btn.value = '<%:Perform reset%>';
}
);
return false;
}
//]]></script>
<input type="button" class="cbi-button cbi-button-reset" value="<%:Perform reset%>" onclick="return cache(this,'<%=self.option%>')" />
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
<%+cbi/valuefooter%>

View File

@ -1,6 +1,6 @@
<%+cbi/valueheader%>
<script type="text/javascript">//<![CDATA[
function subscribe(btn,dataname) {
function reset(btn,dataname) {
var s = document.getElementById(dataname + '-status');
var reset = prompt('<%:Really reset all changes?%><%:Please fill in reset%>',"")
if (reset == null || reset == "") {
@ -20,6 +20,6 @@
return false;
}
//]]></script>
<input type="button" class="cbi-button cbi-button-reset" value="<%:Perform reset%> " onclick="return subscribe(this,'<%=self.option%>')" />
<input type="button" class="cbi-button cbi-button-reset" value="<%:Perform reset%> " onclick="return reset(this,'<%=self.option%>')" />
<span id="<%=self.option%>-status"></span>
<%+cbi/valuefooter%>

View File

@ -220,8 +220,7 @@ function import_ssr_url(btn, urlname, sid) {
document.getElementsByName('cbid.shadowsocksr.' + sid + '.password')[0].value = password;
document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls')[0].checked = true;
document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls')[0].dispatchEvent(event);
document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_host')[0].value = queryParam.peer || '';
document.getElementsByName('cbid.shadowsocksr.' + sid + '.insecure')[0].checked = queryParam.allowInsecure == '1';
document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_host')[0].value = queryParam.sni || '';
if (param != undefined) {
document.getElementsByName('cbid.shadowsocksr.' + sid + '.alias')[0].value = decodeURI(param);
}

View File

@ -733,5 +733,11 @@ msgstr "输入的内容不正确!"
msgid "Reset complete"
msgstr "重置完成"
msgid "Reset Error"
msgstr "重置错误"
msgid "Reset pdnsd cache"
msgstr "重置pdnsd缓存"
msgid "Finger Print"
msgstr "指纹伪造"

View File

@ -37,7 +37,6 @@ server_count=0
redir_tcp=0
redir_udp=0
local_enable=0
ss_protocol=
kcp_enable_flag=0
pdnsd_enable_flag=0
switch_server=$1
@ -462,6 +461,7 @@ start_shunt() {
}
start_local() {
[ "$LOCAL_SERVER" = "nil" ] && return 1
local local_port=$(uci_get_by_type socks5_proxy local_port)
[ "$LOCAL_SERVER" == "$SHUNT_SERVER" ] && tmp_local_port=$local_port
local type=$(uci_get_by_name $LOCAL_SERVER type)
@ -581,12 +581,16 @@ load_config() {
else
GLOBAL_SERVER=$switch_server
fi
LOCAL_SERVER=$(uci_get_by_type socks5_proxy server nil)
if [ "$GLOBAL_SERVER" == "nil" ]; then
mode="tcp,udp"
_local="2"
local_config_file=$TMP_PATH/tcp-udp-ssr-local.json
start_local
return 1
fi
UDP_RELAY_SERVER=$(uci_get_by_type global udp_relay_server nil)
SHUNT_SERVER=$(uci_get_by_type global netflix_server nil)
LOCAL_SERVER=$(uci_get_by_type socks5_proxy server nil)
tcp_config_file=$TMP_PATH/tcp-only-ssr-retcp.json
case "$UDP_RELAY_SERVER" in
nil)
@ -843,7 +847,7 @@ stop() {
ps -w | grep -v "grep" | grep ssr-monitor | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 &
ps -w | grep -v "grep" | grep "sleep 0000" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 &
ps -w | grep -v "grep" | grep "$TMP_PATH" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 &
killall -q -9 v2ray-plugin obfs-local
killall -q -9 v2ray-plugin obfs-local xray-plugin
rm -f /var/lock/ssr-monitor.lock
if [ -f "/var/dnsmasq.d/dnsmasq-ssrplus.conf" ]; then
rm -rf /var/dnsmasq.d/dnsmasq-ssrplus.conf $TMP_DNSMASQ_PATH $TMP_PATH/*-ssr-*.json

View File

@ -3639,7 +3639,6 @@
103.107.216.0/22
103.107.220.0/22
103.108.52.0/22
103.108.64.0/22
103.108.160.0/22
103.108.164.0/22
103.108.184.0/23
@ -3656,7 +3655,6 @@
103.109.88.0/22
103.109.106.0/23
103.109.248.0/22
103.110.32.0/22
103.110.80.0/23
103.110.92.0/22
103.110.100.0/22
@ -4139,6 +4137,13 @@
103.164.178.0/23
103.164.226.0/23
103.165.44.0/23
103.165.52.0/23
103.165.82.0/23
103.165.110.0/23
103.166.20.0/23
103.166.50.0/23
103.166.52.0/23
103.166.54.0/23
103.192.0.0/22
103.192.4.0/22
103.192.8.0/22
@ -5103,7 +5108,6 @@
103.248.168.0/22
103.248.192.0/22
103.248.212.0/22
103.248.220.0/22
103.248.224.0/22
103.249.8.0/22
103.249.12.0/22
@ -6753,7 +6757,6 @@
202.74.42.0/24
202.74.52.0/24
202.74.80.0/20
202.74.232.0/22
202.74.254.0/23
202.75.208.0/20
202.75.252.0/22

File diff suppressed because it is too large Load Diff

View File

@ -247,14 +247,9 @@ local function processData(szType, content)
local t = split(v, '=')
params[t[1]] = t[2]
end
if params.peer then
if params.sni then
-- 未指定peersni默认使用remote addr
result.tls_host = params.peer
end
if params.allowInsecure == "1" then
result.insecure = "1"
else
result.insecure = "0"
result.tls_host = params.sni
end
else
result.server_port = host[2]

View File

@ -1,151 +0,0 @@
#
# Copyright (C) 2019-2020 Xingwang Liao
# Copyright (C) 2019-2021 Mattraks
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=v2ray
PKG_VERSION:=4.38.0
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/v2ray-core-$(PKG_VERSION)
PKG_SOURCE:=v2ray-core-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/v2fly/v2ray-core/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=36f718389501e03131d6637cfee5e8f2f1efe123f88bd4143f5c6d0d6007bfba
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Xingwang Liao <kuoruan@gmail.com>
PKG_CONFIG_DEPENDS:= \
CONFIG_V2RAY_EXCLUDE_V2CTL \
CONFIG_V2RAY_EXCLUDE_ASSETS \
CONFIG_V2RAY_COMPRESS_GOPROXY \
CONFIG_V2RAY_COMPRESS_UPX
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/v2fly/v2ray-core/v4
GO_PKG_LDFLAGS:=-s -w
GO_PKG_LDFLAGS_X:= \
$(GO_PKG).build=OpenWrt \
$(GO_PKG).version=$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/$(PKG_NAME)
TITLE:=A platform for building proxies
URL:=https://www.v2fly.org
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
DEPENDS:=@BROKEN $(GO_ARCH_DEPENDS) +ca-certificates
endef
define Package/$(PKG_NAME)/config
menu "V2Ray Configuration"
depends on PACKAGE_v2ray
config V2RAY_COMPRESS_GOPROXY
bool "Compiling with GOPROXY proxy"
default n
config V2RAY_EXCLUDE_V2CTL
bool "Exclude V2Ctl"
default y
config V2RAY_EXCLUDE_ASSETS
bool "Exclude geoip.dat & geosite.dat"
default y
config V2RAY_COMPRESS_UPX
bool "Compress executable files with UPX"
default y
endmenu
endef
define Package/$(PKG_NAME)/description
Project V is a set of network tools that help you to build your own computer network.
It secures your network connections and thus protects your privacy.
This package contains v2ray, v2ctl, geoip.dat and geosite.dat.
endef
ifeq ($(CONFIG_V2RAY_COMPRESS_GOPROXY),y)
export GO111MODULE=on
export GOPROXY=https://goproxy.io
#export GOPROXY=https://mirrors.aliyun.com/goproxy/
endif
GEOIP_VER:=latest
GEOIP_FILE:=geoip-$(GEOIP_VER).dat
define Download/geoip.dat
URL:=https://github.com/v2fly/geoip/releases/$(GEOIP_VER)/download
URL_FILE:=geoip.dat
FILE:=$(GEOIP_FILE)
HASH:=skip
endef
GEOSITE_VER:=latest
GEOSITE_FILE:=geosite-$(GEOSITE_VER).dat
define Download/geosite.dat
URL:=https://github.com/v2fly/domain-list-community/releases/$(GEOSITE_VER)/download
URL_FILE:=dlc.dat
FILE:=$(GEOSITE_FILE)
HASH:=skip
endef
define Build/Prepare
$(call Build/Prepare/Default)
ifneq ($(CONFIG_V2RAY_EXCLUDE_ASSETS),y)
# move file to make sure download new file every build
mv -f $(DL_DIR)/$(GEOIP_FILE) $(PKG_BUILD_DIR)/release/config/geoip.dat
mv -f $(DL_DIR)/$(GEOSITE_FILE) $(PKG_BUILD_DIR)/release/config/geosite.dat
endif
endef
define Build/Compile
$(eval GO_PKG_BUILD_PKG:=$(GO_PKG)/main)
$(call GoPackage/Build/Compile)
mv -f $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/v2ray
ifeq ($(CONFIG_V2RAY_COMPRESS_UPX),y)
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/v2ray || true
endif
ifneq ($(CONFIG_V2RAY_EXCLUDE_V2CTL),y)
$(eval GO_PKG_BUILD_PKG:=$(GO_PKG)/infra/control/main)
$(call GoPackage/Build/Compile)
mv -f $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/v2ctl
ifeq ($(CONFIG_V2RAY_COMPRESS_UPX),y)
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/v2ctl || true
endif
endif
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/v2ray $(1)/usr/bin
ifneq ($(CONFIG_V2RAY_EXCLUDE_V2CTL),y)
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/v2ctl $(1)/usr/bin
endif
ifneq ($(CONFIG_V2RAY_EXCLUDE_ASSETS),y)
$(INSTALL_DIR) $(1)/usr/share/v2ray
$(INSTALL_DATA) $(PKG_BUILD_DIR)/release/config/{geoip,geosite}.dat $(1)/usr/share/v2ray
endif
endef
ifneq ($(CONFIG_V2RAY_EXCLUDE_ASSETS),y)
$(eval $(call Download,geoip.dat))
$(eval $(call Download,geosite.dat))
endif
$(eval $(call GoBinPackage,$(PKG_NAME)))
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -1016,7 +1016,12 @@ dnsmasq_start()
xappend "--dhcp-broadcast=tag:needs-broadcast"
xappend "--addn-hosts=$(dirname $HOSTFILE)"
config_get_bool ignore_hosts_dir "$cfg" ignore_hosts_dir 0
if [ "$ignore_hosts_dir" = "1" ]; then
xappend "--addn-hosts=$HOSTFILE"
else
xappend "--addn-hosts=$(dirname $HOSTFILE)"
fi
config_get dnsmasqconfdir "$cfg" confdir "/tmp/dnsmasq.d"
xappend "--conf-dir=$dnsmasqconfdir"

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bpftools
PKG_VERSION:=5.11.2
PKG_RELEASE:=2
PKG_VERSION:=5.11.16
PKG_RELEASE:=1
PKG_SOURCE:=linux-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/kernel/v5.x
PKG_HASH:=904a5b3cbaf5264ef8da6c7a5445fa7ea19168ad77fb83a7cc1b8ba95d52d0a0
PKG_HASH:=21163681d130cbce5a6be39019e2c69e44f284855ddd70b1a3bd039249540f43
PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com>
@ -93,9 +93,11 @@ ifneq ($(BUILD_VARIANT),lib)
TARGET_LDFLAGS += -Wl,--gc-sections
endif
MAKE_FLAGS += \
MAKE_VARS = \
EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)"
MAKE_FLAGS += \
BPFTOOL_VERSION="$(LINUX_VERSION)" \
FEATURES_DUMP="$(PKG_BUILD_DIR)/FEATURE-DUMP.openwrt" \
OUTPUT="$(PKG_BUILD_DIR)/" \
@ -128,7 +130,7 @@ define Build/Configure
| sort | uniq > FEATURE-DUMP.openwrt)
$(SED) 's/feature-libbfd=1/feature-libbfd=$(HAVE_LIBBFD)/' \
-e 's/feature-libcap=1/feature-libcap=$(HAVE_LIBCAP)/' \
-e 's/feature-clang-bpf-global-var=1/feature-clang-bpf-global-var=$(HAVE_CLANG)/' \
-e 's/feature-clang-bpf-co-re=1/feature-clang-bpf-co-re=$(HAVE_CLANG)/' \
$(PKG_BUILD_DIR)/FEATURE-DUMP.openwrt
endef

View File

@ -1,11 +0,0 @@
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -236,7 +236,7 @@ define do_install
if [ ! -d '$(DESTDIR_SQ)$2' ]; then \
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \
fi; \
- $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2'
+ $(INSTALL) $(if $3,-m $3,) $1 '$(DESTDIR_SQ)$2'
endef
install_lib: all_cmd

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=iproute2
PKG_VERSION:=5.11.0
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
@ -153,6 +153,7 @@ MAKE_FLAGS += \
KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \
SHARED_LIBS=$(SHARED_LIBS) \
IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
BUILD_VARIANT=$(BUILD_VARIANT) \
LIBBPF_FORCE=$(LIBBPF_FORCE) \
HAVE_ELF=$(HAVE_ELF) \
HAVE_MNL=$(HAVE_MNL) \

View File

@ -1,6 +1,11 @@
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -6,9 +6,9 @@ TARGETS=ss nstat ifstat rtacct lnstat
@@ -2,13 +2,13 @@
SSOBJ=ss.o ssfilter_check.o ssfilter.tab.o
LNSTATOBJ=lnstat.o lnstat_util.o
-TARGETS=ss nstat ifstat rtacct lnstat
+TARGETS=ss nstat
include ../config.mk

View File

@ -5,7 +5,7 @@
YACCFLAGS = -d -t -v
-SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man
+SUBDIRS=lib ip tc bridge misc genl tipc devlink rdma dcb man
+SUBDIRS=lib ip tc bridge misc genl devlink rdma
LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
LDLIBS += $(LIBNETLINK)

View File

@ -0,0 +1,22 @@
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -26,7 +26,7 @@ STATIC_SYM_SOURCES:=$(filter-out $(STATI
ALLOBJ=$(IPOBJ) $(RTMONOBJ)
SCRIPTS=ifcfg rtpr routel routef
-TARGETS=ip rtmon
+TARGETS=$(findstring ip,$(BUILD_VARIANT)) rtmon
all: $(TARGETS) $(SCRIPTS)
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -141,7 +141,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic $< -o $@
-all: tc $(TCSO)
+all: $(findstring tc,$(BUILD_VARIANT)) $(TCSO)
tc: $(TCOBJ) $(LIBNETLINK) libtc.a
$(QUIET_LINK)$(CC) $(filter-out dynsyms.list, $^) $(LDFLAGS) $(LDLIBS) -o $@

View File

@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/target.mk
PKG_NAME:=ccache
PKG_VERSION:=4.1
PKG_VERSION:=4.2.1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/ccache/ccache/releases/download/v$(PKG_VERSION)
PKG_HASH:=5fdc804056632d722a1182e15386696f0ea6c59cb4ab4d65a54f0b269ae86f99
PKG_HASH:=9d6ba1cdefdc690401f404b747d81a9a1802b17af4235815866b7620d980477e
HOST_BUILD_PARALLEL:=1

View File

@ -1,6 +1,6 @@
--- a/src/ccache.cpp
+++ b/src/ccache.cpp
@@ -1654,6 +1654,7 @@ calculate_result_name(Context& ctx,
@@ -1756,6 +1756,7 @@ calculate_result_name(Context& ctx,
"CPLUS_INCLUDE_PATH",
"OBJC_INCLUDE_PATH",
"OBJCPLUS_INCLUDE_PATH", // clang