mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2026-03-20 03:39:54 +00:00
Compare commits
1 Commits
next
...
uCentral-t
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6c5e1f1f2 |
39
.github/actions/create-ami-from-image/action.yml
vendored
39
.github/actions/create-ami-from-image/action.yml
vendored
@@ -1,39 +0,0 @@
|
||||
name: Create AMI from firmware image in S3 bucket
|
||||
|
||||
inputs:
|
||||
firmware_image_name:
|
||||
description: Name of the firmware image
|
||||
required: true
|
||||
firmware_image_s3_bucket:
|
||||
description: Name of the S3 bucket where the image resides
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Import snapshot based on firmware image
|
||||
id: import_snapshot
|
||||
shell: bash
|
||||
run: |
|
||||
echo "import_task_id=$(aws ec2 import-snapshot --description '${{ inputs.firmware_image_name }}' --disk-container 'Format=raw,UserBucket={S3Bucket=${{ inputs.firmware_image_s3_bucket }},S3Key=${{ inputs.firmware_image_name }}}' | jq -r '.ImportTaskId')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Wait for import task to complete and get snapshot ID
|
||||
id: get_snapshot_id
|
||||
shell: bash
|
||||
run: |
|
||||
IMPORT_TASK_STATUS=""
|
||||
while [[ $IMPORT_TASK_STATUS != 'completed' ]]; do
|
||||
IMPORT_TASK_STATUS=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.Status')
|
||||
echo "Import task status is $IMPORT_TASK_STATUS, waiting for completion."
|
||||
done
|
||||
echo "id=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.SnapshotId')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Tag snapshot with image name
|
||||
shell: bash
|
||||
run: |
|
||||
aws ec2 create-tags --resources ${{ steps.get_snapshot_id.outputs.id }} --tags 'Key=Name,Value=${{ inputs.firmware_image_name }}'
|
||||
|
||||
- name: Register AMI based on snapshot
|
||||
shell: bash
|
||||
run: |
|
||||
aws ec2 register-image --name '${{ inputs.firmware_image_name }}' --root-device-name /dev/xvda --block-device-mappings 'DeviceName=/dev/xvda,Ebs={SnapshotId=${{ steps.get_snapshot_id.outputs.id }}}'
|
||||
65
.github/workflows/build-dev.yml
vendored
Executable file → Normal file
65
.github/workflows/build-dev.yml
vendored
Executable file → Normal file
@@ -1,34 +1,20 @@
|
||||
name: Build OpenWrt/uCentral images
|
||||
|
||||
env:
|
||||
AWS_DEFAULT_OUTPUT: json
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
|
||||
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, next, staging-* ]
|
||||
branches: [ uCentral-* ]
|
||||
tags: [ v* ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
x64_vm_image_name: ${{ steps.package_and_upload_image.outputs.x64_vm_image_name }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: [ 'cig_wf189h', 'cig_wf189w', 'cig_wf660a', 'cig_wf672', 'cig_wf186h', 'cig_wf186w', 'cig_wf188n', 'cig_wf189', 'cig_wf196', 'cig_wf196', 'cybertan_eww631-a1', 'cybertan_eww631-b1', 'sonicfi_rap630w-312g', 'sonicfi_rap630c-311g', 'sonicfi_rap630w-311g', 'sonicfi_rap650c', 'sonicfi_rap7110c-341x', 'sonicfi_rap750e-h', 'sonicfi_rap750e-s', 'sonicfi_rap750w-311a', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'edgecore_eap105', 'edgecore_eap111', 'edgecore_oap101', 'edgecore_oap101-6e', 'edgecore_oap101e', 'edgecore_oap101e-6e', 'edgecore_oap103', 'hfcl_ion4xe', 'hfcl_ion4xi', 'hfcl_ion4x', 'hfcl_ion4x_2', 'hfcl_ion4x_3', 'hfcl_ion4xi_w', 'hfcl_ion4x_w', 'indio_um-305ax', 'udaya_a6-id2', 'udaya_a6-od2', 'yuncore_ax820', 'yuncore_ax840', 'yuncore_fap640', 'yuncore_fap650', 'yuncore_fap655', 'zyxel_nwa130be', 'sercomm_ap72tip-v4', 'asterfusion_ap7330']
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
target: ['cig_wf188', 'cig_wf194c', 'cig_wf160d', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'indio_um-305ac', 'linksys_e8450-ubi', 'linksys_ea8300', 'mikrotik_nand', 'tplink_cpe210_v3', 'tplink_cpe510_v3', 'tplink_eap225_outdoor_v1', 'tplink_ec420', 'tplink_ex227', 'tplink_ex228', 'tplink_ex447', 'wallys_dr40x9' ]
|
||||
|
||||
# Clean unnecessary files to save disk space
|
||||
- name: clean unncessary files to save space
|
||||
run: |
|
||||
docker rmi `docker images -q` || true
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Build image for ${{ matrix.target }}
|
||||
id: build
|
||||
@@ -38,12 +24,17 @@ jobs:
|
||||
make -j TARGET=${{ matrix.target }}
|
||||
|
||||
- name: Package and upload image for ${{ matrix.target }}
|
||||
id: package_and_upload_image
|
||||
env:
|
||||
GH_BUILD_USERNAME: ${{ secrets.GH_BUILD_USERNAME }}
|
||||
GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }}
|
||||
ARTIFACTORY_USERNAME: cicd-indoor-main
|
||||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
||||
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
|
||||
AWS_DEFAULT_OUTPUT: json
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
|
||||
run: |
|
||||
LOWERCASE_TARGET=`echo ${{ matrix.target }} | tr '[:upper:]' '[:lower:]'`
|
||||
HASH=$(git rev-parse --short HEAD)
|
||||
@@ -51,10 +42,8 @@ jobs:
|
||||
if [[ ${GITHUB_REF} == "refs/heads/"* ]]
|
||||
then
|
||||
REF=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-')
|
||||
IS_RELEASE="false"
|
||||
else
|
||||
REF=$(echo ${GITHUB_REF#refs/tags/} | tr '/' '-')
|
||||
IS_RELEASE="true"
|
||||
fi
|
||||
|
||||
BASENAME="$(date +%Y%m%d)-$LOWERCASE_TARGET-$REF-$HASH"
|
||||
@@ -71,36 +60,4 @@ jobs:
|
||||
[ -f openwrt/tmp/image-file ] && curl -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "latest-upgrade.json" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/latest-upgrade.json"
|
||||
|
||||
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/octet-stream" "openwrt/$(cat openwrt/tmp/image-file)" "s3://$AWS_S3_BUCKET_NAME/$IMG_NAME"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$IMG_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/json" "latest-upgrade.json" "s3://$AWS_S3_BUCKET_NAME/$JSON_NAME"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
|
||||
|
||||
if [ ${{ matrix.target }} == 'x64_vm' ]; then
|
||||
echo "x64_vm_image_name=$(echo $IMG_NAME)" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
trigger-testing:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
- name: Trigger testing of release
|
||||
uses: peter-evans/repository-dispatch@v1
|
||||
with:
|
||||
token: ${{ secrets.WLAN_TESTING_PAT }}
|
||||
repository: Telecominfraproject/wlan-testing
|
||||
event-type: new-ap-release
|
||||
client-payload: '{"ref": "${GITHUB_REF#refs/tags/}", "sha": "${{ github.sha }}"}'
|
||||
|
||||
create-x64_vm-ami:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Use create-ami-from-image composite action
|
||||
uses: ./.github/actions/create-ami-from-image
|
||||
with:
|
||||
firmware_image_name: ${{ needs.build.outputs.x64_vm_image_name }}
|
||||
firmware_image_s3_bucket: ${{ env.AWS_S3_BUCKET_NAME }}
|
||||
|
||||
88
.github/workflows/x64_vm-build-test.yml
vendored
88
.github/workflows/x64_vm-build-test.yml
vendored
@@ -1,88 +0,0 @@
|
||||
name: Test x64_vm build and AMI creation
|
||||
|
||||
env:
|
||||
AWS_DEFAULT_OUTPUT: json
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
|
||||
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
x64_vm_image_name: ${{ steps.package_and_upload_image.outputs.x64_vm_image_name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: ['x64_vm']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Build image for ${{ matrix.target }}
|
||||
id: build
|
||||
run: |
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.name "Your Name"
|
||||
make -j TARGET=${{ matrix.target }} make -j TARGET=${{ matrix.target }}
|
||||
|
||||
- name: Package and upload image for ${{ matrix.target }}
|
||||
id: package_and_upload_image
|
||||
env:
|
||||
GH_BUILD_USERNAME: ${{ secrets.GH_BUILD_USERNAME }}
|
||||
GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }}
|
||||
ARTIFACTORY_USERNAME: cicd-indoor-main
|
||||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
||||
run: |
|
||||
LOWERCASE_TARGET=`echo ${{ matrix.target }} | tr '[:upper:]' '[:lower:]'`
|
||||
HASH=$(git rev-parse --short HEAD)
|
||||
|
||||
if [[ ${GITHUB_REF} == "refs/heads/"* ]]
|
||||
then
|
||||
REF=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-')
|
||||
IS_RELEASE="false"
|
||||
else
|
||||
REF=$(echo ${GITHUB_REF#refs/tags/} | tr '/' '-')
|
||||
IS_RELEASE="true"
|
||||
fi
|
||||
|
||||
BASENAME="$(date +%Y%m%d)-$LOWERCASE_TARGET-$REF-$HASH"
|
||||
TAR_NAME="$BASENAME.tar.gz"
|
||||
IMG_NAME="$BASENAME-upgrade.bin";
|
||||
JSON_NAME="$BASENAME.json";
|
||||
|
||||
tar cfz "$TAR_NAME" -C openwrt/bin/targets/ .
|
||||
curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "$TAR_NAME" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/"$TAR_NAME""
|
||||
IMG_NAME="$BASENAME-upgrade.bin";
|
||||
TIP_VERSION="$(grep DISTRIB_TIP= openwrt/tmp/openwrt_release | cut -d\' -f2)"
|
||||
echo -e "{\n\t\"image\":\""${IMG_NAME}"\",\n\t\"revision\": \""${TIP_VERSION}"\",\n\t\"timestamp\":\""$(date +%s)"\",\n\t\"compatible\": \""${LOWERCASE_TARGET}"\"\n}" > latest-upgrade.json
|
||||
[ -f openwrt/tmp/image-file ] && curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "openwrt/$(cat openwrt/tmp/image-file)" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/"$IMG_NAME""
|
||||
[ -f openwrt/tmp/image-file ] && curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "latest-upgrade.json" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/latest-upgrade.json"
|
||||
|
||||
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/octet-stream" "openwrt/$(cat openwrt/tmp/image-file)" "s3://$AWS_S3_BUCKET_NAME/$IMG_NAME"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$IMG_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/json" "latest-upgrade.json" "s3://$AWS_S3_BUCKET_NAME/$JSON_NAME"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
|
||||
|
||||
if [[ ${{ matrix.target }} == 'x64_vm' ]]; then
|
||||
echo "x64_vm_image_name=$(echo $IMG_NAME)" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
create-x64_vm-ami:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: WIFI-7206-add-workflow-to-build-virtual-ap-image
|
||||
|
||||
- name: Use create-ami-from-image composite action
|
||||
uses: ./.github/actions/create-ami-from-image
|
||||
with:
|
||||
firmware_image_name: ${{ needs.build.outputs.x64_vm_image_name }}
|
||||
firmware_image_s3_bucket: ${{ env.AWS_S3_BUCKET_NAME }}
|
||||
28
LICENSE
28
LICENSE
@@ -1,28 +0,0 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2024, Telecom Infra Project
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
85
README.md
85
README.md
@@ -1,83 +1,20 @@
|
||||
# OpenWiFi AP NOS
|
||||
# Setting up your build machine
|
||||
|
||||
OpenWrt-based access point network operating system (AP NOS) for TIP OpenWiFi.
|
||||
Read more at [openwifi.tip.build](https://openwifi.tip.build/).
|
||||
Requires a recent linux installation. Older systems without python 3.7 will have trouble. See this link for details: https://openwrt.org/docs/guide-developer/quickstart-build-images
|
||||
|
||||
## Building
|
||||
Install build packages: sudo apt install build-essential libncurses5-dev gawk git libssl-dev gettext zlib1g-dev swig unzip time rsync python3 python3-setuptools python3-yaml.
|
||||
|
||||
### Setting up your build machine
|
||||
|
||||
Building requires a recent Linux installation. Older systems without Python 3.7
|
||||
will have trouble. See this guide for details:
|
||||
https://openwrt.org/docs/guide-developer/toolchain/beginners-build-guide
|
||||
|
||||
Install build packages on Debian/Ubuntu (or see above guide for other systems):
|
||||
# Doing a native build on Linux
|
||||
First we need to clone and setup our tree. This will result in an openwrt/.
|
||||
```
|
||||
sudo apt install build-essential libncurses5-dev gawk git libssl-dev gettext zlib1g-dev swig unzip time rsync python3 python3-setuptools python3-yaml
|
||||
./setup.py --setup
|
||||
```
|
||||
|
||||
### Doing a native build on Linux
|
||||
|
||||
Use `./build.sh <target>`, or follow the manual steps below:
|
||||
|
||||
1. Clone and set up the tree. This will create an `openwrt/` directory.
|
||||
```shell
|
||||
./setup.py --setup # for subsequent builds, use --rebase instead
|
||||
Next we need to select the profile and base package selection. This setup will install the feeds, packages and generate the .config file.
|
||||
```
|
||||
|
||||
2. Select the profile and base package selection. This setup will install the
|
||||
feeds and packages and generate the `.config` file.
|
||||
```shell
|
||||
cd openwrt
|
||||
./scripts/gen_config.py linksys_ea8300
|
||||
./scripts/gen_config.py ea8300
|
||||
```
|
||||
|
||||
3. Build the tree (replace `-j 8` with the number of cores to use).
|
||||
```shell
|
||||
make -j 8 V=s
|
||||
Finally we can build the tree.
|
||||
```
|
||||
make -j X V=s
|
||||
```
|
||||
|
||||
### Build output
|
||||
|
||||
The build results are located in the `openwrt/bin/` directory:
|
||||
|
||||
| Type | Path |
|
||||
| ---------------- | ---------------------------------------------------- |
|
||||
| Firmware images | `openwrt/bin/targets/<target>/<subtarget>/` |
|
||||
| Kernel modules | `openwrt/bin/targets/<target>/<subtarget>/packages/` |
|
||||
| Package binaries | `openwrt/bin/packages/<platform>/<feed>/` |
|
||||
|
||||
## Developer Notes
|
||||
|
||||
### Branching model
|
||||
|
||||
- `main` - Stable dev branch
|
||||
- `next` - Integration branch
|
||||
- `staging-*` - Feature/bug branches
|
||||
- `release/v#.#.#` - Release branches (*major.minor.patch*)
|
||||
|
||||
### Repository structure
|
||||
|
||||
Build files:
|
||||
- `Makefile` - Calls Docker environment per target
|
||||
- `dock-run.sh` - Dockerized build environment
|
||||
- `docker/Dockerfile` - Dockerfile for build image
|
||||
- `build.sh` - Build script
|
||||
- `setup.py` - Clone and set up the tree
|
||||
- `config.yml` - Specifies OpenWrt version and patches to apply
|
||||
|
||||
Directories:
|
||||
- `feeds/` - OpenWiFi feeds
|
||||
- `patches/` - OpenWiFi patches applied during builds
|
||||
- `profiles/` - Per-target kernel configs, packages, and feeds
|
||||
- [wifi-ax](profiles/wifi-ax.yml): Wi-Fi AX packages
|
||||
- [ucentral-ap](profiles/ucentral-ap.yml): uCentral packages
|
||||
- [x64_vm](profiles/x64_vm.yml): x86-64 VM image
|
||||
|
||||
### uCentral packages
|
||||
|
||||
AP-NOS packages implementing the uCentral protocol include the following
|
||||
repositories (refer to the [ucentral](feeds/ucentral/) feed for a full list):
|
||||
- ucentral-client: https://github.com/Telecominfraproject/wlan-ucentral-client
|
||||
- ucentral-schema: https://github.com/Telecominfraproject/wlan-ucentral-schema
|
||||
- ucentral-wifi: https://github.com/blogic/ucentral-wifi
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
From c51ac602aff1a9b0093687fe39164a3b895fd4a2 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Thu, 22 Oct 2020 10:29:34 +0200
|
||||
Subject: [PATCH 01/27] build: build kernel image before building
|
||||
modules/packages
|
||||
|
||||
This is needed for linux 5.10, where modules.builtin is generated from
|
||||
vmlinux.o
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
include/kernel-defaults.mk | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
|
||||
index 3aa1baa761..c02e0d34ca 100644
|
||||
--- a/include/kernel-defaults.mk
|
||||
+++ b/include/kernel-defaults.mk
|
||||
@@ -115,7 +115,7 @@ endef
|
||||
|
||||
define Kernel/CompileModules/Default
|
||||
rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
|
||||
- +$(KERNEL_MAKE) modules
|
||||
+ +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
|
||||
endef
|
||||
|
||||
OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
|
||||
@@ -139,7 +139,7 @@ endef
|
||||
|
||||
define Kernel/CompileImage/Default
|
||||
rm -f $(TARGET_DIR)/init
|
||||
- +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
|
||||
+ +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all)
|
||||
$(call Kernel/CopyImage)
|
||||
endef
|
||||
|
||||
@@ -149,7 +149,7 @@ define Kernel/CompileImage/Initramfs
|
||||
$(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init
|
||||
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(TARGET_DIR)/init)
|
||||
rm -rf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/usr/initramfs_data.cpio*
|
||||
- +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
|
||||
+ +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all)
|
||||
$(call Kernel/CopyImage,-initramfs)
|
||||
endef
|
||||
else
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From 6c50e27b166b30c0b3f7b730717ab4b7f446e4d0 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Wed, 17 Feb 2021 13:49:14 +0100
|
||||
Subject: [PATCH 02/27] build: fix build with CONFIG_STRIP_KERNEL_EXPORTS
|
||||
|
||||
Only use symtab.h on the final kernel link
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
include/kernel-defaults.mk | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
|
||||
index c02e0d34ca..f9316fc3f9 100644
|
||||
--- a/include/kernel-defaults.mk
|
||||
+++ b/include/kernel-defaults.mk
|
||||
@@ -3,7 +3,7 @@
|
||||
# Copyright (C) 2006-2020 OpenWrt.org
|
||||
|
||||
ifdef CONFIG_STRIP_KERNEL_EXPORTS
|
||||
- KERNEL_MAKEOPTS += \
|
||||
+ KERNEL_MAKEOPTS_IMAGE += \
|
||||
EXTRA_LDSFLAGS="-I$(KERNEL_BUILD_DIR) -include symtab.h"
|
||||
endif
|
||||
|
||||
@@ -139,7 +139,7 @@ endef
|
||||
|
||||
define Kernel/CompileImage/Default
|
||||
rm -f $(TARGET_DIR)/init
|
||||
- +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all)
|
||||
+ +$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all)
|
||||
$(call Kernel/CopyImage)
|
||||
endef
|
||||
|
||||
@@ -149,7 +149,7 @@ define Kernel/CompileImage/Initramfs
|
||||
$(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init
|
||||
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(TARGET_DIR)/init)
|
||||
rm -rf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/usr/initramfs_data.cpio*
|
||||
- +$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all)
|
||||
+ +$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all)
|
||||
$(call Kernel/CopyImage,-initramfs)
|
||||
endef
|
||||
else
|
||||
--
|
||||
2.25.1
|
||||
|
||||
39479
backports/0003-kernel-add-linux-5.10-support.patch
Normal file
39479
backports/0003-kernel-add-linux-5.10-support.patch
Normal file
File diff suppressed because it is too large
Load Diff
108825
backports/0004-mediatek-update-to-latest-trunk-version.patch
Normal file
108825
backports/0004-mediatek-update-to-latest-trunk-version.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
||||
From 7ed003d57f1c5273fecddabcdc7bd6845c3854a0 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Sat, 20 Feb 2021 08:36:43 +0100
|
||||
Subject: [PATCH 05/27] sysupgrade-nand: allow limiting rootfs_data by setting
|
||||
env variable
|
||||
|
||||
Check if firmware environment variable 'rootfs_data_max' exists and is
|
||||
set to a numerical value greater than 0. If so, limit rootfs_data
|
||||
volume to that size instead of using the maximum available size.
|
||||
|
||||
This is useful on devices with lots of flash where users may want to
|
||||
have eg. a volume for persistent logs and statistics or for external
|
||||
applications/containers. Persistence on rootfs overlay is limited by
|
||||
the size of memory available during the sysugprade process as that
|
||||
data needs to be copied to RAM while the volume is being recreated
|
||||
during sysupgrade. Hence it is unsuitable for keeping larger amounts
|
||||
of data accross upgrade which makes additional volume(s) for
|
||||
application data desirable.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
package/base-files/files/lib/upgrade/nand.sh | 20 ++++++++++++++++----
|
||||
1 file changed, 16 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
|
||||
index 5bc9ff83f9..e335d940ed 100644
|
||||
--- a/package/base-files/files/lib/upgrade/nand.sh
|
||||
+++ b/package/base-files/files/lib/upgrade/nand.sh
|
||||
@@ -117,6 +117,9 @@ nand_restore_config() {
|
||||
nand_upgrade_prepare_ubi() {
|
||||
local rootfs_length="$1"
|
||||
local rootfs_type="$2"
|
||||
+ local rootfs_data_max="$(fw_printenv -n rootfs_data_max 2>/dev/null)"
|
||||
+ [ -n "$rootfs_data_max" ] && rootfs_data_max=$(printf %d "$rootfs_data_max")
|
||||
+
|
||||
local kernel_length="$3"
|
||||
local has_env="${4:-0}"
|
||||
|
||||
@@ -176,11 +179,11 @@ nand_upgrade_prepare_ubi() {
|
||||
|
||||
# update rootfs
|
||||
if [ -n "$rootfs_length" ]; then
|
||||
- local root_size_param
|
||||
+ local rootfs_size_param
|
||||
if [ "$rootfs_type" = "ubifs" ]; then
|
||||
- root_size_param="-m"
|
||||
+ rootfs_size_param="-m"
|
||||
else
|
||||
- root_size_param="-s $rootfs_length"
|
||||
+ rootfs_size_param="-s $rootfs_length"
|
||||
fi
|
||||
if ! ubimkvol /dev/$ubidev -N $CI_ROOTPART $rootfs_size_param; then
|
||||
echo "cannot create rootfs volume"
|
||||
@@ -190,7 +193,16 @@ nand_upgrade_prepare_ubi() {
|
||||
|
||||
# create rootfs_data for non-ubifs rootfs
|
||||
if [ "$rootfs_type" != "ubifs" ]; then
|
||||
- if ! ubimkvol /dev/$ubidev -N rootfs_data -m; then
|
||||
+ local availeb=$(cat /sys/devices/virtual/ubi/$ubidev/avail_eraseblocks)
|
||||
+ local ebsize=$(cat /sys/devices/virtual/ubi/$ubidev/eraseblock_size)
|
||||
+ local avail_size=$(( $availeb * $ebsize ))
|
||||
+ local rootfs_data_size_param="-m"
|
||||
+ if [ -n "$rootfs_data_max" ] &&
|
||||
+ [ "$rootfs_data_max" != "0" ] &&
|
||||
+ [ "$rootfs_data_max" -le "$avail_size" ]; then
|
||||
+ rootfs_data_size_param="-s $rootfs_data_max"
|
||||
+ fi
|
||||
+ if ! ubimkvol /dev/$ubidev -N rootfs_data $rootfs_data_size_param; then
|
||||
echo "cannot initialize rootfs_data volume"
|
||||
return 1
|
||||
fi
|
||||
--
|
||||
2.25.1
|
||||
|
||||
1351
backports/0006-uboot-mediatek-add-support-for-linksys-e8450.patch
Normal file
1351
backports/0006-uboot-mediatek-add-support-for-linksys-e8450.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,70 @@
|
||||
From 1a9921bab861dd2c89337c3e4833c716a0474653 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Fri, 12 Feb 2021 03:09:39 +0000
|
||||
Subject: [PATCH 07/27] uboot-envtools: add defaults for linksys-e8450-ubi
|
||||
|
||||
Add U-Boot environment configuration for the Linksys E8450 (UBI) to
|
||||
allow access to the bootloader environment from OpenWrt via
|
||||
'fw_printenv' and 'fw_setenv'.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
package/boot/uboot-envtools/files/mediatek | 46 ++++++++++++++++++++++
|
||||
1 file changed, 46 insertions(+)
|
||||
create mode 100644 package/boot/uboot-envtools/files/mediatek
|
||||
|
||||
diff --git a/package/boot/uboot-envtools/files/mediatek b/package/boot/uboot-envtools/files/mediatek
|
||||
new file mode 100644
|
||||
index 0000000000..495a837274
|
||||
--- /dev/null
|
||||
+++ b/package/boot/uboot-envtools/files/mediatek
|
||||
@@ -0,0 +1,46 @@
|
||||
+#
|
||||
+# Copyright (C) 2021 OpenWrt.org
|
||||
+#
|
||||
+
|
||||
+[ -e /etc/config/ubootenv ] && exit 0
|
||||
+
|
||||
+touch /etc/config/ubootenv
|
||||
+
|
||||
+. /lib/uboot-envtools.sh
|
||||
+. /lib/functions.sh
|
||||
+
|
||||
+board=$(board_name)
|
||||
+
|
||||
+case "$board" in
|
||||
+linksys,e8450-ubi)
|
||||
+ ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1"
|
||||
+ ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
|
||||
+ ;;
|
||||
+bananapi,bpi-r64)
|
||||
+ . /lib/upgrade/common.sh
|
||||
+ export_bootdevice
|
||||
+ export_partdevice rootdev 0
|
||||
+ case "$rootdev" in
|
||||
+ mmc*)
|
||||
+ local envdev=/dev/$(get_partition_by_name $rootdev ubootenv)
|
||||
+ ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
|
||||
+ ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
|
||||
+ ;;
|
||||
+ *)
|
||||
+ ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1"
|
||||
+ ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
|
||||
+ ;;
|
||||
+ esac
|
||||
+ ;;
|
||||
+buffalo,wsr-2533dhp2)
|
||||
+ ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x1000" "0x20000"
|
||||
+ ;;
|
||||
+ubnt,unifi-6-lr-ubootmod)
|
||||
+ ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x10000"
|
||||
+ ;;
|
||||
+esac
|
||||
+
|
||||
+config_load ubootenv
|
||||
+config_foreach ubootenv_add_app_config ubootenv
|
||||
+
|
||||
+exit 0
|
||||
--
|
||||
2.25.1
|
||||
|
||||
20561
backports/0008-realtek-update-to-latest-owrt-HEAD.patch
Normal file
20561
backports/0008-realtek-update-to-latest-owrt-HEAD.patch
Normal file
File diff suppressed because it is too large
Load Diff
33
backports/0009-include-set-kernel-version.mk.patch
Normal file
33
backports/0009-include-set-kernel-version.mk.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From 4ed9b7d04405d5109681643f3ceebbd25f3f28e2 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Wed, 7 Apr 2021 10:46:26 +0200
|
||||
Subject: [PATCH 09/27] include: set kernel-version.mk
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
include/kernel-version.mk | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/include/kernel-version.mk b/include/kernel-version.mk
|
||||
index fe81dbf603..3c109c13c8 100644
|
||||
--- a/include/kernel-version.mk
|
||||
+++ b/include/kernel-version.mk
|
||||
@@ -6,9 +6,15 @@ ifdef CONFIG_TESTING_KERNEL
|
||||
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
|
||||
endif
|
||||
|
||||
+LINUX_VERSION-4.4 = .60
|
||||
+LINUX_VERSION-4.14 = .193
|
||||
LINUX_VERSION-5.4 = .142
|
||||
+LINUX_VERSION-5.10 = .27
|
||||
|
||||
+LINUX_KERNEL_HASH-4.4.60 = 2cd8df6f1ac6a5329c5a286ec9b5956215977221a1b731597ed169fff74a9659
|
||||
+LINUX_KERNEL_HASH-4.14.193 = 0b0fb41d4430e1a42738b341cbfd2f41951aa5cd02acabbd53f076119c8b9f03
|
||||
LINUX_KERNEL_HASH-5.4.142 = 99785728968564ba27c7e552d024b560072dcbc885540912eabb5c021e231451
|
||||
+LINUX_KERNEL_HASH-5.10.27 = d99dc9662951299c53a0a8d8c8d0a72a16ff861d20e927c0f9b14f63282d69d9
|
||||
|
||||
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
|
||||
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
|
||||
--
|
||||
2.25.1
|
||||
|
||||
137757
backports/0010-ar71xx-forward-port-target-to-get-routerboard-suppor.patch
Normal file
137757
backports/0010-ar71xx-forward-port-target-to-get-routerboard-suppor.patch
Normal file
File diff suppressed because it is too large
Load Diff
266
backports/0011-backport-mkits.sh.patch
Normal file
266
backports/0011-backport-mkits.sh.patch
Normal file
@@ -0,0 +1,266 @@
|
||||
From ad860cb413d1934332de60658d5eb8fb64d19663 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Sun, 9 May 2021 12:23:00 +0200
|
||||
Subject: [PATCH 11/27] backport: mkits.sh
|
||||
|
||||
969083634481c3ab5fb80509f385ef10ab45b55f
|
||||
e991c1b8a2385397fc1e657ed73878938997d951
|
||||
9f714398e060c6338fbfad44cdbfa8c940dbb84b
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
include/image-commands.mk | 2 +-
|
||||
include/image.mk | 2 +-
|
||||
scripts/mkits.sh | 101 +++++++++++++++++++++++++---
|
||||
target/linux/ipq40xx/image/Makefile | 1 +
|
||||
target/linux/ipq806x/image/Makefile | 1 +
|
||||
5 files changed, 95 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/include/image-commands.mk b/include/image-commands.mk
|
||||
index 2c917d613e..c6e8eb0293 100644
|
||||
--- a/include/image-commands.mk
|
||||
+++ b/include/image-commands.mk
|
||||
@@ -203,7 +203,7 @@ define Build/fit
|
||||
$(if $(word 3,$(1)),-r $(IMAGE_ROOTFS) -f $(subst _,$(comma),$(DEVICE_NAME))) \
|
||||
-a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
|
||||
$(if $(DEVICE_FDT_NUM),-n $(DEVICE_FDT_NUM)) \
|
||||
- -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config@1") \
|
||||
+ -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
|
||||
-A $(LINUX_KARCH) -v $(LINUX_VERSION)
|
||||
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(word 3,$(1)),-E -B 0x1000 -p 0x1000) -f $@.its $@.new
|
||||
@mv $@.new $@
|
||||
diff --git a/include/image.mk b/include/image.mk
|
||||
index b6e8ab3c84..7c2dcf0e8b 100644
|
||||
--- a/include/image.mk
|
||||
+++ b/include/image.mk
|
||||
@@ -139,7 +139,7 @@ endef
|
||||
define Image/BuildKernel/MkFIT
|
||||
$(TOPDIR)/scripts/mkits.sh \
|
||||
-D $(1) -o $(KDIR)/fit-$(1).its -k $(2) $(if $(3),-d $(3)) -C $(4) -a $(5) -e $(6) \
|
||||
- -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config@1") \
|
||||
+ -c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
|
||||
-A $(LINUX_KARCH) -v $(LINUX_VERSION)
|
||||
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/fit-$(1).its $(KDIR)/fit-$(1)$(7).itb
|
||||
endef
|
||||
diff --git a/scripts/mkits.sh b/scripts/mkits.sh
|
||||
index 3d68fdacbc..7533baf799 100755
|
||||
--- a/scripts/mkits.sh
|
||||
+++ b/scripts/mkits.sh
|
||||
@@ -24,22 +24,29 @@ usage() {
|
||||
printf "\n\t-a ==> set load address to 'addr' (hex)"
|
||||
printf "\n\t-e ==> set entry point to 'entry' (hex)"
|
||||
printf "\n\t-f ==> set device tree compatible string"
|
||||
+ printf "\n\t-i ==> include initrd Blob 'initrd'"
|
||||
printf "\n\t-v ==> set kernel version to 'version'"
|
||||
printf "\n\t-k ==> include kernel image 'kernel'"
|
||||
printf "\n\t-D ==> human friendly Device Tree Blob 'name'"
|
||||
printf "\n\t-n ==> fdt unit-address 'address'"
|
||||
printf "\n\t-d ==> include Device Tree Blob 'dtb'"
|
||||
- printf "\n\t-r ==> include RootFS blob"
|
||||
+ printf "\n\t-r ==> include RootFS blob 'rootfs'"
|
||||
printf "\n\t-H ==> specify hash algo instead of SHA1"
|
||||
- printf "\n\t-o ==> create output file 'its_file'\n"
|
||||
+ printf "\n\t-o ==> create output file 'its_file'"
|
||||
+ printf "\n\t-O ==> create config with dt overlay 'name:dtb'"
|
||||
+ printf "\n\t\t(can be specified more than once)\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
FDTNUM=1
|
||||
ROOTFSNUM=1
|
||||
+INITRDNUM=1
|
||||
HASH=sha1
|
||||
+LOADABLES=
|
||||
+DTOVERLAY=
|
||||
+DTADDR=
|
||||
|
||||
-while getopts ":A:a:c:C:D:d:e:f:k:n:o:v:r:S" OPTION
|
||||
+while getopts ":A:a:c:C:D:d:e:f:i:k:n:o:O:v:r:S" OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
A ) ARCH=$OPTARG;;
|
||||
@@ -50,9 +57,11 @@ do
|
||||
d ) DTB=$OPTARG;;
|
||||
e ) ENTRY_ADDR=$OPTARG;;
|
||||
f ) COMPATIBLE=$OPTARG;;
|
||||
+ i ) INITRD=$OPTARG;;
|
||||
k ) KERNEL=$OPTARG;;
|
||||
n ) FDTNUM=$OPTARG;;
|
||||
o ) OUTPUT=$OPTARG;;
|
||||
+ O ) DTOVERLAY="$DTOVERLAY ${OPTARG}";;
|
||||
r ) ROOTFS=$OPTARG;;
|
||||
S ) HASH=$OPTARG;;
|
||||
v ) VERSION=$OPTARG;;
|
||||
@@ -74,14 +83,20 @@ if [ -n "${COMPATIBLE}" ]; then
|
||||
COMPATIBLE_PROP="compatible = \"${COMPATIBLE}\";"
|
||||
fi
|
||||
|
||||
+[ "$DTOVERLAY" ] && {
|
||||
+ dtbsize=$(wc -c "$DTB" | cut -d' ' -f1)
|
||||
+ DTADDR=$(printf "0x%08x" $(($LOAD_ADDR - $dtbsize)) )
|
||||
+}
|
||||
+
|
||||
# Conditionally create fdt information
|
||||
if [ -n "${DTB}" ]; then
|
||||
FDT_NODE="
|
||||
- fdt@$FDTNUM {
|
||||
+ fdt-$FDTNUM {
|
||||
description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\";
|
||||
${COMPATIBLE_PROP}
|
||||
data = /incbin/(\"${DTB}\");
|
||||
type = \"flat_dt\";
|
||||
+ ${DTADDR:+load = <${DTADDR}>;}
|
||||
arch = \"${ARCH}\";
|
||||
compression = \"none\";
|
||||
hash@1 {
|
||||
@@ -92,13 +107,34 @@ if [ -n "${DTB}" ]; then
|
||||
};
|
||||
};
|
||||
"
|
||||
- FDT_PROP="fdt = \"fdt@$FDTNUM\";"
|
||||
+ FDT_PROP="fdt = \"fdt-$FDTNUM\";"
|
||||
fi
|
||||
|
||||
+if [ -n "${INITRD}" ]; then
|
||||
+ INITRD_NODE="
|
||||
+ initrd-$INITRDNUM {
|
||||
+ description = \"${ARCH_UPPER} OpenWrt ${DEVICE} initrd\";
|
||||
+ ${COMPATIBLE_PROP}
|
||||
+ data = /incbin/(\"${INITRD}\");
|
||||
+ type = \"ramdisk\";
|
||||
+ arch = \"${ARCH}\";
|
||||
+ os = \"linux\";
|
||||
+ hash@1 {
|
||||
+ algo = \"crc32\";
|
||||
+ };
|
||||
+ hash@2 {
|
||||
+ algo = \"${HASH}\";
|
||||
+ };
|
||||
+ };
|
||||
+"
|
||||
+ INITRD_PROP="ramdisk=\"initrd-${INITRDNUM}\";"
|
||||
+fi
|
||||
+
|
||||
+
|
||||
if [ -n "${ROOTFS}" ]; then
|
||||
dd if="${ROOTFS}" of="${ROOTFS}.pagesync" bs=4096 conv=sync
|
||||
ROOTFS_NODE="
|
||||
- rootfs@$ROOTFSNUM {
|
||||
+ rootfs-$ROOTFSNUM {
|
||||
description = \"${ARCH_UPPER} OpenWrt ${DEVICE} rootfs\";
|
||||
${COMPATIBLE_PROP}
|
||||
data = /incbin/(\"${ROOTFS}.pagesync\");
|
||||
@@ -113,9 +149,50 @@ if [ -n "${ROOTFS}" ]; then
|
||||
};
|
||||
};
|
||||
"
|
||||
- ROOTFS_PROP="loadables = \"rootfs@${ROOTFSNUM}\";"
|
||||
+ LOADABLES="${LOADABLES:+$LOADABLES, }\"rootfs-${ROOTFSNUM}\""
|
||||
fi
|
||||
|
||||
+# add DT overlay blobs
|
||||
+FDTOVERLAY_NODE=""
|
||||
+OVCONFIGS=""
|
||||
+[ "$DTOVERLAY" ] && for overlay in $DTOVERLAY ; do
|
||||
+ overlay_blob=${overlay##*:}
|
||||
+ ovname=${overlay%%:*}
|
||||
+ ovnode="fdt-$ovname"
|
||||
+ ovsize=$(wc -c "$overlay_blob" | cut -d' ' -f1)
|
||||
+ echo "$ovname ($overlay_blob) : $ovsize" >&2
|
||||
+ DTADDR=$(printf "0x%08x" $(($DTADDR - $ovsize)))
|
||||
+ FDTOVERLAY_NODE="$FDTOVERLAY_NODE
|
||||
+
|
||||
+ $ovnode {
|
||||
+ description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree overlay $ovname\";
|
||||
+ ${COMPATIBLE_PROP}
|
||||
+ data = /incbin/(\"${overlay_blob}\");
|
||||
+ type = \"flat_dt\";
|
||||
+ arch = \"${ARCH}\";
|
||||
+ load = <${DTADDR}>;
|
||||
+ compression = \"none\";
|
||||
+ hash@1 {
|
||||
+ algo = \"crc32\";
|
||||
+ };
|
||||
+ hash@2 {
|
||||
+ algo = \"${HASH}\";
|
||||
+ };
|
||||
+ };
|
||||
+"
|
||||
+ OVCONFIGS="$OVCONFIGS
|
||||
+
|
||||
+ config-$ovname {
|
||||
+ description = \"OpenWrt ${DEVICE} with $ovname\";
|
||||
+ kernel = \"kernel-1\";
|
||||
+ fdt = \"fdt-$FDTNUM\", \"$ovnode\";
|
||||
+ ${LOADABLES:+loadables = ${LOADABLES};}
|
||||
+ ${COMPATIBLE_PROP}
|
||||
+ ${INITRD_PROP}
|
||||
+ };
|
||||
+ "
|
||||
+done
|
||||
+
|
||||
# Create a default, fully populated DTS file
|
||||
DATA="/dts-v1/;
|
||||
|
||||
@@ -124,7 +201,7 @@ DATA="/dts-v1/;
|
||||
#address-cells = <1>;
|
||||
|
||||
images {
|
||||
- kernel@1 {
|
||||
+ kernel-1 {
|
||||
description = \"${ARCH_UPPER} OpenWrt Linux-${VERSION}\";
|
||||
data = /incbin/(\"${KERNEL}\");
|
||||
type = \"kernel\";
|
||||
@@ -140,7 +217,9 @@ DATA="/dts-v1/;
|
||||
algo = \"$HASH\";
|
||||
};
|
||||
};
|
||||
+${INITRD_NODE}
|
||||
${FDT_NODE}
|
||||
+${FDTOVERLAY_NODE}
|
||||
${ROOTFS_NODE}
|
||||
};
|
||||
|
||||
@@ -148,11 +227,13 @@ ${ROOTFS_NODE}
|
||||
default = \"${CONFIG}\";
|
||||
${CONFIG} {
|
||||
description = \"OpenWrt ${DEVICE}\";
|
||||
- kernel = \"kernel@1\";
|
||||
+ kernel = \"kernel-1\";
|
||||
${FDT_PROP}
|
||||
- ${ROOTFS_PROP}
|
||||
+ ${LOADABLES:+loadables = ${LOADABLES};}
|
||||
${COMPATIBLE_PROP}
|
||||
+ ${INITRD_PROP}
|
||||
};
|
||||
+ ${OVCONFIGS}
|
||||
};
|
||||
};"
|
||||
|
||||
diff --git a/target/linux/ipq40xx/image/Makefile b/target/linux/ipq40xx/image/Makefile
|
||||
index 2be262936f..a0d6242a28 100644
|
||||
--- a/target/linux/ipq40xx/image/Makefile
|
||||
+++ b/target/linux/ipq40xx/image/Makefile
|
||||
@@ -8,6 +8,7 @@ define Device/Default
|
||||
KERNEL_PREFIX := $$(IMAGE_PREFIX)
|
||||
KERNEL_LOADADDR := 0x80208000
|
||||
DEVICE_DTS = $$(SOC)-$(lastword $(subst _, ,$(1)))
|
||||
+ DEVICE_DTS_CONFIG := config@1
|
||||
IMAGES := sysupgrade.bin
|
||||
IMAGE/sysupgrade.bin = sysupgrade-tar | append-metadata
|
||||
IMAGE/sysupgrade.bin/squashfs :=
|
||||
diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
|
||||
index bab1da0090..3bc60fa931 100644
|
||||
--- a/target/linux/ipq806x/image/Makefile
|
||||
+++ b/target/linux/ipq806x/image/Makefile
|
||||
@@ -30,6 +30,7 @@ define Device/Default
|
||||
KERNEL_PREFIX := $$(IMAGE_PREFIX)
|
||||
KERNEL_LOADADDR = 0x42208000
|
||||
DEVICE_DTS = $$(SOC)-$(lastword $(subst _, ,$(1)))
|
||||
+ DEVICE_DTS_CONFIG := config@1
|
||||
IMAGES := sysupgrade.bin
|
||||
IMAGE/sysupgrade.bin = sysupgrade-tar | append-metadata
|
||||
IMAGE/sysupgrade.bin/squashfs :=
|
||||
--
|
||||
2.25.1
|
||||
|
||||
39
backports/0012-libubox-update-to-latest-HEAD.patch
Normal file
39
backports/0012-libubox-update-to-latest-HEAD.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From 2af08d2e85ee946de5f53bbd0ddf239de9b78f6d Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Tue, 18 May 2021 10:46:43 +0200
|
||||
Subject: [PATCH 12/27] libubox: update to latest HEAD
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/libs/libubox/Makefile | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile
|
||||
index d2c07783e1..33aa73eef7 100644
|
||||
--- a/package/libs/libubox/Makefile
|
||||
+++ b/package/libs/libubox/Makefile
|
||||
@@ -5,9 +5,9 @@ PKG_RELEASE=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git
|
||||
-PKG_MIRROR_HASH:=7dd1db1e0074a9c7c722db654cce3111b3bd3cff0bfd791c4497cb0f6c22d3ca
|
||||
-PKG_SOURCE_DATE:=2021-05-16
|
||||
-PKG_SOURCE_VERSION:=b14c4688612c05c78ce984d7bde633bce8703b1e
|
||||
+PKG_MIRROR_HASH:=1cdb91ac0ee925f133ee9f70eac131a99def312fe7cf0aed44df84eb1762e30b
|
||||
+PKG_SOURCE_DATE:=2021-08-19
|
||||
+PKG_SOURCE_VERSION:=d716ac4bc4236031d4c3cc1ed362b502e20e3787
|
||||
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
@@ -67,7 +67,7 @@ define Package/libubox-lua
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
|
||||
-CMAKE_OPTIONS = \
|
||||
+CMAKE_OPTIONS += \
|
||||
-DLUAPATH=/usr/lib/lua \
|
||||
-DABIVERSION="$(PKG_ABI_VERSION)"
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
30
backports/0013-umdns-update-to-latest-HEAD.patch
Normal file
30
backports/0013-umdns-update-to-latest-HEAD.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 41db6b8282d09bd9d7ee453f54e592003904ab0e Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Wed, 30 Jun 2021 14:21:23 +0200
|
||||
Subject: [PATCH 13/27] umdns: update to latest HEAD
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/network/services/umdns/Makefile | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/package/network/services/umdns/Makefile b/package/network/services/umdns/Makefile
|
||||
index 9a5f46a705..908758e44b 100644
|
||||
--- a/package/network/services/umdns/Makefile
|
||||
+++ b/package/network/services/umdns/Makefile
|
||||
@@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
-PKG_SOURCE_DATE:=2021-01-26
|
||||
-PKG_SOURCE_VERSION:=78aa36b0e9808e801c527c6dc47320e593309522
|
||||
-PKG_MIRROR_HASH:=241833f2bf2f3366f356703159be386862ef747d9b253af6c13555f252cc970d
|
||||
+PKG_SOURCE_DATE:=2021-06-30
|
||||
+PKG_SOURCE_VERSION:=4a8747193ab2b8f2d68a9d26334545e19d89cbe2
|
||||
+PKG_MIRROR_HASH:=bdddec2793303e4cc1a90cb2ed2241c04fdd0a736b6c0cbbb1fab9de5527566a
|
||||
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
PKG_LICENSE:=LGPL-2.1
|
||||
--
|
||||
2.25.1
|
||||
|
||||
242
backports/0014-kernel-add-bdpu-filter-support.patch
Normal file
242
backports/0014-kernel-add-bdpu-filter-support.patch
Normal file
@@ -0,0 +1,242 @@
|
||||
From 9df1500bde8e609dcbbecbefa0eb5a29d9e6f7f5 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Fri, 27 Aug 2021 16:52:34 +0200
|
||||
Subject: [PATCH 14/27] kernel: add bdpu filter support
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
...l-knob-for-filtering-rx-tx-BPDU-pack.patch | 107 ++++++++++++++++++
|
||||
...l-knob-for-filtering-rx-tx-BPDU-pack.patch | 107 ++++++++++++++++++
|
||||
2 files changed, 214 insertions(+)
|
||||
create mode 100644 target/linux/generic/pending-5.10/710-bridge-add-sysctl-knob-for-filtering-rx-tx-BPDU-pack.patch
|
||||
create mode 100644 target/linux/generic/pending-5.4/710-bridge-add-sysctl-knob-for-filtering-rx-tx-BPDU-pack.patch
|
||||
|
||||
diff --git a/target/linux/generic/pending-5.10/710-bridge-add-sysctl-knob-for-filtering-rx-tx-BPDU-pack.patch b/target/linux/generic/pending-5.10/710-bridge-add-sysctl-knob-for-filtering-rx-tx-BPDU-pack.patch
|
||||
new file mode 100644
|
||||
index 0000000000..918ae05d12
|
||||
--- /dev/null
|
||||
+++ b/target/linux/generic/pending-5.10/710-bridge-add-sysctl-knob-for-filtering-rx-tx-BPDU-pack.patch
|
||||
@@ -0,0 +1,107 @@
|
||||
+From: Felix Fietkau <nbd@nbd.name>
|
||||
+Date: Fri, 27 Aug 2021 12:22:32 +0200
|
||||
+Subject: [PATCH] bridge: add sysctl knob for filtering rx/tx BPDU packets on a
|
||||
+ port
|
||||
+
|
||||
+Some devices (e.g. wireless APs) can't have devices behind them be part of
|
||||
+a bridge topology with redundant links, due to address limitations.
|
||||
+Additionally, broadcast traffic on these devices is somewhat expensive, due to
|
||||
+the low data rate and wakeups of clients in powersave mode.
|
||||
+This sysctl knob can be used to ensure that BPDU packets are never sent
|
||||
+or forwarded to/from these devices
|
||||
+
|
||||
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+---
|
||||
+
|
||||
+--- a/include/linux/if_bridge.h
|
||||
++++ b/include/linux/if_bridge.h
|
||||
+@@ -56,6 +56,7 @@ struct br_ip_list {
|
||||
+ #define BR_MRP_AWARE BIT(17)
|
||||
+ #define BR_MRP_LOST_CONT BIT(18)
|
||||
+ #define BR_MRP_LOST_IN_CONT BIT(19)
|
||||
++#define BR_BPDU_FILTER BIT(20)
|
||||
+
|
||||
+ #define BR_DEFAULT_AGEING_TIME (300 * HZ)
|
||||
+
|
||||
+--- a/net/bridge/br_forward.c
|
||||
++++ b/net/bridge/br_forward.c
|
||||
+@@ -191,6 +191,7 @@ out:
|
||||
+ void br_flood(struct net_bridge *br, struct sk_buff *skb,
|
||||
+ enum br_pkt_type pkt_type, bool local_rcv, bool local_orig)
|
||||
+ {
|
||||
++ const unsigned char *dest = eth_hdr(skb)->h_dest;
|
||||
+ struct net_bridge_port *prev = NULL;
|
||||
+ struct net_bridge_port *p;
|
||||
+
|
||||
+@@ -206,6 +207,10 @@ void br_flood(struct net_bridge *br, str
|
||||
+ case BR_PKT_MULTICAST:
|
||||
+ if (!(p->flags & BR_MCAST_FLOOD) && skb->dev != br->dev)
|
||||
+ continue;
|
||||
++ if ((p->flags & BR_BPDU_FILTER) &&
|
||||
++ unlikely(is_link_local_ether_addr(dest) &&
|
||||
++ dest[5] == 0))
|
||||
++ continue;
|
||||
+ break;
|
||||
+ case BR_PKT_BROADCAST:
|
||||
+ if (!(p->flags & BR_BCAST_FLOOD) && skb->dev != br->dev)
|
||||
+--- a/net/bridge/br_input.c
|
||||
++++ b/net/bridge/br_input.c
|
||||
+@@ -305,6 +305,8 @@ static rx_handler_result_t br_handle_fra
|
||||
+ fwd_mask |= p->group_fwd_mask;
|
||||
+ switch (dest[5]) {
|
||||
+ case 0x00: /* Bridge Group Address */
|
||||
++ if (p->flags & BR_BPDU_FILTER)
|
||||
++ goto drop;
|
||||
+ /* If STP is turned off,
|
||||
+ then must forward to keep loop detection */
|
||||
+ if (p->br->stp_enabled == BR_NO_STP ||
|
||||
+--- a/net/bridge/br_sysfs_if.c
|
||||
++++ b/net/bridge/br_sysfs_if.c
|
||||
+@@ -233,6 +233,7 @@ BRPORT_ATTR_FLAG(multicast_flood, BR_MCA
|
||||
+ BRPORT_ATTR_FLAG(broadcast_flood, BR_BCAST_FLOOD);
|
||||
+ BRPORT_ATTR_FLAG(neigh_suppress, BR_NEIGH_SUPPRESS);
|
||||
+ BRPORT_ATTR_FLAG(isolated, BR_ISOLATED);
|
||||
++BRPORT_ATTR_FLAG(bpdu_filter, BR_BPDU_FILTER);
|
||||
+
|
||||
+ #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
|
||||
+ static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf)
|
||||
+@@ -285,6 +286,7 @@ static const struct brport_attribute *br
|
||||
+ &brport_attr_group_fwd_mask,
|
||||
+ &brport_attr_neigh_suppress,
|
||||
+ &brport_attr_isolated,
|
||||
++ &brport_attr_bpdu_filter,
|
||||
+ &brport_attr_backup_port,
|
||||
+ NULL
|
||||
+ };
|
||||
+--- a/net/bridge/br_stp_bpdu.c
|
||||
++++ b/net/bridge/br_stp_bpdu.c
|
||||
+@@ -80,7 +80,8 @@ void br_send_config_bpdu(struct net_brid
|
||||
+ {
|
||||
+ unsigned char buf[35];
|
||||
+
|
||||
+- if (p->br->stp_enabled != BR_KERNEL_STP)
|
||||
++ if (p->br->stp_enabled != BR_KERNEL_STP ||
|
||||
++ (p->flags & BR_BPDU_FILTER))
|
||||
+ return;
|
||||
+
|
||||
+ buf[0] = 0;
|
||||
+@@ -127,7 +128,8 @@ void br_send_tcn_bpdu(struct net_bridge_
|
||||
+ {
|
||||
+ unsigned char buf[4];
|
||||
+
|
||||
+- if (p->br->stp_enabled != BR_KERNEL_STP)
|
||||
++ if (p->br->stp_enabled != BR_KERNEL_STP ||
|
||||
++ (p->flags & BR_BPDU_FILTER))
|
||||
+ return;
|
||||
+
|
||||
+ buf[0] = 0;
|
||||
+@@ -172,6 +174,9 @@ void br_stp_rcv(const struct stp_proto *
|
||||
+ if (!(br->dev->flags & IFF_UP))
|
||||
+ goto out;
|
||||
+
|
||||
++ if (p->flags & BR_BPDU_FILTER)
|
||||
++ goto out;
|
||||
++
|
||||
+ if (p->state == BR_STATE_DISABLED)
|
||||
+ goto out;
|
||||
+
|
||||
diff --git a/target/linux/generic/pending-5.4/710-bridge-add-sysctl-knob-for-filtering-rx-tx-BPDU-pack.patch b/target/linux/generic/pending-5.4/710-bridge-add-sysctl-knob-for-filtering-rx-tx-BPDU-pack.patch
|
||||
new file mode 100644
|
||||
index 0000000000..586d264cd5
|
||||
--- /dev/null
|
||||
+++ b/target/linux/generic/pending-5.4/710-bridge-add-sysctl-knob-for-filtering-rx-tx-BPDU-pack.patch
|
||||
@@ -0,0 +1,107 @@
|
||||
+From: Felix Fietkau <nbd@nbd.name>
|
||||
+Date: Fri, 27 Aug 2021 12:22:32 +0200
|
||||
+Subject: [PATCH] bridge: add sysctl knob for filtering rx/tx BPDU packets on a
|
||||
+ port
|
||||
+
|
||||
+Some devices (e.g. wireless APs) can't have devices behind them be part of
|
||||
+a bridge topology with redundant links, due to address limitations.
|
||||
+Additionally, broadcast traffic on these devices is somewhat expensive, due to
|
||||
+the low data rate and wakeups of clients in powersave mode.
|
||||
+This sysctl knob can be used to ensure that BPDU packets are never sent
|
||||
+or forwarded to/from these devices
|
||||
+
|
||||
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+---
|
||||
+
|
||||
+--- a/include/linux/if_bridge.h
|
||||
++++ b/include/linux/if_bridge.h
|
||||
+@@ -47,6 +47,7 @@ struct br_ip_list {
|
||||
+ #define BR_BCAST_FLOOD BIT(14)
|
||||
+ #define BR_NEIGH_SUPPRESS BIT(15)
|
||||
+ #define BR_ISOLATED BIT(16)
|
||||
++#define BR_BPDU_FILTER BIT(17)
|
||||
+
|
||||
+ #define BR_DEFAULT_AGEING_TIME (300 * HZ)
|
||||
+
|
||||
+--- a/net/bridge/br_forward.c
|
||||
++++ b/net/bridge/br_forward.c
|
||||
+@@ -191,6 +191,7 @@ out:
|
||||
+ void br_flood(struct net_bridge *br, struct sk_buff *skb,
|
||||
+ enum br_pkt_type pkt_type, bool local_rcv, bool local_orig)
|
||||
+ {
|
||||
++ const unsigned char *dest = eth_hdr(skb)->h_dest;
|
||||
+ struct net_bridge_port *prev = NULL;
|
||||
+ struct net_bridge_port *p;
|
||||
+
|
||||
+@@ -206,6 +207,10 @@ void br_flood(struct net_bridge *br, str
|
||||
+ case BR_PKT_MULTICAST:
|
||||
+ if (!(p->flags & BR_MCAST_FLOOD) && skb->dev != br->dev)
|
||||
+ continue;
|
||||
++ if ((p->flags & BR_BPDU_FILTER) &&
|
||||
++ unlikely(is_link_local_ether_addr(dest) &&
|
||||
++ dest[5] == 0))
|
||||
++ continue;
|
||||
+ break;
|
||||
+ case BR_PKT_BROADCAST:
|
||||
+ if (!(p->flags & BR_BCAST_FLOOD) && skb->dev != br->dev)
|
||||
+--- a/net/bridge/br_input.c
|
||||
++++ b/net/bridge/br_input.c
|
||||
+@@ -300,6 +300,8 @@ rx_handler_result_t br_handle_frame(stru
|
||||
+ fwd_mask |= p->group_fwd_mask;
|
||||
+ switch (dest[5]) {
|
||||
+ case 0x00: /* Bridge Group Address */
|
||||
++ if (p->flags & BR_BPDU_FILTER)
|
||||
++ goto drop;
|
||||
+ /* If STP is turned off,
|
||||
+ then must forward to keep loop detection */
|
||||
+ if (p->br->stp_enabled == BR_NO_STP ||
|
||||
+--- a/net/bridge/br_sysfs_if.c
|
||||
++++ b/net/bridge/br_sysfs_if.c
|
||||
+@@ -233,6 +233,7 @@ BRPORT_ATTR_FLAG(multicast_flood, BR_MCA
|
||||
+ BRPORT_ATTR_FLAG(broadcast_flood, BR_BCAST_FLOOD);
|
||||
+ BRPORT_ATTR_FLAG(neigh_suppress, BR_NEIGH_SUPPRESS);
|
||||
+ BRPORT_ATTR_FLAG(isolated, BR_ISOLATED);
|
||||
++BRPORT_ATTR_FLAG(bpdu_filter, BR_BPDU_FILTER);
|
||||
+
|
||||
+ #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
|
||||
+ static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf)
|
||||
+@@ -285,6 +286,7 @@ static const struct brport_attribute *br
|
||||
+ &brport_attr_group_fwd_mask,
|
||||
+ &brport_attr_neigh_suppress,
|
||||
+ &brport_attr_isolated,
|
||||
++ &brport_attr_bpdu_filter,
|
||||
+ &brport_attr_backup_port,
|
||||
+ NULL
|
||||
+ };
|
||||
+--- a/net/bridge/br_stp_bpdu.c
|
||||
++++ b/net/bridge/br_stp_bpdu.c
|
||||
+@@ -80,7 +80,8 @@ void br_send_config_bpdu(struct net_brid
|
||||
+ {
|
||||
+ unsigned char buf[35];
|
||||
+
|
||||
+- if (p->br->stp_enabled != BR_KERNEL_STP)
|
||||
++ if (p->br->stp_enabled != BR_KERNEL_STP ||
|
||||
++ (p->flags & BR_BPDU_FILTER))
|
||||
+ return;
|
||||
+
|
||||
+ buf[0] = 0;
|
||||
+@@ -125,7 +126,8 @@ void br_send_tcn_bpdu(struct net_bridge_
|
||||
+ {
|
||||
+ unsigned char buf[4];
|
||||
+
|
||||
+- if (p->br->stp_enabled != BR_KERNEL_STP)
|
||||
++ if (p->br->stp_enabled != BR_KERNEL_STP ||
|
||||
++ (p->flags & BR_BPDU_FILTER))
|
||||
+ return;
|
||||
+
|
||||
+ buf[0] = 0;
|
||||
+@@ -168,6 +170,9 @@ void br_stp_rcv(const struct stp_proto *
|
||||
+ if (!(br->dev->flags & IFF_UP))
|
||||
+ goto out;
|
||||
+
|
||||
++ if (p->flags & BR_BPDU_FILTER)
|
||||
++ goto out;
|
||||
++
|
||||
+ if (p->state == BR_STATE_DISABLED)
|
||||
+ goto out;
|
||||
+
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 8ba5feb6aaba50bda126db027490c7d37e428e3b Mon Sep 17 00:00:00 2001
|
||||
From: Stijn Tintel <stijn@linux-ipv6.be>
|
||||
Date: Fri, 20 Aug 2021 16:11:12 +0300
|
||||
Subject: [PATCH 15/27] uhttpd: add config option for json_script
|
||||
|
||||
Add a config option for json_script instead of unconditionally including
|
||||
all json files in /etc/uhttpd in every uhttpd instance. This makes it
|
||||
possible to configure a single instance with an unconditional redirect,
|
||||
which is currently not possible as it would render all other uhttpd
|
||||
instances unusable.
|
||||
|
||||
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
|
||||
---
|
||||
package/network/services/uhttpd/files/uhttpd.init | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/package/network/services/uhttpd/files/uhttpd.init b/package/network/services/uhttpd/files/uhttpd.init
|
||||
index 869f79bea2..7020912c6c 100755
|
||||
--- a/package/network/services/uhttpd/files/uhttpd.init
|
||||
+++ b/package/network/services/uhttpd/files/uhttpd.init
|
||||
@@ -195,7 +195,8 @@ start_instance()
|
||||
append_bool "$cfg" redirect_https "-q" 0
|
||||
}
|
||||
|
||||
- for file in /etc/uhttpd/*.json; do
|
||||
+ config_get json_script "$cfg" json_script
|
||||
+ for file in $json_script; do
|
||||
[ -s "$file" ] && procd_append_param command -H "$file"
|
||||
done
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
41
backports/0016-iwinfo-update-to-latest-git-HEAD.patch
Normal file
41
backports/0016-iwinfo-update-to-latest-git-HEAD.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
From 63281b982b3692828ff453dcb9e68b8e43d628e5 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Mon, 21 Jun 2021 12:53:28 +0200
|
||||
Subject: [PATCH 16/27] iwinfo: update to latest git HEAD
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/network/utils/iwinfo/Makefile | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile
|
||||
index 815c477988..d235f07da9 100644
|
||||
--- a/package/network/utils/iwinfo/Makefile
|
||||
+++ b/package/network/utils/iwinfo/Makefile
|
||||
@@ -11,12 +11,20 @@ PKG_RELEASE:=2.1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git
|
||||
-PKG_SOURCE_DATE:=2021-04-30
|
||||
-PKG_SOURCE_VERSION:=c45f0b584b4b86f8250f90ea19afca271c114fa2
|
||||
-PKG_MIRROR_HASH:=24ad04791254a0523cd15a4fec6116d9ff121e006c93e5e41459f91347b33ec2
|
||||
+PKG_SOURCE_DATE:=2021-06-09
|
||||
+PKG_SOURCE_VERSION:=c0414642fead263a4a6a686ad3cb7e965ec8a23a
|
||||
+PKG_MIRROR_HASH:=c5686bbae86753c53db03a686b034bbb80d31107cc359ebd8522ea1c82db35ea
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
+PKG_FLAGS := nonshared
|
||||
+
|
||||
+PKG_CONFIG_DEPENDS := \
|
||||
+ CONFIG_PACKAGE_kmod-brcm-wl \
|
||||
+ CONFIG_PACKAGE_kmod-brcm-wl-mini \
|
||||
+ CONFIG_PACKAGE_kmod-brcm-wl-mimo \
|
||||
+ CONFIG_PACKAGE_kmod-cfg80211
|
||||
+
|
||||
IWINFO_ABI_VERSION:=20210430
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
--
|
||||
2.25.1
|
||||
|
||||
62
backports/0017-netifd-update-to-latest-HEAD.patch
Normal file
62
backports/0017-netifd-update-to-latest-HEAD.patch
Normal file
@@ -0,0 +1,62 @@
|
||||
From 3bc625814c04a24cdf16587c2adb2060a77a5e1a Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 27 May 2021 13:24:47 +0200
|
||||
Subject: [PATCH 17/27] netifd: update to latest HEAD
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/network/config/netifd/Makefile | 8 +++-----
|
||||
.../netifd/patches/002-fix-dhcp-issue.patch | 17 +++++++++++++++++
|
||||
2 files changed, 20 insertions(+), 5 deletions(-)
|
||||
create mode 100644 package/network/config/netifd/patches/002-fix-dhcp-issue.patch
|
||||
|
||||
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
|
||||
index 4b5f110da2..13c1d96ed7 100644
|
||||
--- a/package/network/config/netifd/Makefile
|
||||
+++ b/package/network/config/netifd/Makefile
|
||||
@@ -5,16 +5,14 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
|
||||
-PKG_SOURCE_DATE:=2021-07-26
|
||||
-PKG_SOURCE_VERSION:=440eb0647708274cc8d7d9e7c2bb0cfdfba90023
|
||||
-PKG_MIRROR_HASH:=eed957036ab608fdc49bdf801fc5b4405fcd2a3a5e5d3343ec39898e156c10e9
|
||||
+PKG_SOURCE_DATE:=2021-09-01
|
||||
+PKG_SOURCE_VERSION:=300b1220fab38600f102bb8cfcc59a29ce41b095
|
||||
+PKG_MIRROR_HASH:=310fa90059795b1c956f9822db712ecc58bc19725b0f05f98c9e0a6824c8ca36
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
-PKG_BUILD_PARALLEL:=1
|
||||
-
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
diff --git a/package/network/config/netifd/patches/002-fix-dhcp-issue.patch b/package/network/config/netifd/patches/002-fix-dhcp-issue.patch
|
||||
new file mode 100644
|
||||
index 0000000000..6f1d2e708e
|
||||
--- /dev/null
|
||||
+++ b/package/network/config/netifd/patches/002-fix-dhcp-issue.patch
|
||||
@@ -0,0 +1,17 @@
|
||||
+Index: netifd-2019-08-05-5e02f944/interface.c
|
||||
+===================================================================
|
||||
+--- netifd-2019-08-05-5e02f944.orig/interface.c
|
||||
++++ netifd-2019-08-05-5e02f944/interface.c
|
||||
+@@ -424,7 +424,11 @@ interface_main_dev_cb(struct device_user
|
||||
+ interface_set_link_state(iface, false);
|
||||
+ break;
|
||||
+ case DEV_EVENT_TOPO_CHANGE:
|
||||
+- interface_proto_event(iface->proto, PROTO_CMD_RENEW, false);
|
||||
++ /* This renews the dhcp lease when the bridge adds/deletes a
|
||||
++ * new interface. It causes some dhcp servers to fail in
|
||||
++ * case where there are many interfaces being added to the
|
||||
++ * bridge frequently. Disabling this for now. */
|
||||
++ /* interface_proto_event(iface->proto, PROTO_CMD_RENEW, false); */
|
||||
+ return;
|
||||
+ default:
|
||||
+ break;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
4323
backports/0018-mac80211-update-to-latest-HEAD.patch
Normal file
4323
backports/0018-mac80211-update-to-latest-HEAD.patch
Normal file
File diff suppressed because it is too large
Load Diff
5810
backports/0019-hostapd-update-to-latest-HEAD.patch
Normal file
5810
backports/0019-hostapd-update-to-latest-HEAD.patch
Normal file
File diff suppressed because it is too large
Load Diff
170
backports/0020-procd-add-uxc-support.patch
Normal file
170
backports/0020-procd-add-uxc-support.patch
Normal file
@@ -0,0 +1,170 @@
|
||||
From aab305d662fa77ef4495574c096cb1e065c1908a Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Sun, 25 Jul 2021 13:32:37 +0200
|
||||
Subject: [PATCH 20/27] procd: add uxc support
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/system/procd/Makefile | 12 ++---
|
||||
package/system/procd/files/procd.sh | 79 +++++++++++++++++++++++++++++
|
||||
package/system/procd/files/uxc.init | 4 ++
|
||||
3 files changed, 89 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
|
||||
index 30d5adf427..98f1ed1775 100644
|
||||
--- a/package/system/procd/Makefile
|
||||
+++ b/package/system/procd/Makefile
|
||||
@@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
|
||||
-PKG_SOURCE_DATE:=2021-02-23
|
||||
-PKG_SOURCE_VERSION:=37eed131e9967a35f47bacb3437a9d3c8a57b3f4
|
||||
-PKG_MIRROR_HASH:=2b0131ff9055ccf987cbeb5f36c2c2585dc780999df6be312fbbbcd61ce676d4
|
||||
+PKG_SOURCE_DATE:=2021-08-15
|
||||
+PKG_SOURCE_VERSION:=104b49d6ab25a8cf067e6d8d1f2da7defb9876d4
|
||||
+PKG_MIRROR_HASH:=d13b566a14e84f6babe8b7d3dfb88e34c3dff0e97d7770d6fe71174685bca628
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
@@ -32,7 +32,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
ifeq ($(DUMP),)
|
||||
- STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5)
|
||||
+ STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | $(MKHASH) md5)
|
||||
endif
|
||||
|
||||
CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"
|
||||
@@ -82,7 +82,7 @@ endef
|
||||
define Package/procd-seccomp
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
- DEPENDS:=@(arm||armeb||mips||mipsel||i386||powerpc||x86_64) @!TARGET_uml \
|
||||
+ DEPENDS:=@(aarch64||arm||armeb||mips||mipsel||i386||powerpc||x86_64) @!TARGET_uml \
|
||||
@KERNEL_SECCOMP +libubox +libblobmsg-json
|
||||
TITLE:=OpenWrt process seccomp helper + utrace
|
||||
endef
|
||||
@@ -90,7 +90,7 @@ endef
|
||||
define Package/uxc
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
- DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json
|
||||
+ DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json +blockd +rpcd
|
||||
TITLE:=OpenWrt container management
|
||||
MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
|
||||
endef
|
||||
diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh
|
||||
index d86b7219da..3549a5a914 100644
|
||||
--- a/package/system/procd/files/procd.sh
|
||||
+++ b/package/system/procd/files/procd.sh
|
||||
@@ -329,6 +329,82 @@ _procd_add_config_trigger() {
|
||||
json_close_array
|
||||
}
|
||||
|
||||
+_procd_add_mount_trigger() {
|
||||
+ json_add_array
|
||||
+ _procd_add_array_data "$1"
|
||||
+ local action="$2"
|
||||
+ local multi=0
|
||||
+ shift ; shift
|
||||
+
|
||||
+ json_add_array
|
||||
+ _procd_add_array_data "if"
|
||||
+
|
||||
+ if [ "$2" ]; then
|
||||
+ json_add_array
|
||||
+ _procd_add_array_data "or"
|
||||
+ multi=1
|
||||
+ fi
|
||||
+
|
||||
+ while [ "$1" ]; do
|
||||
+ json_add_array
|
||||
+ _procd_add_array_data "eq" "target" "$1"
|
||||
+ shift
|
||||
+ json_close_array
|
||||
+ done
|
||||
+
|
||||
+ [ $multi = 1 ] && json_close_array
|
||||
+
|
||||
+ json_add_array
|
||||
+ _procd_add_array_data "run_script" /etc/init.d/$name $action
|
||||
+ json_close_array
|
||||
+
|
||||
+ json_close_array
|
||||
+ _procd_add_timeout
|
||||
+ json_close_array
|
||||
+}
|
||||
+
|
||||
+_procd_add_action_mount_trigger() {
|
||||
+ local script=$(readlink "$initscript")
|
||||
+ local name=$(basename ${script:-$initscript})
|
||||
+ local action="$1"
|
||||
+ local mpath
|
||||
+ shift
|
||||
+
|
||||
+ _procd_open_trigger
|
||||
+ _procd_add_mount_trigger mount.add $action "$@"
|
||||
+ _procd_close_trigger
|
||||
+}
|
||||
+
|
||||
+procd_get_mountpoints() {
|
||||
+ (
|
||||
+ __procd_check_mount() {
|
||||
+ local cfg="$1"
|
||||
+ local path="${2%%/}/"
|
||||
+ local target
|
||||
+ config_get target "$cfg" target
|
||||
+ target="${target%%/}/"
|
||||
+ [ "$path" != "${path##$target}" ] && echo "${target%%/}"
|
||||
+ }
|
||||
+
|
||||
+ config_load fstab
|
||||
+ for mpath in "$@"; do
|
||||
+ config_foreach __procd_check_mount mount "$mpath"
|
||||
+ done
|
||||
+ ) | sort -u
|
||||
+}
|
||||
+
|
||||
+_procd_add_restart_mount_trigger() {
|
||||
+ local mountpoints="$(procd_get_mountpoints "$@")"
|
||||
+ [ "${mountpoints//[[:space:]]}" ] &&
|
||||
+ _procd_add_action_mount_trigger restart $mountpoints
|
||||
+}
|
||||
+
|
||||
+_procd_add_reload_mount_trigger() {
|
||||
+ local mountpoints="$(procd_get_mountpoints "$@")"
|
||||
+ [ "${mountpoints//[[:space:]]}" ] &&
|
||||
+ _procd_add_action_mount_trigger reload $mountpoints
|
||||
+}
|
||||
+
|
||||
_procd_add_raw_trigger() {
|
||||
json_add_array
|
||||
_procd_add_array_data "$1"
|
||||
@@ -560,8 +636,11 @@ _procd_wrapper \
|
||||
procd_add_raw_trigger \
|
||||
procd_add_config_trigger \
|
||||
procd_add_interface_trigger \
|
||||
+ procd_add_mount_trigger \
|
||||
procd_add_reload_trigger \
|
||||
procd_add_reload_interface_trigger \
|
||||
+ procd_add_reload_mount_trigger \
|
||||
+ procd_add_restart_mount_trigger \
|
||||
procd_open_trigger \
|
||||
procd_close_trigger \
|
||||
procd_open_instance \
|
||||
diff --git a/package/system/procd/files/uxc.init b/package/system/procd/files/uxc.init
|
||||
index 035c8b0b9e..1e75b796f8 100644
|
||||
--- a/package/system/procd/files/uxc.init
|
||||
+++ b/package/system/procd/files/uxc.init
|
||||
@@ -16,3 +16,7 @@ boot() {
|
||||
__BOOT_UXC=1
|
||||
start
|
||||
}
|
||||
+
|
||||
+service_triggers() {
|
||||
+ procd_add_raw_trigger "mount.add" 3000 /etc/init.d/uxc boot
|
||||
+}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
174
backports/0021-build-create-APK-files-parrallel-to-IPK.patch
Normal file
174
backports/0021-build-create-APK-files-parrallel-to-IPK.patch
Normal file
@@ -0,0 +1,174 @@
|
||||
From 23c15e2536d0fa5ed81c5bdfe7623d3370dca997 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Spooren <mail@aparcar.org>
|
||||
Date: Fri, 2 Oct 2020 23:30:30 -1000
|
||||
Subject: [PATCH 21/27] build: create APK files parrallel to IPK
|
||||
|
||||
Create APK files based on the folder and control files of IPK packages.
|
||||
|
||||
Signed-off-by: Paul Spooren <mail@aparcar.org>
|
||||
---
|
||||
include/package-ipkg.mk | 48 +++++++++++++++++++++++++------------
|
||||
package/Makefile | 2 ++
|
||||
package/base-files/Makefile | 4 ++++
|
||||
rules.mk | 2 ++
|
||||
scripts/apk-make-index.sh | 20 ++++++++++++++++
|
||||
5 files changed, 61 insertions(+), 15 deletions(-)
|
||||
create mode 100755 scripts/apk-make-index.sh
|
||||
|
||||
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
|
||||
index e972b7de0b..5c31b1774f 100644
|
||||
--- a/include/package-ipkg.mk
|
||||
+++ b/include/package-ipkg.mk
|
||||
@@ -102,6 +102,7 @@ ifeq ($(DUMP),)
|
||||
ABIV_$(1):=$(call FormatABISuffix,$(1),$(ABI_VERSION))
|
||||
PDIR_$(1):=$(call FeedPackageDir,$(1))
|
||||
IPKG_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))_$(VERSION)_$(PKGARCH).ipk
|
||||
+ APK_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))_$(VERSION)_$(PKGARCH).apk
|
||||
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
|
||||
KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
|
||||
|
||||
@@ -200,7 +201,7 @@ $(_endef)
|
||||
$(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk
|
||||
@rm -rf $$(IDIR_$(1)); \
|
||||
$$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1))))
|
||||
- mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
|
||||
+ mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1)) $(PKG_INFO_DIR)
|
||||
$(call Package/$(1)/install,$$(IDIR_$(1)))
|
||||
$(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay)
|
||||
$(call Package/$(1)/install-overlay,$$(IDIR_$(1))/rootfs-overlay)
|
||||
@@ -226,6 +227,37 @@ $(_endef)
|
||||
) || true \
|
||||
)
|
||||
endif
|
||||
+
|
||||
+ ifneq ($$(KEEP_$(1)),)
|
||||
+ @( \
|
||||
+ keepfiles=""; \
|
||||
+ for x in $$(KEEP_$(1)); do \
|
||||
+ [ -f "$$(IDIR_$(1))/$$$$x" ] || keepfiles="$$$${keepfiles:+$$$$keepfiles }$$$$x"; \
|
||||
+ done; \
|
||||
+ [ -z "$$$$keepfiles" ] || { \
|
||||
+ mkdir -p $$(IDIR_$(1))/lib/upgrade/keep.d; \
|
||||
+ for x in $$$$keepfiles; do echo $$$$x >> $$(IDIR_$(1))/lib/upgrade/keep.d/$(1); done; \
|
||||
+ }; \
|
||||
+ )
|
||||
+ endif
|
||||
+
|
||||
+ $(INSTALL_DIR) $$(PDIR_$(1))
|
||||
+
|
||||
+ $(FAKEROOT) apk mkpkg \
|
||||
+ --info "name:$(1)" \
|
||||
+ --info "version:$(VERSION)" \
|
||||
+ --info "description:$()" \
|
||||
+ --info "arch:$(PKGARCH)" \
|
||||
+ --info "license:$(LICENSE)" \
|
||||
+ --info "origin:$(SOURCE)" \
|
||||
+ --info "maintainer:$(MAINTAINER)" \
|
||||
+ $$(foreach dep,$$(Package/$(1)/DEPENDS),--info "depends:$$(subst $$(comma),,$$(dep))") \
|
||||
+ --files "$$(IDIR_$(1))" \
|
||||
+ --output "$$(APK_$(1))" \
|
||||
+ --sign "$(BUILD_KEY_APK_SEC)"
|
||||
+
|
||||
+ mkdir -p $$(IDIR_$(1))/CONTROL
|
||||
+
|
||||
(cd $$(IDIR_$(1))/CONTROL; \
|
||||
( \
|
||||
echo "$$$$CONTROL"; \
|
||||
@@ -249,20 +281,6 @@ $(_endef)
|
||||
$($(1)_COMMANDS) \
|
||||
)
|
||||
|
||||
- ifneq ($$(KEEP_$(1)),)
|
||||
- @( \
|
||||
- keepfiles=""; \
|
||||
- for x in $$(KEEP_$(1)); do \
|
||||
- [ -f "$$(IDIR_$(1))/$$$$x" ] || keepfiles="$$$${keepfiles:+$$$$keepfiles }$$$$x"; \
|
||||
- done; \
|
||||
- [ -z "$$$$keepfiles" ] || { \
|
||||
- mkdir -p $$(IDIR_$(1))/lib/upgrade/keep.d; \
|
||||
- for x in $$$$keepfiles; do echo $$$$x >> $$(IDIR_$(1))/lib/upgrade/keep.d/$(1); done; \
|
||||
- }; \
|
||||
- )
|
||||
- endif
|
||||
-
|
||||
- $(INSTALL_DIR) $$(PDIR_$(1))
|
||||
$(FAKEROOT) $(SCRIPT_DIR)/ipkg-build -m "$(FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1))
|
||||
@[ -f $$(IPKG_$(1)) ]
|
||||
|
||||
diff --git a/package/Makefile b/package/Makefile
|
||||
index ec503dc527..18a19fff13 100644
|
||||
--- a/package/Makefile
|
||||
+++ b/package/Makefile
|
||||
@@ -60,6 +60,7 @@ $(curdir)/merge-index: $(curdir)/merge
|
||||
|
||||
ifndef SDK
|
||||
$(curdir)/compile: $(curdir)/system/opkg/host/compile
|
||||
+ $(patsubst %,$(curdir)/%/compile,$(filter-out %/apk/host,$($(curdir)/builddirs))): $(curdir)/system/apk/host/compile
|
||||
endif
|
||||
|
||||
$(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(if $(CONFIG_TARGET_PER_DEVICE_ROOTFS),$(curdir)/merge-index)
|
||||
@@ -84,6 +85,7 @@ $(curdir)/index: FORCE
|
||||
@for d in $(PACKAGE_SUBDIRS); do ( \
|
||||
mkdir -p $$d; \
|
||||
cd $$d || continue; \
|
||||
+ $(SCRIPT_DIR)/apk-make-index.sh . 2>&1; \
|
||||
$(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \
|
||||
grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require|SourceDateEpoch)' Packages.manifest > Packages; \
|
||||
case "$$(((64 + $$(stat -L -c%s Packages)) % 128))" in 110|111) \
|
||||
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
|
||||
index 8a1ddf96f5..9db4812981 100644
|
||||
--- a/package/base-files/Makefile
|
||||
+++ b/package/base-files/Makefile
|
||||
@@ -107,6 +107,10 @@ ifdef CONFIG_SIGNED_PACKAGES
|
||||
[ -s $(BUILD_KEY).ucert ] || \
|
||||
$(STAGING_DIR_HOST)/bin/ucert -I -c $(BUILD_KEY).ucert -p $(BUILD_KEY).pub -s $(BUILD_KEY)
|
||||
|
||||
+ [ -s $(BUILD_KEY_APK_SEC) -a -s $(BUILD_KEY_APK_PUB) ] || \
|
||||
+ openssl ecparam -name prime256v1 -genkey -noout -out $(BUILD_KEY_APK_SEC); \
|
||||
+ openssl ec -in $(BUILD_KEY_APK_SEC) -pubout > $(BUILD_KEY_APK_PUB)
|
||||
+
|
||||
endef
|
||||
|
||||
ifndef CONFIG_BUILDBOT
|
||||
diff --git a/rules.mk b/rules.mk
|
||||
index f31d9bb113..de81b65d46 100644
|
||||
--- a/rules.mk
|
||||
+++ b/rules.mk
|
||||
@@ -258,6 +258,8 @@ else
|
||||
endif
|
||||
|
||||
BUILD_KEY=$(TOPDIR)/key-build
|
||||
+BUILD_KEY_APK_SEC=$(TOPDIR)/private-key.pem
|
||||
+BUILD_KEY_APK_PUB=$(TOPDIR)/public-key.pem
|
||||
|
||||
FAKEROOT:=$(STAGING_DIR_HOST)/bin/fakeroot
|
||||
|
||||
diff --git a/scripts/apk-make-index.sh b/scripts/apk-make-index.sh
|
||||
new file mode 100755
|
||||
index 0000000000..df1f1a2e2b
|
||||
--- /dev/null
|
||||
+++ b/scripts/apk-make-index.sh
|
||||
@@ -0,0 +1,20 @@
|
||||
+#!/usr/bin/env bash
|
||||
+set -e
|
||||
+
|
||||
+pkg_dir=$1
|
||||
+
|
||||
+if [ -z "$pkg_dir" ] || [ ! -d "$pkg_dir" ]; then
|
||||
+ echo "Usage: apk-make-index <package_directory>" >&2
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+(
|
||||
+ cd "$pkg_dir" || exit 1
|
||||
+ GLOBIGNORE="kernel*:libc*"
|
||||
+ set -- *.apk
|
||||
+ if [ "$1" = '*.apk' ]; then
|
||||
+ echo "No APK packages found"
|
||||
+ fi
|
||||
+ apk index --output APKINDEX.tar.gz "$@"
|
||||
+ unset GLOBIGNORE
|
||||
+)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
69
backports/0022-fstools-update-to-git-HEAD.patch
Normal file
69
backports/0022-fstools-update-to-git-HEAD.patch
Normal file
@@ -0,0 +1,69 @@
|
||||
From 8e8b3e443a7f1d0644f43888c8683698f26d4d13 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sun, 25 Jul 2021 01:20:31 +0100
|
||||
Subject: [PATCH 22/27] fstools: update to git HEAD
|
||||
|
||||
bad1835 fstools: add partname volume driver
|
||||
19d7d93 libfstools: partname: several fixes
|
||||
3c38f0c libfstools: fix build with glibc
|
||||
d05ad93 libfstools: remove superflus include
|
||||
964d1e3 partname: allow skipping existing 'rootfs_data' partition
|
||||
c44b40b overlay: fix syncronizing typo
|
||||
b5397a1 fstools: block: fix segfault on mount with no target
|
||||
bd7cc8d block: use dynamically allocated target string
|
||||
6d8450e blockd: use allocated strings instead of fixed buffers
|
||||
d47909e libblkid-tiny: fix buffer overflow
|
||||
67d2297 block: match device path instead of assuming /dev/%s
|
||||
2aeba88 block: allow autofs and umount commands also on MTD/UBI
|
||||
3d40a1b blockd: add missing #define _GNU_SOURCE
|
||||
4d4dcfb blockd: detect mountpoint of /dev/mapper/*
|
||||
2f42515 block: resolve /dev/mapper/* name for /dev/dm-0 when hotplugging
|
||||
39558a1 blockd: also send ubus notification on mount hotplug
|
||||
3386b6b blockd: fix trigger name
|
||||
cdc9939 blockd: move to its own POSIX process group
|
||||
59f7c11 blockd: create mountpoint parent folder if needed
|
||||
9cc96af Revert "block: resolve /dev/mapper/* name for /dev/dm-0 when hotplugging"
|
||||
06334ac Revert "blockd: detect mountpoint of /dev/mapper/*"
|
||||
9ab3551 block: use /dev/dm-* instead of /dev/mapper/*
|
||||
5114595 block: allow remove hotplug event to arrive at blockd
|
||||
a846c6b blockd: fix length of timeout int passed to ioctl
|
||||
1d681ca block: support umount device basename
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
package/system/fstools/Makefile | 6 +++---
|
||||
package/system/fstools/files/blockd.init | 1 +
|
||||
2 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile
|
||||
index 2da508d541..b582a17bae 100644
|
||||
--- a/package/system/fstools/Makefile
|
||||
+++ b/package/system/fstools/Makefile
|
||||
@@ -12,9 +12,9 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git
|
||||
-PKG_MIRROR_HASH:=a485792d90c71cd4fb396ce97f42a57ee4d2a3d78e5f3fd0748270ffb14209e6
|
||||
-PKG_SOURCE_DATE:=2021-01-04
|
||||
-PKG_SOURCE_VERSION:=c53b18820756f6f32ad0782d3bf489422b7c4ad3
|
||||
+PKG_MIRROR_HASH:=6a457b812166e04e2244ee1be92a4957666b5d1554315c0e18db1b30376cc617
|
||||
+PKG_SOURCE_DATE:=2021-07-28
|
||||
+PKG_SOURCE_VERSION:=cc63933faedd8d4fcdabb872cf4661ac04fe4ba2
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
diff --git a/package/system/fstools/files/blockd.init b/package/system/fstools/files/blockd.init
|
||||
index a4ce57d40d..bdd8bbf622 100755
|
||||
--- a/package/system/fstools/files/blockd.init
|
||||
+++ b/package/system/fstools/files/blockd.init
|
||||
@@ -16,6 +16,7 @@ reload_service() {
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
+ procd_set_param watch block
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
40
backports/0023-tools-libressl-update-to-3.3.3.patch
Normal file
40
backports/0023-tools-libressl-update-to-3.3.3.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
From 873052b99d6597209957ec32898fa56324cf34a4 Mon Sep 17 00:00:00 2001
|
||||
From: Rosen Penev <rosenp@gmail.com>
|
||||
Date: Sat, 19 Jun 2021 14:45:11 -0700
|
||||
Subject: [PATCH 23/27] tools/libressl: update to 3.3.3
|
||||
|
||||
Fix wrong FPIC variable usage. Fixes compilation under sparc64 host.
|
||||
|
||||
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
||||
(cherry picked from commit bf4dbbb55e2b8e23f186e1334f1e9ce6a3a8ddfe)
|
||||
---
|
||||
tools/libressl/Makefile | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tools/libressl/Makefile b/tools/libressl/Makefile
|
||||
index 2b5a33450c..e25b5661ee 100644
|
||||
--- a/tools/libressl/Makefile
|
||||
+++ b/tools/libressl/Makefile
|
||||
@@ -8,8 +8,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libressl
|
||||
-PKG_VERSION:=3.3.1
|
||||
-PKG_HASH:=a6d331865e0164a13ac85a228e52517f7cf8f8488f2f95f34e7857302f97cfdb
|
||||
+PKG_VERSION:=3.3.3
|
||||
+PKG_HASH:=a471565b36ccd1a70d0bd7d37c6e95c43a26a62829b487d9d2cdebfe58be3066
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_CPE_ID:=cpe:/a:openbsd:libressl
|
||||
@@ -25,7 +25,7 @@ include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOSTCC := $(HOSTCC_NOCACHE)
|
||||
HOST_CONFIGURE_ARGS += --enable-static --disable-shared --disable-tests
|
||||
-HOST_CFLAGS += $(FPIC)
|
||||
+HOST_CFLAGS += $(HOST_FPIC)
|
||||
|
||||
ifeq ($(GNU_HOST_NAME),x86_64-linux-gnux32)
|
||||
HOST_CONFIGURE_ARGS += --disable-asm
|
||||
--
|
||||
2.25.1
|
||||
|
||||
1213
backports/0024-uvol-backport-package.patch
Normal file
1213
backports/0024-uvol-backport-package.patch
Normal file
File diff suppressed because it is too large
Load Diff
312
backports/0025-apk-backport-package.patch
Normal file
312
backports/0025-apk-backport-package.patch
Normal file
@@ -0,0 +1,312 @@
|
||||
From bf98d3c1de524ca50cbc09f825a4b0648e353624 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Fri, 13 Aug 2021 08:47:11 +0200
|
||||
Subject: [PATCH 25/27] apk: backport package
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/system/apk/Makefile | 93 +++++++++++++++++++
|
||||
...vel@lists.alpinelinux.org-4a6a0840.rsa.pub | 9 ++
|
||||
...vel@lists.alpinelinux.org-5243ef4b.rsa.pub | 9 ++
|
||||
...vel@lists.alpinelinux.org-5261cecb.rsa.pub | 9 ++
|
||||
package/system/apk/files/alpine-repositories | 3 +
|
||||
.../apk/patches/000-Makefile-version.patch | 11 +++
|
||||
.../patches/0001-remove-doc-generation.patch | 21 +++++
|
||||
package/system/apk/patches/100-link.patch | 16 ++++
|
||||
package/system/apk/patches/100-phtread.patch | 12 +++
|
||||
...ude-limits.h-to-fix-build-with-glibc.patch | 20 ++++
|
||||
package/system/apk/test.sh | 9 ++
|
||||
11 files changed, 212 insertions(+)
|
||||
create mode 100644 package/system/apk/Makefile
|
||||
create mode 100644 package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub
|
||||
create mode 100644 package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub
|
||||
create mode 100644 package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub
|
||||
create mode 100644 package/system/apk/files/alpine-repositories
|
||||
create mode 100644 package/system/apk/patches/000-Makefile-version.patch
|
||||
create mode 100644 package/system/apk/patches/0001-remove-doc-generation.patch
|
||||
create mode 100644 package/system/apk/patches/100-link.patch
|
||||
create mode 100644 package/system/apk/patches/100-phtread.patch
|
||||
create mode 100644 package/system/apk/patches/100-tar-include-limits.h-to-fix-build-with-glibc.patch
|
||||
create mode 100644 package/system/apk/test.sh
|
||||
|
||||
diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile
|
||||
new file mode 100644
|
||||
index 0000000000..335f50c155
|
||||
--- /dev/null
|
||||
+++ b/package/system/apk/Makefile
|
||||
@@ -0,0 +1,93 @@
|
||||
+include $(TOPDIR)/rules.mk
|
||||
+
|
||||
+PKG_NAME:=apk
|
||||
+PKG_VERSION:=3.0.0_pre0
|
||||
+
|
||||
+PKG_SOURCE_PROTO:=git
|
||||
+PKG_SOURCE_URL:=https://git.alpinelinux.org/apk-tools.git
|
||||
+PKG_SOURCE_DATE:=2021-08-17
|
||||
+PKG_SOURCE_VERSION:=a46043bcc4cc15b456ef1eac5c5f9d93bd905d53
|
||||
+PKG_MIRROR_HASH:=e16fd04b18043e78a177acd8c6958fa03fd1484b62c879c2dd0bed8ce9c50625
|
||||
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_DATE)-$(call version_abbrev,$(PKG_SOURCE_VERSION))
|
||||
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_SOURCE_SUBDIR)
|
||||
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz
|
||||
+PKG_RELEASE:=r$(PKG_SOURCE_DATE)-$(call version_abbrev,$(PKG_SOURCE_VERSION))-$(AUTORELEASE)
|
||||
+
|
||||
+PKG_MAINTAINER:=Paul Spooren <mail@aparcar.org>
|
||||
+PKG_LICENSE:=GPL-2.0-only
|
||||
+PKG_LICENSE_FILES:=LICENSE
|
||||
+
|
||||
+PKG_INSTALL:=1
|
||||
+PKG_BUILD_PARALLEL:=1
|
||||
+
|
||||
+HOST_BUILD_DEPENDS:=lua/host lua-lzlib/host
|
||||
+PKG_BUILD_DEPENDS:=$(HOST_BUILD_DEPENDS)
|
||||
+
|
||||
+include $(INCLUDE_DIR)/package.mk
|
||||
+include $(INCLUDE_DIR)/host-build.mk
|
||||
+
|
||||
+define Package/apk
|
||||
+ SECTION:=utils
|
||||
+ CATEGORY:=Utilities
|
||||
+ TITLE:=apk package manager
|
||||
+ DEPENDS:=+liblua +libopenssl +zlib @!arc
|
||||
+ URL:=$(PKG_SOURCE_URL)
|
||||
+endef
|
||||
+
|
||||
+define Package/alpine-keys
|
||||
+ SECTION:=utils
|
||||
+ CATEGORY:=Utilities
|
||||
+ TITLE:=Alpine apk public signing keys
|
||||
+ DEPENDS:=apk
|
||||
+endef
|
||||
+
|
||||
+define Package/alpine-repositories
|
||||
+ SECTION:=utils
|
||||
+ CATEGORY:=Utilities
|
||||
+ TITLE:=Official Alpine repositories
|
||||
+ DEPENDS:=apk
|
||||
+endef
|
||||
+
|
||||
+MAKE_FLAGS += \
|
||||
+ LUA=$(STAGING_DIR_HOSTPKG)/bin/lua \
|
||||
+ LUA_VERSION=5.1 \
|
||||
+ LUA_PC=lua
|
||||
+
|
||||
+HOST_MAKE_FLAGS += \
|
||||
+ LUA=$(STAGING_DIR_HOSTPKG)/bin/lua \
|
||||
+ LUA_VERSION=5.1 \
|
||||
+ DESTDIR=$(STAGING_DIR_HOSTPKG) \
|
||||
+ SBINDIR=/bin \
|
||||
+ PREFIX=
|
||||
+
|
||||
+HOST_LDFLAGS+=-Wl,-rpath=$(STAGING_DIR_HOSTPKG)/lib -lpthread
|
||||
+
|
||||
+define Package/apk/install
|
||||
+ $(INSTALL_DIR) $(1)/lib/apk/db
|
||||
+
|
||||
+ $(INSTALL_DIR) $(1)/bin
|
||||
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/apk $(1)/bin/apk
|
||||
+
|
||||
+ $(INSTALL_DIR) $(1)/usr/lib
|
||||
+ $(CP) $(PKG_INSTALL_DIR)/lib/*.so.* $(1)/usr/lib/
|
||||
+
|
||||
+ $(INSTALL_DIR) $(1)/etc/apk/
|
||||
+ echo $(ARCH) > $(1)/etc/apk/arch
|
||||
+ touch $(1)/etc/apk/world
|
||||
+endef
|
||||
+
|
||||
+define Package/alpine-keys/install
|
||||
+ $(INSTALL_DIR) $(1)/etc/apk/keys
|
||||
+ $(INSTALL_DATA) ./files/alpine-keys/* $(1)/etc/apk/keys
|
||||
+endef
|
||||
+
|
||||
+define Package/alpine-repositories/install
|
||||
+ $(INSTALL_DIR) $(1)/etc/apk/keys
|
||||
+ $(INSTALL_DATA) ./files/alpine-repositories $(1)/etc/apk/repositories
|
||||
+endef
|
||||
+
|
||||
+$(eval $(call BuildPackage,apk))
|
||||
+$(eval $(call BuildPackage,alpine-keys))
|
||||
+$(eval $(call BuildPackage,alpine-repositories))
|
||||
+$(eval $(call HostBuild))
|
||||
diff --git a/package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub b/package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub
|
||||
new file mode 100644
|
||||
index 0000000000..bb4bdc80fd
|
||||
--- /dev/null
|
||||
+++ b/package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub
|
||||
@@ -0,0 +1,9 @@
|
||||
+-----BEGIN PUBLIC KEY-----
|
||||
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1yHJxQgsHQREclQu4Ohe
|
||||
+qxTxd1tHcNnvnQTu/UrTky8wWvgXT+jpveroeWWnzmsYlDI93eLI2ORakxb3gA2O
|
||||
+Q0Ry4ws8vhaxLQGC74uQR5+/yYrLuTKydFzuPaS1dK19qJPXB8GMdmFOijnXX4SA
|
||||
+jixuHLe1WW7kZVtjL7nufvpXkWBGjsfrvskdNA/5MfxAeBbqPgaq0QMEfxMAn6/R
|
||||
+L5kNepi/Vr4S39Xvf2DzWkTLEK8pcnjNkt9/aafhWqFVW7m3HCAII6h/qlQNQKSo
|
||||
+GuH34Q8GsFG30izUENV9avY7hSLq7nggsvknlNBZtFUcmGoQrtx3FmyYsIC8/R+B
|
||||
+ywIDAQAB
|
||||
+-----END PUBLIC KEY-----
|
||||
diff --git a/package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub b/package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub
|
||||
new file mode 100644
|
||||
index 0000000000..6cbfad7441
|
||||
--- /dev/null
|
||||
+++ b/package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub
|
||||
@@ -0,0 +1,9 @@
|
||||
+-----BEGIN PUBLIC KEY-----
|
||||
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvNijDxJ8kloskKQpJdx+
|
||||
+mTMVFFUGDoDCbulnhZMJoKNkSuZOzBoFC94omYPtxnIcBdWBGnrm6ncbKRlR+6oy
|
||||
+DO0W7c44uHKCFGFqBhDasdI4RCYP+fcIX/lyMh6MLbOxqS22TwSLhCVjTyJeeH7K
|
||||
+aA7vqk+QSsF4TGbYzQDDpg7+6aAcNzg6InNePaywA6hbT0JXbxnDWsB+2/LLSF2G
|
||||
+mnhJlJrWB1WGjkz23ONIWk85W4S0XB/ewDefd4Ly/zyIciastA7Zqnh7p3Ody6Q0
|
||||
+sS2MJzo7p3os1smGjUF158s6m/JbVh4DN6YIsxwl2OjDOz9R0OycfJSDaBVIGZzg
|
||||
+cQIDAQAB
|
||||
+-----END PUBLIC KEY-----
|
||||
diff --git a/package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub b/package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub
|
||||
new file mode 100644
|
||||
index 0000000000..83f0658e9c
|
||||
--- /dev/null
|
||||
+++ b/package/system/apk/files/alpine-keys/alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub
|
||||
@@ -0,0 +1,9 @@
|
||||
+-----BEGIN PUBLIC KEY-----
|
||||
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwlzMkl7b5PBdfMzGdCT0
|
||||
+cGloRr5xGgVmsdq5EtJvFkFAiN8Ac9MCFy/vAFmS8/7ZaGOXoCDWbYVLTLOO2qtX
|
||||
+yHRl+7fJVh2N6qrDDFPmdgCi8NaE+3rITWXGrrQ1spJ0B6HIzTDNEjRKnD4xyg4j
|
||||
+g01FMcJTU6E+V2JBY45CKN9dWr1JDM/nei/Pf0byBJlMp/mSSfjodykmz4Oe13xB
|
||||
+Ca1WTwgFykKYthoLGYrmo+LKIGpMoeEbY1kuUe04UiDe47l6Oggwnl+8XD1MeRWY
|
||||
+sWgj8sF4dTcSfCMavK4zHRFFQbGp/YFJ/Ww6U9lA3Vq0wyEI6MCMQnoSMFwrbgZw
|
||||
+wwIDAQAB
|
||||
+-----END PUBLIC KEY-----
|
||||
diff --git a/package/system/apk/files/alpine-repositories b/package/system/apk/files/alpine-repositories
|
||||
new file mode 100644
|
||||
index 0000000000..5babbb23b4
|
||||
--- /dev/null
|
||||
+++ b/package/system/apk/files/alpine-repositories
|
||||
@@ -0,0 +1,3 @@
|
||||
+https://dl-cdn.alpinelinux.org/alpine/edge/main
|
||||
+https://dl-cdn.alpinelinux.org/alpine/edge/community
|
||||
+
|
||||
diff --git a/package/system/apk/patches/000-Makefile-version.patch b/package/system/apk/patches/000-Makefile-version.patch
|
||||
new file mode 100644
|
||||
index 0000000000..2e7f5b0f15
|
||||
--- /dev/null
|
||||
+++ b/package/system/apk/patches/000-Makefile-version.patch
|
||||
@@ -0,0 +1,11 @@
|
||||
+--- a/Makefile
|
||||
++++ b/Makefile
|
||||
+@@ -4,7 +4,7 @@
|
||||
+ -include config.mk
|
||||
+
|
||||
+ PACKAGE := apk-tools
|
||||
+-VERSION := 2.12.0
|
||||
++VERSION := 3.0.0_pre0
|
||||
+
|
||||
+ export VERSION
|
||||
+
|
||||
diff --git a/package/system/apk/patches/0001-remove-doc-generation.patch b/package/system/apk/patches/0001-remove-doc-generation.patch
|
||||
new file mode 100644
|
||||
index 0000000000..dee05c56f2
|
||||
--- /dev/null
|
||||
+++ b/package/system/apk/patches/0001-remove-doc-generation.patch
|
||||
@@ -0,0 +1,21 @@
|
||||
+From b05a93c48fdbb50f0c464310dc2ce45777d32ea2 Mon Sep 17 00:00:00 2001
|
||||
+From: Paul Spooren <mail@aparcar.org>
|
||||
+Date: Fri, 2 Oct 2020 14:08:52 -1000
|
||||
+Subject: [PATCH] remove doc generation
|
||||
+
|
||||
+Signed-off-by: Paul Spooren <mail@aparcar.org>
|
||||
+---
|
||||
+ Makefile | 2 +-
|
||||
+ 1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
+
|
||||
+--- a/Makefile
|
||||
++++ b/Makefile
|
||||
+@@ -25,7 +25,7 @@ export DESTDIR SBINDIR LIBDIR CONFDIR MA
|
||||
+ ##
|
||||
+ # Top-level subdirs
|
||||
+
|
||||
+-subdirs := libfetch/ src/ doc/
|
||||
++subdirs := libfetch/ src/
|
||||
+
|
||||
+ ##
|
||||
+ # Include all rules and stuff
|
||||
diff --git a/package/system/apk/patches/100-link.patch b/package/system/apk/patches/100-link.patch
|
||||
new file mode 100644
|
||||
index 0000000000..9cae2787d9
|
||||
--- /dev/null
|
||||
+++ b/package/system/apk/patches/100-link.patch
|
||||
@@ -0,0 +1,16 @@
|
||||
+diff -urN apk-2021-08-17-a46043bc.orig/src/Makefile apk-2021-08-17-a46043bc/src/Makefile
|
||||
+--- apk-2021-08-17-a46043bc.orig/src/Makefile 2021-08-17 14:21:04.117760513 +0200
|
||||
++++ apk-2021-08-17-a46043bc/src/Makefile 2021-08-17 14:21:16.653830180 +0200
|
||||
+@@ -65,7 +65,11 @@
|
||||
+ app_convdb.o app_convndx.o app_del.o app_dot.o app_extract.o app_fetch.o \
|
||||
+ app_fix.o app_index.o app_info.o app_list.o app_manifest.o app_mkndx.o \
|
||||
+ app_mkpkg.o app_policy.o app_update.o app_upgrade.o app_search.o \
|
||||
+- app_stats.o app_verify.o app_version.o app_vertest.o applet.o
|
||||
++ app_stats.o app_verify.o app_version.o app_vertest.o applet.o \
|
||||
++ adb.o adb_comp.o adb_walk_adb.o adb_walk_genadb.o adb_walk_gentext.o adb_walk_text.o apk_adb.o \
|
||||
++ atom.o blob.o commit.o common.o context.o crypto_openssl.o database.o hash.o \
|
||||
++ extract.o extract_v2.o extract_v3.o io.o io_gunzip.o io_url.o tar.o \
|
||||
++ package.o pathbuilder.o print.o solver.o trust.o version.o
|
||||
+
|
||||
+ ifeq ($(ADB),y)
|
||||
+ libapk.so.$(libapk_soname)-objs += apk_adb.o
|
||||
diff --git a/package/system/apk/patches/100-phtread.patch b/package/system/apk/patches/100-phtread.patch
|
||||
new file mode 100644
|
||||
index 0000000000..c252e14dc1
|
||||
--- /dev/null
|
||||
+++ b/package/system/apk/patches/100-phtread.patch
|
||||
@@ -0,0 +1,12 @@
|
||||
+diff -urN apk-2021-07-23-3d203e8f.orig/src/Makefile apk-2021-07-23-3d203e8f/src/Makefile
|
||||
+--- apk-2021-07-23-3d203e8f.orig/src/Makefile 2021-07-25 12:55:05.576564663 +0200
|
||||
++++ apk-2021-07-23-3d203e8f/src/Makefile 2021-07-25 12:55:48.660862181 +0200
|
||||
+@@ -87,7 +87,7 @@
|
||||
+ apk.static-libs := $(apk-static-libs)
|
||||
+ LDFLAGS_apk.static := -static
|
||||
+ LIBS_apk.static := -Wl,--as-needed -ldl -Wl,--no-as-needed
|
||||
+-LDFLAGS_apk += -L$(obj)
|
||||
++LDFLAGS_apk += -L$(obj) -pthread
|
||||
+ LDFLAGS_apk-test += -L$(obj)
|
||||
+
|
||||
+ CFLAGS_ALL += $(OPENSSL_CFLAGS) $(ZLIB_CFLAGS)
|
||||
diff --git a/package/system/apk/patches/100-tar-include-limits.h-to-fix-build-with-glibc.patch b/package/system/apk/patches/100-tar-include-limits.h-to-fix-build-with-glibc.patch
|
||||
new file mode 100644
|
||||
index 0000000000..43ec7d5f1a
|
||||
--- /dev/null
|
||||
+++ b/package/system/apk/patches/100-tar-include-limits.h-to-fix-build-with-glibc.patch
|
||||
@@ -0,0 +1,20 @@
|
||||
+From c72ea983e287ec1d8b1f2b3aab1bf40aa7a30b03 Mon Sep 17 00:00:00 2001
|
||||
+From: Daniel Golle <daniel@makrotopia.org>
|
||||
+Date: Wed, 4 Aug 2021 21:37:40 +0100
|
||||
+Subject: [PATCH] tar: include <limits.h> to fix build with glibc
|
||||
+
|
||||
+Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
+---
|
||||
+ src/tar.c | 1 +
|
||||
+ 1 file changed, 1 insertion(+)
|
||||
+
|
||||
+--- a/src/tar.c
|
||||
++++ b/src/tar.c
|
||||
+@@ -9,6 +9,7 @@
|
||||
+
|
||||
+ #include <sys/stat.h>
|
||||
+ #include <sys/sysmacros.h>
|
||||
++#include <limits.h> /* for SSIZE_MAX with glibc */
|
||||
+
|
||||
+ #include "apk_defines.h"
|
||||
+ #include "apk_tar.h"
|
||||
diff --git a/package/system/apk/test.sh b/package/system/apk/test.sh
|
||||
new file mode 100644
|
||||
index 0000000000..814777fd70
|
||||
--- /dev/null
|
||||
+++ b/package/system/apk/test.sh
|
||||
@@ -0,0 +1,9 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+case "$1" in
|
||||
+ "apk")
|
||||
+ apk --version | grep "${2/-r*/}"
|
||||
+ ;;
|
||||
+ *)
|
||||
+ return 0;
|
||||
+esac
|
||||
--
|
||||
2.25.1
|
||||
|
||||
104
backports/0026-lua-lzlib-backport-package.patch
Normal file
104
backports/0026-lua-lzlib-backport-package.patch
Normal file
@@ -0,0 +1,104 @@
|
||||
From ec862d472fca676cc04ce71b640e880ecefdd477 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Fri, 13 Aug 2021 08:48:02 +0200
|
||||
Subject: [PATCH 26/27] lua-lzlib: backport package
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/libs/lua-lzlib/Makefile | 64 +++++++++++++++++++
|
||||
.../patches/001-allow_optim_flags.patch | 12 ++++
|
||||
2 files changed, 76 insertions(+)
|
||||
create mode 100644 package/libs/lua-lzlib/Makefile
|
||||
create mode 100644 package/libs/lua-lzlib/patches/001-allow_optim_flags.patch
|
||||
|
||||
diff --git a/package/libs/lua-lzlib/Makefile b/package/libs/lua-lzlib/Makefile
|
||||
new file mode 100644
|
||||
index 0000000000..5e0a16b135
|
||||
--- /dev/null
|
||||
+++ b/package/libs/lua-lzlib/Makefile
|
||||
@@ -0,0 +1,64 @@
|
||||
+#
|
||||
+# Copyright (C) 2015 OpenWrt.org
|
||||
+#
|
||||
+# This is free software, licensed under the GNU General Public License v2.
|
||||
+# See /LICENSE for more information.
|
||||
+#
|
||||
+
|
||||
+include $(TOPDIR)/rules.mk
|
||||
+
|
||||
+PKG_NAME:=lua-lzlib
|
||||
+PKG_VERSION:=0.4.3
|
||||
+PKG_RELEASE:=1
|
||||
+PKG_MAINTAINER:=Dirk Chang <dirk@kooiot.com>
|
||||
+PKG_LICENSE:=MIT
|
||||
+
|
||||
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
+PKG_MIRROR_HASH:=b6ef5e3f04b7f2137b39931a175ee802489a2486e70537770919bcccca10e723
|
||||
+PKG_SOURCE_URL:=https://github.com/LuaDist/lzlib.git
|
||||
+PKG_SOURCE_PROTO:=git
|
||||
+PKG_SOURCE_VERSION:=79329a07d8f79c19eadd7ea2752b4c4e1574b015
|
||||
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
+
|
||||
+HOST_BUILD_DEPENDS:=lua/host
|
||||
+
|
||||
+include $(INCLUDE_DIR)/package.mk
|
||||
+include $(INCLUDE_DIR)/host-build.mk
|
||||
+
|
||||
+define Package/lua-lzlib
|
||||
+ SUBMENU:=Lua
|
||||
+ SECTION:=lang
|
||||
+ CATEGORY:=Languages
|
||||
+ TITLE:=Lua zlib binding
|
||||
+ URL:=http://github.com/LuaDist/lzlib
|
||||
+ DEPENDS:= +lua +zlib
|
||||
+endef
|
||||
+
|
||||
+define Package/lua-lzlib/description
|
||||
+ A library to access zlib library functions and also to read/write gzip files using an interface similar to the base io package.
|
||||
+endef
|
||||
+
|
||||
+MAKE_FLAGS += \
|
||||
+ LUA="$(STAGING_DIR)/usr" \
|
||||
+ OFLAGS="$(TARGET_CFLAGS)" \
|
||||
+
|
||||
+HOST_MAKE_FLAGS += \
|
||||
+ LUA="$(STAGING_DIR_HOSTPKG)" \
|
||||
+ OFLAGS="$(HOST_CFLAGS)" \
|
||||
+
|
||||
+define Package/lua-lzlib/install
|
||||
+ $(INSTALL_DIR) $(1)/usr/lib/lua
|
||||
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/zlib.so $(1)/usr/lib/lua/
|
||||
+
|
||||
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/gzip.lua $(1)/usr/lib/lua/
|
||||
+endef
|
||||
+
|
||||
+define Host/Install
|
||||
+ $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/lua/5.1
|
||||
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/zlib.so $(STAGING_DIR_HOSTPKG)/lib/lua/5.1
|
||||
+
|
||||
+ $(INSTALL_DATA) $(HOST_BUILD_DIR)/gzip.lua $(STAGING_DIR_HOSTPKG)/lib/lua/5.1
|
||||
+endef
|
||||
+
|
||||
+$(eval $(call BuildPackage,lua-lzlib))
|
||||
+$(eval $(call HostBuild))
|
||||
diff --git a/package/libs/lua-lzlib/patches/001-allow_optim_flags.patch b/package/libs/lua-lzlib/patches/001-allow_optim_flags.patch
|
||||
new file mode 100644
|
||||
index 0000000000..78f981d237
|
||||
--- /dev/null
|
||||
+++ b/package/libs/lua-lzlib/patches/001-allow_optim_flags.patch
|
||||
@@ -0,0 +1,12 @@
|
||||
+--- a/Makefile
|
||||
++++ b/Makefile
|
||||
+@@ -14,7 +14,8 @@ LUABIN= $(LUA)/bin
|
||||
+ ZLIB=../zlib-1.2.3
|
||||
+
|
||||
+ # no need to change anything below here
|
||||
+-CFLAGS= $(INCS) $(DEFS) $(WARN) -O0 -fPIC
|
||||
++CFLAGS= $(INCS) $(DEFS) $(WARN) $(OFLAGS) -fPIC
|
||||
++OFLAGS= -O0
|
||||
+ WARN= -g -Werror -Wall -pedantic #-ansi
|
||||
+ INCS= -I$(LUAINC) -I$(ZLIB)
|
||||
+ LIBS= -L$(ZLIB) -lz -L$(LUALIB) -L$(LUABIN) #-llua51
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 5fc717aa60b36934892d6d77c0637fc53aa7f761 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sat, 10 Jul 2021 20:21:26 +0100
|
||||
Subject: [PATCH 27/27] lua: make it easier to detect host-built Lua
|
||||
|
||||
Install pkg-config file also for host-build, clean up Lua symlinks.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
(cherry picked from commit 315f52e0f3bfa3d65ad14ca21a696c6d31c4edcd)
|
||||
---
|
||||
package/utils/lua/Makefile | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile
|
||||
index d262d1e1fc..e15142d8d2 100644
|
||||
--- a/package/utils/lua/Makefile
|
||||
+++ b/package/utils/lua/Makefile
|
||||
@@ -134,8 +134,12 @@ define Host/Install
|
||||
INSTALL_TOP="$(STAGING_DIR_HOSTPKG)" \
|
||||
install
|
||||
|
||||
- $(LN) $(STAGING_DIR_HOSTPKG)/bin/lua5.1 $(STAGING_DIR_HOSTPKG)/bin/lua
|
||||
- $(LN) $(STAGING_DIR_HOSTPKG)/bin/luac5.1 $(STAGING_DIR_HOSTPKG)/bin/luac
|
||||
+ $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/pkgconfig
|
||||
+ $(CP) $(HOST_BUILD_DIR)/etc/lua.pc $(STAGING_DIR_HOSTPKG)/lib/pkgconfig/lua5.1.pc
|
||||
+
|
||||
+ $(LN) lua5.1 $(STAGING_DIR_HOSTPKG)/bin/lua
|
||||
+ $(LN) luac5.1 $(STAGING_DIR_HOSTPKG)/bin/luac
|
||||
+ $(LN) lua5.1.pc $(STAGING_DIR_HOSTPKG)/lib/pkgconfig/lua.pc
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
repo: https://github.com/openwrt/openwrt.git
|
||||
branch: openwrt-25.12
|
||||
revision: 1353227ad391b0008b8365eebd38495e01ed7577
|
||||
branch: openwrt-21.02
|
||||
revision: 378769b5551714ccaa821b481bfeecbf362f351e
|
||||
output_dir: ./output
|
||||
|
||||
patch_folders:
|
||||
- patches-25.12
|
||||
- backports/
|
||||
- patches/
|
||||
|
||||
@@ -3,7 +3,7 @@ FROM ubuntu:20.04
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata \
|
||||
&& apt-get install -y \
|
||||
time git-core build-essential gcc-multilib clang \
|
||||
time git-core build-essential gcc-multilib \
|
||||
libncurses5-dev zlib1g-dev gawk flex gettext wget unzip python \
|
||||
python3 python3-pip python3-yaml libssl-dev rsync \
|
||||
&& apt-get clean
|
||||
|
||||
53
feeds/bluetooth/bluetooth-6lowpand/Makefile
Normal file
53
feeds/bluetooth/bluetooth-6lowpand/Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# Copyright (C) 2016 Nordic Semiconductor ASA.
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bluetooth-6lowpand
|
||||
PKG_VERSION:=0.0.1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=https://github.com/NordicSemiconductor/Linux-ble-6lowpan-joiner.git
|
||||
PKG_SOURCE_VERSION:=5ce5b248846a6d4ac4a609eb0e8d023cf920b247
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
BLUEZ_DIR:=$(wildcard $(BUILD_DIR)/bluez-*)
|
||||
|
||||
TARGET_CFLAGS += -I$(BLUEZ_DIR)
|
||||
TARGET_LDFLAGS += -L$(BLUEZ_DIR)/lib/.libs/ -L$(BLUEZ_DIR)/src/.libs/ -lshared-mainloop -lbluetooth-internal
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bluetooth-6lowpand
|
||||
SECTION:=base
|
||||
CATEGORY:=Network
|
||||
TITLE:=Bluetooth LE 6lowpan joiner daemon
|
||||
URL:=http://www.nordicsemi.com/
|
||||
DEPENDS:=+libusb-1.0 +bluez-libs
|
||||
endef
|
||||
|
||||
define Package/bluetooth-6lowpand/description
|
||||
Bluetooth Low Energy IPSP device scanner and connection daemon.
|
||||
The Daemon can be used to whitelist certain IPSP Bluetooth LE MAC
|
||||
addresses, or autoconnect using SSID and Key derived from Wifi AP
|
||||
setup to authenticate the devices in order to connect. Also, manual
|
||||
configuration of software SSID and Key can be used.
|
||||
endef
|
||||
|
||||
define Package/bluetooth-6lowpand/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/bluetooth_6lowpand.init $(1)/etc/init.d/bluetooth_6lowpand
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/bluetooth
|
||||
$(INSTALL_DATA) ./files/bluetooth_6lowpand.conf $(1)/etc/bluetooth
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bluetooth_6lowpand $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bluetooth-6lowpand))
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=63
|
||||
PROG=/usr/sbin/bluetooth_6lowpand
|
||||
HCICONFIG=/usr/bin/hciconfig
|
||||
|
||||
start() {
|
||||
config_load btle
|
||||
config_get enable bluetooth_6lowpand enable 0
|
||||
[ "$enable" -eq 1 ] || return
|
||||
echo "start bluetooth_6lowpand"
|
||||
sleep 1
|
||||
echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable
|
||||
sleep 1
|
||||
killall bluetoothd
|
||||
sleep 1
|
||||
$HCICONFIG hci0 reset
|
||||
$PROG -w 3 -t 5 -a -d
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo "stop bluetooth_6lowpand"
|
||||
killall -9 bluetooth_6lowpand
|
||||
}
|
||||
33
feeds/bluetooth/bluez-ibeacon/Makefile
Normal file
33
feeds/bluetooth/bluez-ibeacon/Makefile
Normal file
@@ -0,0 +1,33 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bluez-ibeacon
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL=https://github.com/blogic/bluez-ibeacon
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2022-10-31
|
||||
PKG_SOURCE_VERSION:=07c082bf3e139ce061ff62a42b7876860256f4ea
|
||||
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
PKG_LICENSE:=MIT
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bluez-ibeacon
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=bluez-ibeacon
|
||||
DEPENDS:=+bluez-libs
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/bluez-beacon $(MAKE_FLAGS)
|
||||
endef
|
||||
|
||||
define Package/bluez-ibeacon/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bluez-beacon/ibeacon $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/ibeacon $(1)/etc/init.d/ibeacon
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bluez-ibeacon))
|
||||
25
feeds/bluetooth/bluez-ibeacon/files/ibeacon
Normal file
25
feeds/bluetooth/bluez-ibeacon/files/ibeacon
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/ibeacon
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger btle
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load btle
|
||||
config_get enable ibeacon enable 0
|
||||
config_get uuid ibeacon uuid 0
|
||||
config_get major ibeacon major 0
|
||||
config_get minor ibeacon minor 0
|
||||
|
||||
[ "$enable" -eq 1 ] || return
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG" 200 "${uuid}" "${major}" "${minor}" -29
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
32
feeds/bluetooth/ubtled/Makefile
Normal file
32
feeds/bluetooth/ubtled/Makefile
Normal file
@@ -0,0 +1,32 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ubtled
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL=https://github.com/blogic/ubtled.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2022-10-31
|
||||
PKG_SOURCE_VERSION:=7e01ab86c562fc8ab3777d04e60b8dce596a4c5f
|
||||
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/ubtled
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=OpenWrt BTLE daemon
|
||||
DEPENDS:=+libubox +libubus +bluez-libs
|
||||
endef
|
||||
|
||||
define Package/ubtled/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/{config,init.d,uci-defaults}
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ubtled $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/ubtled.init $(1)/etc/init.d/ubtled
|
||||
$(INSTALL_DATA) ./files/btle.config $(1)/etc/config/btle
|
||||
$(INSTALL_DATA) ./files/99-btle $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ubtled))
|
||||
8
feeds/bluetooth/ubtled/files/99-btle
Normal file
8
feeds/bluetooth/ubtled/files/99-btle
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat >> /etc/bluetooth/main.conf <<EOF
|
||||
[General]
|
||||
Name = TIP AP
|
||||
[GATT]
|
||||
[Policy]
|
||||
EOF
|
||||
11
feeds/bluetooth/ubtled/files/btle.config
Normal file
11
feeds/bluetooth/ubtled/files/btle.config
Normal file
@@ -0,0 +1,11 @@
|
||||
config ubtled ubtled
|
||||
option enable 0
|
||||
|
||||
config bluetooth_6lowpand bluetooth_6lowpand
|
||||
option enable 0
|
||||
|
||||
config ubtled ibeacon
|
||||
option enable 0
|
||||
option uuid 0
|
||||
option major 0
|
||||
option minor 0
|
||||
24
feeds/bluetooth/ubtled/files/ubtled.init
Normal file
24
feeds/bluetooth/ubtled/files/ubtled.init
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/ubtled
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger btle
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load btle
|
||||
config_get enable ubtled enable 0
|
||||
|
||||
[ "$enable" -eq 1 ] || return
|
||||
|
||||
hciconfig hci0 up
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
56
feeds/facebook/fbwifi/Makefile
Normal file
56
feeds/facebook/fbwifi/Makefile
Normal file
@@ -0,0 +1,56 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
#
|
||||
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fbwifi
|
||||
PKG_VERSION:=2
|
||||
PKG_RELEASE:=0
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
PKG_MAINTAINER:=Simon Kinane <skinane@fb.com>
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fbwifi
|
||||
SUBMENU:=Captive Portals
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+iptables +luasec +luasocket \
|
||||
+luci-base +libuci-lua +luaposix \
|
||||
+luci-mod-network +luci-mod-status +luci-theme-bootstrap \
|
||||
+lua-cjson +uhttpd
|
||||
TITLE:=Facebook Wi-Fi
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/fbwifi/description
|
||||
Facebook Wi-Fi, an AP authorisation solution
|
||||
endef
|
||||
|
||||
define Package/fbwifi/conffiles
|
||||
/etc/config/fbwifi
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/fbwifi/install
|
||||
$(INSTALL_DIR) $(1)
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fbwifi))
|
||||
55
feeds/facebook/fbwifi/README.md
Normal file
55
feeds/facebook/fbwifi/README.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# Facebook Wi-Fi v2.0 Reference Implementation for OpenWrt
|
||||
|
||||
## Getting started
|
||||
|
||||
Case studies for OEM customers are available at the official page of [Facebook Wi-Fi](https://www.facebook.com/facebook-wifi).
|
||||
|
||||
For OEM engineers, start by reading the init script in [files/etc/init.d/fbwifi](https://github.com/facebookincubator/fbc_owrt_feed/blob/master/fbwifi/files/etc/init.d/fbwifi)
|
||||
|
||||
## Contents
|
||||
|
||||
The 'files' subdirectory contains all the configuration, script and code
|
||||
that implements the Facebook Wi-Fi v2.0 standard for OpenWrt.
|
||||
|
||||
The folder structure follows *nix conventions :
|
||||
- 'etc' is the boot time scripts and configuration
|
||||
- 'usr' contains procedural scripts, lua common code module and GUI prototype for luci
|
||||
- 'www' contains the HTTP endpoints as CGI handlers
|
||||
|
||||
```
|
||||
files/
|
||||
├── etc
|
||||
│ ├── config
|
||||
│ │ └── fbwifi
|
||||
│ ├── hotplug.d
|
||||
│ │ └── iface
|
||||
│ │ └── 50-fbwifi
|
||||
│ ├── init.d
|
||||
│ │ └── fbwifi
|
||||
├── usr
|
||||
│ ├── lib
|
||||
│ │ └── lua
|
||||
│ │ ├── fbwifi.lua
|
||||
│ │ └── luci
|
||||
│ │ ├── controller
|
||||
│ │ │ └── fbwifi.lua
|
||||
│ │ └── view
|
||||
│ │ └── fbwifi.htm
|
||||
│ ├── sbin
|
||||
│ │ ├── fbwifi
|
||||
│ │ ├── fbwifi_debug_dump
|
||||
│ │ ├── fbwifi_gateway_info_update
|
||||
│ │ ├── fbwifi_get_config
|
||||
│ │ └── fbwifi_validate_token_db
|
||||
│ └── share
|
||||
│ └── fbwifi
|
||||
│ ├── firewall.include
|
||||
│ └── uhttpd.json
|
||||
└── www
|
||||
└── cgi-bin
|
||||
└── fbwifi
|
||||
└── v2.0
|
||||
├── auth
|
||||
├── capport
|
||||
└── info
|
||||
```
|
||||
6
feeds/facebook/fbwifi/files/etc/config/fbwifi
Normal file
6
feeds/facebook/fbwifi/files/etc/config/fbwifi
Normal file
@@ -0,0 +1,6 @@
|
||||
config fbwifi 'main'
|
||||
option enabled '0'
|
||||
option gateway_token 'FBWIFI:GATEWAY|123456789|0123456789|abcdeABCDE123456789'
|
||||
option http_port '2060'
|
||||
option https_port '2061'
|
||||
option zone 'lan'
|
||||
10
feeds/facebook/fbwifi/files/etc/hotplug.d/iface/50-fbwifi
Normal file
10
feeds/facebook/fbwifi/files/etc/hotplug.d/iface/50-fbwifi
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
|
||||
/etc/init.d/fbwifi enabled || exit 0
|
||||
|
||||
ip route get fibmatch 1.1.1.1 | grep -q "$DEVICE" || exit 0
|
||||
|
||||
logger -t fbwifi "Reloading fbwifi due to $ACTION of $INTERFACE ($DEVICE)"
|
||||
/etc/init.d/fbwifi restart
|
||||
43
feeds/facebook/fbwifi/files/etc/init.d/fbwifi
Executable file
43
feeds/facebook/fbwifi/files/etc/init.d/fbwifi
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=90
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
reload_service() {
|
||||
restart
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger fbwifi
|
||||
}
|
||||
|
||||
start_service() {
|
||||
|
||||
config_load fbwifi
|
||||
config_get_bool enabled 'main' 'enabled' '0'
|
||||
[ "$enabled" -eq 0 ] && return
|
||||
|
||||
config_get http_port main http_port
|
||||
[ -z "$http_port" ] && {
|
||||
logger -t fbwifi "required option http_port not set"
|
||||
exit 1
|
||||
}
|
||||
|
||||
config_get https_port main https_port
|
||||
[ -z "$https_port" ] && {
|
||||
logger -t fbwifi "required option https_port not set"
|
||||
exit 1
|
||||
}
|
||||
|
||||
logger "[fbwifi] Enabled; starting"
|
||||
|
||||
mkdir -p /tmp/fbwifi
|
||||
|
||||
/usr/sbin/fbwifi reload
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/sbin/fbwifi_validate_token_db
|
||||
procd_set_param respawn 1 300 0
|
||||
procd_close_instance
|
||||
}
|
||||
153
feeds/facebook/fbwifi/files/usr/lib/lua/fbwifi.lua
Normal file
153
feeds/facebook/fbwifi/files/usr/lib/lua/fbwifi.lua
Normal file
@@ -0,0 +1,153 @@
|
||||
-- FBWIFI Lua library
|
||||
-- function table
|
||||
local fbwifi = {}
|
||||
|
||||
local http = require("ssl.https")
|
||||
local json = require("cjson")
|
||||
local log = require("posix.syslog")
|
||||
local uci = require("uci")
|
||||
|
||||
function fbwifi.gateway_token()
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
token = state:get("fbwifi", "main", "gateway_token")
|
||||
if token and string.len(token) > 0 then
|
||||
return token
|
||||
else
|
||||
log.syslog( log.LOG_WARNING, "[fbwifi] UCI option fbwifi.main.gateway_token is missing" )
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function fbwifi.validate_token( token )
|
||||
|
||||
local valid = false
|
||||
|
||||
if string.len(token or '' ) > 0 then
|
||||
|
||||
GATEWAY_TOKEN = fbwifi.gateway_token()
|
||||
|
||||
URL="https://api.fbwifi.com/v2.0/token"
|
||||
BODY="token="..token
|
||||
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, BODY)
|
||||
|
||||
if code==200 then
|
||||
valid = true
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] validate_token:"..body)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return valid
|
||||
end
|
||||
|
||||
local mac_to_purge=''
|
||||
function remove_client_by_mac(client)
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
|
||||
for key, value in pairs(client) do
|
||||
if
|
||||
key == 'mac' and
|
||||
value == mac_to_purge
|
||||
then
|
||||
log.syslog(log.LOG_INFO, string.format("[fbwifi] Purging DB entry %s for MAC %s", client['.name'] or 'unknown', mac_to_purge) )
|
||||
state:delete("fbwifi", client['.name'])
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function fbwifi.instate_client_rule( token, client_mac )
|
||||
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Validating client "..client_mac)
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
state_name = "token_" .. token
|
||||
|
||||
RULE_COND="iptables -w -L FBWIFI_CLIENT_TO_INTERNET -t mangle | grep -i -q \"%s\""
|
||||
RULE_FMT="iptables -w -t mangle -%s FBWIFI_CLIENT_TO_INTERNET -m mac --mac-source \"%s\" -j MARK --set-mark 0xfb"
|
||||
local RULE
|
||||
|
||||
log.syslog(log.LOG_INFO, string.format("[fbwifi] Cleaning DB for MAC %s", client_mac) )
|
||||
mac_to_purge = client_mac
|
||||
state:foreach("fbwifi", "client", remove_client_by_mac)
|
||||
|
||||
|
||||
log.syslog(log.LOG_INFO, string.format("[fbwifi] Adding DB entry %s for MAC %s", state_name, client_mac) )
|
||||
state:set("fbwifi", state_name, "client")
|
||||
state:set("fbwifi", state_name, "token", token)
|
||||
state:set("fbwifi", state_name, "mac", client_mac)
|
||||
state:set("fbwifi", state_name, "authenticated", "true")
|
||||
|
||||
-- verify a rule exists for the given client MAC,
|
||||
-- OR install it
|
||||
RULE=string.format(RULE_COND.." || "..RULE_FMT, client_mac, "A", client_mac)
|
||||
|
||||
log.syslog(log.LOG_INFO, string.format( "[fbwifi] Opening iptables for %s", client_mac ) )
|
||||
res = os.execute(RULE)
|
||||
if res ~= 0 then
|
||||
log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Failed to update iptables (%s)", res ) )
|
||||
end
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] "..RULE)
|
||||
|
||||
state:save('fbwifi')
|
||||
end
|
||||
|
||||
function fbwifi.revoke_client_rule( token )
|
||||
|
||||
if (token == nil) then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Invalidating token, but token is Nil")
|
||||
return
|
||||
end
|
||||
|
||||
log.syslog(log.LOG_INFO, string.format( "[fbwifi] Invalidating token (%s)", token) )
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
state_name = "token_" .. token
|
||||
|
||||
client_mac = state:get("fbwifi", state_name, "mac")
|
||||
|
||||
if client_mac then
|
||||
RULE_COND="iptables -w -L FBWIFI_CLIENT_TO_INTERNET -t mangle | grep -i -q \"%s\""
|
||||
RULE_FMT="iptables -w -t mangle -%s FBWIFI_CLIENT_TO_INTERNET -m mac --mac-source \"%s\" -j MARK --set-mark 0xfb"
|
||||
|
||||
-- verify a rule exists for the given client MAC,
|
||||
-- AND delete it
|
||||
RULE=string.format(RULE_COND.." && "..RULE_FMT, client_mac, "D", client_mac)
|
||||
|
||||
res = os.execute(RULE)
|
||||
if res ~= 0 then
|
||||
log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Failed to update iptables (%s)", res ) )
|
||||
end
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] "..RULE)
|
||||
|
||||
state:delete("fbwifi", state_name)
|
||||
state:save('fbwifi')
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Client MAC not found in DB (%s)", state_name ) )
|
||||
end
|
||||
end
|
||||
|
||||
function fbwifi.reset()
|
||||
|
||||
local success = false
|
||||
GATEWAY_TOKEN = fbwifi.gateway_token()
|
||||
URL="https://api.fbwifi.com/v2.0/gateway/reset"
|
||||
BODY="{}"
|
||||
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, BODY)
|
||||
|
||||
if code==200 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Reset committed")
|
||||
success = true
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] Reset failed : "..body)
|
||||
end
|
||||
|
||||
return success
|
||||
end
|
||||
|
||||
--
|
||||
-- Return the function table to the host script
|
||||
--
|
||||
return fbwifi
|
||||
@@ -0,0 +1,12 @@
|
||||
-- Copyright
|
||||
-- Licensed to the public under the GNU General Public License v2.
|
||||
|
||||
module("luci.controller.fbwifi", package.seeall)
|
||||
|
||||
sys = require "luci.sys"
|
||||
ut = require "luci.util"
|
||||
|
||||
function index()
|
||||
entry({"admin", "network", "fbwifi"}, template("fbwifi"), "Facebook Wi-Fi", 90).dependent=false
|
||||
end
|
||||
|
||||
16
feeds/facebook/fbwifi/files/usr/lib/lua/luci/view/fbwifi.htm
Normal file
16
feeds/facebook/fbwifi/files/usr/lib/lua/luci/view/fbwifi.htm
Normal file
@@ -0,0 +1,16 @@
|
||||
<%#
|
||||
Copyright
|
||||
Licensed to the public under the GNU General Public License v2.
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
|
||||
<h1>Facebook Wi-Fi</h1>
|
||||
<%
|
||||
require("uci")
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
url = state:get("fbwifi", "main", "captive_portal_config_url")
|
||||
%>
|
||||
<a href="<% print(url) %>">Configure FB business page</a>
|
||||
|
||||
<%+footer%>
|
||||
57
feeds/facebook/fbwifi/files/usr/sbin/fbwifi
Executable file
57
feeds/facebook/fbwifi/files/usr/sbin/fbwifi
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
disable)
|
||||
uci set fbwifi.main.enabled=0
|
||||
|
||||
uci delete firewall.fbwifi
|
||||
|
||||
uci delete uhttpd.fbwifi_redirect
|
||||
|
||||
uci delete uhttpd.main.json_script
|
||||
uci set uhttpd.main.cert='/etc/uhttpd.crt'
|
||||
uci set uhttpd.main.key='/etc/uhttpd.key'
|
||||
uci set uhttpd.main.rfc1918_filter=1
|
||||
;;
|
||||
enable)
|
||||
uci set fbwifi.main.enabled=1
|
||||
|
||||
uci set firewall.fbwifi=include
|
||||
uci set firewall.fbwifi.enabled=1
|
||||
uci set firewall.fbwifi.family=ipv4
|
||||
uci set firewall.fbwifi.path=/usr/share/fbwifi/firewall.include
|
||||
uci set firewall.fbwifi.reload=1
|
||||
uci set firewall.fbwifi.type=script
|
||||
|
||||
uci set uhttpd.fbwifi_redirect=uhttpd
|
||||
uci set uhttpd.fbwifi_redirect.enabled=1
|
||||
uci set uhttpd.fbwifi_redirect.cert='/tmp/fbwifi/https_server_cert'
|
||||
uci set uhttpd.fbwifi_redirect.json_script='/tmp/fbwifi/uhttpd-redirect.json'
|
||||
uci set uhttpd.fbwifi_redirect.key='/tmp/fbwifi/https_server_key'
|
||||
uci set uhttpd.fbwifi_redirect.listen_http='0.0.0.0:2060'
|
||||
uci set uhttpd.fbwifi_redirect.listen_https='0.0.0.0:2061'
|
||||
|
||||
uci set uhttpd.main.cert='/tmp/fbwifi/https_server_cert'
|
||||
uci set uhttpd.main.json_script='/usr/share/fbwifi/uhttpd.json'
|
||||
uci set uhttpd.main.key='/tmp/fbwifi/https_server_key'
|
||||
uci set uhttpd.main.rfc1918_filter=0
|
||||
;;
|
||||
reload)
|
||||
/usr/sbin/fbwifi_get_config
|
||||
|
||||
login_url=$(uci -p /var/state get fbwifi.main.captive_portal_url)
|
||||
[ -z "$login_url" ] && {
|
||||
logger -t fbwifi "captive_portal_url not available yet"
|
||||
exit 1
|
||||
}
|
||||
printf '{ "request": [ ["redirect", "%s", 302] ] }' "$login_url" > /tmp/fbwifi/uhttpd-redirect.json
|
||||
|
||||
/etc/init.d/uhttpd restart
|
||||
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
uci commit
|
||||
/etc/init.d/uhttpd restart
|
||||
reload_config
|
||||
8
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_debug_dump
Executable file
8
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_debug_dump
Executable file
@@ -0,0 +1,8 @@
|
||||
echo -e "Runtime configuration and token DB\n"
|
||||
uci -p /var/state export fbwifi
|
||||
|
||||
echo -e "\nDynamic firewall flow rules\n"
|
||||
iptables -t mangle -L FBWIFI_CLIENT_TO_INTERNET
|
||||
|
||||
echo -e "\nDHCP leases\n"
|
||||
cat /tmp/dhcp.leases
|
||||
38
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_gateway_info_update
Executable file
38
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_gateway_info_update
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
http = require("ssl.https")
|
||||
json = require("cjson")
|
||||
log = require("posix.syslog")
|
||||
socket = require("socket")
|
||||
require("uci")
|
||||
fbwifi = require("fbwifi")
|
||||
|
||||
GATEWAY_TOKEN = fbwifi.gateway_token()
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
|
||||
payload="name="..socket.dns.gethostname()
|
||||
|
||||
function queue_ssid_update(iface)
|
||||
bssid_file="/sys/class/net/br-"..iface["network"].."/address"
|
||||
local file = io.open(bssid_file)
|
||||
if file then
|
||||
for line in file:lines() do
|
||||
payload=payload.."&bssid[]="..line
|
||||
end
|
||||
payload=payload.."ssid[]="..iface["ssid"]
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to find BSSID for interface br-"..iface["network"])
|
||||
end
|
||||
end
|
||||
|
||||
state:foreach("wireless", "wifi-iface", queue_ssid_update)
|
||||
|
||||
URL="https://api.fbwifi.com/v2.0/gateway"
|
||||
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, payload)
|
||||
if code == 200 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] gateway information updated "..body)
|
||||
os.exit(0)
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] gateway API failed "..body)
|
||||
os.exit(code)
|
||||
end
|
||||
106
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_get_config
Executable file
106
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_get_config
Executable file
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/lua
|
||||
http = require("ssl.https")
|
||||
json = require("cjson")
|
||||
require("uci")
|
||||
log = require("posix.syslog")
|
||||
fbwifi = require("fbwifi")
|
||||
|
||||
GATEWAY_TOKEN = fbwifi.gateway_token()
|
||||
|
||||
http_port = uci.get("fbwifi.main.http_port")
|
||||
https_port = uci.get("fbwifi.main.https_port")
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
|
||||
URL="https://api.fbwifi.com/v2.0/gateway"
|
||||
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN.."&fields=config,config_version")
|
||||
|
||||
if code == 200 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Got gateway config ("..code..")")
|
||||
else
|
||||
log.syslog(log.LOG_CRIT, "[fbwifi] Failed to get gateway config ("..code..")")
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
obj = json.decode(body)
|
||||
|
||||
function save_cert(name, value)
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Saving cert "..name)
|
||||
local f = assert(io.open("/tmp/fbwifi/"..name, "w"))
|
||||
f:write(value)
|
||||
f:close()
|
||||
end
|
||||
|
||||
function process_redirect(ix, host)
|
||||
IP_SET = "ip addr replace dev lo "..host
|
||||
local result = os.execute(IP_SET)
|
||||
if result == 0 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Redirect address applied "..host)
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to apply redirect address "..host)
|
||||
end
|
||||
|
||||
ip = string.match(host, '([0-9\.]*)/([0-9]*)')
|
||||
RULE_FMT="grep -q \"%s\" /etc/hosts || echo \"%s\tstar.fbwifigateway.net\" >> /etc/hosts"
|
||||
HOSTS_RULE = string.format(RULE_FMT, ip, ip)
|
||||
result = os.execute(HOSTS_RULE)
|
||||
if result == 0 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Cached redirect host for DNS")
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to amend /etc/hosts")
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] "..HOSTS_RULE)
|
||||
end
|
||||
|
||||
result = os.execute("iptables -t nat -A FBWIFI_HOST_REDIRLIST -p tcp --dport 80 -d "..ip.." -j ACCEPT # REDIRECT --to-ports "..http_port)
|
||||
--print(result)
|
||||
result = os.execute("iptables -t nat -A FBWIFI_HOST_REDIRLIST -p tcp --dport 443 -d "..ip.." -j ACCEPT # REDIRECT --to-ports "..https_port)
|
||||
--print(result)
|
||||
end
|
||||
|
||||
save_cert("https_server_cert", obj['config']['https_server_cert'])
|
||||
save_cert("https_server_key", obj['config']['https_server_key'])
|
||||
|
||||
result = os.execute("iptables -t nat -F FBWIFI_HOST_REDIRLIST")
|
||||
--print(result)
|
||||
table.foreach(obj['config']['host_redirect_ips'], process_redirect)
|
||||
|
||||
RULE_FORMAT = "iptables -t mangle -A FBWIFI_TRAFFIC_ALLOWLIST -d %s -p %s --dport %s -j MARK --set-mark 0xfb"
|
||||
function process_traffic_rule(ix, rule)
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Traffic rule "..ix)
|
||||
|
||||
if rule["protocol"] == 6 then
|
||||
PROTO = "tcp"
|
||||
elseif rule["protocol"] == 17 then
|
||||
PROTO = "udp"
|
||||
end
|
||||
RULE = string.format(RULE_FORMAT, rule["ip"], PROTO, rule["port"])
|
||||
local result = os.execute(RULE)
|
||||
if result == 0 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Traffic rule "..ix)
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to install traffic rule ; "..RULE)
|
||||
end
|
||||
end
|
||||
|
||||
local cross_origin_list = {}
|
||||
function process_cross_origin_rule(ix, url)
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Cross origin rule "..url)
|
||||
table.insert(cross_origin_list, url)
|
||||
end
|
||||
|
||||
function process_url(url_purpose, fqdn)
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Caching "..url_purpose)
|
||||
state:set("fbwifi", "main", url_purpose, fqdn)
|
||||
end
|
||||
|
||||
state:set("fbwifi", "main", "config")
|
||||
|
||||
result = os.execute("iptables -t mangle -F FBWIFI_TRAFFIC_ALLOWLIST ")
|
||||
--print(result)
|
||||
table.foreach(obj['config']['traffic_allowlist'], process_traffic_rule)
|
||||
table.foreach(obj['config']['cross_origin_allowlist'], process_cross_origin_rule)
|
||||
table.foreach(obj['config']['urls'], process_url)
|
||||
state:set("fbwifi", "main", "cross_origin_allow_rules", cross_origin_list)
|
||||
|
||||
state:set("fbwifi", "main", "config_version", obj['config_version'])
|
||||
state:save('fbwifi')
|
||||
75
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_validate_token_db
Executable file
75
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_validate_token_db
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
https = require("ssl.https")
|
||||
json = require("cjson")
|
||||
log = require("posix.syslog")
|
||||
fbwifi = require("fbwifi")
|
||||
require("uci")
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
GATEWAY_TOKEN = fbwifi.gateway_token()
|
||||
|
||||
request = {
|
||||
tokens = {},
|
||||
traffic_type = "total",
|
||||
config_version = state:get("fbwifi", "main", "config_version")
|
||||
}
|
||||
|
||||
function queue_token(client)
|
||||
|
||||
request.tokens[client.token]={
|
||||
incoming = json.null,
|
||||
outgoing = json.null,
|
||||
connected_time_sec = json.null,
|
||||
inactive_time_sec = json.null,
|
||||
signal_rssi_dbm = json.null,
|
||||
--expected_tpus_mbps = json.null,
|
||||
is_connected = true
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
state:foreach("fbwifi", "client", queue_token)
|
||||
print( "\nRequest:\n"..json.encode(request) )
|
||||
|
||||
URL="https://api.fbwifi.com/v2.0/tokens"
|
||||
BODY=string.format(
|
||||
"tokens=%s&traffic_type=%s&config_version=%s",
|
||||
json.encode(request.tokens),
|
||||
"'total'",
|
||||
state:get("fbwifi", "main", "config_version")
|
||||
)
|
||||
|
||||
body, code, headers = https.request(URL.."?access_token="..GATEWAY_TOKEN, BODY)
|
||||
|
||||
if code then
|
||||
print( "\nResponse:\n"..body )
|
||||
end
|
||||
|
||||
response = json.decode(body)
|
||||
--print(response)
|
||||
--table.foreach(response,print)
|
||||
--table.foreach(response.tokens,print)
|
||||
|
||||
if response.config_valid then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Config validated")
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] config is stale, refreshing config")
|
||||
local result = os.execute("/usr/sbin/fbwifi reload")
|
||||
if result == 0 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] successfully fetched and loaded new config ")
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] failed to fetch and load new config, possible stale config")
|
||||
end
|
||||
end
|
||||
|
||||
function process_token(token, metadata)
|
||||
table.foreach(metadata,print)
|
||||
if metadata.valid then
|
||||
print("OK: "..token)
|
||||
else
|
||||
print("Nok: "..token)
|
||||
fbwifi.revoke_client_rule( token )
|
||||
end
|
||||
end
|
||||
table.foreach(response.tokens,process_token)
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/bin/sh
|
||||
|
||||
IPT4="/usr/sbin/iptables"
|
||||
|
||||
fbwifi_http_port="$(uci get fbwifi.main.http_port)"
|
||||
[ -n "$fbwifi_http_port" ] || {
|
||||
logger -t fbwifi "required option http_port not set"
|
||||
exit 1
|
||||
}
|
||||
|
||||
fbwifi_https_port="$(uci get fbwifi.main.https_port)"
|
||||
[ -n "$fbwifi_https_port" ] || {
|
||||
logger -t fbwifi "required option https_port not set"
|
||||
exit 1
|
||||
}
|
||||
|
||||
fbwifi_zone="$(uci get fbwifi.main.zone)"
|
||||
[ -n "$fbwifi_zone" ] || {
|
||||
logger -t fbwifi "required option zone not set"
|
||||
exit 1
|
||||
}
|
||||
|
||||
fbwifi_ifaces="$(fw3 -q zone "$fbwifi_zone")"
|
||||
|
||||
## Create custom chains
|
||||
$IPT4 -t filter -N FBWIFI_FORWARD 2>/dev/null
|
||||
$IPT4 -t filter -N FBWIFI_INPUT 2>/dev/null
|
||||
$IPT4 -t mangle -N FBWIFI_CLIENT_TO_INTERNET 2>/dev/null
|
||||
$IPT4 -t mangle -N FBWIFI_PREROUTING 2>/dev/null
|
||||
$IPT4 -t mangle -N FBWIFI_TRAFFIC_ALLOWLIST 2>/dev/null
|
||||
$IPT4 -t nat -N FBWIFI_CLIENT_TO_INTERNET 2>/dev/null
|
||||
$IPT4 -t nat -N FBWIFI_PREROUTING 2>/dev/null
|
||||
$IPT4 -t nat -N FBWIFI_HOST_REDIRLIST 2>/dev/null
|
||||
|
||||
## Flush custom chains
|
||||
$IPT4 -t filter -F FBWIFI_FORWARD
|
||||
$IPT4 -t filter -F FBWIFI_INPUT
|
||||
$IPT4 -t mangle -F FBWIFI_CLIENT_TO_INTERNET
|
||||
$IPT4 -t mangle -F FBWIFI_PREROUTING
|
||||
$IPT4 -t mangle -F FBWIFI_TRAFFIC_ALLOWLIST
|
||||
$IPT4 -t nat -F FBWIFI_CLIENT_TO_INTERNET
|
||||
$IPT4 -t nat -F FBWIFI_PREROUTING
|
||||
$IPT4 -t nat -F FBWIFI_HOST_REDIRLIST
|
||||
|
||||
## Populate custom chains
|
||||
$IPT4 -t filter -A FBWIFI_FORWARD -p udp --dport 53 -m conntrack --ctstate NEW -j ACCEPT
|
||||
$IPT4 -t filter -A FBWIFI_FORWARD -m conntrack --ctstate NEW -m mark --mark 0xfb -j ACCEPT
|
||||
$IPT4 -t filter -A FBWIFI_FORWARD -j REJECT
|
||||
$IPT4 -t filter -A FBWIFI_INPUT -p tcp --dport "$fbwifi_http_port" -m conntrack --ctstate NEW -j ACCEPT
|
||||
$IPT4 -t filter -A FBWIFI_INPUT -p tcp --dport "$fbwifi_https_port" -m conntrack --ctstate NEW -j ACCEPT
|
||||
$IPT4 -t mangle -A FBWIFI_PREROUTING -j FBWIFI_CLIENT_TO_INTERNET
|
||||
$IPT4 -t mangle -A FBWIFI_PREROUTING -j FBWIFI_TRAFFIC_ALLOWLIST
|
||||
$IPT4 -t nat -A FBWIFI_PREROUTING -j FBWIFI_CLIENT_TO_INTERNET
|
||||
$IPT4 -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 80 -m conntrack --ctstate NEW -j FBWIFI_HOST_REDIRLIST
|
||||
$IPT4 -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 443 -m conntrack --ctstate NEW -j FBWIFI_HOST_REDIRLIST
|
||||
$IPT4 -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 80 -m conntrack --ctstate NEW -m mark --mark 0xfb -j ACCEPT
|
||||
$IPT4 -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 443 -m conntrack --ctstate NEW -m mark --mark 0xfb -j ACCEPT
|
||||
$IPT4 -t nat -A FBWIFI_CLIENT_TO_INTERNET -p tcp --dport 80 -m conntrack --ctstate NEW -j REDIRECT --to-ports "$fbwifi_http_port"
|
||||
|
||||
## Hook custom chains in firewall3 chains
|
||||
$IPT4 -t filter -I "zone_${fbwifi_zone}_input" 2 -j FBWIFI_INPUT
|
||||
$IPT4 -t filter -I "zone_${fbwifi_zone}_forward" 2 -j FBWIFI_FORWARD
|
||||
$IPT4 -t nat -I "zone_${fbwifi_zone}_prerouting" 2 -j FBWIFI_PREROUTING
|
||||
# There are no firewall3 zone chains in the mangle table so we need to do this for all interfaces in the zone
|
||||
for iface in $fbwifi_ifaces; do
|
||||
$IPT4 -t mangle -I PREROUTING -i "$iface" -j FBWIFI_PREROUTING
|
||||
done
|
||||
8
feeds/facebook/fbwifi/files/usr/share/fbwifi/uhttpd.json
Normal file
8
feeds/facebook/fbwifi/files/usr/share/fbwifi/uhttpd.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"request": [
|
||||
[ "if",
|
||||
[ "regex", "REQUEST_URI", "^/fbwifi" ],
|
||||
[ "rewrite", "/cgi-bin%REQUEST_URI%" ]
|
||||
]
|
||||
]
|
||||
}
|
||||
69
feeds/facebook/fbwifi/files/www/cgi-bin/fbwifi/v2.0/auth
Executable file
69
feeds/facebook/fbwifi/files/www/cgi-bin/fbwifi/v2.0/auth
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/lua
|
||||
require("uci")
|
||||
log = require("posix.syslog")
|
||||
fbwifi = require("fbwifi")
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
function process_cors()
|
||||
origin = os.getenv("HTTP_ORIGIN")
|
||||
log.syslog(log.LOG_INFO, string.format("[fbwifi] [auth] process_cors origin %s", origin or 'not found') )
|
||||
if string.len(origin or '') > 0 then
|
||||
allow_list = state:get("fbwifi", "main", "cross_origin_allow_rules")
|
||||
for _, value in pairs(allow_list) do
|
||||
if value == origin then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] [auth] process_cors Appending CORS Headers to HTTP")
|
||||
print("Access-Control-Allow-Origin: "..origin)
|
||||
print("Vary: Origin")
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] [auth] process_cors No CORS Headers added to Response")
|
||||
end
|
||||
end
|
||||
|
||||
method = os.getenv("REQUEST_METHOD")
|
||||
if method == 'GET' then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] [auth] GET handler")
|
||||
print("Status: 302")
|
||||
print("Location: "..state:get("fbwifi", "main", "landing_page_url"))
|
||||
process_cors()
|
||||
print ('\n')
|
||||
|
||||
elseif method == 'POST' then
|
||||
local token
|
||||
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] [auth] POST handler")
|
||||
process_cors()
|
||||
print("Status: 200")
|
||||
|
||||
form_data=io.read()
|
||||
while form_data do
|
||||
token = string.match(form_data, '[%d]+')
|
||||
if string.len(token or '') > 14 then
|
||||
|
||||
client = os.getenv("REMOTE_ADDR")
|
||||
f = io.popen("awk '/"..client.."/ { printf(\"%s\", $4) }' /proc/net/arp", 'r')
|
||||
client_mac = assert(f:read('*a'))
|
||||
|
||||
if fbwifi.validate_token(token) then
|
||||
log.syslog(log.LOG_INFO, string.format( "[fbwifi] [auth] POST handler : Validating Token (%s) for MAC (%s)", token or 'nil', client_mac or 'nil') )
|
||||
fbwifi.instate_client_rule(token, client_mac)
|
||||
print("\n{\"valid\":true}\n")
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, string.format( "[fbwifi] [auth] POST handler : ! Invalid token (%s) for mac (%s) !", token or 'nil', client_mac or 'nil') )
|
||||
fbwifi.revoke_client_rule(token)
|
||||
print("\n{\"valid\":false}\n")
|
||||
end
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] [auth] POST handler completed")
|
||||
return
|
||||
end
|
||||
|
||||
form_data=io.read()
|
||||
end
|
||||
print ('\n')
|
||||
|
||||
log.syslog(log.LOG_WARNING, string.format("[fbwifi] [auth] POST handler : token not found" ))
|
||||
fbwifi.revoke_client_rule(token)
|
||||
print("\n{\"valid\":false}\n")
|
||||
end
|
||||
41
feeds/facebook/fbwifi/files/www/cgi-bin/fbwifi/v2.0/capport
Executable file
41
feeds/facebook/fbwifi/files/www/cgi-bin/fbwifi/v2.0/capport
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/lua
|
||||
json = require("cjson")
|
||||
require("uci")
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
client_mac = ""
|
||||
token = ""
|
||||
|
||||
response = {}
|
||||
response['venue-info-url'] = state:get("fbwifi", "main", "capport_venue_info_url")
|
||||
|
||||
function map_remote_mac_to_token(client)
|
||||
for key, value in pairs(client) do
|
||||
if
|
||||
key == 'mac' and
|
||||
value == client_mac
|
||||
then
|
||||
token = client.token
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function hasValidToken(client_ip)
|
||||
f = io.popen("awk '/"..client_ip.."/ { printf(\"%s\", $4) }' /proc/net/arp", 'r')
|
||||
client_mac = assert(f:read('*a'))
|
||||
state:foreach("fbwifi", "client", map_remote_mac_to_token)
|
||||
|
||||
return 0 < string.len(token)
|
||||
end
|
||||
|
||||
print("Content-type: application/captive+json; charset=utf-8\n")
|
||||
|
||||
client = os.getenv("REMOTE_ADDR")
|
||||
response['captive'] = not hasValidToken(client)
|
||||
|
||||
if response['captive'] then
|
||||
response['user-portal-url'] = state:get("fbwifi", "main", "captive_portal_url")
|
||||
end
|
||||
|
||||
print( json.encode(response) )
|
||||
58
feeds/facebook/fbwifi/files/www/cgi-bin/fbwifi/v2.0/info
Executable file
58
feeds/facebook/fbwifi/files/www/cgi-bin/fbwifi/v2.0/info
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/lua
|
||||
require "luci.cacheloader"
|
||||
require "luci.sgi.cgi"
|
||||
json = require("cjson")
|
||||
fbwifi = require("fbwifi")
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
GATEWAY_TOKEN = fbwifi.gateway_token()
|
||||
|
||||
response = { api_version = "2.0", token = json.null }
|
||||
client_mac = ""
|
||||
|
||||
function process_cors()
|
||||
origin = os.getenv("HTTP_ORIGIN")
|
||||
if string.len(origin or '') > 0 then
|
||||
allow_list = state:get("fbwifi", "main", "cross_origin_allow_rules")
|
||||
for _, value in pairs(allow_list) do
|
||||
if value == origin then
|
||||
print("Access-Control-Allow-Origin: "..origin)
|
||||
print("Vary: Origin")
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function map_remote_mac_to_token(client)
|
||||
|
||||
for key, value in pairs(client) do
|
||||
if
|
||||
key == 'mac' and
|
||||
value == client_mac
|
||||
then
|
||||
response.token = client.token
|
||||
return false -- escape outer loop
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function getClientToken(client_ip)
|
||||
f = io.popen("awk '/"..client_ip.."/ { printf(\"%s\", $4) }' /proc/net/arp", 'r')
|
||||
client_mac = assert(f:read('*a'))
|
||||
|
||||
state:foreach("fbwifi", "client", map_remote_mac_to_token)
|
||||
end
|
||||
|
||||
function getGatewayId()
|
||||
id = string.match(GATEWAY_TOKEN, 'FBWIFI:GATEWAY|[0-9]*|([0-9]*)')
|
||||
return id
|
||||
end
|
||||
|
||||
process_cors()
|
||||
print("Content-type: application/json; charset=utf-8\n")
|
||||
|
||||
getClientToken(os.getenv("REMOTE_ADDR"))
|
||||
response.gateway_id = getGatewayId()
|
||||
|
||||
print( json.encode(response) )
|
||||
67
feeds/ipq807x/protobuf-c/Makefile
Normal file
67
feeds/ipq807x/protobuf-c/Makefile
Normal file
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# Copyright (C) 2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libprotobuf-c
|
||||
PKG_VERSION:=1.3.1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=protobuf-c-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/protobuf-c/protobuf-c/releases/download/v$(PKG_VERSION)
|
||||
PKG_HASH:=51472d3a191d6d7b425e32b612e477c06f73fe23e07f6a6a839b11808e9d2267
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/protobuf-c-$(PKG_VERSION)
|
||||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/protobuf-c-$(PKG_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
|
||||
PKG_LICENSE:=BSD-2c
|
||||
|
||||
PKG_BUILD_DEPENDS:=protobuf-c/host
|
||||
HOST_BUILD_DEPENDS:=protobuf/host
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Package/libprotobuf-c
|
||||
TITLE:=Protocol Buffers library
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
URL:=https://github.com/protobuf-c/protobuf-c
|
||||
endef
|
||||
|
||||
define Package/libprotobuf-c/description
|
||||
Runtime library to use Google Protocol Buffers from C applications.
|
||||
Protocol Buffers are a way of encoding structured data in an efficient yet
|
||||
extensible format. Google uses Protocol Buffers for almost all of its
|
||||
internal RPC protocols and file formats.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-shared \
|
||||
--enable-static \
|
||||
--disable-protoc
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libprotobuf-c.{a,la,so*} $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig/
|
||||
endef
|
||||
|
||||
define Package/libprotobuf-c/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libprotobuf-c.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libprotobuf-c))
|
||||
$(eval $(call HostBuild))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
Index: protobuf-c-1.3.1/t/generated-code2/cxx-generate-packed-data.cc
|
||||
===================================================================
|
||||
--- protobuf-c-1.3.1.orig/t/generated-code2/cxx-generate-packed-data.cc
|
||||
+++ protobuf-c-1.3.1/t/generated-code2/cxx-generate-packed-data.cc
|
||||
@@ -998,7 +998,7 @@ static void dump_test_packed_repeated_en
|
||||
static void dump_test_unknown_fields (void)
|
||||
{
|
||||
EmptyMess mess;
|
||||
- const google::protobuf::Message::Reflection *reflection = mess.GetReflection();
|
||||
+ const google::protobuf::Reflection *reflection = mess.GetReflection();
|
||||
google::protobuf::UnknownFieldSet *fs = reflection->MutableUnknownFields(&mess);
|
||||
|
||||
#if GOOGLE_PROTOBUF_VERSION >= 2001000
|
||||
110
feeds/ipq807x/protobuf/Makefile
Normal file
110
feeds/ipq807x/protobuf/Makefile
Normal file
@@ -0,0 +1,110 @@
|
||||
#
|
||||
# Copyright (C) 2007-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=protobuf
|
||||
PKG_VERSION:=3.7.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-cpp-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/google/protobuf/releases/download/v$(PKG_VERSION)
|
||||
PKG_HASH:=97f6cdaa0724d5a8cd3375d5f5cf4bd253d5ad5291154f533ed0d94a9d501ef3
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_CPE_ID:=cpe:/a:google:protobuf
|
||||
|
||||
PKG_BUILD_DEPENDS:=protobuf/host
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Package/protobuf/Default
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=A structured data encoding library
|
||||
URL:=https://github.com/google/protobuf
|
||||
DEPENDS:=+zlib +libpthread +libatomic +libstdcpp
|
||||
MAINTAINER:=Ken Keys <kkeys@caida.org>
|
||||
endef
|
||||
|
||||
define Package/protobuf
|
||||
$(call Package/protobuf/Default)
|
||||
DEPENDS+=+protobuf-lite
|
||||
endef
|
||||
|
||||
define Package/protobuf-lite
|
||||
$(call Package/protobuf/Default)
|
||||
endef
|
||||
|
||||
define Package/protobuf/description/Default
|
||||
Protocol Buffers are a way of encoding structured data in an efficient
|
||||
yet extensible format. Google uses Protocol Buffers for almost all
|
||||
of its internal RPC protocols and file formats.
|
||||
endef
|
||||
|
||||
define Package/protobuf/description
|
||||
$(call Package/protobuf/description/Default)
|
||||
|
||||
This package provides the libprotoc, libprotobuf, and libprotobuf-lite
|
||||
libraries. For a much smaller protobuf package, see "protobuf-lite".
|
||||
|
||||
endef
|
||||
|
||||
define Package/protobuf-lite/description
|
||||
$(call Package/protobuf/description/Default)
|
||||
|
||||
This package provides the libprotobuf-lite library.
|
||||
|
||||
endef
|
||||
|
||||
EXTRA_CPPFLAGS+=-std=c++11
|
||||
CONFIGURE_ARGS += --with-protoc=$(STAGING_DIR_HOSTPKG)/bin/protoc
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) \
|
||||
$(1)/usr/lib \
|
||||
$(1)/usr/include
|
||||
|
||||
$(CP) \
|
||||
$(PKG_INSTALL_DIR)/usr/include/* \
|
||||
$(1)/usr/include/
|
||||
|
||||
$(CP) \
|
||||
$(PKG_INSTALL_DIR)/usr/lib/* \
|
||||
$(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/protobuf-lite/install
|
||||
$(INSTALL_DIR) \
|
||||
$(1)/usr/lib
|
||||
|
||||
$(CP) \
|
||||
$(PKG_INSTALL_DIR)/usr/lib/libprotobuf-lite.so* \
|
||||
$(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/protobuf/install
|
||||
$(INSTALL_DIR) \
|
||||
$(1)/usr/lib
|
||||
|
||||
$(CP) \
|
||||
$(PKG_INSTALL_DIR)/usr/lib/libprotoc.so* \
|
||||
$(1)/usr/lib/
|
||||
|
||||
$(CP) \
|
||||
$(PKG_INSTALL_DIR)/usr/lib/libprotobuf.so* \
|
||||
$(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,protobuf))
|
||||
$(eval $(call BuildPackage,protobuf-lite))
|
||||
$(eval $(call HostBuild))
|
||||
626
feeds/ipq807x/qca-nss-clients/Makefile
Normal file
626
feeds/ipq807x/qca-nss-clients/Makefile
Normal file
@@ -0,0 +1,626 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=qca-nss-clients
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_BRANCH:=master
|
||||
PKG_RELEASE:=2
|
||||
PKG_SOURCE_URL:=https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-clients/
|
||||
PKG_VERSION:=9136ef60bf68ceed760781d3acbeddb05470e432
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=$(PKG_VERSION)
|
||||
|
||||
#PKG_BUILD_DEPENDS := PACKAGE_kmod-qca-nss-crypto:kmod-qca-nss-crypto
|
||||
MAKE_OPTS:=
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
# Keep default as ipq806x for branches that does not have subtarget framework
|
||||
ifeq ($(CONFIG_TARGET_ipq),y)
|
||||
subtarget:=$(SUBTARGET)
|
||||
else
|
||||
subtarget:=$(CONFIG_TARGET_BOARD)
|
||||
endif
|
||||
|
||||
ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_ipq807x" "ipq60xx" "ipq807x_ipq60xx"))
|
||||
# DTLS Manager v2.0 for Hawkeye/Cypress
|
||||
DTLSMGR_DIR:=v2.0
|
||||
# IPsec Manager v2.0 for Hawkeye/Cypress
|
||||
IPSECMGR_DIR:=v2.0
|
||||
else
|
||||
# DTLS Manager v1.0 for Akronite.
|
||||
DTLSMGR_DIR:=v1.0
|
||||
# IPsec Manager v1.0 for Akronite.
|
||||
IPSECMGR_DIR:=v1.0
|
||||
endif
|
||||
|
||||
define KernelPackage/qca-nss-drv-tun6rd
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS (connection manager) - tun6rd
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-sit @!LINUX_3_18
|
||||
FILES:=$(PKG_BUILD_DIR)/qca-nss-tun6rd.ko
|
||||
AUTOLOAD:=$(call AutoLoad,60,qca-nss-tun6rd)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-tun6rd/Description
|
||||
Kernel modules for NSS connection manager - Support for 6rd tunnel
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-dtlsmgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS (connection manager) - dtlsmgr
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-cfi-cryptoapi @!LINUX_3_18
|
||||
FILES:=$(PKG_BUILD_DIR)/dtls/$(DTLSMGR_DIR)/qca-nss-dtlsmgr.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-dtls/Description
|
||||
Kernel modules for NSS connection manager - Support for DTLS sessions
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-tlsmgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS (connection manager) - tlsmgr
|
||||
DEPENDS:=@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx +kmod-qca-nss-drv +kmod-qca-nss-cfi @!LINUX_3_18
|
||||
FILES:=$(PKG_BUILD_DIR)/tls/qca-nss-tlsmgr.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-tls/Description
|
||||
Kernel modules for NSS connection manager - Support for TLS sessions
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-l2tpv2
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS (connection manager) - l2tp
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-ppp +kmod-l2tp @!LINUX_3_18
|
||||
FILES:=$(PKG_BUILD_DIR)/l2tp/l2tpv2/qca-nss-l2tpv2.ko
|
||||
AUTOLOAD:=$(call AutoLoad,51,qca-nss-l2tpv2)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-l2tp/Description
|
||||
Kernel modules for NSS connection manager - Support for l2tp tunnel
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-pptp
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS (connection manager) - PPTP
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-pptp @!LINUX_3_18
|
||||
FILES:=$(PKG_BUILD_DIR)/pptp/qca-nss-pptp.ko
|
||||
AUTOLOAD:=$(call AutoLoad,51,qca-nss-pptp)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-pptp/Description
|
||||
Kernel modules for NSS connection manager - Support for PPTP tunnel
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-pppoe
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS (connection manager) - PPPoE
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-pppoe @!LINUX_3_18 \
|
||||
+!(TARGET_ipq_ipq807x_QSDK_256||TARGET_ipq_ipq60xx_QSDK_256):kmod-bonding
|
||||
FILES:=$(PKG_BUILD_DIR)/pppoe/qca-nss-pppoe.ko
|
||||
AUTOLOAD:=$(call AutoLoad,51,qca-nss-pppoe)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-pppoe/Description
|
||||
Kernel modules for NSS connection manager - Support for PPPoE
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-map-t
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS (connection manager) - MAP-T
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-nat46 @!LINUX_3_18
|
||||
FILES:=$(PKG_BUILD_DIR)/map/map-t/qca-nss-map-t.ko
|
||||
AUTOLOAD:=$(call AutoLoad,51,qca-nss-map-t)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-map-t/Description
|
||||
Kernel modules for NSS connection manager - Support for MAP-T
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-gre
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS (connection manager) - GRE
|
||||
DEPENDS:=@TARGET_ipq_ipq806x||TARGET_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64 \
|
||||
+kmod-qca-nss-drv @!LINUX_3_18 +kmod-gre6
|
||||
FILES:=$(PKG_BUILD_DIR)/gre/qca-nss-gre.ko $(PKG_BUILD_DIR)/gre/test/qca-nss-gre-test.ko
|
||||
AUTOLOAD:=$(call AutoLoad,51,qca-nss-gre)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-gre/Description
|
||||
Kernel modules for NSS connection manager - Support for GRE
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-tunipip6
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS (connection manager) - DS-lite and ipip6 Tunnel
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-iptunnel6 +kmod-ip6-tunnel @!LINUX_3_18
|
||||
FILES:=$(PKG_BUILD_DIR)/tunipip6/qca-nss-tunipip6.ko
|
||||
AUTOLOAD:=$(call AutoLoad,60,qca-nss-tunipip6)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-tunipip6/Description
|
||||
Kernel modules for NSS connection manager
|
||||
Add support for DS-lite and ipip6 tunnel
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-profile
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18
|
||||
TITLE:=Profiler for QCA NSS driver (IPQ806x)
|
||||
FILES:=$(PKG_BUILD_DIR)/profiler/qca-nss-profile-drv.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-profile/Description
|
||||
This package contains a NSS driver profiler for QCA chipset
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-ipsecmgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS (ipsec manager) - ipsecmgr
|
||||
DEPENDS:=@TARGET_ipq806x||TARGET_ipq_ipq806x||TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx \
|
||||
+kmod-qca-nss-drv +kmod-qca-nss-cfi-cryptoapi +kmod-qca-nss-cfi-ocf @!LINUX_3_18
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-l2tpv2),)
|
||||
DEPENDS:=+kmod-qca-nss-drv-l2tpv2
|
||||
endif
|
||||
FILES:=$(PKG_BUILD_DIR)/ipsecmgr/$(IPSECMGR_DIR)/qca-nss-ipsecmgr.ko
|
||||
AUTOLOAD:=$(call AutoLoad,60,qca-nss-ipsecmgr)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-ipsecmgr/Description
|
||||
Kernel module for NSS IPsec offload manager
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-ipsecmgr-klips
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS (ipsec klips)
|
||||
DEPENDS:=@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx \
|
||||
+kmod-qca-nss-drv-ipsecmgr kmod-qca-nss-ecm
|
||||
FILES:=$(PKG_BUILD_DIR)/ipsecmgr/$(IPSECMGR_DIR)/plugins/klips/qca-nss-ipsec-klips.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-ipsecmgr-klips/Description
|
||||
NSS Kernel module for IPsec klips offload
|
||||
endef
|
||||
|
||||
|
||||
define KernelPackage/qca-nss-drv-capwapmgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-drv-dtlsmgr @!LINUX_3_18
|
||||
TITLE:=NSS CAPWAP Manager for QCA NSS driver (IPQ806x)
|
||||
FILES:=$(PKG_BUILD_DIR)/capwapmgr/qca-nss-capwapmgr.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-capwapmgr/Description
|
||||
This package contains a NSS CAPWAP Manager
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-bridge-mgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS bridge manager
|
||||
DEPENDS:=@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx \
|
||||
+TARGET_ipq_ipq807x:kmod-qca-nss-drv-vlan-mgr \
|
||||
+TARGET_ipq_ipq807x_ipq807x:kmod-qca-nss-drv-vlan-mgr \
|
||||
+TARGET_ipq807x:kmod-qca-nss-drv-vlan-mgr \
|
||||
+TARGET_ipq807x_ipq807x:kmod-qca-nss-drv-vlan-mgr \
|
||||
+TARGET_ipq_ipq60xx:kmod-qca-nss-drv-vlan-mgr \
|
||||
+TARGET_ipq807x_ipq60xx:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \
|
||||
+!(TARGET_ipq_ipq807x_QSDK_256||TARGET_ipq_ipq60xx_QSDK_256):kmod-bonding
|
||||
FILES:=$(PKG_BUILD_DIR)/bridge/qca-nss-bridge-mgr.ko
|
||||
AUTOLOAD:=$(call AutoLoad,51,qca-nss-bridge-mgr)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-bridge-mgr/Description
|
||||
Kernel modules for NSS bridge manager
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-vlan-mgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS vlan manager
|
||||
DEPENDS:=@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx +kmod-qca-nss-drv @!LINUX_3_18 \
|
||||
+!(TARGET_ipq_ipq807x_QSDK_256||TARGET_ipq_ipq60xx_QSDK_256):kmod-bonding
|
||||
FILES:=$(PKG_BUILD_DIR)/vlan/qca-nss-vlan.ko
|
||||
AUTOLOAD:=$(call AutoLoad,51,qca-nss-vlan)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-vlan-mgr/Description
|
||||
Kernel modules for NSS vlan manager
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-qdisc
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Support
|
||||
TITLE:=Qdisc for configuring shapers in NSS
|
||||
DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18
|
||||
FILES:=$(PKG_BUILD_DIR)/nss_qdisc/qca-nss-qdisc.ko
|
||||
AUTOLOAD:=$(call AutoLoad,58,qca-nss-qdisc)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-qdisc/Description
|
||||
Linux qdisc that aids in configuring shapers in the NSS
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-igs
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Support
|
||||
TITLE:=Action for offloading traffic to an IFB interface to perform ingress shaping.
|
||||
DEPENDS:=@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64 \
|
||||
+kmod-qca-nss-drv +kmod-sched-core +kmod-ifb +kmod-qca-nss-drv-qdisc @!LINUX_3_18
|
||||
FILES:=$(PKG_BUILD_DIR)/nss_qdisc/igs/act_nssmirred.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-igs/Description
|
||||
Linux action that helps in offloading traffic to an IFB interface to perform ingress shaping.
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-lag-mgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS LAG manager
|
||||
DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18 \
|
||||
+TARGET_ipq_ipq807x:kmod-qca-nss-drv-vlan-mgr \
|
||||
+TARGET_ipq_ipq807x_ipq807x:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \
|
||||
+TARGET_ipq807x:kmod-qca-nss-drv-vlan-mgr \
|
||||
+TARGET_ipq807x_ipq807x:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \
|
||||
+TARGET_ipq_ipq60xx:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \
|
||||
+TARGET_ipq807x_ipq60xx:kmod-qca-nss-drv-vlan-mgr @!LINUX_3_18 \
|
||||
+kmod-bonding
|
||||
FILES:=$(PKG_BUILD_DIR)/lag/qca-nss-lag-mgr.ko
|
||||
AUTOLOAD:=$(call AutoLoad,51,qca-nss-lag-mgr)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-lag-mgr/Description
|
||||
Kernel modules for NSS LAG manager
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-netlink
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
DEPENDS:=@TARGET_ipq807x||TARGET_ipq_ipq807x||TARGET_ipq807x_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx||TARGET_ipq_ipq50xx||TARGET_ipq_ipq50xx_64 \
|
||||
+kmod-qca-nss-drv @!LINUX_3_18 \
|
||||
+PACKAGE_kmod-qca-nss-drv-ipsecmgr:kmod-qca-nss-drv-ipsecmgr \
|
||||
+PACKAGE_kmod-qca-nss-drv-dtlsmgr:kmod-qca-nss-drv-dtlsmgr \
|
||||
+PACKAGE_kmod-qca-nss-drv-capwapmgr:kmod-qca-nss-drv-capwapmgr @!LINUX_3_18
|
||||
TITLE:=NSS NETLINK Manager for QCA NSS driver
|
||||
FILES:=$(PKG_BUILD_DIR)/netlink/qca-nss-netlink.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-netlink/Description
|
||||
Kernel module for NSS netlink manager
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-ovpn-mgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for NSS OpenVPN manager
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-cfi +kmod-tun +kmod-ipt-conntrack @!LINUX_3_18 \
|
||||
@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx
|
||||
FILES:=$(PKG_BUILD_DIR)/openvpn/src/qca-nss-ovpn-mgr.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-ovpn-mgr/Description
|
||||
Kernel module for NSS OpenVPN manager
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-ovpn-link
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Kernel driver for interfacing NSS OpenVPN manager with ECM
|
||||
DEPENDS:=+kmod-qca-nss-drv-ovpn-mgr +kmod-qca-nss-ecm-premium @!LINUX_3_18 \
|
||||
@TARGET_ipq_ipq807x||TARGET_ipq_ipq807x_ipq807x||TARGET_ipq_ipq60xx||TARGET_ipq807x_ipq60xx
|
||||
FILES:=$(PKG_BUILD_DIR)/openvpn/plugins/qca-nss-ovpn-link.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-ovpn-link/Description
|
||||
This module registers with ECM and communicates with NSS OpenVPN manager for supporting OpenVPN offload.
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-pvxlanmgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18
|
||||
TITLE:=NSS PVXLAN Manager for QCA NSS driver
|
||||
FILES:=$(PKG_BUILD_DIR)/pvxlanmgr/qca-nss-pvxlanmgr.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-pvxlanmgr/Description
|
||||
Kernel module for managing NSS PVxLAN
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-eogremgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-drv-gre @!LINUX_3_18
|
||||
TITLE:=NSS EOGRE Manager for QCA NSS driver
|
||||
FILES:=$(PKG_BUILD_DIR)/eogremgr/qca-nss-eogremgr.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-eogremgr/Description
|
||||
Kernel module for managing NSS EoGRE
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-clmapmgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-qca-nss-drv-eogremgr @!LINUX_3_18
|
||||
TITLE:=NSS clmap Manager for QCA NSS driver
|
||||
FILES:=$(PKG_BUILD_DIR)/clmapmgr/qca-nss-clmapmgr.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-clmapmgr/Description
|
||||
Kernel module for managing NSS clmap
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-vxlanmgr
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
DEPENDS:=+kmod-qca-nss-drv +kmod-vxlan @!LINUX_3_18
|
||||
TITLE:=NSS VxLAN Manager for QCA NSS driver
|
||||
FILES:=$(PKG_BUILD_DIR)/vxlanmgr/qca-nss-vxlanmgr.ko
|
||||
AUTOLOAD:=$(call AutoLoad,51,qca-nss-vxlanmgr)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-vxlanmgr/Description
|
||||
Kernel module for managing NSS VxLAN
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-match
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18
|
||||
TITLE:=NSS Match for QCA NSS driver
|
||||
FILES:=$(PKG_BUILD_DIR)/match/qca-nss-match.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-match/Description
|
||||
Kernel module for managing NSS Match
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-mirror
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Support
|
||||
TITLE:=Module for mirroring packets from NSS to host.
|
||||
DEPENDS:=+kmod-qca-nss-drv @!LINUX_3_18
|
||||
FILES:=$(PKG_BUILD_DIR)/mirror/qca-nss-mirror.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-mirror/Description
|
||||
Kernel module for managing NSS Mirror
|
||||
endef
|
||||
|
||||
define Build/InstallDev/qca-nss-clients
|
||||
$(INSTALL_DIR) $(1)/usr/include/qca-nss-clients
|
||||
$(CP) $(PKG_BUILD_DIR)/netlink/include/* $(1)/usr/include/qca-nss-clients/
|
||||
$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-clients/
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(call Build/InstallDev/qca-nss-clients,$(1))
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-ovpn-mgr/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/qca-nss-ovpn.init $(1)/etc/init.d/qca-nss-ovpn
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-ipsecmgr-klips/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/qca-nss-ipsec $(1)/etc/init.d/qca-nss-ipsec
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-drv-igs/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/qca-nss-mirred.init $(1)/etc/init.d/qca-nss-mirred
|
||||
endef
|
||||
|
||||
EXTRA_CFLAGS+= \
|
||||
-I$(STAGING_DIR)/usr/include/qca-nss-drv \
|
||||
-I$(STAGING_DIR)/usr/include/qca-nss-crypto \
|
||||
-I$(STAGING_DIR)/usr/include/qca-nss-cfi \
|
||||
-I$(STAGING_DIR)/usr/include/qca-nss-gmac \
|
||||
-I$(STAGING_DIR)/usr/include/qca-ssdk \
|
||||
-I$(STAGING_DIR)/usr/include/qca-ssdk/fal \
|
||||
-I$(STAGING_DIR)/usr/include/nat46
|
||||
|
||||
# Build individual packages if selected
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-profile),)
|
||||
MAKE_OPTS+=profile=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-capwapmgr),)
|
||||
MAKE_OPTS+=capwapmgr=y
|
||||
EXTRA_CFLAGS += -DNSS_CAPWAPMGR_ONE_NETDEV
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tun6rd),)
|
||||
MAKE_OPTS+=tun6rd=m
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-dtlsmgr),)
|
||||
MAKE_OPTS+=dtlsmgr=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tlsmgr),)
|
||||
MAKE_OPTS+=tlsmgr=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-l2tpv2),)
|
||||
MAKE_OPTS+=l2tpv2=y
|
||||
EXTRA_CFLAGS += -DNSS_L2TPV2_ENABLED
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pptp),)
|
||||
MAKE_OPTS+=pptp=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-map-t),)
|
||||
MAKE_OPTS+=map-t=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tunipip6),)
|
||||
MAKE_OPTS+=tunipip6=m
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-qdisc),)
|
||||
MAKE_OPTS+=qdisc=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-igs),)
|
||||
MAKE_OPTS+=igs=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ipsecmgr),)
|
||||
EXTRA_CFLAGS+= -I$(PKG_BUILD_DIR)/exports
|
||||
MAKE_OPTS+=ipsecmgr=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ipsecmgr-klips),)
|
||||
EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-nss-ecm
|
||||
MAKE_OPTS+=ipsecmgr-klips=m
|
||||
endif
|
||||
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-bridge-mgr),)
|
||||
MAKE_OPTS+=bridge-mgr=y
|
||||
#enable OVS bridge if ovsmgr is enabled
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-ovsmgr),)
|
||||
MAKE_OPTS+= NSS_BRIDGE_MGR_OVS_ENABLE=y
|
||||
EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-ovsmgr
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-vlan-mgr),)
|
||||
MAKE_OPTS+=vlan-mgr=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-lag-mgr),)
|
||||
MAKE_OPTS+=lag-mgr=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-gre),)
|
||||
EXTRA_CFLAGS+= -I$(PKG_BUILD_DIR)/exports
|
||||
MAKE_OPTS+=gre=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pppoe),)
|
||||
MAKE_OPTS+=pppoe=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-netlink),)
|
||||
MAKE_OPTS+=netlink=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ovpn-mgr),)
|
||||
MAKE_OPTS+=ovpn-mgr=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ovpn-link),)
|
||||
MAKE_OPTS+=ovpn-link=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pvxlanmgr),)
|
||||
MAKE_OPTS+=pvxlanmgr=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-eogremgr),)
|
||||
MAKE_OPTS+=eogremgr=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-clmapmgr),)
|
||||
MAKE_OPTS+=clmapmgr=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-vxlanmgr),)
|
||||
MAKE_OPTS+=vxlanmgr=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-match),)
|
||||
MAKE_OPTS+=match=y
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-mirror),)
|
||||
MAKE_OPTS+=mirror=y
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" $(strip $(MAKE_OPTS)) \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
|
||||
SoC="$(subtarget)" \
|
||||
DTLSMGR_DIR="$(DTLSMGR_DIR)" \
|
||||
IPSECMGR_DIR="$(IPSECMGR_DIR)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,qca-nss-drv-profile))
|
||||
#$(eval $(call KernelPackage,qca-nss-drv-capwapmgr))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-tun6rd))
|
||||
#$(eval $(call KernelPackage,qca-nss-drv-dtlsmgr))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-l2tpv2))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-pptp))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-pppoe))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-map-t))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-tunipip6))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-qdisc))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-igs))
|
||||
#$(eval $(call KernelPackage,qca-nss-drv-netlink))
|
||||
#$(eval $(call KernelPackage,qca-nss-drv-ipsecmgr))
|
||||
#$(eval $(call KernelPackage,qca-nss-drv-ipsecmgr-klips))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-bridge-mgr))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-vlan-mgr))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-lag-mgr))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-gre))
|
||||
#$(eval $(call KernelPackage,qca-nss-drv-ovpn-mgr))
|
||||
#$(eval $(call KernelPackage,qca-nss-drv-ovpn-link))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-pvxlanmgr))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-eogremgr))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-clmapmgr))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-vxlanmgr))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-match))
|
||||
#$(eval $(call KernelPackage,qca-nss-drv-tlsmgr))
|
||||
$(eval $(call KernelPackage,qca-nss-drv-mirror))
|
||||
92
feeds/ipq807x/qca-nss-clients/files/qca-nss-ipsec
Executable file
92
feeds/ipq807x/qca-nss-clients/files/qca-nss-ipsec
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#
|
||||
# Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
NSS_IPSEC_LOG_FILE=/tmp/.nss_ipsec_log
|
||||
NSS_IPSEC_LOG_STR_ECM="ECM_Loaded"
|
||||
|
||||
ecm_load () {
|
||||
if [ ! -d /sys/module/ecm ]; then
|
||||
/etc/init.d/qca-nss-ecm start
|
||||
if [ -d /sys/module/ecm ]; then
|
||||
echo ${NSS_IPSEC_LOG_STR_ECM} >> ${NSS_IPSEC_LOG_FILE}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ecm_unload () {
|
||||
if [ -f /tmp/.nss_ipsec_log ]; then
|
||||
str=`grep ${NSS_IPSEC_LOG_STR_ECM} ${NSS_IPSEC_LOG_FILE}`
|
||||
if [[ $str == ${NSS_IPSEC_LOG_STR_ECM} ]]; then
|
||||
/etc/init.d/qca-nss-ecm stop
|
||||
`sed 's/${NSS_IPSEC_LOG_STR_ECM}/ /g' $NSS_IPSEC_LOG_FILE > $NSS_IPSEC_LOG_FILE`
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
ecm_disable() {
|
||||
|
||||
if [ ! -d /sys/module/ecm ]; then
|
||||
return;
|
||||
fi
|
||||
|
||||
echo 1 > /sys/kernel/debug/ecm/front_end_ipv4_stop
|
||||
echo 1 > /sys/kernel/debug/ecm/front_end_ipv6_stop
|
||||
echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all
|
||||
sleep 2
|
||||
}
|
||||
|
||||
ecm_enable() {
|
||||
if [ ! -d /sys/module/ecm ]; then
|
||||
return;
|
||||
fi
|
||||
|
||||
echo 0 > /sys/kernel/debug/ecm/ecm_db/defunct_all
|
||||
echo 0 > /sys/kernel/debug/ecm/front_end_ipv4_stop
|
||||
echo 0 > /sys/kernel/debug/ecm/front_end_ipv6_stop
|
||||
}
|
||||
|
||||
start() {
|
||||
ecm_load
|
||||
|
||||
local kernel_version=$(uname -r)
|
||||
|
||||
insmod /lib/modules/${kernel_version}/qca-nss-ipsec-klips.ko
|
||||
if [ "$?" -gt 0 ]; then
|
||||
echo "Failed to load plugin. Please start ecm if not done already"
|
||||
ecm_enable
|
||||
return
|
||||
fi
|
||||
|
||||
/etc/init.d/ipsec start
|
||||
sleep 2
|
||||
ipsec eroute
|
||||
|
||||
ecm_enable
|
||||
}
|
||||
|
||||
stop() {
|
||||
ecm_disable
|
||||
|
||||
/etc/init.d/ipsec stop
|
||||
rmmod qca-nss-ipsec-klips
|
||||
|
||||
ecm_unload
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
52
feeds/ipq807x/qca-nss-dp/Makefile
Normal file
52
feeds/ipq807x/qca-nss-dp/Makefile
Normal file
@@ -0,0 +1,52 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=qca-nss-dp
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_BRANCH:=master
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/qca-nss-dp
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
DEPENDS:=@TARGET_ipq807x +kmod-qca-ssdk
|
||||
TITLE:=Kernel driver for NSS data plane
|
||||
FILES:=$(PKG_BUILD_DIR)/qca-nss-dp.ko
|
||||
AUTOLOAD:=$(call AutoLoad,31,qca-nss-dp)
|
||||
endef
|
||||
|
||||
define KernelPackage/qca-nss-dp/Description
|
||||
This package contains a NSS data plane driver for QCA chipset
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
mkdir -p $(1)/usr/include/qca-nss-dp
|
||||
$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-dp/
|
||||
endef
|
||||
|
||||
EXTRA_CFLAGS+= \
|
||||
-I$(STAGING_DIR)/usr/include/qca-ssdk
|
||||
|
||||
subtarget:=$(SUBTARGET)
|
||||
|
||||
NSS_DP_HAL_DIR:=$(PKG_BUILD_DIR)/hal
|
||||
hal_arch:=$(subtarget)
|
||||
|
||||
define Build/Configure
|
||||
$(LN) $(NSS_DP_HAL_DIR)/arch/$(hal_arch)/nss_$(hal_arch).h \
|
||||
$(PKG_BUILD_DIR)/exports/nss_dp_arch.h
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(subtarget)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,qca-nss-dp))
|
||||
56
feeds/ipq807x/qca-nss-dp/src/Makefile
Normal file
56
feeds/ipq807x/qca-nss-dp/src/Makefile
Normal file
@@ -0,0 +1,56 @@
|
||||
###################################################
|
||||
# Makefile for the NSS data plane driver
|
||||
###################################################
|
||||
|
||||
obj ?= .
|
||||
|
||||
obj-m += qca-nss-dp.o
|
||||
|
||||
qca-nss-dp-objs += nss_dp_attach.o \
|
||||
nss_dp_ethtools.o \
|
||||
nss_dp_main.o
|
||||
|
||||
ifneq ($(CONFIG_NET_SWITCHDEV),)
|
||||
qca-nss-dp-objs += nss_dp_switchdev.o
|
||||
endif
|
||||
|
||||
ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64 ipq60xx ipq60xx_64))
|
||||
qca-nss-dp-objs += hal/edma/edma_cfg.o \
|
||||
hal/edma/edma_data_plane.o \
|
||||
hal/edma/edma_tx_rx.o \
|
||||
hal/gmac_hal_ops/qcom/qcom_if.o \
|
||||
hal/gmac_hal_ops/syn/xgmac/syn_if.o
|
||||
endif
|
||||
|
||||
NSS_DP_INCLUDE = -I$(obj)/include -I$(obj)/exports -I$(obj)/gmac_hal_ops/include \
|
||||
-I$(obj)/hal/include
|
||||
|
||||
ifeq ($(SoC),$(filter $(SoC),ipq50xx ipq50xx_64))
|
||||
NSS_DP_INCLUDE += -I$(obj)/hal/gmac_hal_ops/syn/gmac
|
||||
endif
|
||||
|
||||
ccflags-y += $(NSS_DP_INCLUDE)
|
||||
ccflags-y += -Werror
|
||||
|
||||
ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64 ipq60xx ipq60xx_64))
|
||||
ccflags-y += -DNSS_DP_PPE_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64))
|
||||
qca-nss-dp-objs += hal/arch/ipq60xx/nss_ipq60xx.o
|
||||
ccflags-y += -DNSS_DP_IPQ60XX
|
||||
endif
|
||||
|
||||
ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64))
|
||||
qca-nss-dp-objs += hal/arch/ipq807x/nss_ipq807x.o
|
||||
ccflags-y += -DNSS_DP_IPQ807X
|
||||
endif
|
||||
|
||||
ifeq ($(SoC),$(filter $(SoC),ipq50xx ipq50xx_64))
|
||||
qca-nss-dp-objs += hal/arch/ipq50xx/nss_ipq50xx.o \
|
||||
hal/gmac_hal_ops/syn/gmac/syn_if.o \
|
||||
hal/syn_gmac_dp/syn_data_plane.o \
|
||||
hal/syn_gmac_dp/syn_dp_tx_rx.o \
|
||||
hal/syn_gmac_dp/syn_dp_cfg.o
|
||||
ccflags-y += -DNSS_DP_IPQ50XX
|
||||
endif
|
||||
219
feeds/ipq807x/qca-nss-dp/src/exports/nss_dp_api_if.h
Normal file
219
feeds/ipq807x/qca-nss-dp/src/exports/nss_dp_api_if.h
Normal file
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
**************************************************************************
|
||||
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file nss_dp_api_if.h
|
||||
* nss-dp exported structures/apis.
|
||||
*
|
||||
* This file declares all the public interfaces
|
||||
* for NSS data-plane driver.
|
||||
*/
|
||||
|
||||
#ifndef __NSS_DP_API_IF_H
|
||||
#define __NSS_DP_API_IF_H
|
||||
|
||||
#include "nss_dp_arch.h"
|
||||
|
||||
/**
|
||||
* @addtogroup nss_dp_subsystem
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*
|
||||
* NSS DP status
|
||||
*/
|
||||
#define NSS_DP_SUCCESS 0
|
||||
#define NSS_DP_FAILURE -1
|
||||
|
||||
/*
|
||||
* NSS DP platform specific defines
|
||||
*/
|
||||
#define NSS_DP_START_IFNUM NSS_DP_HAL_START_IFNUM
|
||||
/**< First GMAC interface number (0/1) depending on SoC. */
|
||||
#define NSS_DP_MAX_MTU_SIZE NSS_DP_HAL_MAX_MTU_SIZE
|
||||
#define NSS_DP_MAX_PACKET_LEN NSS_DP_HAL_MAX_PACKET_LEN
|
||||
#define NSS_DP_MAX_INTERFACES (NSS_DP_HAL_MAX_PORTS + NSS_DP_HAL_START_IFNUM)
|
||||
/**< Last interface index for the SoC, to be used by qca-nss-drv. */
|
||||
|
||||
/*
|
||||
* NSS PTP service code
|
||||
*/
|
||||
#define NSS_PTP_EVENT_SERVICE_CODE 0x9
|
||||
|
||||
/**
|
||||
* nss_dp_data_plane_ctx
|
||||
* Data plane context base class.
|
||||
*/
|
||||
struct nss_dp_data_plane_ctx {
|
||||
struct net_device *dev;
|
||||
};
|
||||
|
||||
/**
|
||||
* nss_dp_gmac_stats
|
||||
* The per-GMAC statistics structure.
|
||||
*/
|
||||
struct nss_dp_gmac_stats {
|
||||
struct nss_dp_hal_gmac_stats stats;
|
||||
};
|
||||
|
||||
/**
|
||||
* nss_dp_data_plane_ops
|
||||
* Per data-plane ops structure.
|
||||
*
|
||||
* Default would be slowpath and can be overridden by nss-drv
|
||||
*/
|
||||
struct nss_dp_data_plane_ops {
|
||||
int (*init)(struct nss_dp_data_plane_ctx *dpc);
|
||||
int (*open)(struct nss_dp_data_plane_ctx *dpc, uint32_t tx_desc_ring,
|
||||
uint32_t rx_desc_ring, uint32_t mode);
|
||||
int (*close)(struct nss_dp_data_plane_ctx *dpc);
|
||||
int (*link_state)(struct nss_dp_data_plane_ctx *dpc,
|
||||
uint32_t link_state);
|
||||
int (*mac_addr)(struct nss_dp_data_plane_ctx *dpc, uint8_t *addr);
|
||||
int (*change_mtu)(struct nss_dp_data_plane_ctx *dpc, uint32_t mtu);
|
||||
netdev_tx_t (*xmit)(struct nss_dp_data_plane_ctx *dpc, struct sk_buff *os_buf);
|
||||
void (*set_features)(struct nss_dp_data_plane_ctx *dpc);
|
||||
int (*pause_on_off)(struct nss_dp_data_plane_ctx *dpc,
|
||||
uint32_t pause_on);
|
||||
int (*vsi_assign)(struct nss_dp_data_plane_ctx *dpc, uint32_t vsi);
|
||||
int (*vsi_unassign)(struct nss_dp_data_plane_ctx *dpc, uint32_t vsi);
|
||||
int (*rx_flow_steer)(struct nss_dp_data_plane_ctx *dpc, struct sk_buff *skb,
|
||||
uint32_t cpu, bool is_add);
|
||||
void (*get_stats)(struct nss_dp_data_plane_ctx *dpc, struct nss_dp_gmac_stats *stats);
|
||||
int (*deinit)(struct nss_dp_data_plane_ctx *dpc);
|
||||
};
|
||||
|
||||
/**
|
||||
* nss_dp_receive
|
||||
* Called by overlay drivers to deliver packets to nss-dp.
|
||||
*
|
||||
* @datatypes
|
||||
* net_device
|
||||
* sk_buff
|
||||
* napi_struct
|
||||
*
|
||||
* @param[in] netdev Pointer to netdev structure on which packet is received.
|
||||
* @param[in] skb Pointer to the received packet.
|
||||
* @param[in] napi Pointer to napi context.
|
||||
*/
|
||||
void nss_dp_receive(struct net_device *netdev, struct sk_buff *skb,
|
||||
struct napi_struct *napi);
|
||||
|
||||
/**
|
||||
* nss_dp_is_in_open_state
|
||||
* Returns if a data plane is opened or not.
|
||||
*
|
||||
* @datatypes
|
||||
* net_device
|
||||
*
|
||||
* @param[in] netdev Pointer to netdev structure.
|
||||
*
|
||||
* @return
|
||||
* bool
|
||||
*/
|
||||
bool nss_dp_is_in_open_state(struct net_device *netdev);
|
||||
|
||||
/**
|
||||
* nss_dp_override_data_palne
|
||||
* API to allow overlay drivers to override the data plane.
|
||||
*
|
||||
* @datatypes
|
||||
* net_device
|
||||
* nss_dp_data_plane_ops
|
||||
* nss_dp_data_plane_ctx
|
||||
*
|
||||
* @param[in] netdev Pointer to netdev structure.
|
||||
* @param[in] dp_ops Pointer to respective data plane ops structure.
|
||||
* @param[in] dpc Pointer to data plane context.
|
||||
*
|
||||
* @return
|
||||
* int
|
||||
*/
|
||||
int nss_dp_override_data_plane(struct net_device *netdev,
|
||||
struct nss_dp_data_plane_ops *dp_ops,
|
||||
struct nss_dp_data_plane_ctx *dpc);
|
||||
|
||||
/**
|
||||
* nss_dp_start_data_plane
|
||||
* Dataplane API to inform netdev when it is ready to start.
|
||||
*
|
||||
* @datatypes
|
||||
* net_device
|
||||
* nss_dp_data_plane_ctx
|
||||
*
|
||||
* @param[in] netdev Pointer to netdev structure.
|
||||
* @param[in] dpc Pointer to data plane context.
|
||||
*/
|
||||
void nss_dp_start_data_plane(struct net_device *netdev,
|
||||
struct nss_dp_data_plane_ctx *dpc);
|
||||
|
||||
/**
|
||||
* nss_dp_restore_data_plane
|
||||
* Called by overlay drivers to detach itself from nss-dp.
|
||||
*
|
||||
* @datatypes
|
||||
* net_device
|
||||
*
|
||||
* @param[in] netdev Pointer to netdev structure.
|
||||
*/
|
||||
void nss_dp_restore_data_plane(struct net_device *netdev);
|
||||
|
||||
/**
|
||||
* nss_dp_get_netdev_by_nss_if_num
|
||||
* Returns the net device of the corresponding id if it exists.
|
||||
*
|
||||
* @datatypes
|
||||
* int
|
||||
*
|
||||
* @param[in] interface ID of the physical mac port.
|
||||
*
|
||||
* @return
|
||||
* Pointer to netdev structure.
|
||||
*/
|
||||
struct net_device *nss_dp_get_netdev_by_nss_if_num(int if_num);
|
||||
|
||||
/**
|
||||
* nss_phy_tstamp_rx_buf
|
||||
* Receive timestamp packet.
|
||||
*
|
||||
* @datatypes
|
||||
* sk_buff
|
||||
*
|
||||
* @param[in] app_data Pointer to the application context of the message.
|
||||
* @param[in] skb Pointer to the packet.
|
||||
*/
|
||||
void nss_phy_tstamp_rx_buf(void *app_data, struct sk_buff *skb);
|
||||
|
||||
/**
|
||||
* nss_phy_tstamp_tx_buf
|
||||
* Transmit timestamp packet
|
||||
*
|
||||
* @datatypes
|
||||
* net_device
|
||||
* sk_buff
|
||||
*
|
||||
* @param[in] net_device Pointer to netdev structure.
|
||||
* @param[in] skb Pointer to the packet.
|
||||
*/
|
||||
void nss_phy_tstamp_tx_buf(struct net_device *ndev, struct sk_buff *skb);
|
||||
|
||||
/**
|
||||
*@}
|
||||
*/
|
||||
|
||||
#endif /** __NSS_DP_API_IF_H */
|
||||
148
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq50xx/nss_ipq50xx.c
Normal file
148
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq50xx/nss_ipq50xx.c
Normal file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/of.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include "nss_dp_hal.h"
|
||||
|
||||
/*
|
||||
* nss_dp_hal_tcsr_base_get
|
||||
* Reads TCSR base address from DTS
|
||||
*/
|
||||
static uint32_t nss_dp_hal_tcsr_base_get(void)
|
||||
{
|
||||
uint32_t tcsr_base_addr = 0;
|
||||
struct device_node *dp_cmn;
|
||||
|
||||
/*
|
||||
* Get reference to NSS dp common device node
|
||||
*/
|
||||
dp_cmn = of_find_node_by_name(NULL, "nss-dp-common");
|
||||
if (!dp_cmn) {
|
||||
pr_info("%s: NSS DP common node not found\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (of_property_read_u32(dp_cmn, "qcom,tcsr-base", &tcsr_base_addr)) {
|
||||
pr_err("%s: error reading TCSR base\n", __func__);
|
||||
}
|
||||
of_node_put(dp_cmn);
|
||||
|
||||
return tcsr_base_addr;
|
||||
}
|
||||
|
||||
/*
|
||||
* nss_dp_hal_tcsr_set
|
||||
* Sets the TCSR axi cache override register
|
||||
*/
|
||||
static void nss_dp_hal_tcsr_set(void)
|
||||
{
|
||||
void __iomem *tcsr_addr = NULL;
|
||||
uint32_t tcsr_base;
|
||||
int err;
|
||||
|
||||
tcsr_base = nss_dp_hal_tcsr_base_get();
|
||||
if (!tcsr_base) {
|
||||
pr_err("%s: Unable to get TCSR base address\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if Trust Zone is enabled in the system.
|
||||
* If yes, we need to go through SCM API call to program TCSR register.
|
||||
* If TZ is not enabled, we can write to the register directly.
|
||||
*/
|
||||
if (qcom_scm_is_available()) {
|
||||
err = qcom_scm_tcsr_reg_write((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
|
||||
TCSR_GMAC_AXI_CACHE_OVERRIDE_VALUE);
|
||||
if (err) {
|
||||
pr_err("%s: SCM TCSR write error: %d\n", __func__, err);
|
||||
}
|
||||
} else {
|
||||
tcsr_addr = ioremap_nocache((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
|
||||
TCSR_GMAC_AXI_CACHE_OVERRIDE_REG_SIZE);
|
||||
if (!tcsr_addr) {
|
||||
pr_err("%s: ioremap failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
writel(TCSR_GMAC_AXI_CACHE_OVERRIDE_VALUE, tcsr_addr);
|
||||
iounmap(tcsr_addr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* nss_dp_hal_get_data_plane_ops
|
||||
* Return the data plane ops for GMAC data plane.
|
||||
*/
|
||||
struct nss_dp_data_plane_ops *nss_dp_hal_get_data_plane_ops(void)
|
||||
{
|
||||
return &nss_dp_gmac_ops;
|
||||
}
|
||||
|
||||
/*
|
||||
* nss_dp_hal_clk_enable
|
||||
* Function to enable GCC_SNOC_GMAC_AXI_CLK.
|
||||
*
|
||||
* These clocks are required for GMAC operations.
|
||||
*/
|
||||
void nss_dp_hal_clk_enable(struct nss_dp_dev *dp_priv)
|
||||
{
|
||||
struct platform_device *pdev = dp_priv->pdev;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct clk *gmac_clk = NULL;
|
||||
int err;
|
||||
|
||||
gmac_clk = devm_clk_get(dev, NSS_SNOC_GMAC_AXI_CLK);
|
||||
if (IS_ERR(gmac_clk)) {
|
||||
pr_err("%s: cannot get clock: %s\n", __func__,
|
||||
NSS_SNOC_GMAC_AXI_CLK);
|
||||
return;
|
||||
}
|
||||
|
||||
err = clk_prepare_enable(gmac_clk);
|
||||
if (err) {
|
||||
pr_err("%s: cannot enable clock: %s, err: %d\n", __func__,
|
||||
NSS_SNOC_GMAC_AXI_CLK, err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* nss_dp_hal_init
|
||||
* Sets the gmac ops based on the GMAC type.
|
||||
*/
|
||||
bool nss_dp_hal_init(void)
|
||||
{
|
||||
nss_dp_hal_set_gmac_ops(&syn_hal_ops, GMAC_HAL_TYPE_SYN_GMAC);
|
||||
|
||||
/*
|
||||
* Program the global GMAC AXI Cache override register
|
||||
* for optimized AXI DMA operation.
|
||||
*/
|
||||
nss_dp_hal_tcsr_set();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* nss_dp_hal_cleanup
|
||||
* Sets the gmac ops to NULL.
|
||||
*/
|
||||
void nss_dp_hal_cleanup(void)
|
||||
{
|
||||
nss_dp_hal_set_gmac_ops(NULL, GMAC_HAL_TYPE_SYN_GMAC);
|
||||
}
|
||||
130
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq50xx/nss_ipq50xx.h
Normal file
130
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq50xx/nss_ipq50xx.h
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __NSS_DP_ARCH_H__
|
||||
#define __NSS_DP_ARCH_H__
|
||||
|
||||
#define NSS_DP_HAL_MAX_PORTS 2
|
||||
#define NSS_DP_HAL_CPU_NUM 2
|
||||
#define NSS_DP_HAL_START_IFNUM 0
|
||||
#define NSS_DP_GMAC_NORMAL_FRAME_MTU 1500
|
||||
#define NSS_DP_GMAC_MINI_JUMBO_FRAME_MTU 1978
|
||||
#define NSS_DP_GMAC_FULL_JUMBO_FRAME_MTU 9000
|
||||
#define NSS_DP_HAL_MAX_MTU_SIZE NSS_DP_GMAC_FULL_JUMBO_FRAME_MTU
|
||||
#define NSS_DP_HAL_MAX_PACKET_LEN 65535
|
||||
|
||||
/*
|
||||
* TCSR_GMAC_AXI_CACHE_OVERRIDE register size
|
||||
*/
|
||||
#define TCSR_GMAC_AXI_CACHE_OVERRIDE_REG_SIZE 4
|
||||
|
||||
/*
|
||||
* TCSR_GMAC_AXI_CACHE_OVERRIDE Register offset
|
||||
*/
|
||||
#define TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET 0x6224
|
||||
|
||||
/*
|
||||
* Value for TCSR_GMAC_AXI_CACHE_OVERRIDE register
|
||||
*/
|
||||
#define TCSR_GMAC_AXI_CACHE_OVERRIDE_VALUE 0x05050505
|
||||
|
||||
/*
|
||||
* GCC_SNOC_GMAC_AXI_CLOCK
|
||||
*/
|
||||
#define NSS_SNOC_GMAC_AXI_CLK "nss-snoc-gmac-axi-clk"
|
||||
|
||||
/**
|
||||
* nss_dp_hal_gmac_stats
|
||||
* The per-GMAC statistics structure.
|
||||
*/
|
||||
struct nss_dp_hal_gmac_stats {
|
||||
uint64_t rx_bytes; /**< Number of RX bytes */
|
||||
uint64_t rx_packets; /**< Number of RX packets */
|
||||
uint64_t rx_errors; /**< Number of RX errors */
|
||||
uint64_t rx_receive_errors; /**< Number of RX receive errors */
|
||||
uint64_t rx_descriptor_errors; /**< Number of RX descriptor errors */
|
||||
uint64_t rx_late_collision_errors;
|
||||
/**< Number of RX late collision errors */
|
||||
uint64_t rx_dribble_bit_errors; /**< Number of RX dribble bit errors */
|
||||
uint64_t rx_length_errors; /**< Number of RX length errors */
|
||||
uint64_t rx_ip_header_errors; /**< Number of RX IP header errors read from rxdec */
|
||||
uint64_t rx_ip_payload_errors; /**< Number of RX IP payload errors */
|
||||
uint64_t rx_no_buffer_errors; /**< Number of RX no-buffer errors */
|
||||
uint64_t rx_transport_csum_bypassed;
|
||||
/**< Number of RX packets where the transport checksum was bypassed */
|
||||
uint64_t tx_bytes; /**< Number of TX bytes */
|
||||
uint64_t tx_packets; /**< Number of TX packets */
|
||||
uint64_t tx_collisions; /**< Number of TX collisions */
|
||||
uint64_t tx_errors; /**< Number of TX errors */
|
||||
uint64_t tx_jabber_timeout_errors;
|
||||
/**< Number of TX jabber timeout errors */
|
||||
uint64_t tx_frame_flushed_errors;
|
||||
/**< Number of TX frame flushed errors */
|
||||
uint64_t tx_loss_of_carrier_errors;
|
||||
/**< Number of TX loss of carrier errors */
|
||||
uint64_t tx_no_carrier_errors; /**< Number of TX no carrier errors */
|
||||
uint64_t tx_late_collision_errors;
|
||||
/**< Number of TX late collision errors */
|
||||
uint64_t tx_excessive_collision_errors;
|
||||
/**< Number of TX excessive collision errors */
|
||||
uint64_t tx_excessive_deferral_errors;
|
||||
/**< Number of TX excessive deferral errors */
|
||||
uint64_t tx_underflow_errors; /**< Number of TX underflow errors */
|
||||
uint64_t tx_ip_header_errors; /**< Number of TX IP header errors */
|
||||
uint64_t tx_ip_payload_errors; /**< Number of TX IP payload errors */
|
||||
uint64_t tx_dropped; /**< Number of TX dropped packets */
|
||||
uint64_t hw_errs[10]; /**< GMAC DMA error counters */
|
||||
uint64_t rx_missed; /**< Number of RX packets missed by the DMA */
|
||||
uint64_t fifo_overflows; /**< Number of RX FIFO overflows signalled by the DMA */
|
||||
uint64_t rx_scatter_errors; /**< Number of scattered frames received by the DMA */
|
||||
uint64_t tx_ts_create_errors; /**< Number of tx timestamp creation errors */
|
||||
uint64_t gmac_total_ticks; /**< Total clock ticks spend inside the GMAC */
|
||||
uint64_t gmac_worst_case_ticks; /**< Worst case iteration of the GMAC in ticks */
|
||||
uint64_t gmac_iterations; /**< Number of iterations around the GMAC */
|
||||
uint64_t tx_pause_frames; /**< Number of pause frames sent by the GMAC */
|
||||
uint64_t mmc_rx_overflow_errors;
|
||||
/**< Number of RX overflow errors */
|
||||
uint64_t mmc_rx_watchdog_timeout_errors;
|
||||
/**< Number of RX watchdog timeout errors */
|
||||
uint64_t mmc_rx_crc_errors; /**< Number of RX CRC errors */
|
||||
uint64_t mmc_rx_ip_header_errors;
|
||||
/**< Number of RX IP header errors read from MMC counter*/
|
||||
uint64_t mmc_rx_octets_g;
|
||||
/**< Number of good octets received */
|
||||
uint64_t mmc_rx_ucast_frames; /**< Number of Unicast frames received */
|
||||
uint64_t mmc_rx_bcast_frames; /**< Number of Bcast frames received */
|
||||
uint64_t mmc_rx_mcast_frames; /**< Number of Mcast frames received */
|
||||
uint64_t mmc_rx_undersize;
|
||||
/**< Number of RX undersize frames */
|
||||
uint64_t mmc_rx_oversize;
|
||||
/**< Number of RX oversize frames */
|
||||
uint64_t mmc_rx_jabber; /**< Number of jabber frames */
|
||||
uint64_t mmc_rx_octets_gb;
|
||||
/**< Number of good/bad octets */
|
||||
uint64_t mmc_rx_frag_frames_g; /**< Number of good ipv4 frag frames */
|
||||
uint64_t mmc_tx_octets_g; /**< Number of good octets sent */
|
||||
uint64_t mmc_tx_ucast_frames; /**< Number of Unicast frames sent*/
|
||||
uint64_t mmc_tx_bcast_frames; /**< Number of Broadcast frames sent */
|
||||
uint64_t mmc_tx_mcast_frames; /**< Number of Multicast frames sent */
|
||||
uint64_t mmc_tx_deferred; /**< Number of Deferred frames sent */
|
||||
uint64_t mmc_tx_single_col; /**< Number of single collisions */
|
||||
uint64_t mmc_tx_multiple_col; /**< Number of multiple collisions */
|
||||
uint64_t mmc_tx_octets_gb; /**< Number of good/bad octets sent*/
|
||||
};
|
||||
|
||||
extern struct nss_dp_data_plane_ops nss_dp_gmac_ops;
|
||||
|
||||
#endif /* __NSS_DP_ARCH_H__ */
|
||||
53
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq60xx/nss_ipq60xx.c
Normal file
53
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq60xx/nss_ipq60xx.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "nss_dp_hal.h"
|
||||
#include "edma.h"
|
||||
|
||||
/*
|
||||
* nss_dp_hal_get_data_plane_ops()
|
||||
* Return the data plane ops for edma data plane.
|
||||
*/
|
||||
struct nss_dp_data_plane_ops *nss_dp_hal_get_data_plane_ops(void)
|
||||
{
|
||||
return &nss_dp_edma_ops;
|
||||
}
|
||||
|
||||
/*
|
||||
* nss_dp_hal_init()
|
||||
* Initialize EDMA and set gmac ops.
|
||||
*/
|
||||
bool nss_dp_hal_init(void)
|
||||
{
|
||||
nss_dp_hal_set_gmac_ops(&qcom_hal_ops, GMAC_HAL_TYPE_QCOM);
|
||||
nss_dp_hal_set_gmac_ops(&syn_hal_ops, GMAC_HAL_TYPE_SYN_XGMAC);
|
||||
|
||||
if (edma_init()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* nss_dp_hal_cleanup()
|
||||
* Cleanup EDMA and set gmac ops to NULL.
|
||||
*/
|
||||
void nss_dp_hal_cleanup(void)
|
||||
{
|
||||
nss_dp_hal_set_gmac_ops(NULL, GMAC_HAL_TYPE_QCOM);
|
||||
nss_dp_hal_set_gmac_ops(NULL, GMAC_HAL_TYPE_SYN_XGMAC);
|
||||
edma_cleanup(false);
|
||||
}
|
||||
34
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq60xx/nss_ipq60xx.h
Normal file
34
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq60xx/nss_ipq60xx.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __NSS_DP_ARCH_H__
|
||||
#define __NSS_DP_ARCH_H__
|
||||
|
||||
#define NSS_DP_HAL_MAX_PORTS 5
|
||||
#define NSS_DP_HAL_CPU_NUM 4
|
||||
#define NSS_DP_HAL_START_IFNUM 1
|
||||
#define NSS_DP_HAL_MAX_MTU_SIZE 9216
|
||||
#define NSS_DP_HAL_MAX_PACKET_LEN 65535
|
||||
#define NSS_DP_PREHEADER_SIZE 32
|
||||
|
||||
/**
|
||||
* nss_dp_hal_gmac_stats
|
||||
* The per-GMAC statistics structure.
|
||||
*/
|
||||
struct nss_dp_hal_gmac_stats {
|
||||
};
|
||||
|
||||
#endif /* __NSS_DP_ARCH_H__ */
|
||||
53
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq807x/nss_ipq807x.c
Normal file
53
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq807x/nss_ipq807x.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "nss_dp_hal.h"
|
||||
#include "edma.h"
|
||||
|
||||
/*
|
||||
* nss_dp_hal_get_data_plane_ops()
|
||||
* Return the data plane ops for edma data plane.
|
||||
*/
|
||||
struct nss_dp_data_plane_ops *nss_dp_hal_get_data_plane_ops(void)
|
||||
{
|
||||
return &nss_dp_edma_ops;
|
||||
}
|
||||
|
||||
/*
|
||||
* nss_dp_hal_init()
|
||||
* Initialize EDMA and set gmac ops.
|
||||
*/
|
||||
bool nss_dp_hal_init(void)
|
||||
{
|
||||
nss_dp_hal_set_gmac_ops(&qcom_hal_ops, GMAC_HAL_TYPE_QCOM);
|
||||
nss_dp_hal_set_gmac_ops(&syn_hal_ops, GMAC_HAL_TYPE_SYN_XGMAC);
|
||||
|
||||
if (edma_init()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* nss_dp_hal_cleanup()
|
||||
* Cleanup EDMA and set gmac ops to NULL.
|
||||
*/
|
||||
void nss_dp_hal_cleanup(void)
|
||||
{
|
||||
nss_dp_hal_set_gmac_ops(NULL, GMAC_HAL_TYPE_QCOM);
|
||||
nss_dp_hal_set_gmac_ops(NULL, GMAC_HAL_TYPE_SYN_XGMAC);
|
||||
edma_cleanup(false);
|
||||
}
|
||||
34
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq807x/nss_ipq807x.h
Normal file
34
feeds/ipq807x/qca-nss-dp/src/hal/arch/ipq807x/nss_ipq807x.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __NSS_DP_ARCH_H__
|
||||
#define __NSS_DP_ARCH_H__
|
||||
|
||||
#define NSS_DP_HAL_MAX_PORTS 6
|
||||
#define NSS_DP_HAL_CPU_NUM 4
|
||||
#define NSS_DP_HAL_START_IFNUM 1
|
||||
#define NSS_DP_HAL_MAX_MTU_SIZE 9216
|
||||
#define NSS_DP_HAL_MAX_PACKET_LEN 65535
|
||||
#define NSS_DP_PREHEADER_SIZE 32
|
||||
|
||||
/**
|
||||
* nss_dp_hal_gmac_stats
|
||||
* The per-GMAC statistics structure.
|
||||
*/
|
||||
struct nss_dp_hal_gmac_stats {
|
||||
};
|
||||
|
||||
#endif /* __NSS_DP_ARCH_H__ */
|
||||
967
feeds/ipq807x/qca-nss-dp/src/hal/edma/edma_cfg.c
Normal file
967
feeds/ipq807x/qca-nss-dp/src/hal/edma/edma_cfg.c
Normal file
@@ -0,0 +1,967 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/reset.h>
|
||||
|
||||
#include "nss_dp_dev.h"
|
||||
#include "edma_regs.h"
|
||||
#include "edma_data_plane.h"
|
||||
|
||||
#define EDMA_HW_RESET_ID "edma_rst"
|
||||
|
||||
/*
|
||||
* edma_cleanup_rxfill_ring_res()
|
||||
* Cleanup resources for one RxFill ring
|
||||
*/
|
||||
static void edma_cleanup_rxfill_ring_res(struct edma_hw *ehw,
|
||||
struct edma_rxfill_ring *rxfill_ring)
|
||||
{
|
||||
struct platform_device *pdev = ehw->pdev;
|
||||
struct sk_buff *skb;
|
||||
uint16_t cons_idx, curr_idx;
|
||||
struct edma_rxfill_desc *rxfill_desc;
|
||||
uint32_t reg_data = 0;
|
||||
struct edma_rx_preheader *rxph = NULL;
|
||||
int store_idx;
|
||||
|
||||
/*
|
||||
* Read RXFILL ring producer index
|
||||
*/
|
||||
reg_data = edma_reg_read(EDMA_REG_RXFILL_PROD_IDX(rxfill_ring->id));
|
||||
curr_idx = reg_data & EDMA_RXFILL_PROD_IDX_MASK;
|
||||
|
||||
/*
|
||||
* Read RXFILL ring consumer index
|
||||
*/
|
||||
reg_data = edma_reg_read(EDMA_REG_RXFILL_CONS_IDX(rxfill_ring->id));
|
||||
cons_idx = reg_data & EDMA_RXFILL_CONS_IDX_MASK;
|
||||
|
||||
while (curr_idx != cons_idx) {
|
||||
/*
|
||||
* Get RXFILL descriptor
|
||||
*/
|
||||
rxfill_desc = EDMA_RXFILL_DESC(rxfill_ring, cons_idx);
|
||||
|
||||
/*
|
||||
* Get Rx preheader
|
||||
*/
|
||||
rxph = (struct edma_rx_preheader *)
|
||||
phys_to_virt(rxfill_desc->buffer_addr);
|
||||
|
||||
dma_unmap_single(&pdev->dev, rxfill_desc->buffer_addr,
|
||||
EDMA_RX_BUFF_SIZE, DMA_FROM_DEVICE);
|
||||
|
||||
/*
|
||||
* Get sk_buff and free it
|
||||
*/
|
||||
store_idx = rxph->opaque;
|
||||
skb = ehw->rx_skb_store[store_idx];
|
||||
ehw->rx_skb_store[store_idx] = NULL;
|
||||
dev_kfree_skb_any(skb);
|
||||
cons_idx++;
|
||||
if (cons_idx == rxfill_ring->count)
|
||||
cons_idx = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free RXFILL ring descriptors
|
||||
*/
|
||||
dma_free_coherent(&pdev->dev,
|
||||
(sizeof(struct edma_rxfill_desc)
|
||||
* rxfill_ring->count),
|
||||
rxfill_ring->desc, rxfill_ring->dma);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_setup_rxfill_ring_res()
|
||||
* Setup resources for one RxFill ring
|
||||
*/
|
||||
static int edma_setup_rxfill_ring_res(struct edma_hw *ehw,
|
||||
struct edma_rxfill_ring *rxfill_ring)
|
||||
{
|
||||
struct platform_device *pdev = ehw->pdev;
|
||||
|
||||
/*
|
||||
* Allocate RxFill ring descriptors
|
||||
*/
|
||||
rxfill_ring->desc = dma_alloc_coherent(&pdev->dev,
|
||||
(sizeof(struct edma_rxfill_desc)
|
||||
* rxfill_ring->count),
|
||||
&rxfill_ring->dma, GFP_KERNEL);
|
||||
if (!rxfill_ring->desc) {
|
||||
pr_warn("Descriptor alloc for RXFILL ring %u failed\n",
|
||||
rxfill_ring->id);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
spin_lock_init(&rxfill_ring->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_setup_rxdesc_ring_res()
|
||||
* Setup resources for one RxDesc ring
|
||||
*/
|
||||
static int edma_setup_rxdesc_ring_res(struct edma_hw *ehw,
|
||||
struct edma_rxdesc_ring *rxdesc_ring)
|
||||
{
|
||||
struct platform_device *pdev = ehw->pdev;
|
||||
|
||||
/*
|
||||
* Allocate RxDesc ring descriptors
|
||||
*/
|
||||
rxdesc_ring->desc = dma_alloc_coherent(&pdev->dev,
|
||||
(sizeof(struct edma_rxdesc_desc)
|
||||
* rxdesc_ring->count),
|
||||
&rxdesc_ring->dma, GFP_KERNEL);
|
||||
if (!rxdesc_ring->desc) {
|
||||
pr_warn("Descriptor alloc for RXDESC ring %u failed\n",
|
||||
rxdesc_ring->id);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_cleanup_rxdesc_ring_res()
|
||||
* Cleanup resources for RxDesc ring
|
||||
*/
|
||||
static void edma_cleanup_rxdesc_ring_res(struct edma_hw *ehw,
|
||||
struct edma_rxdesc_ring *rxdesc_ring)
|
||||
{
|
||||
struct platform_device *pdev = ehw->pdev;
|
||||
struct sk_buff *skb;
|
||||
struct edma_rxdesc_desc *rxdesc_desc;
|
||||
struct edma_rx_preheader *rxph = NULL;
|
||||
uint16_t prod_idx = 0;
|
||||
uint16_t cons_idx = 0;
|
||||
int store_idx;
|
||||
|
||||
cons_idx = edma_reg_read(EDMA_REG_RXDESC_CONS_IDX(rxdesc_ring->id))
|
||||
& EDMA_RXDESC_CONS_IDX_MASK;
|
||||
|
||||
prod_idx = edma_reg_read(EDMA_REG_RXDESC_PROD_IDX(rxdesc_ring->id))
|
||||
& EDMA_RXDESC_PROD_IDX_MASK;
|
||||
|
||||
/*
|
||||
* Free any buffers assigned to any descriptors
|
||||
*/
|
||||
while (cons_idx != prod_idx) {
|
||||
rxdesc_desc = EDMA_RXDESC_DESC(rxdesc_ring, cons_idx);
|
||||
|
||||
rxph = (struct edma_rx_preheader *)
|
||||
phys_to_virt(rxdesc_desc->buffer_addr);
|
||||
|
||||
dma_unmap_single(&pdev->dev, rxdesc_desc->buffer_addr,
|
||||
EDMA_RX_BUFF_SIZE, DMA_FROM_DEVICE);
|
||||
store_idx = rxph->opaque;
|
||||
skb = ehw->rx_skb_store[store_idx];
|
||||
ehw->rx_skb_store[store_idx] = NULL;
|
||||
dev_kfree_skb_any(skb);
|
||||
|
||||
/*
|
||||
* Update consumer index
|
||||
*/
|
||||
if (++cons_idx == rxdesc_ring->count)
|
||||
cons_idx = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free RXDESC ring descriptors
|
||||
*/
|
||||
dma_free_coherent(&pdev->dev,
|
||||
(sizeof(struct edma_rxdesc_desc)
|
||||
* rxdesc_ring->count),
|
||||
rxdesc_ring->desc, rxdesc_ring->dma);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_cleanup_txcmpl_ring_res()
|
||||
* Cleanup resources for one TxCmpl ring
|
||||
*/
|
||||
static void edma_cleanup_txcmpl_ring_res(struct edma_hw *ehw,
|
||||
struct edma_txcmpl_ring *txcmpl_ring)
|
||||
{
|
||||
struct platform_device *pdev = ehw->pdev;
|
||||
|
||||
/*
|
||||
* Free any buffers assigned to any descriptors
|
||||
*/
|
||||
edma_clean_tx(ehw, txcmpl_ring);
|
||||
|
||||
/*
|
||||
* Free TxCmpl ring descriptors
|
||||
*/
|
||||
dma_free_coherent(&pdev->dev,
|
||||
(sizeof(struct edma_txcmpl_desc)
|
||||
* txcmpl_ring->count),
|
||||
txcmpl_ring->desc, txcmpl_ring->dma);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_setup_txcmpl_ring_res()
|
||||
* Setup resources for one TxCmpl ring
|
||||
*/
|
||||
static int edma_setup_txcmpl_ring_res(struct edma_hw *ehw,
|
||||
struct edma_txcmpl_ring *txcmpl_ring)
|
||||
{
|
||||
struct platform_device *pdev = ehw->pdev;
|
||||
|
||||
/*
|
||||
* Allocate TxCmpl ring descriptors
|
||||
*/
|
||||
txcmpl_ring->desc = dma_alloc_coherent(&pdev->dev,
|
||||
(sizeof(struct edma_txcmpl_desc)
|
||||
* txcmpl_ring->count),
|
||||
&txcmpl_ring->dma, GFP_KERNEL);
|
||||
|
||||
if (!txcmpl_ring->desc) {
|
||||
pr_warn("Descriptor alloc for TXCMPL ring %u failed\n",
|
||||
txcmpl_ring->id);
|
||||
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_cleanup_txdesc_ring_res()
|
||||
* Cleanup resources for one TxDesc ring
|
||||
*/
|
||||
static void edma_cleanup_txdesc_ring_res(struct edma_hw *ehw,
|
||||
struct edma_txdesc_ring *txdesc_ring)
|
||||
{
|
||||
struct platform_device *pdev = ehw->pdev;
|
||||
struct sk_buff *skb = NULL;
|
||||
struct edma_txdesc_desc *txdesc = NULL;
|
||||
uint16_t prod_idx, cons_idx;
|
||||
size_t buf_len;
|
||||
uint32_t data;
|
||||
int store_idx;
|
||||
|
||||
/*
|
||||
* Free any buffers assigned to any descriptors
|
||||
*/
|
||||
data = edma_reg_read(EDMA_REG_TXDESC_PROD_IDX(txdesc_ring->id));
|
||||
prod_idx = data & EDMA_TXDESC_PROD_IDX_MASK;
|
||||
|
||||
data = edma_reg_read(EDMA_REG_TXDESC_CONS_IDX(txdesc_ring->id));
|
||||
cons_idx = data & EDMA_TXDESC_CONS_IDX_MASK;
|
||||
|
||||
while (cons_idx != prod_idx) {
|
||||
txdesc = EDMA_TXDESC_DESC(txdesc_ring, cons_idx);
|
||||
store_idx = txdesc->buffer_addr;
|
||||
skb = ehw->tx_skb_store[store_idx];
|
||||
ehw->tx_skb_store[store_idx] = NULL;
|
||||
|
||||
buf_len = (txdesc->word1 & EDMA_TXDESC_DATA_LENGTH_MASK) >>
|
||||
EDMA_TXDESC_DATA_LENGTH_SHIFT;
|
||||
|
||||
dma_unmap_single(&pdev->dev, (dma_addr_t)skb->data,
|
||||
buf_len + EDMA_TX_PREHDR_SIZE, DMA_TO_DEVICE);
|
||||
|
||||
dev_kfree_skb_any(skb);
|
||||
cons_idx = (cons_idx + 1) & (txdesc_ring->count - 1);
|
||||
cons_idx++;
|
||||
if (cons_idx == txdesc_ring->count)
|
||||
cons_idx = 0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Free Tx ring descriptors
|
||||
*/
|
||||
dma_free_coherent(&pdev->dev,
|
||||
(sizeof(struct edma_txdesc_desc)
|
||||
* txdesc_ring->count),
|
||||
txdesc_ring->desc, txdesc_ring->dma);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_setup_txdesc_ring_res()
|
||||
* Setup resources for one TxDesc ring
|
||||
*/
|
||||
static int edma_setup_txdesc_ring_res(struct edma_hw *ehw,
|
||||
struct edma_txdesc_ring *txdesc_ring)
|
||||
{
|
||||
struct platform_device *pdev = ehw->pdev;
|
||||
|
||||
/*
|
||||
* Allocate Tx ring descriptors
|
||||
*/
|
||||
txdesc_ring->desc = dma_alloc_coherent(&pdev->dev,
|
||||
(sizeof(struct edma_txdesc_desc)
|
||||
* txdesc_ring->count),
|
||||
&txdesc_ring->dma, GFP_KERNEL);
|
||||
if (!txdesc_ring->desc) {
|
||||
pr_warn("Descriptor alloc for TXDESC ring %u failed\n",
|
||||
txdesc_ring->id);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
spin_lock_init(&txdesc_ring->tx_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_setup_ring_resources()
|
||||
* Allocate/setup resources for EDMA rings
|
||||
*/
|
||||
static int edma_setup_ring_resources(struct edma_hw *ehw)
|
||||
{
|
||||
struct edma_txcmpl_ring *txcmpl_ring = NULL;
|
||||
struct edma_txdesc_ring *txdesc_ring = NULL;
|
||||
struct edma_rxfill_ring *rxfill_ring = NULL;
|
||||
struct edma_rxdesc_ring *rxdesc_ring = NULL;
|
||||
int i;
|
||||
int ret;
|
||||
int index;
|
||||
|
||||
/*
|
||||
* Allocate TxDesc ring descriptors
|
||||
*/
|
||||
for (i = 0; i < ehw->txdesc_rings; i++) {
|
||||
txdesc_ring = &ehw->txdesc_ring[i];
|
||||
txdesc_ring->count = EDMA_RING_SIZE;
|
||||
txdesc_ring->id = ehw->txdesc_ring_start + i;
|
||||
|
||||
ret = edma_setup_txdesc_ring_res(ehw, txdesc_ring);
|
||||
if (ret != 0) {
|
||||
while (i-- >= 0)
|
||||
edma_cleanup_txdesc_ring_res(ehw,
|
||||
&ehw->txdesc_ring[i]);
|
||||
|
||||
return -ENOMEM;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate TxCmpl ring descriptors
|
||||
*/
|
||||
for (i = 0; i < ehw->txcmpl_rings; i++) {
|
||||
txcmpl_ring = &ehw->txcmpl_ring[i];
|
||||
txcmpl_ring->count = EDMA_RING_SIZE;
|
||||
txcmpl_ring->id = ehw->txcmpl_ring_start + i;
|
||||
|
||||
ret = edma_setup_txcmpl_ring_res(ehw, txcmpl_ring);
|
||||
|
||||
if (ret != 0) {
|
||||
while (i-- >= 0)
|
||||
edma_cleanup_txcmpl_ring_res(ehw,
|
||||
&ehw->txcmpl_ring[i]);
|
||||
|
||||
goto txcmpl_mem_alloc_fail;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate Rx fill ring descriptors
|
||||
*/
|
||||
for (i = 0; i < ehw->rxfill_rings; i++) {
|
||||
rxfill_ring = &ehw->rxfill_ring[i];
|
||||
rxfill_ring->count = EDMA_RING_SIZE;
|
||||
rxfill_ring->id = ehw->rxfill_ring_start + i;
|
||||
|
||||
ret = edma_setup_rxfill_ring_res(ehw, rxfill_ring);
|
||||
if (ret != 0) {
|
||||
while (--i >= 0)
|
||||
edma_cleanup_rxfill_ring_res(ehw,
|
||||
&ehw->rxfill_ring[i]);
|
||||
|
||||
goto rxfill_mem_alloc_fail;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate RxDesc ring descriptors
|
||||
*/
|
||||
for (i = 0; i < ehw->rxdesc_rings; i++) {
|
||||
rxdesc_ring = &ehw->rxdesc_ring[i];
|
||||
rxdesc_ring->count = EDMA_RING_SIZE;
|
||||
rxdesc_ring->id = ehw->rxdesc_ring_start + i;
|
||||
|
||||
/*
|
||||
* Create a mapping between RX Desc ring and Rx fill ring.
|
||||
* Number of fill rings are lesser than the descriptor rings
|
||||
* Share the fill rings across descriptor rings.
|
||||
*/
|
||||
|
||||
index = ehw->rxfill_ring_start + (i % ehw->rxfill_rings);
|
||||
rxdesc_ring->rxfill =
|
||||
&ehw->rxfill_ring[index - ehw->rxfill_ring_start];
|
||||
|
||||
ret = edma_setup_rxdesc_ring_res(ehw, rxdesc_ring);
|
||||
if (ret != 0) {
|
||||
while (--i >= 0)
|
||||
edma_cleanup_rxdesc_ring_res(ehw,
|
||||
&ehw->rxdesc_ring[i]);
|
||||
|
||||
goto rxdesc_mem_alloc_fail;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
rxdesc_mem_alloc_fail:
|
||||
for (i = 0; i < ehw->rxfill_rings; i++)
|
||||
edma_cleanup_rxfill_ring_res(ehw, &ehw->rxfill_ring[i]);
|
||||
|
||||
rxfill_mem_alloc_fail:
|
||||
for (i = 0; i < ehw->txcmpl_rings; i++)
|
||||
edma_cleanup_txcmpl_ring_res(ehw, &ehw->txcmpl_ring[i]);
|
||||
|
||||
txcmpl_mem_alloc_fail:
|
||||
for (i = 0; i < ehw->txdesc_rings; i++)
|
||||
edma_cleanup_txdesc_ring_res(ehw, &ehw->txdesc_ring[i]);
|
||||
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_free_rings()
|
||||
* Free EDMA software rings
|
||||
*/
|
||||
static void edma_free_rings(struct edma_hw *ehw)
|
||||
{
|
||||
kfree(ehw->rxfill_ring);
|
||||
kfree(ehw->rxdesc_ring);
|
||||
kfree(ehw->txdesc_ring);
|
||||
kfree(ehw->txcmpl_ring);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_alloc_rings()
|
||||
* Allocate EDMA software rings
|
||||
*/
|
||||
static int edma_alloc_rings(struct edma_hw *ehw)
|
||||
{
|
||||
ehw->rxfill_ring = kzalloc((sizeof(struct edma_rxfill_ring) *
|
||||
ehw->rxfill_rings), GFP_KERNEL);
|
||||
if (!ehw->rxfill_ring)
|
||||
return -ENOMEM;
|
||||
|
||||
ehw->rxdesc_ring = kzalloc((sizeof(struct edma_rxdesc_ring) *
|
||||
ehw->rxdesc_rings), GFP_KERNEL);
|
||||
if (!ehw->rxdesc_ring)
|
||||
goto rxdesc_ring_alloc_fail;
|
||||
|
||||
ehw->txdesc_ring = kzalloc((sizeof(struct edma_txdesc_ring) *
|
||||
ehw->txdesc_rings), GFP_KERNEL);
|
||||
if (!ehw->txdesc_ring)
|
||||
goto txdesc_ring_alloc_fail;
|
||||
|
||||
ehw->txcmpl_ring = kzalloc((sizeof(struct edma_txcmpl_ring) *
|
||||
ehw->txcmpl_rings), GFP_KERNEL);
|
||||
if (!ehw->txcmpl_ring)
|
||||
goto txcmpl_ring_alloc_fail;
|
||||
|
||||
pr_info("Num rings - TxDesc:%u (%u-%u) TxCmpl:%u (%u-%u)\n",
|
||||
ehw->txdesc_rings, ehw->txdesc_ring_start,
|
||||
(ehw->txdesc_ring_start + ehw->txdesc_rings - 1),
|
||||
ehw->txcmpl_rings, ehw->txcmpl_ring_start,
|
||||
(ehw->txcmpl_ring_start + ehw->txcmpl_rings - 1));
|
||||
|
||||
pr_info("RxDesc:%u (%u-%u) RxFill:%u (%u-%u)\n",
|
||||
ehw->rxdesc_rings, ehw->rxdesc_ring_start,
|
||||
(ehw->rxdesc_ring_start + ehw->rxdesc_rings - 1),
|
||||
ehw->rxfill_rings, ehw->rxfill_ring_start,
|
||||
(ehw->rxfill_ring_start + ehw->rxfill_rings - 1));
|
||||
|
||||
return 0;
|
||||
txcmpl_ring_alloc_fail:
|
||||
kfree(ehw->txdesc_ring);
|
||||
txdesc_ring_alloc_fail:
|
||||
kfree(ehw->rxdesc_ring);
|
||||
rxdesc_ring_alloc_fail:
|
||||
kfree(ehw->rxfill_ring);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_cleanup_rings()
|
||||
* Cleanup EDMA rings
|
||||
*/
|
||||
void edma_cleanup_rings(struct edma_hw *ehw)
|
||||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Free any buffers assigned to any descriptors
|
||||
*/
|
||||
for (i = 0; i < ehw->txdesc_rings; i++)
|
||||
edma_cleanup_txdesc_ring_res(ehw, &ehw->txdesc_ring[i]);
|
||||
|
||||
/*
|
||||
* Free Tx completion descriptors
|
||||
*/
|
||||
for (i = 0; i < ehw->txcmpl_rings; i++)
|
||||
edma_cleanup_txcmpl_ring_res(ehw, &ehw->txcmpl_ring[i]);
|
||||
|
||||
/*
|
||||
* Free Rx fill ring descriptors
|
||||
*/
|
||||
for (i = 0; i < ehw->rxfill_rings; i++)
|
||||
edma_cleanup_rxfill_ring_res(ehw, &ehw->rxfill_ring[i]);
|
||||
|
||||
/*
|
||||
* Free Rx completion ring descriptors
|
||||
*/
|
||||
for (i = 0; i < ehw->rxdesc_rings; i++)
|
||||
edma_cleanup_rxdesc_ring_res(ehw, &ehw->rxdesc_ring[i]);
|
||||
|
||||
edma_free_rings(ehw);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_init_rings()
|
||||
* Initialize EDMA rings
|
||||
*/
|
||||
static int edma_init_rings(struct edma_hw *ehw)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = edma_alloc_rings(ehw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = edma_setup_ring_resources(ehw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_configure_txdesc_ring()
|
||||
* Configure one TxDesc ring
|
||||
*/
|
||||
static void edma_configure_txdesc_ring(struct edma_hw *ehw,
|
||||
struct edma_txdesc_ring *txdesc_ring)
|
||||
{
|
||||
uint32_t data = 0;
|
||||
uint16_t hw_cons_idx = 0;
|
||||
|
||||
/*
|
||||
* Configure TXDESC ring
|
||||
*/
|
||||
edma_reg_write(EDMA_REG_TXDESC_BA(txdesc_ring->id),
|
||||
(uint32_t)(txdesc_ring->dma &
|
||||
EDMA_RING_DMA_MASK));
|
||||
|
||||
edma_reg_write(EDMA_REG_TXDESC_RING_SIZE(txdesc_ring->id),
|
||||
(uint32_t)(txdesc_ring->count &
|
||||
EDMA_TXDESC_RING_SIZE_MASK));
|
||||
|
||||
data = edma_reg_read(EDMA_REG_TXDESC_CONS_IDX(txdesc_ring->id));
|
||||
data &= ~(EDMA_TXDESC_CONS_IDX_MASK);
|
||||
hw_cons_idx = data;
|
||||
|
||||
data = edma_reg_read(EDMA_REG_TXDESC_PROD_IDX(txdesc_ring->id));
|
||||
data &= ~(EDMA_TXDESC_PROD_IDX_MASK);
|
||||
data |= hw_cons_idx & EDMA_TXDESC_PROD_IDX_MASK;
|
||||
edma_reg_write(EDMA_REG_TXDESC_PROD_IDX(txdesc_ring->id), data);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_configure_txcmpl_ring()
|
||||
* Configure one TxCmpl ring
|
||||
*/
|
||||
static void edma_configure_txcmpl_ring(struct edma_hw *ehw,
|
||||
struct edma_txcmpl_ring *txcmpl_ring)
|
||||
{
|
||||
uint32_t tx_mod_timer;
|
||||
|
||||
/*
|
||||
* Configure TxCmpl ring base address
|
||||
*/
|
||||
edma_reg_write(EDMA_REG_TXCMPL_BA(txcmpl_ring->id),
|
||||
(uint32_t)(txcmpl_ring->dma & EDMA_RING_DMA_MASK));
|
||||
edma_reg_write(EDMA_REG_TXCMPL_RING_SIZE(txcmpl_ring->id),
|
||||
(uint32_t)(txcmpl_ring->count
|
||||
& EDMA_TXDESC_RING_SIZE_MASK));
|
||||
|
||||
/*
|
||||
* Set TxCmpl ret mode to opaque
|
||||
*/
|
||||
edma_reg_write(EDMA_REG_TXCMPL_CTRL(txcmpl_ring->id),
|
||||
EDMA_TXCMPL_RETMODE_OPAQUE);
|
||||
|
||||
tx_mod_timer = (EDMA_TX_MOD_TIMER & EDMA_TX_MOD_TIMER_INIT_MASK)
|
||||
<< EDMA_TX_MOD_TIMER_INIT_SHIFT;
|
||||
edma_reg_write(EDMA_REG_TX_MOD_TIMER(txcmpl_ring->id),
|
||||
tx_mod_timer);
|
||||
|
||||
edma_reg_write(EDMA_REG_TX_INT_CTRL(txcmpl_ring->id), 0x2);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_configure_rxdesc_ring()
|
||||
* Configure one RxDesc ring
|
||||
*/
|
||||
static void edma_configure_rxdesc_ring(struct edma_hw *ehw,
|
||||
struct edma_rxdesc_ring *rxdesc_ring)
|
||||
{
|
||||
uint32_t data;
|
||||
|
||||
edma_reg_write(EDMA_REG_RXDESC_BA(rxdesc_ring->id),
|
||||
(uint32_t)(rxdesc_ring->dma & 0xffffffff));
|
||||
|
||||
data = rxdesc_ring->count & EDMA_RXDESC_RING_SIZE_MASK;
|
||||
data |= (ehw->rx_payload_offset & EDMA_RXDESC_PL_OFFSET_MASK)
|
||||
<< EDMA_RXDESC_PL_OFFSET_SHIFT;
|
||||
edma_reg_write(EDMA_REG_RXDESC_RING_SIZE(rxdesc_ring->id), data);
|
||||
|
||||
data = (EDMA_RX_MOD_TIMER_INIT & EDMA_RX_MOD_TIMER_INIT_MASK)
|
||||
<< EDMA_RX_MOD_TIMER_INIT_SHIFT;
|
||||
edma_reg_write(EDMA_REG_RX_MOD_TIMER(rxdesc_ring->id), data);
|
||||
|
||||
/*
|
||||
* Enable ring. Set ret mode to 'opaque'.
|
||||
*/
|
||||
edma_reg_write(EDMA_REG_RX_INT_CTRL(rxdesc_ring->id), 0x2);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_configure_rxfill_ring()
|
||||
* Configure one RxFill ring
|
||||
*/
|
||||
static void edma_configure_rxfill_ring(struct edma_hw *ehw,
|
||||
struct edma_rxfill_ring *rxfill_ring)
|
||||
{
|
||||
uint32_t data = 0;
|
||||
|
||||
edma_reg_write(EDMA_REG_RXFILL_BA(rxfill_ring->id),
|
||||
(uint32_t)(rxfill_ring->dma & EDMA_RING_DMA_MASK));
|
||||
|
||||
data = rxfill_ring->count & EDMA_RXFILL_RING_SIZE_MASK;
|
||||
edma_reg_write(EDMA_REG_RXFILL_RING_SIZE(rxfill_ring->id), data);
|
||||
|
||||
/*
|
||||
* Alloc Rx buffers
|
||||
*/
|
||||
edma_alloc_rx_buffer(ehw, rxfill_ring);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_configure_rings()
|
||||
* Configure EDMA rings
|
||||
*/
|
||||
static void edma_configure_rings(struct edma_hw *ehw)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
/*
|
||||
* Initialize the store
|
||||
*/
|
||||
for (i = 0; i < EDMA_RING_SIZE; i++) {
|
||||
ehw->tx_skb_store[i] = NULL;
|
||||
ehw->rx_skb_store[i] = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Configure TXDESC ring
|
||||
*/
|
||||
for (i = 0; i < ehw->txdesc_rings; i++)
|
||||
edma_configure_txdesc_ring(ehw, &ehw->txdesc_ring[i]);
|
||||
|
||||
/*
|
||||
* Configure TXCMPL ring
|
||||
*/
|
||||
for (i = 0; i < ehw->txcmpl_rings; i++)
|
||||
edma_configure_txcmpl_ring(ehw, &ehw->txcmpl_ring[i]);
|
||||
|
||||
/*
|
||||
* Configure RXFILL rings
|
||||
*/
|
||||
for (i = 0; i < ehw->rxfill_rings; i++)
|
||||
edma_configure_rxfill_ring(ehw, &ehw->rxfill_ring[i]);
|
||||
|
||||
/*
|
||||
* Configure RXDESC ring
|
||||
*/
|
||||
for (i = 0; i < ehw->rxdesc_rings; i++)
|
||||
edma_configure_rxdesc_ring(ehw, &ehw->rxdesc_ring[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_hw_reset()
|
||||
* Reset EDMA Hardware during initialization
|
||||
*/
|
||||
int edma_hw_reset(struct edma_hw *ehw)
|
||||
{
|
||||
struct reset_control *rst;
|
||||
struct platform_device *pdev = ehw->pdev;
|
||||
|
||||
rst = devm_reset_control_get(&pdev->dev, EDMA_HW_RESET_ID);
|
||||
if (IS_ERR(rst)) {
|
||||
pr_warn("DTS Node: %s does not exist\n", EDMA_HW_RESET_ID);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
reset_control_assert(rst);
|
||||
udelay(100);
|
||||
|
||||
reset_control_deassert(rst);
|
||||
udelay(100);
|
||||
|
||||
pr_info("EDMA HW Reset completed succesfully\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_hw_init()
|
||||
* EDMA hw init
|
||||
*/
|
||||
int edma_hw_init(struct edma_hw *ehw)
|
||||
{
|
||||
int ret = 0;
|
||||
int desc_index;
|
||||
uint32_t i, data, reg = 0;
|
||||
struct edma_rxdesc_ring *rxdesc_ring = NULL;
|
||||
|
||||
data = edma_reg_read(EDMA_REG_MAS_CTRL);
|
||||
pr_info("EDMA ver %d hw init\n", data);
|
||||
|
||||
/*
|
||||
* Setup private data structure
|
||||
*/
|
||||
ehw->misc_intr_mask = 0x0;
|
||||
ehw->rxfill_intr_mask = EDMA_RXFILL_INT_MASK;
|
||||
ehw->rxdesc_intr_mask = EDMA_RXDESC_INT_MASK_PKT_INT;
|
||||
ehw->txcmpl_intr_mask = EDMA_TX_INT_MASK_PKT_INT |
|
||||
EDMA_TX_INT_MASK_UGT_INT;
|
||||
ehw->rx_payload_offset = EDMA_RX_PREHDR_SIZE;
|
||||
ehw->active = 0;
|
||||
ehw->edma_initialized = false;
|
||||
|
||||
/* Reset EDMA */
|
||||
ret = edma_hw_reset(ehw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* Disable interrupts
|
||||
*/
|
||||
for (i = 0; i < EDMA_MAX_TXCMPL_RINGS; i++)
|
||||
edma_reg_write(EDMA_REG_TX_INT_MASK(i), 0);
|
||||
|
||||
for (i = 0; i < EDMA_MAX_RXFILL_RINGS; i++)
|
||||
edma_reg_write(EDMA_REG_RXFILL_INT_MASK(i), 0);
|
||||
|
||||
for (i = 0; i < EDMA_MAX_RXDESC_RINGS; i++)
|
||||
edma_reg_write(EDMA_REG_RX_INT_CTRL(i), 0);
|
||||
|
||||
/*
|
||||
* Disable Rx rings
|
||||
*/
|
||||
for (i = 0; i < EDMA_MAX_RXDESC_RINGS; i++) {
|
||||
data = edma_reg_read(EDMA_REG_RXDESC_CTRL(i));
|
||||
data &= ~EDMA_RXDESC_RX_EN;
|
||||
edma_reg_write(EDMA_REG_RXDESC_CTRL(i), data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable RxFill Rings
|
||||
*/
|
||||
for (i = 0; i < EDMA_MAX_RXFILL_RINGS; i++) {
|
||||
data = edma_reg_read(EDMA_REG_RXFILL_RING_EN(i));
|
||||
data &= ~EDMA_RXFILL_RING_EN;
|
||||
edma_reg_write(EDMA_REG_RXFILL_RING_EN(i), data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable Tx rings
|
||||
*/
|
||||
for (desc_index = 0; desc_index < EDMA_MAX_TXDESC_RINGS; desc_index++) {
|
||||
data = edma_reg_read(EDMA_REG_TXDESC_CTRL(desc_index));
|
||||
data &= ~EDMA_TXDESC_TX_EN;
|
||||
edma_reg_write(EDMA_REG_TXDESC_CTRL(desc_index), data);
|
||||
}
|
||||
|
||||
#if defined(NSS_DP_IPQ807X)
|
||||
/*
|
||||
* Clear the TXDESC2CMPL_MAP_xx reg before setting up
|
||||
* the mapping. This register holds TXDESC to TXFILL ring
|
||||
* mapping.
|
||||
*/
|
||||
edma_reg_write(EDMA_REG_TXDESC2CMPL_MAP_0, 0);
|
||||
edma_reg_write(EDMA_REG_TXDESC2CMPL_MAP_1, 0);
|
||||
edma_reg_write(EDMA_REG_TXDESC2CMPL_MAP_2, 0);
|
||||
desc_index = ehw->txcmpl_ring_start;
|
||||
|
||||
/*
|
||||
* 3 registers to hold the completion mapping for total 24
|
||||
* TX desc rings (0-9,10-19 and rest). In each entry 3 bits hold
|
||||
* the mapping for a particular TX desc ring.
|
||||
*/
|
||||
for (i = ehw->txdesc_ring_start;
|
||||
i < ehw->txdesc_ring_end; i++) {
|
||||
if (i >= 0 && i <= 9)
|
||||
reg = EDMA_REG_TXDESC2CMPL_MAP_0;
|
||||
else if (i >= 10 && i <= 19)
|
||||
reg = EDMA_REG_TXDESC2CMPL_MAP_1;
|
||||
else
|
||||
reg = EDMA_REG_TXDESC2CMPL_MAP_2;
|
||||
|
||||
pr_debug("Configure TXDESC:%u to use TXCMPL:%u\n",
|
||||
i, desc_index);
|
||||
|
||||
data = edma_reg_read(reg);
|
||||
data |= (desc_index & 0x7) << ((i % 10) * 3);
|
||||
edma_reg_write(reg, data);
|
||||
|
||||
desc_index++;
|
||||
if (desc_index == ehw->txcmpl_ring_end)
|
||||
desc_index = ehw->txcmpl_ring_start;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set PPE QID to EDMA Rx ring mapping.
|
||||
* When coming up use only queue 0.
|
||||
* HOST EDMA rings. FW EDMA comes up and overwrites as required.
|
||||
* Each entry can hold mapping for 8 PPE queues and entry size is
|
||||
* 4 bytes
|
||||
*/
|
||||
desc_index = ehw->rxdesc_ring_start;
|
||||
data = 0;
|
||||
data |= (desc_index & 0xF);
|
||||
edma_reg_write(EDMA_QID2RID_TABLE_MEM(0), data);
|
||||
pr_debug("Configure QID2RID reg:0x%x to 0x%x\n", reg, data);
|
||||
|
||||
ret = edma_init_rings(ehw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
edma_configure_rings(ehw);
|
||||
|
||||
/*
|
||||
* Set RXDESC2FILL_MAP_xx reg.
|
||||
* There are two registers RXDESC2FILL_0 and RXDESC2FILL_1
|
||||
* 3 bits holds the rx fill ring mapping for each of the
|
||||
* rx descriptor ring.
|
||||
*/
|
||||
edma_reg_write(EDMA_REG_RXDESC2FILL_MAP_0, 0);
|
||||
edma_reg_write(EDMA_REG_RXDESC2FILL_MAP_1, 0);
|
||||
for (i = ehw->rxdesc_ring_start;
|
||||
i < ehw->rxdesc_ring_end; i++) {
|
||||
if ((i >= 0) && (i <= 9))
|
||||
reg = EDMA_REG_RXDESC2FILL_MAP_0;
|
||||
else
|
||||
reg = EDMA_REG_RXDESC2FILL_MAP_1;
|
||||
|
||||
rxdesc_ring = &ehw->rxdesc_ring[i - ehw->rxdesc_ring_start];
|
||||
|
||||
pr_debug("Configure RXDESC:%u to use RXFILL:%u\n",
|
||||
rxdesc_ring->id, rxdesc_ring->rxfill->id);
|
||||
|
||||
data = edma_reg_read(reg);
|
||||
data |= (rxdesc_ring->rxfill->id & 0x7) << ((i % 10) * 3);
|
||||
edma_reg_write(reg, data);
|
||||
}
|
||||
|
||||
reg = EDMA_REG_RXDESC2FILL_MAP_0;
|
||||
pr_debug("EDMA_REG_RXDESC2FILL_MAP_0: 0x%x\n", edma_reg_read(reg));
|
||||
reg = EDMA_REG_RXDESC2FILL_MAP_1;
|
||||
pr_debug("EDMA_REG_RXDESC2FILL_MAP_1: 0x%x\n", edma_reg_read(reg));
|
||||
|
||||
#if defined(NSS_DP_IPQ807X)
|
||||
reg = EDMA_REG_TXDESC2CMPL_MAP_0;
|
||||
pr_debug("EDMA_REG_TXDESC2CMPL_MAP_0: 0x%x\n", edma_reg_read(reg));
|
||||
reg = EDMA_REG_TXDESC2CMPL_MAP_1;
|
||||
pr_debug("EDMA_REG_TXDESC2CMPL_MAP_1: 0x%x\n", edma_reg_read(reg));
|
||||
reg = EDMA_REG_TXDESC2CMPL_MAP_2;
|
||||
pr_debug("EDMA_REG_TXDESC2CMPL_MAP_2: 0x%x\n", edma_reg_read(reg));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Configure DMA request priority, DMA read burst length,
|
||||
* and AXI write size.
|
||||
*/
|
||||
data = EDMA_DMAR_BURST_LEN_SET(EDMA_BURST_LEN_ENABLE)
|
||||
| EDMA_DMAR_REQ_PRI_SET(0)
|
||||
| EDMA_DMAR_TXDATA_OUTSTANDING_NUM_SET(31)
|
||||
| EDMA_DMAR_TXDESC_OUTSTANDING_NUM_SET(7)
|
||||
| EDMA_DMAR_RXFILL_OUTSTANDING_NUM_SET(7);
|
||||
edma_reg_write(EDMA_REG_DMAR_CTRL, data);
|
||||
#if defined(NSS_DP_IPQ60XX)
|
||||
data = edma_reg_read(EDMA_REG_AXIW_CTRL);
|
||||
data |= EDMA_AXIW_MAX_WR_SIZE_EN;
|
||||
edma_reg_write(EDMA_REG_AXIW_CTRL, data);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Misc error mask
|
||||
*/
|
||||
data = EDMA_MISC_AXI_RD_ERR_MASK_EN |
|
||||
EDMA_MISC_AXI_WR_ERR_MASK_EN |
|
||||
EDMA_MISC_RX_DESC_FIFO_FULL_MASK_EN |
|
||||
EDMA_MISC_RX_ERR_BUF_SIZE_MASK_EN |
|
||||
EDMA_MISC_TX_SRAM_FULL_MASK_EN |
|
||||
EDMA_MISC_TX_CMPL_BUF_FULL_MASK_EN |
|
||||
EDMA_MISC_DATA_LEN_ERR_MASK_EN;
|
||||
#if defined(NSS_DP_IPQ807X)
|
||||
data |= EDMA_MISC_PKT_LEN_LA_64K_MASK_EN |
|
||||
EDMA_MISC_PKT_LEN_LE_40_MASK_EN;
|
||||
#else
|
||||
data |= EDMA_MISC_TX_TIMEOUT_MASK_EN;
|
||||
#endif
|
||||
edma_reg_write(EDMA_REG_MISC_INT_MASK, data);
|
||||
|
||||
/*
|
||||
* Global EDMA enable and padding enable
|
||||
*/
|
||||
data = EDMA_PORT_PAD_EN | EDMA_PORT_EDMA_EN;
|
||||
edma_reg_write(EDMA_REG_PORT_CTRL, data);
|
||||
|
||||
/*
|
||||
* Enable Rx rings
|
||||
*/
|
||||
for (i = ehw->rxdesc_ring_start; i < ehw->rxdesc_ring_end; i++) {
|
||||
data = edma_reg_read(EDMA_REG_RXDESC_CTRL(i));
|
||||
data |= EDMA_RXDESC_RX_EN;
|
||||
edma_reg_write(EDMA_REG_RXDESC_CTRL(i), data);
|
||||
}
|
||||
|
||||
for (i = ehw->rxfill_ring_start; i < ehw->rxfill_ring_end; i++) {
|
||||
data = edma_reg_read(EDMA_REG_RXFILL_RING_EN(i));
|
||||
data |= EDMA_RXFILL_RING_EN;
|
||||
edma_reg_write(EDMA_REG_RXFILL_RING_EN(i), data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable Tx rings
|
||||
*/
|
||||
for (i = ehw->txdesc_ring_start; i < ehw->txdesc_ring_end; i++) {
|
||||
data = edma_reg_read(EDMA_REG_TXDESC_CTRL(i));
|
||||
data |= EDMA_TXDESC_TX_EN;
|
||||
edma_reg_write(EDMA_REG_TXDESC_CTRL(i), data);
|
||||
}
|
||||
|
||||
ehw->edma_initialized = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
906
feeds/ipq807x/qca-nss-dp/src/hal/edma/edma_data_plane.c
Normal file
906
feeds/ipq807x/qca-nss-dp/src/hal/edma/edma_data_plane.c
Normal file
@@ -0,0 +1,906 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <fal/fal_vsi.h>
|
||||
|
||||
#include "nss_dp_dev.h"
|
||||
#include "edma_regs.h"
|
||||
#include "edma_data_plane.h"
|
||||
|
||||
/*
|
||||
* EDMA hardware instance
|
||||
*/
|
||||
struct edma_hw edma_hw;
|
||||
|
||||
/*
|
||||
* edma_get_port_num_from_netdev()
|
||||
* Get port number from net device
|
||||
*/
|
||||
static int edma_get_port_num_from_netdev(struct net_device *netdev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < EDMA_MAX_GMACS; i++) {
|
||||
/* In the port-id to netdev mapping table, port-id
|
||||
* starts from 1 and table index starts from 0.
|
||||
* So we return index + 1 for port-id
|
||||
*/
|
||||
if (edma_hw.netdev_arr[i] == netdev)
|
||||
return i+1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_reg_read()
|
||||
* Read EDMA register
|
||||
*/
|
||||
uint32_t edma_reg_read(uint32_t reg_off)
|
||||
{
|
||||
return (uint32_t)readl(edma_hw.reg_base + reg_off);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_reg_write()
|
||||
* Write EDMA register
|
||||
*/
|
||||
void edma_reg_write(uint32_t reg_off, uint32_t val)
|
||||
{
|
||||
writel(val, edma_hw.reg_base + reg_off);
|
||||
}
|
||||
|
||||
/*
|
||||
* nss_dp_edma_if_open()
|
||||
* Do slow path data plane open
|
||||
*/
|
||||
static int edma_if_open(struct nss_dp_data_plane_ctx *dpc,
|
||||
uint32_t tx_desc_ring, uint32_t rx_desc_ring,
|
||||
uint32_t mode)
|
||||
{
|
||||
if (!dpc->dev)
|
||||
return NSS_DP_FAILURE;
|
||||
|
||||
/*
|
||||
* Enable NAPI
|
||||
*/
|
||||
if (edma_hw.active++ != 0)
|
||||
return NSS_DP_SUCCESS;
|
||||
|
||||
napi_enable(&edma_hw.napi);
|
||||
return NSS_DP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_if_close()
|
||||
* Do slow path data plane close
|
||||
*/
|
||||
static int edma_if_close(struct nss_dp_data_plane_ctx *dpc)
|
||||
{
|
||||
if (--edma_hw.active != 0)
|
||||
return NSS_DP_SUCCESS;
|
||||
|
||||
/*
|
||||
* Disable NAPI
|
||||
*/
|
||||
napi_disable(&edma_hw.napi);
|
||||
return NSS_DP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_if_link_state()
|
||||
*/
|
||||
static int edma_if_link_state(struct nss_dp_data_plane_ctx *dpc,
|
||||
uint32_t link_state)
|
||||
{
|
||||
return NSS_DP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_if_mac_addr()
|
||||
*/
|
||||
static int edma_if_mac_addr(struct nss_dp_data_plane_ctx *dpc, uint8_t *addr)
|
||||
{
|
||||
return NSS_DP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_if_change_mtu()
|
||||
*/
|
||||
static int edma_if_change_mtu(struct nss_dp_data_plane_ctx *dpc, uint32_t mtu)
|
||||
{
|
||||
return NSS_DP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_if_xmit()
|
||||
* Transmit a packet using EDMA
|
||||
*/
|
||||
static netdev_tx_t edma_if_xmit(struct nss_dp_data_plane_ctx *dpc,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct net_device *netdev = dpc->dev;
|
||||
int ret;
|
||||
uint32_t tx_ring, skbq, nhead, ntail;
|
||||
bool expand_skb = false;
|
||||
|
||||
if (skb->len < ETH_HLEN) {
|
||||
netdev_dbg(netdev, "skb->len < ETH_HLEN\n");
|
||||
goto drop;
|
||||
}
|
||||
|
||||
/*
|
||||
* Select a Tx ring
|
||||
*/
|
||||
skbq = skb_get_queue_mapping(skb);
|
||||
tx_ring = 0;
|
||||
if ((edma_hw.txdesc_rings > 1) && (skbq > 0))
|
||||
tx_ring = edma_hw.txdesc_rings % skbq;
|
||||
|
||||
/*
|
||||
* Check for non-linear skb
|
||||
*/
|
||||
if (skb_is_nonlinear(skb)) {
|
||||
netdev_dbg(netdev, "cannot Tx non-linear skb:%px\n", skb);
|
||||
goto drop;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for headroom/tailroom and clone
|
||||
*/
|
||||
nhead = netdev->needed_headroom;
|
||||
ntail = netdev->needed_tailroom;
|
||||
|
||||
if (skb_cloned(skb) ||
|
||||
(skb_headroom(skb) < nhead) ||
|
||||
(skb_headroom(skb) < ntail)) {
|
||||
expand_skb = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand the skb. This also unclones a cloned skb.
|
||||
*/
|
||||
if (expand_skb && pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC)) {
|
||||
netdev_dbg(netdev, "cannot expand skb:%px\n", skb);
|
||||
goto drop;
|
||||
}
|
||||
|
||||
/*
|
||||
* Transmit the packet
|
||||
*/
|
||||
ret = edma_ring_xmit(&edma_hw, netdev, skb,
|
||||
&edma_hw.txdesc_ring[tx_ring]);
|
||||
if (ret == EDMA_TX_OK)
|
||||
return NETDEV_TX_OK;
|
||||
|
||||
/*
|
||||
* Not enough descriptors. Stop netdev Tx queue.
|
||||
*/
|
||||
if (ret == EDMA_TX_DESC) {
|
||||
netif_stop_queue(netdev);
|
||||
return NETDEV_TX_BUSY;
|
||||
}
|
||||
|
||||
drop:
|
||||
dev_kfree_skb_any(skb);
|
||||
netdev->stats.tx_dropped++;
|
||||
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_if_set_features()
|
||||
* Set the supported net_device features
|
||||
*/
|
||||
static void edma_if_set_features(struct nss_dp_data_plane_ctx *dpc)
|
||||
{
|
||||
/*
|
||||
* TODO - add flags to support HIGHMEM/cksum offload VLAN
|
||||
* the features are enabled.
|
||||
*/
|
||||
}
|
||||
|
||||
/* TODO - check if this is needed */
|
||||
/*
|
||||
* edma_if_pause_on_off()
|
||||
* Set pause frames on or off
|
||||
*
|
||||
* No need to send a message if we defaulted to slow path.
|
||||
*/
|
||||
static int edma_if_pause_on_off(struct nss_dp_data_plane_ctx *dpc,
|
||||
uint32_t pause_on)
|
||||
{
|
||||
return NSS_DP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_if_vsi_assign()
|
||||
* assign vsi of the data plane
|
||||
*
|
||||
*/
|
||||
static int edma_if_vsi_assign(struct nss_dp_data_plane_ctx *dpc, uint32_t vsi)
|
||||
{
|
||||
struct net_device *netdev = dpc->dev;
|
||||
int32_t port_num;
|
||||
|
||||
port_num = edma_get_port_num_from_netdev(netdev);
|
||||
|
||||
if (port_num < 0)
|
||||
return NSS_DP_FAILURE;
|
||||
|
||||
if (fal_port_vsi_set(0, port_num, vsi) < 0)
|
||||
return NSS_DP_FAILURE;
|
||||
|
||||
return NSS_DP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_if_vsi_unassign()
|
||||
* unassign vsi of the data plane
|
||||
*
|
||||
*/
|
||||
static int edma_if_vsi_unassign(struct nss_dp_data_plane_ctx *dpc, uint32_t vsi)
|
||||
{
|
||||
struct net_device *netdev = dpc->dev;
|
||||
uint32_t port_num;
|
||||
|
||||
port_num = edma_get_port_num_from_netdev(netdev);
|
||||
|
||||
if (port_num < 0)
|
||||
return NSS_DP_FAILURE;
|
||||
|
||||
if (fal_port_vsi_set(0, port_num, 0xffff) < 0)
|
||||
return NSS_DP_FAILURE;
|
||||
|
||||
return NSS_DP_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RFS_ACCEL
|
||||
/*
|
||||
* edma_if_rx_flow_steer()
|
||||
* Flow steer of the data plane
|
||||
*
|
||||
* Initial receive flow steering function for data plane operation.
|
||||
*/
|
||||
static int edma_if_rx_flow_steer(struct nss_dp_data_plane_ctx *dpc, struct sk_buff *skb,
|
||||
uint32_t cpu, bool is_add)
|
||||
{
|
||||
return NSS_DP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* edma_if_deinit()
|
||||
* Free edma resources
|
||||
*/
|
||||
static int edma_if_deinit(struct nss_dp_data_plane_ctx *dpc)
|
||||
{
|
||||
/*
|
||||
* Free up resources used by EDMA if all the
|
||||
* interfaces have been overridden
|
||||
* */
|
||||
if (edma_hw.dp_override_cnt == EDMA_MAX_GMACS - 1) {
|
||||
edma_cleanup(true);
|
||||
} else {
|
||||
edma_hw.dp_override_cnt++;
|
||||
}
|
||||
|
||||
return NSS_DP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_irq_init()
|
||||
* Initialize interrupt handlers for the driver
|
||||
*/
|
||||
static int edma_irq_init(void)
|
||||
{
|
||||
struct edma_rxdesc_ring *rxdesc_ring = NULL;
|
||||
struct edma_rxfill_ring *rxfill_ring = NULL;
|
||||
struct edma_txcmpl_ring *txcmpl_ring = NULL;
|
||||
int err;
|
||||
uint32_t entry_num, i;
|
||||
|
||||
/*
|
||||
* Get TXCMPL rings IRQ numbers
|
||||
*/
|
||||
entry_num = 0;
|
||||
for (i = 0; i < edma_hw.txcmpl_rings; i++, entry_num++) {
|
||||
edma_hw.txcmpl_intr[i] =
|
||||
platform_get_irq(edma_hw.pdev, entry_num);
|
||||
if (edma_hw.txcmpl_intr[i] < 0) {
|
||||
pr_warn("%s: txcmpl_intr[%u] irq get failed\n",
|
||||
(edma_hw.device_node)->name, i);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pr_debug("%s: txcmpl_intr[%u] = %u\n",
|
||||
(edma_hw.device_node)->name,
|
||||
i, edma_hw.txcmpl_intr[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get RXFILL rings IRQ numbers
|
||||
*/
|
||||
for (i = 0; i < edma_hw.rxfill_rings; i++, entry_num++) {
|
||||
edma_hw.rxfill_intr[i] =
|
||||
platform_get_irq(edma_hw.pdev, entry_num);
|
||||
if (edma_hw.rxfill_intr[i] < 0) {
|
||||
pr_warn("%s: rxfill_intr[%u] irq get failed\n",
|
||||
(edma_hw.device_node)->name, i);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pr_debug("%s: rxfill_intr[%u] = %u\n",
|
||||
(edma_hw.device_node)->name,
|
||||
i, edma_hw.rxfill_intr[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get RXDESC rings IRQ numbers
|
||||
*
|
||||
*/
|
||||
for (i = 0; i < edma_hw.rxdesc_rings; i++, entry_num++) {
|
||||
edma_hw.rxdesc_intr[i] =
|
||||
platform_get_irq(edma_hw.pdev, entry_num);
|
||||
if (edma_hw.rxdesc_intr[i] < 0) {
|
||||
pr_warn("%s: rxdesc_intr[%u] irq get failed\n",
|
||||
(edma_hw.device_node)->name, i);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pr_debug("%s: rxdesc_intr[%u] = %u\n",
|
||||
(edma_hw.device_node)->name,
|
||||
i, edma_hw.rxdesc_intr[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get misc IRQ number
|
||||
*/
|
||||
edma_hw.misc_intr = platform_get_irq(edma_hw.pdev, entry_num);
|
||||
pr_debug("%s: misc IRQ:%u\n",
|
||||
(edma_hw.device_node)->name,
|
||||
edma_hw.misc_intr);
|
||||
|
||||
/*
|
||||
* Request IRQ for TXCMPL rings
|
||||
*/
|
||||
for (i = 0; i < edma_hw.txcmpl_rings; i++) {
|
||||
err = request_irq(edma_hw.txcmpl_intr[i],
|
||||
edma_handle_irq, IRQF_SHARED,
|
||||
"edma_txcmpl", (void *)edma_hw.pdev);
|
||||
if (err) {
|
||||
pr_debug("TXCMPL ring IRQ:%d request failed\n",
|
||||
edma_hw.txcmpl_intr[i]);
|
||||
return -1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Request IRQ for RXFILL rings
|
||||
*/
|
||||
for (i = 0; i < edma_hw.rxfill_rings; i++) {
|
||||
err = request_irq(edma_hw.rxfill_intr[i],
|
||||
edma_handle_irq, IRQF_SHARED,
|
||||
"edma_rxfill", (void *)edma_hw.pdev);
|
||||
if (err) {
|
||||
pr_debug("RXFILL ring IRQ:%d request failed\n",
|
||||
edma_hw.rxfill_intr[i]);
|
||||
goto rx_fill_ring_intr_req_fail;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Request IRQ for RXDESC rings
|
||||
*/
|
||||
for (i = 0; i < edma_hw.rxdesc_rings; i++) {
|
||||
err = request_irq(edma_hw.rxdesc_intr[i],
|
||||
edma_handle_irq, IRQF_SHARED,
|
||||
"edma_rxdesc", (void *)edma_hw.pdev);
|
||||
if (err) {
|
||||
pr_debug("RXDESC ring IRQ:%d request failed\n",
|
||||
edma_hw.rxdesc_intr[i]);
|
||||
goto rx_desc_ring_intr_req_fail;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Request Misc IRQ
|
||||
*/
|
||||
err = request_irq(edma_hw.misc_intr, edma_handle_misc_irq,
|
||||
IRQF_SHARED, "edma_misc",
|
||||
(void *)edma_hw.pdev);
|
||||
if (err) {
|
||||
pr_debug("MISC IRQ:%d request failed\n",
|
||||
edma_hw.misc_intr);
|
||||
goto misc_intr_req_fail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set interrupt mask
|
||||
*/
|
||||
for (i = 0; i < edma_hw.rxfill_rings; i++) {
|
||||
rxfill_ring = &edma_hw.rxfill_ring[i];
|
||||
edma_reg_write(EDMA_REG_RXFILL_INT_MASK(rxfill_ring->id),
|
||||
edma_hw.rxfill_intr_mask);
|
||||
}
|
||||
|
||||
for (i = 0; i < edma_hw.txcmpl_rings; i++) {
|
||||
txcmpl_ring = &edma_hw.txcmpl_ring[i];
|
||||
edma_reg_write(EDMA_REG_TX_INT_MASK(txcmpl_ring->id),
|
||||
edma_hw.txcmpl_intr_mask);
|
||||
}
|
||||
|
||||
for (i = 0; i < edma_hw.rxdesc_rings; i++) {
|
||||
rxdesc_ring = &edma_hw.rxdesc_ring[i];
|
||||
edma_reg_write(EDMA_REG_RXDESC_INT_MASK(rxdesc_ring->id),
|
||||
edma_hw.rxdesc_intr_mask);
|
||||
}
|
||||
|
||||
edma_reg_write(EDMA_REG_MISC_INT_MASK, edma_hw.misc_intr_mask);
|
||||
return 0;
|
||||
|
||||
misc_intr_req_fail:
|
||||
|
||||
/*
|
||||
* Free IRQ for RXDESC rings
|
||||
*/
|
||||
for (i = 0; i < edma_hw.rxdesc_rings; i++) {
|
||||
synchronize_irq(edma_hw.rxdesc_intr[i]);
|
||||
free_irq(edma_hw.rxdesc_intr[i],
|
||||
(void *)&(edma_hw.pdev)->dev);
|
||||
}
|
||||
|
||||
rx_desc_ring_intr_req_fail:
|
||||
|
||||
/*
|
||||
* Free IRQ for RXFILL rings
|
||||
*/
|
||||
for (i = 0; i < edma_hw.rxfill_rings; i++) {
|
||||
synchronize_irq(edma_hw.rxfill_intr[i]);
|
||||
free_irq(edma_hw.rxfill_intr[i],
|
||||
(void *)&(edma_hw.pdev)->dev);
|
||||
}
|
||||
|
||||
rx_fill_ring_intr_req_fail:
|
||||
|
||||
/*
|
||||
* Free IRQ for TXCMPL rings
|
||||
*/
|
||||
for (i = 0; i < edma_hw.txcmpl_rings; i++) {
|
||||
|
||||
synchronize_irq(edma_hw.txcmpl_intr[i]);
|
||||
free_irq(edma_hw.txcmpl_intr[i],
|
||||
(void *)&(edma_hw.pdev)->dev);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_register_netdevice()
|
||||
* Register netdevice with EDMA
|
||||
*/
|
||||
static int edma_register_netdevice(struct net_device *netdev, uint32_t macid)
|
||||
{
|
||||
if (!netdev) {
|
||||
pr_info("nss_dp_edma: Invalid netdev pointer %px\n", netdev);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((macid < EDMA_START_GMACS) || (macid > EDMA_MAX_GMACS)) {
|
||||
netdev_dbg(netdev, "nss_dp_edma: Invalid macid(%d) for %s\n",
|
||||
macid, netdev->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
netdev_info(netdev, "nss_dp_edma: Registering netdev %s(qcom-id:%d) with EDMA\n",
|
||||
netdev->name, macid);
|
||||
|
||||
/*
|
||||
* We expect 'macid' to correspond to ports numbers on
|
||||
* IPQ807x. These begin from '1' and hence we subtract
|
||||
* one when using it as an array index.
|
||||
*/
|
||||
edma_hw.netdev_arr[macid - 1] = netdev;
|
||||
|
||||
/*
|
||||
* NAPI add
|
||||
*/
|
||||
if (!edma_hw.napi_added) {
|
||||
netif_napi_add(netdev, &edma_hw.napi, edma_napi,
|
||||
EDMA_NAPI_WORK);
|
||||
/*
|
||||
* Register the interrupt handlers and enable interrupts
|
||||
*/
|
||||
if (edma_irq_init() < 0)
|
||||
return -EINVAL;
|
||||
|
||||
edma_hw.napi_added = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_if_init()
|
||||
*/
|
||||
|
||||
static int edma_if_init(struct nss_dp_data_plane_ctx *dpc)
|
||||
{
|
||||
|
||||
struct net_device *netdev = dpc->dev;
|
||||
struct nss_dp_dev *dp_dev = (struct nss_dp_dev *)netdev_priv(netdev);
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* Register the netdev
|
||||
*/
|
||||
ret = edma_register_netdevice(netdev, dp_dev->macid);
|
||||
if (ret) {
|
||||
netdev_dbg(netdev,
|
||||
"Error registering netdevice with EDMA %s\n",
|
||||
netdev->name);
|
||||
return NSS_DP_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Headroom needed for Tx preheader
|
||||
*/
|
||||
netdev->needed_headroom += EDMA_TX_PREHDR_SIZE;
|
||||
|
||||
return NSS_DP_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* nss_dp_edma_ops
|
||||
*/
|
||||
struct nss_dp_data_plane_ops nss_dp_edma_ops = {
|
||||
.init = edma_if_init,
|
||||
.open = edma_if_open,
|
||||
.close = edma_if_close,
|
||||
.link_state = edma_if_link_state,
|
||||
.mac_addr = edma_if_mac_addr,
|
||||
.change_mtu = edma_if_change_mtu,
|
||||
.xmit = edma_if_xmit,
|
||||
.set_features = edma_if_set_features,
|
||||
.pause_on_off = edma_if_pause_on_off,
|
||||
.vsi_assign = edma_if_vsi_assign,
|
||||
.vsi_unassign = edma_if_vsi_unassign,
|
||||
#ifdef CONFIG_RFS_ACCEL
|
||||
.rx_flow_steer = edma_if_rx_flow_steer,
|
||||
#endif
|
||||
.deinit = edma_if_deinit,
|
||||
};
|
||||
|
||||
/*
|
||||
* edma_of_get_pdata()
|
||||
* Read the device tree details for EDMA
|
||||
*/
|
||||
static int edma_of_get_pdata(struct resource *edma_res)
|
||||
{
|
||||
/*
|
||||
* Find EDMA node in device tree
|
||||
*/
|
||||
edma_hw.device_node = of_find_node_by_name(NULL,
|
||||
EDMA_DEVICE_NODE_NAME);
|
||||
if (!edma_hw.device_node) {
|
||||
pr_warn("EDMA device tree node (%s) not found\n",
|
||||
EDMA_DEVICE_NODE_NAME);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get EDMA device node
|
||||
*/
|
||||
edma_hw.pdev = of_find_device_by_node(edma_hw.device_node);
|
||||
if (!edma_hw.pdev) {
|
||||
pr_warn("Platform device for node %px(%s) not found\n",
|
||||
edma_hw.device_node,
|
||||
(edma_hw.device_node)->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get EDMA register resource
|
||||
*/
|
||||
if (of_address_to_resource(edma_hw.device_node, 0, edma_res) != 0) {
|
||||
pr_warn("Unable to get register address for edma device: "
|
||||
EDMA_DEVICE_NODE_NAME"\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get id of first TXDESC ring
|
||||
*/
|
||||
if (of_property_read_u32(edma_hw.device_node, "qcom,txdesc-ring-start",
|
||||
&edma_hw.txdesc_ring_start) != 0) {
|
||||
pr_warn("Read error 1st TXDESC ring (txdesc_ring_start)\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get number of TXDESC rings
|
||||
*/
|
||||
if (of_property_read_u32(edma_hw.device_node, "qcom,txdesc-rings",
|
||||
&edma_hw.txdesc_rings) != 0) {
|
||||
pr_warn("Unable to read number of txdesc rings.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
edma_hw.txdesc_ring_end = edma_hw.txdesc_ring_start +
|
||||
edma_hw.txdesc_rings;
|
||||
|
||||
/*
|
||||
* Get id of first TXCMPL ring
|
||||
*/
|
||||
if (of_property_read_u32(edma_hw.device_node, "qcom,txcmpl-ring-start",
|
||||
&edma_hw.txcmpl_ring_start) != 0) {
|
||||
pr_warn("Read error 1st TXCMPL ring (txcmpl_ring_start)\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get number of TXCMPL rings
|
||||
*/
|
||||
if (of_property_read_u32(edma_hw.device_node, "qcom,txcmpl-rings",
|
||||
&edma_hw.txcmpl_rings) != 0) {
|
||||
pr_warn("Unable to read number of txcmpl rings.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
edma_hw.txcmpl_ring_end = edma_hw.txcmpl_ring_start +
|
||||
edma_hw.txcmpl_rings;
|
||||
|
||||
/*
|
||||
* Get id of first RXFILL ring
|
||||
*/
|
||||
if (of_property_read_u32(edma_hw.device_node, "qcom,rxfill-ring-start",
|
||||
&edma_hw.rxfill_ring_start) != 0) {
|
||||
pr_warn("Read error 1st RXFILL ring (rxfill-ring-start)\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get number of RXFILL rings
|
||||
*/
|
||||
if (of_property_read_u32(edma_hw.device_node, "qcom,rxfill-rings",
|
||||
&edma_hw.rxfill_rings) != 0) {
|
||||
pr_warn("Unable to read number of rxfill rings.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
edma_hw.rxfill_ring_end = edma_hw.rxfill_ring_start +
|
||||
edma_hw.rxfill_rings;
|
||||
|
||||
/*
|
||||
* Get id of first RXDESC ring
|
||||
*/
|
||||
if (of_property_read_u32(edma_hw.device_node, "qcom,rxdesc-ring-start",
|
||||
&edma_hw.rxdesc_ring_start) != 0) {
|
||||
pr_warn("Read error 1st RXDESC ring (rxdesc-ring-start)\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get number of RXDESC rings
|
||||
*/
|
||||
if (of_property_read_u32(edma_hw.device_node, "qcom,rxdesc-rings",
|
||||
&edma_hw.rxdesc_rings) != 0) {
|
||||
pr_warn("Unable to read number of rxdesc rings.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
edma_hw.rxdesc_ring_end = edma_hw.rxdesc_ring_start +
|
||||
edma_hw.rxdesc_rings;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_init()
|
||||
* EDMA init
|
||||
*/
|
||||
int edma_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
struct resource res_edma;
|
||||
|
||||
/*
|
||||
* Get all the DTS data needed
|
||||
*/
|
||||
if (edma_of_get_pdata(&res_edma) < 0) {
|
||||
pr_warn("Unable to get EDMA DTS data.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Request memory region for EDMA registers
|
||||
*/
|
||||
edma_hw.reg_resource = request_mem_region(res_edma.start,
|
||||
resource_size(&res_edma),
|
||||
EDMA_DEVICE_NODE_NAME);
|
||||
if (!edma_hw.reg_resource) {
|
||||
pr_warn("Unable to request EDMA register memory.\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remap register resource
|
||||
*/
|
||||
edma_hw.reg_base = ioremap_nocache((edma_hw.reg_resource)->start,
|
||||
resource_size(edma_hw.reg_resource));
|
||||
if (!edma_hw.reg_base) {
|
||||
pr_warn("Unable to remap EDMA register memory.\n");
|
||||
ret = -EFAULT;
|
||||
goto edma_init_remap_fail;
|
||||
}
|
||||
|
||||
if (edma_hw_init(&edma_hw) != 0) {
|
||||
ret = -EFAULT;
|
||||
goto edma_init_hw_init_fail;
|
||||
}
|
||||
|
||||
platform_set_drvdata(edma_hw.pdev, (void *)&edma_hw);
|
||||
|
||||
edma_hw.napi_added = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
edma_init_hw_init_fail:
|
||||
iounmap(edma_hw.reg_base);
|
||||
|
||||
edma_init_remap_fail:
|
||||
release_mem_region((edma_hw.reg_resource)->start,
|
||||
resource_size(edma_hw.reg_resource));
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_disable_port()
|
||||
* EDMA disable port
|
||||
*/
|
||||
static void edma_disable_port(void)
|
||||
{
|
||||
edma_reg_write(EDMA_REG_PORT_CTRL, EDMA_DISABLE);
|
||||
}
|
||||
|
||||
/*
|
||||
* edma_cleanup()
|
||||
* EDMA cleanup
|
||||
*/
|
||||
void edma_cleanup(bool is_dp_override)
|
||||
{
|
||||
int i;
|
||||
struct edma_txcmpl_ring *txcmpl_ring = NULL;
|
||||
struct edma_rxdesc_ring *rxdesc_ring = NULL;
|
||||
|
||||
/*
|
||||
* The cleanup can happen from data plane override
|
||||
* or from module_exit, we want to cleanup only once
|
||||
*/
|
||||
if (!edma_hw.edma_initialized) {
|
||||
/*
|
||||
* Disable EDMA only at module exit time, since NSS firmware
|
||||
* depends on this setting.
|
||||
*/
|
||||
if (!is_dp_override) {
|
||||
edma_disable_port();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable Rx rings used by this driver
|
||||
*/
|
||||
for (i = edma_hw.rxdesc_ring_start; i < edma_hw.rxdesc_ring_end; i++)
|
||||
edma_reg_write(EDMA_REG_RXDESC_CTRL(i), EDMA_RING_DISABLE);
|
||||
|
||||
/*
|
||||
* Disable Tx rings used by this driver
|
||||
*/
|
||||
for (i = edma_hw.txdesc_ring_start; i < edma_hw.txdesc_ring_end; i++) {
|
||||
txcmpl_ring = &edma_hw.txcmpl_ring[i];
|
||||
edma_reg_write(EDMA_REG_TXDESC_CTRL(i),
|
||||
EDMA_RING_DISABLE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable RxFill Rings used by this driver
|
||||
*/
|
||||
for (i = edma_hw.rxfill_ring_start; i < edma_hw.rxfill_ring_end; i++)
|
||||
edma_reg_write(EDMA_REG_RXFILL_RING_EN(i), EDMA_RING_DISABLE);
|
||||
|
||||
/*
|
||||
* Clear interrupt mask
|
||||
*/
|
||||
for (i = 0; i < edma_hw.rxdesc_rings; i++) {
|
||||
rxdesc_ring = &edma_hw.rxdesc_ring[i];
|
||||
edma_reg_write(EDMA_REG_RXDESC_INT_MASK(rxdesc_ring->id),
|
||||
EDMA_MASK_INT_CLEAR);
|
||||
}
|
||||
|
||||
for (i = 0; i < edma_hw.txcmpl_rings; i++) {
|
||||
txcmpl_ring = &edma_hw.txcmpl_ring[i];
|
||||
edma_reg_write(EDMA_REG_TX_INT_MASK(txcmpl_ring->id),
|
||||
EDMA_MASK_INT_CLEAR);
|
||||
}
|
||||
|
||||
edma_reg_write(EDMA_REG_MISC_INT_MASK, EDMA_MASK_INT_CLEAR);
|
||||
/*
|
||||
* Remove interrupt handlers and NAPI
|
||||
*/
|
||||
if (edma_hw.napi_added) {
|
||||
|
||||
/*
|
||||
* Free IRQ for TXCMPL rings
|
||||
*/
|
||||
for (i = 0; i < edma_hw.txcmpl_rings; i++) {
|
||||
synchronize_irq(edma_hw.txcmpl_intr[i]);
|
||||
free_irq(edma_hw.txcmpl_intr[i],
|
||||
(void *)(edma_hw.pdev));
|
||||
}
|
||||
|
||||
/*
|
||||
* Free IRQ for RXFILL rings
|
||||
*/
|
||||
for (i = 0; i < edma_hw.rxfill_rings; i++) {
|
||||
synchronize_irq(edma_hw.rxfill_intr[i]);
|
||||
free_irq(edma_hw.rxfill_intr[i],
|
||||
(void *)(edma_hw.pdev));
|
||||
}
|
||||
|
||||
/*
|
||||
* Free IRQ for RXDESC rings
|
||||
*/
|
||||
for (i = 0; i < edma_hw.rxdesc_rings; i++) {
|
||||
synchronize_irq(edma_hw.rxdesc_intr[i]);
|
||||
free_irq(edma_hw.rxdesc_intr[i],
|
||||
(void *)(edma_hw.pdev));
|
||||
}
|
||||
|
||||
/*
|
||||
* Free Misc IRQ
|
||||
*/
|
||||
synchronize_irq(edma_hw.misc_intr);
|
||||
free_irq(edma_hw.misc_intr, (void *)(edma_hw.pdev));
|
||||
|
||||
netif_napi_del(&edma_hw.napi);
|
||||
edma_hw.napi_added = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable EDMA only at module exit time, since NSS firmware
|
||||
* depends on this setting.
|
||||
*/
|
||||
if (!is_dp_override) {
|
||||
edma_disable_port();
|
||||
}
|
||||
|
||||
/*
|
||||
* cleanup rings and free
|
||||
*/
|
||||
edma_cleanup_rings(&edma_hw);
|
||||
iounmap(edma_hw.reg_base);
|
||||
release_mem_region((edma_hw.reg_resource)->start,
|
||||
resource_size(edma_hw.reg_resource));
|
||||
|
||||
/*
|
||||
* Mark initialize false, so that we do not
|
||||
* try to cleanup again
|
||||
*/
|
||||
edma_hw.edma_initialized = false;
|
||||
}
|
||||
287
feeds/ipq807x/qca-nss-dp/src/hal/edma/edma_data_plane.h
Normal file
287
feeds/ipq807x/qca-nss-dp/src/hal/edma/edma_data_plane.h
Normal file
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
**************************************************************************
|
||||
* Copyright (c) 2016, 2018-2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
#include "nss_dp_dev.h"
|
||||
|
||||
#ifndef __NSS_DP_EDMA_DATAPLANE__
|
||||
#define __NSS_DP_EDMA_DATAPLANE__
|
||||
|
||||
#define EDMA_BUF_SIZE 2000
|
||||
#define EDMA_DEVICE_NODE_NAME "edma"
|
||||
#define EDMA_RX_BUFF_SIZE (EDMA_BUF_SIZE + EDMA_RX_PREHDR_SIZE)
|
||||
#define EDMA_RX_PREHDR_SIZE (sizeof(struct edma_rx_preheader))
|
||||
#define EDMA_TX_PREHDR_SIZE (sizeof(struct edma_tx_preheader))
|
||||
#define EDMA_RING_SIZE 128
|
||||
#define EDMA_NAPI_WORK 100
|
||||
#define EDMA_START_GMACS NSS_DP_START_IFNUM
|
||||
#define EDMA_MAX_GMACS NSS_DP_HAL_MAX_PORTS
|
||||
#define EDMA_TX_PKT_MIN_SIZE 33
|
||||
#if defined(NSS_DP_IPQ60XX)
|
||||
#define EDMA_MAX_TXCMPL_RINGS 24 /* Max TxCmpl rings */
|
||||
#else
|
||||
#define EDMA_MAX_TXCMPL_RINGS 8 /* Max TxCmpl rings */
|
||||
#endif
|
||||
#define EDMA_MAX_RXDESC_RINGS 16 /* Max RxDesc rings */
|
||||
#define EDMA_MAX_RXFILL_RINGS 8 /* Max RxFill rings */
|
||||
#define EDMA_MAX_TXDESC_RINGS 24 /* Max TxDesc rings */
|
||||
#define EDMA_GET_DESC(R, i, type) (&(((type *)((R)->desc))[i]))
|
||||
#define EDMA_RXFILL_DESC(R, i) EDMA_GET_DESC(R, i, struct edma_rxfill_desc)
|
||||
#define EDMA_RXDESC_DESC(R, i) EDMA_GET_DESC(R, i, struct edma_rxdesc_desc)
|
||||
#define EDMA_TXDESC_DESC(R, i) EDMA_GET_DESC(R, i, struct edma_txdesc_desc)
|
||||
#define EDMA_RXPH_SRC_INFO_TYPE_GET(rxph) (((rxph)->src_info >> 8) & 0xf0)
|
||||
#define EDMA_RXPH_SERVICE_CODE_GET(rxph) (((rxph)->rx_pre4) & 0xff)
|
||||
|
||||
/*
|
||||
* Tx descriptor
|
||||
*/
|
||||
struct edma_txdesc_desc {
|
||||
uint32_t buffer_addr;
|
||||
/* buffer address */
|
||||
uint32_t word1;
|
||||
/* more bit, TSO, preheader, pool, offset and length */
|
||||
};
|
||||
|
||||
/*
|
||||
* TxCmpl descriptor
|
||||
*/
|
||||
struct edma_txcmpl_desc {
|
||||
uint32_t buffer_addr; /* buffer address/opaque */
|
||||
uint32_t status; /* status */
|
||||
};
|
||||
|
||||
/*
|
||||
* Rx descriptor
|
||||
*/
|
||||
struct edma_rxdesc_desc {
|
||||
uint32_t buffer_addr; /* buffer address */
|
||||
uint32_t status; /* status */
|
||||
};
|
||||
|
||||
/*
|
||||
* RxFill descriptor
|
||||
*/
|
||||
struct edma_rxfill_desc {
|
||||
uint32_t buffer_addr; /* Buffer address */
|
||||
uint32_t word1; /* opaque_ind and buffer size */
|
||||
};
|
||||
|
||||
/*
|
||||
* Tx descriptor ring
|
||||
*/
|
||||
struct edma_txdesc_ring {
|
||||
uint32_t id; /* TXDESC ring number */
|
||||
void *desc; /* descriptor ring virtual address */
|
||||
dma_addr_t dma; /* descriptor ring physical address */
|
||||
spinlock_t tx_lock; /* Tx ring lock */
|
||||
uint16_t count; /* number of descriptors */
|
||||
};
|
||||
|
||||
/*
|
||||
* TxCmpl ring
|
||||
*/
|
||||
struct edma_txcmpl_ring {
|
||||
uint32_t id; /* TXCMPL ring number */
|
||||
void *desc; /* descriptor ring virtual address */
|
||||
dma_addr_t dma; /* descriptor ring physical address */
|
||||
uint16_t count; /* number of descriptors in the ring */
|
||||
};
|
||||
|
||||
/*
|
||||
* RxFill ring
|
||||
*/
|
||||
struct edma_rxfill_ring {
|
||||
uint32_t id; /* RXFILL ring number */
|
||||
void *desc; /* descriptor ring virtual address */
|
||||
dma_addr_t dma; /* descriptor ring physical address */
|
||||
spinlock_t lock; /* Rx ring lock */
|
||||
uint16_t count; /* number of descriptors in the ring */
|
||||
};
|
||||
|
||||
/*
|
||||
* RxDesc ring
|
||||
*/
|
||||
struct edma_rxdesc_ring {
|
||||
uint32_t id; /* RXDESC ring number */
|
||||
struct edma_rxfill_ring *rxfill; /* RXFILL ring used */
|
||||
void *desc; /* descriptor ring virtual address */
|
||||
dma_addr_t dma; /* descriptor ring physical address */
|
||||
uint16_t count; /* number of descriptors in the ring */
|
||||
};
|
||||
|
||||
/*
|
||||
* EDMA Tx Preheader
|
||||
*/
|
||||
struct edma_tx_preheader {
|
||||
uint32_t opaque; /* Opaque, contains skb pointer */
|
||||
uint16_t src_info; /* Src information */
|
||||
uint16_t dst_info; /* Dest information */
|
||||
uint32_t tx_pre2; /* SVLAN & CVLAN flag, drop prec, hash value */
|
||||
uint32_t tx_pre3; /* STAG, CTAG */
|
||||
uint32_t tx_pre4; /* CPU code, L3 & L4 offset, service code */
|
||||
uint32_t tx_pre5; /* IP addr index, ACL index */
|
||||
uint32_t tx_pre6; /* IP payload checksum, copy2cpu, timestamp, dscp */
|
||||
uint32_t tx_pre7; /* Timestamp, QoS TAG */
|
||||
};
|
||||
|
||||
/*
|
||||
* EDMA Rx Preheader
|
||||
*/
|
||||
struct edma_rx_preheader {
|
||||
uint32_t opaque;
|
||||
/* Opaque, contains skb pointer*/
|
||||
uint16_t src_info;
|
||||
/* Src information */
|
||||
uint16_t dst_info;
|
||||
/* Dest information */
|
||||
uint32_t rx_pre2;
|
||||
/* SVLAN & CVLAN flag, drop prec, hash value */
|
||||
uint32_t rx_pre3;
|
||||
/* STAG, CTAG */
|
||||
uint32_t rx_pre4;
|
||||
/* CPU code, L3 & L4 offset, service code */
|
||||
uint32_t rx_pre5;
|
||||
/* IP addr index, ACL index */
|
||||
uint32_t rx_pre6;
|
||||
/* IP payload checksum, copy2cpu, timestamp, dscp */
|
||||
uint32_t rx_pre7;
|
||||
/* Timestamp, QoS TAG */
|
||||
};
|
||||
|
||||
enum edma_tx {
|
||||
EDMA_TX_OK = 0, /* Tx success */
|
||||
EDMA_TX_DESC = 1, /* Not enough descriptors */
|
||||
EDMA_TX_FAIL = 2, /* Tx failure */
|
||||
};
|
||||
|
||||
/*
|
||||
* EDMA private data structure
|
||||
*/
|
||||
struct edma_hw {
|
||||
struct napi_struct napi;
|
||||
/* napi structure */
|
||||
struct net_device *netdev_arr[EDMA_MAX_GMACS];
|
||||
/* netdev for each gmac port */
|
||||
struct device_node *device_node;
|
||||
/* Device tree node */
|
||||
struct platform_device *pdev;
|
||||
/* Platform device */
|
||||
void __iomem *reg_base;
|
||||
/* Base register address */
|
||||
struct resource *reg_resource;
|
||||
/* Memory resource */
|
||||
uint16_t rx_payload_offset;
|
||||
/* start of the payload offset */
|
||||
uint32_t flags;
|
||||
/* internal flags */
|
||||
int active;
|
||||
/* status */
|
||||
int napi_added;
|
||||
/* flag to indicate napi add status */
|
||||
|
||||
/*
|
||||
* Debugfs entries
|
||||
*/
|
||||
struct dentry *edma_dentry;
|
||||
struct dentry *txdesc_dentry;
|
||||
struct dentry *txcmpl_dentry;
|
||||
struct dentry *rxdesc_dentry;
|
||||
|
||||
/*
|
||||
* Store for tx and rx skbs
|
||||
*/
|
||||
struct sk_buff *rx_skb_store[EDMA_RING_SIZE];
|
||||
struct sk_buff *tx_skb_store[EDMA_RING_SIZE];
|
||||
|
||||
struct edma_rxfill_ring *rxfill_ring;
|
||||
/* Rx Fill Ring, SW is producer */
|
||||
struct edma_rxdesc_ring *rxdesc_ring;
|
||||
/* Rx Descriptor Ring, SW is consumer */
|
||||
struct edma_txdesc_ring *txdesc_ring;
|
||||
/* Tx Descriptor Ring, SW is producer */
|
||||
struct edma_txcmpl_ring *txcmpl_ring;
|
||||
/* Tx Completion Ring, SW is consumer */
|
||||
|
||||
uint32_t txdesc_rings;
|
||||
/* Number of TxDesc rings */
|
||||
uint32_t txdesc_ring_start;
|
||||
/* Id of first TXDESC ring */
|
||||
uint32_t txdesc_ring_end;
|
||||
/* Id of the last TXDESC ring */
|
||||
uint32_t txcmpl_rings;
|
||||
/* Number of TxCmpl rings */
|
||||
uint32_t txcmpl_ring_start;
|
||||
/* Id of first TXCMPL ring */
|
||||
uint32_t txcmpl_ring_end;
|
||||
/* Id of last TXCMPL ring */
|
||||
uint32_t rxfill_rings;
|
||||
/* Number of RxFill rings */
|
||||
uint32_t rxfill_ring_start;
|
||||
/* Id of first RxFill ring */
|
||||
uint32_t rxfill_ring_end;
|
||||
/* Id of last RxFill ring */
|
||||
uint32_t rxdesc_rings;
|
||||
/* Number of RxDesc rings */
|
||||
uint32_t rxdesc_ring_start;
|
||||
/* Id of first RxDesc ring */
|
||||
uint32_t rxdesc_ring_end;
|
||||
/* Id of last RxDesc ring */
|
||||
uint32_t txcmpl_intr[EDMA_MAX_TXCMPL_RINGS];
|
||||
/* TxCmpl ring IRQ numbers */
|
||||
uint32_t rxfill_intr[EDMA_MAX_RXFILL_RINGS];
|
||||
/* Rx fill ring IRQ numbers */
|
||||
uint32_t rxdesc_intr[EDMA_MAX_RXDESC_RINGS];
|
||||
/* Rx desc ring IRQ numbers */
|
||||
uint32_t misc_intr;
|
||||
/* Misc IRQ number */
|
||||
|
||||
uint32_t tx_intr_mask;
|
||||
/* Tx interrupt mask */
|
||||
uint32_t rxfill_intr_mask;
|
||||
/* Rx fill ring interrupt mask */
|
||||
uint32_t rxdesc_intr_mask;
|
||||
/* Rx Desc ring interrupt mask */
|
||||
uint32_t txcmpl_intr_mask;
|
||||
/* Tx Cmpl ring interrupt mask */
|
||||
uint32_t misc_intr_mask;
|
||||
/* misc interrupt interrupt mask */
|
||||
uint32_t dp_override_cnt;
|
||||
/* number of interfaces overriden */
|
||||
bool edma_initialized;
|
||||
/* flag to check initialization status */
|
||||
};
|
||||
|
||||
extern struct edma_hw edma_hw;
|
||||
|
||||
uint32_t edma_reg_read(uint32_t reg_off);
|
||||
void edma_reg_write(uint32_t reg_off, uint32_t val);
|
||||
|
||||
int edma_alloc_rx_buffer(struct edma_hw *ehw,
|
||||
struct edma_rxfill_ring *rxfill_ring);
|
||||
enum edma_tx edma_ring_xmit(struct edma_hw *ehw,
|
||||
struct net_device *netdev,
|
||||
struct sk_buff *skb,
|
||||
struct edma_txdesc_ring *txdesc_ring);
|
||||
uint32_t edma_clean_tx(struct edma_hw *ehw,
|
||||
struct edma_txcmpl_ring *txcmpl_ring);
|
||||
irqreturn_t edma_handle_irq(int irq, void *ctx);
|
||||
irqreturn_t edma_handle_misc_irq(int irq, void *ctx);
|
||||
int edma_napi(struct napi_struct *napi, int budget);
|
||||
void edma_cleanup_rings(struct edma_hw *ehw);
|
||||
void edma_cleanup(bool is_dp_override);
|
||||
int edma_hw_init(struct edma_hw *ehw);
|
||||
#endif /* __NSS_DP_EDMA_DATAPLANE__ */
|
||||
454
feeds/ipq807x/qca-nss-dp/src/hal/edma/edma_regs.h
Normal file
454
feeds/ipq807x/qca-nss-dp/src/hal/edma/edma_regs.h
Normal file
@@ -0,0 +1,454 @@
|
||||
/*
|
||||
**************************************************************************
|
||||
* Copyright (c) 2016,2019-2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __EDMA_REGS__
|
||||
#define __EDMA_REGS__
|
||||
|
||||
/*
|
||||
* IPQ807x EDMA register offsets
|
||||
*/
|
||||
#define EDMA_REG_MAS_CTRL 0x0
|
||||
#define EDMA_REG_PORT_CTRL 0x4
|
||||
#define EDMA_REG_VLAN_CTRL 0x8
|
||||
#define EDMA_REG_RXDESC2FILL_MAP_0 0x18
|
||||
#define EDMA_REG_RXDESC2FILL_MAP_1 0x1c
|
||||
#define EDMA_REG_TXQ_CTRL 0x20
|
||||
#define EDMA_REG_TXQ_CTRL_2 0x24
|
||||
#define EDMA_REG_TXQ_FC_0 0x28
|
||||
#define EDMA_REG_TXQ_FC_1 0x30
|
||||
#define EDMA_REG_TXQ_FC_2 0x34
|
||||
#define EDMA_REG_TXQ_FC_3 0x38
|
||||
#define EDMA_REG_RXQ_CTRL 0x3c
|
||||
#define EDMA_REG_RX_TX_FULL_QID 0x40
|
||||
#define EDMA_REG_RXQ_FC_THRE 0x44
|
||||
#define EDMA_REG_DMAR_CTRL 0x48
|
||||
#define EDMA_REG_AXIR_CTRL 0x4c
|
||||
#define EDMA_REG_AXIW_CTRL 0x50
|
||||
#define EDMA_REG_MIN_MSS 0x54
|
||||
#define EDMA_REG_LOOPBACK_CTRL 0x58
|
||||
#define EDMA_REG_MISC_INT_STAT 0x5c
|
||||
#define EDMA_REG_MISC_INT_MASK 0x60
|
||||
#define EDMA_REG_DBG_CTRL 0x64
|
||||
#define EDMA_REG_DBG_DATA 0x68
|
||||
#define EDMA_REG_TXDESC_BA(n) (0x1000 + (0x1000 * n))
|
||||
#define EDMA_REG_TXDESC_PROD_IDX(n) (0x1004 + (0x1000 * n))
|
||||
#define EDMA_REG_TXDESC_CONS_IDX(n) (0x1008 + (0x1000 * n))
|
||||
#define EDMA_REG_TXDESC_RING_SIZE(n) (0x100c + (0x1000 * n))
|
||||
#define EDMA_REG_TXDESC_CTRL(n) (0x1010 + (0x1000 * n))
|
||||
#if defined(NSS_DP_IPQ807X)
|
||||
#define EDMA_REG_TXDESC2CMPL_MAP_0 0xc
|
||||
#define EDMA_REG_TXDESC2CMPL_MAP_1 0x10
|
||||
#define EDMA_REG_TXDESC2CMPL_MAP_2 0x14
|
||||
#define EDMA_REG_TXCMPL_BASE 0x19000
|
||||
#define EDMA_REG_TX_BASE 0x21000
|
||||
#else
|
||||
#define EDMA_REG_TXCMPL_BASE 0x79000
|
||||
#define EDMA_REG_TX_BASE 0x91000
|
||||
#endif
|
||||
#define EDMA_REG_TXCMPL_BA_OFFSET 0x00000
|
||||
#define EDMA_REG_TXCMPL_PROD_IDX_OFFSET 0x00004
|
||||
#define EDMA_REG_TXCMPL_CONS_IDX_OFFSET 0x00008
|
||||
#define EDMA_REG_TXCMPL_RING_SIZE_OFFSET 0x0000c
|
||||
#define EDMA_REG_TXCMPL_UGT_THRE_OFFSET 0x00010
|
||||
#define EDMA_REG_TXCMPL_CTRL_OFFSET 0x00014
|
||||
#define EDMA_REG_TXCMPL_BPC_OFFSET 0x00018
|
||||
#define EDMA_REG_TX_INT_STAT_OFFSET 0x00000
|
||||
#define EDMA_REG_TX_INT_MASK_OFFSET 0x00004
|
||||
#define EDMA_REG_TX_MOD_TIMER_OFFSET 0x00008
|
||||
#define EDMA_REG_TX_INT_CTRL_OFFSET 0x0000c
|
||||
#define EDMA_REG_TXCMPL_BA(n) (EDMA_REG_TXCMPL_BASE + EDMA_REG_TXCMPL_BA_OFFSET + (0x1000 * n))
|
||||
#define EDMA_REG_TXCMPL_PROD_IDX(n) (EDMA_REG_TXCMPL_BASE + EDMA_REG_TXCMPL_PROD_IDX_OFFSET + (0x1000 * n))
|
||||
#define EDMA_REG_TXCMPL_CONS_IDX(n) (EDMA_REG_TXCMPL_BASE + EDMA_REG_TXCMPL_CONS_IDX_OFFSET + (0x1000 * n))
|
||||
#define EDMA_REG_TXCMPL_RING_SIZE(n) (EDMA_REG_TXCMPL_BASE + EDMA_REG_TXCMPL_RING_SIZE_OFFSET + (0x1000 * n))
|
||||
#define EDMA_REG_TXCMPL_UGT_THRE(n) (EDMA_REG_TXCMPL_BASE + EDMA_REG_TXCMPL_UGT_THRE_OFFSET + (0x1000 * n))
|
||||
#define EDMA_REG_TXCMPL_CTRL(n) (EDMA_REG_TXCMPL_BASE + EDMA_REG_TXCMPL_CTRL_OFFSET + (0x1000 * n))
|
||||
#define EDMA_REG_TXCMPL_BPC(n) (EDMA_REG_TXCMPL_BASE + EDMA_REG_TXCMPL_BPC_OFFSET + (0x1000 * n))
|
||||
#define EDMA_REG_TX_INT_STAT(n) (EDMA_REG_TX_BASE + EDMA_REG_TX_INT_STAT_OFFSET + (0x1000 * n))
|
||||
#define EDMA_REG_TX_INT_MASK(n) (EDMA_REG_TX_BASE + EDMA_REG_TX_INT_MASK_OFFSET + (0x1000 * n))
|
||||
#define EDMA_REG_TX_MOD_TIMER(n) (EDMA_REG_TX_BASE + EDMA_REG_TX_MOD_TIMER_OFFSET + (0x1000 * n))
|
||||
#define EDMA_REG_TX_INT_CTRL(n) (EDMA_REG_TX_BASE + EDMA_REG_TX_INT_CTRL_OFFSET + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_BA(n) (0x29000 + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_PROD_IDX(n) (0x29004 + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_CONS_IDX(n) (0x29008 + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_RING_SIZE(n) (0x2900c + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_BUFFER1_SIZE(n) (0x29010 + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_FC_THRE(n) (0x29014 + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_UGT_THRE(n) (0x29018 + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_RING_EN(n) (0x2901c + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_DISABLE(n) (0x29020 + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_DISABLE_DONE(n) (0x29024 + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_INT_STAT(n) (0x31000 + (0x1000 * n))
|
||||
#define EDMA_REG_RXFILL_INT_MASK(n) (0x31004 + (0x1000 * n))
|
||||
#define EDMA_REG_RXDESC_BA(n) (0x39000 + (0x1000 * n))
|
||||
#define EDMA_REG_RXDESC_PROD_IDX(n) (0x39004 + (0x1000 * n))
|
||||
#define EDMA_REG_RXDESC_CONS_IDX(n) (0x39008 + (0x1000 * n))
|
||||
#define EDMA_REG_RXDESC_RING_SIZE(n) (0x3900c + (0x1000 * n))
|
||||
#define EDMA_REG_RXDESC_FC_THRE(n) (0x39010 + (0x1000 * n))
|
||||
#define EDMA_REG_RXDESC_UGT_THRE(n) (0x39014 + (0x1000 * n))
|
||||
#define EDMA_REG_RXDESC_CTRL(n) (0x39018 + (0x1000 * n))
|
||||
#define EDMA_REG_RXDESC_BPC(n) (0x3901c + (0x1000 * n))
|
||||
#define EDMA_REG_RXDESC_INT_STAT(n) (0x49000 + (0x1000 * n))
|
||||
#define EDMA_REG_RXDESC_INT_MASK(n) (0x49004 + (0x1000 * n))
|
||||
#define EDMA_REG_RX_MOD_TIMER(n) (0x49008 + (0x1000 * n))
|
||||
#define EDMA_REG_RX_INT_CTRL(n) (0x4900c + (0x1000 * n))
|
||||
#define EDMA_QID2RID_TABLE_MEM(q) (0x5a000 + (0x4 * q))
|
||||
#define EDMA_REG_RXRING_PC(n) (0x5A200 + (0x10 * n))
|
||||
#define EDMA_REG_RXRING_BC_0(n) (0x5A204 + (0x10 * n))
|
||||
#define EDMA_REG_RXRING_BC_1(n) (0x5A208 + (0x10 * n))
|
||||
#define EDMA_REG_TXRING_PC(n) (0x74000 + (0x10 * n))
|
||||
#define EDMA_REG_TXRING_BC_0(n) (0x74004 + (0x10 * n))
|
||||
#define EDMA_REG_TXRING_BC_1(n) (0x74008 + (0x10 * n))
|
||||
|
||||
/*
|
||||
* EDMA_REG_PORT_CTRL register
|
||||
*/
|
||||
#define EDMA_PORT_PAD_EN 0x1
|
||||
#define EDMA_PORT_EDMA_EN 0x2
|
||||
|
||||
/*
|
||||
* EDMA_REG_TXQ_CTRL register
|
||||
*/
|
||||
#define EDMA_TXDESC_PF_THRE_MASK 0xf
|
||||
#define EDMA_TXDESC_PF_THRE_SHIFT 0
|
||||
#define EDMA_TXCMPL_WB_THRE_MASK 0xf
|
||||
#define EDMA_TXCMPL_WB_THRE_SHIFT 4
|
||||
#define EDMA_TXDESC_PKT_SRAM_THRE_MASK 0xff
|
||||
#define EDMA_TXDESC_PKT_SRAM_THRE_SHIFT 8
|
||||
#define EDMA_TXCMPL_WB_TIMER_MASK 0xffff
|
||||
#define EDMA_TXCMPL_WB_TIMER_SHIFT 16
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXQ_CTRL register
|
||||
*/
|
||||
#define EDMA_RXFILL_PF_THRE_MASK 0xf
|
||||
#define EDMA_RXFILL_PF_THRE_SHIFT 0
|
||||
#define EDMA_RXDESC_WB_THRE_MASK 0xf
|
||||
#define EDMA_RXDESC_WB_THRE_SHIFT 4
|
||||
#define EDMA_RXDESC_WB_TIMER_MASK 0xffff
|
||||
#define EDMA_RXDESC_WB_TIMER_SHIFT 16
|
||||
|
||||
/*
|
||||
* EDMA_REG_RX_TX_FULL_QID register
|
||||
*/
|
||||
#define EDMA_RX_DESC_FULL_QID_MASK 0xff
|
||||
#define EDMA_RX_DESC_FULL_QID_SHIFT 0
|
||||
#define EDMA_TX_CMPL_BUF_FULL_QID_MASK 0xff
|
||||
#define EDMA_TX_CMPL_BUF_FULL_QID_SHIFT 8
|
||||
#define EDMA_TX_SRAM_FULL_QID_MASK 0x1f
|
||||
#define EDMA_TX_SRAM_FULL_QID_SHIFT 16
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXQ_FC_THRE reister
|
||||
*/
|
||||
#define EDMA_RXFILL_FIFO_XOFF_THRE_MASK 0x1f
|
||||
#define EDMA_RXFILL_FIFO_XOFF_THRE_SHIFT 0
|
||||
#define EDMA_DESC_FIFO_XOFF_THRE_MASK 0x3f
|
||||
#define EDMA_DESC_FIFO_XOFF_THRE_SHIFT 16
|
||||
|
||||
/*
|
||||
* EDMA_REG_DMAR_CTRL register
|
||||
*/
|
||||
#define EDMA_DMAR_REQ_PRI_MASK 0x7
|
||||
#define EDMA_DMAR_REQ_PRI_SHIFT 0
|
||||
#define EDMA_DMAR_BURST_LEN_MASK 0x1
|
||||
#define EDMA_DMAR_BURST_LEN_SHIFT 3
|
||||
#define EDMA_DMAR_TXDATA_OUTSTANDING_NUM_MASK 0x1f
|
||||
#define EDMA_DMAR_TXDATA_OUTSTANDING_NUM_SHIFT 4
|
||||
#define EDMA_DMAR_TXDESC_OUTSTANDING_NUM_MASK 0x7
|
||||
#define EDMA_DMAR_TXDESC_OUTSTANDING_NUM_SHIFT 9
|
||||
#define EDMA_DMAR_RXFILL_OUTSTANDING_NUM_MASK 0x7
|
||||
#define EDMA_DMAR_RXFILL_OUTSTANDING_NUM_SHIFT 12
|
||||
|
||||
#define EDMA_DMAR_REQ_PRI_SET(x) (((x) & EDMA_DMAR_REQ_PRI_MASK) << EDMA_DMAR_REQ_PRI_SHIFT)
|
||||
#define EDMA_DMAR_TXDATA_OUTSTANDING_NUM_SET(x) (((x) & EDMA_DMAR_TXDATA_OUTSTANDING_NUM_MASK) << EDMA_DMAR_TXDATA_OUTSTANDING_NUM_SHIFT)
|
||||
#define EDMA_DMAR_TXDESC_OUTSTANDING_NUM_SET(x) (((x) & EDMA_DMAR_TXDESC_OUTSTANDING_NUM_MASK) << EDMA_DMAR_TXDESC_OUTSTANDING_NUM_SHIFT)
|
||||
#define EDMA_DMAR_RXFILL_OUTSTANDING_NUM_SET(x) (((x) & EDMA_DMAR_RXFILL_OUTSTANDING_NUM_MASK) << EDMA_DMAR_RXFILL_OUTSTANDING_NUM_SHIFT)
|
||||
#define EDMA_DMAR_BURST_LEN_SET(x) (((x) & EDMA_DMAR_BURST_LEN_MASK) << EDMA_DMAR_BURST_LEN_SHIFT)
|
||||
|
||||
/*
|
||||
* Enable 128 byte EDMA burts for IPQ60xx
|
||||
*/
|
||||
#if defined(NSS_DP_IPQ60XX)
|
||||
#define EDMA_BURST_LEN_ENABLE 1
|
||||
#else
|
||||
#define EDMA_BURST_LEN_ENABLE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* EDMA_REG_AXIW_CTRL_REG
|
||||
*/
|
||||
#define EDMA_AXIW_MAX_WR_SIZE_EN 0x400
|
||||
|
||||
/*
|
||||
* EDMA DISABLE
|
||||
*/
|
||||
#define EDMA_DISABLE 0
|
||||
|
||||
/*
|
||||
* EDMA_REG_TXDESC_PROD_IDX register
|
||||
*/
|
||||
#define EDMA_TXDESC_PROD_IDX_MASK 0xffff
|
||||
|
||||
/*
|
||||
* EDMA_REG_TXDESC_CONS_IDX register
|
||||
*/
|
||||
#define EDMA_TXDESC_CONS_IDX_MASK 0xffff
|
||||
|
||||
/*
|
||||
* EDMA_REG_TXDESC_RING_SIZE register
|
||||
*/
|
||||
#define EDMA_TXDESC_RING_SIZE_MASK 0xffff
|
||||
|
||||
/*
|
||||
* EDMA_REG_TXDESC_CTRL register
|
||||
*/
|
||||
#define EDMA_TXDESC_ARB_GRP_ID_MASK 0x3
|
||||
#define EDMA_TXDESC_ARB_GRP_ID_SHIFT 4
|
||||
#define EDMA_TXDESC_FC_GRP_ID_MASK 0x7
|
||||
#define EDMA_TXDESC_FC_GRP_ID_SHIFT 1
|
||||
#define EDMA_TXDESC_TX_EN 0x1
|
||||
|
||||
/*
|
||||
* EDMA_REG_TXCMPL_PROD_IDX register
|
||||
*/
|
||||
#define EDMA_TXCMPL_PROD_IDX_MASK 0xffff
|
||||
|
||||
/*
|
||||
* EDMA_REG_TXCMPL_CONS_IDX register
|
||||
*/
|
||||
#define EDMA_TXCMPL_CONS_IDX_MASK 0xffff
|
||||
|
||||
/*
|
||||
* EDMA_REG_TXCMPL_RING_SIZE register
|
||||
*/
|
||||
#define EDMA_TXCMPL_RING_SIZE_MASK 0xffff
|
||||
|
||||
/*
|
||||
* EDMA_REG_TXCMPL_UGT_THRE register
|
||||
*/
|
||||
#define EDMA_TXCMPL_LOW_THRE_MASK 0xffff
|
||||
#define EDMA_TXCMPL_LOW_THRE_SHIFT 0
|
||||
#define EDMA_TXCMPL_FC_THRE_MASK 0x3f
|
||||
#define EDMA_TXCMPL_FC_THRE_SHIFT 16
|
||||
|
||||
/*
|
||||
* EDMA_REG_TXCMPL_CTRL register
|
||||
*/
|
||||
#define EDMA_TXCMPL_RET_MODE_BUFF_ADDR 0x0
|
||||
#define EDMA_TXCMPL_RET_MODE_OPAQUE 0x1
|
||||
|
||||
/*
|
||||
* EDMA_REG_TX_MOD_TIMER register
|
||||
*/
|
||||
#define EDMA_TX_MOD_TIMER_INIT_MASK 0xffff
|
||||
#define EDMA_TX_MOD_TIMER_INIT_SHIFT 0
|
||||
|
||||
/*
|
||||
* EDMA_REG_TX_INT_CTRL register
|
||||
*/
|
||||
#define EDMA_TX_INT_MASK 0x3
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXFILL_PROD_IDX register
|
||||
*/
|
||||
#define EDMA_RXFILL_PROD_IDX_MASK 0xffff
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXFILL_CONS_IDX register
|
||||
*/
|
||||
#define EDMA_RXFILL_CONS_IDX_MASK 0xffff
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXFILL_RING_SIZE register
|
||||
*/
|
||||
#define EDMA_RXFILL_RING_SIZE_MASK 0xffff
|
||||
#define EDMA_RXFILL_BUF_SIZE_MASK 0x3fff
|
||||
#define EDMA_RXFILL_BUF_SIZE_SHIFT 16
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXFILL_FC_THRE register
|
||||
*/
|
||||
#define EDMA_RXFILL_FC_XON_THRE_MASK 0x7ff
|
||||
#define EDMA_RXFILL_FC_XON_THRE_SHIFT 12
|
||||
#define EDMA_RXFILL_FC_XOFF_THRE_MASK 0x7ff
|
||||
#define EDMA_RXFILL_FC_XOFF_THRE_SHIFT 0
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXFILL_UGT_THRE register
|
||||
*/
|
||||
#define EDMA_RXFILL_LOW_THRE_MASK 0xffff
|
||||
#define EDMA_RXFILL_LOW_THRE_SHIFT 0
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXFILL_RING_EN register
|
||||
*/
|
||||
#define EDMA_RXFILL_RING_EN 0x1
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXFILL_INT_MASK register
|
||||
*/
|
||||
#define EDMA_RXFILL_INT_MASK 0x1
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXDESC_PROD_IDX register
|
||||
*/
|
||||
#define EDMA_RXDESC_PROD_IDX_MASK 0xffff
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXDESC_CONS_IDX register
|
||||
*/
|
||||
#define EDMA_RXDESC_CONS_IDX_MASK 0xffff
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXDESC_RING_SIZE register
|
||||
*/
|
||||
#define EDMA_RXDESC_RING_SIZE_MASK 0xffff
|
||||
#define EDMA_RXDESC_PL_OFFSET_MASK 0x1ff
|
||||
#define EDMA_RXDESC_PL_OFFSET_SHIFT 16
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXDESC_FC_THRE register
|
||||
*/
|
||||
#define EDMA_RXDESC_FC_XON_THRE_MASK 0x7ff
|
||||
#define EDMA_RXDESC_FC_XON_THRE_SHIFT 12
|
||||
#define EDMA_RXDESC_FC_XOFF_THRE_MASK 0x7ff
|
||||
#define EDMA_RXDESC_FC_XOFF_THRE_SHIFT 0
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXDESC_UGT_THRE register
|
||||
*/
|
||||
#define EDMA_RXDESC_LOW_THRE_MASK 0xffff
|
||||
#define EDMA_RXDESC_LOW_THRE_SHIFT 0
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXDESC_CTRL register
|
||||
*/
|
||||
#define EDMA_RXDESC_STAG_REMOVE_EN 0x8
|
||||
#define EDMA_RXDESC_CTAG_REMOVE_EN 0x4
|
||||
#define EDMA_RXDESC_QDISC_EN 0x2
|
||||
#define EDMA_RXDESC_RX_EN 0x1
|
||||
|
||||
/*
|
||||
* EDMA_REG_TX_INT_MASK register
|
||||
*/
|
||||
#define EDMA_TX_INT_MASK_PKT_INT 0x1
|
||||
#define EDMA_TX_INT_MASK_UGT_INT 0x2
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXDESC_INT_STAT register
|
||||
*/
|
||||
#define EDMA_RXDESC_INT_STAT_PKT_INT 0x1
|
||||
#define EDMA_RXDESC_INT_STAT_UGT_INT 0x2
|
||||
|
||||
/*
|
||||
* EDMA_REG_RXDESC_INT_MASK register
|
||||
*/
|
||||
#define EDMA_RXDESC_INT_MASK_PKT_INT 0x1
|
||||
#define EDMA_RXDESC_INT_MASK_TIMER_INT_DIS 0x2
|
||||
|
||||
#define EDMA_MASK_INT_DISABLE 0x0
|
||||
#define EDMA_MASK_INT_CLEAR 0x0
|
||||
|
||||
/*
|
||||
* EDMA_REG_RX_MOD_TIMER register
|
||||
*/
|
||||
#define EDMA_RX_MOD_TIMER_INIT_MASK 0xffff
|
||||
#define EDMA_RX_MOD_TIMER_INIT_SHIFT 0
|
||||
|
||||
/*
|
||||
* EDMA QID2RID register sizes
|
||||
*/
|
||||
#define EDMA_QID2RID_DEPTH 0x40
|
||||
#define EDMA_QID2RID_QUEUES_PER_ENTRY 8
|
||||
|
||||
/*
|
||||
* TXDESC shift values
|
||||
*/
|
||||
#define EDMA_TXDESC_MORE_SHIFT 31
|
||||
#define EDMA_TXDESC_TSO_EN_SHIFT 30
|
||||
#define EDMA_TXDESC_PREHEADER_SHIFT 29
|
||||
#define EDMA_TXDESC_POOL_ID_SHIFT 24
|
||||
#define EDMA_TXDESC_POOL_ID_MASK 0x1f
|
||||
#define EDMA_TXDESC_DATA_OFFSET_SHIFT 16
|
||||
#define EDMA_TXDESC_DATA_OFFSET_MASK 0xff
|
||||
#define EDMA_TXDESC_DATA_LENGTH_SHIFT 0
|
||||
#define EDMA_TXDESC_DATA_LENGTH_MASK 0xffff
|
||||
|
||||
#define EDMA_PREHDR_DSTINFO_PORTID_IND 0x20
|
||||
#define EDMA_PREHDR_PORTNUM_BITS 0x0fff
|
||||
#define EDMA_RING_DMA_MASK 0xffffffff
|
||||
/*
|
||||
* RXDESC shift values
|
||||
*/
|
||||
#define EDMA_RXDESC_RX_RXFILL_CNT_MASK 0x000f
|
||||
#define EDMA_RXDESC_RX_RXFILL_CNT_SHIFT 16
|
||||
|
||||
#define EDMA_RXDESC_PKT_SIZE_MASK 0x3fff
|
||||
#define EDMA_RXDESC_PKT_SIZE_SHIFT 0
|
||||
|
||||
#define EDMA_RXDESC_RXD_VALID_MASK 0x1
|
||||
#define EDMA_RXDESC_RXD_VALID_SHIFT 31
|
||||
|
||||
#define EDMA_RXDESC_PACKET_LEN_MASK 0x3fff
|
||||
#define EDMA_RXDESC_RING_INT_STATUS_MASK 0x3
|
||||
|
||||
#define EDMA_RING_DISABLE 0
|
||||
#define EDMA_TXCMPL_RING_INT_STATUS_MASK 0x3
|
||||
#define EDMA_TXCMPL_RETMODE_OPAQUE 0x0
|
||||
#define EDMA_RXFILL_RING_INT_STATUS_MASK 0x1
|
||||
|
||||
/*
|
||||
* TODO tune the timer and threshold values
|
||||
*/
|
||||
#define EDMA_RXFILL_FIFO_XOFF_THRE 0x3
|
||||
#define EDMA_RXFILL_PF_THRE 0x3
|
||||
#define EDMA_RXDESC_WB_THRE 0x0
|
||||
#define EDMA_RXDESC_WB_TIMER 0x2
|
||||
|
||||
#define EDMA_RXDESC_XON_THRE 50
|
||||
#define EDMA_RXDESC_XOFF_THRE 30
|
||||
#define EDMA_RXDESC_LOW_THRE 0
|
||||
#define EDMA_RX_MOD_TIMER_INIT 1000
|
||||
|
||||
#define EDMA_TXDESC_PF_THRE 0x3
|
||||
#define EDMA_TXCMPL_WB_THRE 0X0
|
||||
#define EDMA_TXDESC_PKT_SRAM_THRE 0x20
|
||||
#define EDMA_TXCMPL_WB_TIMER 0x2
|
||||
|
||||
#define EDMA_TX_MOD_TIMER 150
|
||||
|
||||
/*
|
||||
* EDMA misc error mask
|
||||
*/
|
||||
#define EDMA_MISC_AXI_RD_ERR_MASK_EN 0x1
|
||||
#define EDMA_MISC_AXI_WR_ERR_MASK_EN 0x2
|
||||
#define EDMA_MISC_RX_DESC_FIFO_FULL_MASK_EN 0x4
|
||||
#define EDMA_MISC_RX_ERR_BUF_SIZE_MASK_EN 0x8
|
||||
#define EDMA_MISC_TX_SRAM_FULL_MASK_EN 0x10
|
||||
#define EDMA_MISC_TX_CMPL_BUF_FULL_MASK_EN 0x20
|
||||
|
||||
#if defined(NSS_DP_IPQ807X)
|
||||
#define EDMA_MISC_PKT_LEN_LA_64K_MASK_EN 0x40
|
||||
#define EDMA_MISC_PKT_LEN_LE_40_MASK_EN 0x80
|
||||
#define EDMA_MISC_DATA_LEN_ERR_MASK_EN 0x100
|
||||
#else
|
||||
#define EDMA_MISC_DATA_LEN_ERR_MASK_EN 0x40
|
||||
#define EDMA_MISC_TX_TIMEOUT_MASK_EN 0x80
|
||||
#endif
|
||||
|
||||
#endif /* __EDMA_REGS__ */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user