Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a6870bc362 | |||
| db0dff8260 | |||
|
|
b1d23cd4cb | ||
|
|
dfb5b8d66f | ||
|
|
3de3fb2bdb | ||
|
|
3c627e4c45 | ||
|
|
6478e4145b | ||
|
|
370b35db61 | ||
|
|
c5aff168d9 | ||
|
|
5b3da73bba | ||
|
|
c1684fa66d | ||
|
|
f98f8fc3fe | ||
|
|
530f413fff | ||
|
|
87e3a5eac7 | ||
|
|
38bcfc76b2 | ||
|
|
30004b9f42 | ||
|
|
2ba4581701 | ||
|
|
34e2cdb069 | ||
|
|
e8966d4556 | ||
|
|
7acc285f6a | ||
|
|
67fa84ee6f | ||
|
|
6632fd0cbd | ||
|
|
8468092c16 | ||
|
|
a5bec70af7 | ||
|
|
12d2b83a2d | ||
|
|
a37549124f | ||
|
|
2edf63a4ad | ||
|
|
9aacaa0ffa |
84
.github/workflows/openwrt-ci.yml
vendored
84
.github/workflows/openwrt-ci.yml
vendored
@@ -5,23 +5,12 @@
|
||||
#
|
||||
# Copyright (C) 2020 KFERMercer
|
||||
#
|
||||
#
|
||||
# <https://github.com/KFERMercer/OpenWrt-CI>
|
||||
#
|
||||
# Copyright (C) 2019 P3TERX
|
||||
#
|
||||
# Copyright (C) 2020 KFERMercer
|
||||
#
|
||||
name: OpenWrt-CI
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: 0 20 * * *
|
||||
release:
|
||||
types: [published]
|
||||
repository_dispatch:
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -29,37 +18,30 @@ jobs:
|
||||
|
||||
build_openwrt:
|
||||
|
||||
permissions:
|
||||
contents: write # for release creation
|
||||
name: Build OpenWrt Firmware
|
||||
|
||||
name: Build OpenWrt firmware
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
if: github.event.repository.owner.id == github.event.sender.id || ! github.event.sender.id
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: stable
|
||||
|
||||
- name: Space cleanup
|
||||
- name: Space cleanup and Initialization environment
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: |
|
||||
docker rmi `docker images -q`
|
||||
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android
|
||||
sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* adoptopenjdk* mysql* php* mongodb* dotnet* moby* snapd* || true
|
||||
sudo -E apt-get update
|
||||
sudo -E rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android
|
||||
sudo -E apt-mark hold grub-efi-amd64-signed
|
||||
sudo -E apt-get -y install ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
|
||||
pip3 install pyelftools
|
||||
sudo -E apt-get -y autoremove --purge
|
||||
sudo -E apt-get clean
|
||||
df -h
|
||||
sudo -E apt update
|
||||
sudo -E apt -y purge azure-cli* docker* ghc* zulu* llvm* firefox google* dotnet* powershell* openjdk* mysql* php* mongodb* dotnet* snap*
|
||||
sudo -E apt -y full-upgrade
|
||||
sudo -E apt -y install ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext genisoimage git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool llvm lrzsz msmtp ninja-build p7zip p7zip-full patch pkgconf python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
|
||||
sudo -E systemctl daemon-reload
|
||||
sudo -E apt -y autoremove --purge
|
||||
sudo -E apt clean
|
||||
sudo -E timedatectl set-timezone "Asia/Shanghai"
|
||||
|
||||
- name: Checkout OpenWrt
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Update feeds
|
||||
run: |
|
||||
./scripts/feeds update -a
|
||||
@@ -99,10 +81,8 @@ jobs:
|
||||
- name: Generate configuration file
|
||||
run: make defconfig
|
||||
|
||||
- name: Make download
|
||||
run: |
|
||||
make download -j8
|
||||
find dl -size -1024c -exec rm -f {} \;
|
||||
- name: Download packages
|
||||
run: make download -j16
|
||||
|
||||
- name: Compile firmware
|
||||
run: |
|
||||
@@ -115,40 +95,30 @@ jobs:
|
||||
du -h --max-depth=1 ./ --exclude=build_dir --exclude=bin
|
||||
du -h --max-depth=1 ./build_dir
|
||||
du -h --max-depth=1 ./bin
|
||||
|
||||
- name: Prepare artifact
|
||||
run: |
|
||||
mkdir -p ./artifact/firmware
|
||||
mkdir -p ./artifact/package
|
||||
mkdir -p ./artifact/buildinfo
|
||||
rm -rf $(find ./bin/targets/ -type d -name "packages")
|
||||
cp -rf $(find ./bin/targets/ -type f) ./artifact/firmware/
|
||||
cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact/package/
|
||||
cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/
|
||||
|
||||
- name: Deliver buildinfo
|
||||
uses: actions/upload-artifact@v3
|
||||
|
||||
- name: Upload buildinfo
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: OpenWrt_buildinfo
|
||||
path: ./artifact/buildinfo/
|
||||
|
||||
- name: Deliver package
|
||||
uses: actions/upload-artifact@v3
|
||||
- name: Upload package
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: OpenWrt_package
|
||||
path: ./artifact/package/
|
||||
|
||||
- name: Deliver firmware
|
||||
uses: actions/upload-artifact@v3
|
||||
- name: Upload firmware
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: OpenWrt_firmware
|
||||
path: ./bin/targets/
|
||||
|
||||
|
||||
- name: Upload release asset
|
||||
if: github.event == 'release'
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.YOURTOKEN }}
|
||||
file: ./artifact/firmware/*
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,3 +30,4 @@ git-src
|
||||
.cproject
|
||||
.ccache
|
||||
.vscode*
|
||||
/openwrt_logs
|
||||
@@ -9,6 +9,7 @@ embedfire_lubancat2
|
||||
embedfire_lubancat2n
|
||||
friendlyarm_nanopi-r2c
|
||||
friendlyarm_nanopi-r2s
|
||||
friendlyarm_nanopi-r3s
|
||||
friendlyarm_nanopi-r4s
|
||||
friendlyarm_nanopi-r4se
|
||||
friendlyarm_nanopi-r5s
|
||||
@@ -19,11 +20,12 @@ friendlyarm_nanopc-t6
|
||||
hinlink_opc-h66k
|
||||
hinlink_opc-h68k
|
||||
hinlink_opc-h69k
|
||||
hinlink_h88k
|
||||
```
|
||||
|
||||
### Next plan to add equipment:
|
||||
```
|
||||
hinlink_h88k
|
||||
no
|
||||
```
|
||||
How to compile the OpenWrt firmware you need
|
||||
-
|
||||
@@ -39,10 +41,10 @@ Notice:
|
||||
```bash
|
||||
sudo apt update -y
|
||||
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
|
||||
bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \
|
||||
bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gettext gcc-multilib g++-multilib \
|
||||
git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev \
|
||||
libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev \
|
||||
libssl-dev libtool lrzsz mkisofs msmtp ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 \
|
||||
libssl-dev libtool llvm lrzsz mkisofs msmtp ninja-build p7zip p7zip-full patch pkgconf python3 \
|
||||
python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo \
|
||||
uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
|
||||
```
|
||||
|
||||
750
build_openwrt.sh
Executable file
750
build_openwrt.sh
Executable file
@@ -0,0 +1,750 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#====================================================
|
||||
# OpenWrt 构建管理脚本
|
||||
# 功能:提供交互式菜单,可选择执行特定操作
|
||||
# 更新:2025-04-05
|
||||
#====================================================
|
||||
|
||||
#---------------基础配置---------------#
|
||||
# 日志目录设置
|
||||
LOGS_ROOT="openwrt_logs"
|
||||
SESSION_DIR="${LOGS_ROOT}/$(date +%Y%m%d_%H%M%S)"
|
||||
LOG_FILE="${SESSION_DIR}/main_build_script.log" # 主脚本日志文件名更改,更清晰
|
||||
|
||||
#---------------清理配置---------------#
|
||||
# 需要移除的目录列表 (示例,根据你的需要添加)
|
||||
declare -a REMOVE_DIRS=(
|
||||
# "feeds/packages/net/v2ray-geodata" # 示例
|
||||
)
|
||||
|
||||
# 需要移除的包列表 (示例,根据你的需要添加)
|
||||
declare -a REMOVE_PACKAGES=(
|
||||
# "package/feeds/luci/luci-app-example" # 示例
|
||||
)
|
||||
|
||||
#---------------自定义包配置---------------#
|
||||
# 定义自定义包配置,格式:[包名]=[目标目录]=[仓库URL]=[分支]=[是否使用--depth 1]
|
||||
declare -A CUSTOM_PACKAGES=(
|
||||
["partexp"]="package/luci-app-partexp=https://github.com/sirpdboy/luci-app-partexp=main=false"
|
||||
["openclash"]="package/openclash=https://github.com/vernesong/OpenClash=dev=true"
|
||||
["zerotier"]="package/luci-app-zerotier=https://github.com/Firsgith/luci-app-zerotier.git=main=false"
|
||||
["5gsupport"]="package/5G-Modem-Support=https://nanako.site/gitea/Nanako/openwrt-app-actions.git=main=false"
|
||||
["pcat"]="package/pcat-manager=https://github.com/photonicat/rockchip_rk3568_pcat_manager.git=master=true"
|
||||
["adguardhome"]="package/adguardhome=https://github.com/xiaoxiao29/luci-app-adguardhome.git=master=false"
|
||||
)
|
||||
|
||||
#---------------日志系统---------------#
|
||||
# 保存原始的标准输出和错误输出文件描述符
|
||||
exec {STDOUT_ORIG}>&1
|
||||
exec {STDERR_ORIG}>&2
|
||||
|
||||
# 全局变量标记日志是否启用
|
||||
LOGGING_ENABLED=false # 初始为 false,由 init_logger 启用
|
||||
|
||||
# 初始化日志系统
|
||||
init_logger() {
|
||||
# 创建日志目录结构
|
||||
mkdir -p "$SESSION_DIR" || {
|
||||
echo "错误: 无法创建日志目录: $SESSION_DIR" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
LOGGING_ENABLED=true
|
||||
echo "日志将保存在: $SESSION_DIR"
|
||||
echo "主脚本日志: $LOG_FILE"
|
||||
|
||||
# 重定向主脚本的 stdout 和 stderr 到 tee,同时输出到控制台和主日志文件
|
||||
# 使用 process substitution 和 tee
|
||||
exec > >(tee -a "$LOG_FILE")
|
||||
exec 2> >(tee -a "$LOG_FILE" >&2)
|
||||
|
||||
# 记录初始信息到日志
|
||||
echo "[$(date "+%Y-%m-%d %H:%M:%S")] [INFO]: 日志系统初始化完成。主日志文件: $LOG_FILE"
|
||||
}
|
||||
|
||||
# 创建新的特定构建阶段的日志文件
|
||||
create_build_log() {
|
||||
local build_type=$1
|
||||
local timestamp=$(date +%Y%m%d_%H%M%S)
|
||||
# 使用更明确的文件名
|
||||
BUILD_LOG_FILE="${SESSION_DIR}/${build_type}_build_${timestamp}.log"
|
||||
# 确保文件被创建,即使命令没有输出
|
||||
touch "$BUILD_LOG_FILE" || {
|
||||
log "ERROR" "无法创建构建日志文件: $BUILD_LOG_FILE"
|
||||
return 1
|
||||
}
|
||||
# 返回创建的日志文件名
|
||||
echo "$BUILD_LOG_FILE"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 禁用日志重定向 (用于 menuconfig 等交互场景)
|
||||
disable_logging() {
|
||||
if [ "$LOGGING_ENABLED" = true ]; then
|
||||
log "DEBUG" "禁用日志重定向,恢复原始标准输出/错误。"
|
||||
exec >&$STDOUT_ORIG
|
||||
exec 2>&$STDERR_ORIG
|
||||
LOGGING_ENABLED=false # 标记为禁用
|
||||
fi
|
||||
}
|
||||
|
||||
# 启用日志重定向 (恢复)
|
||||
enable_logging() {
|
||||
# 仅在之前被禁用的情况下才重新启用
|
||||
if [ "$LOGGING_ENABLED" = false ]; then
|
||||
# 重新应用重定向到主日志
|
||||
exec > >(tee -a "$LOG_FILE")
|
||||
exec 2> >(tee -a "$LOG_FILE" >&2)
|
||||
LOGGING_ENABLED=true # 标记为启用
|
||||
log "DEBUG" "重新启用日志重定向到主日志。"
|
||||
fi
|
||||
}
|
||||
|
||||
# 设置终端颜色
|
||||
setup_colors() {
|
||||
if [[ -t 1 ]]; then # 检查标准输出是否连接到终端
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
else
|
||||
RED='' GREEN='' YELLOW='' BLUE='' NC=''
|
||||
fi
|
||||
}
|
||||
|
||||
# 记录日志函数 - 使用此函数来明确日志级别
|
||||
# 注意:此函数输出会经过 init_logger 设置的全局重定向
|
||||
log() {
|
||||
local level=$1
|
||||
local message=$2
|
||||
local timestamp
|
||||
timestamp=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
local color="" level_str=""
|
||||
|
||||
case $level in
|
||||
"INFO") color="$GREEN"; level_str="INFO " ;; # 加空格对齐
|
||||
"WARN") color="$YELLOW"; level_str="WARN " ;;
|
||||
"ERROR") color="$RED"; level_str="ERROR" ;;
|
||||
"DEBUG") color="$BLUE"; level_str="DEBUG" ;;
|
||||
*) color=""; level_str="LOG " ;; # 默认级别
|
||||
esac
|
||||
|
||||
# 使用 printf 保证原子写入,减少并发问题
|
||||
printf "[%s] %b[%s]%b: %s\n" "$timestamp" "$color" "$level_str" "$NC" "$message"
|
||||
}
|
||||
|
||||
# 同时记录消息到主日志和特定的构建日志
|
||||
log_to_both() {
|
||||
local level=$1
|
||||
local message=$2
|
||||
local build_log_file=$3 # 明确参数名
|
||||
|
||||
# 1. 输出到主日志(通过全局重定向和 log 函数)
|
||||
log "$level" "$message"
|
||||
|
||||
# 2. 追加到指定的构建日志文件
|
||||
local timestamp
|
||||
timestamp=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
# 直接追加,不需要颜色代码
|
||||
printf "[%s] [%s]: %s\n" "$timestamp" "$level" "$message" >> "$build_log_file"
|
||||
}
|
||||
|
||||
|
||||
#---------------自定义包管理函数---------------#
|
||||
# 更新单个自定义包
|
||||
update_single_package() {
|
||||
local pkg_name=$1
|
||||
local config=$2
|
||||
|
||||
# 解析配置 (保持 cut 的方式,假设路径/URL/分支名不含 '=')
|
||||
# 如果遇到问题,可以切换到 IFS/read
|
||||
local target_dir repo_url branch use_depth
|
||||
target_dir=$(echo "$config" | cut -d= -f1)
|
||||
repo_url=$(echo "$config" | cut -d= -f2)
|
||||
branch=$(echo "$config" | cut -d= -f3)
|
||||
use_depth=$(echo "$config" | cut -d= -f4)
|
||||
|
||||
# 基础验证
|
||||
if [ -z "$target_dir" ] || [ -z "$repo_url" ]; then
|
||||
log "ERROR" "包 '$pkg_name' 的配置无效: $config"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log "INFO" "更新自定义包: $pkg_name..."
|
||||
|
||||
# 检查目标目录的父目录是否存在
|
||||
local parent_dir
|
||||
parent_dir=$(dirname "$target_dir")
|
||||
if [ ! -d "$parent_dir" ]; then
|
||||
log "INFO" "创建父目录: $parent_dir"
|
||||
mkdir -p "$parent_dir" || {
|
||||
log "ERROR" "无法创建父目录: $parent_dir"
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
# 移除现有目录
|
||||
if [ -d "$target_dir" ]; then
|
||||
log "INFO" "移除现有目录: $target_dir"
|
||||
rm -rf "$target_dir" || {
|
||||
log "ERROR" "无法删除目录: $target_dir"
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
# 准备 git clone 命令参数数组 (移除 eval)
|
||||
local git_options=("--progress") # 总是显示进度
|
||||
# 处理分支
|
||||
if [ -n "$branch" ] && [ "$branch" != "master" ]; then
|
||||
git_options+=("-b" "$branch")
|
||||
fi
|
||||
# 处理 depth
|
||||
if [ "$use_depth" = "true" ]; then
|
||||
git_options+=("--depth" "1")
|
||||
fi
|
||||
|
||||
# 执行克隆
|
||||
log "INFO" "执行: git clone ${git_options[*]} $repo_url $target_dir"
|
||||
if git clone "${git_options[@]}" "$repo_url" "$target_dir"; then
|
||||
log "INFO" "包 '$pkg_name' 更新成功"
|
||||
return 0
|
||||
else
|
||||
log "ERROR" "克隆包 '$pkg_name' 失败 (仓库: $repo_url)"
|
||||
# 尝试给出更具体的错误提示
|
||||
log "ERROR" "请检查网络连接、仓库 URL、分支名称以及目标目录权限。"
|
||||
# 保留可能存在的空目录或部分克隆,让用户检查
|
||||
# rm -rf "$target_dir" # 不再自动删除失败的克隆
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新所有自定义包的主函数
|
||||
update_custom_package() {
|
||||
local failed_packages=()
|
||||
local success_count=0
|
||||
local total_packages=${#CUSTOM_PACKAGES[@]}
|
||||
|
||||
if [ "$total_packages" -eq 0 ]; then
|
||||
log "INFO" "没有配置自定义包,跳过更新。"
|
||||
return 0
|
||||
fi
|
||||
|
||||
log "INFO" "开始更新 $total_packages 个自定义包..."
|
||||
|
||||
for pkg_name in "${!CUSTOM_PACKAGES[@]}"; do
|
||||
# 使用 subshell 执行,避免污染当前环境的变量,但这里影响不大
|
||||
if update_single_package "$pkg_name" "${CUSTOM_PACKAGES[$pkg_name]}"; then
|
||||
((success_count++))
|
||||
else
|
||||
failed_packages+=("$pkg_name")
|
||||
fi
|
||||
done
|
||||
|
||||
# 显示更新结果
|
||||
if [ ${#failed_packages[@]} -eq 0 ]; then
|
||||
log "INFO" "所有自定义包更新成功 ($success_count/$total_packages)"
|
||||
return 0
|
||||
else
|
||||
log "WARN" "部分自定义包更新失败 (成功: $success_count/$total_packages)"
|
||||
log "ERROR" "更新失败的包: ${failed_packages[*]}"
|
||||
return 1 # 返回失败状态码
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新特定自定义包
|
||||
update_specific_package() {
|
||||
local pkg_name=$1
|
||||
|
||||
if [ -z "$pkg_name" ]; then
|
||||
log "ERROR" "未指定包名"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${CUSTOM_PACKAGES[$pkg_name]}" ]; then
|
||||
log "ERROR" "未找到包配置:'$pkg_name'"
|
||||
log "INFO" "可用的包名: ${!CUSTOM_PACKAGES[*]}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
update_single_package "$pkg_name" "${CUSTOM_PACKAGES[$pkg_name]}"
|
||||
}
|
||||
|
||||
#---------------基础功能函数---------------#
|
||||
# 清理工作区 (make clean 的替代方案,更彻底)
|
||||
clean_workspace() {
|
||||
log "INFO" "开始彻底清理工作区..."
|
||||
|
||||
# 清理 feeds (可选,如果 feeds 内容经常变动或出问题可以启用)
|
||||
# log "INFO" "执行 ./scripts/feeds clean ..."
|
||||
# ./scripts/feeds clean || log "WARN" "./scripts/feeds clean 执行时遇到问题。"
|
||||
|
||||
# 清理编译产物和临时文件
|
||||
log "INFO" "执行 rm -rf ./tmp ./logs ./staging_dir ./build_dir ./bin ./dl ..."
|
||||
# 注意:这里移除了 logs 目录,但我们的脚本日志在 openwrt_logs 下,不会被删
|
||||
# 如果 OpenWrt 自身有 logs 目录且需要保留,则从下面移除 ./logs
|
||||
rm -rf ./tmp ./logs ./staging_dir ./build_dir ./bin ./dl || {
|
||||
log "ERROR" "删除部分工作区目录失败,请检查权限或文件占用。"
|
||||
return 1
|
||||
}
|
||||
|
||||
log "INFO" "工作区清理完成。"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 清理编译临时文件 (make clean 的快速版)
|
||||
clean_build_temp() {
|
||||
log "INFO" "开始清理编译临时文件..."
|
||||
|
||||
log "INFO" "执行 rm -rf ./tmp ./staging_dir ./build_dir ..."
|
||||
rm -rf ./tmp ./staging_dir ./build_dir || {
|
||||
log "ERROR" "删除部分编译临时目录失败。"
|
||||
return 1
|
||||
}
|
||||
|
||||
log "INFO" "编译临时文件清理完成。"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 更新源码
|
||||
update_source() {
|
||||
log "INFO" "开始更新 OpenWrt 源码 (git pull)..."
|
||||
if git pull --rebase; then # 使用 rebase 避免不必要的 merge commit
|
||||
log "INFO" "源码更新完成"
|
||||
return 0
|
||||
else
|
||||
log "ERROR" "源码更新失败 (git pull --rebase)"
|
||||
log "WARN" "请检查本地是否有未提交的修改,或尝试手动解决 Git 冲突。"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新并安装 feeds
|
||||
update_feeds() {
|
||||
log "INFO" "开始更新 Feeds (update -a)..."
|
||||
if ./scripts/feeds update -a; then
|
||||
log "INFO" "Feeds 更新成功,开始安装 (install -a)..."
|
||||
if ./scripts/feeds install -a; then
|
||||
log "INFO" "Feeds 安装成功"
|
||||
return 0
|
||||
else
|
||||
log "ERROR" "Feeds 安装失败 (install -a)"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
log "ERROR" "Feeds 更新失败 (update -a)"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 执行构建相关命令,并将 stdout 重定向到日志,stderr 同时输出到控制台和日志
|
||||
run_build_command() {
|
||||
local cmd=$1 # 要执行的命令字符串
|
||||
local log_file=$2 # 目标日志文件
|
||||
local description=$3 # 操作描述
|
||||
|
||||
log_to_both "INFO" "开始执行: $description" "$log_file"
|
||||
log "DEBUG" "命令详情: $cmd" # 只记录到主日志
|
||||
|
||||
# 执行命令
|
||||
# stdout (>>) 追加到日志文件
|
||||
# stderr (2>) 通过管道给 tee
|
||||
# tee -a "$log_file" 将 stderr 追加到日志文件
|
||||
# tee 默认将其标准输入复制到标准输出,这里即脚本的 stderr,因此会显示在控制台
|
||||
local start_time end_time duration
|
||||
start_time=$(date +%s)
|
||||
if eval "$cmd" >> "$log_file" 2> >(tee -a "$log_file" >&2); then
|
||||
end_time=$(date +%s)
|
||||
duration=$((end_time - start_time))
|
||||
log_to_both "INFO" "$description 完成 (耗时: ${duration}s)" "$log_file"
|
||||
return 0 # 成功返回 0
|
||||
else
|
||||
end_time=$(date +%s)
|
||||
duration=$((end_time - start_time))
|
||||
local exit_code=$? # 获取命令的退出码
|
||||
# 错误信息已经通过 stderr 的 tee 输出到控制台了
|
||||
log_to_both "ERROR" "$description 失败 (退出码: $exit_code, 耗时: ${duration}s)" "$log_file"
|
||||
log "ERROR" "详细错误请查看控制台输出以及日志文件: $log_file"
|
||||
return $exit_code # 失败返回命令的退出码
|
||||
fi
|
||||
}
|
||||
|
||||
# 编译固件
|
||||
build_firmware() {
|
||||
# 创建新的固件编译日志文件
|
||||
local current_log
|
||||
current_log=$(create_build_log "firmware") || return 1 # 创建失败则退出
|
||||
|
||||
log "INFO" "开始编译固件..."
|
||||
log "INFO" "详细编译日志将保存在: $current_log"
|
||||
|
||||
# 1. 下载依赖包
|
||||
local download_cmd="make download -j$(nproc) V=s"
|
||||
run_build_command "$download_cmd" "$current_log" "下载依赖包" || {
|
||||
log "ERROR" "依赖包下载失败,编译中止。"
|
||||
# 即使下载失败,日志文件也已包含错误信息
|
||||
return 1
|
||||
}
|
||||
|
||||
# 2. 多线程编译
|
||||
local cpu_cores
|
||||
cpu_cores=$(nproc)
|
||||
log "INFO" "检测到 $cpu_cores 个 CPU 核心,开始多线程编译..."
|
||||
local build_cmd="make -j${cpu_cores} V=s"
|
||||
|
||||
if run_build_command "$build_cmd" "$current_log" "固件编译 (多线程)"; then
|
||||
log "INFO" "${GREEN}固件编译成功完成!${NC}"
|
||||
log "INFO" "固件输出目录: ./bin/targets/"
|
||||
return 0 # 编译成功
|
||||
else
|
||||
# 多线程编译失败,询问用户是否重试
|
||||
log "WARN" "多线程编译失败。"
|
||||
local retry_choice
|
||||
# -r: raw input, -p: prompt, -n 1: read only one char (optional but nice), -t 15: timeout (optional)
|
||||
# Default to No
|
||||
read -rp "$(echo -e ${YELLOW}"是否尝试使用单线程重新编译? (y/N): "${NC})" -n 1 -t 30 retry_choice
|
||||
echo # Add a newline after read -n
|
||||
|
||||
if [[ "$retry_choice" =~ ^[Yy]$ ]]; then
|
||||
log "INFO" "用户选择使用单线程重试编译..."
|
||||
|
||||
# 3. 单线程编译重试
|
||||
local build_cmd_single="make -j1 V=s"
|
||||
if run_build_command "$build_cmd_single" "$current_log" "固件编译 (单线程重试)"; then
|
||||
log "INFO" "${GREEN}单线程编译成功完成!${NC}"
|
||||
log "INFO" "固件输出目录: ./bin/targets/"
|
||||
return 0 # 单线程编译成功
|
||||
else
|
||||
log "ERROR" "${RED}单线程编译也失败了。${NC}"
|
||||
log "ERROR" "请仔细检查控制台错误输出以及日志文件: $current_log"
|
||||
return 1 # 最终编译失败
|
||||
fi
|
||||
else
|
||||
log "INFO" "用户选择不进行单线程重试编译。"
|
||||
log "ERROR" "${RED}编译失败,未进行单线程重试。${NC}"
|
||||
log "ERROR" "请仔细检查控制台错误输出以及日志文件: $current_log"
|
||||
return 1 # 用户取消重试,编译失败
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# 清理配置文件中指定的旧包/目录
|
||||
clean_packages() {
|
||||
log "INFO" "开始清理配置文件中指定的旧包和目录..."
|
||||
local removed_count=0
|
||||
local failed_count=0
|
||||
local total_to_remove=$((${#REMOVE_DIRS[@]} + ${#REMOVE_PACKAGES[@]}))
|
||||
|
||||
if [ "$total_to_remove" -eq 0 ]; then
|
||||
log "INFO" "配置文件中未指定需要移除的包或目录。"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# 清理目录
|
||||
for dir in "${REMOVE_DIRS[@]}"; do
|
||||
if [ -e "$dir" ]; then # 使用 -e 检查文件或目录是否存在
|
||||
log "INFO" "正在删除目录: $dir"
|
||||
if rm -rf "$dir"; then
|
||||
log "INFO" "已删除: $dir"
|
||||
((removed_count++))
|
||||
else
|
||||
log "ERROR" "删除失败: $dir (请检查权限或是否被占用)"
|
||||
((failed_count++))
|
||||
fi
|
||||
else
|
||||
log "WARN" "指定的目录不存在,跳过: $dir"
|
||||
fi
|
||||
done
|
||||
|
||||
# 清理包 (通常包也是目录)
|
||||
for pkg in "${REMOVE_PACKAGES[@]}"; do
|
||||
if [ -e "$pkg" ]; then
|
||||
log "INFO" "正在删除包/目录: $pkg"
|
||||
if rm -rf "$pkg"; then
|
||||
log "INFO" "已删除: $pkg"
|
||||
((removed_count++))
|
||||
else
|
||||
log "ERROR" "删除失败: $pkg (请检查权限或是否被占用)"
|
||||
((failed_count++))
|
||||
fi
|
||||
else
|
||||
log "WARN" "指定的包/目录不存在,跳过: $pkg"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $failed_count -eq 0 ]; then
|
||||
log "INFO" "旧包/目录清理完成,共处理 $removed_count 个项目。"
|
||||
return 0
|
||||
else
|
||||
log "WARN" "旧包/目录清理部分完成 (成功: $removed_count, 失败: $failed_count)"
|
||||
return 1 # 返回失败状态码
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新所有组件 (源码 -> 清理旧包 -> 自定义包 -> feeds)
|
||||
update_all_components() {
|
||||
log "INFO" "开始更新所有组件..."
|
||||
local success=true # 假设成功
|
||||
|
||||
# 1. 更新源码
|
||||
log "INFO" "[1/4] 更新 OpenWrt 源码..."
|
||||
update_source || success=false
|
||||
|
||||
# 2. 清理旧包 (即使上一步失败也尝试清理)
|
||||
log "INFO" "[2/4] 清理配置文件指定的旧包/目录..."
|
||||
clean_packages || log "WARN" "清理旧包/目录时遇到问题,继续执行..." # 清理失败通常不阻止后续
|
||||
|
||||
# 3. 更新自定义包 (只有在源码更新成功时才执行较好)
|
||||
if [ "$success" = true ]; then
|
||||
log "INFO" "[3/4] 更新自定义包..."
|
||||
update_custom_package || success=false
|
||||
else
|
||||
log "WARN" "[3/4] 跳过更新自定义包,因为源码更新失败。"
|
||||
fi
|
||||
|
||||
# 4. 更新 Feeds (只有在源码和自定义包都成功时执行较好)
|
||||
if [ "$success" = true ]; then
|
||||
log "INFO" "[4/4] 更新 Feeds..."
|
||||
update_feeds || success=false
|
||||
else
|
||||
log "WARN" "[4/4] 跳过更新 Feeds,因为之前的步骤失败。"
|
||||
fi
|
||||
|
||||
# 总结
|
||||
if [ "$success" = true ]; then
|
||||
log "INFO" "所有组件更新完成!"
|
||||
return 0
|
||||
else
|
||||
log "ERROR" "部分或全部组件更新失败,请检查上面的日志。"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 菜单配置 (make menuconfig)
|
||||
menuconfig() {
|
||||
log "INFO" "准备进入菜单配置 (make menuconfig)..."
|
||||
log "INFO" "注意:日志重定向将暂时禁用以进行交互。"
|
||||
|
||||
# 禁用日志重定向,否则 menuconfig 界面可能显示不正常
|
||||
disable_logging
|
||||
|
||||
# 执行 menuconfig
|
||||
if make menuconfig; then
|
||||
# 配置成功后重新启用日志
|
||||
enable_logging
|
||||
log "INFO" "菜单配置完成。新配置已保存到 .config"
|
||||
# 询问是否保存 defconfig (可选)
|
||||
# read -p "是否将当前配置保存为 defconfig? (y/N): " save_defconfig
|
||||
# if [[ "$save_defconfig" =~ ^[Yy]$ ]]; then
|
||||
# ./scripts/diffconfig.sh > my_defconfig
|
||||
# log "INFO" "当前配置已保存到 my_defconfig"
|
||||
# fi
|
||||
return 0
|
||||
else
|
||||
# 配置失败或被取消,也要恢复日志
|
||||
enable_logging
|
||||
log "WARN" "菜单配置未完成或被取消。"
|
||||
return 1 # 返回失败状态码
|
||||
fi
|
||||
}
|
||||
|
||||
#---------------组合功能函数---------------#
|
||||
# 完整构建流程
|
||||
full_build() {
|
||||
log "INFO" "启动完整构建流程..."
|
||||
local step=1
|
||||
local total_steps=6 # 预估步骤数
|
||||
|
||||
# 1. 清理工作区
|
||||
log "INFO" "[${step}/${total_steps}] 清理工作区..."
|
||||
clean_workspace || { log "WARN" "工作区清理可能不完整,尝试继续..."; } # 清理失败通常不致命
|
||||
((step++))
|
||||
|
||||
# 2. 更新源码
|
||||
log "INFO" "[${step}/${total_steps}] 更新源码..."
|
||||
update_source || { log "ERROR" "源码更新失败,终止构建流程。"; return 1; }
|
||||
((step++))
|
||||
|
||||
# 3. 清理旧包
|
||||
log "INFO" "[${step}/${total_steps}] 清理配置文件指定的旧包..."
|
||||
clean_packages || log "WARN" "清理旧包时遇到问题,继续执行..."
|
||||
((step++))
|
||||
|
||||
# 4. 更新自定义包
|
||||
log "INFO" "[${step}/${total_steps}] 更新自定义包..."
|
||||
update_custom_package || { log "ERROR" "自定义包更新失败,终止构建流程。"; return 1; }
|
||||
((step++))
|
||||
|
||||
# 5. 更新 Feeds
|
||||
log "INFO" "[${step}/${total_steps}] 更新 Feeds..."
|
||||
update_feeds || { log "ERROR" "Feeds 更新失败,终止构建流程。"; return 1; }
|
||||
((step++))
|
||||
|
||||
# 6. 菜单配置
|
||||
log "INFO" "[${step}/${total_steps}] 进入菜单配置 (make menuconfig)..."
|
||||
menuconfig || { log "WARN" "菜单配置未完成或取消,但继续尝试编译..."; } # 允许使用现有配置编译
|
||||
((step++)) # 无论成功与否,都算一步
|
||||
|
||||
# 7. 编译固件 (独立步骤,不计入前面的 total_steps)
|
||||
log "INFO" "所有准备工作完成,开始编译固件..."
|
||||
if build_firmware; then
|
||||
log "INFO" "${GREEN}完整构建流程成功完成!${NC}"
|
||||
return 0
|
||||
else
|
||||
log "ERROR" "${RED}完整构建流程失败于编译阶段。${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#---------------菜单函数---------------#
|
||||
# 打印主菜单
|
||||
print_menu() {
|
||||
echo -e "\n${BLUE}======= OpenWrt 构建管理菜单 =======${NC}"
|
||||
echo -e " ${YELLOW}会话日志目录: ${SESSION_DIR}${NC}"
|
||||
echo -e "${GREEN} 1.${NC} ${BOLD}完整构建流程${NC} (清理 > 更新源码/包/feeds > 配置 > 编译)"
|
||||
echo -e "${GREEN} 2.${NC} 清理工作区 (删除 tmp, bin, build_dir 等)"
|
||||
echo -e "${GREEN} 3.${NC} 更新所有组件 (源码 + 旧包清理 + 自定义包 + feeds)"
|
||||
echo -e "${GREEN} 4.${NC} 清理配置文件指定的旧包/目录"
|
||||
echo -e "${GREEN} 5.${NC} ${BOLD}编译固件${NC} (make V=s)"
|
||||
echo -e "${GREEN} 6.${NC} 调整配置 (make menuconfig)"
|
||||
echo -e "${GREEN} 7.${NC} 更新所有自定义包"
|
||||
echo -e "${GREEN} 8.${NC} 更新特定的自定义包"
|
||||
echo -e "${GREEN} 9.${NC} 更新 OpenWrt 源码 (git pull)"
|
||||
echo -e "${GREEN}10.${NC} 更新并安装 Feeds"
|
||||
echo -e "-------------------------------------"
|
||||
echo -e "${GREEN} 0.${NC} 退出脚本"
|
||||
echo -e "${BLUE}====================================${NC}"
|
||||
# 使用 read -p 提供提示
|
||||
read -rp "请输入选项 [0-10]: " choice
|
||||
}
|
||||
|
||||
# 打印并选择特定自定义包进行更新
|
||||
select_specific_package() {
|
||||
local pkg_names=("${!CUSTOM_PACKAGES[@]}") # 获取所有包名
|
||||
local num_packages=${#pkg_names[@]}
|
||||
|
||||
if [ "$num_packages" -eq 0 ]; then
|
||||
log "WARN" "没有配置任何自定义包。"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "\n${BLUE}--- 选择要更新的自定义包 ---${NC}"
|
||||
local i=1
|
||||
# 使用 sort 命令让包名按字母排序显示
|
||||
local sorted_pkg_names=($(printf "%s\n" "${pkg_names[@]}" | sort))
|
||||
|
||||
for pkg_name in "${sorted_pkg_names[@]}"; do
|
||||
echo -e " ${GREEN}$i.${NC} $pkg_name"
|
||||
((i++))
|
||||
done
|
||||
echo -e " ${GREEN}0.${NC} 返回主菜单"
|
||||
echo -e "${BLUE}----------------------------${NC}"
|
||||
|
||||
local choice_pkg
|
||||
read -rp "请输入包的序号 [0-$num_packages]: " choice_pkg
|
||||
|
||||
# 验证选择
|
||||
if [[ ! "$choice_pkg" =~ ^[0-9]+$ ]]; then
|
||||
log "ERROR" "无效输入,请输入数字。"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$choice_pkg" -eq 0 ]; then
|
||||
log "INFO" "返回主菜单。"
|
||||
return 0 # 返回成功,表示正常退出选择
|
||||
elif [ "$choice_pkg" -ge 1 ] && [ "$choice_pkg" -le "$num_packages" ]; then
|
||||
local selected_pkg=${sorted_pkg_names[$((choice_pkg-1))]}
|
||||
log "INFO" "选择更新包: $selected_pkg"
|
||||
update_specific_package "$selected_pkg" # 调用更新函数
|
||||
return $? # 返回更新函数的执行结果
|
||||
else
|
||||
log "ERROR" "无效的选择序号: $choice_pkg"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#---------------主函数---------------#
|
||||
main() {
|
||||
# 0. 设置颜色变量
|
||||
setup_colors
|
||||
|
||||
# 1. 初始化日志系统 (会进行第一次输出重定向)
|
||||
init_logger || exit 1 # 初始化失败则退出
|
||||
|
||||
# 2. 检查运行环境和依赖
|
||||
log "INFO" "检查运行环境..."
|
||||
local dep_missing=false
|
||||
if [ ! -f "Makefile" ] || [ ! -d "scripts" ] || [ ! -d ".git" ]; then
|
||||
log "ERROR" "脚本必须在 OpenWrt 源码的根目录下运行 (需要存在 Makefile, scripts, .git)。"
|
||||
dep_missing=true
|
||||
fi
|
||||
for cmd in git make nproc tee cut dirname mkdir rm git date printf sort read; do
|
||||
if ! command -v "$cmd" &> /dev/null; then
|
||||
log "ERROR" "缺少必要的系统命令: $cmd"
|
||||
dep_missing=true
|
||||
fi
|
||||
done
|
||||
if [ "$dep_missing" = true ]; then
|
||||
log "ERROR" "环境或依赖检查失败,请修正后重试。"
|
||||
# 恢复原始输出,避免后续可能的错误信息无法显示
|
||||
exec >&$STDOUT_ORIG
|
||||
exec 2>&$STDERR_ORIG
|
||||
exit 1
|
||||
fi
|
||||
log "INFO" "环境检查通过。"
|
||||
|
||||
# 记录脚本启动信息
|
||||
log "INFO" "${BOLD}OpenWrt 构建管理脚本已启动${NC}"
|
||||
log "INFO" "PID: $$"
|
||||
log "INFO" "会话日志目录: $SESSION_DIR"
|
||||
|
||||
# 3. 主菜单循环
|
||||
local choice # 提前声明 choice
|
||||
while true; do
|
||||
print_menu # 显示菜单并获取输入到 choice 变量
|
||||
log "DEBUG" "用户选择了: $choice" # 记录用户选择
|
||||
|
||||
# 根据选择执行操作
|
||||
case $choice in
|
||||
1) full_build ;;
|
||||
2) clean_workspace ;;
|
||||
3) update_all_components ;;
|
||||
4) clean_packages ;;
|
||||
5) build_firmware ;;
|
||||
6) menuconfig ;;
|
||||
7) update_custom_package ;;
|
||||
8) select_specific_package ;;
|
||||
9) update_source ;;
|
||||
10) update_feeds ;;
|
||||
0)
|
||||
log "INFO" "收到退出命令,正在退出脚本..."
|
||||
# 恢复原始输出流 (好习惯)
|
||||
exec >&$STDOUT_ORIG
|
||||
exec 2>&$STDERR_ORIG
|
||||
echo -e "${GREEN}脚本已退出。${NC}"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
log "WARN" "无效的选项: '$choice',请输入 0 到 10 之间的数字。"
|
||||
;;
|
||||
esac
|
||||
|
||||
local last_exit_code=$? # 获取上一个命令的退出状态码
|
||||
# 操作完成后暂停,给用户查看结果的时间
|
||||
if [[ $choice != 0 ]]; then
|
||||
if [ $last_exit_code -eq 0 ]; then
|
||||
echo -e "\n${GREEN}操作 '$choice' 执行完成。${NC}"
|
||||
else
|
||||
echo -e "\n${RED}操作 '$choice' 执行时遇到错误 (退出码: $last_exit_code)。${NC}"
|
||||
fi
|
||||
echo -e "${YELLOW}按 Enter 键返回主菜单...${NC}"
|
||||
read -r # 等待用户按回车
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#---------------脚本入口---------------#
|
||||
# 将所有主逻辑放入 main 函数,并在最后调用它
|
||||
# "$@" 将所有命令行参数传递给 main 函数 (虽然本脚本目前未使用)
|
||||
main "$@"
|
||||
@@ -1,5 +1,5 @@
|
||||
src-git packages https://github.com/DHDAXCW/packages
|
||||
src-git luci https://github.com/DHDAXCW/luci
|
||||
src-git routing https://github.com/coolsnowwolf/routing
|
||||
src-git telephony https://git.openwrt.org/feed/telephony.git
|
||||
src-git telephony https://github.com/coolsnowwolf/telephony.git
|
||||
src-git istore https://github.com/linkease/istore;main
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-6.6 = .62
|
||||
LINUX_KERNEL_HASH-6.6.62 = e2c35611775534941b9d4dd871f3ae5b988b6594dc9033b5ca784366e07d9336
|
||||
LINUX_VERSION-6.6 = .66
|
||||
LINUX_KERNEL_HASH-6.6.66 = 9d757937c4661c2f512c62641b74ef74eff9bb13dc5dbcbaaa108c21152f1e52
|
||||
|
||||
56
openwrt_logs/20250408_180935/main_build_script.log
Normal file
56
openwrt_logs/20250408_180935/main_build_script.log
Normal file
@@ -0,0 +1,56 @@
|
||||
[2025-04-08 18:09:35] [INFO]: 日志系统初始化完成。主日志文件: openwrt_logs/20250408_180935/main_build_script.log
|
||||
[2025-04-08 18:09:35] [0;32m[INFO ][0m: 检查运行环境...
|
||||
[2025-04-08 18:09:35] [0;32m[INFO ][0m: 环境检查通过。
|
||||
[2025-04-08 18:09:35] [0;32m[INFO ][0m: OpenWrt 构建管理脚本已启动\033[0m
|
||||
[2025-04-08 18:09:35] [0;32m[INFO ][0m: PID: 2874378
|
||||
[2025-04-08 18:09:35] [0;32m[INFO ][0m: 会话日志目录: openwrt_logs/20250408_180935
|
||||
|
||||
[0;34m======= OpenWrt 构建管理菜单 =======[0m
|
||||
[1;33m会话日志目录: openwrt_logs/20250408_180935[0m
|
||||
[0;32m 1.[0m 完整构建流程[0m (清理 > 更新源码/包/feeds > 配置 > 编译)
|
||||
[0;32m 2.[0m 清理工作区 (删除 tmp, bin, build_dir 等)
|
||||
[0;32m 3.[0m 更新所有组件 (源码 + 旧包清理 + 自定义包 + feeds)
|
||||
[0;32m 4.[0m 清理配置文件指定的旧包/目录
|
||||
[0;32m 5.[0m 编译固件[0m (make V=s)
|
||||
[0;32m 6.[0m 调整配置 (make menuconfig)
|
||||
[0;32m 7.[0m 更新所有自定义包
|
||||
[0;32m 8.[0m 更新特定的自定义包
|
||||
[0;32m 9.[0m 更新 OpenWrt 源码 (git pull)
|
||||
[0;32m10.[0m 更新并安装 Feeds
|
||||
-------------------------------------
|
||||
[0;32m 0.[0m 退出脚本
|
||||
[0;34m====================================[0m
|
||||
请输入选项 [0-10]: [2025-04-08 18:09:36] [0;34m[DEBUG][0m: 用户选择了: 1
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: 启动完整构建流程...
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: [1/6] 清理工作区...
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: 开始彻底清理工作区...
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: 执行 rm -rf ./tmp ./logs ./staging_dir ./build_dir ./bin ./dl ...
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: 工作区清理完成。
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: [2/6] 更新源码...
|
||||
[2025-04-08 18:09:36] [0;32m[INFO ][0m: 开始更新 OpenWrt 源码 (git pull)...
|
||||
error: cannot pull with rebase: You have unstaged changes.
|
||||
error: Please commit or stash them.
|
||||
[2025-04-08 18:09:36] [0;31m[ERROR][0m: 源码更新失败 (git pull --rebase)
|
||||
[2025-04-08 18:09:36] [1;33m[WARN ][0m: 请检查本地是否有未提交的修改,或尝试手动解决 Git 冲突。
|
||||
[2025-04-08 18:09:36] [0;31m[ERROR][0m: 源码更新失败,终止构建流程。
|
||||
|
||||
[0;31m操作 '1' 执行时遇到错误 (退出码: 1)。[0m
|
||||
[1;33m按 Enter 键返回主菜单...[0m
|
||||
|
||||
[0;34m======= OpenWrt 构建管理菜单 =======[0m
|
||||
[1;33m会话日志目录: openwrt_logs/20250408_180935[0m
|
||||
[0;32m 1.[0m 完整构建流程[0m (清理 > 更新源码/包/feeds > 配置 > 编译)
|
||||
[0;32m 2.[0m 清理工作区 (删除 tmp, bin, build_dir 等)
|
||||
[0;32m 3.[0m 更新所有组件 (源码 + 旧包清理 + 自定义包 + feeds)
|
||||
[0;32m 4.[0m 清理配置文件指定的旧包/目录
|
||||
[0;32m 5.[0m 编译固件[0m (make V=s)
|
||||
[0;32m 6.[0m 调整配置 (make menuconfig)
|
||||
[0;32m 7.[0m 更新所有自定义包
|
||||
[0;32m 8.[0m 更新特定的自定义包
|
||||
[0;32m 9.[0m 更新 OpenWrt 源码 (git pull)
|
||||
[0;32m10.[0m 更新并安装 Feeds
|
||||
-------------------------------------
|
||||
[0;32m 0.[0m 退出脚本
|
||||
[0;34m====================================[0m
|
||||
请输入选项 [0-10]: [2025-04-08 18:09:40] [0;34m[DEBUG][0m: 用户选择了: 0
|
||||
[2025-04-08 18:09:40] [0;32m[INFO ][0m: 收到退出命令,正在退出脚本...
|
||||
1
package/5G-Modem-Support
Submodule
1
package/5G-Modem-Support
Submodule
Submodule package/5G-Modem-Support added at da43e7a10e
1
package/adguardhome
Submodule
1
package/adguardhome
Submodule
Submodule package/adguardhome added at ff6d1e2edf
@@ -232,6 +232,13 @@ define U-Boot/lubancat-4-rk3588s
|
||||
embedfire_lubancat-4
|
||||
endef
|
||||
|
||||
define U-Boot/photonicat-rk3568
|
||||
$(U-Boot/rk3568/Default)
|
||||
NAME:=Photonicat
|
||||
BUILD_DEVICES:= \
|
||||
ariaboard_photonicat
|
||||
endef
|
||||
|
||||
UBOOT_TARGETS := \
|
||||
doornet1-rk3328 \
|
||||
doornet2-rk3399 \
|
||||
@@ -255,7 +262,8 @@ UBOOT_TARGETS := \
|
||||
opc-h68k-rk3568 \
|
||||
opc-h69k-rk3568 \
|
||||
zero-3e-rk3566 \
|
||||
h88k-rk3588
|
||||
h88k-rk3588 \
|
||||
photonicat-rk3568
|
||||
|
||||
UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/drivers/watchdog/Makefile
|
||||
+++ b/drivers/watchdog/Makefile
|
||||
@@ -50,3 +50,4 @@ obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt
|
||||
obj-$(CONFIG_WDT_SUNXI) += sunxi_wdt.o
|
||||
obj-$(CONFIG_WDT_TANGIER) += tangier_wdt.o
|
||||
obj-$(CONFIG_WDT_XILINX) += xilinx_wwdt.o
|
||||
+obj-$(CONFIG_WDT_PCAT) += pcat_wdt.o
|
||||
--- a/drivers/watchdog/Kconfig
|
||||
+++ b/drivers/watchdog/Kconfig
|
||||
@@ -421,4 +421,10 @@ config WDT_FTWDT010
|
||||
help
|
||||
Faraday Technology ftwdt010 watchdog is an architecture independent
|
||||
watchdog. It is usually used in SoC chip design.
|
||||
+
|
||||
+config WDT_PCAT
|
||||
+ bool "photonicat board watchdog support"
|
||||
+ depends on WDT && SERIAL && DM
|
||||
+ help
|
||||
+ Select this to enable watchdog timer on photonicat board.
|
||||
endmenu
|
||||
@@ -8,3 +8,6 @@
|
||||
rk3399-orangepi.dtb \
|
||||
rk3399-pinebook-pro.dtb \
|
||||
rk3399-pinephone-pro.dtb \
|
||||
|
||||
+dtb-$(CONFIG_ROCKCHIP_RK3568) += \
|
||||
+ rk3568-photonicat.dtb
|
||||
@@ -0,0 +1,37 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
#include "rk356x-u-boot.dtsi"
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
stdout-path = &uart2;
|
||||
};
|
||||
|
||||
pcat-wdt {
|
||||
compatible = "linux,wdt-pcat";
|
||||
port = <&uart4>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
bootph-pre-ram;
|
||||
};
|
||||
|
||||
&sdhci {
|
||||
cap-mmc-highspeed;
|
||||
mmc-hs200-1_8v;
|
||||
mmc-hs400-1_8v;
|
||||
mmc-hs400-enhanced-strobe;
|
||||
pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>;
|
||||
};
|
||||
|
||||
&uart2 {
|
||||
clock-frequency = <24000000>;
|
||||
bootph-all;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vcc3v3_sd {
|
||||
bootph-pre-ram;
|
||||
};
|
||||
@@ -0,0 +1,567 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
|
||||
/dts-v1/;
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/leds/common.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
#include <dt-bindings/soc/rockchip,vop2.h>
|
||||
#include "rk3568.dtsi"
|
||||
|
||||
/ {
|
||||
model = "Ariaboard Photonicat";
|
||||
compatible = "ariaboard,photonicat", "rockchip,rk3568";
|
||||
|
||||
aliases {
|
||||
ethernet1 = &gmac1;
|
||||
mmc0 = &sdhci;
|
||||
mmc1 = &sdmmc0;
|
||||
mmc2 = &sdmmc1;
|
||||
};
|
||||
|
||||
chosen: chosen {
|
||||
stdout-path = "serial2:1500000n8";
|
||||
};
|
||||
|
||||
gpio-poweroff {
|
||||
compatible = "gpio-poweroff";
|
||||
gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_LOW>;
|
||||
timeout-ms = <3000>;
|
||||
};
|
||||
|
||||
hdmi-con {
|
||||
compatible = "hdmi-connector";
|
||||
type = "a";
|
||||
|
||||
port {
|
||||
hdmi_con_in: endpoint {
|
||||
remote-endpoint = <&hdmi_out_con>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
modem-rfkill {
|
||||
compatible = "rfkill-gpio";
|
||||
label = "modem-rfkill";
|
||||
radio-type = "wwan";
|
||||
reset-gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_LOW>;
|
||||
shutdown-gpios = <&gpio4 RK_PC4 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
sdio_pwrseq: sdio-pwrseq {
|
||||
compatible = "mmc-pwrseq-simple";
|
||||
clocks = <&pmucru CLK_RTC_32K>;
|
||||
clock-names = "ext_clock";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&wifi_enable_h &clk32k_out1>;
|
||||
reset-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
vcc_sysin: vcc-sysin-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc_sysin";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
};
|
||||
|
||||
vcc_syson: vcc-syson-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc_syson";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
vin-supply = <&vcc_sysin>;
|
||||
};
|
||||
|
||||
vcc3v3_sys: vcc3v3-sys-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc3v3_sys";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
vin-supply = <&vcc_syson>;
|
||||
};
|
||||
|
||||
vcc_1v8: vcc-1v8-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc_1v8";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
vin-supply = <&vcc3v3_sys>;
|
||||
};
|
||||
|
||||
vcc_3v3: vcc-3v3-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc_3v3";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
vin-supply = <&vcc3v3_sys>;
|
||||
};
|
||||
|
||||
vcc3v3_ngff: vcc3v3-ngff-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
gpio = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
|
||||
regulator-name = "vcc3v3_ngff";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
};
|
||||
|
||||
/* pi6c pcie clock generator */
|
||||
vcc3v3_pi6c: vcc3v3-pi6c-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pcie_enable_h>;
|
||||
regulator-name = "vcc3v3_pi6c";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
vin-supply = <&vcc_syson>;
|
||||
};
|
||||
|
||||
/* actually fed by vcc_syson, dependent on pi6c clock generator */
|
||||
vcc3v3_pcie: vcc3v3-pcie-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc3v3_pcie";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
vin-supply = <&vcc3v3_pi6c>;
|
||||
};
|
||||
|
||||
vcc3v3_sd: vcc3v3-sd-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&vcc_sd_h>;
|
||||
regulator-boot-on;
|
||||
regulator-name = "vcc3v3_sd";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
vin-supply = <&vcc_3v3>;
|
||||
};
|
||||
|
||||
vcc5v0_boost: vcc5v0-boost-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&vcc5v0_boost_en>;
|
||||
regulator-name = "vcc5v0_boost";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
};
|
||||
|
||||
vcc5v0_usb_otg: vcc5v0-usb-otg-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&vcc5v0_usb_otg_en>;
|
||||
regulator-name = "vcc5v0_usb_otg";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
vin-supply = <&vcc_sysin>;
|
||||
};
|
||||
|
||||
vcca_1v8: vcca-1v8-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcca_1v8";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
vin-supply = <&vcc3v3_sys>;
|
||||
};
|
||||
|
||||
vdda_0v9: vdda-0v9-regulator {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vdda_0v9";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <900000>;
|
||||
regulator-max-microvolt = <900000>;
|
||||
vin-supply = <&vcc3v3_sys>;
|
||||
};
|
||||
|
||||
vdd_gpu: vdd-gpu-regulator {
|
||||
compatible = "pwm-regulator";
|
||||
pwms = <&pwm2 0 5000 1>;
|
||||
regulator-name = "vdd_gpu";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-init-microvolt = <900000>;
|
||||
regulator-min-microvolt = <800000>;
|
||||
regulator-max-microvolt = <1350000>;
|
||||
regulator-ramp-delay = <6001>;
|
||||
regulator-settling-time-up-us = <250>;
|
||||
pwm-supply = <&vcc_syson>;
|
||||
};
|
||||
|
||||
vdd_logic: vdd-logic-regulator {
|
||||
compatible = "pwm-regulator";
|
||||
pwms = <&pwm1 0 5000 1>;
|
||||
regulator-name = "vdd_logic";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-init-microvolt = <900000>;
|
||||
regulator-min-microvolt = <500000>;
|
||||
regulator-max-microvolt = <1350000>;
|
||||
regulator-ramp-delay = <6001>;
|
||||
regulator-settling-time-up-us = <250>;
|
||||
pwm-supply = <&vcc_syson>;
|
||||
};
|
||||
};
|
||||
|
||||
&combphy0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&combphy1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&combphy2 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&cpu0 {
|
||||
cpu-supply = <&vdd_cpu>;
|
||||
};
|
||||
|
||||
&cpu1 {
|
||||
cpu-supply = <&vdd_cpu>;
|
||||
};
|
||||
|
||||
&cpu2 {
|
||||
cpu-supply = <&vdd_cpu>;
|
||||
};
|
||||
|
||||
&cpu3 {
|
||||
cpu-supply = <&vdd_cpu>;
|
||||
};
|
||||
|
||||
&gmac1 {
|
||||
assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>;
|
||||
assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>;
|
||||
assigned-clock-rates = <0>, <125000000>;
|
||||
clock_in_out = "output";
|
||||
phy-handle = <&rgmii_phy>;
|
||||
phy-mode = "rgmii";
|
||||
phy-supply = <&vcc_3v3>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gmac1m1_miim
|
||||
&gmac1m1_tx_bus2
|
||||
&gmac1m1_rx_bus2
|
||||
&gmac1m1_rgmii_clk
|
||||
&gmac1m1_rgmii_bus>;
|
||||
snps,reset-gpio = <&gpio4 RK_PC0 GPIO_ACTIVE_LOW>;
|
||||
snps,reset-active-low;
|
||||
snps,reset-delays-us = <0 15000 50000>;
|
||||
tx_delay = <0x30>;
|
||||
rx_delay = <0x10>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpu {
|
||||
mali-supply = <&vdd_gpu>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&hdmi {
|
||||
avdd-0v9-supply = <&vdda_0v9>;
|
||||
avdd-1v8-supply = <&vcca_1v8>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&hdmi_in {
|
||||
hdmi_in_vp0: endpoint {
|
||||
remote-endpoint = <&vp0_out_hdmi>;
|
||||
};
|
||||
};
|
||||
|
||||
&hdmi_out {
|
||||
hdmi_out_con: endpoint {
|
||||
remote-endpoint = <&hdmi_con_in>;
|
||||
};
|
||||
};
|
||||
|
||||
&hdmi_sound {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
status = "okay";
|
||||
|
||||
vdd_cpu: regulator@1c {
|
||||
compatible = "tcs,tcs4525";
|
||||
reg = <0x1c>;
|
||||
fcs,suspend-voltage-selector = <1>;
|
||||
regulator-name = "vdd_cpu";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-init-microvolt = <900000>;
|
||||
regulator-min-microvolt = <712500>;
|
||||
regulator-max-microvolt = <1390000>;
|
||||
regulator-ramp-delay = <2300>;
|
||||
vin-supply = <&vcc_syson>;
|
||||
|
||||
regulator-state-mem {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&i2c2 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c2m1_xfer>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2s0_8ch {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&mdio1 {
|
||||
rgmii_phy: ethernet-phy@0 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
&pcie30phy {
|
||||
phy-supply = <&vcc3v3_pi6c>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pcie3x2 {
|
||||
reset-gpios = <&gpio0 RK_PC3 GPIO_ACTIVE_HIGH>;
|
||||
vpcie3v3-supply = <&vcc3v3_pcie>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
bt {
|
||||
bt_enable_h: bt-enable-h {
|
||||
rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
pcie {
|
||||
pcie_enable_h: pcie-enable-h {
|
||||
rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
sdio-pwrseq {
|
||||
wifi_enable_h: wifi-enable-h {
|
||||
rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
usb {
|
||||
vcc5v0_boost_en: vcc5v0-boost-en {
|
||||
rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
vcc5v0_usb_otg_en: vcc5v0-usb-otg-en {
|
||||
rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
vcc-sd {
|
||||
vcc_sd_h: vcc-sd-h {
|
||||
rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&pmu_io_domains {
|
||||
pmuio1-supply = <&vcc_3v3>;
|
||||
pmuio2-supply = <&vcc_3v3>;
|
||||
vccio1-supply = <&vcc_3v3>;
|
||||
vccio3-supply = <&vcc_3v3>;
|
||||
vccio4-supply = <&vcc_1v8>;
|
||||
vccio5-supply = <&vcc_3v3>;
|
||||
vccio6-supply = <&vcc_3v3>;
|
||||
vccio7-supply = <&vcc_3v3>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pwm1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pwm2 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&saradc {
|
||||
vref-supply = <&vcca_1v8>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdhci {
|
||||
bus-width = <8>;
|
||||
max-frequency = <200000000>;
|
||||
non-removable;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd>;
|
||||
vmmc-supply = <&vcc_3v3>;
|
||||
vqmmc-supply = <&vcc_1v8>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdmmc0 {
|
||||
bus-width = <4>;
|
||||
cap-sd-highspeed;
|
||||
cd-gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_LOW>;
|
||||
disable-wp;
|
||||
no-1-8-v;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd>;
|
||||
vmmc-supply = <&vcc3v3_sd>;
|
||||
vqmmc-supply = <&vcc_3v3>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdmmc1 {
|
||||
bus-width = <4>;
|
||||
cap-sd-highspeed;
|
||||
cap-sdio-irq;
|
||||
keep-power-in-suspend;
|
||||
mmc-pwrseq = <&sdio_pwrseq>;
|
||||
non-removable;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_clk &sdmmc1_cmd>;
|
||||
sd-uhs-sdr25;
|
||||
sd-uhs-sdr50;
|
||||
sd-uhs-sdr104;
|
||||
vmmc-supply = <&vcc3v3_sys>;
|
||||
vqmmc-supply = <&vcc_1v8>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
status = "okay";
|
||||
|
||||
wifi@1 {
|
||||
reg = <1>;
|
||||
interrupt-parent = <&gpio2>;
|
||||
interrupts = <RK_PB2 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "host-wake";
|
||||
};
|
||||
};
|
||||
|
||||
&tsadc {
|
||||
rockchip,hw-tshut-mode = <1>;
|
||||
rockchip,hw-tshut-polarity = <0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&uart1 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>;
|
||||
status = "okay";
|
||||
uart-has-rtscts;
|
||||
|
||||
bluetooth {
|
||||
compatible = "qcom,qca9377-bt";
|
||||
enable-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>;
|
||||
clocks = <&pmucru CLK_RTC_32K>;
|
||||
clock-names = "lpo";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&bt_enable_h>;
|
||||
vddio-supply = <&vcc_1v8>;
|
||||
};
|
||||
};
|
||||
|
||||
&uart2 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&uart3 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&uart4 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host0_ehci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host0_ohci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host0_xhci {
|
||||
dr_mode = "host";
|
||||
extcon = <&usb2phy0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host1_ehci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host1_ohci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host1_xhci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb2phy0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb2phy0_host {
|
||||
phy-supply = <&vcc3v3_ngff>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb2phy0_otg {
|
||||
phy-supply = <&vcc5v0_usb_otg>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb2phy1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb2phy1_otg {
|
||||
phy-supply = <&vcc5v0_usb_otg>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vop {
|
||||
assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
|
||||
assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vop_mmu {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vp0 {
|
||||
vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
|
||||
reg = <ROCKCHIP_VOP2_EP_HDMI0>;
|
||||
remote-endpoint = <&hdmi_in_vp0>;
|
||||
};
|
||||
};
|
||||
|
||||
&xin32k {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&clk32k_out1>;
|
||||
};
|
||||
@@ -0,0 +1,78 @@
|
||||
CONFIG_ARM=y
|
||||
CONFIG_SKIP_LOWLEVEL_INIT=y
|
||||
CONFIG_COUNTER_FREQUENCY=24000000
|
||||
CONFIG_ARCH_ROCKCHIP=y
|
||||
CONFIG_SPL_GPIO=y
|
||||
CONFIG_DEFAULT_DEVICE_TREE="rk3568-photonicat"
|
||||
CONFIG_ROCKCHIP_RK3568=y
|
||||
CONFIG_SPL_SERIAL=y
|
||||
CONFIG_DEBUG_UART_BASE=0xFE660000
|
||||
CONFIG_DEBUG_UART_CLOCK=24000000
|
||||
CONFIG_SYS_LOAD_ADDR=0xc00800
|
||||
CONFIG_PCI=y
|
||||
CONFIG_DEBUG_UART=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_SPL_FIT_SIGNATURE=y
|
||||
CONFIG_SPL_LOAD_FIT=y
|
||||
CONFIG_LEGACY_IMAGE_FORMAT=y
|
||||
CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-photonicat.dtb"
|
||||
# CONFIG_DISPLAY_CPUINFO is not set
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
CONFIG_SPL_MAX_SIZE=0x40000
|
||||
CONFIG_SPL_PAD_TO=0x7f8000
|
||||
# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
|
||||
CONFIG_SPL_ATF=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_GPT=y
|
||||
CONFIG_CMD_I2C=y
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_PCI=y
|
||||
CONFIG_CMD_USB=y
|
||||
CONFIG_CMD_WDT=y
|
||||
CONFIG_CMD_REGULATOR=y
|
||||
# CONFIG_SPL_DOS_PARTITION is not set
|
||||
CONFIG_SPL_OF_CONTROL=y
|
||||
# CONFIG_OF_UPSTREAM is not set
|
||||
CONFIG_OF_LIVE=y
|
||||
CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
|
||||
CONFIG_SPL_DM_SEQ_ALIAS=y
|
||||
CONFIG_SPL_REGMAP=y
|
||||
CONFIG_SPL_SYSCON=y
|
||||
CONFIG_SPL_CLK=y
|
||||
CONFIG_ROCKCHIP_GPIO=y
|
||||
CONFIG_SYS_I2C_ROCKCHIP=y
|
||||
CONFIG_MISC=y
|
||||
CONFIG_SUPPORT_EMMC_RPMB=y
|
||||
CONFIG_MMC_DW=y
|
||||
CONFIG_MMC_DW_ROCKCHIP=y
|
||||
CONFIG_MMC_SDHCI=y
|
||||
CONFIG_MMC_SDHCI_SDMA=y
|
||||
CONFIG_MMC_SDHCI_ROCKCHIP=y
|
||||
CONFIG_PHY_MOTORCOMM=y
|
||||
CONFIG_DWC_ETH_QOS=y
|
||||
CONFIG_DWC_ETH_QOS_ROCKCHIP=y
|
||||
CONFIG_NVME_PCI=y
|
||||
CONFIG_PCIE_DW_ROCKCHIP=y
|
||||
CONFIG_PHY_ROCKCHIP_INNO_USB2=y
|
||||
CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y
|
||||
CONFIG_SPL_PINCTRL=y
|
||||
CONFIG_PWM_ROCKCHIP=y
|
||||
CONFIG_SPL_RAM=y
|
||||
CONFIG_RESET_SCMI=y
|
||||
CONFIG_BAUDRATE=1500000
|
||||
CONFIG_DEBUG_UART_SHIFT=2
|
||||
CONFIG_SYS_NS16550_MEM32=y
|
||||
CONFIG_SYSRESET=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_GENERIC=y
|
||||
CONFIG_USB_OHCI_HCD=y
|
||||
CONFIG_USB_OHCI_GENERIC=y
|
||||
CONFIG_USB_DWC3=y
|
||||
CONFIG_USB_DWC3_GENERIC=y
|
||||
# CONFIG_WATCHDOG_AUTOSTART is not set
|
||||
CONFIG_WDT=y
|
||||
CONFIG_WDT_PCAT=y
|
||||
CONFIG_ERRNO_STR=y
|
||||
@@ -8,9 +8,9 @@ PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/openwrt/mt76
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2024-10-10
|
||||
PKG_SOURCE_VERSION:=6a1199463fc8f7758c32122613288ed95c09e3bd
|
||||
PKG_MIRROR_HASH:=4b42a586e098c1dc5970fbd3190ac2faf67992c7357161a3ef3040817a8ed8d6
|
||||
PKG_SOURCE_DATE:=2024-10-28
|
||||
PKG_SOURCE_VERSION:=c246fa545119abe5097682316700f13c91399042
|
||||
PKG_MIRROR_HASH:=ff59d9588e6b114be8fe08013b55da975bc6bb4219b97b6fedb72246e9337c18
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_USE_NINJA:=0
|
||||
|
||||
33
package/kernel/r8101/Makefile
Normal file
33
package/kernel/r8101/Makefile
Normal file
@@ -0,0 +1,33 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=r8101
|
||||
PKG_VERSION:=1.039.00
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://github.com/openwrt/rtl8101/releases/download/$(PKG_VERSION)
|
||||
PKG_HASH:=e64e1738e71d6717dd844bf771fea4691edae63e92d7d03bb5ad2ef08e56e72b
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Alvaro Fernandez Rojas <noltari@gmail.com>
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/r8101
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Realtek RTL8101 PCI Fast Ethernet driver
|
||||
DEPENDS:=@PCI_SUPPORT +kmod-libphy
|
||||
FILES:=$(PKG_BUILD_DIR)/src/r8101.ko
|
||||
AUTOLOAD:=$(call AutoProbe,r8101)
|
||||
PROVIDES:=kmod-r8169
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(KERNEL_MAKE) $(PKG_JOBS) \
|
||||
M="$(PKG_BUILD_DIR)/src" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,r8101))
|
||||
@@ -0,0 +1,100 @@
|
||||
From ec0de750e20073b23c91b67f4bc3ab71c50f0eed Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Sat, 17 Aug 2024 21:19:54 +0200
|
||||
Subject: [PATCH] r8101: print link speed and duplex mode
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Like other Ethernet drivers, print link speed and duplex mode
|
||||
when the interface is up. Formatting output at the same time.
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
---
|
||||
src/r8101.h | 2 ++
|
||||
src/r8101_n.c | 42 +++++++++++++++++++++++++++++++++++++++---
|
||||
2 files changed, 41 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/r8101.h
|
||||
+++ b/src/r8101.h
|
||||
@@ -1162,6 +1162,8 @@ enum RTL8101_register_content {
|
||||
LinkStatus = 0x02,
|
||||
FullDup = 0x01,
|
||||
|
||||
+#define RTL8101_FULL_DUPLEX_MASK (FullDup)
|
||||
+
|
||||
/* ResetCounterCommand */
|
||||
CounterReset = 0x1,
|
||||
/* DumpCounterCommand */
|
||||
--- a/src/r8101_n.c
|
||||
+++ b/src/r8101_n.c
|
||||
@@ -39,6 +39,7 @@ This driver is modified from r8169.c in
|
||||
#include <linux/module.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/pci.h>
|
||||
+#include <linux/phy.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/delay.h>
|
||||
@@ -2838,6 +2839,34 @@ rtl8101_issue_offset_99_event(struct rtl
|
||||
}
|
||||
}
|
||||
|
||||
+static unsigned int rtl8101_phy_duplex(u8 status)
|
||||
+{
|
||||
+ unsigned int duplex = DUPLEX_UNKNOWN;
|
||||
+
|
||||
+ if (status & LinkStatus) {
|
||||
+ if (status & RTL8101_FULL_DUPLEX_MASK)
|
||||
+ duplex = DUPLEX_FULL;
|
||||
+ else
|
||||
+ duplex = DUPLEX_HALF;
|
||||
+ }
|
||||
+
|
||||
+ return duplex;
|
||||
+}
|
||||
+
|
||||
+static int rtl8101_phy_speed(u8 status)
|
||||
+{
|
||||
+ int speed = SPEED_UNKNOWN;
|
||||
+
|
||||
+ if (status & LinkStatus) {
|
||||
+ if (status & _100bps)
|
||||
+ speed = SPEED_100;
|
||||
+ else if (status & _10bps)
|
||||
+ speed = SPEED_10;
|
||||
+ }
|
||||
+
|
||||
+ return speed;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
rtl8101_check_link_status(struct net_device *dev)
|
||||
{
|
||||
@@ -2913,8 +2942,15 @@ rtl8101_check_link_status(struct net_dev
|
||||
tp->phy_reg_aner = rtl8101_mdio_read(tp, MII_EXPANSION);
|
||||
tp->phy_reg_anlpar = rtl8101_mdio_read(tp, MII_LPA);
|
||||
|
||||
- if (netif_msg_ifup(tp))
|
||||
- printk(KERN_INFO PFX "%s: link up\n", dev->name);
|
||||
+ if (netif_msg_ifup(tp)) {
|
||||
+ const u8 phy_status = RTL_R8(tp, PHYstatus);
|
||||
+ const unsigned int phy_duplex = rtl8101_phy_duplex(phy_status);
|
||||
+ const int phy_speed = rtl8101_phy_speed(phy_status);
|
||||
+ printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n",
|
||||
+ dev->name,
|
||||
+ phy_speed_to_str(phy_speed),
|
||||
+ phy_duplex_to_str(phy_duplex));
|
||||
+ }
|
||||
} else {
|
||||
if (tp->mcfg == CFG_METHOD_11 || tp->mcfg == CFG_METHOD_12 ||
|
||||
tp->mcfg == CFG_METHOD_13) {
|
||||
@@ -2925,7 +2961,7 @@ rtl8101_check_link_status(struct net_dev
|
||||
rtl8101_mdio_write(tp, 0x1F, 0x0000);
|
||||
}
|
||||
if (netif_msg_ifdown(tp))
|
||||
- printk(KERN_INFO PFX "%s: link down\n", dev->name);
|
||||
+ printk(KERN_INFO PFX "%s: Link is Down\n", dev->name);
|
||||
|
||||
tp->phy_reg_aner = 0;
|
||||
tp->phy_reg_anlpar = 0;
|
||||
51
package/kernel/r8125/Makefile
Normal file
51
package/kernel/r8125/Makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=r8125
|
||||
PKG_VERSION:=9.014.01
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://github.com/openwrt/rtl8125/releases/download/$(PKG_VERSION)
|
||||
PKG_HASH:=f006aa95501738ca55c522812c9d1b473ac781675f3ad88ce341a09316b8aa13
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Alvaro Fernandez Rojas <noltari@gmail.com>
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/r8125
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Realtek RTL8125 PCI 2.5 Gigabit Ethernet driver
|
||||
DEPENDS:=@PCI_SUPPORT +kmod-libphy
|
||||
FILES:=$(PKG_BUILD_DIR)/src/r8125.ko
|
||||
AUTOLOAD:=$(call AutoProbe,r8125)
|
||||
PROVIDES:=kmod-r8169
|
||||
VARIANT:=regular
|
||||
endef
|
||||
|
||||
define KernelPackage/r8125-rss
|
||||
$(call KernelPackage/r8125)
|
||||
CONFLICTS:=kmod-r8125
|
||||
TITLE+= (RSS)
|
||||
VARIANT:=rss
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),rss)
|
||||
PKG_MAKE_FLAGS += \
|
||||
ENABLE_RSS_SUPPORT=y \
|
||||
ENABLE_MULTIPLE_TX_QUEUE=y
|
||||
endif
|
||||
|
||||
PKG_MAKE_FLAGS += CONFIG_ASPM=n
|
||||
|
||||
define Build/Compile
|
||||
+$(KERNEL_MAKE) $(PKG_JOBS) \
|
||||
$(PKG_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)/src" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,r8125))
|
||||
$(eval $(call KernelPackage,r8125-rss))
|
||||
104
package/kernel/r8125/patches/100-kernel-6.9-support.patch
Normal file
104
package/kernel/r8125/patches/100-kernel-6.9-support.patch
Normal file
@@ -0,0 +1,104 @@
|
||||
--- a/src/r8125_n.c
|
||||
+++ b/src/r8125_n.c
|
||||
@@ -7478,7 +7478,11 @@
|
||||
}
|
||||
|
||||
static int
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
|
||||
+#else
|
||||
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
+#endif
|
||||
{
|
||||
struct rtl8125_private *tp = netdev_priv(net);
|
||||
struct ethtool_eee *eee = &tp->eee;
|
||||
@@ -7511,9 +7515,15 @@
|
||||
|
||||
edata->eee_enabled = !!val;
|
||||
edata->eee_active = !!(supported & adv & lp);
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->supported, supported);
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->lp_advertised, lp);
|
||||
+#else
|
||||
edata->supported = supported;
|
||||
edata->advertised = adv;
|
||||
edata->lp_advertised = lp;
|
||||
+#endif
|
||||
edata->tx_lpi_enabled = edata->eee_enabled;
|
||||
edata->tx_lpi_timer = tx_lpi_timer;
|
||||
|
||||
@@ -7521,11 +7531,18 @@
|
||||
}
|
||||
|
||||
static int
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
|
||||
+#else
|
||||
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
+#endif
|
||||
{
|
||||
struct rtl8125_private *tp = netdev_priv(net);
|
||||
struct ethtool_eee *eee = &tp->eee;
|
||||
u64 advertising;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ u32 adv;
|
||||
+#endif
|
||||
int rc = 0;
|
||||
|
||||
if (!HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp) ||
|
||||
@@ -7557,6 +7574,18 @@
|
||||
*/
|
||||
|
||||
advertising = tp->advertising;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ ethtool_convert_link_mode_to_legacy_u32(&adv, edata->advertised);
|
||||
+ if (linkmode_empty(edata->advertised)) {
|
||||
+ adv = advertising & eee->supported;
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
|
||||
+ } else if (!linkmode_empty(edata->advertised) & ~advertising) {
|
||||
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of autoneg advertised speeds %llu\n",
|
||||
+ adv, advertising);
|
||||
+ rc = -EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+#else
|
||||
if (!edata->advertised) {
|
||||
edata->advertised = advertising & eee->supported;
|
||||
} else if (edata->advertised & ~advertising) {
|
||||
@@ -7565,13 +7594,23 @@
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
+#endif
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ if (!linkmode_empty(edata->advertised) & ~eee->supported) {
|
||||
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
|
||||
+ adv, eee->supported);
|
||||
+ rc = -EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+#else
|
||||
if (edata->advertised & ~eee->supported) {
|
||||
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
|
||||
edata->advertised, eee->supported);
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
+#endif
|
||||
|
||||
//tp->eee.eee_enabled = edata->eee_enabled;
|
||||
//tp->eee_adv_t = ethtool_adv_to_mmd_eee_adv_t(edata->advertised);
|
||||
@@ -7579,7 +7618,11 @@
|
||||
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE tx_lpi_timer %x must be a subset of support %x\n",
|
||||
edata->tx_lpi_timer, eee->tx_lpi_timer);
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, edata->advertised);
|
||||
+#else
|
||||
eee->advertised = edata->advertised;
|
||||
+#endif
|
||||
//eee->tx_lpi_enabled = edata->tx_lpi_enabled;
|
||||
//eee->tx_lpi_timer = edata->tx_lpi_timer;
|
||||
eee->eee_enabled = edata->eee_enabled;
|
||||
@@ -0,0 +1,99 @@
|
||||
From e351ac87bc3135e8555587e0bf80efb248ade0b7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Sun, 4 Aug 2024 21:16:23 +0800
|
||||
Subject: [PATCH] r8125: print link speed and duplex mode
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Like other Ethernet drivers, print link speed and duplex mode
|
||||
when the interface is up. Formatting output at the same time.
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
---
|
||||
src/r8125.h | 2 ++
|
||||
src/r8125_n.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
|
||||
2 files changed, 45 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/r8125.h
|
||||
+++ b/src/r8125.h
|
||||
@@ -1672,6 +1672,8 @@ enum RTL8125_register_content {
|
||||
LinkStatus = 0x02,
|
||||
FullDup = 0x01,
|
||||
|
||||
+#define RTL8125_FULL_DUPLEX_MASK (_2500bpsF | _1000bpsF | FullDup)
|
||||
+
|
||||
/* DBG_reg */
|
||||
Fix_Nak_1 = (1 << 4),
|
||||
Fix_Nak_2 = (1 << 3),
|
||||
--- a/src/r8125_n.c
|
||||
+++ b/src/r8125_n.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/pci.h>
|
||||
+#include <linux/phy.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/delay.h>
|
||||
@@ -5116,6 +5117,38 @@ rtl8125_link_down_patch(struct net_devic
|
||||
#endif
|
||||
}
|
||||
|
||||
+static unsigned int rtl8125_phy_duplex(u16 status)
|
||||
+{
|
||||
+ unsigned int duplex = DUPLEX_UNKNOWN;
|
||||
+
|
||||
+ if (status & LinkStatus) {
|
||||
+ if (status & RTL8125_FULL_DUPLEX_MASK)
|
||||
+ duplex = DUPLEX_FULL;
|
||||
+ else
|
||||
+ duplex = DUPLEX_HALF;
|
||||
+ }
|
||||
+
|
||||
+ return duplex;
|
||||
+}
|
||||
+
|
||||
+static int rtl8125_phy_speed(u16 status)
|
||||
+{
|
||||
+ int speed = SPEED_UNKNOWN;
|
||||
+
|
||||
+ if (status & LinkStatus) {
|
||||
+ if (status & _2500bpsF)
|
||||
+ speed = SPEED_2500;
|
||||
+ else if (status & _1000bpsF)
|
||||
+ speed = SPEED_1000;
|
||||
+ else if (status & _100bps)
|
||||
+ speed = SPEED_100;
|
||||
+ else if (status & _10bps)
|
||||
+ speed = SPEED_10;
|
||||
+ }
|
||||
+
|
||||
+ return speed;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
_rtl8125_check_link_status(struct net_device *dev, unsigned int link_state)
|
||||
{
|
||||
@@ -5128,11 +5161,18 @@ _rtl8125_check_link_status(struct net_de
|
||||
if (link_state == R8125_LINK_STATE_ON) {
|
||||
rtl8125_link_on_patch(dev);
|
||||
|
||||
- if (netif_msg_ifup(tp))
|
||||
- printk(KERN_INFO PFX "%s: link up\n", dev->name);
|
||||
+ if (netif_msg_ifup(tp)) {
|
||||
+ const u16 phy_status = RTL_R16(tp, PHYstatus);
|
||||
+ const unsigned int phy_duplex = rtl8125_phy_duplex(phy_status);
|
||||
+ const int phy_speed = rtl8125_phy_speed(phy_status);
|
||||
+ printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n",
|
||||
+ dev->name,
|
||||
+ phy_speed_to_str(phy_speed),
|
||||
+ phy_duplex_to_str(phy_duplex));
|
||||
+ }
|
||||
} else {
|
||||
if (netif_msg_ifdown(tp))
|
||||
- printk(KERN_INFO PFX "%s: link down\n", dev->name);
|
||||
+ printk(KERN_INFO PFX "%s: Link is Down\n", dev->name);
|
||||
|
||||
rtl8125_link_down_patch(dev);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/r8125_n.c
|
||||
+++ b/src/r8125_n.c
|
||||
@@ -43,6 +43,7 @@
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mii.h>
|
||||
@@ -8,36 +8,34 @@
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/interrupt.h>
|
||||
@@ -13626,6 +13627,23 @@ rtl8125_setup_mqs_reg(struct rtl8125_pri
|
||||
tp->imr_reg[i] = (u16)(IMR1_8125 + (i - 1) * 4);
|
||||
@@ -14756,6 +14757,22 @@ rtl8125_setup_mqs_reg(struct rtl8125_pri
|
||||
}
|
||||
|
||||
+static int
|
||||
static void
|
||||
+rtl8125_led_configuration(struct rtl8125_private *tp)
|
||||
+{
|
||||
+ u32 led_data;
|
||||
+ int ret;
|
||||
+ u32 led_data[4];
|
||||
+ int i, 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;
|
||||
+ const int led_regs[] = { 0x18, 0x86, 0x84, 0x96 };
|
||||
+ ret = of_property_read_u32_array(tp->pci_dev->dev.of_node,
|
||||
+ "led-data", led_data, 4);
|
||||
+ if (!ret) {
|
||||
+ for (i = 0; i < 4; i++) {
|
||||
+ RTL_W16(tp, led_regs[i], led_data[i]);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void
|
||||
+static void
|
||||
rtl8125_init_software_variable(struct net_device *dev)
|
||||
{
|
||||
@@ -14260,6 +14278,8 @@ rtl8125_init_software_variable(struct ne
|
||||
struct rtl8125_private *tp = netdev_priv(dev);
|
||||
@@ -15358,6 +15375,7 @@ rtl8125_init_software_variable(struct ne
|
||||
else if (tp->InitRxDescType == RX_DESC_RING_TYPE_4)
|
||||
tp->rtl8125_rx_config &= ~EnableRxDescV4_1;
|
||||
|
||||
+ rtl8125_led_configuration(tp);
|
||||
+
|
||||
tp->NicCustLedValue = RTL_R16(tp, CustomLED);
|
||||
|
||||
tp->wol_opts = rtl8125_get_hw_wol(tp);
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/src/r8125_n.c
|
||||
+++ b/src/r8125_n.c
|
||||
@@ -15345,6 +15345,7 @@ rtl8125_init_board(struct pci_dev *pdev,
|
||||
void __iomem *ioaddr;
|
||||
struct net_device *dev;
|
||||
struct rtl8125_private *tp;
|
||||
+ const char *devname = of_get_property(pdev->dev.of_node, "label", NULL);
|
||||
int rc = -ENOMEM, i, pm_cap;
|
||||
|
||||
assert(ioaddr_out != NULL);
|
||||
@@ -15359,6 +15360,9 @@ rtl8125_init_board(struct pci_dev *pdev,
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
+ if (devname)
|
||||
+ strscpy(dev->name, devname, IFNAMSIZ);
|
||||
+
|
||||
SET_MODULE_OWNER(dev);
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
tp = netdev_priv(dev);
|
||||
51
package/kernel/r8126/Makefile
Normal file
51
package/kernel/r8126/Makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=r8126
|
||||
PKG_VERSION:=10.014.01
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://github.com/openwrt/rtl8126/releases/download/$(PKG_VERSION)
|
||||
PKG_HASH:=dbb10a7abd0972e4abd1b89ea4eb22fc55d6c1dc2f711b5acf4a3bc376275e21
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Alvaro Fernandez Rojas <noltari@gmail.com>
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/r8126
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Realtek RTL8126 PCI 5 Gigabit Ethernet driver
|
||||
DEPENDS:=@PCI_SUPPORT +kmod-libphy
|
||||
FILES:=$(PKG_BUILD_DIR)/src/r8126.ko
|
||||
AUTOLOAD:=$(call AutoProbe,r8126)
|
||||
PROVIDES:=kmod-r8169
|
||||
VARIANT:=regular
|
||||
endef
|
||||
|
||||
define KernelPackage/r8126-rss
|
||||
$(call KernelPackage/r8126)
|
||||
CONFLICTS:=kmod-r8126
|
||||
TITLE+= (RSS)
|
||||
VARIANT:=rss
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),rss)
|
||||
PKG_MAKE_FLAGS += \
|
||||
ENABLE_RSS_SUPPORT=y \
|
||||
ENABLE_MULTIPLE_TX_QUEUE=y
|
||||
endif
|
||||
|
||||
PKG_MAKE_FLAGS += CONFIG_ASPM=n
|
||||
|
||||
define Build/Compile
|
||||
+$(KERNEL_MAKE) $(PKG_JOBS) \
|
||||
$(PKG_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)/src" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,r8126))
|
||||
$(eval $(call KernelPackage,r8126-rss))
|
||||
116
package/kernel/r8126/patches/100-fix-build-with-linux-6.9.patch
Normal file
116
package/kernel/r8126/patches/100-fix-build-with-linux-6.9.patch
Normal file
@@ -0,0 +1,116 @@
|
||||
--- a/src/r8126_n.c
|
||||
+++ b/src/r8126_n.c
|
||||
@@ -6929,7 +6929,11 @@ rtl8126_device_lpi_t_to_ethtool_lpi_t(st
|
||||
}
|
||||
|
||||
static int
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
|
||||
+#else
|
||||
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
+#endif
|
||||
{
|
||||
struct rtl8126_private *tp = netdev_priv(net);
|
||||
struct ethtool_eee *eee = &tp->eee;
|
||||
@@ -6962,9 +6966,15 @@ rtl_ethtool_get_eee(struct net_device *n
|
||||
|
||||
edata->eee_enabled = !!val;
|
||||
edata->eee_active = !!(supported & adv & lp);
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->supported, supported);
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->lp_advertised, lp);
|
||||
+#else
|
||||
edata->supported = supported;
|
||||
edata->advertised = adv;
|
||||
edata->lp_advertised = lp;
|
||||
+#endif
|
||||
edata->tx_lpi_enabled = edata->eee_enabled;
|
||||
edata->tx_lpi_timer = tx_lpi_timer;
|
||||
|
||||
@@ -6972,11 +6982,19 @@ rtl_ethtool_get_eee(struct net_device *n
|
||||
}
|
||||
|
||||
static int
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
|
||||
+#else
|
||||
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
+#endif
|
||||
{
|
||||
struct rtl8126_private *tp = netdev_priv(net);
|
||||
struct ethtool_eee *eee = &tp->eee;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ u32 advertising, adv;
|
||||
+#else
|
||||
u32 advertising;
|
||||
+#endif
|
||||
int rc = 0;
|
||||
|
||||
if (!HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp) ||
|
||||
@@ -7008,6 +7026,18 @@ rtl_ethtool_set_eee(struct net_device *n
|
||||
*/
|
||||
|
||||
advertising = tp->advertising;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ ethtool_convert_link_mode_to_legacy_u32(&adv, edata->advertised);
|
||||
+ if (linkmode_empty(edata->advertised)) {
|
||||
+ adv = advertising & eee->supported;
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
|
||||
+ } else if (!linkmode_empty(edata->advertised) & ~advertising) {
|
||||
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
|
||||
+ adv, advertising);
|
||||
+ rc = -EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+#else
|
||||
if (!edata->advertised) {
|
||||
edata->advertised = advertising & eee->supported;
|
||||
} else if (edata->advertised & ~advertising) {
|
||||
@@ -7016,13 +7046,23 @@ rtl_ethtool_set_eee(struct net_device *n
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
+#endif
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ if (!linkmode_empty(edata->advertised) & ~eee->supported) {
|
||||
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
|
||||
+ adv, eee->supported);
|
||||
+ rc = -EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+#else
|
||||
if (edata->advertised & ~eee->supported) {
|
||||
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
|
||||
edata->advertised, eee->supported);
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
+#endif
|
||||
|
||||
//tp->eee.eee_enabled = edata->eee_enabled;
|
||||
//tp->eee_adv_t = ethtool_adv_to_mmd_eee_adv_t(edata->advertised);
|
||||
@@ -7030,7 +7070,11 @@ rtl_ethtool_set_eee(struct net_device *n
|
||||
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE tx_lpi_timer %x must be a subset of support %x\n",
|
||||
edata->tx_lpi_timer, eee->tx_lpi_timer);
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, edata->advertised);
|
||||
+#else
|
||||
eee->advertised = edata->advertised;
|
||||
+#endif
|
||||
//eee->tx_lpi_enabled = edata->tx_lpi_enabled;
|
||||
//eee->tx_lpi_timer = edata->tx_lpi_timer;
|
||||
eee->eee_enabled = edata->eee_enabled;
|
||||
@@ -7106,8 +7150,10 @@ static const struct ethtool_ops rtl8126_
|
||||
.set_rxnfc = rtl8126_set_rxnfc,
|
||||
.get_rxfh_indir_size = rtl8126_rss_indir_size,
|
||||
.get_rxfh_key_size = rtl8126_get_rxfh_key_size,
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0)
|
||||
.get_rxfh = rtl8126_get_rxfh,
|
||||
.set_rxfh = rtl8126_set_rxfh,
|
||||
+#endif
|
||||
#endif //ENABLE_RSS_SUPPORT
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
|
||||
#ifdef ENABLE_PTP_SUPPORT
|
||||
@@ -0,0 +1,101 @@
|
||||
From 5ca1d47e065c0318774a946ffdf76010c78cc164 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Sat, 10 Aug 2024 20:16:32 +0800
|
||||
Subject: [PATCH] r8126: print link speed and duplex mode
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Like other Ethernet drivers, print link speed and duplex mode
|
||||
when the interface is up. Formatting output at the same time.
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
---
|
||||
src/r8126.h | 2 ++
|
||||
src/r8126_n.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
|
||||
2 files changed, 47 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/r8126.h
|
||||
+++ b/src/r8126.h
|
||||
@@ -1740,6 +1740,8 @@ enum RTL8126_register_content {
|
||||
LinkStatus = 0x02,
|
||||
FullDup = 0x01,
|
||||
|
||||
+#define RTL8126_FULL_DUPLEX_MASK (_5000bpsF | _2500bpsF | _1000bpsF | FullDup)
|
||||
+
|
||||
/* DBG_reg */
|
||||
Fix_Nak_1 = (1 << 4),
|
||||
Fix_Nak_2 = (1 << 3),
|
||||
--- a/src/r8126_n.c
|
||||
+++ b/src/r8126_n.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/pci.h>
|
||||
+#include <linux/phy.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/delay.h>
|
||||
@@ -4744,6 +4745,40 @@ rtl8126_link_down_patch(struct net_devic
|
||||
#endif
|
||||
}
|
||||
|
||||
+static unsigned int rtl8126_phy_duplex(u16 status)
|
||||
+{
|
||||
+ unsigned int duplex = DUPLEX_UNKNOWN;
|
||||
+
|
||||
+ if (status & LinkStatus) {
|
||||
+ if (status & RTL8126_FULL_DUPLEX_MASK)
|
||||
+ duplex = DUPLEX_FULL;
|
||||
+ else
|
||||
+ duplex = DUPLEX_HALF;
|
||||
+ }
|
||||
+
|
||||
+ return duplex;
|
||||
+}
|
||||
+
|
||||
+static int rtl8126_phy_speed(u16 status)
|
||||
+{
|
||||
+ int speed = SPEED_UNKNOWN;
|
||||
+
|
||||
+ if (status & LinkStatus) {
|
||||
+ if (status & _5000bpsF)
|
||||
+ speed = SPEED_5000;
|
||||
+ else if (status & _2500bpsF)
|
||||
+ speed = SPEED_2500;
|
||||
+ else if (status & _1000bpsF)
|
||||
+ speed = SPEED_1000;
|
||||
+ else if (status & _100bps)
|
||||
+ speed = SPEED_100;
|
||||
+ else if (status & _10bps)
|
||||
+ speed = SPEED_10;
|
||||
+ }
|
||||
+
|
||||
+ return speed;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
_rtl8126_check_link_status(struct net_device *dev, unsigned int link_state)
|
||||
{
|
||||
@@ -4756,11 +4791,18 @@ _rtl8126_check_link_status(struct net_de
|
||||
if (link_state == R8126_LINK_STATE_ON) {
|
||||
rtl8126_link_on_patch(dev);
|
||||
|
||||
- if (netif_msg_ifup(tp))
|
||||
- printk(KERN_INFO PFX "%s: link up\n", dev->name);
|
||||
+ if (netif_msg_ifup(tp)) {
|
||||
+ const u16 phy_status = RTL_R16(tp, PHYstatus);
|
||||
+ const unsigned int phy_duplex = rtl8126_phy_duplex(phy_status);
|
||||
+ const int phy_speed = rtl8126_phy_speed(phy_status);
|
||||
+ printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n",
|
||||
+ dev->name,
|
||||
+ phy_speed_to_str(phy_speed),
|
||||
+ phy_duplex_to_str(phy_duplex));
|
||||
+ }
|
||||
} else {
|
||||
if (netif_msg_ifdown(tp))
|
||||
- printk(KERN_INFO PFX "%s: link down\n", dev->name);
|
||||
+ printk(KERN_INFO PFX "%s: Link is Down\n", dev->name);
|
||||
|
||||
rtl8126_link_down_patch(dev);
|
||||
}
|
||||
40
package/kernel/r8152/Makefile
Normal file
40
package/kernel/r8152/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Download realtek r8152 linux driver from official site:
|
||||
# [https://www.realtek.com/Download/List?cate_id=585]
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=r8152
|
||||
PKG_VERSION:=2.19.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
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:=03f9a558ebf90d7cd121150f942395be4b96a5d11059fd0d0517db2574731189
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/realtek-$(PKG_NAME)-linux-$(PKG_VERSION)
|
||||
|
||||
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:=Realtek RTL8152/RTL8153/RTL8154/RTL8156/RTL8157 driver
|
||||
SUBMENU:=USB Support
|
||||
DEPENDS:=+kmod-usb-net +LINUX_6_12:kmod-libphy
|
||||
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 USB Ethernet chipsets
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(KERNEL_MAKE) M=$(PKG_BUILD_DIR) modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,usb-net-rtl8152-vendor))
|
||||
33
package/kernel/r8168/Makefile
Normal file
33
package/kernel/r8168/Makefile
Normal file
@@ -0,0 +1,33 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=r8168
|
||||
PKG_VERSION:=8.054.00
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://github.com/openwrt/rtl8168/releases/download/$(PKG_VERSION)
|
||||
PKG_HASH:=5480120cf823e991e8cbd325118c1ec0c57d8f42760ba1a7334bd07d291d235d
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Alvaro Fernandez Rojas <noltari@gmail.com>
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/r8168
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Realtek RTL8168 PCI Gigabit Ethernet driver
|
||||
DEPENDS:=@PCI_SUPPORT +kmod-libphy
|
||||
FILES:=$(PKG_BUILD_DIR)/src/r8168.ko
|
||||
AUTOLOAD:=$(call AutoProbe,r8168)
|
||||
PROVIDES:=kmod-r8169
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(KERNEL_MAKE) $(PKG_JOBS) \
|
||||
M="$(PKG_BUILD_DIR)/src" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,r8168))
|
||||
@@ -0,0 +1,28 @@
|
||||
From c0e1ae03f564f0e3db492ef2f25357b5da7977d7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Sat, 10 Aug 2024 20:12:40 +0200
|
||||
Subject: [PATCH] r8168_n: fix proc_dump_rx_desc_2 on 32 bits
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
---
|
||||
src/r8168_n.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/r8168_n.c
|
||||
+++ b/src/r8168_n.c
|
||||
@@ -1655,9 +1655,9 @@ static int proc_dump_rx_desc_2(struct se
|
||||
j, k);
|
||||
for (i=0; i<(tp->RxDescLength/4); i++) {
|
||||
if (!(i % 4))
|
||||
- seq_printf(m, "\n%04llx ",
|
||||
- ((u64)pdword + (i * 4) -
|
||||
- (u64)tp->RxDescArray));
|
||||
+ seq_printf(m, "\n%04x ",
|
||||
+ (u32) ((uintptr_t)pdword + (i * 4) -
|
||||
+ (uintptr_t)tp->RxDescArray));
|
||||
seq_printf(m, "%08x ", pdword[i]);
|
||||
}
|
||||
}
|
||||
119
package/kernel/r8168/patches/100-linux-6.9-support.patch
Normal file
119
package/kernel/r8168/patches/100-linux-6.9-support.patch
Normal file
@@ -0,0 +1,119 @@
|
||||
From 94426e16197c244d03aad0434e3490acdaa830fe Mon Sep 17 00:00:00 2001
|
||||
From: Masato TOYOSHIMA <phoepsilonix@phoepsilonix.love>
|
||||
Date: Tue, 14 May 2024 14:52:58 +0900
|
||||
Subject: [PATCH] Linux 6.9 compat: change to ethtool_keee from ethtool_eee
|
||||
|
||||
linux/include/linux/ethtool.h
|
||||
|
||||
struct ethtool_ops
|
||||
int (*get_eee)(struct net_device *dev, struct ethtool_keee *eee);
|
||||
int (*set_eee)(struct net_device *dev, struct ethtool_keee *eee);
|
||||
|
||||
change to ethtool_keee from ethtool_eee
|
||||
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
|
||||
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
|
||||
---
|
||||
src/r8168_n.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 44 insertions(+)
|
||||
|
||||
diff --git a/src/r8168_n.c b/src/r8168_n.c
|
||||
index ad63f42..3d67641 100755
|
||||
--- a/src/r8168_n.c
|
||||
+++ b/src/r8168_n.c
|
||||
@@ -7941,7 +7941,11 @@ rtl8168_device_lpi_t_to_ethtool_lpi_t(struct rtl8168_private *tp , u32 lpi_timer
|
||||
}
|
||||
|
||||
static int
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata)
|
||||
+#else
|
||||
rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
+#endif
|
||||
{
|
||||
struct rtl8168_private *tp = netdev_priv(net);
|
||||
struct ethtool_eee *eee = &tp->eee;
|
||||
@@ -7975,9 +7979,15 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
|
||||
edata->eee_enabled = !!val;
|
||||
edata->eee_active = !!(supported & adv & lp);
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->supported, supported);
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->lp_advertised, lp);
|
||||
+#else
|
||||
edata->supported = supported;
|
||||
edata->advertised = adv;
|
||||
edata->lp_advertised = lp;
|
||||
+#endif
|
||||
edata->tx_lpi_enabled = edata->eee_enabled;
|
||||
edata->tx_lpi_timer = tx_lpi_timer;
|
||||
|
||||
@@ -7985,11 +7995,19 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
}
|
||||
|
||||
static int
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata)
|
||||
+#else
|
||||
rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
+#endif
|
||||
{
|
||||
struct rtl8168_private *tp = netdev_priv(net);
|
||||
struct ethtool_eee *eee = &tp->eee;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ u32 advertising, adv;
|
||||
+#else
|
||||
u32 advertising;
|
||||
+#endif
|
||||
int rc = 0;
|
||||
|
||||
if (!rtl8168_support_eee(tp))
|
||||
@@ -8013,6 +8031,18 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
}
|
||||
|
||||
advertising = tp->advertising;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ ethtool_convert_link_mode_to_legacy_u32(&adv, edata->advertised);
|
||||
+ if (linkmode_empty(edata->advertised)) {
|
||||
+ adv = advertising & eee->supported;
|
||||
+ ethtool_convert_legacy_u32_to_link_mode(edata->advertised, adv);
|
||||
+ } else if (!linkmode_empty(edata->advertised) & ~advertising) {
|
||||
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
|
||||
+ adv, advertising);
|
||||
+ rc = -EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+#else
|
||||
if (!edata->advertised) {
|
||||
edata->advertised = advertising & eee->supported;
|
||||
} else if (edata->advertised & ~advertising) {
|
||||
@@ -8021,15 +8051,29 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata)
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
+#endif
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ if (!linkmode_empty(edata->advertised) & ~eee->supported) {
|
||||
+ dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
|
||||
+ adv, eee->supported);
|
||||
+ rc = -EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+#else
|
||||
if (edata->advertised & ~eee->supported) {
|
||||
dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised %x must be a subset of support %x\n",
|
||||
edata->advertised, eee->supported);
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
+#endif
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0)
|
||||
+ ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, edata->advertised);
|
||||
+#else
|
||||
eee->advertised = edata->advertised;
|
||||
+#endif
|
||||
eee->eee_enabled = edata->eee_enabled;
|
||||
|
||||
if (eee->eee_enabled)
|
||||
@@ -0,0 +1,97 @@
|
||||
From 0078930e0c374d327cd3281e5e2f7ff97b40b335 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Sun, 4 Aug 2024 16:15:12 +0800
|
||||
Subject: [PATCH] r8168: print link speed and duplex mode
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Like other Ethernet drivers, print link speed and duplex mode
|
||||
when the interface is up. Formatting output at the same time.
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
---
|
||||
src/r8168.h | 2 ++
|
||||
src/r8168_n.c | 44 +++++++++++++++++++++++++++++++++++++++++---
|
||||
2 files changed, 43 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/r8168.h
|
||||
+++ b/src/r8168.h
|
||||
@@ -1468,6 +1468,8 @@ enum RTL8168_register_content {
|
||||
LinkStatus = 0x02,
|
||||
FullDup = 0x01,
|
||||
|
||||
+#define RTL8168_FULL_DUPLEX_MASK (_1000bpsF | FullDup)
|
||||
+
|
||||
/* DBG_reg */
|
||||
Fix_Nak_1 = (1 << 4),
|
||||
Fix_Nak_2 = (1 << 3),
|
||||
--- a/src/r8168_n.c
|
||||
+++ b/src/r8168_n.c
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/pci.h>
|
||||
+#include <linux/phy.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/delay.h>
|
||||
@@ -5369,6 +5370,36 @@ rtl8168_link_down_patch(struct net_devic
|
||||
#endif
|
||||
}
|
||||
|
||||
+static unsigned int rtl8168_phy_duplex(u8 status)
|
||||
+{
|
||||
+ unsigned int duplex = DUPLEX_UNKNOWN;
|
||||
+
|
||||
+ if (status & LinkStatus) {
|
||||
+ if (status & RTL8168_FULL_DUPLEX_MASK)
|
||||
+ duplex = DUPLEX_FULL;
|
||||
+ else
|
||||
+ duplex = DUPLEX_HALF;
|
||||
+ }
|
||||
+
|
||||
+ return duplex;
|
||||
+}
|
||||
+
|
||||
+static int rtl8168_phy_speed(u8 status)
|
||||
+{
|
||||
+ int speed = SPEED_UNKNOWN;
|
||||
+
|
||||
+ if (status & LinkStatus) {
|
||||
+ if (status & _1000bpsF)
|
||||
+ speed = SPEED_1000;
|
||||
+ else if (status & _100bps)
|
||||
+ speed = SPEED_100;
|
||||
+ else if (status & _10bps)
|
||||
+ speed = SPEED_10;
|
||||
+ }
|
||||
+
|
||||
+ return speed;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
rtl8168_check_link_status(struct net_device *dev)
|
||||
{
|
||||
@@ -5388,11 +5419,18 @@ rtl8168_check_link_status(struct net_dev
|
||||
if (link_status_on) {
|
||||
rtl8168_link_on_patch(dev);
|
||||
|
||||
- if (netif_msg_ifup(tp))
|
||||
- printk(KERN_INFO PFX "%s: link up\n", dev->name);
|
||||
+ if (netif_msg_ifup(tp)) {
|
||||
+ const u8 phy_status = RTL_R8(tp, PHYstatus);
|
||||
+ const unsigned int phy_duplex = rtl8168_phy_duplex(phy_status);
|
||||
+ const int phy_speed = rtl8168_phy_speed(phy_status);
|
||||
+ printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n",
|
||||
+ dev->name,
|
||||
+ phy_speed_to_str(phy_speed),
|
||||
+ phy_duplex_to_str(phy_duplex));
|
||||
+ }
|
||||
} else {
|
||||
if (netif_msg_ifdown(tp))
|
||||
- printk(KERN_INFO PFX "%s: link down\n", dev->name);
|
||||
+ printk(KERN_INFO PFX "%s: Link is Down\n", dev->name);
|
||||
|
||||
rtl8168_link_down_patch(dev);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/r8168_n.c
|
||||
+++ b/src/r8168_n.c
|
||||
@@ -47,6 +47,7 @@
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mii.h>
|
||||
@@ -8,35 +8,30 @@
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/interrupt.h>
|
||||
@@ -25945,6 +25946,22 @@ rtl8168_setup_mqs_reg(struct rtl8168_pri
|
||||
tp->imr_reg[3] = IntrMask3;
|
||||
@@ -26098,6 +26099,18 @@ rtl8168_setup_mqs_reg(struct rtl8168_pri
|
||||
}
|
||||
|
||||
+static int rtl8168_led_configuration(struct rtl8168_private *tp)
|
||||
static void
|
||||
+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;
|
||||
+ "realtek,led-data", &led_data);
|
||||
+ if (!ret)
|
||||
+ RTL_W16(tp, CustomLED, led_data);
|
||||
+}
|
||||
+
|
||||
static void
|
||||
+static void
|
||||
rtl8168_init_software_variable(struct net_device *dev)
|
||||
{
|
||||
@@ -26640,6 +26657,8 @@ err1:
|
||||
struct rtl8168_private *tp = netdev_priv(dev);
|
||||
@@ -26792,6 +26805,7 @@ err1:
|
||||
if (tp->InitRxDescType == RX_DESC_RING_TYPE_2)
|
||||
tp->RxDescLength = RX_DESC_LEN_TYPE_2;
|
||||
|
||||
+ rtl8168_led_configuration(tp);
|
||||
+
|
||||
tp->NicCustLedValue = RTL_R16(tp, CustomLED);
|
||||
|
||||
rtl8168_get_hw_wol(dev);
|
||||
60
package/lean/aic8800/Makefile
Normal file
60
package/lean/aic8800/Makefile
Normal file
@@ -0,0 +1,60 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# Copyright (c) 2023-2024 AnYun
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=aic8800
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2024-03-04
|
||||
PKG_SOURCE_URL:=https://github.com/radxa-pkg/aic8800.git
|
||||
PKG_SOURCE_VERSION:=6a7ec8536a1688a785740d98ca96a4d00b274c56
|
||||
PKG_MIRROR_HASH:=75bbd6f410089d8301663aebdeeb79027420ec45dd054b5851c408dfeef23776
|
||||
|
||||
MAKE_PATH:=src/SDIO/driver_fw/driver/aic8800
|
||||
PKG_EXTMOD_SUBDIRS:=$(MAKE_PATH)
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/aic8800
|
||||
SUBMENU:=Wireless Drivers
|
||||
TITLE:=SKI WB800D80S wireless support
|
||||
DEPENDS:=+kmod-mac80211 +kmod-mmc \
|
||||
+@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT
|
||||
FILES:= \
|
||||
$(PKG_BUILD_DIR)/$(MAKE_PATH)/aic8800_bsp/aic8800_bsp.ko \
|
||||
$(PKG_BUILD_DIR)/$(MAKE_PATH)/aic8800_fdrv/aic8800_fdrv.ko
|
||||
AUTOLOAD:=$(call AutoProbe,aic8800_bsp aic8800_fdrv)
|
||||
MODPARAMS.aic8800_fdrv:=he_on=n
|
||||
endef
|
||||
|
||||
NOSTDINC_FLAGS := \
|
||||
$(KERNEL_NOSTDINC_FLAGS) \
|
||||
-I$(PKG_BUILD_DIR) \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211 \
|
||||
-include backport/backport.h
|
||||
|
||||
EXTRA_CFLAGS:= -DBUILD_OPENWRT
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)/$(MAKE_PATH)/" \
|
||||
modules
|
||||
endef
|
||||
|
||||
define KernelPackage/aic8800/install
|
||||
$(INSTALL_DIR) $(1)/lib/firmware/aic8800
|
||||
$(CP) $(PKG_BUILD_DIR)/src/SDIO/driver_fw/fw/aic8800D80/* $(1)/lib/firmware/aic8800
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,aic8800))
|
||||
114
package/lean/aic8800/patches/010-fixes-build.patch
Normal file
114
package/lean/aic8800/patches/010-fixes-build.patch
Normal file
@@ -0,0 +1,114 @@
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
|
||||
@@ -2932,7 +2932,7 @@ static struct rwnx_vif *rwnx_interface_a
|
||||
vif->ap.generation = 0;
|
||||
vif->ap.mesh_pm = NL80211_MESH_POWER_ACTIVE;
|
||||
vif->ap.next_mesh_pm = NL80211_MESH_POWER_ACTIVE;
|
||||
- // no break
|
||||
+ fallthrough;
|
||||
case NL80211_IFTYPE_AP:
|
||||
INIT_LIST_HEAD(&vif->ap.sta_list);
|
||||
memset(&vif->ap.bcn, 0, sizeof(vif->ap.bcn));
|
||||
@@ -3349,7 +3349,7 @@ static int rwnx_cfg80211_change_iface(st
|
||||
INIT_LIST_HEAD(&vif->ap.proxy_list);
|
||||
vif->ap.create_path = false;
|
||||
vif->ap.generation = 0;
|
||||
- // no break
|
||||
+ fallthrough;
|
||||
case NL80211_IFTYPE_AP:
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
INIT_LIST_HEAD(&vif->ap.sta_list);
|
||||
@@ -5257,6 +5257,7 @@ static int rwnx_cfg80211_mgmt_tx(struct
|
||||
switch (RWNX_VIF_TYPE(rwnx_vif)) {
|
||||
case NL80211_IFTYPE_AP_VLAN:
|
||||
rwnx_vif = rwnx_vif->ap_vlan.master;
|
||||
+ fallthrough;
|
||||
case NL80211_IFTYPE_AP:
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
@@ -5569,7 +5570,7 @@ rwnx_cfg80211_tdls_mgmt(struct wiphy *wi
|
||||
printk("%s: only one TDLS link is supported!\n", __func__);
|
||||
status_code = WLAN_STATUS_REQUEST_DECLINED;
|
||||
}
|
||||
- /* fall-through */
|
||||
+ fallthrough;
|
||||
case WLAN_TDLS_SETUP_REQUEST:
|
||||
case WLAN_TDLS_TEARDOWN:
|
||||
case WLAN_TDLS_DISCOVERY_REQUEST:
|
||||
@@ -5889,6 +5890,7 @@ static int rwnx_fill_station_info(struct
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
|
||||
case FORMATMOD_HE_MU:
|
||||
sinfo->rxrate.he_ru_alloc = rx_vect1->he.ru_size;
|
||||
+ fallthrough;
|
||||
case FORMATMOD_HE_SU:
|
||||
case FORMATMOD_HE_ER:
|
||||
sinfo->rxrate.flags = RATE_INFO_FLAGS_HE_MCS;
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_tx.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_tx.c
|
||||
@@ -524,7 +524,7 @@ int rwnx_send_add_if (struct rwnx_hw *rw
|
||||
//case NL80211_IFTYPE_P2P_DEVICE:
|
||||
case NL80211_IFTYPE_P2P_CLIENT:
|
||||
add_if_req_param->p2p = true;
|
||||
- // no break
|
||||
+ fallthrough;
|
||||
#endif /* CONFIG_RWNX_FULLMAC */
|
||||
case NL80211_IFTYPE_STATION:
|
||||
add_if_req_param->type = MM_STA;
|
||||
@@ -537,7 +537,7 @@ int rwnx_send_add_if (struct rwnx_hw *rw
|
||||
#ifdef CONFIG_RWNX_FULLMAC
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
add_if_req_param->p2p = true;
|
||||
- // no break
|
||||
+ fallthrough;
|
||||
#endif /* CONFIG_RWNX_FULLMAC */
|
||||
case NL80211_IFTYPE_AP:
|
||||
add_if_req_param->type = MM_AP;
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tdls.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tdls.c
|
||||
@@ -255,17 +255,24 @@ rwnx_add_wmm_info_ie(struct sk_buff *skb
|
||||
static u8 rwnx_ac_from_wmm(int ac)
|
||||
{
|
||||
switch (ac) {
|
||||
- default:
|
||||
- WARN_ON_ONCE(1);
|
||||
case 0:
|
||||
return AC_BE;
|
||||
+ break;
|
||||
case 1:
|
||||
return AC_BK;
|
||||
+ break;
|
||||
case 2:
|
||||
return AC_VI;
|
||||
+ break;
|
||||
case 3:
|
||||
return AC_VO;
|
||||
+ break;
|
||||
+ default:
|
||||
+ WARN_ON_ONCE(1);
|
||||
+ break;
|
||||
}
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tx.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tx.c
|
||||
@@ -325,6 +325,7 @@ u16 rwnx_select_txq(struct rwnx_vif *rwn
|
||||
/* AP_VLAN interface is not used for a 4A STA,
|
||||
fallback searching sta amongs all AP's clients */
|
||||
rwnx_vif = rwnx_vif->ap_vlan.master;
|
||||
+ fallthrough;
|
||||
case NL80211_IFTYPE_AP:
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
{
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_txq.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_txq.c
|
||||
@@ -635,6 +635,7 @@ static inline void rwnx_txq_vif_for_each
|
||||
}
|
||||
case NL80211_IFTYPE_AP_VLAN:
|
||||
rwnx_vif = rwnx_vif->ap_vlan.master;
|
||||
+ fallthrough;
|
||||
case NL80211_IFTYPE_AP:
|
||||
case NL80211_IFTYPE_MESH_POINT:
|
||||
case NL80211_IFTYPE_P2P_GO:
|
||||
12
package/lean/aic8800/patches/020-update-path.patch
Normal file
12
package/lean/aic8800/patches/020-update-path.patch
Normal file
@@ -0,0 +1,12 @@
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_bsp/Makefile
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_bsp/Makefile
|
||||
@@ -1,7 +1,7 @@
|
||||
CONFIG_SDIO_SUPPORT := y
|
||||
CONFIG_SDIO_PWRCTRL := y
|
||||
-CONFIG_AIC_FW_PATH = "/vendor/etc/firmware"
|
||||
-#CONFIG_AIC_FW_PATH = "/lib/firmware/aic8800"
|
||||
+#CONFIG_AIC_FW_PATH = "/vendor/etc/firmware"
|
||||
+CONFIG_AIC_FW_PATH = "/lib/firmware/aic8800"
|
||||
export CONFIG_AIC_FW_PATH
|
||||
ccflags-y += -DCONFIG_AIC_FW_PATH=\"$(CONFIG_AIC_FW_PATH)\"
|
||||
|
||||
92
package/lean/aic8800/patches/030-wireless-5.15.patch
Normal file
92
package/lean/aic8800/patches/030-wireless-5.15.patch
Normal file
@@ -0,0 +1,92 @@
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_compat.h
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_compat.h
|
||||
@@ -52,7 +52,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 60)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 60) || defined(BUILD_OPENWRT)
|
||||
#define IEEE80211_MAX_AMPDU_BUF IEEE80211_MAX_AMPDU_BUF_HE
|
||||
#define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB
|
||||
#define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
|
||||
@@ -2998,7 +2998,7 @@ static struct rwnx_vif *rwnx_interface_a
|
||||
} else
|
||||
vif->use_4addr = false;
|
||||
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) || defined(BUILD_OPENWRT)
|
||||
if (cfg80211_register_netdevice(ndev))
|
||||
#else
|
||||
if (register_netdevice(ndev))
|
||||
@@ -3271,7 +3271,7 @@ static int rwnx_cfg80211_del_iface(struc
|
||||
|
||||
if (dev->reg_state == NETREG_REGISTERED) {
|
||||
/* Will call rwnx_close if interface is UP */
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) || defined(BUILD_OPENWRT)
|
||||
cfg80211_unregister_netdevice(dev);
|
||||
#else
|
||||
unregister_netdevice(dev);
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_mod_params.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_mod_params.c
|
||||
@@ -1312,7 +1312,7 @@ static void rwnx_set_he_capa(struct rwnx
|
||||
if (rwnx_hw->mod_params->stbc_on)
|
||||
he_cap->he_cap_elem.phy_cap_info[2] |= IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ;
|
||||
|
||||
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
|
||||
he_cap->he_cap_elem.phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM |
|
||||
IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 |
|
||||
IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU;
|
||||
@@ -1330,7 +1330,7 @@ static void rwnx_set_he_capa(struct rwnx
|
||||
}
|
||||
he_cap->he_cap_elem.phy_cap_info[5] |= IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK |
|
||||
IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK;
|
||||
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
|
||||
he_cap->he_cap_elem.phy_cap_info[6] |= IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU |
|
||||
IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU |
|
||||
IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB |
|
||||
@@ -1429,7 +1429,7 @@ static void rwnx_set_he_capa(struct rwnx
|
||||
#endif
|
||||
if (rwnx_hw->mod_params->stbc_on)
|
||||
he_cap->he_cap_elem.phy_cap_info[2] |= IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ;
|
||||
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
|
||||
he_cap->he_cap_elem.phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM |
|
||||
IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 |
|
||||
IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU;
|
||||
@@ -1446,7 +1446,7 @@ static void rwnx_set_he_capa(struct rwnx
|
||||
}
|
||||
he_cap->he_cap_elem.phy_cap_info[5] |= IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK |
|
||||
IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK;
|
||||
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
|
||||
he_cap->he_cap_elem.phy_cap_info[6] |= IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU |
|
||||
IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU |
|
||||
IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB |
|
||||
@@ -1732,7 +1732,7 @@ void rwnx_custregd(struct rwnx_hw *rwnx_
|
||||
wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
|
||||
|
||||
rtnl_lock();
|
||||
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) || defined(BUILD_OPENWRT)
|
||||
if (regulatory_set_wiphy_regd_sync(wiphy, getRegdomainFromRwnxDB(wiphy, default_ccode))){
|
||||
wiphy_err(wiphy, "Failed to set custom regdomain\n");
|
||||
}
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_radar.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_radar.c
|
||||
@@ -1282,7 +1282,11 @@ static void rwnx_radar_detected(struct r
|
||||
chan_def = rwnx_hw->chanctx_table[rwnx_hw->cur_chanctx].chan_def;
|
||||
|
||||
rwnx_radar_cancel_cac(&rwnx_hw->radar);
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) || defined(BUILD_OPENWRT)
|
||||
+ __cfg80211_radar_event(rwnx_hw->wiphy, &chan_def, true, GFP_KERNEL);
|
||||
+#else
|
||||
cfg80211_radar_event(rwnx_hw->wiphy, &chan_def, GFP_KERNEL);
|
||||
+#endif
|
||||
|
||||
#endif /* CONFIG_RWNX_FULLMAC */
|
||||
}
|
||||
159
package/lean/aic8800/patches/031-wireless-6.1.patch
Normal file
159
package/lean/aic8800/patches/031-wireless-6.1.patch
Normal file
@@ -0,0 +1,159 @@
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
|
||||
@@ -776,7 +776,7 @@ static void rwnx_csa_finish(struct work_
|
||||
spin_unlock_bh(&rwnx_hw->cb_lock);
|
||||
#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION3)
|
||||
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef, 0, 0);
|
||||
-#elif (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION)
|
||||
+#elif (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION) || defined(BUILD_OPENWRT)
|
||||
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef, 0);
|
||||
#else
|
||||
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef);
|
||||
@@ -3540,7 +3540,7 @@ bool key_flag = false;
|
||||
* when adding a group key.
|
||||
*/
|
||||
static int rwnx_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
|
||||
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
|
||||
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
|
||||
int link_id,
|
||||
#endif
|
||||
u8 key_index, bool pairwise, const u8 *mac_addr,
|
||||
@@ -3637,7 +3637,7 @@ bool key_flag = false;
|
||||
*
|
||||
*/
|
||||
static int rwnx_cfg80211_get_key(struct wiphy *wiphy, struct net_device *netdev,
|
||||
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
|
||||
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
|
||||
int link_id,
|
||||
#endif
|
||||
u8 key_index, bool pairwise, const u8 *mac_addr,
|
||||
@@ -3655,7 +3655,7 @@ static int rwnx_cfg80211_get_key(struct
|
||||
* and @key_index, return -ENOENT if the key doesn't exist.
|
||||
*/
|
||||
static int rwnx_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev,
|
||||
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
|
||||
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
|
||||
int link_id,
|
||||
#endif
|
||||
u8 key_index, bool pairwise, const u8 *mac_addr)
|
||||
@@ -3694,7 +3694,7 @@ static int rwnx_cfg80211_del_key(struct
|
||||
*/
|
||||
static int rwnx_cfg80211_set_default_key(struct wiphy *wiphy,
|
||||
struct net_device *netdev,
|
||||
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
|
||||
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
|
||||
int link_id,
|
||||
#endif
|
||||
u8 key_index, bool unicast, bool multicast)
|
||||
@@ -3709,7 +3709,7 @@ static int rwnx_cfg80211_set_default_key
|
||||
*/
|
||||
static int rwnx_cfg80211_set_default_mgmt_key(struct wiphy *wiphy,
|
||||
struct net_device *netdev,
|
||||
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
|
||||
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
|
||||
int link_id,
|
||||
#endif
|
||||
u8 key_index)
|
||||
@@ -3796,7 +3796,7 @@ static int rwnx_cfg80211_connect(struct
|
||||
key_params.seq_len = 0;
|
||||
key_params.cipher = sme->crypto.cipher_group;
|
||||
rwnx_cfg80211_add_key(wiphy, dev,
|
||||
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
|
||||
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
|
||||
0,
|
||||
#endif
|
||||
sme->key_idx, false, NULL, &key_params);
|
||||
@@ -4063,7 +4063,7 @@ static int rwnx_cfg80211_add_station(str
|
||||
sta->vif_idx = rwnx_vif->vif_index;
|
||||
sta->vlan_idx = sta->vif_idx;
|
||||
sta->qos = (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME)) != 0;
|
||||
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
|
||||
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
|
||||
sta->ht = params->link_sta_params.ht_capa ? 1 : 0;
|
||||
sta->vht = params->link_sta_params.vht_capa ? 1 : 0;
|
||||
#else
|
||||
@@ -4469,7 +4469,7 @@ static int rwnx_cfg80211_change_station(
|
||||
sta->vif_idx = rwnx_vif->vif_index;
|
||||
sta->vlan_idx = sta->vif_idx;
|
||||
sta->qos = (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME)) != 0;
|
||||
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
|
||||
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
|
||||
sta->ht = params->link_sta_params.ht_capa ? 1 : 0;
|
||||
sta->vht = params->link_sta_params.vht_capa ? 1 : 0;
|
||||
#else
|
||||
@@ -4716,7 +4716,7 @@ static int rwnx_cfg80211_change_beacon(s
|
||||
/**
|
||||
* * @stop_ap: Stop being an AP, including stopping beaconing.
|
||||
*/
|
||||
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION)
|
||||
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION) || defined(BUILD_OPENWRT)
|
||||
static int rwnx_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, unsigned int link_id)
|
||||
#else
|
||||
static int rwnx_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
|
||||
@@ -5190,7 +5190,7 @@ static int rwnx_cfg80211_dump_survey(str
|
||||
*/
|
||||
static int rwnx_cfg80211_get_channel(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev,
|
||||
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
|
||||
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
|
||||
unsigned int link_id,
|
||||
#endif
|
||||
struct cfg80211_chan_def *chandef)
|
||||
@@ -5487,7 +5487,7 @@ int rwnx_cfg80211_channel_switch (struct
|
||||
INIT_WORK(&csa->work, rwnx_csa_finish);
|
||||
#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION4
|
||||
cfg80211_ch_switch_started_notify(dev, &csa->chandef, 0, params->count, false, 0);
|
||||
-#elif LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2
|
||||
+#elif LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2 || defined(BUILD_OPENWRT)
|
||||
cfg80211_ch_switch_started_notify(dev, &csa->chandef, 0, params->count, false);
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
|
||||
cfg80211_ch_switch_started_notify(dev, &csa->chandef, params->count, params->block_tx);
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_rx.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_rx.c
|
||||
@@ -836,7 +836,7 @@ static inline int rwnx_rx_sm_connect_ind
|
||||
|
||||
do {
|
||||
bss = cfg80211_get_bss(wdev->wiphy, NULL, rwnx_vif->sta.bssid,
|
||||
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
|
||||
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
|
||||
wdev->u.client.ssid, wdev->u.client.ssid_len,
|
||||
#else
|
||||
wdev->ssid, wdev->ssid_len,
|
||||
@@ -866,7 +866,7 @@ static inline int rwnx_rx_sm_connect_ind
|
||||
#else
|
||||
WLAN_CAPABILITY_ESS,
|
||||
#endif
|
||||
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
|
||||
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
|
||||
(int)wdev->u.client.ssid_len,
|
||||
wdev->u.client.ssid,
|
||||
#else
|
||||
@@ -887,7 +887,7 @@ static inline int rwnx_rx_sm_connect_ind
|
||||
rwnx_vif->sta.bssid[0], rwnx_vif->sta.bssid[1], rwnx_vif->sta.bssid[2],
|
||||
rwnx_vif->sta.bssid[3], rwnx_vif->sta.bssid[4], rwnx_vif->sta.bssid[5]);
|
||||
|
||||
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
|
||||
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
|
||||
wdev->u.client.ssid_len = (int)rwnx_vif->sta.ssid_len;
|
||||
memcpy(wdev->u.client.ssid, rwnx_vif->sta.ssid, wdev->u.client.ssid_len);
|
||||
#else
|
||||
@@ -927,7 +927,7 @@ static inline int rwnx_rx_sm_connect_ind
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
||||
struct cfg80211_roam_info info;
|
||||
memset(&info, 0, sizeof(info));
|
||||
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
|
||||
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
|
||||
if (rwnx_vif->ch_index < NX_CHAN_CTXT_CNT)
|
||||
info.links[0].channel = rwnx_hw->chanctx_table[rwnx_vif->ch_index].chan_def.chan;
|
||||
info.links[0].bssid = (const u8 *)ind->bssid.array;
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_tx.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_tx.c
|
||||
@@ -1941,7 +1941,7 @@ int rwnx_send_me_sta_add(struct rwnx_hw
|
||||
{
|
||||
struct me_sta_add_req *req;
|
||||
|
||||
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
|
||||
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
|
||||
struct link_station_parameters *link_sta_params = ¶ms->link_sta_params;
|
||||
#else
|
||||
struct station_parameters *link_sta_params = params;
|
||||
13
package/lean/aic8800/patches/032-wireless-6.6.patch
Normal file
13
package/lean/aic8800/patches/032-wireless-6.6.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_compat.h
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_compat.h
|
||||
@@ -47,8 +47,8 @@
|
||||
#else
|
||||
#define HIGH_KERNEL_VERSION KERNEL_VERSION(6, 0, 0)
|
||||
#define HIGH_KERNEL_VERSION2 KERNEL_VERSION(6, 1, 0)
|
||||
-#define HIGH_KERNEL_VERSION3 KERNEL_VERSION(6, 3, 0)
|
||||
-#define HIGH_KERNEL_VERSION4 KERNEL_VERSION(6, 3, 0)
|
||||
+#define HIGH_KERNEL_VERSION3 KERNEL_VERSION(6, 9, 0)
|
||||
+#define HIGH_KERNEL_VERSION4 KERNEL_VERSION(6, 9, 0)
|
||||
#endif
|
||||
|
||||
|
||||
32
package/lean/aic8800/patches/040-disable-log.patch
Normal file
32
package/lean/aic8800/patches/040-disable-log.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_bsp/aic_bsp_main.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_bsp/aic_bsp_main.c
|
||||
@@ -15,7 +15,7 @@
|
||||
#define DRV_AUTHOR "AICSemi"
|
||||
#define DRV_VERS_MOD "1.0"
|
||||
|
||||
-int aicwf_dbg_level_bsp = LOGERROR|LOGINFO|LOGDEBUG|LOGTRACE;
|
||||
+int aicwf_dbg_level_bsp = LOGDATA;
|
||||
|
||||
static struct platform_device *aicbsp_pdev;
|
||||
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
|
||||
@@ -503,7 +503,7 @@ static const int rwnx_hwq2uapsd[NL80211_
|
||||
|
||||
|
||||
extern uint8_t scanning;
|
||||
-int aicwf_dbg_level = LOGERROR|LOGINFO|LOGDEBUG|LOGTRACE;
|
||||
+int aicwf_dbg_level = LOGWAKELOCK;
|
||||
module_param(aicwf_dbg_level, int, 0660);
|
||||
int testmode = 0;
|
||||
char aic_fw_path[200];
|
||||
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tx.c
|
||||
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_tx.c
|
||||
@@ -169,7 +169,6 @@ void rwnx_ps_bh_traffic_req(struct rwnx_
|
||||
// sta->mac_addr))
|
||||
// return;
|
||||
if (!sta->ps.active) {
|
||||
- printk("sta %pM is not in Power Save mode", sta->mac_addr);
|
||||
return;
|
||||
}
|
||||
#ifdef CREATE_TRACE_POINTS
|
||||
@@ -43,11 +43,15 @@ define Package/autocore-arm/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/arm/index.htm $(1)/etc/index.htm
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/arm/090-cover-index_htm $(1)/etc/uci-defaults/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) ./files/arm/sbin/cpuinfo $(1)/sbin/cpuinfo
|
||||
$(INSTALL_BIN) ./files/arm/sbin/ethinfo $(1)/sbin/ethinfo
|
||||
$(INSTALL_BIN) ./files/arm/sbin/usage $(1)/sbin/usage
|
||||
$(INSTALL_BIN) ./files/arm/sbin/tempinfo $(1)/sbin/tempinfo
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
|
||||
endef
|
||||
|
||||
define Package/autocore-x86/install
|
||||
@@ -55,8 +59,12 @@ define Package/autocore-x86/install
|
||||
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/autocore
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/x86/index.htm $(1)/etc/index.htm
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(CP) ./files/x86/sbin/* $(1)/sbin
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,autocore-arm))
|
||||
|
||||
5
package/lean/autocore/files/60-autocore-reload-rpcd
Executable file
5
package/lean/autocore/files/60-autocore-reload-rpcd
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
/etc/init.d/rpcd restart
|
||||
|
||||
exit 0
|
||||
40
package/lean/autocore/files/arm/sbin/tempinfo
Executable file
40
package/lean/autocore/files/arm/sbin/tempinfo
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /etc/openwrt_release
|
||||
|
||||
IEEE_PATH="/sys/class/ieee80211"
|
||||
THERMAL_PATH="/sys/class/thermal"
|
||||
|
||||
case "$DISTRIB_TARGET" in
|
||||
ipq40xx/*|ipq806x/*)
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/device/hwmon/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
|
||||
;;
|
||||
mediatek/mt7622)
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/wl*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
|
||||
;;
|
||||
*)
|
||||
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$DISTRIB_TARGET" in
|
||||
ipq40xx/*)
|
||||
if [ -e "$IEEE_PATH/phy0/hwmon0/temp1_input" ]; then
|
||||
mt76_temp="$(awk -F ': ' '{print $2}' "$IEEE_PATH/phy0/hwmon0/temp1_input" 2>"/dev/null")°C"
|
||||
fi
|
||||
[ -z "$mt76_temp" ] || wifi_temp="${wifi_temp:+$wifi_temp }$mt76_temp"
|
||||
;;
|
||||
*)
|
||||
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' "$THERMAL_PATH/thermal_zone0/temp" 2>"/dev/null")"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$cpu_temp" ] && [ -z "$wifi_temp" ]; then
|
||||
echo -n "CPU: $cpu_temp"
|
||||
elif [ -z "$cpu_temp" ] && [ -n "$wifi_temp" ]; then
|
||||
echo -n "WiFi: $wifi_temp"
|
||||
elif [ -n "$cpu_temp" ] && [ -n "$wifi_temp" ]; then
|
||||
echo -n "CPU: $cpu_temp, WiFi: $wifi_temp"
|
||||
else
|
||||
echo -n "No temperature info"
|
||||
fi
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
NSS_PATH="/sys/kernel/debug/qca-nss-drv/stats"
|
||||
|
||||
cpu_usage="$(top -n1 | awk '/^CPU/ {printf("%d%", 100 - $8)}')"
|
||||
cpu_usage="$(busybox top -n1 | awk '/^CPU/ {printf("%d%", 100 - $8)}')"
|
||||
|
||||
[ ! -d "$NSS_PATH" ] || \
|
||||
npu_usage="$(grep '%' "$NSS_PATH"/cpu_load_ubi | awk -F ' ' '{print $2}')"
|
||||
|
||||
10
package/lean/autocore/files/luci-mod-status-autocore.json
Normal file
10
package/lean/autocore/files/luci-mod-status-autocore.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"luci-mod-status-autocore": {
|
||||
"description": "Grant access to autocore",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"luci": [ "getCPUInfo", "getCPUUsage", "getTempInfo" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ start()
|
||||
d=$(echo -n 'C')
|
||||
e=$(cat /proc/cpuinfo | grep 'processor' | wc -l)
|
||||
f=$(echo -n 'T ')
|
||||
g=$(dmesg | grep 'DMI:' | awk -F ',' '{print $1 }' | awk -F ':' '{print $2 }')
|
||||
g=$(dmesg | grep 'DMI:' | awk -F ',' '{print $1 }' | awk -F ':' '{print $2 }' | head -n 1)
|
||||
|
||||
if [ -d /sys/devices/cpu_atom/ ]; then
|
||||
pcore=$(cat /sys/devices/cpu_core/cpus | awk -F- '{print $2}')
|
||||
|
||||
@@ -9,21 +9,43 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=autosamba
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=13
|
||||
PKG_RELEASE:=15
|
||||
PKG_ARCH:=all
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_KSMBD \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA3 \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA4 \
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/autosamba
|
||||
TITLE:=Samba autoconfig hotplug script.
|
||||
MAINTAINER:=Lean
|
||||
DEPENDS:=+luci-app-samba4 +wsdd2
|
||||
DEPENDS:=+wsdd2 +PACKAGE_$(PKG_NAME)_INCLUDE_KSMBD:luci-app-ksmbd +PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA3:luci-app-samba +PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA4:luci-app-samba4
|
||||
endef
|
||||
|
||||
define Package/autosamba/description
|
||||
A hotplug script to config Samba share automatically.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
choice
|
||||
prompt "Samba Server Selection"
|
||||
default PACKAGE_$(PKG_NAME)_INCLUDE_KSMBD
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_KSMBD
|
||||
bool "KSMBD"
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA3
|
||||
bool "SAMBA 3"
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_SAMBA4
|
||||
bool "SAMBA 4"
|
||||
endchoice
|
||||
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
|
||||
@@ -39,8 +39,9 @@ define Package/ddns-scripts_aliyun/preinst
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_aliyun/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/update_aliyun_com.sh $(1)/usr/lib/ddns
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns $(1)/usr/share/ddns/default
|
||||
$(INSTALL_BIN) $(CURDIR)/update_aliyun_com.sh $(1)/usr/lib/ddns
|
||||
$(INSTALL_DATA) $(CURDIR)/aliyun.com.json $(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_aliyun/postinst
|
||||
|
||||
9
package/lean/ddns-scripts_aliyun/aliyun.com.json
Normal file
9
package/lean/ddns-scripts_aliyun/aliyun.com.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "aliyun.com",
|
||||
"ipv4": {
|
||||
"url": "update_aliyun_com.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_aliyun_com.sh"
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(CP) ./*.sh $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_dnspod/preinst
|
||||
@@ -39,8 +38,9 @@ define Package/ddns-scripts_dnspod/preinst
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_dnspod/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/*.sh $(1)/usr/lib/ddns
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ddns $(1)/usr/share/ddns/default
|
||||
$(INSTALL_BIN) $(CURDIR)/*.sh $(1)/usr/lib/ddns
|
||||
$(INSTALL_DATA) $(CURDIR)/*.json $(1)/usr/share/ddns/default
|
||||
endef
|
||||
|
||||
define Package/ddns-scripts_dnspod/postinst
|
||||
|
||||
9
package/lean/ddns-scripts_dnspod/dnspod.cn.json
Normal file
9
package/lean/ddns-scripts_dnspod/dnspod.cn.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "dnspod.com",
|
||||
"ipv4": {
|
||||
"url": "update_dnspod_cn.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_dnspod_cn.sh"
|
||||
}
|
||||
}
|
||||
9
package/lean/ddns-scripts_dnspod/dnspod.com.json
Normal file
9
package/lean/ddns-scripts_dnspod/dnspod.com.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "dnspod.com",
|
||||
"ipv4": {
|
||||
"url": "update_dnspod_com.sh"
|
||||
},
|
||||
"ipv6": {
|
||||
"url": "update_dnspod_com.sh"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci set luci.main.lang=zh_cn
|
||||
uci commit luci
|
||||
|
||||
uci -q batch <<-EOF
|
||||
set system.@system[0].timezone='CST-8'
|
||||
set system.@system[0].zonename='Asia/Shanghai'
|
||||
@@ -11,13 +8,10 @@ uci -q batch <<-EOF
|
||||
add_list system.ntp.server='ntp1.aliyun.com'
|
||||
add_list system.ntp.server='ntp.tencent.com'
|
||||
add_list system.ntp.server='ntp.ntsc.ac.cn'
|
||||
add_list system.ntp.server='time.ustc.edu.cn'
|
||||
add_list system.ntp.server='time.apple.com'
|
||||
EOF
|
||||
uci commit system
|
||||
|
||||
uci set fstab.@global[0].anon_mount=1
|
||||
uci commit fstab
|
||||
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/mwan.htm
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/upnp.htm
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/ddns.htm
|
||||
@@ -36,6 +30,8 @@ sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/usb_printer.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/xunlei.lua
|
||||
sed -i 's/services/nas/g' /usr/lib/lua/luci/view/minidlna_status.htm
|
||||
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/share/luci/menu.d/luci-app-samba4.json
|
||||
|
||||
sed -i 's#downloads.openwrt.org#mirrors.tencent.com/lede#g' /etc/opkg/distfeeds.conf
|
||||
sed -i 's/root::0:0:99999:7:::/root:$1$V4UetPzk$CYXluq4wUazHjmCDBCqXF.:0:0:99999:7:::/g' /etc/shadow
|
||||
sed -i 's/root:::0:99999:7:::/root:$1$V4UetPzk$CYXluq4wUazHjmCDBCqXF.:0:0:99999:7:::/g' /etc/shadow
|
||||
@@ -51,15 +47,13 @@ sed -i '/option disabled/d' /etc/config/wireless
|
||||
sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh
|
||||
|
||||
sed -i '/DISTRIB_REVISION/d' /etc/openwrt_release
|
||||
echo "DISTRIB_REVISION='R24.8.1'" >> /etc/openwrt_release
|
||||
echo "DISTRIB_REVISION='R24.12.12-D'" >> /etc/openwrt_release
|
||||
sed -i '/DISTRIB_DESCRIPTION/d' /etc/openwrt_release
|
||||
echo "DISTRIB_DESCRIPTION='OpenWrt '" >> /etc/openwrt_release
|
||||
|
||||
sed -i '/log-facility/d' /etc/dnsmasq.conf
|
||||
echo "log-facility=/dev/null" >> /etc/dnsmasq.conf
|
||||
|
||||
#ln -sf /sbin/ip /usr/bin/ip
|
||||
|
||||
rm -rf /tmp/luci-modulecache/
|
||||
rm -f /tmp/luci-indexcache
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=leigod-acc
|
||||
PKG_VERSION:=1.3.0.30
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -26,18 +26,32 @@ endef
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
acc-arch:=amd64
|
||||
endif
|
||||
ifeq ($(ARCH),mipsel)
|
||||
acc-arch:=mipsle
|
||||
endif
|
||||
ifeq ($(ARCH),arm)
|
||||
acc-arch:=arm
|
||||
endif
|
||||
ifeq ($(ARCH),aarch64)
|
||||
acc-arch:=arm64
|
||||
PKG_HASH:=c26e2cde79ef21991834a94232520d1e5ac2df88a6382cb436a61865a8d9c15e
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),mipsel)
|
||||
acc-arch:=mipsle
|
||||
PKG_HASH:=ac35cf6e19fc5028ac1da9921456726a14e0726339e89fe3e14c01a713140e57
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),arm)
|
||||
acc-arch:=arm
|
||||
PKG_HASH:=c904bb3f41910d50ae6e8abc1e2a0b73eed6d74fb5c3b55274b82e9d4662a426
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),aarch64)
|
||||
acc-arch:=arm64
|
||||
PKG_HASH:=316a604645f4216276dc5642d5f638a005b342771fb436a3c63826d85c5b5c1b
|
||||
endif
|
||||
|
||||
PKG_SOURCE_URL:=http://119.3.40.126/router_plugin/
|
||||
PKG_SOURCE:=acc-gw.linux.$(acc-arch)
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
mkdir -p $(PKG_BUILD_DIR)/bin
|
||||
wget -O $(PKG_BUILD_DIR)/bin/acc-gw.linux.$(acc-arch) $(PKG_SOURCE_URL)$(PKG_SOURCE)
|
||||
chmod +x $(PKG_BUILD_DIR)/bin/acc-gw.linux.$(acc-arch)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
@@ -48,9 +62,10 @@ endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin/leigod
|
||||
$(INSTALL_BIN) ./files/acc-gw.linux.$(acc-arch) $(1)/usr/sbin/leigod/acc-gw.linux.$(acc-arch)
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/acc-gw.linux.$(acc-arch) $(1)/usr/sbin/leigod/acc-gw.linux.$(acc-arch)
|
||||
$(INSTALL_BIN) ./files/leigod_uninstall.sh $(1)/usr/sbin/leigod/leigod_uninstall.sh
|
||||
$(INSTALL_BIN) ./files/plugin_common.sh $(1)/usr/sbin/leigod/plugin_common.sh
|
||||
$(INSTALL_BIN) ./files/leigod-helper.sh $(1)/usr/sbin/leigod/leigod-helper.sh
|
||||
$(INSTALL_BIN) ./files/update_plugin $(1)/usr/sbin/leigod/update_plugin
|
||||
$(INSTALL_DATA) ./files/version $(1)/usr/sbin/leigod/version
|
||||
endef
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=Luci for Leigod Game Accelerater
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+libpcap +iptables +kmod-ipt-nat +iptables-mod-tproxy +kmod-ipt-tproxy +kmod-tun +kmod-netem +tc-full +kmod-ipt-ipset +ipset +curl +miniupnpd +conntrack +conntrackd +leigod-acc
|
||||
LUCI_DEPENDS:=+libpcap +iptables +kmod-ipt-nat +iptables-mod-tproxy +kmod-ipt-tproxy +kmod-tun +kmod-netem +tc-full +kmod-ipt-ipset +ipset +curl +miniupnpd +conntrack +conntrackd +leigod-acc +jq
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=5
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ function index()
|
||||
entry({ "admin", "services", "acc", "status" }, call("get_acc_status")).leaf = true
|
||||
entry({ "admin", "services", "acc", "start_acc_service" }, call("start_acc_service"))
|
||||
entry({ "admin", "services", "acc", "stop_acc_service" }, call("stop_acc_service"))
|
||||
entry({ "admin", "services", "acc", "schedule_pause" }, call("schedule_pause"))
|
||||
end
|
||||
|
||||
-- get_acc_status get acc status
|
||||
@@ -78,24 +79,26 @@ end
|
||||
function schedule_pause()
|
||||
local util = require "luci.util"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
|
||||
local schedule_enabled = uci:get("accelerator", "system", "schedule_enabled") or "0"
|
||||
local pause_time = uci:get("accelerator", "system", "pause_time") or "01:00"
|
||||
local username = uci:get("accelerator", "system", "username") or ""
|
||||
local password = uci:get("accelerator", "system", "password") or ""
|
||||
|
||||
-- Remove existing cron jobs related to leigod_helper.sh
|
||||
util.exec("sed -i '/usr/sbin/leigod/leigod_helper.sh/d' /etc/crontabs/root")
|
||||
-- Remove existing cron jobs related to leigod-helper.sh
|
||||
util.exec("sed -i '/\\/usr\\/sbin\\/leigod\\/leigod-helper.sh/d' /etc/crontabs/root")
|
||||
|
||||
if schedule_enabled == "1" then
|
||||
-- Set the new cron job
|
||||
local hour, minute = pause_time:match("(%d+):(%d+)")
|
||||
local cron_time = string.format("%d %d * * * USERNAME=%s PASSWORD=%s /usr/sbin/leigod/leigod_helper.sh", tonumber(minute), tonumber(hour), username, password)
|
||||
util.exec(string.format('echo "%s" >> /etc/crontabs/root', cron_time))
|
||||
util.exec("/etc/init.d/cron restart")
|
||||
local hour, minute = pause_time:match("(%d+):(%d+)")
|
||||
local cron_time = string.format("%s %s * * * USERNAME='%s' PASSWORD='%s' /usr/sbin/leigod/leigod-helper.sh", tonumber(minute), tonumber(hour), username, password)
|
||||
|
||||
-- Add new cron job
|
||||
local cron_command = string.format('echo "%s" >> /etc/crontabs/root', cron_time)
|
||||
util.exec(cron_command)
|
||||
util.exec("/etc/init.d/cron restart")
|
||||
end
|
||||
|
||||
local resp = {}
|
||||
resp.result = "OK"
|
||||
local resp = { result = "OK" }
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(resp)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,26 +21,24 @@ tun.description = translate("Turning Leigod into Tunnel mode can make some proxy
|
||||
schedule_enabled = s:option(Flag, "schedule_enabled", translate("Scheduled Pause"))
|
||||
schedule_enabled.rmempty = false
|
||||
schedule_enabled.default = 0
|
||||
schedule_enabled.description = translate("夜猫子选项")
|
||||
schedule_enabled.description = translate("Enable scheduled pause for Leigod Accelerator")
|
||||
|
||||
pause_time = s:option(ListValue, "pause_time", translate("Pause Time"))
|
||||
pause_time:depends("schedule_enabled", 1)
|
||||
for i = 0, 23 do
|
||||
pause_time:value(string.format("%02d:00", i), string.format("%02d:00", i))
|
||||
end
|
||||
pause_time.rmempty = false
|
||||
pause_time.description = translate("选择好时间雷神加速器会定时暂停,请避开你的游戏时间以免影响游戏体验")
|
||||
|
||||
pause_time.rmempty = true
|
||||
|
||||
username = s:option(Value, "username", translate("Phone Number"))
|
||||
username:depends("schedule_enabled", 1)
|
||||
username.rmempty = false
|
||||
username.rmempty = true
|
||||
|
||||
password = s:option(Value, "password", translate("Leigod Password"))
|
||||
password:depends("schedule_enabled", 1)
|
||||
password.password = true
|
||||
password.rmempty = false
|
||||
password.rmempty = true
|
||||
|
||||
m:section(SimpleSection).template = "leigod/service"
|
||||
|
||||
return m
|
||||
return m
|
||||
|
||||
1
package/lean/luci-app-leigod-acc/po/zh-cn
Symbolic link
1
package/lean/luci-app-leigod-acc/po/zh-cn
Symbolic link
@@ -0,0 +1 @@
|
||||
zh_Hans
|
||||
@@ -86,11 +86,26 @@ msgstr "未分类设备"
|
||||
msgid "Tunnel Mode"
|
||||
msgstr "TUN 模式"
|
||||
|
||||
msgid "Turning Leigod into Tunnel mode can make some proxy plugins available"
|
||||
msgstr "将雷神加速器设为 TUN 模式可以使一些 proxy 插件可用"
|
||||
|
||||
msgid "Enable scheduled pause for Leigod Accelerator"
|
||||
msgstr "启用后将在预设时间执行暂停时长操作"
|
||||
|
||||
msgid "Pause Time"
|
||||
msgstr "设置计划定时暂停的时间"
|
||||
|
||||
msgid "Phone Number"
|
||||
msgstr "手机号码"
|
||||
|
||||
msgid "Leigod Password"
|
||||
msgstr "雷神密码"
|
||||
|
||||
msgid "PC_Catalog"
|
||||
msgstr "PC 设备"
|
||||
|
||||
msgid "Game_Catalog"
|
||||
msgstr "游戏机"
|
||||
msgstr "游戏主机"
|
||||
|
||||
msgid "VR_Catalog"
|
||||
msgstr "VR 设备"
|
||||
@@ -1,39 +0,0 @@
|
||||
#
|
||||
# Download realtek r8101 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:=r8101
|
||||
PKG_VERSION:=1.038.02
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/sbwml/package_kernel_r8101
|
||||
PKG_SOURCE_VERSION:=5dea36329c0524490c093991801973fc48d92a8b
|
||||
PKG_MIRROR_HASH:=f4182719b25cd177023dddd6f0f555597c8e340fa38127566681d10be885dd9a
|
||||
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/r8101
|
||||
TITLE:=Driver for Realtek r8101 chipsets
|
||||
SUBMENU:=Network Devices
|
||||
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
|
||||
DEPENDS:=@PCI_SUPPORT
|
||||
FILES:= $(PKG_BUILD_DIR)/src/r8101.ko
|
||||
AUTOLOAD:=$(call AutoProbe,r8101)
|
||||
endef
|
||||
|
||||
define Package/r8101/description
|
||||
This package contains a driver for Realtek r8101 chipsets.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(KERNEL_MAKE) M=$(PKG_BUILD_DIR)/src modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,r8101))
|
||||
@@ -1,14 +0,0 @@
|
||||
--- a/src/r8101.h
|
||||
--- b/src/r8101.h
|
||||
@@ -492,7 +492,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;
|
||||
@@ -1,39 +0,0 @@
|
||||
#
|
||||
# Download realtek r8125 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:=r8125
|
||||
PKG_VERSION:=9.013.02-2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
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:=eae10100680de13e8119602c50a1748b8a0669eccd61d9a4515b4c846deb3960
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/realtek-$(PKG_NAME)-dkms-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILE:=LICENSE
|
||||
|
||||
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))
|
||||
@@ -1,20 +0,0 @@
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -35,7 +35,7 @@ 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
|
||||
@@ -44,7 +44,7 @@ ENABLE_TX_NO_CLOSE = y
|
||||
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_WOL_SUPPORT = n
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/src/r8125_rss.c
|
||||
+++ b/src/r8125_rss.c
|
||||
@@ -91,7 +91,7 @@ int rtl8125_get_rxnfc(struct net_device
|
||||
struct rtl8125_private *tp = netdev_priv(dev);
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
- netif_info(tp, drv, tp->dev, "rss get rxnfc\n");
|
||||
+ netif_dbg(tp, drv, tp->dev, "rss get rxnfc\n");
|
||||
|
||||
if (!(dev->features & NETIF_F_RXHASH))
|
||||
return ret;
|
||||
@@ -1,34 +0,0 @@
|
||||
--- a/src/r8125_n.c
|
||||
+++ b/src/r8125_n.c
|
||||
@@ -13628,6 +13628,23 @@ rtl8125_setup_mqs_reg(struct rtl8125_pri
|
||||
}
|
||||
|
||||
static int
|
||||
+rtl8125_devname_configuration(struct rtl8125_private *tp)
|
||||
+{
|
||||
+ const char *devname;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = of_property_read_string(tp->pci_dev->dev.of_node,
|
||||
+ "label", &devname);
|
||||
+
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ strlcpy(tp->dev->name, devname, IFNAMSIZ);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
rtl8125_led_configuration(struct rtl8125_private *tp)
|
||||
{
|
||||
u32 led_data;
|
||||
@@ -14278,6 +14295,7 @@ rtl8125_init_software_variable(struct ne
|
||||
else if (tp->InitRxDescType == RX_DESC_RING_TYPE_4)
|
||||
tp->rtl8125_rx_config &= ~EnableRxDescV4_1;
|
||||
|
||||
+ rtl8125_devname_configuration(tp);
|
||||
rtl8125_led_configuration(tp);
|
||||
|
||||
tp->NicCustLedValue = RTL_R16(tp, CustomLED);
|
||||
@@ -1,34 +0,0 @@
|
||||
#
|
||||
# Download realtek r8126 linux driver from official site:
|
||||
# [https://www.realtek.com/en/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:=r8126
|
||||
PKG_VERSION:=10.013.00
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/r8126
|
||||
TITLE:=Driver for Realtek r8126 chipsets
|
||||
SUBMENU:=Network Devices
|
||||
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
|
||||
DEPENDS:=@PCI_SUPPORT
|
||||
FILES:= $(PKG_BUILD_DIR)/r8126.ko
|
||||
AUTOLOAD:=$(call AutoProbe,r8126)
|
||||
endef
|
||||
|
||||
define Package/r8126/description
|
||||
This package contains a driver for Realtek r8126 chipsets.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(KERNEL_MAKE) M=$(PKG_BUILD_DIR) modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,r8126))
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -44,7 +44,7 @@ ENABLE_TX_NO_CLOSE = y
|
||||
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_WOL_SUPPORT = n
|
||||
@@ -1,209 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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_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
|
||||
ENABLE_TX_NO_CLOSE = y
|
||||
ENABLE_MULTIPLE_TX_QUEUE = y
|
||||
ENABLE_PTP_SUPPORT = n
|
||||
ENABLE_PTP_MASTER_MODE = n
|
||||
ENABLE_RSS_SUPPORT = n
|
||||
ENABLE_LIB_SUPPORT = n
|
||||
ENABLE_USE_FIRMWARE_FILE = n
|
||||
DISABLE_WOL_SUPPORT = n
|
||||
DISABLE_MULTI_MSIX_VECTOR = n
|
||||
ENABLE_DOUBLE_VLAN = n
|
||||
ENABLE_PAGE_REUSE = n
|
||||
ENABLE_RX_PACKET_FRAGMENT = n
|
||||
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
obj-m := r8126.o
|
||||
r8126-objs := r8126_n.o rtl_eeprom.o rtltool.o
|
||||
ifeq ($(CONFIG_SOC_LAN), y)
|
||||
EXTRA_CFLAGS += -DCONFIG_SOC_LAN
|
||||
endif
|
||||
ifeq ($(ENABLE_REALWOW_SUPPORT), y)
|
||||
r8126-objs += r8126_realwow.o
|
||||
EXTRA_CFLAGS += -DENABLE_REALWOW_SUPPORT
|
||||
endif
|
||||
ifeq ($(ENABLE_DASH_SUPPORT), y)
|
||||
r8126-objs += r8126_dash.o
|
||||
EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT
|
||||
endif
|
||||
ifeq ($(ENABLE_DASH_PRINTER_SUPPORT), y)
|
||||
r8126-objs += r8126_dash.o
|
||||
EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT -DENABLE_DASH_PRINTER_SUPPORT
|
||||
endif
|
||||
EXTRA_CFLAGS += -DCONFIG_R8126_NAPI
|
||||
EXTRA_CFLAGS += -DCONFIG_R8126_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
|
||||
ifeq ($(ENABLE_TX_NO_CLOSE), y)
|
||||
EXTRA_CFLAGS += -DENABLE_TX_NO_CLOSE
|
||||
endif
|
||||
ifeq ($(ENABLE_MULTIPLE_TX_QUEUE), y)
|
||||
EXTRA_CFLAGS += -DENABLE_MULTIPLE_TX_QUEUE
|
||||
endif
|
||||
ifeq ($(ENABLE_PTP_SUPPORT), y)
|
||||
r8126-objs += r8126_ptp.o
|
||||
EXTRA_CFLAGS += -DENABLE_PTP_SUPPORT
|
||||
endif
|
||||
ifeq ($(ENABLE_PTP_MASTER_MODE), y)
|
||||
EXTRA_CFLAGS += -DENABLE_PTP_MASTER_MODE
|
||||
endif
|
||||
ifeq ($(ENABLE_RSS_SUPPORT), y)
|
||||
r8126-objs += r8126_rss.o
|
||||
EXTRA_CFLAGS += -DENABLE_RSS_SUPPORT
|
||||
endif
|
||||
ifeq ($(ENABLE_LIB_SUPPORT), y)
|
||||
r8126-objs += r8126_lib.o
|
||||
EXTRA_CFLAGS += -DENABLE_LIB_SUPPORT
|
||||
endif
|
||||
ifeq ($(ENABLE_USE_FIRMWARE_FILE), y)
|
||||
r8126-objs += r8126_firmware.o
|
||||
EXTRA_CFLAGS += -DENABLE_USE_FIRMWARE_FILE
|
||||
endif
|
||||
ifeq ($(DISABLE_WOL_SUPPORT), y)
|
||||
EXTRA_CFLAGS += -DDISABLE_WOL_SUPPORT
|
||||
endif
|
||||
ifeq ($(DISABLE_MULTI_MSIX_VECTOR), y)
|
||||
EXTRA_CFLAGS += -DDISABLE_MULTI_MSIX_VECTOR
|
||||
endif
|
||||
ifeq ($(ENABLE_DOUBLE_VLAN), y)
|
||||
EXTRA_CFLAGS += -DENABLE_DOUBLE_VLAN
|
||||
endif
|
||||
ifeq ($(ENABLE_PAGE_REUSE), y)
|
||||
EXTRA_CFLAGS += -DENABLE_PAGE_REUSE
|
||||
endif
|
||||
ifeq ($(ENABLE_RX_PACKET_FRAGMENT), y)
|
||||
EXTRA_CFLAGS += -DENABLE_RX_PACKET_FRAGMENT
|
||||
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
|
||||
@@ -1,75 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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 := r8126_n.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 r8126.o
|
||||
strip --strip-debug r8126.o
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(MODCFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
rm *.o -f
|
||||
|
||||
install:
|
||||
install -m 744 -c r8126.o $(KMISC)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,261 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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_R8126_DASH_H
|
||||
#define _LINUX_R8126_DASH_H
|
||||
|
||||
#include <linux/if.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 rtl8126_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_R8126_DASH_H */
|
||||
@@ -1,264 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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/version.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/firmware.h>
|
||||
|
||||
#include "r8126_firmware.h"
|
||||
|
||||
enum rtl_fw_opcode {
|
||||
PHY_READ = 0x0,
|
||||
PHY_DATA_OR = 0x1,
|
||||
PHY_DATA_AND = 0x2,
|
||||
PHY_BJMPN = 0x3,
|
||||
PHY_MDIO_CHG = 0x4,
|
||||
PHY_CLEAR_READCOUNT = 0x7,
|
||||
PHY_WRITE = 0x8,
|
||||
PHY_READCOUNT_EQ_SKIP = 0x9,
|
||||
PHY_COMP_EQ_SKIPN = 0xa,
|
||||
PHY_COMP_NEQ_SKIPN = 0xb,
|
||||
PHY_WRITE_PREVIOUS = 0xc,
|
||||
PHY_SKIPN = 0xd,
|
||||
PHY_DELAY_MS = 0xe,
|
||||
};
|
||||
|
||||
struct fw_info {
|
||||
u32 magic;
|
||||
char version[RTL8126_VER_SIZE];
|
||||
__le32 fw_start;
|
||||
__le32 fw_len;
|
||||
u8 chksum;
|
||||
} __packed;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,16,0)
|
||||
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
|
||||
#endif
|
||||
#define FW_OPCODE_SIZE sizeof_field(struct rtl8126_fw_phy_action, code[0])
|
||||
|
||||
static bool rtl8126_fw_format_ok(struct rtl8126_fw *rtl_fw)
|
||||
{
|
||||
const struct firmware *fw = rtl_fw->fw;
|
||||
struct fw_info *fw_info = (struct fw_info *)fw->data;
|
||||
struct rtl8126_fw_phy_action *pa = &rtl_fw->phy_action;
|
||||
|
||||
if (fw->size < FW_OPCODE_SIZE)
|
||||
return false;
|
||||
|
||||
if (!fw_info->magic) {
|
||||
size_t i, size, start;
|
||||
u8 checksum = 0;
|
||||
|
||||
if (fw->size < sizeof(*fw_info))
|
||||
return false;
|
||||
|
||||
for (i = 0; i < fw->size; i++)
|
||||
checksum += fw->data[i];
|
||||
if (checksum != 0)
|
||||
return false;
|
||||
|
||||
start = le32_to_cpu(fw_info->fw_start);
|
||||
if (start > fw->size)
|
||||
return false;
|
||||
|
||||
size = le32_to_cpu(fw_info->fw_len);
|
||||
if (size > (fw->size - start) / FW_OPCODE_SIZE)
|
||||
return false;
|
||||
|
||||
strscpy(rtl_fw->version, fw_info->version, RTL8126_VER_SIZE);
|
||||
|
||||
pa->code = (__le32 *)(fw->data + start);
|
||||
pa->size = size;
|
||||
} else {
|
||||
if (fw->size % FW_OPCODE_SIZE)
|
||||
return false;
|
||||
|
||||
strscpy(rtl_fw->version, rtl_fw->fw_name, RTL8126_VER_SIZE);
|
||||
|
||||
pa->code = (__le32 *)fw->data;
|
||||
pa->size = fw->size / FW_OPCODE_SIZE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool rtl8126_fw_data_ok(struct rtl8126_fw *rtl_fw)
|
||||
{
|
||||
struct rtl8126_fw_phy_action *pa = &rtl_fw->phy_action;
|
||||
size_t index;
|
||||
|
||||
for (index = 0; index < pa->size; index++) {
|
||||
u32 action = le32_to_cpu(pa->code[index]);
|
||||
u32 val = action & 0x0000ffff;
|
||||
u32 regno = (action & 0x0fff0000) >> 16;
|
||||
|
||||
switch (action >> 28) {
|
||||
case PHY_READ:
|
||||
case PHY_DATA_OR:
|
||||
case PHY_DATA_AND:
|
||||
case PHY_CLEAR_READCOUNT:
|
||||
case PHY_WRITE:
|
||||
case PHY_WRITE_PREVIOUS:
|
||||
case PHY_DELAY_MS:
|
||||
break;
|
||||
|
||||
case PHY_MDIO_CHG:
|
||||
if (val > 1)
|
||||
goto out;
|
||||
break;
|
||||
|
||||
case PHY_BJMPN:
|
||||
if (regno > index)
|
||||
goto out;
|
||||
break;
|
||||
case PHY_READCOUNT_EQ_SKIP:
|
||||
if (index + 2 >= pa->size)
|
||||
goto out;
|
||||
break;
|
||||
case PHY_COMP_EQ_SKIPN:
|
||||
case PHY_COMP_NEQ_SKIPN:
|
||||
case PHY_SKIPN:
|
||||
if (index + 1 + regno >= pa->size)
|
||||
goto out;
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_err(rtl_fw->dev, "Invalid action 0x%08x\n", action);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
out:
|
||||
dev_err(rtl_fw->dev, "Out of range of firmware\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
void rtl8126_fw_write_firmware(struct rtl8126_private *tp, struct rtl8126_fw *rtl_fw)
|
||||
{
|
||||
struct rtl8126_fw_phy_action *pa = &rtl_fw->phy_action;
|
||||
rtl8126_fw_write_t fw_write = rtl_fw->phy_write;
|
||||
rtl8126_fw_read_t fw_read = rtl_fw->phy_read;
|
||||
int predata = 0, count = 0;
|
||||
size_t index;
|
||||
|
||||
for (index = 0; index < pa->size; index++) {
|
||||
u32 action = le32_to_cpu(pa->code[index]);
|
||||
u32 data = action & 0x0000ffff;
|
||||
u32 regno = (action & 0x0fff0000) >> 16;
|
||||
enum rtl_fw_opcode opcode = action >> 28;
|
||||
|
||||
if (!action)
|
||||
break;
|
||||
|
||||
switch (opcode) {
|
||||
case PHY_READ:
|
||||
predata = fw_read(tp, regno);
|
||||
count++;
|
||||
break;
|
||||
case PHY_DATA_OR:
|
||||
predata |= data;
|
||||
break;
|
||||
case PHY_DATA_AND:
|
||||
predata &= data;
|
||||
break;
|
||||
case PHY_BJMPN:
|
||||
index -= (regno + 1);
|
||||
break;
|
||||
case PHY_MDIO_CHG:
|
||||
if (data) {
|
||||
fw_write = rtl_fw->mac_mcu_write;
|
||||
fw_read = rtl_fw->mac_mcu_read;
|
||||
} else {
|
||||
fw_write = rtl_fw->phy_write;
|
||||
fw_read = rtl_fw->phy_read;
|
||||
}
|
||||
|
||||
break;
|
||||
case PHY_CLEAR_READCOUNT:
|
||||
count = 0;
|
||||
break;
|
||||
case PHY_WRITE:
|
||||
fw_write(tp, regno, data);
|
||||
break;
|
||||
case PHY_READCOUNT_EQ_SKIP:
|
||||
if (count == data)
|
||||
index++;
|
||||
break;
|
||||
case PHY_COMP_EQ_SKIPN:
|
||||
if (predata == data)
|
||||
index += regno;
|
||||
break;
|
||||
case PHY_COMP_NEQ_SKIPN:
|
||||
if (predata != data)
|
||||
index += regno;
|
||||
break;
|
||||
case PHY_WRITE_PREVIOUS:
|
||||
fw_write(tp, regno, predata);
|
||||
break;
|
||||
case PHY_SKIPN:
|
||||
index += regno;
|
||||
break;
|
||||
case PHY_DELAY_MS:
|
||||
mdelay(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rtl8126_fw_release_firmware(struct rtl8126_fw *rtl_fw)
|
||||
{
|
||||
release_firmware(rtl_fw->fw);
|
||||
}
|
||||
|
||||
int rtl8126_fw_request_firmware(struct rtl8126_fw *rtl_fw)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = request_firmware(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev);
|
||||
if (rc < 0)
|
||||
goto out;
|
||||
|
||||
if (!rtl8126_fw_format_ok(rtl_fw) || !rtl8126_fw_data_ok(rtl_fw)) {
|
||||
release_firmware(rtl_fw->fw);
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
return 0;
|
||||
out:
|
||||
dev_err(rtl_fw->dev, "Unable to load firmware %s (%d)\n",
|
||||
rtl_fw->fw_name, rc);
|
||||
return rc;
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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_R8126_FIRMWARE_H
|
||||
#define _LINUX_R8126_FIRMWARE_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/firmware.h>
|
||||
|
||||
struct rtl8126_private;
|
||||
typedef void (*rtl8126_fw_write_t)(struct rtl8126_private *tp, u16 reg, u16 val);
|
||||
typedef u32 (*rtl8126_fw_read_t)(struct rtl8126_private *tp, u16 reg);
|
||||
|
||||
#define RTL8126_VER_SIZE 32
|
||||
|
||||
struct rtl8126_fw {
|
||||
rtl8126_fw_write_t phy_write;
|
||||
rtl8126_fw_read_t phy_read;
|
||||
rtl8126_fw_write_t mac_mcu_write;
|
||||
rtl8126_fw_read_t mac_mcu_read;
|
||||
const struct firmware *fw;
|
||||
const char *fw_name;
|
||||
struct device *dev;
|
||||
|
||||
char version[RTL8126_VER_SIZE];
|
||||
|
||||
struct rtl8126_fw_phy_action {
|
||||
__le32 *code;
|
||||
size_t size;
|
||||
} phy_action;
|
||||
};
|
||||
|
||||
int rtl8126_fw_request_firmware(struct rtl8126_fw *rtl_fw);
|
||||
void rtl8126_fw_release_firmware(struct rtl8126_fw *rtl_fw);
|
||||
void rtl8126_fw_write_firmware(struct rtl8126_private *tp, struct rtl8126_fw *rtl_fw);
|
||||
|
||||
#endif /* _LINUX_R8126_FIRMWARE_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,619 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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/mii.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
||||
#include "r8126.h"
|
||||
#include "r8126_ptp.h"
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
|
||||
static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
|
||||
{
|
||||
return *(const struct timespec *)&ts64;
|
||||
}
|
||||
|
||||
static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
|
||||
{
|
||||
return *(const struct timespec64 *)&ts;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int _rtl8126_phc_gettime(struct rtl8126_private *tp, struct timespec64 *ts64)
|
||||
{
|
||||
//get local time
|
||||
RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_LATCHED_LOCAL_TIME | PTP_EXEC_CMD));
|
||||
|
||||
/* nanoseconds */
|
||||
//0x6808[29:0]
|
||||
ts64->tv_nsec = (RTL_R32(tp, PTP_SOFT_CONFIG_Time_NS_8125) & 0x3fffffff);
|
||||
|
||||
/* seconds */
|
||||
//0x680C[47:0]
|
||||
ts64->tv_sec = RTL_R16(tp, PTP_SOFT_CONFIG_Time_S_8125 + 4);
|
||||
ts64->tv_sec <<= 32;
|
||||
ts64->tv_sec |= RTL_R32(tp, PTP_SOFT_CONFIG_Time_S_8125);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _rtl8126_phc_settime(struct rtl8126_private *tp, const struct timespec64 *ts64)
|
||||
{
|
||||
/* nanoseconds */
|
||||
//0x6808[29:0]
|
||||
RTL_W32(tp, PTP_SOFT_CONFIG_Time_NS_8125, (ts64->tv_nsec & 0x3fffffff));
|
||||
|
||||
/* seconds */
|
||||
//0x680C[47:0]
|
||||
RTL_W32(tp, PTP_SOFT_CONFIG_Time_S_8125, ts64->tv_sec);
|
||||
RTL_W16(tp, PTP_SOFT_CONFIG_Time_S_8125 + 4, (ts64->tv_sec >> 32));
|
||||
|
||||
//set local time
|
||||
RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_SET_LOCAL_TIME | PTP_EXEC_CMD));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _rtl8126_phc_adjtime(struct rtl8126_private *tp, s64 delta)
|
||||
{
|
||||
struct timespec64 d;
|
||||
bool negative = false;
|
||||
u64 tohw;
|
||||
u32 nsec;
|
||||
u64 sec;
|
||||
|
||||
if (delta < 0) {
|
||||
negative = true;
|
||||
tohw = -delta;
|
||||
} else {
|
||||
tohw = delta;
|
||||
}
|
||||
|
||||
d = ns_to_timespec64(tohw);
|
||||
|
||||
nsec = d.tv_nsec;
|
||||
sec = d.tv_sec;
|
||||
|
||||
if (negative) {
|
||||
nsec = -nsec;
|
||||
sec = -sec;
|
||||
}
|
||||
|
||||
nsec &= 0x3fffffff;
|
||||
sec &= 0x0000ffffffffffff;
|
||||
|
||||
if (negative) {
|
||||
nsec |= PTP_SOFT_CONFIG_TIME_NS_NEGATIVE;
|
||||
sec |= PTP_SOFT_CONFIG_TIME_S_NEGATIVE;
|
||||
}
|
||||
|
||||
/* nanoseconds */
|
||||
//0x6808[29:0]
|
||||
RTL_W32(tp, PTP_SOFT_CONFIG_Time_NS_8125, nsec);
|
||||
|
||||
/* seconds */
|
||||
//0x680C[47:0]
|
||||
RTL_W32(tp, PTP_SOFT_CONFIG_Time_S_8125, sec);
|
||||
RTL_W16(tp, PTP_SOFT_CONFIG_Time_S_8125 + 4, (sec >> 32));
|
||||
|
||||
//adjust local time
|
||||
//RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_DRIFT_LOCAL_TIME | PTP_EXEC_CMD));
|
||||
RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_SET_LOCAL_TIME | PTP_EXEC_CMD));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8126_phc_adjtime(struct ptp_clock_info *ptp, s64 delta)
|
||||
{
|
||||
struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info);
|
||||
int ret;
|
||||
|
||||
//netif_info(tp, drv, tp->dev, "phc adjust time\n");
|
||||
|
||||
rtnl_lock();
|
||||
ret = _rtl8126_phc_adjtime(tp, delta);
|
||||
rtnl_unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0)
|
||||
/*
|
||||
1ppm means every 125MHz plus 125Hz. It also means every 8ns minus 8ns*10^(-6)
|
||||
|
||||
1ns=2^30 sub_ns
|
||||
|
||||
8ns*10^(-6) = 8 * 2^30 sub_ns * 10^(-6) = 2^33 sub_ns * 10^(-6) = 8590 = 0x218E sub_ns
|
||||
|
||||
1ppb means every 125MHz plus 0.125Hz. It also means every 8ns minus 8ns*10^(-9)
|
||||
|
||||
1ns=2^30 sub_ns
|
||||
|
||||
8ns*10^(-9) = 8 * 2^30 sub_ns * 10^(-9) = 2^33 sub_ns * 10^(-9) = 8.59 sub_ns = 9 sub_ns
|
||||
*/
|
||||
static int _rtl8126_phc_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
|
||||
{
|
||||
struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info);
|
||||
bool negative = false;
|
||||
u32 sub_ns;
|
||||
|
||||
if (ppb < 0) {
|
||||
negative = true;
|
||||
ppb = -ppb;
|
||||
}
|
||||
|
||||
sub_ns = ppb * 9;
|
||||
if (negative) {
|
||||
sub_ns = -sub_ns;
|
||||
sub_ns &= 0x3fffffff;
|
||||
sub_ns |= PTP_ADJUST_TIME_NS_NEGATIVE;
|
||||
} else
|
||||
sub_ns &= 0x3fffffff;
|
||||
|
||||
/* nanoseconds */
|
||||
//0x6808[29:0]
|
||||
RTL_W32(tp, PTP_SOFT_CONFIG_Time_NS_8125, sub_ns);
|
||||
|
||||
//adjust local time
|
||||
RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_DRIFT_LOCAL_TIME | PTP_EXEC_CMD));
|
||||
//RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_SET_LOCAL_TIME | PTP_EXEC_CMD));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8126_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta)
|
||||
{
|
||||
//struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info);
|
||||
|
||||
//netif_info(tp, drv, tp->dev, "phc adjust freq\n");
|
||||
|
||||
if (delta > ptp->max_adj || delta < -ptp->max_adj)
|
||||
return -EINVAL;
|
||||
|
||||
_rtl8126_phc_adjfreq(ptp, delta);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif //LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0)
|
||||
|
||||
static int rtl8126_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts64)
|
||||
{
|
||||
struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info);
|
||||
int ret;
|
||||
|
||||
//netif_info(tp, drv, tp->dev, "phc get ts\n");
|
||||
|
||||
rtnl_lock();
|
||||
ret = _rtl8126_phc_gettime(tp, ts64);
|
||||
rtnl_unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rtl8126_phc_settime(struct ptp_clock_info *ptp,
|
||||
const struct timespec64 *ts64)
|
||||
{
|
||||
struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info);
|
||||
int ret;
|
||||
|
||||
//netif_info(tp, drv, tp->dev, "phc set ts\n");
|
||||
|
||||
rtnl_lock();
|
||||
ret = _rtl8126_phc_settime(tp, ts64);
|
||||
rtnl_unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rtl8126_phc_enable(struct ptp_clock_info *ptp,
|
||||
struct ptp_clock_request *rq, int on)
|
||||
{
|
||||
struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info);
|
||||
u16 ptp_ctrl;
|
||||
|
||||
//netif_info(tp, drv, tp->dev, "phc enable type %x on %d\n", rq->type, on);
|
||||
|
||||
switch (rq->type) {
|
||||
case PTP_CLK_REQ_PPS:
|
||||
rtnl_lock();
|
||||
ptp_ctrl = RTL_R16(tp, PTP_CTRL_8125);
|
||||
ptp_ctrl &= ~BIT_15;
|
||||
if (on)
|
||||
ptp_ctrl |= BIT_14;
|
||||
else
|
||||
ptp_ctrl &= ~BIT_14;
|
||||
RTL_W16(tp, PTP_CTRL_8125, ptp_ctrl);
|
||||
rtnl_unlock();
|
||||
return 0;
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
}
|
||||
|
||||
int rtl8126_get_ts_info(struct net_device *netdev,
|
||||
struct ethtool_ts_info *info)
|
||||
{
|
||||
struct rtl8126_private *tp = netdev_priv(netdev);
|
||||
|
||||
/* we always support timestamping disabled */
|
||||
info->rx_filters = BIT(HWTSTAMP_FILTER_NONE);
|
||||
|
||||
if (tp->HwSuppPtpVer == 0)
|
||||
return ethtool_op_get_ts_info(netdev, info);
|
||||
|
||||
info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
|
||||
SOF_TIMESTAMPING_RX_SOFTWARE |
|
||||
SOF_TIMESTAMPING_SOFTWARE |
|
||||
SOF_TIMESTAMPING_TX_HARDWARE |
|
||||
SOF_TIMESTAMPING_RX_HARDWARE |
|
||||
SOF_TIMESTAMPING_RAW_HARDWARE;
|
||||
|
||||
if (tp->ptp_clock)
|
||||
info->phc_index = ptp_clock_index(tp->ptp_clock);
|
||||
else
|
||||
info->phc_index = -1;
|
||||
|
||||
info->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON);
|
||||
|
||||
info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_EVENT) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_L4_EVENT) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_SYNC) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_L4_SYNC) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_DELAY_REQ) |
|
||||
BIT(HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ptp_clock_info rtl_ptp_clock_info = {
|
||||
.owner = THIS_MODULE,
|
||||
.n_alarm = 0,
|
||||
.n_ext_ts = 0,
|
||||
.n_per_out = 0,
|
||||
.n_pins = 0,
|
||||
.pps = 1,
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0)
|
||||
.adjfreq = rtl8126_phc_adjfreq,
|
||||
#endif //LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0)
|
||||
.adjtime = rtl8126_phc_adjtime,
|
||||
.gettime64 = rtl8126_phc_gettime,
|
||||
.settime64 = rtl8126_phc_settime,
|
||||
.enable = rtl8126_phc_enable,
|
||||
};
|
||||
|
||||
static int rtl8126_ptp_egresstime(struct rtl8126_private *tp, struct timespec64 *ts64, u32 regnum)
|
||||
{
|
||||
/* nanoseconds */
|
||||
//[29:0]
|
||||
ts64->tv_nsec = rtl8126_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_NS_8125 + regnum * 16 + 2);
|
||||
ts64->tv_nsec <<= 16;
|
||||
ts64->tv_nsec |= rtl8126_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_NS_8125 + regnum * 16);
|
||||
ts64->tv_nsec &= 0x3fffffff;
|
||||
|
||||
/* seconds */
|
||||
//[47:0]
|
||||
ts64->tv_sec = rtl8126_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_S_8125 + regnum * 16 + 4);
|
||||
ts64->tv_sec <<= 16;
|
||||
ts64->tv_sec |= rtl8126_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_S_8125 + regnum * 16 + 2);
|
||||
ts64->tv_sec <<= 16;
|
||||
ts64->tv_sec |= rtl8126_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_S_8125 + regnum * 16);
|
||||
ts64->tv_sec &= 0x0000ffffffffffff;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rtl8126_ptp_tx_hwtstamp(struct rtl8126_private *tp)
|
||||
{
|
||||
struct sk_buff *skb = tp->ptp_tx_skb;
|
||||
struct skb_shared_hwtstamps shhwtstamps = {0};
|
||||
struct timespec64 ts64;
|
||||
u32 regnum;
|
||||
|
||||
RTL_W8(tp, PTP_ISR_8125, PTP_ISR_TOK | PTP_ISR_TER);
|
||||
|
||||
//IO 0x2302 bit 10~11 WR_PTR
|
||||
regnum = RTL_R16(tp, 0x2032) & 0x0C00;
|
||||
regnum >>= 10;
|
||||
regnum = (regnum + 3) % 4;
|
||||
|
||||
rtnl_lock();
|
||||
rtl8126_ptp_egresstime(tp, &ts64, regnum);
|
||||
rtnl_unlock();
|
||||
|
||||
/* Upper 32 bits contain s, lower 32 bits contain ns. */
|
||||
shhwtstamps.hwtstamp = ktime_set(ts64.tv_sec,
|
||||
ts64.tv_nsec);
|
||||
|
||||
/* Clear the lock early before calling skb_tstamp_tx so that
|
||||
* applications are not woken up before the lock bit is clear. We use
|
||||
* a copy of the skb pointer to ensure other threads can't change it
|
||||
* while we're notifying the stack.
|
||||
*/
|
||||
tp->ptp_tx_skb = NULL;
|
||||
clear_bit_unlock(__RTL8126_PTP_TX_IN_PROGRESS, &tp->state);
|
||||
|
||||
/* Notify the stack and free the skb after we've unlocked */
|
||||
skb_tstamp_tx(skb, &shhwtstamps);
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
|
||||
#define RTL8126_PTP_TX_TIMEOUT (HZ * 15)
|
||||
static void rtl8126_ptp_tx_work(struct work_struct *work)
|
||||
{
|
||||
struct rtl8126_private *tp = container_of(work, struct rtl8126_private,
|
||||
ptp_tx_work);
|
||||
|
||||
if (!tp->ptp_tx_skb)
|
||||
return;
|
||||
|
||||
if (time_is_before_jiffies(tp->ptp_tx_start +
|
||||
RTL8126_PTP_TX_TIMEOUT)) {
|
||||
dev_kfree_skb_any(tp->ptp_tx_skb);
|
||||
tp->ptp_tx_skb = NULL;
|
||||
clear_bit_unlock(__RTL8126_PTP_TX_IN_PROGRESS, &tp->state);
|
||||
tp->tx_hwtstamp_timeouts++;
|
||||
/* Clear the tx valid bit in TSYNCTXCTL register to enable
|
||||
* interrupt
|
||||
*/
|
||||
RTL_W8(tp, PTP_ISR_8125, PTP_ISR_TOK | PTP_ISR_TER);
|
||||
return;
|
||||
}
|
||||
|
||||
if (RTL_R8(tp, PTP_ISR_8125) & (PTP_ISR_TOK))
|
||||
rtl8126_ptp_tx_hwtstamp(tp);
|
||||
else
|
||||
/* reschedule to check later */
|
||||
schedule_work(&tp->ptp_tx_work);
|
||||
|
||||
}
|
||||
|
||||
static int rtl8126_hwtstamp_enable(struct rtl8126_private *tp, bool enable)
|
||||
{
|
||||
RTL_W16(tp, PTP_CTRL_8125, 0);
|
||||
if (enable) {
|
||||
u16 ptp_ctrl;
|
||||
struct timespec64 ts64;
|
||||
|
||||
//clear ptp isr
|
||||
RTL_W8(tp, PTP_ISR_8125, 0xff);
|
||||
//ptp source 0:gphy 1:mac
|
||||
rtl8126_mac_ocp_write(tp, 0xDC00, rtl8126_mac_ocp_read(tp, 0xDC00) | BIT_6);
|
||||
//enable ptp
|
||||
ptp_ctrl = (BIT_0 | BIT_3 | BIT_4 | BIT_6 | BIT_10 | BIT_12);
|
||||
if (tp->ptp_master_mode)
|
||||
ptp_ctrl |= BIT_1;
|
||||
RTL_W16(tp, PTP_CTRL_8125, ptp_ctrl);
|
||||
|
||||
//set system time
|
||||
/*
|
||||
if (ktime_to_timespec64_cond(ktime_get_real(), &ts64))
|
||||
_rtl8126_phc_settime(tp, timespec64_to_timespec(ts64));
|
||||
*/
|
||||
ktime_get_real_ts64(&ts64);
|
||||
_rtl8126_phc_settime(tp, &ts64);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long rtl8126_ptp_create_clock(struct rtl8126_private *tp)
|
||||
{
|
||||
struct net_device *netdev = tp->dev;
|
||||
long err;
|
||||
|
||||
if (!IS_ERR_OR_NULL(tp->ptp_clock))
|
||||
return 0;
|
||||
|
||||
if (tp->HwSuppPtpVer == 0) {
|
||||
tp->ptp_clock = NULL;
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
tp->ptp_clock_info = rtl_ptp_clock_info;
|
||||
snprintf(tp->ptp_clock_info.name, sizeof(tp->ptp_clock_info.name),
|
||||
"%pm", tp->dev->dev_addr);
|
||||
tp->ptp_clock_info.max_adj = 119304647;
|
||||
tp->ptp_clock = ptp_clock_register(&tp->ptp_clock_info, &tp->pci_dev->dev);
|
||||
if (IS_ERR(tp->ptp_clock)) {
|
||||
err = PTR_ERR(tp->ptp_clock);
|
||||
tp->ptp_clock = NULL;
|
||||
netif_err(tp, drv, tp->dev, "ptp_clock_register failed\n");
|
||||
return err;
|
||||
} else
|
||||
netif_info(tp, drv, tp->dev, "registered PHC device on %s\n", netdev->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rtl8126_ptp_reset(struct rtl8126_private *tp)
|
||||
{
|
||||
if (!tp->ptp_clock)
|
||||
return;
|
||||
|
||||
netif_info(tp, drv, tp->dev, "reset PHC clock\n");
|
||||
|
||||
rtl8126_hwtstamp_enable(tp, false);
|
||||
}
|
||||
|
||||
void rtl8126_ptp_init(struct rtl8126_private *tp)
|
||||
{
|
||||
/* obtain a PTP device, or re-use an existing device */
|
||||
if (rtl8126_ptp_create_clock(tp))
|
||||
return;
|
||||
|
||||
/* we have a clock so we can initialize work now */
|
||||
INIT_WORK(&tp->ptp_tx_work, rtl8126_ptp_tx_work);
|
||||
|
||||
/* reset the PTP related hardware bits */
|
||||
rtl8126_ptp_reset(tp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void rtl8126_ptp_suspend(struct rtl8126_private *tp)
|
||||
{
|
||||
if (!tp->ptp_clock)
|
||||
return;
|
||||
|
||||
netif_info(tp, drv, tp->dev, "suspend PHC clock\n");
|
||||
|
||||
rtl8126_hwtstamp_enable(tp, false);
|
||||
|
||||
/* ensure that we cancel any pending PTP Tx work item in progress */
|
||||
cancel_work_sync(&tp->ptp_tx_work);
|
||||
}
|
||||
|
||||
void rtl8126_ptp_stop(struct rtl8126_private *tp)
|
||||
{
|
||||
struct net_device *netdev = tp->dev;
|
||||
|
||||
netif_info(tp, drv, tp->dev, "stop PHC clock\n");
|
||||
|
||||
/* first, suspend PTP activity */
|
||||
rtl8126_ptp_suspend(tp);
|
||||
|
||||
/* disable the PTP clock device */
|
||||
if (tp->ptp_clock) {
|
||||
ptp_clock_unregister(tp->ptp_clock);
|
||||
tp->ptp_clock = NULL;
|
||||
netif_info(tp, drv, tp->dev, "removed PHC on %s\n",
|
||||
netdev->name);
|
||||
}
|
||||
}
|
||||
|
||||
static int rtl8126_set_tstamp(struct net_device *netdev, struct ifreq *ifr)
|
||||
{
|
||||
struct rtl8126_private *tp = netdev_priv(netdev);
|
||||
struct hwtstamp_config config;
|
||||
bool hwtstamp = 0;
|
||||
|
||||
//netif_info(tp, drv, tp->dev, "ptp set ts\n");
|
||||
|
||||
if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
|
||||
return -EFAULT;
|
||||
|
||||
if (config.flags)
|
||||
return -EINVAL;
|
||||
|
||||
switch (config.tx_type) {
|
||||
case HWTSTAMP_TX_ON:
|
||||
hwtstamp = 1;
|
||||
case HWTSTAMP_TX_OFF:
|
||||
break;
|
||||
case HWTSTAMP_TX_ONESTEP_SYNC:
|
||||
default:
|
||||
return -ERANGE;
|
||||
}
|
||||
|
||||
switch (config.rx_filter) {
|
||||
case HWTSTAMP_FILTER_PTP_V2_EVENT:
|
||||
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
|
||||
case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
|
||||
case HWTSTAMP_FILTER_PTP_V2_SYNC:
|
||||
case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
|
||||
case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
|
||||
case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
|
||||
case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
|
||||
case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
|
||||
config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
|
||||
hwtstamp = 1;
|
||||
case HWTSTAMP_FILTER_NONE:
|
||||
break;
|
||||
default:
|
||||
return -ERANGE;
|
||||
}
|
||||
|
||||
if (tp->hwtstamp_config.tx_type != config.tx_type ||
|
||||
tp->hwtstamp_config.rx_filter != config.rx_filter) {
|
||||
tp->hwtstamp_config = config;
|
||||
rtl8126_hwtstamp_enable(tp, hwtstamp);
|
||||
}
|
||||
|
||||
return copy_to_user(ifr->ifr_data, &config,
|
||||
sizeof(config)) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
static int rtl8126_get_tstamp(struct net_device *netdev, struct ifreq *ifr)
|
||||
{
|
||||
struct rtl8126_private *tp = netdev_priv(netdev);
|
||||
|
||||
//netif_info(tp, drv, tp->dev, "ptp get ts\n");
|
||||
|
||||
return copy_to_user(ifr->ifr_data, &tp->hwtstamp_config,
|
||||
sizeof(tp->hwtstamp_config)) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
int rtl8126_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
//netif_info(tp, drv, tp->dev, "ptp ioctl\n");
|
||||
|
||||
switch (cmd) {
|
||||
#ifdef ENABLE_PTP_SUPPORT
|
||||
case SIOCSHWTSTAMP:
|
||||
ret = rtl8126_set_tstamp(netdev, ifr);
|
||||
break;
|
||||
case SIOCGHWTSTAMP:
|
||||
ret = rtl8126_get_tstamp(netdev, ifr);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ret = -EOPNOTSUPP;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void rtl8126_rx_ptp_pktstamp(struct rtl8126_private *tp, struct sk_buff *skb,
|
||||
struct RxDescV3 *descv3)
|
||||
{
|
||||
time64_t tv_sec;
|
||||
long tv_nsec;
|
||||
|
||||
tv_sec = le32_to_cpu(descv3->RxDescTimeStamp.TimeStampHigh) +
|
||||
((u64)le32_to_cpu(descv3->RxDescPTPDDWord4.TimeStampHHigh) << 32);
|
||||
tv_nsec = le32_to_cpu(descv3->RxDescTimeStamp.TimeStampLow);
|
||||
|
||||
skb_hwtstamps(skb)->hwtstamp = ktime_set(tv_sec, tv_nsec);
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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_R8126_PTP_H
|
||||
#define _LINUX_R8126_PTP_H
|
||||
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/timecounter.h>
|
||||
#include <linux/net_tstamp.h>
|
||||
#include <linux/ptp_clock_kernel.h>
|
||||
#include <linux/ptp_classify.h>
|
||||
|
||||
struct rtl8126_ptp_info {
|
||||
s64 time_sec;
|
||||
u32 time_ns;
|
||||
u16 ts_info;
|
||||
};
|
||||
|
||||
#ifndef _STRUCT_TIMESPEC
|
||||
#define _STRUCT_TIMESPEC
|
||||
struct timespec {
|
||||
__kernel_old_time_t tv_sec; /* seconds */
|
||||
long tv_nsec; /* nanoseconds */
|
||||
};
|
||||
#endif
|
||||
|
||||
enum PTP_CMD_TYPE {
|
||||
PTP_CMD_SET_LOCAL_TIME = 0,
|
||||
PTP_CMD_DRIFT_LOCAL_TIME,
|
||||
PTP_CMD_LATCHED_LOCAL_TIME,
|
||||
};
|
||||
|
||||
|
||||
struct rtl8126_private;
|
||||
struct RxDescV3;
|
||||
|
||||
int rtl8126_get_ts_info(struct net_device *netdev,
|
||||
struct ethtool_ts_info *info);
|
||||
|
||||
void rtl8126_ptp_reset(struct rtl8126_private *tp);
|
||||
void rtl8126_ptp_init(struct rtl8126_private *tp);
|
||||
void rtl8126_ptp_suspend(struct rtl8126_private *tp);
|
||||
void rtl8126_ptp_stop(struct rtl8126_private *tp);
|
||||
|
||||
int rtl8126_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
|
||||
|
||||
void rtl8126_rx_ptp_pktstamp(struct rtl8126_private *tp, struct sk_buff *skb,
|
||||
struct RxDescV3 *descv3);
|
||||
|
||||
#endif /* _LINUX_R8126_PTP_H */
|
||||
@@ -1,118 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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_R8126_REALWOW_H
|
||||
#define _LINUX_R8126_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 rtl8126_realwow_ioctl(struct net_device *dev, struct ifreq *ifr);
|
||||
void rtl8126_realwow_hw_init(struct net_device *dev);
|
||||
void rtl8126_get_realwow_hw_version(struct net_device *dev);
|
||||
void rtl8126_set_realwow_d3_para(struct net_device *dev);
|
||||
|
||||
#endif /* _LINUX_R8126_REALWOW_H */
|
||||
@@ -1,491 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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/version.h>
|
||||
#include "r8126.h"
|
||||
|
||||
enum rtl8126_rss_register_content {
|
||||
/* RSS */
|
||||
RSS_CTRL_TCP_IPV4_SUPP = (1 << 0),
|
||||
RSS_CTRL_IPV4_SUPP = (1 << 1),
|
||||
RSS_CTRL_TCP_IPV6_SUPP = (1 << 2),
|
||||
RSS_CTRL_IPV6_SUPP = (1 << 3),
|
||||
RSS_CTRL_IPV6_EXT_SUPP = (1 << 4),
|
||||
RSS_CTRL_TCP_IPV6_EXT_SUPP = (1 << 5),
|
||||
RSS_HALF_SUPP = (1 << 7),
|
||||
RSS_CTRL_UDP_IPV4_SUPP = (1 << 11),
|
||||
RSS_CTRL_UDP_IPV6_SUPP = (1 << 12),
|
||||
RSS_CTRL_UDP_IPV6_EXT_SUPP = (1 << 13),
|
||||
RSS_QUAD_CPU_EN = (1 << 16),
|
||||
RSS_HQ_Q_SUP_R = (1 << 31),
|
||||
};
|
||||
|
||||
static int rtl8126_get_rss_hash_opts(struct rtl8126_private *tp,
|
||||
struct ethtool_rxnfc *cmd)
|
||||
{
|
||||
cmd->data = 0;
|
||||
|
||||
/* Report default options for RSS */
|
||||
switch (cmd->flow_type) {
|
||||
case TCP_V4_FLOW:
|
||||
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case UDP_V4_FLOW:
|
||||
if (tp->rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV4)
|
||||
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case IPV4_FLOW:
|
||||
cmd->data |= RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
case TCP_V6_FLOW:
|
||||
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case UDP_V6_FLOW:
|
||||
if (tp->rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV6)
|
||||
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
|
||||
fallthrough;
|
||||
case IPV6_FLOW:
|
||||
cmd->data |= RXH_IP_SRC | RXH_IP_DST;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rtl8126_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
u32 *rule_locs)
|
||||
{
|
||||
struct rtl8126_private *tp = netdev_priv(dev);
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
netif_info(tp, drv, tp->dev, "rss get rxnfc\n");
|
||||
|
||||
if (!(dev->features & NETIF_F_RXHASH))
|
||||
return ret;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_GRXRINGS:
|
||||
cmd->data = rtl8126_tot_rx_rings(tp);
|
||||
ret = 0;
|
||||
break;
|
||||
case ETHTOOL_GRXFH:
|
||||
ret = rtl8126_get_rss_hash_opts(tp, cmd);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 rtl8126_rss_indir_tbl_entries(struct rtl8126_private *tp)
|
||||
{
|
||||
return tp->HwSuppIndirTblEntries;
|
||||
}
|
||||
|
||||
#define RSS_MASK_BITS_OFFSET (8)
|
||||
#define RSS_CPU_NUM_OFFSET (16)
|
||||
#define RTL8126_UDP_RSS_FLAGS (RTL_8125_RSS_FLAG_HASH_UDP_IPV4 | \
|
||||
RTL_8125_RSS_FLAG_HASH_UDP_IPV6)
|
||||
static int _rtl8126_set_rss_hash_opt(struct rtl8126_private *tp)
|
||||
{
|
||||
u32 rss_flags = tp->rss_flags;
|
||||
u32 hash_mask_len;
|
||||
u32 rss_ctrl;
|
||||
|
||||
rss_ctrl = ilog2(rtl8126_tot_rx_rings(tp));
|
||||
rss_ctrl &= (BIT_0 | BIT_1 | BIT_2);
|
||||
rss_ctrl <<= RSS_CPU_NUM_OFFSET;
|
||||
|
||||
/* Perform hash on these packet types */
|
||||
rss_ctrl |= RSS_CTRL_TCP_IPV4_SUPP
|
||||
| RSS_CTRL_IPV4_SUPP
|
||||
| RSS_CTRL_IPV6_SUPP
|
||||
| RSS_CTRL_IPV6_EXT_SUPP
|
||||
| RSS_CTRL_TCP_IPV6_SUPP
|
||||
| RSS_CTRL_TCP_IPV6_EXT_SUPP;
|
||||
|
||||
if (rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV4)
|
||||
rss_ctrl |= RSS_CTRL_UDP_IPV4_SUPP;
|
||||
|
||||
if (rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV6)
|
||||
rss_ctrl |= RSS_CTRL_UDP_IPV6_SUPP |
|
||||
RSS_CTRL_UDP_IPV6_EXT_SUPP;
|
||||
|
||||
hash_mask_len = ilog2(rtl8126_rss_indir_tbl_entries(tp));
|
||||
hash_mask_len &= (BIT_0 | BIT_1 | BIT_2);
|
||||
rss_ctrl |= hash_mask_len << RSS_MASK_BITS_OFFSET;
|
||||
|
||||
RTL_W32(tp, RSS_CTRL_8125, rss_ctrl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8126_set_rss_hash_opt(struct rtl8126_private *tp,
|
||||
struct ethtool_rxnfc *nfc)
|
||||
{
|
||||
u32 rss_flags = tp->rss_flags;
|
||||
|
||||
netif_info(tp, drv, tp->dev, "rss set hash\n");
|
||||
|
||||
/*
|
||||
* RSS does not support anything other than hashing
|
||||
* to queues on src and dst IPs and ports
|
||||
*/
|
||||
if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST |
|
||||
RXH_L4_B_0_1 | RXH_L4_B_2_3))
|
||||
return -EINVAL;
|
||||
|
||||
switch (nfc->flow_type) {
|
||||
case TCP_V4_FLOW:
|
||||
case TCP_V6_FLOW:
|
||||
if (!(nfc->data & RXH_IP_SRC) ||
|
||||
!(nfc->data & RXH_IP_DST) ||
|
||||
!(nfc->data & RXH_L4_B_0_1) ||
|
||||
!(nfc->data & RXH_L4_B_2_3))
|
||||
return -EINVAL;
|
||||
break;
|
||||
case UDP_V4_FLOW:
|
||||
if (!(nfc->data & RXH_IP_SRC) ||
|
||||
!(nfc->data & RXH_IP_DST))
|
||||
return -EINVAL;
|
||||
switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) {
|
||||
case 0:
|
||||
rss_flags &= ~RTL_8125_RSS_FLAG_HASH_UDP_IPV4;
|
||||
break;
|
||||
case (RXH_L4_B_0_1 | RXH_L4_B_2_3):
|
||||
rss_flags |= RTL_8125_RSS_FLAG_HASH_UDP_IPV4;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
case UDP_V6_FLOW:
|
||||
if (!(nfc->data & RXH_IP_SRC) ||
|
||||
!(nfc->data & RXH_IP_DST))
|
||||
return -EINVAL;
|
||||
switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) {
|
||||
case 0:
|
||||
rss_flags &= ~RTL_8125_RSS_FLAG_HASH_UDP_IPV6;
|
||||
break;
|
||||
case (RXH_L4_B_0_1 | RXH_L4_B_2_3):
|
||||
rss_flags |= RTL_8125_RSS_FLAG_HASH_UDP_IPV6;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
case SCTP_V4_FLOW:
|
||||
case AH_ESP_V4_FLOW:
|
||||
case AH_V4_FLOW:
|
||||
case ESP_V4_FLOW:
|
||||
case SCTP_V6_FLOW:
|
||||
case AH_ESP_V6_FLOW:
|
||||
case AH_V6_FLOW:
|
||||
case ESP_V6_FLOW:
|
||||
case IP_USER_FLOW:
|
||||
case ETHER_FLOW:
|
||||
/* RSS is not supported for these protocols */
|
||||
if (nfc->data) {
|
||||
netif_err(tp, drv, tp->dev, "Command parameters not supported\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* if we changed something we need to update flags */
|
||||
if (rss_flags != tp->rss_flags) {
|
||||
u32 rss_ctrl = RTL_R32(tp, RSS_CTRL_8125);
|
||||
|
||||
if ((rss_flags & RTL8126_UDP_RSS_FLAGS) &&
|
||||
!(tp->rss_flags & RTL8126_UDP_RSS_FLAGS))
|
||||
netdev_warn(tp->dev,
|
||||
"enabling UDP RSS: fragmented packets may "
|
||||
"arrive out of order to the stack above\n");
|
||||
|
||||
tp->rss_flags = rss_flags;
|
||||
|
||||
/* Perform hash on these packet types */
|
||||
rss_ctrl |= RSS_CTRL_TCP_IPV4_SUPP
|
||||
| RSS_CTRL_IPV4_SUPP
|
||||
| RSS_CTRL_IPV6_SUPP
|
||||
| RSS_CTRL_IPV6_EXT_SUPP
|
||||
| RSS_CTRL_TCP_IPV6_SUPP
|
||||
| RSS_CTRL_TCP_IPV6_EXT_SUPP;
|
||||
|
||||
rss_ctrl &= ~(RSS_CTRL_UDP_IPV4_SUPP |
|
||||
RSS_CTRL_UDP_IPV6_SUPP |
|
||||
RSS_CTRL_UDP_IPV6_EXT_SUPP);
|
||||
|
||||
if (rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV4)
|
||||
rss_ctrl |= RSS_CTRL_UDP_IPV4_SUPP;
|
||||
|
||||
if (rss_flags & RTL_8125_RSS_FLAG_HASH_UDP_IPV6)
|
||||
rss_ctrl |= RSS_CTRL_UDP_IPV6_SUPP |
|
||||
RSS_CTRL_UDP_IPV6_EXT_SUPP;
|
||||
|
||||
RTL_W32(tp, RSS_CTRL_8125, rss_ctrl);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rtl8126_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
|
||||
{
|
||||
struct rtl8126_private *tp = netdev_priv(dev);
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
netif_info(tp, drv, tp->dev, "rss set rxnfc\n");
|
||||
|
||||
if (!(dev->features & NETIF_F_RXHASH))
|
||||
return ret;
|
||||
|
||||
switch (cmd->cmd) {
|
||||
case ETHTOOL_SRXFH:
|
||||
ret = rtl8126_set_rss_hash_opt(tp, cmd);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u32 _rtl8126_get_rxfh_key_size(struct rtl8126_private *tp)
|
||||
{
|
||||
return sizeof(tp->rss_key);
|
||||
}
|
||||
|
||||
u32 rtl8126_get_rxfh_key_size(struct net_device *dev)
|
||||
{
|
||||
struct rtl8126_private *tp = netdev_priv(dev);
|
||||
|
||||
netif_info(tp, drv, tp->dev, "rss get key size\n");
|
||||
|
||||
if (!(dev->features & NETIF_F_RXHASH))
|
||||
return 0;
|
||||
|
||||
return _rtl8126_get_rxfh_key_size(tp);
|
||||
}
|
||||
|
||||
u32 rtl8126_rss_indir_size(struct net_device *dev)
|
||||
{
|
||||
struct rtl8126_private *tp = netdev_priv(dev);
|
||||
|
||||
netif_info(tp, drv, tp->dev, "rss get indir tbl size\n");
|
||||
|
||||
if (!(dev->features & NETIF_F_RXHASH))
|
||||
return 0;
|
||||
|
||||
return rtl8126_rss_indir_tbl_entries(tp);
|
||||
}
|
||||
|
||||
static void rtl8126_get_reta(struct rtl8126_private *tp, u32 *indir)
|
||||
{
|
||||
int i, reta_size = rtl8126_rss_indir_tbl_entries(tp);
|
||||
|
||||
for (i = 0; i < reta_size; i++)
|
||||
indir[i] = tp->rss_indir_tbl[i];
|
||||
}
|
||||
|
||||
int rtl8126_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
|
||||
u8 *hfunc)
|
||||
{
|
||||
struct rtl8126_private *tp = netdev_priv(dev);
|
||||
|
||||
netif_info(tp, drv, tp->dev, "rss get rxfh\n");
|
||||
|
||||
if (!(dev->features & NETIF_F_RXHASH))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (hfunc)
|
||||
*hfunc = ETH_RSS_HASH_TOP;
|
||||
|
||||
if (indir)
|
||||
rtl8126_get_reta(tp, indir);
|
||||
|
||||
if (key)
|
||||
memcpy(key, tp->rss_key, RTL8126_RSS_KEY_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 rtl8126_rss_key_reg(struct rtl8126_private *tp)
|
||||
{
|
||||
return RSS_KEY_8125;
|
||||
}
|
||||
|
||||
static u32 rtl8126_rss_indir_tbl_reg(struct rtl8126_private *tp)
|
||||
{
|
||||
return RSS_INDIRECTION_TBL_8125_V2;
|
||||
}
|
||||
|
||||
static void rtl8126_store_reta(struct rtl8126_private *tp)
|
||||
{
|
||||
u16 indir_tbl_reg = rtl8126_rss_indir_tbl_reg(tp);
|
||||
u32 i, reta_entries = rtl8126_rss_indir_tbl_entries(tp);
|
||||
u32 reta = 0;
|
||||
u8 *indir_tbl = tp->rss_indir_tbl;
|
||||
|
||||
/* Write redirection table to HW */
|
||||
for (i = 0; i < reta_entries; i++) {
|
||||
reta |= indir_tbl[i] << (i & 0x3) * 8;
|
||||
if ((i & 3) == 3) {
|
||||
RTL_W32(tp, indir_tbl_reg, reta);
|
||||
|
||||
indir_tbl_reg += 4;
|
||||
reta = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rtl8126_store_rss_key(struct rtl8126_private *tp)
|
||||
{
|
||||
const u16 rss_key_reg = rtl8126_rss_key_reg(tp);
|
||||
u32 i, rss_key_size = _rtl8126_get_rxfh_key_size(tp);
|
||||
u32 *rss_key = (u32*)tp->rss_key;
|
||||
|
||||
/* Write redirection table to HW */
|
||||
for (i = 0; i < rss_key_size; i+=4)
|
||||
RTL_W32(tp, rss_key_reg + i, *rss_key++);
|
||||
}
|
||||
|
||||
int rtl8126_set_rxfh(struct net_device *dev, const u32 *indir,
|
||||
const u8 *key, const u8 hfunc)
|
||||
{
|
||||
struct rtl8126_private *tp = netdev_priv(dev);
|
||||
int i;
|
||||
u32 reta_entries = rtl8126_rss_indir_tbl_entries(tp);
|
||||
|
||||
netif_info(tp, drv, tp->dev, "rss set rxfh\n");
|
||||
|
||||
/* We require at least one supported parameter to be changed and no
|
||||
* change in any of the unsupported parameters
|
||||
*/
|
||||
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
/* Fill out the redirection table */
|
||||
if (indir) {
|
||||
int max_queues = tp->num_rx_rings;
|
||||
|
||||
/* Verify user input. */
|
||||
for (i = 0; i < reta_entries; i++)
|
||||
if (indir[i] >= max_queues)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < reta_entries; i++)
|
||||
tp->rss_indir_tbl[i] = indir[i];
|
||||
}
|
||||
|
||||
/* Fill out the rss hash key */
|
||||
if (key)
|
||||
memcpy(tp->rss_key, key, RTL8126_RSS_KEY_SIZE);
|
||||
|
||||
rtl8126_store_reta(tp);
|
||||
|
||||
rtl8126_store_rss_key(tp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 rtl8126_get_rx_desc_hash(struct rtl8126_private *tp,
|
||||
struct RxDescV3 *descv3)
|
||||
{
|
||||
return le32_to_cpu(descv3->RxDescNormalDDWord2.RSSResult);
|
||||
}
|
||||
|
||||
#define RXS_8125B_RSS_UDP BIT(9)
|
||||
#define RXS_8125_RSS_IPV4 BIT(10)
|
||||
#define RXS_8125_RSS_IPV6 BIT(12)
|
||||
#define RXS_8125_RSS_TCP BIT(13)
|
||||
#define RTL8126_RXS_RSS_L3_TYPE_MASK (RXS_8125_RSS_IPV4 | RXS_8125_RSS_IPV6)
|
||||
#define RTL8126_RXS_RSS_L4_TYPE_MASK (RXS_8125_RSS_TCP | RXS_8125B_RSS_UDP)
|
||||
void rtl8126_rx_hash(struct rtl8126_private *tp,
|
||||
struct RxDescV3 *descv3,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
u16 rss_header_info;
|
||||
|
||||
if (!(tp->dev->features & NETIF_F_RXHASH))
|
||||
return;
|
||||
|
||||
rss_header_info = le16_to_cpu(descv3->RxDescNormalDDWord2.HeaderInfo);
|
||||
|
||||
if (!(rss_header_info & RTL8126_RXS_RSS_L3_TYPE_MASK))
|
||||
return;
|
||||
|
||||
skb_set_hash(skb, rtl8126_get_rx_desc_hash(tp, descv3),
|
||||
(RTL8126_RXS_RSS_L4_TYPE_MASK & rss_header_info) ?
|
||||
PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
|
||||
}
|
||||
|
||||
void rtl8126_disable_rss(struct rtl8126_private *tp)
|
||||
{
|
||||
RTL_W32(tp, RSS_CTRL_8125, 0x00);
|
||||
}
|
||||
|
||||
void _rtl8126_config_rss(struct rtl8126_private *tp)
|
||||
{
|
||||
_rtl8126_set_rss_hash_opt(tp);
|
||||
|
||||
rtl8126_store_reta(tp);
|
||||
|
||||
rtl8126_store_rss_key(tp);
|
||||
}
|
||||
|
||||
void rtl8126_config_rss(struct rtl8126_private *tp)
|
||||
{
|
||||
if (!tp->EnableRss) {
|
||||
rtl8126_disable_rss(tp);
|
||||
return;
|
||||
}
|
||||
|
||||
_rtl8126_config_rss(tp);
|
||||
}
|
||||
|
||||
void rtl8126_init_rss(struct rtl8126_private *tp)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rtl8126_rss_indir_tbl_entries(tp); i++)
|
||||
tp->rss_indir_tbl[i] = ethtool_rxfh_indir_default(i, tp->num_rx_rings);
|
||||
|
||||
netdev_rss_key_fill(tp->rss_key, RTL8126_RSS_KEY_SIZE);
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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_R8126_RSS_H
|
||||
#define _LINUX_R8126_RSS_H
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#define RTL8126_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */
|
||||
#define RTL8126_MAX_INDIRECTION_TABLE_ENTRIES 128
|
||||
|
||||
enum rtl8126_rss_flag {
|
||||
RTL_8125_RSS_FLAG_HASH_UDP_IPV4 = (1 << 0),
|
||||
RTL_8125_RSS_FLAG_HASH_UDP_IPV6 = (1 << 1),
|
||||
};
|
||||
|
||||
struct rtl8126_private;
|
||||
|
||||
int rtl8126_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
|
||||
u32 *rule_locs);
|
||||
int rtl8126_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd);
|
||||
u32 rtl8126_get_rxfh_key_size(struct net_device *netdev);
|
||||
u32 rtl8126_rss_indir_size(struct net_device *netdev);
|
||||
int rtl8126_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
|
||||
u8 *hfunc);
|
||||
int rtl8126_set_rxfh(struct net_device *netdev, const u32 *indir,
|
||||
const u8 *key, const u8 hfunc);
|
||||
void rtl8126_rx_hash(struct rtl8126_private *tp,
|
||||
struct RxDescV3 *descv3,
|
||||
struct sk_buff *skb);
|
||||
void _rtl8126_config_rss(struct rtl8126_private *tp);
|
||||
void rtl8126_config_rss(struct rtl8126_private *tp);
|
||||
void rtl8126_init_rss(struct rtl8126_private *tp);
|
||||
u32 rtl8126_rss_indir_tbl_entries(struct rtl8126_private *tp);
|
||||
void rtl8126_disable_rss(struct rtl8126_private *tp);
|
||||
|
||||
#endif /* _LINUX_R8126_RSS_H */
|
||||
@@ -1,289 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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 "r8126.h"
|
||||
#include "rtl_eeprom.h"
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
//rtl8126_eeprom_type():
|
||||
// tell the eeprom type
|
||||
//return value:
|
||||
// 0: the eeprom type is 93C46
|
||||
// 1: the eeprom type is 93C56 or 93C66
|
||||
//-------------------------------------------------------------------
|
||||
void rtl8126_eeprom_type(struct rtl8126_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 = rtl8126_eeprom_read_sc(tp, 0);
|
||||
|
||||
out_no_eeprom:
|
||||
if ((magic != 0x8129) && (magic != 0x8128)) {
|
||||
tp->eeprom_type = EEPROM_TYPE_NONE;
|
||||
tp->eeprom_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void rtl8126_eeprom_cleanup(struct rtl8126_private *tp)
|
||||
{
|
||||
u8 x;
|
||||
|
||||
x = RTL_R8(tp, Cfg9346);
|
||||
x &= ~(Cfg9346_EEDI | Cfg9346_EECS);
|
||||
|
||||
RTL_W8(tp, Cfg9346, x);
|
||||
|
||||
rtl8126_raise_clock(tp, &x);
|
||||
rtl8126_lower_clock(tp, &x);
|
||||
}
|
||||
|
||||
int rtl8126_eeprom_cmd_done(struct rtl8126_private *tp)
|
||||
{
|
||||
u8 x;
|
||||
int i;
|
||||
|
||||
rtl8126_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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
//rtl8126_eeprom_read_sc():
|
||||
// read one word from eeprom
|
||||
//-------------------------------------------------------------------
|
||||
u16 rtl8126_eeprom_read_sc(struct rtl8126_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);
|
||||
|
||||
rtl8126_shift_out_bits(tp, RTL_EEPROM_READ_OPCODE, 3);
|
||||
rtl8126_shift_out_bits(tp, reg, addr_sz);
|
||||
|
||||
data = rtl8126_shift_in_bits(tp);
|
||||
|
||||
rtl8126_eeprom_cleanup(tp);
|
||||
|
||||
RTL_W8(tp, Cfg9346, 0);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
//rtl8126_eeprom_write_sc():
|
||||
// write one word to a specific address in the eeprom
|
||||
//-------------------------------------------------------------------
|
||||
void rtl8126_eeprom_write_sc(struct rtl8126_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);
|
||||
|
||||
rtl8126_shift_out_bits(tp, RTL_EEPROM_EWEN_OPCODE, 5);
|
||||
rtl8126_shift_out_bits(tp, reg, w_dummy_addr);
|
||||
rtl8126_stand_by(tp);
|
||||
|
||||
rtl8126_shift_out_bits(tp, RTL_EEPROM_ERASE_OPCODE, 3);
|
||||
rtl8126_shift_out_bits(tp, reg, addr_sz);
|
||||
if (rtl8126_eeprom_cmd_done(tp) < 0) {
|
||||
return;
|
||||
}
|
||||
rtl8126_stand_by(tp);
|
||||
|
||||
rtl8126_shift_out_bits(tp, RTL_EEPROM_WRITE_OPCODE, 3);
|
||||
rtl8126_shift_out_bits(tp, reg, addr_sz);
|
||||
rtl8126_shift_out_bits(tp, data, 16);
|
||||
if (rtl8126_eeprom_cmd_done(tp) < 0) {
|
||||
return;
|
||||
}
|
||||
rtl8126_stand_by(tp);
|
||||
|
||||
rtl8126_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5);
|
||||
rtl8126_shift_out_bits(tp, reg, w_dummy_addr);
|
||||
|
||||
rtl8126_eeprom_cleanup(tp);
|
||||
RTL_W8(tp, Cfg9346, 0);
|
||||
}
|
||||
|
||||
void rtl8126_raise_clock(struct rtl8126_private *tp, u8 *x)
|
||||
{
|
||||
*x = *x | Cfg9346_EESK;
|
||||
RTL_W8(tp, Cfg9346, *x);
|
||||
udelay(RTL_CLOCK_RATE);
|
||||
}
|
||||
|
||||
void rtl8126_lower_clock(struct rtl8126_private *tp, u8 *x)
|
||||
{
|
||||
|
||||
*x = *x & ~Cfg9346_EESK;
|
||||
RTL_W8(tp, Cfg9346, *x);
|
||||
udelay(RTL_CLOCK_RATE);
|
||||
}
|
||||
|
||||
void rtl8126_shift_out_bits(struct rtl8126_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);
|
||||
rtl8126_raise_clock(tp, &x);
|
||||
rtl8126_lower_clock(tp, &x);
|
||||
mask = mask >> 1;
|
||||
} while(mask);
|
||||
|
||||
x &= ~Cfg9346_EEDI;
|
||||
RTL_W8(tp, Cfg9346, x);
|
||||
}
|
||||
|
||||
u16 rtl8126_shift_in_bits(struct rtl8126_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;
|
||||
rtl8126_raise_clock(tp, &x);
|
||||
|
||||
x = RTL_R8(tp, Cfg9346);
|
||||
x &= ~Cfg9346_EEDI;
|
||||
|
||||
if (x & Cfg9346_EEDO)
|
||||
d |= 1;
|
||||
|
||||
rtl8126_lower_clock(tp, &x);
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
void rtl8126_stand_by(struct rtl8126_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 rtl8126_set_eeprom_sel_low(struct rtl8126_private *tp)
|
||||
{
|
||||
RTL_W8(tp, Cfg9346, Cfg9346_EEM1);
|
||||
RTL_W8(tp, Cfg9346, Cfg9346_EEM1 | Cfg9346_EESK);
|
||||
|
||||
udelay(20);
|
||||
|
||||
RTL_W8(tp, Cfg9346, Cfg9346_EEM1);
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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_RTLEEPROM_H
|
||||
#define _LINUX_RTLEEPROM_H
|
||||
|
||||
//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 rtl8126_eeprom_type(struct rtl8126_private *tp);
|
||||
void rtl8126_eeprom_cleanup(struct rtl8126_private *tp);
|
||||
u16 rtl8126_eeprom_read_sc(struct rtl8126_private *tp, u16 reg);
|
||||
void rtl8126_eeprom_write_sc(struct rtl8126_private *tp, u16 reg, u16 data);
|
||||
void rtl8126_shift_out_bits(struct rtl8126_private *tp, int data, int count);
|
||||
u16 rtl8126_shift_in_bits(struct rtl8126_private *tp);
|
||||
void rtl8126_raise_clock(struct rtl8126_private *tp, u8 *x);
|
||||
void rtl8126_lower_clock(struct rtl8126_private *tp, u8 *x);
|
||||
void rtl8126_stand_by(struct rtl8126_private *tp);
|
||||
void rtl8126_set_eeprom_sel_low(struct rtl8126_private *tp);
|
||||
|
||||
#endif /* _LINUX_RTLEEPROM_H */
|
||||
@@ -1,260 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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 "r8126.h"
|
||||
#include "rtl_eeprom.h"
|
||||
#include "rtltool.h"
|
||||
|
||||
int rtl8126_tool_ioctl(struct rtl8126_private *tp, struct ifreq *ifr)
|
||||
{
|
||||
struct rtltool_cmd my_cmd;
|
||||
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 (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 (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:
|
||||
my_cmd.data = rtl8126_mdio_prot_read(tp, my_cmd.offset);
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RTLTOOL_WRITE_PHY:
|
||||
rtl8126_mdio_prot_write(tp, my_cmd.offset, my_cmd.data);
|
||||
break;
|
||||
|
||||
case RTLTOOL_READ_EPHY:
|
||||
my_cmd.data = rtl8126_ephy_read(tp, my_cmd.offset);
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RTLTOOL_WRITE_EPHY:
|
||||
rtl8126_ephy_write(tp, my_cmd.offset, my_cmd.data);
|
||||
break;
|
||||
|
||||
case RTLTOOL_READ_ERI:
|
||||
my_cmd.data = 0;
|
||||
if (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) {
|
||||
my_cmd.data = rtl8126_eri_read(tp, my_cmd.offset, my_cmd.len, ERIAR_ExGMAC);
|
||||
} 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 (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) {
|
||||
rtl8126_eri_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data, ERIAR_ExGMAC);
|
||||
} else {
|
||||
ret = -EOPNOTSUPP;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case RTLTOOL_READ_PCI:
|
||||
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 (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:
|
||||
my_cmd.data = rtl8126_eeprom_read_sc(tp, my_cmd.offset);
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RTLTOOL_WRITE_EEPROM:
|
||||
rtl8126_eeprom_write_sc(tp, my_cmd.offset, my_cmd.data);
|
||||
break;
|
||||
|
||||
case RTL_READ_OOB_MAC:
|
||||
rtl8126_oob_mutex_lock(tp);
|
||||
my_cmd.data = rtl8126_ocp_read(tp, my_cmd.offset, 4);
|
||||
rtl8126_oob_mutex_unlock(tp);
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case RTL_WRITE_OOB_MAC:
|
||||
if (my_cmd.len == 0 || my_cmd.len > 4)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
rtl8126_oob_mutex_lock(tp);
|
||||
rtl8126_ocp_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data);
|
||||
rtl8126_oob_mutex_unlock(tp);
|
||||
break;
|
||||
|
||||
case RTL_ENABLE_PCI_DIAG:
|
||||
tp->rtk_enable_diag = 1;
|
||||
|
||||
dprintk("enable rtk diag\n");
|
||||
break;
|
||||
|
||||
case RTL_DISABLE_PCI_DIAG:
|
||||
tp->rtk_enable_diag = 0;
|
||||
|
||||
dprintk("disable rtk diag\n");
|
||||
break;
|
||||
|
||||
case RTL_READ_MAC_OCP:
|
||||
if (my_cmd.offset % 2)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
my_cmd.data = rtl8126_mac_ocp_read(tp, my_cmd.offset);
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case RTL_WRITE_MAC_OCP:
|
||||
if ((my_cmd.offset % 2) || (my_cmd.len != 2))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
rtl8126_mac_ocp_write(tp, my_cmd.offset, (u16)my_cmd.data);
|
||||
break;
|
||||
|
||||
case RTL_DIRECT_READ_PHY_OCP:
|
||||
my_cmd.data = rtl8126_mdio_prot_direct_read_phy_ocp(tp, my_cmd.offset);
|
||||
if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RTL_DIRECT_WRITE_PHY_OCP:
|
||||
rtl8126_mdio_prot_direct_write_phy_ocp(tp, my_cmd.offset, my_cmd.data);
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = -EOPNOTSUPP;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2024 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 rtl8126_tool_ioctl(struct rtl8126_private *tp, struct ifreq *ifr);
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_RTLTOOL_H */
|
||||
@@ -1,19 +1,19 @@
|
||||
#
|
||||
# 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]
|
||||
# [https://www.realtek.com/Download/List?cate_id=585]
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=r8152
|
||||
PKG_VERSION:=2.17.1-3
|
||||
PKG_VERSION:=2.19.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/awesometic/realtek-r8152-dkms/tar.gz/$(PKG_VERSION)?
|
||||
PKG_HASH:=3e0486d412cb05ede0571b19fa6d402c1448b0220e5ae54aa5b11af918ad9a43
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/realtek-$(PKG_NAME)-dkms-$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/wget/realtek-r8152-linux/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=03f9a558ebf90d7cd121150f942395be4b96a5d11059fd0d0517db2574731189
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/realtek-$(PKG_NAME)-linux-$(PKG_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
@@ -21,10 +21,10 @@ include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/usb-net-rtl8152-vendor
|
||||
VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
|
||||
TITLE:=Realtek RTL8152/RTL8153/RTL8154/RTL8156 driver
|
||||
TITLE:=Realtek RTL8152/RTL8153/RTL8154/RTL8156/RTL8157 driver
|
||||
SUBMENU:=USB Support
|
||||
DEPENDS:=+kmod-usb-net
|
||||
FILES:=$(PKG_BUILD_DIR)/src/r8152.ko
|
||||
DEPENDS:=+kmod-usb-net +LINUX_6_12:kmod-libphy
|
||||
FILES:=$(PKG_BUILD_DIR)/r8152.ko
|
||||
AUTOLOAD:=$(call AutoProbe,r8152)
|
||||
CONFLICTS:=kmod-usb-net-rtl8152
|
||||
endef
|
||||
@@ -34,7 +34,7 @@ define KernelPackage/usb-net-rtl8152-vendor/description
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(KERNEL_MAKE) M=$(PKG_BUILD_DIR)/src modules
|
||||
+$(KERNEL_MAKE) M=$(PKG_BUILD_DIR) modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,usb-net-rtl8152-vendor))
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
From f409f1cbfbeedc7b35b6651de9873e597f2f78e1 Mon Sep 17 00:00:00 2001
|
||||
From: W_Y_CPP <383152993@qq.com>
|
||||
Date: Thu, 10 Aug 2023 23:15:47 +0900
|
||||
Subject: [PATCH] rework eth hw addr set for kernel 5.4
|
||||
|
||||
---
|
||||
src/compatibility.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/compatibility.h b/src/compatibility.h
|
||||
index 7738d17..25ffc39 100644
|
||||
--- a/src/compatibility.h
|
||||
+++ b/src/compatibility.h
|
||||
@@ -608,10 +608,12 @@
|
||||
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0) */
|
||||
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) */
|
||||
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0) */
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251)
|
||||
static inline void eth_hw_addr_set(struct net_device *dev, const u8 *addr)
|
||||
{
|
||||
memcpy(dev->dev_addr, addr, 6);
|
||||
}
|
||||
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,4,251) */
|
||||
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) */
|
||||
|
||||
#ifndef FALSE
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -1,38 +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.053.00
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/mtorromeo/r8168/tar.gz/$(PKG_VERSION)?
|
||||
PKG_HASH:=7c00cc13f17c45e1d1002e4c390f118204b04d42caba9d04d8ae95e953770857
|
||||
|
||||
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))
|
||||
@@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=openssl
|
||||
PKG_VERSION:=3.0.14
|
||||
PKG_VERSION:=3.0.15
|
||||
PKG_RELEASE:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_FLAGS:=gc-sections no-lto
|
||||
@@ -17,17 +17,9 @@ PKG_BUILD_PARALLEL:=1
|
||||
|
||||
PKG_BASE:=$(subst $(space),.,$(wordlist 1,2,$(subst .,$(space),$(PKG_VERSION))))
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:= \
|
||||
https://mirrors.tencent.com/openssl/source/ \
|
||||
https://mirrors.tencent.com/openssl/source/old/$(PKG_BASE)/ \
|
||||
https://www.openssl.org/source/ \
|
||||
https://www.openssl.org/source/old/$(PKG_BASE)/ \
|
||||
https://ftp.fi.muni.cz/pub/openssl/source/ \
|
||||
https://ftp.fi.muni.cz/pub/openssl/source/old/$(PKG_BASE)/ \
|
||||
ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \
|
||||
ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/old/$(PKG_BASE)/
|
||||
PKG_SOURCE_URL:=https://github.com/openssl/openssl/releases/download/$(PKG_NAME)-$(PKG_VERSION)/
|
||||
|
||||
PKG_HASH:=eeca035d4dd4e84fc25846d952da6297484afa0650a6f84c682e39df3a4123ca
|
||||
PKG_HASH:=23c666d0edf20f14249b3d8f0368acaee9ab585b09e1de82107c66e1f3ec9533
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
@@ -409,7 +401,7 @@ define Package/libopenssl/install
|
||||
chmod 0700 $(1)/etc/ssl/private
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libcrypto.so.* $(1)/usr/lib/
|
||||
$(LN) libcrypto.so.3 $(1)/usr/lib/libcrypto.so.1.1
|
||||
$(LN) libcrypto.so.3 $(1)/usr/lib/libcrypto.so.1.1
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libssl.so.* $(1)/usr/lib/
|
||||
$(LN) libssl.so.3 $(1)/usr/lib/libssl.so.1.1
|
||||
$(if $(CONFIG_OPENSSL_ENGINE),$(INSTALL_DIR) $(1)/usr/lib/$(ENGINES_DIR))
|
||||
@@ -421,6 +413,8 @@ define Package/libopenssl-conf/install
|
||||
$(INSTALL_BIN) ./files/openssl.init $(1)/etc/init.d/openssl
|
||||
$(SED) 's!%ENGINES_DIR%!/usr/lib/$(ENGINES_DIR)!' $(1)/etc/init.d/openssl
|
||||
touch $(1)/etc/config/openssl
|
||||
$(if $(CONFIG_OPENSSL_ENGINE),,
|
||||
$(SED) 's!engines = engines_sect!#&!' $(1)/etc/ssl/openssl.cnf)
|
||||
$(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO),
|
||||
$(CP) ./files/devcrypto.cnf $(1)/etc/ssl/modules.cnf.d/
|
||||
echo -e "config engine 'devcrypto'\n\toption enabled '1'\n\toption builtin '1'" >> $(1)/etc/config/openssl)
|
||||
|
||||
1
package/luci-app-partexp
Submodule
1
package/luci-app-partexp
Submodule
Submodule package/luci-app-partexp added at 64eb0bd909
1
package/luci-app-zerotier
Submodule
1
package/luci-app-zerotier
Submodule
Submodule package/luci-app-zerotier added at 84061c8aff
@@ -87,10 +87,6 @@ config DRIVER_11AX_SUPPORT
|
||||
default n
|
||||
select WPA_MBO_SUPPORT
|
||||
|
||||
config DRIVER_11BE_SUPPORT
|
||||
bool
|
||||
default n
|
||||
|
||||
config WPA_ENABLE_WEP
|
||||
bool "Enable support for unsecure and obsolete WEP"
|
||||
help
|
||||
|
||||
@@ -30,7 +30,6 @@ PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_DRIVER_WEXT_SUPPORT \
|
||||
CONFIG_DRIVER_11AC_SUPPORT \
|
||||
CONFIG_DRIVER_11AX_SUPPORT \
|
||||
CONFIG_DRIVER_11BE_SUPPORT \
|
||||
CONFIG_WPA_ENABLE_WEP
|
||||
|
||||
PKG_BUILD_FLAGS:=gc-sections lto
|
||||
@@ -83,15 +82,11 @@ ifneq ($(CONFIG_DRIVER_11AX_SUPPORT),)
|
||||
HOSTAPD_IEEE80211AX:=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DRIVER_11BE_SUPPORT),)
|
||||
HOSTAPD_IEEE80211BE:=y
|
||||
endif
|
||||
DRIVER_MAKEOPTS= \
|
||||
CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
|
||||
CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
|
||||
CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \
|
||||
CONFIG_IEEE80211AX=$(HOSTAPD_IEEE80211AX) \
|
||||
CONFIG_IEEE80211BE=$(HOSTAPD_IEEE80211BE) \
|
||||
CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
|
||||
CONFIG_MBO=$(CONFIG_WPA_MBO_SUPPORT)
|
||||
|
||||
|
||||
@@ -15,10 +15,6 @@ static inline int has_feature(const char *feat)
|
||||
if (!strcmp(feat, "11ax"))
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef CONFIG_IEEE80211BE
|
||||
if (!strcmp(feat, "11be"))
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef CONFIG_IEEE80211R
|
||||
if (!strcmp(feat, "11r"))
|
||||
return 1;
|
||||
|
||||
1
package/openclash
Submodule
1
package/openclash
Submodule
Submodule package/openclash added at 74ce817f0a
1
package/pcat-manager
Submodule
1
package/pcat-manager
Submodule
Submodule package/pcat-manager added at 0149b47808
@@ -8,7 +8,18 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=Hyper Modem Server
|
||||
LUCI_DEPENDS:=+luci-compat
|
||||
LUCI_DEPENDS:=+luci-compat +kmod-usb-net +kmod-usb-net-cdc-ether +kmod-usb-acm \
|
||||
+kmod-usb-net-qmi-wwan +kmod-usb-net-rndis +kmod-usb-serial-qualcomm \
|
||||
+kmod-usb-net-sierrawireless +kmod-usb-ohci +kmod-usb-serial \
|
||||
+kmod-usb-serial-option +kmod-usb-wdm \
|
||||
+kmod-usb2 +kmod-usb3 \
|
||||
+kmod-usb-net-cdc-mbim \
|
||||
+usbutils \
|
||||
+luci-proto-qmi \
|
||||
+pciutils \
|
||||
+kmod-pcie_mhi \
|
||||
+quectel-CM-5G \
|
||||
+grep \
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
||||
@@ -1 +1,20 @@
|
||||
# luci-app-hypermodem
|
||||
# luci-app-hypermodem
|
||||
|
||||
# 目录
|
||||
|
||||
[一、说明](#一说明)
|
||||
|
||||
# 一、说明
|
||||
|
||||
原项目地址:https://github.com/momokind/luci-app-hypermodem
|
||||
|
||||
插件功能
|
||||
|
||||
- 支持USB和PCIe两种通信方式的通信模组
|
||||
|
||||
- 支持IPv6
|
||||
|
||||
- 支持高通和紫光展锐两个平台的通信模组
|
||||
|
||||
- 支持常见厂商的通信模组(例如:移远,广和通等)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ mp = Map("hypermodem")
|
||||
mp.title = translate("Hyper Modem Server")
|
||||
mp.description = translate("Modem Server For OpenWrt")
|
||||
|
||||
s = mp:section(TypedSection, "service", "Base Setting")
|
||||
s = mp:section(TypedSection, "service", translate("Base Setting"))
|
||||
s.anonymous = true
|
||||
|
||||
enabled = s:option(Flag, "enabled", translate("Enable"))
|
||||
@@ -16,6 +16,11 @@ ipv6 = s:option(Flag, "ipv6", translate("Enable IPv6"))
|
||||
ipv6.default = 1
|
||||
ipv6.rmempty = false
|
||||
|
||||
network_bridge = s:option(Flag, "network_bridge", translate("Enable Network bridge"))
|
||||
network_bridge.description = translate("After checking, enable network interface bridge.")
|
||||
network_bridge.default = 0
|
||||
network_bridge.rmempty = false
|
||||
|
||||
device = s:option(Value, "device", translate("Modem device"))
|
||||
device.rmempty = false
|
||||
|
||||
@@ -29,20 +34,34 @@ if device_suggestions then
|
||||
end
|
||||
|
||||
apn = s:option(Value, "apn", translate("APN"))
|
||||
apn.default = ""
|
||||
apn.rmempty = true
|
||||
apn:value("", translate("Auto Choose"))
|
||||
apn:value("cmnet", translate("China Mobile"))
|
||||
apn:value("3gnet", translate("China Unicom"))
|
||||
apn:value("ctnet", translate("China Telecom"))
|
||||
apn:value("cbnet", translate("China Broadcast"))
|
||||
apn:value("5gscuiot", translate("Skytone"))
|
||||
|
||||
username = s:option(Value, "username", translate("PAP/CHAP username"))
|
||||
username.rmempty = true
|
||||
|
||||
password = s:option(Value, "password", translate("PAP/CHAP password"))
|
||||
password.rmempty = true
|
||||
|
||||
auth = s:option(Value, "auth", translate("Authentication Type"))
|
||||
auth.rmempty = true
|
||||
auth:value("", translate("-- Please choose --"))
|
||||
auth:value("both", "PAP/CHAP (both)")
|
||||
auth = s:option(ListValue, "auth", translate("Authentication Type"))
|
||||
auth.default = "none"
|
||||
auth.rmempty = false
|
||||
auth:value("none", translate("NONE"))
|
||||
auth:value("both", translate("PAP/CHAP (both)"))
|
||||
auth:value("pap", "PAP")
|
||||
auth:value("chap", "CHAP")
|
||||
auth:value("none", "NONE")
|
||||
|
||||
username = s:option(Value, "username", translate("PAP/CHAP Username"))
|
||||
username.rmempty = true
|
||||
username:depends("auth", "both")
|
||||
username:depends("auth", "pap")
|
||||
username:depends("auth", "chap")
|
||||
|
||||
password = s:option(Value, "password", translate("PAP/CHAP Password"))
|
||||
password.rmempty = true
|
||||
password.password = true
|
||||
password:depends("auth", "both")
|
||||
password:depends("auth", "pap")
|
||||
password:depends("auth", "chap")
|
||||
|
||||
return mp
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user