Update On Mon May 26 20:35:53 CEST 2025

This commit is contained in:
github-action[bot]
2025-05-26 20:35:54 +02:00
parent 8b9af21a0e
commit b4f16385aa
622 changed files with 78515 additions and 7999 deletions

1
.github/update.log vendored
View File

@@ -1010,3 +1010,4 @@ Update On Thu May 22 20:37:12 CEST 2025
Update On Fri May 23 20:34:50 CEST 2025
Update On Sat May 24 20:33:25 CEST 2025
Update On Sun May 25 20:34:05 CEST 2025
Update On Mon May 26 20:35:45 CEST 2025

View File

@@ -141,22 +141,19 @@ func handleUDPToLocal(writeBack C.WriteBack, pc N.EnhancePacketConn, sender C.Pa
} else if fromUDPAddr == nil {
fromUDPAddr = net.UDPAddrFromAddrPort(oAddrPort) // oAddrPort was Unmapped
log.Warnln("server return a nil *net.UDPAddr, force replace to (%s), this may be caused by a wrongly implemented server", oAddrPort)
} else {
_fromUDPAddr := *fromUDPAddr
fromUDPAddr = &_fromUDPAddr // make a copy
if fromAddr, ok := netip.AddrFromSlice(fromUDPAddr.IP); ok {
fromAddr = fromAddr.Unmap()
if fAddr.IsValid() && (oAddrPort.Addr() == fromAddr) { // oAddrPort was Unmapped
fromAddr = fAddr.Unmap()
}
fromUDPAddr.IP = fromAddr.AsSlice()
if fromAddr.Is4() {
fromUDPAddr.Zone = "" // only ipv6 can have the zone
}
}
}
_, err = writeBack.WriteBack(data, fromUDPAddr)
fromAddrPort := fromUDPAddr.AddrPort()
fromAddr := fromAddrPort.Addr().Unmap()
// restore fakeip
if fAddr.IsValid() && (oAddrPort.Addr() == fromAddr) { // oAddrPort was Unmapped
fromAddr = fAddr.Unmap()
}
fromAddrPort = netip.AddrPortFrom(fromAddr, fromAddrPort.Port())
_, err = writeBack.WriteBack(data, net.UDPAddrFromAddrPort(fromAddrPort))
if put != nil {
put()
}

View File

@@ -79,7 +79,7 @@
"clsx": "2.1.1",
"core-js": "3.42.0",
"filesize": "10.1.6",
"meta-json-schema": "1.19.5",
"meta-json-schema": "1.19.9",
"monaco-yaml": "5.4.0",
"nanoid": "5.1.5",
"sass-embedded": "1.88.0",

View File

@@ -2,10 +2,10 @@
"manifest_version": 1,
"latest": {
"mihomo": "v1.19.9",
"mihomo_alpha": "alpha-34de62d",
"mihomo_alpha": "alpha-88419cb",
"clash_rs": "v0.7.8",
"clash_premium": "2023-09-05-gdcc8d87",
"clash_rs_alpha": "0.7.8-alpha+sha.993dda8"
"clash_rs_alpha": "0.7.8-alpha+sha.f762b51"
},
"arch_template": {
"mihomo": {
@@ -69,5 +69,5 @@
"linux-armv7hf": "clash-armv7-unknown-linux-gnueabihf"
}
},
"updated_at": "2025-05-24T22:20:47.315Z"
"updated_at": "2025-05-25T22:20:58.736Z"
}

View File

@@ -83,11 +83,11 @@
"eslint-plugin-react": "7.37.5",
"eslint-plugin-react-compiler": "19.1.0-rc.2",
"eslint-plugin-react-hooks": "5.2.0",
"globals": "16.1.0",
"knip": "5.55.1",
"globals": "16.2.0",
"knip": "5.58.0",
"lint-staged": "16.0.0",
"neostandard": "0.12.1",
"npm-run-all2": "8.0.3",
"npm-run-all2": "8.0.4",
"postcss": "8.5.3",
"postcss-html": "1.8.0",
"postcss-import": "16.1.0",

View File

@@ -98,11 +98,11 @@ importers:
specifier: 5.2.0
version: 5.2.0(eslint@9.26.0(jiti@2.4.2))
globals:
specifier: 16.1.0
version: 16.1.0
specifier: 16.2.0
version: 16.2.0
knip:
specifier: 5.55.1
version: 5.55.1(@types/node@22.15.21)(typescript@5.8.3)
specifier: 5.58.0
version: 5.58.0(@types/node@22.15.21)(typescript@5.8.3)
lint-staged:
specifier: 16.0.0
version: 16.0.0
@@ -110,8 +110,8 @@ importers:
specifier: 0.12.1
version: 0.12.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.26.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.26.0(jiti@2.4.2)))(eslint@9.26.0(jiti@2.4.2))(typescript@5.8.3)
npm-run-all2:
specifier: 8.0.3
version: 8.0.3
specifier: 8.0.4
version: 8.0.4
postcss:
specifier: 8.5.3
version: 8.5.3
@@ -409,8 +409,8 @@ importers:
specifier: 10.1.6
version: 10.1.6
meta-json-schema:
specifier: 1.19.5
version: 1.19.5
specifier: 1.19.9
version: 1.19.9
monaco-yaml:
specifier: 5.4.0
version: 5.4.0(monaco-editor@0.52.2)
@@ -1351,6 +1351,15 @@ packages:
resolution: {integrity: sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ==}
engines: {node: '>=12'}
'@emnapi/core@1.4.3':
resolution: {integrity: sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g==}
'@emnapi/runtime@1.4.3':
resolution: {integrity: sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ==}
'@emnapi/wasi-threads@1.0.2':
resolution: {integrity: sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA==}
'@emotion/babel-plugin@11.13.5':
resolution: {integrity: sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ==}
@@ -1891,6 +1900,9 @@ packages:
peerDependencies:
react: ^17.0.0 || ^18.0.0 || ^19.0.0
'@napi-rs/wasm-runtime@0.2.10':
resolution: {integrity: sha512-bCsCyeZEwVErsGmyPNSzwfwFn4OdxBj0mmv6hOFucB/k81Ojdu68RbZdxYsRQUPc9l6SU5F/cG+bXgWs3oUgsQ==}
'@nodelib/fs.scandir@2.1.5':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@@ -2062,6 +2074,71 @@ packages:
resolution: {integrity: sha512-5Kva+/Gi7c+39d0/0MM/v/5RCZuwqm75fUD+t7Es3Iz/adui54GnjfNmJpkkPkXGC+5IWnEvgqwY6gstK/JlUQ==}
engines: {node: '>= 18'}
'@oxc-resolver/binding-darwin-arm64@9.0.2':
resolution: {integrity: sha512-MVyRgP2gzJJtAowjG/cHN3VQXwNLWnY+FpOEsyvDepJki1SdAX/8XDijM1yN6ESD1kr9uhBKjGelC6h3qtT+rA==}
cpu: [arm64]
os: [darwin]
'@oxc-resolver/binding-darwin-x64@9.0.2':
resolution: {integrity: sha512-7kV0EOFEZ3sk5Hjy4+bfA6XOQpCwbDiDkkHN4BHHyrBHsXxUR05EcEJPPL1WjItefg+9+8hrBmoK0xRoDs41+A==}
cpu: [x64]
os: [darwin]
'@oxc-resolver/binding-freebsd-x64@9.0.2':
resolution: {integrity: sha512-6OvkEtRXrt8sJ4aVfxHRikjain9nV1clIsWtJ1J3J8NG1ZhjyJFgT00SCvqxbK+pzeWJq6XzHyTCN78ML+lY2w==}
cpu: [x64]
os: [freebsd]
'@oxc-resolver/binding-linux-arm-gnueabihf@9.0.2':
resolution: {integrity: sha512-aYpNL6o5IRAUIdoweW21TyLt54Hy/ZS9tvzNzF6ya1ckOQ8DLaGVPjGpmzxdNja9j/bbV6aIzBH7lNcBtiOTkQ==}
cpu: [arm]
os: [linux]
'@oxc-resolver/binding-linux-arm64-gnu@9.0.2':
resolution: {integrity: sha512-RGFW4vCfKMFEIzb9VCY0oWyyY9tR1/o+wDdNePhiUXZU4SVniRPQaZ1SJ0sUFI1k25pXZmzQmIP6cBmazi/Dew==}
cpu: [arm64]
os: [linux]
'@oxc-resolver/binding-linux-arm64-musl@9.0.2':
resolution: {integrity: sha512-lxx/PibBfzqYvut2Y8N2D0Ritg9H8pKO+7NUSJb9YjR/bfk2KRmP8iaUz3zB0JhPtf/W3REs65oKpWxgflGToA==}
cpu: [arm64]
os: [linux]
'@oxc-resolver/binding-linux-riscv64-gnu@9.0.2':
resolution: {integrity: sha512-yD28ptS/OuNhwkpXRPNf+/FvrO7lwURLsEbRVcL1kIE0GxNJNMtKgIE4xQvtKDzkhk6ZRpLho5VSrkkF+3ARTQ==}
cpu: [riscv64]
os: [linux]
'@oxc-resolver/binding-linux-s390x-gnu@9.0.2':
resolution: {integrity: sha512-WBwEJdspoga2w+aly6JVZeHnxuPVuztw3fPfWrei2P6rNM5hcKxBGWKKT6zO1fPMCB4sdDkFohGKkMHVV1eryQ==}
cpu: [s390x]
os: [linux]
'@oxc-resolver/binding-linux-x64-gnu@9.0.2':
resolution: {integrity: sha512-a2z3/cbOOTUq0UTBG8f3EO/usFcdwwXnCejfXv42HmV/G8GjrT4fp5+5mVDoMByH3Ce3iVPxj1LmS6OvItKMYQ==}
cpu: [x64]
os: [linux]
'@oxc-resolver/binding-linux-x64-musl@9.0.2':
resolution: {integrity: sha512-bHZF+WShYQWpuswB9fyxcgMIWVk4sZQT0wnwpnZgQuvGTZLkYJ1JTCXJMtaX5mIFHf69ngvawnwPIUA4Feil0g==}
cpu: [x64]
os: [linux]
'@oxc-resolver/binding-wasm32-wasi@9.0.2':
resolution: {integrity: sha512-I5cSgCCh5nFozGSHz+PjIOfrqW99eUszlxKLgoNNzQ1xQ2ou9ZJGzcZ94BHsM9SpyYHLtgHljmOZxCT9bgxYNA==}
engines: {node: '>=14.0.0'}
cpu: [wasm32]
'@oxc-resolver/binding-win32-arm64-msvc@9.0.2':
resolution: {integrity: sha512-5IhoOpPr38YWDWRCA5kP30xlUxbIJyLAEsAK7EMyUgqygBHEYLkElaKGgS0X5jRXUQ6l5yNxuW73caogb2FYaw==}
cpu: [arm64]
os: [win32]
'@oxc-resolver/binding-win32-x64-msvc@9.0.2':
resolution: {integrity: sha512-Qc40GDkaad9rZksSQr2l/V9UubigIHsW69g94Gswc2sKYB3XfJXfIfyV8WTJ67u6ZMXsZ7BH1msSC6Aen75mCg==}
cpu: [x64]
os: [win32]
'@parcel/watcher-android-arm64@2.4.1':
resolution: {integrity: sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==}
engines: {node: '>= 10.0.0'}
@@ -2908,6 +2985,9 @@ packages:
'@vue/compiler-sfc':
optional: true
'@tybys/wasm-util@0.9.0':
resolution: {integrity: sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==}
'@types/adm-zip@0.5.7':
resolution: {integrity: sha512-DNEs/QvmyRLurdQPChqq0Md4zGvPwHerAJYWk9l2jCbD1VPpnzRJorOdiq4zsw09NFbYnhfsoEhWtxIzXpn2yw==}
@@ -4942,8 +5022,8 @@ packages:
resolution: {integrity: sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==}
engines: {node: '>=18'}
globals@16.1.0:
resolution: {integrity: sha512-aibexHNbb/jiUSObBgpHLj+sIuUmJnYcgXBlrfsiDZ9rt4aF2TFRbyLgZ2iFQuVZ1K5Mx3FVkbKRSgKrbK3K2g==}
globals@16.2.0:
resolution: {integrity: sha512-O+7l9tPdHCU320IigZZPj5zmRCFG9xHmx9cU8FqU2Rp+JN714seHV+2S9+JslCpY4gJwU2vOGox0wzgae/MCEg==}
engines: {node: '>=18'}
globalthis@1.0.4:
@@ -5620,8 +5700,8 @@ packages:
resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==}
engines: {node: '>=0.10.0'}
knip@5.55.1:
resolution: {integrity: sha512-NYXjgGrXgMdabUKCP2TlBH/e83m9KnLc1VLyWHUtoRrCEJ/C15YtbafrpTvm3td+jE4VdDPgudvXT1IMtCx8lw==}
knip@5.58.0:
resolution: {integrity: sha512-U3+ADL9mylwia7bU85CYeHSdMI7DIpaCzH37NZ8rru/dgq56iyiS0oTELhfNaCYu+TcRyuijU2YQf9o0zUGA5w==}
engines: {node: '>=18.18.0'}
hasBin: true
peerDependencies:
@@ -5910,8 +5990,8 @@ packages:
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
engines: {node: '>= 8'}
meta-json-schema@1.19.5:
resolution: {integrity: sha512-hjI5avhH265Ef8l2szO+XjxmjSaJSP501wdKFxxz11lYXTWbnMASoYx39Adm0/1B76VEKgBIAguDKawsq8Q9Uw==}
meta-json-schema@1.19.9:
resolution: {integrity: sha512-0jPPlfTvzgJe7zexTegoB+YtczytkhpU7mbJJQmCEHOaceShCKaxvyM5JTt+6pEW780nVVv2OmorzsDex5gFFw==}
engines: {node: '>=18', pnpm: '>=9'}
micromark-core-commonmark@2.0.1:
@@ -6015,10 +6095,6 @@ packages:
resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
engines: {node: '>=10'}
minimatch@10.0.1:
resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==}
engines: {node: 20 || >=22}
minimatch@3.0.8:
resolution: {integrity: sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==}
@@ -6192,8 +6268,8 @@ packages:
resolution: {integrity: sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w==}
engines: {node: ^18.17.0 || >=20.5.0}
npm-run-all2@8.0.3:
resolution: {integrity: sha512-0mAycidMUMThrLt8AT3LGtOMgfLaMg6/4oUKHTKMU0jDSIsdKBsKp98H8zBFcJylQC4CtOB140UUFbOlFyE9gA==}
npm-run-all2@8.0.4:
resolution: {integrity: sha512-wdbB5My48XKp2ZfJUlhnLVihzeuA1hgBnqB2J9ahV77wLS+/YAJAlN8I+X3DIFIPZ3m5L7nplmlbhNiFDmXRDA==}
engines: {node: ^20.5.0 || >=22.0.0, npm: '>= 10'}
hasBin: true
@@ -6285,6 +6361,9 @@ packages:
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'}
oxc-resolver@9.0.2:
resolution: {integrity: sha512-w838ygc1p7rF+7+h5vR9A+Y9Fc4imy6C3xPthCMkdFUgFvUWkmABeNB8RBDQ6+afk44Q60/UMMQ+gfDUW99fBA==}
p-cancelable@2.1.1:
resolution: {integrity: sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==}
engines: {node: '>=8'}
@@ -9222,6 +9301,22 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@emnapi/core@1.4.3':
dependencies:
'@emnapi/wasi-threads': 1.0.2
tslib: 2.8.1
optional: true
'@emnapi/runtime@1.4.3':
dependencies:
tslib: 2.8.1
optional: true
'@emnapi/wasi-threads@1.0.2':
dependencies:
tslib: 2.8.1
optional: true
'@emotion/babel-plugin@11.13.5':
dependencies:
'@babel/helper-module-imports': 7.25.9
@@ -9735,6 +9830,13 @@ snapshots:
transitivePeerDependencies:
- '@types/react'
'@napi-rs/wasm-runtime@0.2.10':
dependencies:
'@emnapi/core': 1.4.3
'@emnapi/runtime': 1.4.3
'@tybys/wasm-util': 0.9.0
optional: true
'@nodelib/fs.scandir@2.1.5':
dependencies:
'@nodelib/fs.stat': 2.0.5
@@ -9954,6 +10056,47 @@ snapshots:
'@octokit/request-error': 6.1.8
'@octokit/webhooks-methods': 5.1.1
'@oxc-resolver/binding-darwin-arm64@9.0.2':
optional: true
'@oxc-resolver/binding-darwin-x64@9.0.2':
optional: true
'@oxc-resolver/binding-freebsd-x64@9.0.2':
optional: true
'@oxc-resolver/binding-linux-arm-gnueabihf@9.0.2':
optional: true
'@oxc-resolver/binding-linux-arm64-gnu@9.0.2':
optional: true
'@oxc-resolver/binding-linux-arm64-musl@9.0.2':
optional: true
'@oxc-resolver/binding-linux-riscv64-gnu@9.0.2':
optional: true
'@oxc-resolver/binding-linux-s390x-gnu@9.0.2':
optional: true
'@oxc-resolver/binding-linux-x64-gnu@9.0.2':
optional: true
'@oxc-resolver/binding-linux-x64-musl@9.0.2':
optional: true
'@oxc-resolver/binding-wasm32-wasi@9.0.2':
dependencies:
'@napi-rs/wasm-runtime': 0.2.10
optional: true
'@oxc-resolver/binding-win32-arm64-msvc@9.0.2':
optional: true
'@oxc-resolver/binding-win32-x64-msvc@9.0.2':
optional: true
'@parcel/watcher-android-arm64@2.4.1':
optional: true
@@ -10694,6 +10837,11 @@ snapshots:
- supports-color
optional: true
'@tybys/wasm-util@0.9.0':
dependencies:
tslib: 2.8.1
optional: true
'@types/adm-zip@0.5.7':
dependencies:
'@types/node': 22.15.3
@@ -13177,7 +13325,7 @@ snapshots:
globals@15.15.0: {}
globals@16.1.0: {}
globals@16.2.0: {}
globalthis@1.0.4:
dependencies:
@@ -13836,16 +13984,16 @@ snapshots:
kind-of@6.0.3: {}
knip@5.55.1(@types/node@22.15.21)(typescript@5.8.3):
knip@5.58.0(@types/node@22.15.21)(typescript@5.8.3):
dependencies:
'@nodelib/fs.walk': 1.2.8
'@types/node': 22.15.21
enhanced-resolve: 5.18.1
fast-glob: 3.3.3
formatly: 0.2.3
jiti: 2.4.2
js-yaml: 4.1.0
minimist: 1.2.8
oxc-resolver: 9.0.2
picocolors: 1.1.1
picomatch: 4.0.2
smol-toml: 1.3.1
@@ -14174,7 +14322,7 @@ snapshots:
merge2@1.4.1: {}
meta-json-schema@1.19.5: {}
meta-json-schema@1.19.9: {}
micromark-core-commonmark@2.0.1:
dependencies:
@@ -14333,10 +14481,6 @@ snapshots:
mimic-response@3.1.0: {}
minimatch@10.0.1:
dependencies:
brace-expansion: 2.0.1
minimatch@3.0.8:
dependencies:
brace-expansion: 1.1.11
@@ -14516,12 +14660,12 @@ snapshots:
npm-normalize-package-bin@4.0.0: {}
npm-run-all2@8.0.3:
npm-run-all2@8.0.4:
dependencies:
ansi-styles: 6.2.1
cross-spawn: 7.0.6
memorystream: 0.3.1
minimatch: 10.0.1
picomatch: 4.0.2
pidtree: 0.6.0
read-package-json-fast: 4.0.0
shell-quote: 1.8.1
@@ -14653,6 +14797,22 @@ snapshots:
type-check: 0.4.0
word-wrap: 1.2.5
oxc-resolver@9.0.2:
optionalDependencies:
'@oxc-resolver/binding-darwin-arm64': 9.0.2
'@oxc-resolver/binding-darwin-x64': 9.0.2
'@oxc-resolver/binding-freebsd-x64': 9.0.2
'@oxc-resolver/binding-linux-arm-gnueabihf': 9.0.2
'@oxc-resolver/binding-linux-arm64-gnu': 9.0.2
'@oxc-resolver/binding-linux-arm64-musl': 9.0.2
'@oxc-resolver/binding-linux-riscv64-gnu': 9.0.2
'@oxc-resolver/binding-linux-s390x-gnu': 9.0.2
'@oxc-resolver/binding-linux-x64-gnu': 9.0.2
'@oxc-resolver/binding-linux-x64-musl': 9.0.2
'@oxc-resolver/binding-wasm32-wasi': 9.0.2
'@oxc-resolver/binding-win32-arm64-msvc': 9.0.2
'@oxc-resolver/binding-win32-x64-msvc': 9.0.2
p-cancelable@2.1.1: {}
p-event@4.2.0:

View File

@@ -6979,8 +6979,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-autostart"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c58593aafcb03892dbf9998b35a96ead3b8e597435c7af46aff1654d076d5d03"
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#9bc4b2230ebb32bd30a4c0c2a21077829a729193"
dependencies = [
"auto-launch",
"serde",

View File

@@ -85,13 +85,21 @@ hex = "0.4.3"
runas = "=1.2.0"
deelevate = "0.2.0"
winreg = "0.55.0"
winapi = { version = "0.3", features = ["winbase", "fileapi", "winnt", "handleapi", "errhandlingapi", "minwindef", "winerror"] }
winapi = { version = "0.3", features = [
"winbase",
"fileapi",
"winnt",
"handleapi",
"errhandlingapi",
"minwindef",
"winerror",
] }
[target.'cfg(target_os = "linux")'.dependencies]
users = "0.11.0"
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-autostart = "2.3.0"
tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
tauri-plugin-global-shortcut = "2.2.0"
tauri-plugin-updater = "2.7.1"

View File

@@ -2,8 +2,10 @@ use super::CmdResult;
use crate::module::mihomo::MihomoManager;
use once_cell::sync::Lazy;
use parking_lot::Mutex;
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::{Duration, Instant};
use std::{
sync::atomic::{AtomicBool, Ordering},
time::{Duration, Instant},
};
static LAST_REFRESH_TIME: Lazy<Mutex<Option<Instant>>> = Lazy::new(|| Mutex::new(None));
static IS_REFRESHING: AtomicBool = AtomicBool::new(false);

View File

@@ -715,8 +715,8 @@ pub async fn check_service_needs_reinstall() -> bool {
logging!(error, Type::Service, true, "检查服务版本失败: {}", err);
// 检查服务是否可用
match is_service_running().await {
Ok(true) => {
match is_service_available().await {
Ok(()) => {
log::info!(target: "app", "服务正在运行但版本检查失败: {}", err);
/* logging!(
info,
@@ -846,7 +846,7 @@ pub(super) async fn run_core_by_service(config_file: &PathBuf) -> Result<()> {
};
if version_check {
if let Ok(true) = is_service_running().await {
if is_service_available().await.is_ok() {
log::info!(target: "app", "服务已在运行且版本匹配,尝试使用");
return start_with_existing_service(config_file).await;
}
@@ -947,14 +947,14 @@ pub(super) async fn stop_core_by_service() -> Result<()> {
}
/// 检查服务是否正在运行
pub async fn is_service_running() -> Result<bool> {
pub async fn is_service_available() -> Result<()> {
logging!(info, Type::Service, true, "开始检查服务是否正在运行");
match check_ipc_service_status().await {
Ok(resp) => {
if resp.code == 0 && resp.msg == "ok" && resp.data.is_some() {
logging!(info, Type::Service, true, "服务正在运行");
Ok(true)
Ok(())
} else {
logging!(
warn,
@@ -964,74 +964,12 @@ pub async fn is_service_running() -> Result<bool> {
resp.code,
resp.msg
);
Ok(false)
Ok(())
}
}
Err(err) => {
logging!(error, Type::Service, true, "检查服务运行状态失败: {}", err);
/*
let error_type = err.root_cause().to_string();
logging!(
error,
Type::Service,
true,
"连接失败的根本原因: {}",
error_type
);
let socket_path = if cfg!(windows) {
r"\\.\pipe\clash-verge-service"
} else {
"/tmp/clash-verge-service.sock"
};
if cfg!(windows) {
logging!(
info,
Type::Service,
true,
"检查Windows命名管道: {}",
socket_path
);
} else {
let socket_exists = std::path::Path::new(socket_path).exists();
logging!(
info,
Type::Service,
true,
"检查Unix套接字文件: {} 是否存在: {}",
socket_path,
socket_exists
);
}
*/
Ok(false)
}
}
}
pub async fn is_service_available() -> Result<()> {
logging!(info, Type::Service, true, "开始检查服务是否可用");
match check_ipc_service_status().await {
Ok(resp) => {
if resp.code == 0 && resp.msg == "ok" && resp.data.is_some() {
logging!(info, Type::Service, true, "服务可用");
} else {
logging!(
warn,
Type::Service,
true,
"服务返回异常: code={}, msg={}",
resp.code,
resp.msg
);
}
Ok(())
}
Err(err) => {
logging!(error, Type::Service, true, "服务不可用: {}", err);
bail!("服务不可用: {}", err)
Err(err)
}
}
}

View File

@@ -23,11 +23,13 @@ use parking_lot::Mutex;
use parking_lot::RwLock;
#[cfg(target_os = "macos")]
pub use speed_rate::{SpeedRate, Traffic};
use std::fs;
use std::sync::atomic::{AtomicBool, Ordering};
#[cfg(target_os = "macos")]
use std::sync::Arc;
use std::time::{Duration, Instant};
use std::{
fs,
sync::atomic::{AtomicBool, Ordering},
time::{Duration, Instant},
};
use tauri::{
menu::{CheckMenuItem, IsMenuItem, MenuEvent, MenuItem, PredefinedMenuItem, Submenu},
tray::{MouseButton, MouseButtonState, TrayIconEvent},

View File

@@ -123,12 +123,9 @@ pub fn run() {
#[cfg(debug_assertions)]
let devtools = tauri_plugin_devtools::init();
#[allow(unused_mut)]
let mut builder = tauri::Builder::default()
.plugin(tauri_plugin_autostart::init(
MacosLauncher::LaunchAgent,
None,
))
.plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_clipboard_manager::init())
.plugin(tauri_plugin_process::init())
@@ -139,12 +136,22 @@ pub fn run() {
.plugin(tauri_plugin_deep_link::init())
.setup(|app| {
logging!(info, Type::Setup, true, "开始应用初始化...");
let mut auto_start_plugin_builder = tauri_plugin_autostart::Builder::new();
#[cfg(target_os = "macos")]
{
auto_start_plugin_builder = auto_start_plugin_builder
.macos_launcher(MacosLauncher::LaunchAgent)
.app_name(app.config().identifier.clone());
}
let _ = app.handle().plugin(auto_start_plugin_builder.build());
#[cfg(any(target_os = "linux", all(debug_assertions, windows)))]
{
use tauri_plugin_deep_link::DeepLinkExt;
logging!(info, Type::Setup, true, "注册深层链接...");
logging_error!(Type::System, true, app.deep_link().register_all());
}
app.deep_link().on_open_url(|event| {
AsyncHandler::spawn(move || {
let url = event.urls().first().map(|u| u.to_string());

View File

@@ -20,7 +20,7 @@ import {
import { useVerge } from "@/hooks/use-verge";
import { useSystemState } from "@/hooks/use-system-state";
import { showNotice } from "@/services/noticeService";
import { isServiceAvailable } from "@/services/cmds";
import { getRunningMode } from "@/services/cmds";
import { mutate } from "swr";
const LOCAL_STORAGE_TAB_KEY = "clash-verge-proxy-active-tab";
@@ -150,7 +150,8 @@ export const ProxyTunCard: FC = () => {
const updateLocalStatus = async () => {
try {
const serviceStatus = await isServiceAvailable();
const runningMode = await getRunningMode();
const serviceStatus = runningMode === "Service";
setLocalServiceOk(serviceStatus);
mutate("isServiceAvailable", serviceStatus, false);
} catch (error) {
@@ -165,7 +166,7 @@ export const ProxyTunCard: FC = () => {
const isTunAvailable = localServiceOk || isAdminMode;
const handleError = (err: Error) => {
showNotice('error', err.message || err.toString());
showNotice("error", err.message || err.toString());
};
const handleTabChange = (tab: string) => {

View File

@@ -23,7 +23,6 @@ import {
uninstallService,
restartCore,
stopCore,
isServiceAvailable,
} from "@/services/cmds";
import { useLockFn } from "ahooks";
import { Button, Tooltip } from "@mui/material";
@@ -45,16 +44,10 @@ const SettingSystem = ({ onError }: Props) => {
const { data: sysproxy } = useSWR("getSystemProxy", getSystemProxy);
const { data: autoproxy } = useSWR("getAutotemProxy", getAutotemProxy);
const { data: serviceOk, mutate: mutateServiceAvailable } = useSWR(
"isServiceAvailable",
isServiceAvailable
);
const { isAdminMode, isServiceMode, mutateRunningMode } = useSystemState();
const { isAdminMode, isSidecarMode, mutateRunningMode } = useSystemState();
// +++ isTunAvailable 现在使用 SWR 的 serviceOk
const isTunAvailable = serviceOk || isAdminMode;
// +++ isTunAvailable 现在使用 SWR 的 isServiceMode
const isTunAvailable = isServiceMode || isAdminMode;
const sysproxyRef = useRef<DialogRef>(null);
const tunRef = useRef<DialogRef>(null);
@@ -80,19 +73,17 @@ const SettingSystem = ({ onError }: Props) => {
// 抽象服务操作逻辑
const handleServiceOperation = useLockFn(
async (
{
beforeMsg,
action,
actionMsg,
successMsg,
}: {
beforeMsg: string;
action: () => Promise<void>;
actionMsg: string;
successMsg: string;
}
) => {
async ({
beforeMsg,
action,
actionMsg,
successMsg,
}: {
beforeMsg: string;
action: () => Promise<void>;
actionMsg: string;
successMsg: string;
}) => {
try {
showNotice("info", beforeMsg);
await stopCore();
@@ -102,19 +93,17 @@ const SettingSystem = ({ onError }: Props) => {
showNotice("info", t("Restarting Core..."));
await restartCore();
await mutateRunningMode();
await mutateServiceAvailable();
} catch (err: any) {
showNotice("error", err.message || err.toString());
try {
showNotice("info", t("Try running core as Sidecar..."));
await restartCore();
await mutateRunningMode();
await mutateServiceAvailable();
} catch (e: any) {
showNotice("error", e?.message || e?.toString());
}
}
}
},
);
// 卸载系统服务
@@ -145,7 +134,7 @@ const SettingSystem = ({ onError }: Props) => {
<WarningRounded sx={{ color: "warning.main", mr: 1 }} />
</Tooltip>
)}
{!serviceOk && !isAdminMode && (
{!isServiceMode && !isAdminMode && (
<Tooltip title={t("Install Service")}>
<Button
variant="outlined"
@@ -158,20 +147,19 @@ const SettingSystem = ({ onError }: Props) => {
</Button>
</Tooltip>
)}
{serviceOk && (
<Tooltip title={t("Uninstall Service")}>
<Button
// variant="outlined"
color="secondary"
size="small"
onClick={onUninstallService}
sx={{ mr: 1, minWidth: "32px", p: "4px" }}
>
{isServiceMode && (
<Tooltip title={t("Uninstall Service")}>
<Button
// variant="outlined"
color="secondary"
size="small"
onClick={onUninstallService}
sx={{ mr: 1, minWidth: "32px", p: "4px" }}
>
<DeleteForeverRounded fontSize="small" />
</Button>
</Tooltip>
)
}
</Button>
</Tooltip>
)}
</>
}
>
@@ -187,7 +175,9 @@ const SettingSystem = ({ onError }: Props) => {
onGuard={(e) => {
if (!isTunAvailable) {
showNotice("error", t("TUN requires Service Mode or Admin Mode"));
return Promise.reject(new Error(t("TUN requires Service Mode or Admin Mode")));
return Promise.reject(
new Error(t("TUN requires Service Mode or Admin Mode")),
);
}
return patchVerge({ enable_tun_mode: e });
}}

View File

@@ -23,12 +23,14 @@ export function useSystemState() {
});
// 获取系统服务状态
const isServiceMode = runningMode === "Service";
const { data: isServiceOk = false } = useSWR(
"isServiceAvailable",
isServiceAvailable,
{
suspense: false,
revalidateOnFocus: false,
isPaused: () => !isServiceMode, // 仅在 Service 模式下请求
},
);
@@ -36,7 +38,8 @@ export function useSystemState() {
runningMode,
isAdminMode,
isSidecarMode: runningMode === "Sidecar",
mutateRunningMode,
isServiceMode: runningMode === "Service",
isServiceOk,
mutateRunningMode,
};
}

View File

@@ -422,9 +422,10 @@ $(eval $(call KernelPackage,phy-micrel))
define KernelPackage/phy-realtek
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Realtek Ethernet PHY driver
KCONFIG:=CONFIG_REALTEK_PHY
DEPENDS:=+kmod-libphy
FILES:=$(LINUX_DIR)/drivers/net/phy/realtek.ko
KCONFIG:=CONFIG_REALTEK_PHY \
CONFIG_REALTEK_PHY_HWMON=y
DEPENDS:=+kmod-libphy +kmod-hwmon-core
FILES:=$(LINUX_DIR)/drivers/net/phy/realtek/realtek.ko
AUTOLOAD:=$(call AutoLoad,18,realtek,1)
endef

View File

@@ -0,0 +1,49 @@
--- a/drivers/net/wireless/ath/ath11k/mhi.c
+++ b/drivers/net/wireless/ath/ath11k/mhi.c
@@ -343,8 +343,10 @@
return "MHI_CB_FATAL_ERROR";
case MHI_CB_BW_REQ:
return "MHI_CB_BW_REQ";
+#if LINUX_VERSION_IS_LESS(6,11,0)
case MHI_CB_EE_SBL_MODE:
return "MHI_CB_EE_SBL_MODE";
+#endif
default:
return "UNKNOWN";
}
@@ -367,9 +369,11 @@
if (!(test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags)))
queue_work(ab->workqueue_aux, &ab->reset_work);
break;
+#if LINUX_VERSION_IS_LESS(6,11,0)
case MHI_CB_EE_SBL_MODE:
ath11k_mhi_qrtr_instance_set(mhi_cntrl);
break;
+#endif
default:
break;
}
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -1269,7 +1269,11 @@
platform_set_drvdata(pdev, NULL);
}
+#if LINUX_VERSION_IS_LESS(6,11,0)
static int ath11k_ahb_remove(struct platform_device *pdev)
+#else
+static void ath11k_ahb_remove(struct platform_device *pdev)
+#endif
{
struct ath11k_base *ab = platform_get_drvdata(pdev);
@@ -1286,7 +1290,9 @@
qmi_fail:
ath11k_ahb_free_resources(ab);
+#if LINUX_VERSION_IS_LESS(6,11,0)
return 0;
+#endif
}
static void ath11k_ahb_shutdown(struct platform_device *pdev)

View File

@@ -4,10 +4,10 @@ PKG_NAME:=qca-nss-clients
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2023-10-04
PKG_SOURCE_DATE:=2024-09-11
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-clients.git
PKG_SOURCE_VERSION:=f058ae199b42f30be9925b2ed1ce53afb128200c
PKG_MIRROR_HASH:=90401b577a7750d3b7eadb423700aab7e1da1af392637598e08f6007f23a92e1
PKG_SOURCE_VERSION:=51be82d43ef85079f78aa163d014223b05baa6a2
PKG_MIRROR_HASH:=c65f5602ddb960c1f6dd9382a9560db2525c382227e0efee1b7322f17da06988
PKG_BUILD_PARALLEL:=1
@@ -20,9 +20,14 @@ ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq807x")
else ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq60xx")
SOC="ipq60xx_64"
subtarget:=$(CONFIG_TARGET_SUBTARGET)
else ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq50xx")
SOC="ipq50xx_64"
subtarget:=$(CONFIG_TARGET_SUBTARGET)
else
SOC=$(CONFIG_TARGET_BOARD)
endif
ifneq (, $(findstring $(subtarget), "ipq807x" "ipq60xx"))
ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_64" "ipq60xx" "ipq60xx_64" "ipq50xx" "ipq50xx_64"))
DTLSMGR_DIR:=v2.0
IPSECMGR_DIR:=v2.0
IPSECMGR_KLIPS:= $(PKG_BUILD_DIR)/ipsecmgr/$(IPSECMGR_DIR)/plugins/klips/qca-nss-ipsec-klips.ko
@@ -580,7 +585,7 @@ define Build/Compile
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS) -Wno-missing-declarations -Wno-missing-prototypes -Wno-enum-conversion -Wno-empty-body -Wno-unused-variable -Wno-int-conversion" \
DTLSMGR_DIR="$(DTLSMGR_DIR)" \
IPSECMGR_DIR="$(IPSECMGR_DIR)" \
SoC=$(SOC) \

View File

@@ -128,15 +128,6 @@
#endif
if ((status == TC_ACT_STOLEN) || (status == TC_ACT_QUEUED)) {
return 1;
@@ -2188,6 +2189,8 @@ int __nss_qdisc_init(struct Qdisc *sch,
* This is to prevent mixing NSS and PPE qdisc with linux qdisc.
*/
if ((parent != TC_H_ROOT) && (root->ops->owner != THIS_MODULE)) {
+ nss_qdisc_warning("parent (%d) and TC_H_ROOT (%d))", parent, TC_H_ROOT);
+ nss_qdisc_warning("root->ops->owner (%px) and THIS_MODULE (%px))", root->ops->owner , THIS_MODULE);
nss_qdisc_warning("NSS qdisc %px (type %d) used along with non-nss qdiscs,"
" or the interface is currently down", nq->qdisc, nq->type);
}
--- a/nss_qdisc/nss_wrr.c
+++ b/nss_qdisc/nss_wrr.c
@@ -229,7 +229,7 @@ static int nss_wrr_ppe_change_class(stru

View File

@@ -1,6 +1,6 @@
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -800,8 +800,10 @@ static struct nss_vlan_pvt *nss_vlan_mgr
@@ -688,8 +688,10 @@ detach_vsi:
*/
static void nss_vlan_mgr_instance_free(struct nss_vlan_pvt *v)
{
@@ -9,9 +9,9 @@
int ret = 0;
+#endif
spin_lock(&vlan_mgr_ctx.lock);
BUG_ON(--v->refs);
@@ -961,8 +963,11 @@ static int nss_vlan_mgr_register_event(s
#ifdef NSS_VLAN_MGR_PPE_SUPPORT
if (v->ppe_vsi) {
@@ -999,8 +1001,11 @@ static int nss_vlan_mgr_register_event(s
int ret;
#endif
uint32_t vlan_tag;
@@ -24,7 +24,7 @@
struct vlan_dev_priv *vlan;
struct net_device *real_dev;
bool is_bond_master = false;
@@ -1355,8 +1360,10 @@ return_with_error:
@@ -1393,8 +1398,10 @@ return_with_error:
int nss_vlan_mgr_join_bridge(struct net_device *dev, uint32_t bridge_vsi)
{
struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev);
@@ -35,7 +35,7 @@
if (!v)
return 0;
@@ -1416,8 +1423,10 @@ EXPORT_SYMBOL(nss_vlan_mgr_join_bridge);
@@ -1454,8 +1461,10 @@ EXPORT_SYMBOL(nss_vlan_mgr_join_bridge);
int nss_vlan_mgr_leave_bridge(struct net_device *dev, uint32_t bridge_vsi)
{
struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev);

View File

@@ -1,17 +0,0 @@
--- a/gre/nss_connmgr_gre_v4.c
+++ b/gre/nss_connmgr_gre_v4.c
@@ -172,14 +172,6 @@ int nss_connmgr_gre_v4_set_config(struct
}
}
- /*
- * IP address validate
- */
- if ((cfg->src_ip == 0) || (cfg->dest_ip == 0)) {
- nss_connmgr_gre_warning("Source ip/Destination IP is invalid");
- return GRE_ERR_INVALID_IP;
- }
-
memset(t, 0, sizeof(struct ip_tunnel));
priv->pad_len = (cfg->add_padding) ? GRE_HDR_PAD_LEN : 0;

View File

@@ -1,34 +1,3 @@
--- a/bridge/nss_bridge_mgr.c
+++ b/bridge/nss_bridge_mgr.c
@@ -1081,7 +1081,7 @@ int nss_bridge_mgr_register_br(struct ne
}
#endif
- err = nss_bridge_tx_set_mac_addr_msg(ifnum, dev->dev_addr);
+ err = nss_bridge_tx_set_mac_addr_msg(ifnum, (uint8_t *) dev->dev_addr);
if (err != NSS_TX_SUCCESS) {
nss_bridge_mgr_warn("%px: failed to set mac_addr msg, error = %d\n", b_pvt, err);
goto fail_4;
@@ -1242,7 +1242,7 @@ static int nss_bridge_mgr_changeaddr_eve
nss_bridge_mgr_trace("%px: MAC changed to %pM, update NSS\n", b_pvt, dev->dev_addr);
- if (nss_bridge_tx_set_mac_addr_msg(b_pvt->ifnum, dev->dev_addr) != NSS_TX_SUCCESS) {
+ if (nss_bridge_tx_set_mac_addr_msg(b_pvt->ifnum, (uint8_t *) dev->dev_addr) != NSS_TX_SUCCESS) {
nss_bridge_mgr_warn("%px: Failed to send change MAC address message to NSS\n", b_pvt);
return NOTIFY_DONE;
}
--- a/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
+++ b/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
@@ -532,7 +532,7 @@ void nss_dtlsmgr_ctx_dev_setup(struct ne
#else
dev->priv_destructor = nss_dtlsmgr_ctx_dev_free;
#endif
- memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len);
+ memcpy((void *) dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
}
--- a/gre/test/nss_connmgr_gre_test.c
+++ b/gre/test/nss_connmgr_gre_test.c
@@ -223,7 +223,7 @@ static int nss_connmgr_gre_test_show_pro
@@ -131,15 +100,24 @@
- stats.rx_packets = stats.tx_packets = node_stats->tx_packets;
- stats.rx_bytes = stats.tx_bytes = node_stats->tx_bytes;
+ u64_stats_set(&stats.rx_packets, node_stats->tx_packets);
+ u64_stats_set(&stats.tx_packets, node_stats->tx_packets);
+ u64_stats_set(&stats.tx_packets, node_stats->tx_packets);
+ u64_stats_set(&stats.rx_bytes, node_stats->tx_bytes);
+ u64_stats_set(&stats.tx_bytes, node_stats->tx_bytes);
+ u64_stats_set(&stats.tx_bytes, node_stats->tx_bytes);
dev->stats.rx_dropped = dev->stats.tx_dropped += sync_stats->igs_stats.tx_dropped;
u64_stats_update_end(&stats.syncp);
--- a/nss_qdisc/nss_qdisc.c
+++ b/nss_qdisc/nss_qdisc.c
@@ -2608,12 +2608,14 @@ int nss_qdisc_init(struct Qdisc *sch, st
@@ -2189,7 +2189,7 @@ int __nss_qdisc_init(struct Qdisc *sch,
* This is to prevent mixing NSS and PPE qdisc with linux qdisc.
*/
if ((parent != TC_H_ROOT) && (root->ops->owner != THIS_MODULE)) {
- nss_qdisc_warning("NSS qdisc %px (type %d) used along with non-nss qdiscs,"
+ nss_qdisc_info("NSS qdisc %px (type %d) used along with non-nss qdiscs,"
" or the interface is currently down", nq->qdisc, nq->type);
}
@@ -2606,12 +2606,14 @@ int nss_qdisc_init(struct Qdisc *sch, st
* Wrapper around gnet_stats_copy_basic()
*/
int nss_qdisc_gnet_stats_copy_basic(struct Qdisc *sch, struct gnet_dump *d,
@@ -157,7 +135,7 @@
#endif
--- a/nss_qdisc/nss_qdisc_stats.c
+++ b/nss_qdisc/nss_qdisc_stats.c
@@ -160,7 +160,7 @@ static void nss_qdisc_stats_process_node
@@ -161,7 +161,7 @@ static void nss_qdisc_stats_process_node
{
struct Qdisc *qdisc;
struct nss_qdisc *nq;
@@ -166,7 +144,7 @@
struct gnet_stats_queue *qstats;
uint32_t qos_tag = response->qos_tag;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0))
@@ -214,8 +214,8 @@ static void nss_qdisc_stats_process_node
@@ -215,8 +215,8 @@ static void nss_qdisc_stats_process_node
* Update qdisc->bstats
*/
spin_lock_bh(&nq->lock);
@@ -177,34 +155,6 @@
/*
* Update qdisc->qstats
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -787,7 +787,7 @@ static struct nss_vlan_pvt *nss_vlan_mgr
}
v->mtu = dev->mtu;
- ether_addr_copy(v->dev_addr, dev->dev_addr);
+ ether_addr_copy(v->dev_addr, (uint8_t *) dev->dev_addr);
v->ifindex = dev->ifindex;
v->refs = 1;
@@ -936,14 +936,14 @@ static int nss_vlan_mgr_changeaddr_event
}
spin_unlock(&vlan_mgr_ctx.lock);
- if (nss_vlan_tx_set_mac_addr_msg(v_pvt->nss_if, dev->dev_addr) != NSS_TX_SUCCESS) {
+ if (nss_vlan_tx_set_mac_addr_msg(v_pvt->nss_if, (uint8_t *) dev->dev_addr) != NSS_TX_SUCCESS) {
nss_vlan_mgr_warn("%s: Failed to send change MAC address message to NSS\n", dev->name);
nss_vlan_mgr_instance_deref(v_pvt);
return NOTIFY_BAD;
}
spin_lock(&vlan_mgr_ctx.lock);
- ether_addr_copy(v_pvt->dev_addr, dev->dev_addr);
+ ether_addr_copy(v_pvt->dev_addr, (uint8_t *) dev->dev_addr);
spin_unlock(&vlan_mgr_ctx.lock);
nss_vlan_mgr_trace("%s: MAC changed to %pM, updated NSS\n", dev->name, dev->dev_addr);
nss_vlan_mgr_instance_deref(v_pvt);
--- a/vxlanmgr/nss_vxlanmgr_tunnel.c
+++ b/vxlanmgr/nss_vxlanmgr_tunnel.c
@@ -489,8 +489,8 @@ static void nss_vxlanmgr_tunnel_inner_st
@@ -240,15 +190,19 @@
priv = netdev_priv(dev);
memset(stats, 0, sizeof(struct rtnl_link_stats64));
memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64));
@@ -305,7 +305,7 @@ static void nss_pvxlanmgr_dummy_netdev_s
@@ -305,9 +305,9 @@ static void nss_pvxlanmgr_dummy_netdev_s
dev->priv_destructor = NULL;
#endif
- memcpy(dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
+ memcpy((void *) dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
- memset(dev->broadcast, 0xff, dev->addr_len);
- memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
+ const uint8_t mac_addr[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ eth_hw_addr_set(dev, mac_addr);
+ eth_broadcast_addr(dev->broadcast);
}
/*
--- a/clmapmgr/nss_clmapmgr.c
+++ b/clmapmgr/nss_clmapmgr.c
@@ -103,7 +103,7 @@ static struct rtnl_link_stats64 *nss_clm
@@ -299,3 +253,25 @@
u64_stats_update_end(&stats.syncp);
#else
struct nss_tun6rd_stats stats;
--- a/ipsecmgr/v1.0/nss_ipsecmgr.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr.c
@@ -445,7 +445,7 @@ static void nss_ipsecmgr_tunnel_setup(st
/*
* get the MAC address from the ethernet device
*/
- random_ether_addr(dev->dev_addr);
+ eth_random_addr((u8 *) dev->dev_addr);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
--- a/ipsecmgr/v2.0/nss_ipsecmgr_tunnel.c
+++ b/ipsecmgr/v2.0/nss_ipsecmgr_tunnel.c
@@ -445,7 +445,7 @@ static void nss_ipsecmgr_tunnel_setup(st
/*
* Get the MAC address from the ethernet device
*/
- random_ether_addr(dev->dev_addr);
+ eth_random_addr((u8 *) dev->dev_addr);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);

View File

@@ -0,0 +1,238 @@
--- a/wifi_meshmgr/nss_wifi_meshmgr.c
+++ b/wifi_meshmgr/nss_wifi_meshmgr.c
@@ -49,7 +49,7 @@ static bool nss_wifi_meshmgr_verify_if_n
*/
static nss_wifi_meshmgr_status_t nss_wifi_meshmgr_tx_msg(struct nss_wifi_mesh_msg *msg)
{
- return nss_wifi_mesh_tx_msg(wmgr_ctx.nss_ctx, msg);
+ return (nss_wifi_meshmgr_status_t)nss_wifi_mesh_tx_msg(wmgr_ctx.nss_ctx, msg);
}
/*
@@ -126,7 +126,7 @@ static void nss_wifi_meshmgr_cleanup(str
* Unregister and dealloc decap DI.
*/
nss_unregister_wifi_mesh_if(decap_ifnum);
- nss_status = nss_dynamic_interface_dealloc_node(decap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_dynamic_interface_dealloc_node(decap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER);
if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) {
nss_wifi_meshmgr_warn("%px: Failed to dealloc decap: %d\n", &wmgr_ctx, nss_status);
}
@@ -135,7 +135,7 @@ static void nss_wifi_meshmgr_cleanup(str
* Unregister and dealloc encap DI.
*/
nss_unregister_wifi_mesh_if(encap_ifnum);
- nss_status = nss_dynamic_interface_dealloc_node(encap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_dynamic_interface_dealloc_node(encap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER);
if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) {
nss_wifi_meshmgr_warn("%px: Failed to dealloc encap: %d\n", &wmgr_ctx, nss_status);
}
@@ -257,10 +257,10 @@ static void nss_wifi_meshmgr_tx_msg_cb(v
/*
* FIXME: The wmesh_ctx can be invalid if the memory goes away with the caller being timedout.
*/
- wmesh_ctx->response = NSS_WIFI_MESHMGR_SUCCESS;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_SUCCESS;
if (ncm->response != NSS_CMN_RESPONSE_ACK) {
nss_wifi_meshmgr_warn("%px: WiFi-Mesh error response %d error_code: %u\n", &wmgr_ctx, ncm->response, error_code);
- wmesh_ctx->response = nss_wifi_meshmgr_remap_error(error_code);
+ wmesh_ctx->response = (nss_tx_status_t)nss_wifi_meshmgr_remap_error(error_code);
}
complete(&wmesh_ctx->complete);
@@ -289,10 +289,10 @@ static nss_wifi_meshmgr_status_t nss_wif
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- status = wmesh_ctx->response;
+ status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
return status;
}
@@ -324,7 +324,7 @@ nss_wifi_meshmgr_status_t nss_wifi_meshm
return NSS_WIFI_MESHMGR_FAILURE;
}
- nss_status = nss_wifi_mesh_tx_buf(wmgr_ctx.nss_ctx, os_buf, encap_ifnum);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_wifi_mesh_tx_buf(wmgr_ctx.nss_ctx, os_buf, encap_ifnum);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
return nss_status;
}
@@ -548,10 +548,10 @@ nss_wifi_meshmgr_dump_mesh_path_sync(nss
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -643,10 +643,10 @@ nss_wifi_meshmgr_dump_mesh_proxy_path_sy
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -715,7 +715,7 @@ nss_wifi_meshmgr_assoc_link_vap(nss_wifi
/*
* Send the link vap mesage to the NSS synchronously.
*/
- nss_status = nss_wifi_vdev_tx_msg(wmgr_ctx.nss_ctx, wifivdevmsg);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_wifi_vdev_tx_msg(wmgr_ctx.nss_ctx, wifivdevmsg);
if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) {
nss_wifi_meshmgr_warn("%px: Mesh link vap association failed: %d.\n", &wmgr_ctx, nss_status);
}
@@ -761,10 +761,10 @@ nss_wifi_meshmgr_assoc_link_vap_sync(nss
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -886,10 +886,10 @@ nss_wifi_meshmgr_mesh_config_update_sync
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -985,10 +985,10 @@ nss_wifi_meshmgr_mesh_proxy_path_delete_
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1084,10 +1084,10 @@ nss_wifi_meshmgr_mesh_proxy_path_update_
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1183,10 +1183,10 @@ nss_wifi_meshmgr_mesh_proxy_path_add_syn
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1282,10 +1282,10 @@ nss_wifi_meshmgr_mesh_path_delete_sync(n
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1381,10 +1381,10 @@ nss_wifi_meshmgr_mesh_path_add_sync(nss_
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
return nss_status;
@@ -1479,10 +1479,10 @@ nss_wifi_meshmgr_mesh_path_update_sync(n
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1578,10 +1578,10 @@ nss_wifi_meshmgr_mesh_path_exception_syn
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1702,10 +1702,10 @@ nss_wifi_meshmgr_config_mesh_exception_s
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1795,7 +1795,7 @@ nss_wifi_mesh_handle_t nss_wifi_meshmgr_
int32_t encap_ifnum, decap_ifnum;
uint32_t features = 0;
nss_wifi_mesh_handle_t mesh_handle;
- nss_wifi_meshmgr_status_t nss_status;
+ nss_wifi_meshmgr_status_t nss_status = NSS_WIFI_MESHMGR_SUCCESS;
struct nss_wifi_meshmgr_mesh_ctx *wmesh_ctx;
spin_lock_bh(&wmgr_ctx.ref_lock);

View File

@@ -0,0 +1,169 @@
--- a/capwapmgr/nss_capwapmgr.c
+++ b/capwapmgr/nss_capwapmgr.c
@@ -334,7 +334,7 @@ static struct rtnl_link_stats64 *nss_cap
* Netdev seems to be incrementing rx_dropped because we don't give IP header.
* So reset it as it's of no use for us.
*/
- atomic_long_set(&dev->rx_dropped, 0);
+ dev->stats.rx_dropped = 0;
memset(stats, 0, sizeof (struct rtnl_link_stats64));
nss_capwapmgr_fill_up_stats(stats, &global.tunneld);
@@ -379,7 +379,6 @@ static const struct net_device_ops nss_c
.ndo_stop = nss_capwapmgr_close,
.ndo_start_xmit = nss_capwapmgr_start_xmit,
.ndo_set_mac_address = eth_mac_addr,
- .ndo_change_mtu = eth_change_mtu,
.ndo_get_stats64 = nss_capwapmgr_dev_tunnel_stats,
};
@@ -403,7 +402,7 @@ static void nss_capwapmgr_dummpy_netdev_
#else
dev->priv_destructor = NULL;
#endif
- memcpy(dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
+ memcpy((u8 *)dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
}
@@ -572,7 +571,7 @@ static struct nss_capwapmgr_tunnel *nss_
* nss_capwapmgr_netdev_create()
* API to create a CAPWAP netdev
*/
-struct net_device *nss_capwapmgr_netdev_create()
+struct net_device *nss_capwapmgr_netdev_create(void)
{
struct nss_capwapmgr_priv *priv;
struct nss_capwapmgr_response *r;
@@ -1179,7 +1178,7 @@ static nss_capwapmgr_status_t nss_capwap
/*
* Call NSS driver
*/
- status = nss_capwap_tx_msg(ctx, msg);
+ status = (nss_capwapmgr_status_t)nss_capwap_tx_msg(ctx, msg);
if (status != NSS_CAPWAPMGR_SUCCESS) {
up(&r->sem);
dev_put(dev);
@@ -1220,7 +1219,7 @@ static nss_capwapmgr_status_t nss_capwap
struct nss_ctx_instance *ctx = nss_capwap_get_ctx();
struct nss_capwap_msg capwapmsg;
struct nss_capwap_rule_msg *capwapcfg;
- nss_tx_status_t status;
+ nss_capwapmgr_status_t status;
nss_capwapmgr_info("%px: ctx: CAPWAP Rule src_port: 0x%d dest_port:0x%d\n", ctx,
ntohl(msg->encap.src_port), ntohl(msg->encap.dest_port));
@@ -1285,7 +1284,7 @@ static nss_capwapmgr_status_t nss_capwap
nss_capwapmgr_msg_event_receive, dev);
status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
- if (status != NSS_TX_SUCCESS) {
+ if (status != NSS_CAPWAPMGR_SUCCESS) {
nss_capwapmgr_warn("%px: ctx: create encap data tunnel error %d \n", ctx, status);
return status;
}
@@ -1297,10 +1296,10 @@ static nss_capwapmgr_status_t nss_capwap
* nss_capwapmgr_tx_msg_enable_tunnel()
* Common function to send CAPWAP tunnel enable msg
*/
-static nss_tx_status_t nss_capwapmgr_tx_msg_enable_tunnel(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, uint32_t sibling_if_num)
+static nss_capwapmgr_status_t nss_capwapmgr_tx_msg_enable_tunnel(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, uint32_t sibling_if_num)
{
struct nss_capwap_msg capwapmsg;
- nss_tx_status_t status;
+ nss_capwapmgr_status_t status;
/*
* Prepare the tunnel configuration parameter to send to NSS FW
@@ -1314,7 +1313,7 @@ static nss_tx_status_t nss_capwapmgr_tx_
nss_capwap_msg_init(&capwapmsg, if_num, NSS_CAPWAP_MSG_TYPE_ENABLE_TUNNEL, sizeof(struct nss_capwap_enable_tunnel_msg), nss_capwapmgr_msg_event_receive, dev);
status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
- if (status != NSS_TX_SUCCESS) {
+ if (status != NSS_CAPWAPMGR_SUCCESS) {
nss_capwapmgr_warn("%px: ctx: CMD: %d Tunnel error : %d \n", ctx, NSS_CAPWAP_MSG_TYPE_ENABLE_TUNNEL, status);
}
@@ -1326,7 +1325,7 @@ static nss_tx_status_t nss_capwapmgr_tx_
* Common function for CAPWAP tunnel operation messages without
* any message data structures.
*/
-static nss_tx_status_t nss_capwapmgr_tunnel_action(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, nss_capwap_msg_type_t cmd)
+static nss_capwapmgr_status_t nss_capwapmgr_tunnel_action(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, nss_capwap_msg_type_t cmd)
{
struct nss_capwap_msg capwapmsg;
nss_tx_status_t status;
@@ -1341,12 +1340,12 @@ static nss_tx_status_t nss_capwapmgr_tun
*/
nss_capwap_msg_init(&capwapmsg, if_num, cmd, 0, nss_capwapmgr_msg_event_receive, dev);
- status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
+ status = (nss_tx_status_t)nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
if (status != NSS_TX_SUCCESS) {
nss_capwapmgr_warn("%px: ctx: CMD: %d Tunnel error : %d \n", ctx, cmd, status);
}
- return status;
+ return (nss_capwapmgr_status_t)status;
}
/*
@@ -1471,7 +1470,6 @@ EXPORT_SYMBOL(nss_capwapmgr_update_path_
*/
nss_capwapmgr_status_t nss_capwapmgr_update_dest_mac_addr(struct net_device *dev, uint8_t tunnel_id, uint8_t *mac_addr)
{
- struct nss_capwapmgr_priv *priv;
struct nss_capwapmgr_tunnel *t;
nss_tx_status_t nss_status;
nss_capwapmgr_status_t status = NSS_CAPWAPMGR_SUCCESS;
@@ -1487,7 +1485,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
}
- priv = netdev_priv(dev);
nss_capwapmgr_info("%px: %d: tunnel update mac Addr is being called\n", dev, tunnel_id);
/*
@@ -1534,7 +1531,6 @@ EXPORT_SYMBOL(nss_capwapmgr_update_dest_
*/
nss_capwapmgr_status_t nss_capwapmgr_update_src_interface(struct net_device *dev, uint8_t tunnel_id, uint32_t src_interface_num)
{
- struct nss_capwapmgr_priv *priv;
struct nss_capwapmgr_tunnel *t;
nss_tx_status_t nss_status;
uint32_t outer_trustsec_enabled, dtls_enabled, forward_if_num, src_interface_num_temp;
@@ -1548,7 +1544,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
}
- priv = netdev_priv(dev);
nss_capwapmgr_info("%px: %d: tunnel update source interface is being called\n", dev, tunnel_id);
outer_trustsec_enabled = t->capwap_rule.enabled_features & NSS_CAPWAPMGR_FEATURE_OUTER_TRUSTSEC_ENABLED;
dtls_enabled = t->capwap_rule.enabled_features & NSS_CAPWAPMGR_FEATURE_DTLS_ENABLED;
@@ -1587,7 +1582,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
/*
* Destroy the IP rule only if it already exist.
*/
- if (t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
+ if (NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
struct nss_ipv4_destroy v4_destroy;
v4_destroy.protocol = IPPROTO_UDP;
v4_destroy.src_ip = t->ip_rule.v4.src_ip;
@@ -1617,7 +1612,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
/*
* Destroy the IP rule only if it already exist.
*/
- if (t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
+ if (NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
struct nss_ipv6_destroy v6_destroy;
if (t->capwap_rule.which_udp == NSS_CAPWAP_TUNNEL_UDP) {
@@ -1761,7 +1756,7 @@ nss_capwapmgr_status_t nss_capwapmgr_dsc
uint8_t rule_nr = NSS_CAPWAPMGR_RULE_NR;
uint8_t list_id, v4_rule_id, v6_rule_id;
uint8_t lid, rid, i, j;
- int8_t err, fail_dscp;
+ uint8_t err, fail_dscp;
int8_t uid = -1;
nss_capwapmgr_info("Setting priority %u for dscp %u mask %u\n", pri, dscp_value, dscp_mask);

View File

@@ -0,0 +1,44 @@
--- a/netlink/Makefile
+++ b/netlink/Makefile
@@ -27,7 +27,6 @@ ccflags-y += -DCONFIG_NSS_NLPPTP=1
ccflags-y += -DCONFIG_NSS_NLCAPWAP=${CAPWAP_ENABLED}
ccflags-y += -DCONFIG_NSS_NLIPSEC=${IPSEC_ENABLED}
ccflags-y += -DCONFIG_NSS_NLDTLS=${DTLS_ENABLED}
-ccflags-y += -DCONFIG_NSS_NLUDP_ST=1
qca-nss-netlink-objs := nss_nl.o
qca-nss-netlink-objs += nss_nlgre_redir_family.o
@@ -49,7 +48,6 @@ qca-nss-netlink-objs += nss_nlmap_t.o
qca-nss-netlink-objs += nss_nlpppoe.o
qca-nss-netlink-objs += nss_nll2tpv2.o
qca-nss-netlink-objs += nss_nlpptp.o
-qca-nss-netlink-objs += nss_nludp_st.o
qca-nss-netlink-objs += nss_nlqrfs.o
ifneq (,$(filter $(capwapmgr), y))
@@ -81,4 +79,11 @@ else
ccflags-y += -DCONFIG_NSS_NLEDMA=0
endif
+ifeq ($(SoC),$(filter $(SoC),ipq95xx ipq50xx))
+ccflags-y += -DCONFIG_NSS_NLUDP_ST=1
+qca-nss-netlink-objs += nss_nludp_st.o
+else
+ccflags-y += -DCONFIG_NSS_NLUDP_ST=0
+endif
+
obj-m += qca-nss-netlink.o
--- a/netlink/nss_nludp_st.h
+++ b/netlink/nss_nludp_st.h
@@ -23,10 +23,9 @@
#ifndef __NSS_NLUDP_ST_H
#define __NSS_NLUDP_ST_H
+#if defined(CONFIG_NSS_NLUDP_ST) && CONFIG_NSS_NLUDP_ST > 0
bool nss_nludp_st_init(void);
bool nss_nludp_st_exit(void);
-
-#if defined(CONFIG_NSS_NLUDP_ST)
#define NSS_NLUDP_ST_INIT nss_nludp_st_init
#define NSS_NLUDP_ST_EXIT nss_nludp_st_exit
#else

View File

@@ -0,0 +1,93 @@
--- a/match/nss_match_cmd.c
+++ b/match/nss_match_cmd.c
@@ -460,10 +460,10 @@ static int nss_match_cmd_procfs_reset_ne
char *cmd_buf = nss_match_data;
nss_tx_status_t nss_tx_status;
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
- struct nss_ctx_instance *wifi_nss_ctx = nss_wifi_get_context();
+ struct nss_ctx_instance *wifili_nss_ctx = nss_wifili_get_context();
- if (!nss_ctx || !wifi_nss_ctx) {
- pr_warn("%px: NSS Context not found. wifi_nss_ctx: %px. Reset nexthop failed", nss_ctx, wifi_nss_ctx);
+ if (!nss_ctx || !wifili_nss_ctx) {
+ pr_warn("%px: NSS Context not found. wifili_nss_ctx: %px. Reset nexthop failed", nss_ctx, wifili_nss_ctx);
return -ENOMEM;
}
@@ -495,9 +495,9 @@ static int nss_match_cmd_procfs_reset_ne
* nss_phys_if_reset_nexthop: Used for physical interfaces.
* nss_if_reset_nexthop: used for VAP interfaces.
*/
- type = nss_dynamic_interface_get_type(wifi_nss_ctx, if_num);
+ type = nss_dynamic_interface_get_type(wifili_nss_ctx, if_num);
if (type == NSS_DYNAMIC_INTERFACE_TYPE_VAP) {
- nss_tx_status = nss_if_reset_nexthop(wifi_nss_ctx, if_num);
+ nss_tx_status = nss_if_reset_nexthop(wifili_nss_ctx, if_num);
} else if (if_num < NSS_MAX_PHYSICAL_INTERFACES) {
nss_tx_status = nss_phys_if_reset_nexthop(nss_ctx, if_num);
} else {
@@ -528,7 +528,7 @@ static int nss_match_cmd_procfs_set_if_n
uint32_t nh_if_num;
int table_id;
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
- struct nss_ctx_instance *wifi_nss_ctx = nss_wifi_get_context();
+ struct nss_ctx_instance *wifili_nss_ctx = nss_wifili_get_context();
char *dev_name, *nexthop_msg;
char *cmd_buf = NULL;
size_t count = *lenp;
@@ -539,8 +539,8 @@ static int nss_match_cmd_procfs_set_if_n
return ret;
}
- if (!nss_ctx || !wifi_nss_ctx) {
- pr_warn("%px: NSS Context not found. wifi_nss_ctx: %px. Set nexthop failed", nss_ctx, wifi_nss_ctx);
+ if (!nss_ctx || !wifili_nss_ctx) {
+ pr_warn("%px: NSS Context not found. wifili_nss_ctx: %px. Set nexthop failed", nss_ctx, wifili_nss_ctx);
return -ENOMEM;
}
@@ -607,9 +607,9 @@ static int nss_match_cmd_procfs_set_if_n
* nss_phys_if_set_nexthop: Used for physical interfaces.
* nss_if_set_nexthop: used for VAP interfaces.
*/
- type = nss_dynamic_interface_get_type(wifi_nss_ctx, if_num);
+ type = nss_dynamic_interface_get_type(wifili_nss_ctx, if_num);
if (type == NSS_DYNAMIC_INTERFACE_TYPE_VAP) {
- nss_tx_status = nss_if_set_nexthop(wifi_nss_ctx, if_num, nh_if_num);
+ nss_tx_status = nss_if_set_nexthop(wifili_nss_ctx, if_num, nh_if_num);
} else if (if_num < NSS_MAX_PHYSICAL_INTERFACES) {
nss_tx_status = nss_phys_if_set_nexthop(nss_ctx, if_num, nh_if_num);
} else {
--- a/gre/nss_connmgr_gre.c
+++ b/gre/nss_connmgr_gre.c
@@ -1672,7 +1672,7 @@ int nss_connmgr_gre_set_wifi_next_hop(st
return GRE_ERR_NEXT_NODE_UNREG_IN_AE;
}
- ctx = nss_wifi_get_context();
+ ctx = nss_wifili_get_context();
status = nss_wifi_vdev_set_next_hop(ctx, ifnumber, NSS_GRE_INTERFACE);
if (status != NSS_TX_SUCCESS) {
nss_connmgr_gre_info("%px: wifi drv api failed to set next hop\n", wifi_vdev);
--- a/mirror/nss_mirror_ctl.c
+++ b/mirror/nss_mirror_ctl.c
@@ -480,7 +480,7 @@ static int nss_mirror_ctl_parse_enable_i
type = nss_dynamic_interface_get_type(nss_ctx, if_num);
if (type == NSS_DYNAMIC_INTERFACE_TYPE_VAP) {
- status = nss_wifi_vdev_set_next_hop(nss_wifi_get_context(), if_num, mirror_if_num);
+ status = nss_wifi_vdev_set_next_hop(nss_wifili_get_context(), if_num, mirror_if_num);
} else if (if_num < NSS_MAX_PHYSICAL_INTERFACES) {
status = nss_phys_if_set_nexthop(nss_ctx, if_num, mirror_if_num);
} else {
--- a/netlink/nss_nlgre_redir_cmn.c
+++ b/netlink/nss_nlgre_redir_cmn.c
@@ -905,7 +905,7 @@ int nss_nlgre_redir_cmn_set_next_hop(uin
}
nss_nl_info("%px: next hop interface number is %d\n", nss_ctx, next_dev_ifnum);
- ctx = nss_wifi_get_context();
+ ctx = nss_wifili_get_context();
ret = nss_wifi_vdev_set_next_hop(ctx, ifnumber, next_dev_ifnum);
if (ret != NSS_TX_SUCCESS) {

View File

@@ -0,0 +1,13 @@
--- a/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
+++ b/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
@@ -532,7 +532,8 @@ void nss_dtlsmgr_ctx_dev_setup(struct ne
#else
dev->priv_destructor = nss_dtlsmgr_ctx_dev_free;
#endif
- memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len);
- memset(dev->broadcast, 0xff, dev->addr_len);
+ const uint8_t mac_addr[ETH_ALEN] = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff };
+ eth_hw_addr_set(dev, mac_addr);
+ eth_broadcast_addr(dev->broadcast);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
}

View File

@@ -0,0 +1,13 @@
--- a/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
+++ b/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
@@ -236,6 +236,10 @@ void nss_dtlsmgr_ctx_dev_rx_inner(struct
skb->skb_iif = dev->ifindex;
skb->dev = dev;
+ // Update the statistics
+ stats->rx_packets++;
+ stats->rx_bytes += skb->len;
+
ctx->data_cb(ctx->app_data, skb);
dev_put(dev);
}

View File

@@ -0,0 +1,473 @@
--- a/match/nss_match.c
+++ b/match/nss_match.c
@@ -76,9 +76,10 @@ static nss_match_status_t nss_match_veri
* nss_match_sync_callback()
* Sync callback for syncing stats.
*/
-static void nss_match_sync_callback(void *app_data, struct nss_match_msg *nmm)
+static void nss_match_sync_callback(void *app_data, struct nss_cmn_msg *cmm)
{
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
+ struct nss_match_msg *nmm = (struct nss_match_msg *)cmm;
switch (nmm->cm.type) {
case NSS_MATCH_STATS_SYNC:
--- a/nss_qdisc/nss_ppe.c
+++ b/nss_qdisc/nss_ppe.c
@@ -348,8 +348,8 @@ static void nss_ppe_queue_disable(struct
/*
* Disable queue enqueue, dequeue and flush the queue.
*/
- fal_qm_enqueue_ctrl_set(0, npq->q.ucast_qid, false);
- fal_scheduler_dequeue_ctrl_set(0, npq->q.ucast_qid, false);
+ fal_qm_enqueue_ctrl_set(0, npq->q.ucast_qid, 0);
+ fal_scheduler_dequeue_ctrl_set(0, npq->q.ucast_qid, 0);
fal_queue_flush(0, port_num, npq->q.ucast_qid);
nss_qdisc_info("Disable SSDK level0 queue scheduler successful\n");
@@ -370,8 +370,8 @@ static void nss_ppe_queue_enable(struct
/*
* Enable queue enqueue and dequeue.
*/
- fal_qm_enqueue_ctrl_set(0, npq->q.ucast_qid, true);
- fal_scheduler_dequeue_ctrl_set(0, npq->q.ucast_qid, true);
+ fal_qm_enqueue_ctrl_set(0, npq->q.ucast_qid, 1);
+ fal_scheduler_dequeue_ctrl_set(0, npq->q.ucast_qid, 1);
nss_qdisc_info("Enable SSDK level0 queue scheduler successful\n");
}
@@ -535,14 +535,14 @@ static void nss_ppe_all_queue_disable(ui
* Disable queue enqueue, dequeue and flush the queue.
*/
for (offset = 0; offset < nss_ppe_max_get(port_num, NSS_PPE_UCAST_QUEUE); offset++) {
- fal_qm_enqueue_ctrl_set(0, qid + offset, false);
- fal_scheduler_dequeue_ctrl_set(0, qid + offset, false);
+ fal_qm_enqueue_ctrl_set(0, qid + offset, 0);
+ fal_scheduler_dequeue_ctrl_set(0, qid + offset, 0);
fal_queue_flush(0, port_num, qid + offset);
}
for (offset = 0; offset < nss_ppe_max_get(port_num, NSS_PPE_MCAST_QUEUE); offset++) {
- fal_qm_enqueue_ctrl_set(0, mcast_qid + offset, false);
- fal_scheduler_dequeue_ctrl_set(0, mcast_qid + offset, false);
+ fal_qm_enqueue_ctrl_set(0, mcast_qid + offset, 0);
+ fal_scheduler_dequeue_ctrl_set(0, mcast_qid + offset, 0);
fal_queue_flush(0, port_num, mcast_qid + offset);
}
@@ -563,13 +563,13 @@ static void nss_ppe_all_queue_enable(uin
* Enable queue enqueue and dequeue.
*/
for (offset = 0; offset < nss_ppe_max_get(port_num, NSS_PPE_UCAST_QUEUE); offset++) {
- fal_qm_enqueue_ctrl_set(0, qid + offset, true);
- fal_scheduler_dequeue_ctrl_set(0, qid + offset, true);
+ fal_qm_enqueue_ctrl_set(0, qid + offset, 1);
+ fal_scheduler_dequeue_ctrl_set(0, qid + offset, 1);
}
for (offset = 0; offset < nss_ppe_max_get(port_num, NSS_PPE_MCAST_QUEUE); offset++) {
- fal_qm_enqueue_ctrl_set(0, mcast_qid + offset, true);
- fal_scheduler_dequeue_ctrl_set(0, mcast_qid + offset, true);
+ fal_qm_enqueue_ctrl_set(0, mcast_qid + offset, 1);
+ fal_scheduler_dequeue_ctrl_set(0, mcast_qid + offset, 1);
}
nss_qdisc_info("Enable SSDK level0 queue scheduler successful\n");
@@ -589,15 +589,15 @@ static void nss_ppe_assigned_queue_enabl
spin_lock_bh(&ppe_port->lock);
res = ppe_port->res_used[NSS_PPE_UCAST_QUEUE];
while (res) {
- fal_qm_enqueue_ctrl_set(0, qid + res->offset, true);
- fal_scheduler_dequeue_ctrl_set(0, qid + res->offset, true);
+ fal_qm_enqueue_ctrl_set(0, qid + res->offset, (a_bool_t)true);
+ fal_scheduler_dequeue_ctrl_set(0, qid + res->offset, (a_bool_t)true);
res = res->next;
}
res = ppe_port->res_used[NSS_PPE_MCAST_QUEUE];
while (res) {
- fal_qm_enqueue_ctrl_set(0, mcast_qid + res->offset, true);
- fal_scheduler_dequeue_ctrl_set(0, mcast_qid + res->offset, true);
+ fal_qm_enqueue_ctrl_set(0, mcast_qid + res->offset, (a_bool_t)true);
+ fal_scheduler_dequeue_ctrl_set(0, mcast_qid + res->offset, (a_bool_t)true);
res = res->next;
}
@@ -642,7 +642,7 @@ static int nss_ppe_l1_queue_scheduler_co
l1cfg.e_pri = NSS_PPE_PRIORITY_MAX - npq->scheduler.priority;
l1cfg.c_drr_id = npq->l1c_drrid;
l1cfg.e_drr_id = npq->l1e_drrid;
- l1cfg.drr_frame_mode = NSS_PPE_FRAME_CRC;
+ l1cfg.drr_frame_mode = (fal_qos_drr_frame_mode_t)NSS_PPE_FRAME_CRC;
nss_qdisc_trace("SSDK level1 configuration: Port:%d, l0spid:%d, c_drrid:%d, c_pri:%d, c_drr_wt:%d, e_drrid:%d, e_pri:%d, e_drr_wt:%d, l1spid:%d\n",
port_num, npq->l0spid, l1cfg.c_drr_id, l1cfg.c_pri, l1cfg.c_drr_wt, l1cfg.e_drr_id, l1cfg.e_pri, l1cfg.e_drr_wt, l1cfg.sp_id);
@@ -935,7 +935,7 @@ static int nss_ppe_l0_queue_scheduler_co
l0cfg.e_pri = NSS_PPE_PRIORITY_MAX - npq->scheduler.priority;
l0cfg.c_drr_id = npq->l0c_drrid;
l0cfg.e_drr_id = npq->l0e_drrid;
- l0cfg.drr_frame_mode = NSS_PPE_FRAME_CRC;
+ l0cfg.drr_frame_mode = (fal_qos_drr_frame_mode_t)NSS_PPE_FRAME_CRC;
nss_qdisc_trace("SSDK level0 configuration: Port:%d, ucast_qid:%d, c_drrid:%d, c_pri:%d, c_drr_wt:%d, e_drrid:%d, e_pri:%d, e_drr_wt:%d, l0spid:%d\n",
port_num, npq->q.ucast_qid, l0cfg.c_drr_id, l0cfg.c_pri, l0cfg.c_drr_wt, l0cfg.e_drr_id, l0cfg.e_pri, l0cfg.e_drr_wt, l0cfg.sp_id);
@@ -1059,7 +1059,7 @@ static int nss_ppe_port_shaper_set(struc
cfg.c_shaper_en = 1;
cfg.cbs = npq->shaper.cburst;
cfg.cir = (npq->shaper.crate / 1000) * 8;
- cfg.shaper_frame_mode = NSS_PPE_FRAME_CRC;
+ cfg.shaper_frame_mode = (fal_shaper_frame_mode_t)NSS_PPE_FRAME_CRC;
/*
* Take HW scaling into consideration
@@ -1141,7 +1141,7 @@ static int nss_ppe_flow_shaper_set(struc
cfg.e_shaper_en = 1;
cfg.ebs = npq->shaper.cburst;
cfg.eir = ((npq->shaper.crate / 1000) * 8) - cfg.cir;
- cfg.shaper_frame_mode = NSS_PPE_FRAME_CRC;
+ cfg.shaper_frame_mode = (fal_shaper_frame_mode_t)NSS_PPE_FRAME_CRC;
/*
* Take HW scaling into consideration
@@ -1225,7 +1225,7 @@ static int nss_ppe_queue_shaper_set(stru
cfg.e_shaper_en = 1;
cfg.ebs = npq->shaper.cburst;
cfg.eir = ((npq->shaper.crate / 1000) * 8) - cfg.cir;
- cfg.shaper_frame_mode = NSS_PPE_FRAME_CRC;
+ cfg.shaper_frame_mode = (fal_shaper_frame_mode_t)NSS_PPE_FRAME_CRC;
/*
* Take HW scaling into consideration
@@ -1293,7 +1293,6 @@ static void nss_ppe_attach_free(uint32_t
spin_unlock_bh(&ppe_port->lock);
nss_qdisc_info("port:%d, type:%d, res:%px\n", port, res->type, res);
- return;
}
/*
@@ -2379,7 +2378,7 @@ int nss_ppe_init(struct Qdisc *sch, stru
* nothing useful and thus we don't allocate any resource".
*/
nss_qdisc_trace("Qdisc parent = %px, handle=%x\n", nq->parent, nq->parent->qos_tag);
- if ((nq->parent->npq.sub_type == NSS_SHAPER_CONFIG_PPE_SN_TYPE_HTB)) {
+ if (nq->parent->npq.sub_type == NSS_SHAPER_CONFIG_PPE_SN_TYPE_HTB) {
nq->npq.level = nq->parent->npq.level;
} else {
nq->npq.level = nq->parent->npq.level - 1;
--- a/nss_qdisc/nss_ppe_mc.c
+++ b/nss_qdisc/nss_ppe_mc.c
@@ -32,8 +32,8 @@ int nss_ppe_mcast_queue_reset(struct nss
return 0;
}
- fal_qm_enqueue_ctrl_set(0, npq->q.mcast_qid, false);
- fal_scheduler_dequeue_ctrl_set(0, npq->q.mcast_qid, false);
+ fal_qm_enqueue_ctrl_set(0, npq->q.mcast_qid, 0);
+ fal_scheduler_dequeue_ctrl_set(0, npq->q.mcast_qid, 0);
fal_queue_flush(0, port_num, npq->q.mcast_qid);
/*
@@ -153,8 +153,8 @@ int nss_ppe_mcast_queue_set(struct nss_q
}
}
- fal_qm_enqueue_ctrl_set(0, npq->q.mcast_qid, true);
- fal_scheduler_dequeue_ctrl_set(0, npq->q.mcast_qid, true);
+ fal_qm_enqueue_ctrl_set(0, npq->q.mcast_qid, 1);
+ fal_scheduler_dequeue_ctrl_set(0, npq->q.mcast_qid, 1);
nss_qdisc_info("SSDK multicast queue configuration successful for port:%d\n", port_num);
return 0;
@@ -164,4 +164,4 @@ fail:
npq->q.mcast_qid = 0;
npq->q.mcast_valid = 0;
return -EINVAL;
-}
\ No newline at end of file
+}
--- a/nss_qdisc/nss_wred.c
+++ b/nss_qdisc/nss_wred.c
@@ -291,7 +291,7 @@ static int nss_wred_change(struct Qdisc
nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.limit = qopt->limit;
- nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.weight_mode = qopt->weight_mode;
+ nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.weight_mode = (nss_shaper_config_wred_weight_mode_t)qopt->weight_mode;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.weight_mode_value = qopt->weight_mode_value;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.rap.min = qopt->rap.min;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wred_param.rap.max = qopt->rap.max;
--- a/openvpn/plugins/nss_ovpn_sk.c
+++ b/openvpn/plugins/nss_ovpn_sk.c
@@ -156,7 +156,7 @@ static int nss_ovpn_sk_crypto_key_add(st
return -EFAULT;
}
- crypto_cfg.algo = crypto_info.config.algo;
+ crypto_cfg.algo = (enum nss_ovpnmgr_algo)crypto_info.config.algo;
crypto_cfg.encrypt.cipher_keylen = crypto_info.config.cipher_key_size;
crypto_cfg.encrypt.hmac_keylen = crypto_info.config.hmac_key_size;
crypto_cfg.decrypt.cipher_keylen = crypto_info.config.cipher_key_size;
@@ -364,7 +364,7 @@ static int nss_ovpn_sk_tun_add(struct so
tun_hdr.dst_port = tun_data.tun_hdr.dst_port;
tun_hdr.hop_limit = tun_data.tun_hdr.hop_limit;
- crypto_cfg.algo = tun_data.crypto.config.algo;
+ crypto_cfg.algo = (enum nss_ovpnmgr_algo)tun_data.crypto.config.algo;
crypto_cfg.encrypt.cipher_keylen = tun_data.crypto.config.cipher_key_size;
crypto_cfg.encrypt.hmac_keylen = tun_data.crypto.config.hmac_key_size;
crypto_cfg.decrypt.cipher_keylen = tun_data.crypto.config.cipher_key_size;
@@ -442,7 +442,7 @@ static int nss_ovpn_sk_tun_add(struct so
* nss_ovpn_sk_app_dereg()
* Deregister application.
*/
-static int nss_ovpn_sk_app_dereg(struct socket *sock, unsigned long argp)
+static int nss_ovpn_sk_app_dereg(struct socket *sock)
{
struct nss_ovpn_sk_pinfo *pinfo = (struct nss_ovpn_sk_pinfo *)sock->sk;
int ret;
@@ -491,7 +491,7 @@ static int nss_ovpn_sk_app_reg(struct so
return -EFAULT;
}
- ret = nss_ovpnmgr_app_add(pinfo->dev, app.app_mode, (void *)sock);
+ ret = nss_ovpnmgr_app_add(pinfo->dev, (enum nss_ovpnmgr_app_mode)app.app_mode, (void *)sock);
if (ret) {
nss_ovpn_sk_warn("%px: Failed to register application, pid=%u\n", sock, app.pid);
dev_put(pinfo->dev);
@@ -689,7 +689,7 @@ static int nss_ovpn_sk_recvmsg(struct so
return -EINVAL;
}
- skb = skb_recv_datagram(sk, flags, MSG_DONTWAIT, &ret);
+ skb = skb_recv_datagram(sk, flags, &ret);
if (!skb) {
nss_ovpn_sk_warn("%px: There are no packets in the queue.\n", sock);
return -ENOBUFS;
@@ -740,7 +740,7 @@ static int nss_ovpn_sk_ioctl(struct sock
case NSS_OVPN_SK_SIOC_APP_REG:
return nss_ovpn_sk_app_reg(sock, argp);
case NSS_OVPN_SK_SIOC_APP_DEREG:
- return nss_ovpn_sk_app_dereg(sock, argp);
+ return nss_ovpn_sk_app_dereg(sock);
case NSS_OVPN_SK_SIOC_TUN_ADD:
return nss_ovpn_sk_tun_add(sock, argp);
case NSS_OVPN_SK_SIOC_TUN_DEL:
@@ -773,15 +773,12 @@ static const struct proto_ops nss_ovpn_s
.ioctl = nss_ovpn_sk_ioctl,
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
- .getsockopt = sock_no_getsockopt,
.mmap = sock_no_mmap,
- .sendpage = sock_no_sendpage,
.sendmsg = nss_ovpn_sk_sendmsg,
.recvmsg = nss_ovpn_sk_recvmsg,
.poll = datagram_poll,
.bind = sock_no_bind,
.release = nss_ovpn_sk_release,
- .setsockopt = sock_no_setsockopt,
.accept = sock_no_accept,
};
--- a/pvxlanmgr/nss_pvxlanmgr.c
+++ b/pvxlanmgr/nss_pvxlanmgr.c
@@ -408,7 +408,7 @@ nss_pvxlanmgr_status_t nss_pvxlanmgr_net
if (ret != NSS_TX_SUCCESS) {
nss_pvxlanmgr_warn("%px: Tunnel disable failed: %d\n", dev, ret);
dev_put(dev);
- return ret;
+ return (nss_pvxlanmgr_status_t)ret;
}
ret = nss_pvxlanmgr_tunnel_tx_msg_disable(priv->pvxlan_ctx, priv->if_num_outer);
@@ -416,11 +416,11 @@ nss_pvxlanmgr_status_t nss_pvxlanmgr_net
nss_pvxlanmgr_warn("%px: Tunnel disable failed: %d\n", dev, ret);
nss_pvxlanmgr_tunnel_tx_msg_enable(priv->pvxlan_ctx, priv->if_num_host_inner, priv->if_num_outer);
dev_put(dev);
- return ret;
+ return (nss_pvxlanmgr_status_t)ret;
}
dev_put(dev);
- return ret;
+ return (nss_pvxlanmgr_status_t)ret;
}
EXPORT_SYMBOL(nss_pvxlanmgr_netdev_disable);
@@ -440,7 +440,7 @@ nss_pvxlanmgr_status_t nss_pvxlanmgr_net
if (ret != NSS_TX_SUCCESS) {
nss_pvxlanmgr_warn("%px: Tunnel enable failed: %d\n", dev, ret);
dev_put(dev);
- return ret;
+ return (nss_pvxlanmgr_status_t)ret;
}
ret = nss_pvxlanmgr_tunnel_tx_msg_enable(priv->pvxlan_ctx, priv->if_num_outer, priv->if_num_host_inner);
@@ -448,11 +448,11 @@ nss_pvxlanmgr_status_t nss_pvxlanmgr_net
nss_pvxlanmgr_warn("%px: Tunnel enable failed: %d\n", dev, ret);
nss_pvxlanmgr_tunnel_tx_msg_disable(priv->pvxlan_ctx, priv->if_num_host_inner);
dev_put(dev);
- return ret;
+ return (nss_pvxlanmgr_status_t)ret;
}
dev_put(dev);
- return ret;
+ return (nss_pvxlanmgr_status_t)ret;
}
EXPORT_SYMBOL(nss_pvxlanmgr_netdev_enable);
@@ -524,7 +524,7 @@ EXPORT_SYMBOL(nss_pvxlanmgr_netdev_destr
* nss_pvxlanmgr_netdev_create()
* API to create a Pvxlan netdev
*/
-struct net_device *nss_pvxlanmgr_netdev_create()
+struct net_device *nss_pvxlanmgr_netdev_create(void)
{
struct nss_pvxlanmgr_priv *priv;
struct net_device *dev;
--- a/pvxlanmgr/nss_pvxlanmgr_tunnel.c
+++ b/pvxlanmgr/nss_pvxlanmgr_tunnel.c
@@ -67,7 +67,7 @@ static inline nss_pvxlanmgr_status_t nss
}
dev_put(dev);
- return status;
+ return (nss_pvxlanmgr_status_t)status;
}
/*
@@ -110,7 +110,7 @@ static inline nss_pvxlanmgr_status_t nss
}
dev_put(dev);
- return status;
+ return (nss_pvxlanmgr_status_t)status;
}
/*
@@ -138,7 +138,7 @@ static nss_pvxlanmgr_status_t nss_pvxlan
status = nss_pvxlanmgr_tunnel_tx_msg(ctx, &pvxlanmsg, if_num, NSS_PVXLAN_MSG_TYPE_TUNNEL_DESTROY_RULE, sizeof(struct nss_pvxlan_rule_msg));
if (status != NSS_TX_SUCCESS) {
nss_pvxlanmgr_warn("%px: ctx: create encap data tunnel error %d\n", ctx, status);
- return status;
+ return (nss_pvxlanmgr_status_t)status;
}
return NSS_PVXLANMGR_SUCCESS;
@@ -169,7 +169,7 @@ static nss_pvxlanmgr_status_t nss_pvxlan
status = nss_pvxlanmgr_tunnel_tx_msg(ctx, &pvxlanmsg, if_num, NSS_PVXLAN_MSG_TYPE_TUNNEL_CREATE_RULE, sizeof(struct nss_pvxlan_rule_msg));
if (status != NSS_TX_SUCCESS) {
nss_pvxlanmgr_warn("%px: ctx: create encap data tunnel error %d\n", ctx, status);
- return status;
+ return (nss_pvxlanmgr_status_t)status;
}
return NSS_PVXLANMGR_SUCCESS;
@@ -482,7 +482,7 @@ nss_pvxlanmgr_status_t nss_pvxlanmgr_tun
if_num_outer = priv->if_num_outer;
status = nss_pvxlanmgr_tunnel_pvxlan_rule_create(priv->pvxlan_ctx, if_num_host_inner, &pvxlan_rule);
- nss_pvxlanmgr_info("%px: dynamic interface if_num is :%d and pvxlan tunnel status:%d\n", dev, if_num_host_inner, status);
+ nss_pvxlanmgr_info("%px: dynamic interface if_num is :%d, if_num_outer :%d, and pvxlan tunnel status:%d\n", dev, if_num_host_inner, if_num_outer, status);
if (status != NSS_PVXLANMGR_SUCCESS) {
nss_pvxlanmgr_warn("%px: %d: PVXLAN rule create failed with status: %d\n", dev, if_num_host_inner, status);
dev_put(dev);
@@ -586,7 +586,7 @@ nss_pvxlanmgr_status_t nss_pvxlanmgr_tun
if_num_outer = priv->if_num_outer;
status = nss_pvxlanmgr_tunnel_pvxlan_rule_create(priv->pvxlan_ctx, if_num_host_inner, &pvxlan_rule);
- nss_pvxlanmgr_info("%px: dynamic interface if_num is :%d and pvxlan tunnel status:%d\n", dev, if_num_host_inner, status);
+ nss_pvxlanmgr_info("%px: dynamic interface if_num is :%d, if_num_outer :%d, and pvxlan tunnel status:%d\n", dev, if_num_host_inner, if_num_outer, status);
if (status != NSS_PVXLANMGR_SUCCESS) {
nss_pvxlanmgr_warn("%px: %d: PVXLAN rule create failed with status: %d\n", dev, if_num_host_inner, status);
dev_put(dev);
--- a/tls/nss_tlsmgr_crypto.c
+++ b/tls/nss_tlsmgr_crypto.c
@@ -250,7 +250,7 @@ nss_tlsmgr_status_t nss_tlsmgr_crypto_up
status = nss_tls_tx_msg_sync(ctx->nss_ctx, ctx->ifnum, msg_type, sizeof(*ntcu), &ntm);
if (status != NSS_TX_SUCCESS) {
nss_tlsmgr_warn("%px: Failed to configure decap, status:%d, error:%d", ctx, status, ntm.cm.error);
- return false;
+ return (nss_tlsmgr_status_t)false;
}
/*
@@ -361,7 +361,7 @@ nss_tlsmgr_status_t nss_tlsmgr_crypto_up
if (status != NSS_TX_SUCCESS) {
nss_tlsmgr_crypto_free(crypto);
nss_tlsmgr_warn("%px: Failed to configure decap, status:%d, error:%d", ctx, status, ntm.cm.error);
- return false;
+ return (nss_tlsmgr_status_t)false;
}
/*
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -448,8 +448,8 @@ static int nss_vlan_mgr_bond_configure_p
/*
* Fields for match
*/
- v->eg_xlt_rule.vsi_valid = true; /* Use vsi as search key*/
- v->eg_xlt_rule.vsi_enable = true; /* Use vsi as search key*/
+ v->eg_xlt_rule.vsi_valid = 1; /* Use vsi as search key*/
+ v->eg_xlt_rule.vsi_enable = 1; /* Use vsi as search key*/
v->eg_xlt_rule.vsi = vsi; /* Use vsi as search key*/
v->eg_xlt_rule.s_tagged = 0x7; /* Accept tagged/untagged/priority tagged svlan */
v->eg_xlt_rule.c_tagged = 0x7; /* Accept tagged/untagged/priority tagged cvlan */
@@ -612,8 +612,8 @@ static int nss_vlan_mgr_configure_ppe(st
/*
* Fields for match
*/
- v->eg_xlt_rule.vsi_valid = true; /* Use vsi as search key*/
- v->eg_xlt_rule.vsi_enable = true; /* Use vsi as search key*/
+ v->eg_xlt_rule.vsi_valid = 1; /* Use vsi as search key*/
+ v->eg_xlt_rule.vsi_enable = 1; /* Use vsi as search key*/
v->eg_xlt_rule.vsi = vsi; /* Use vsi as search key*/
v->eg_xlt_rule.s_tagged = 0x7; /* Accept tagged/untagged/priority tagged svlan */
v->eg_xlt_rule.c_tagged = 0x7; /* Accept tagged/untagged/priority tagged cvlan */
@@ -1805,8 +1805,8 @@ void nss_vlan_mgr_add_vlan_rule(struct n
/*
* Fields for match
*/
- eg_xlt_rule.vsi_valid = true; /* Use vsi as search key */
- eg_xlt_rule.vsi_enable = true; /* Use vsi as search key */
+ eg_xlt_rule.vsi_valid = 1; /* Use vsi as search key */
+ eg_xlt_rule.vsi_enable = 1; /* Use vsi as search key */
eg_xlt_rule.vsi = bridge_vsi; /* Use vsi as search key */
eg_xlt_rule.s_tagged = 0x7; /* Accept tagged/untagged/priority tagged svlan */
eg_xlt_rule.c_tagged = 0x7; /* Accept tagged/untagged/priority tagged cvlan */
@@ -1873,8 +1873,8 @@ void nss_vlan_mgr_del_vlan_rule(struct n
/*
* Fields for match
*/
- eg_xlt_rule.vsi_valid = true; /* Use vsi as search key */
- eg_xlt_rule.vsi_enable = true; /* Use vsi as search key */
+ eg_xlt_rule.vsi_valid = 1; /* Use vsi as search key */
+ eg_xlt_rule.vsi_enable = 1; /* Use vsi as search key */
eg_xlt_rule.vsi = bridge_vsi; /* Use vsi as search key */
eg_xlt_rule.s_tagged = 0x7; /* Accept tagged/untagged/priority tagged svlan */
eg_xlt_rule.c_tagged = 0x7; /* Accept tagged/untagged/priority tagged cvlan */
--- a/wifi_meshmgr/nss_wifi_meshmgr.c
+++ b/wifi_meshmgr/nss_wifi_meshmgr.c
@@ -1637,9 +1637,6 @@ nss_wifi_meshmgr_config_mesh_exception(n
break;
case NSS_WIFI_MESH_US_MESH_PROXY_NOT_FOUND:
- ifnum = decap_ifnum;
- break;
-
case NSS_WIFI_MESH_US_MESH_PATH_NOT_FOUND:
ifnum = decap_ifnum;
break;
--- a/netlink/nss_nlipsec.c
+++ b/netlink/nss_nlipsec.c
@@ -228,7 +228,7 @@ static void nss_nlipsec_process_event(vo
/*
* Initialize the NETLINK common header
*/
- nss_nlipsec_rule_init(nl_rule, ev->type);
+ nss_nlipsec_rule_init(nl_rule, (enum nss_nlipsec_cmd)ev->type);
/*
* Copy the contents of the sync message into the NETLINK message

View File

@@ -0,0 +1,852 @@
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,9 @@ qca-nss-tun6rd-objs := nss_connmgr_tun6r
ccflags-y += -DNSS_TUN6RD_DEBUG_LEVEL=0
ccflags-y += -Wall -Werror
+# Kernel 6.12 compatibility
+ccflags-y += -Wno-missing-prototypes -include $(src)/compat.h
+
KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION)))
obj-$(bridge-mgr)+= bridge/
--- a/bridge/nss_bridge_mgr.c
+++ b/bridge/nss_bridge_mgr.c
@@ -1486,7 +1486,7 @@ static struct notifier_block nss_bridge_
* nss_bridge_mgr_wan_inf_add_handler
* Marks an interface as a WAN interface for special handling by bridge.
*/
-static int nss_bridge_mgr_wan_intf_add_handler(struct ctl_table *table,
+static int nss_bridge_mgr_wan_intf_add_handler(compat_const struct ctl_table *table,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -1535,7 +1535,7 @@ static int nss_bridge_mgr_wan_intf_add_h
* nss_bridge_mgr_wan_inf_del_handler
* Un-marks an interface as a WAN interface.
*/
-static int nss_bridge_mgr_wan_intf_del_handler(struct ctl_table *table,
+static int nss_bridge_mgr_wan_intf_del_handler(compat_const struct ctl_table *table,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -1593,8 +1593,7 @@ static struct ctl_table nss_bridge_mgr_t
.maxlen = sizeof(char) * IFNAMSIZ,
.mode = 0644,
.proc_handler = &nss_bridge_mgr_wan_intf_del_handler,
- },
- { }
+ }
};
/*
--- a/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
+++ b/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
@@ -284,7 +284,11 @@ void nss_dtlsmgr_ctx_dev_rx_outer(struct
skb_set_transport_header(skb, sizeof(struct iphdr));
iph = ip_hdr(skb);
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, iph->daddr, iph->saddr, 0, 0);
+#else
+ rt = ip_route_output(&init_net, iph->daddr, iph->saddr, 0, 0, 0);
+#endif
if (IS_ERR(rt)) {
nss_dtlsmgr_warn("%px: No IPv4 route or out dev", dev);
dev_kfree_skb_any(skb);
--- a/gre/nss_connmgr_gre.c
+++ b/gre/nss_connmgr_gre.c
@@ -40,6 +40,12 @@
#define MAX_RETRY_COUNT 100
#define MAX_WIFI_HEADROOM 66
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
+#define TUNNEL_CSUM IP_TUNNEL_CSUM_BIT
+#define TUNNEL_SEQ IP_TUNNEL_SEQ_BIT
+#define TUNNEL_KEY IP_TUNNEL_KEY_BIT
+#endif
+
/*
* GRE connection manager context structure
*/
@@ -186,7 +192,12 @@ static int nss_connmgr_gre_dev_init(stru
if ((dev->priv_flags_ext & IFF_EXT_GRE_V4_TAP) || (dev->type == ARPHRD_IPGRE)) {
dev->needed_headroom = sizeof(struct iphdr) + sizeof(struct ethhdr) + MAX_WIFI_HEADROOM + append;
dev->mtu = ETH_DATA_LEN - sizeof(struct iphdr) - append;
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
dev->features |= NETIF_F_NETNS_LOCAL | NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA;
+#else
+ dev->features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA;
+ dev->netns_local = true;
+#endif
dev->hw_features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA;
return 0;
}
@@ -200,7 +211,11 @@ static int nss_connmgr_gre_dev_init(stru
dev->mtu = IPV6_MIN_MTU;
}
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
dev->features |= NETIF_F_NETNS_LOCAL;
+#else
+ dev->netns_local = true;
+#endif
return 0;
}
@@ -211,7 +226,6 @@ static int nss_connmgr_gre_dev_init(stru
static void nss_connmgr_gre_dev_uninit(struct net_device *dev)
{
free_percpu(dev->tstats);
- return;
}
/*
@@ -578,7 +592,6 @@ static void nss_connmgr_gre_tap_inner_ex
*/
skb->protocol = eth_type_trans(skb, dev);
netif_receive_skb(skb);
- return;
}
/*
@@ -724,10 +737,10 @@ static void nss_connmgr_gre_make_name(st
{
switch (cfg->mode) {
case GRE_MODE_TUN:
- strlcpy(name, "tun-%d", IFNAMSIZ);
+ strscpy(name, "tun-%d", IFNAMSIZ);
break;
case GRE_MODE_TAP:
- strlcpy(name, "tap-%d", IFNAMSIZ);
+ strscpy(name, "tap-%d", IFNAMSIZ);
break;
default:
break;
@@ -757,7 +770,7 @@ static struct net_device *__nss_connmgr_
int ret = -1, retry, next_if_num_inner = 0, next_if_num_outer = 0;
if (cfg->name) {
- strlcpy(name, cfg->name, IFNAMSIZ);
+ strscpy(name, cfg->name, IFNAMSIZ);
} else {
nss_connmgr_gre_make_name(cfg, name);
}
--- a/gre/nss_connmgr_gre_v4.c
+++ b/gre/nss_connmgr_gre_v4.c
@@ -45,7 +45,11 @@ static struct net_device *nss_connmgr_gr
struct net_device *dev;
uint32_t ip_addr __attribute__ ((unused)) = ntohl(dest_ip);
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, htonl(dest_ip), 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, htonl(dest_ip), 0, 0, 0, 0);
+#endif
if (IS_ERR(rt)) {
nss_connmgr_gre_warning("Unable to lookup route for %pI4\n", &ip_addr);
return NULL;
@@ -87,7 +91,11 @@ static int nss_connmgr_gre_v4_get_mac_ad
dev_put(local_dev);
nss_connmgr_gre_info("Src MAC address for %pI4 is %pM\n", &laddr, src_mac);
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, raddr, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, raddr, 0, 0, 0, 0);
+#endif
if (IS_ERR(rt)) {
nss_connmgr_gre_warning("route look up failed for %pI4\n", &raddr);
return GRE_ERR_RADDR_ROUTE_LOOKUP;
@@ -218,7 +226,7 @@ int nss_connmgr_gre_v4_set_config(struct
nss_connmgr_gre_set_gre_flags(cfg, &t->parms.o_flags, &t->parms.i_flags);
- strlcpy(t->parms.name, dev->name, IFNAMSIZ);
+ strscpy(t->parms.name, dev->name, IFNAMSIZ);
t->dev = dev;
return GRE_SUCCESS;
}
--- a/ipsecmgr/v1.0/nss_ipsecmgr.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr.c
@@ -526,7 +526,11 @@ static struct net_device *nss_ipsecmgr_t
}
if (!is_encap) {
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, iph->saddr, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, iph->saddr, 0, 0, 0, 0);
+#endif
if (IS_ERR(rt)) {
return NULL;
}
--- a/ipsecmgr/v1.0/nss_ipsecmgr_flow.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr_flow.c
@@ -915,7 +915,11 @@ bool nss_ipsecmgr_flow_process_pmtu(stru
if (unlikely(skb_dst(skb)))
goto send_icmp;
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, ip_hdr(skb)->daddr, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, ip_hdr(skb)->daddr, 0, 0, 0, 0);
+#endif
if (IS_ERR(rt)) {
return false;
}
--- a/ipsecmgr/v2.0/nss_ipsecmgr_ctx.c
+++ b/ipsecmgr/v2.0/nss_ipsecmgr_ctx.c
@@ -230,7 +230,11 @@ static void nss_ipsecmgr_ctx_notify_ipv4
* flow that coming in for the first time. We should query
* the Linux to see the associated NETDEV
*/
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, iph->saddr, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, iph->saddr, 0, 0, 0, 0);
+#endif
if (IS_ERR(rt)) {
dev_kfree_skb_any(skb);
ctx->hstats.v4_notify_drop++;
@@ -258,7 +262,11 @@ static void nss_ipsecmgr_ctx_route_ipv4(
struct iphdr *iph = ip_hdr(skb);
struct rtable *rt;
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, iph->daddr, iph->saddr, 0, 0);
+#else
+ rt = ip_route_output(&init_net, iph->daddr, iph->saddr, 0, 0, 0);
+#endif
if (unlikely(IS_ERR(rt))) {
nss_ipsecmgr_warn("%pK: No route, drop packet.\n", skb);
dev_kfree_skb_any(skb);
--- a/ipsecmgr/v2.0/plugins/xfrm/nss_ipsec_xfrm_tunnel.c
+++ b/ipsecmgr/v2.0/plugins/xfrm/nss_ipsec_xfrm_tunnel.c
@@ -149,7 +149,11 @@ static void nss_ipsec_xfrm_tunnel_rx_out
if (ip_hdr(skb)->version == IPVERSION) {
struct iphdr *iph = ip_hdr(skb);
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
struct rtable *rt = ip_route_output(&init_net, iph->daddr, iph->saddr, 0, 0);
+#else
+ struct rtable *rt = ip_route_output(&init_net, iph->daddr, iph->saddr, 0, 0, 0);
+#endif
if (unlikely(IS_ERR(rt))) {
nss_ipsec_xfrm_warn("%px: Failed to handle ipv4 exception after encap; No route\n", skb);
goto drop;
@@ -285,7 +289,11 @@ struct nss_ipsec_xfrm_tunnel *nss_ipsec_
switch (family) {
case AF_INET:
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, remote->a4, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, remote->a4, 0, 0, 0, 0);
+#endif
if (IS_ERR(rt)) {
nss_ipsec_xfrm_err("%p:Failed to allocate tunnel; No IPv4 dst found\n", drv);
return NULL;
--- a/l2tp/l2tpv2/nss_connmgr_l2tpv2.c
+++ b/l2tp/l2tpv2/nss_connmgr_l2tpv2.c
@@ -319,7 +319,7 @@ static struct nss_connmgr_l2tpv2_session
*/
dev_hold(dev);
l2tpv2_session_data->dev = dev;
- strlcpy(session->ifname, dev->name, IFNAMSIZ);
+ strscpy(session->ifname, dev->name, IFNAMSIZ);
/*
* There is no need for protecting simultaneous addition &
@@ -417,7 +417,11 @@ static void nss_connmgr_l2tpv2_exception
/*
* set skb_iif
*/
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, iph_inner->saddr, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, iph_inner->saddr, 0, 0, 0, 0);
+#endif
if (unlikely(IS_ERR(rt))) {
nss_connmgr_l2tpv2_warning("Martian packets !!!");
} else {
@@ -859,7 +863,7 @@ EXPORT_SYMBOL(l2tpmgr_unregister_ipsecmg
* nss_connmgr_l2tpv2_proc_handler()
* Read and write handler for sysctl.
*/
-static int nss_connmgr_l2tpv2_proc_handler(struct ctl_table *ctl,
+static int nss_connmgr_l2tpv2_proc_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -979,8 +983,7 @@ static struct ctl_table nss_connmgr_l2tp
.maxlen = L2TP_SYSCTL_STR_LEN_MAX,
.mode = 0644,
.proc_handler = &nss_connmgr_l2tpv2_proc_handler,
- },
- { }
+ }
};
/*
@@ -991,8 +994,7 @@ static struct ctl_table nss_connmgr_l2tp
.procname = "l2tpv2",
.mode = 0555,
.child = nss_connmgr_l2tpv2_table,
- },
- { }
+ }
};
/*
@@ -1003,8 +1005,7 @@ static struct ctl_table nss_connmgr_l2tp
.procname = "nss",
.mode = 0555,
.child = nss_connmgr_l2tpv2_dir,
- },
- { }
+ }
};
#endif
--- a/l2tp/l2tpv2/nss_l2tpv2_stats.c
+++ b/l2tp/l2tpv2/nss_l2tpv2_stats.c
@@ -129,7 +129,11 @@ void nss_l2tpv2_update_dev_stats(struct
dev_put(dev);
return;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
session = l2tp_tunnel_get_session(tunnel, data.l2tpv2.session.session_id);
+#else
+ session = l2tp_v2_session_get(dev_net(dev), data.l2tpv2.tunnel.tunnel_id, data.l2tpv2.session.session_id);
+#endif
if (!session) {
tunnel_put(tunnel);
dev_put(dev);
--- a/match/nss_match_cmd.c
+++ b/match/nss_match_cmd.c
@@ -124,7 +124,7 @@ static enum nss_match_profile_type nss_m
* nss_match_cmd_procfs_config_handler()
* Handles command input by user to create and configure match instance.
*/
-static int nss_match_cmd_procfs_config_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_match_cmd_procfs_config_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
char *command_str, *token, *param, *value;
char *input_msg, *input_msg_orig;
@@ -451,7 +451,7 @@ fail:
* nss_match_cmd_procfs_reset_nexthop
* Reset to default nexthop of an interface
*/
-static int nss_match_cmd_procfs_reset_nexthop(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_match_cmd_procfs_reset_nexthop(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct net_device *dev;
uint32_t if_num, type = 0;
@@ -521,7 +521,7 @@ static int nss_match_cmd_procfs_reset_ne
* Set next hop of an interface to a match instance.
* Only VAP and physical interfaces are supported as of now.
*/
-static int nss_match_cmd_procfs_set_if_nexthop(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_match_cmd_procfs_set_if_nexthop(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct net_device *dev;
uint32_t if_num, type = 0;
@@ -632,7 +632,7 @@ static int nss_match_cmd_procfs_set_if_n
* nss_match_cmd_procfs_read_help()
* Display help for commands.
*/
-static int nss_match_cmd_procfs_read_help(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_match_cmd_procfs_read_help(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
@@ -688,8 +688,7 @@ static struct ctl_table nss_match_table[
.maxlen = sizeof(nss_match_data),
.mode = 0400,
.proc_handler = &nss_match_cmd_procfs_read_help,
- },
- { }
+ }
};
static struct ctl_table_header *nss_match_ctl_header;
--- a/mirror/nss_mirror_ctl.c
+++ b/mirror/nss_mirror_ctl.c
@@ -132,7 +132,7 @@ static int nss_mirror_ctl_get_netdev_by_
{
char dev_name[IFNAMSIZ] = {0};
- strlcpy(dev_name, name, IFNAMSIZ);
+ strscpy(dev_name, name, IFNAMSIZ);
if (dev_name[strlen(dev_name) - 1] == '\n') {
dev_name[strlen(dev_name) - 1] = '\0';
}
@@ -357,7 +357,7 @@ static int nss_mirror_ctl_parse_display_
return -1;
}
- strlcpy(dev_name, value, IFNAMSIZ);
+ strscpy(dev_name, value, IFNAMSIZ);
if (dev_name[strlen(dev_name) - 1] == '\n') {
dev_name[strlen(dev_name) - 1] = '\0';
}
@@ -754,7 +754,7 @@ static int32_t nss_mirror_ctl_parse_cmd(
* nss_mirror_ctl_config_handler()
* Mirror sysctl config handler.
*/
-static int nss_mirror_ctl_config_handler(struct ctl_table *ctl, int write,
+static int nss_mirror_ctl_config_handler(compat_const struct ctl_table *ctl, int write,
void __user *buf, size_t *lenp, loff_t *ppos)
{
char *buffer, *pfree;
@@ -914,8 +914,7 @@ static struct ctl_table nss_mirror_table
.maxlen = sizeof(nss_mirror_config_data),
.mode = 0644,
.proc_handler = &nss_mirror_ctl_config_handler,
- },
- { }
+ }
};
/*
--- a/netlink/nss_nlipv4.c
+++ b/netlink/nss_nlipv4.c
@@ -129,7 +129,11 @@ static struct neighbour *nss_nlipv4_get_
/*
* search for route entry
*/
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, ip_addr, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, ip_addr, 0, 0, 0, 0);
+#endif
if (IS_ERR(rt)) {
return NULL;
}
--- a/netlink/nss_nludp_st.c
+++ b/netlink/nss_nludp_st.c
@@ -749,7 +749,11 @@ static struct neighbour *nss_nludp_st_ge
/*
* search for route entry
*/
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, ip_addr, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, ip_addr, 0, 0, 0, 0);
+#endif
if (IS_ERR(rt)) {
return NULL;
}
--- a/nss_qdisc/nss_bf.c
+++ b/nss_qdisc/nss_bf.c
@@ -381,7 +381,11 @@ static int nss_bf_graft_class(struct Qdi
*/
nss_qdisc_info("Grafting old: %px with new: %px\n", *old, new);
if (*old != &noop_qdisc) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
struct nss_qdisc *nq_old = (struct nss_qdisc *)qdisc_priv(*old);
+#else
+ struct nss_qdisc *nq_old = (struct nss_qdisc *)qdisc_priv(((struct Qdisc *)(*old)));
+#endif
nss_qdisc_info("Detaching old: %px\n", *old);
nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
if (nss_qdisc_node_detach(&cl->nq, nq_old, &nim_detach,
--- a/nss_qdisc/nss_qdisc.c
+++ b/nss_qdisc/nss_qdisc.c
@@ -374,7 +374,7 @@ static int nss_qdisc_refresh_bshaper_ass
br_update.port_list_count = 0;
br_update.unassign_count = 0;
- read_lock(&dev_base_lock);
+ /* read_lock(&dev_base_lock); */
dev = first_net_device(&init_net);
while(dev) {
@@ -421,7 +421,7 @@ static int nss_qdisc_refresh_bshaper_ass
nextdev:
dev = next_net_device(dev);
}
- read_unlock(&dev_base_lock);
+ /* read_unlock(&dev_base_lock); */
nss_qdisc_info("List count %d\n", br_update.port_list_count);
--- a/nss_qdisc/nss_tbl.c
+++ b/nss_qdisc/nss_tbl.c
@@ -350,7 +350,11 @@ static int nss_tbl_graft(struct Qdisc *s
nss_qdisc_info("Grafting old: %px with new: %px\n", *old, new);
if (*old != &noop_qdisc) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
struct nss_qdisc *nq_old = (struct nss_qdisc *)qdisc_priv(*old);
+#else
+ struct nss_qdisc *nq_old = (struct nss_qdisc *)qdisc_priv(((struct Qdisc *)(*old)));
+#endif
nss_qdisc_info("Detaching old: %px\n", *old);
nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
if (nss_qdisc_node_detach(&q->nq, nq_old, &nim_detach,
--- a/openvpn/plugins/nss_ovpn_sk.c
+++ b/openvpn/plugins/nss_ovpn_sk.c
@@ -225,7 +225,11 @@ static int nss_ovpn_sk_update_ipv4_tuple
{
struct rtable *rt;
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(dev_net(pinfo->dev), tun_data->tun_hdr.dst_ip[0], 0, 0, 0);
+#else
+ rt = ip_route_output(dev_net(pinfo->dev), tun_data->tun_hdr.dst_ip[0], 0, 0, 0, 0);
+#endif
if (unlikely(IS_ERR(rt))) {
nss_ovpn_sk_warn("%px: Failed to find IPv4 route.\n", pinfo);
return -EINVAL;
--- a/openvpn/src/nss_ovpnmgr_tun.c
+++ b/openvpn/src/nss_ovpnmgr_tun.c
@@ -69,7 +69,11 @@ static void nss_ovpnmgr_tun_ipv4_forward
skb_reset_network_header(skb);
iph = ip_hdr(skb);
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(dev_net(app->dev), iph->daddr, iph->saddr, 0, 0);
+#else
+ rt = ip_route_output(dev_net(app->dev), iph->daddr, iph->saddr, 0, 0, 0);
+#endif
if (unlikely(IS_ERR(rt))) {
nss_ovpnmgr_warn("%px: Failed to find IPv4 route.\n", skb);
tun->outer.stats.host_pkt_drop++;
--- a/tunipip6/nss_connmgr_tunipip6.c
+++ b/tunipip6/nss_connmgr_tunipip6.c
@@ -174,7 +174,11 @@ static void nss_tunipip6_encap_exception
nss_tunipip6_info("%px: received - %d bytes name %s ver %x\n",
skb, skb->len, dev->name, iph->version);
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, iph->daddr, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, iph->daddr, 0, 0, 0, 0);
+#endif
if (unlikely(IS_ERR(rt))) {
nss_tunipip6_info("%px: Failed to find IPv4 route for dest %pI4 src %pI4\n", skb, &iph->daddr, &iph->saddr);
dev_kfree_skb_any(skb);
@@ -284,7 +288,11 @@ static void nss_tunipip6_decap_exception
iph = ip_hdr(skb);
nss_tunipip6_assert(iph->version == 4);
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, iph->daddr, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, iph->daddr, 0, 0, 0, 0);
+#endif
if (unlikely(IS_ERR(rt))) {
nss_tunipip6_info("%px: Failed to find IPv4 route for %pI4\n", skb, &iph->daddr);
dev_kfree_skb_any(skb);
--- a/tunipip6/nss_connmgr_tunipip6_sysctl.c
+++ b/tunipip6/nss_connmgr_tunipip6_sysctl.c
@@ -52,7 +52,7 @@ enum nss_tunipip6_sysctl_mode {
};
-static int nss_tunipip6_data_parser(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos, enum nss_tunipip6_sysctl_mode mode)
+static int nss_tunipip6_data_parser(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos, enum nss_tunipip6_sysctl_mode mode)
{
char dev_name[NETDEV_STR_LEN] = {0}, ipv6_prefix_str[PREFIX_STR_LEN] = {0}, ipv6_suffix_str[PREFIX_STR_LEN] = {0}, ipv4_prefix_str[PREFIX_STR_LEN] = {0};
uint32_t ipv6_prefix[4], ipv6_prefix_len, ipv6_suffix[4], ipv6_suffix_len, ipv4_prefix, ipv4_prefix_len, ea_len, psid_offset;
@@ -108,7 +108,7 @@ static int nss_tunipip6_data_parser(stru
*/
if (!strcmp(param, "netdev")) {
- strlcpy(dev_name, value, 30);
+ strscpy(dev_name, value, 30);
dev = dev_get_by_name(&init_net, dev_name);
if (!dev) {
kfree(pfree);
@@ -147,7 +147,7 @@ static int nss_tunipip6_data_parser(stru
}
if (!strcmp(param, "ipv4_prefix")) {
- strlcpy(ipv4_prefix_str, value, 30);
+ strscpy(ipv4_prefix_str, value, 30);
ret = in4_pton(ipv4_prefix_str, -1, (uint8_t *)&ipv4_prefix, -1, NULL);
if (ret != 1) {
kfree(pfree);
@@ -173,7 +173,7 @@ static int nss_tunipip6_data_parser(stru
}
if (!strcmp(param, "ipv6_prefix")) {
- strlcpy(ipv6_prefix_str, value, 100);
+ strscpy(ipv6_prefix_str, value, 100);
ret = in6_pton(ipv6_prefix_str, -1, (uint8_t *)&ipv6_prefix, -1, NULL);
if (ret != 1) {
kfree(pfree);
@@ -199,7 +199,7 @@ static int nss_tunipip6_data_parser(stru
}
if (!strcmp(param, "ipv6_suffix")) {
- strlcpy(ipv6_suffix_str, value, 100);
+ strscpy(ipv6_suffix_str, value, 100);
ret = in6_pton(ipv6_suffix_str, -1, (uint8_t *)&ipv6_suffix, -1, NULL);
if (ret != 1) {
kfree(pfree);
@@ -368,27 +368,27 @@ fail:
return 0;
}
-static int nss_tunipip6_cmd_procfs_add_maprule(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_tunipip6_cmd_procfs_add_maprule(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
return nss_tunipip6_data_parser(ctl, write, buffer, lenp, ppos, NSS_TUNIPIP6_SYSCTL_ADD_MAPRULE);
}
-static int nss_tunipip6_cmd_procfs_del_maprule(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_tunipip6_cmd_procfs_del_maprule(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
return nss_tunipip6_data_parser(ctl, write, buffer, lenp, ppos, NSS_TUNIPIP6_SYSCTL_DEL_MAPRULE);
}
-static int nss_tunipip6_cmd_procfs_flush_fmr_rule(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_tunipip6_cmd_procfs_flush_fmr_rule(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
return nss_tunipip6_data_parser(ctl, write, buffer, lenp, ppos, NSS_TUNIPIP6_SYSCTL_FLUSH_FMR_RULE);
}
-static int nss_tunipip6_cmd_procfs_enable_frag_id(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_tunipip6_cmd_procfs_enable_frag_id(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
return nss_tunipip6_data_parser(ctl, write, buffer, lenp, ppos, NSS_TUNIPIP6_SYSCTL_FRAG_ID);
}
-static int nss_tunipip6_cmd_procfs_read_help(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_tunipip6_cmd_procfs_read_help(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
@@ -445,8 +445,7 @@ static struct ctl_table nss_tunipip6_tab
.maxlen = sizeof(nss_tunipip6_data),
.mode = 0400,
.proc_handler = &nss_tunipip6_cmd_procfs_read_help,
- },
- { }
+ }
};
static struct ctl_table_header *nss_tunipip6_ctl_header;
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -1549,7 +1549,7 @@ static int nss_vlan_mgr_update_ppe_tpid(
* nss_vlan_mgr_tpid_proc_handler()
* Sets customer TPID and service TPID
*/
-static int nss_vlan_mgr_tpid_proc_handler(struct ctl_table *ctl,
+static int nss_vlan_mgr_tpid_proc_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -1577,8 +1577,7 @@ static struct ctl_table nss_vlan_table[]
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &nss_vlan_mgr_tpid_proc_handler,
- },
- { }
+ }
};
/*
--- a/nss_qdisc/nss_htb.c
+++ b/nss_qdisc/nss_htb.c
@@ -642,7 +642,11 @@ static int nss_htb_graft_class(struct Qd
nss_qdisc_info("grafting old: %x with new: %x\n", (*old)->handle, new->handle);
if (*old != &noop_qdisc) {
nss_qdisc_trace("detaching old: %x\n", (*old)->handle);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
nq_old = qdisc_priv(*old);
+#else
+ nq_old = qdisc_priv(((struct Qdisc *)(*old)));
+#endif
nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
nim_detach.msg.shaper_configure.config.msg.shaper_node_config.snc.htb_group_detach.child_qos_tag = nq_old->qos_tag;
if (nss_qdisc_node_detach(&cl->nq, nq_old, &nim_detach,
--- a/nss_qdisc/nss_wrr.c
+++ b/nss_qdisc/nss_wrr.c
@@ -488,7 +488,11 @@ static int nss_wrr_graft_class(struct Qd
*/
nss_qdisc_info("Grafting old: %px with new: %px\n", *old, new);
if (*old != &noop_qdisc) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
struct nss_qdisc *nq_child = qdisc_priv(*old);
+#else
+ struct nss_qdisc *nq_child = qdisc_priv(((struct Qdisc *)(*old)));
+#endif
nss_qdisc_info("Detaching old: %px\n", *old);
nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
if (nss_qdisc_node_detach(&cl->nq, nq_child, &nim_detach,
--- a/gre/test/nss_connmgr_gre_test.c
+++ b/gre/test/nss_connmgr_gre_test.c
@@ -143,7 +143,7 @@ static ssize_t nss_connmgr_gre_test_writ
* parameter parsing for delete command
*/
if (!strcmp(param, "dev")) {
- strlcpy(dev_name, value, IFNAMSIZ);
+ strscpy(dev_name, value, IFNAMSIZ);
dev_name_valid = true;
break;
}
@@ -153,19 +153,19 @@ static ssize_t nss_connmgr_gre_test_writ
* tap create command
*/
if (!strcmp(param, "next_dev")) {
- strlcpy(dev_name, value, IFNAMSIZ);
+ strscpy(dev_name, value, IFNAMSIZ);
dev_name_valid = true;
continue;
}
if (!strcmp(param, "saddr")) {
- strlcpy(saddr, value, 20);
+ strscpy(saddr, value, 20);
saddr_valid = true;
continue;
}
if (!strcmp(param, "daddr")) {
- strlcpy(daddr, value, 20);
+ strscpy(daddr, value, 20);
daddr_valid = true;
continue;
}
--- a/clmapmgr/nss_clmapmgr.c
+++ b/clmapmgr/nss_clmapmgr.c
@@ -185,7 +185,7 @@ static void nss_clmapmgr_setup(struct ne
{
char name[IFNAMSIZ] = {0};
- strlcpy(name, "nssclmap%d", IFNAMSIZ);
+ strscpy(name, "nssclmap%d", IFNAMSIZ);
memcpy(dev->name, name, IFNAMSIZ);
dev->netdev_ops = &nss_clmapmgr_ops;
eth_hw_addr_random(dev);
--- a/portifmgr/nss_portifmgr.c
+++ b/portifmgr/nss_portifmgr.c
@@ -266,7 +266,7 @@ struct net_device *nss_portifmgr_create_
ndev->vlan_features |= NSS_PORTIFMGR_SUPPORTED_FEATURES;
ndev->wanted_features |= NSS_PORTIFMGR_SUPPORTED_FEATURES;
ndev->mtu = real_dev->mtu - NSS_PORTIFMGR_EXTRA_HEADER_SIZE;
- strlcpy(ndev->name, name, IFNAMSIZ);
+ strscpy(ndev->name, name, IFNAMSIZ);
/*
* Setup temp mac address, this can be changed with ifconfig later
--- a/profiler/profile.c
+++ b/profiler/profile.c
@@ -138,7 +138,7 @@ int profile_register_performance_counter
}
profile_counter[i] = counter;
- strlcpy(profile_name[i], name, PROFILE_COUNTER_NAME_LENGTH);
+ strscpy(profile_name[i], name, PROFILE_COUNTER_NAME_LENGTH);
profile_name[i][PROFILE_COUNTER_NAME_LENGTH - 1] = 0;
return 1;
@@ -317,7 +317,7 @@ static int profile_make_stats_packet(cha
counter_ptr = (struct profile_counter *)ptr;
for (n = 0; n < profile_num_counters; ++n) {
counter_ptr->value = htonl(*profile_counter[n]);
- strlcpy(counter_ptr->name, profile_name[n],
+ strscpy(counter_ptr->name, profile_name[n],
PROFILE_COUNTER_NAME_LENGTH);
counter_ptr++;
}
--- a/gre/nss_connmgr_gre_v6.c
+++ b/gre/nss_connmgr_gre_v6.c
@@ -324,7 +324,7 @@ int nss_connmgr_gre_v6_set_config(struct
nss_connmgr_gre_set_gre_flags(cfg, &t->parms.o_flags, &t->parms.i_flags);
- strlcpy(t->parms.name, dev->name, IFNAMSIZ);
+ strscpy(t->parms.name, dev->name, IFNAMSIZ);
t->dev = dev;
return GRE_SUCCESS;
}
--- /dev/null
+++ b/compat.h
@@ -0,0 +1,15 @@
+// compat.h
+#ifndef _COMPAT_H
+#define _COMPAT_H
+
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
+#include <linux/vmalloc.h>
+#define compat_const const
+#define strlcpy strscpy
+#else
+#define compat_const
+#endif
+
+#endif /* _COMPAT_H */
--- a/nss_qdisc/nss_prio.c
+++ b/nss_qdisc/nss_prio.c
@@ -341,7 +341,11 @@ static int nss_prio_graft(struct Qdisc *
nss_qdisc_info("Grafting old: %px with new: %px\n", *old, new);
if (*old != &noop_qdisc) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
struct nss_qdisc *nq_old = qdisc_priv(*old);
+#else
+ struct nss_qdisc *nq_old = qdisc_priv(((struct Qdisc *)(*old)));
+#endif
nss_qdisc_info("Detaching old: %px\n", *old);
nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
--- a/netlink/nss_nldtls.c
+++ b/netlink/nss_nldtls.c
@@ -1108,7 +1108,7 @@ static ssize_t nss_nldtls_tunnel_stats_r
list_for_each_entry(entry, &gbl_ctx.dtls_list_head, list) {
spin_lock_bh(&gbl_ctx.lock);
memcpy(&stats, &entry->stats, sizeof(stats));
- strlcpy(dev_name, entry->dev_name, IFNAMSIZ);
+ strscpy(dev_name, entry->dev_name, IFNAMSIZ);
spin_unlock_bh(&gbl_ctx.lock);
size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n--------------------------------");
--- a/netlink/nss_nlipsec.c
+++ b/netlink/nss_nlipsec.c
@@ -394,7 +394,7 @@ static int nss_nlipsec_op_create_tunnel(
* the tunnel I/F name into the same rule and send it
* as part of the response for the create operation
*/
- strlcpy(nl_rule->ifname, dev->name, IFNAMSIZ);
+ strscpy(nl_rule->ifname, dev->name, IFNAMSIZ);
/*
* Send to userspace
--- a/openvpn/src/nss_ovpnmgr_app.c
+++ b/openvpn/src/nss_ovpnmgr_app.c
@@ -51,7 +51,11 @@ static struct net_device *nss_ovpnmgr_ap
struct rtable *rt4;
if (rt->ip_version == IPVERSION) {
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 10, 0)
rt4 = ip_route_output(&init_net, rt->ip_addr[0], 0, 0, 0);
+#else
+ rt4 = ip_route_output(&init_net, rt->ip_addr[0], 0, 0, 0, 0);
+#endif
if (IS_ERR(rt4)) {
return NULL;
}
--- a/bridge/Makefile
+++ b/bridge/Makefile
@@ -1,4 +1,4 @@
-ccflags-y := -I$(obj)/../exports -I$(obj)/.. -I$(obj)/nss_hal/include
+ccflags-y := -I$(obj)/../exports -I$(obj)/.. -I$(obj)/nss_hal/include -include $(obj)/../compat.h
ccflags-y += -DNSS_CLIENT_BUILD_ID="$(BUILD_ID)"
ccflags-$(NSS_BRIDGE_MGR_OVS_ENABLE) += -DNSS_BRIDGE_MGR_OVS_ENABLE
--- a/vlan/Makefile
+++ b/vlan/Makefile
@@ -1,4 +1,4 @@
-ccflags-y := -I$(obj)/../exports -I$(obj)/.. -I$(obj)/nss_hal/include
+ccflags-y := -I$(obj)/../exports -I$(obj)/.. -I$(obj)/nss_hal/include -include $(obj)/../compat.h
ccflags-y += -DNSS_CLIENT_BUILD_ID="$(BUILD_ID)"
obj-m += qca-nss-vlan.o

View File

@@ -0,0 +1,406 @@
--- a/match/nss_match_cmd.c
+++ b/match/nss_match_cmd.c
@@ -127,29 +127,30 @@ static enum nss_match_profile_type nss_m
static int nss_match_cmd_procfs_config_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
char *command_str, *token, *param, *value;
- char *input_msg, *input_msg_orig;
+ char *input_msg, *pos;
nss_match_cmd_t command;
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
size_t count = *lenp;
int ret = proc_dostring(ctl, write, buffer, lenp, ppos);
+ char cmd_buf[100] = {0}; /* Use a fixed buffer size matching nss_match_data */
if (!write) {
return ret;
}
- input_msg = (char *)kzalloc(count + 1, GFP_KERNEL);
- if (!input_msg) {
- nss_match_warn("%px: Dynamic allocation falied while writing input message from file", ctl);
- return -ENOMEM;
+ if (count >= sizeof(cmd_buf)) {
+ nss_match_warn("%px: Input too large: %zu\n", ctl, count);
+ return -EINVAL;
}
- input_msg_orig = input_msg;
- if (copy_from_user(input_msg, buffer, count)) {
- kfree(input_msg);
- nss_match_warn("%px: Cannot copy user's entry to kernel memory\n", ctl);
- return -EFAULT;
+ memcpy(cmd_buf, buffer, count);
+ cmd_buf[count] = '\0'; /* Ensure null termination */
+
+ if ((pos = strrchr(cmd_buf, '\n')) != NULL) {
+ *pos = '\0';
}
+ input_msg = cmd_buf;
command_str = strsep(&input_msg, " ");
command = nss_match_cmd_parse(command_str);
@@ -161,20 +162,17 @@ static int nss_match_cmd_procfs_config_h
profile_type = nss_match_cmd_get_profile_type(input_msg);
if (profile_type == NSS_MATCH_PROFILE_TYPE_NONE) {
pr_warn("%px: Please provide a valid profile type\n", ctl);
- kfree(input_msg_orig);
return -EINVAL;
}
table_id = nss_match_instance_create();
if (table_id <= 0) {
pr_warn("%px: Cannot create a new match instance\n", ctl);
- kfree(input_msg_orig);
return -EINVAL;
}
nss_match_db_profile_type_add(profile_type, table_id);
pr_warn("%px: New match instance created, table_id = %d\n", ctl, table_id);
- kfree(input_msg_orig);
return count;
}
@@ -194,32 +192,27 @@ static int nss_match_cmd_procfs_config_h
ret = sscanf(value, "%u", &table_id);
if (!ret) {
pr_warn("%px: Cannot convert to integer. Wrong input!!", ctl);
- kfree(input_msg_orig);
return -EINVAL;
}
}
if (table_id == 0 || table_id > NSS_MATCH_INSTANCE_MAX) {
pr_warn("%px: Invalid table_id %d", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
if (nss_match_db_table_validate(table_id)) {
pr_warn("%px: Table is already configured, %d", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
if (nss_match_db_parse_cmd(table_id, input_msg, &input_mask_param, NSS_MATCH_ADD_MASK)) {
- kfree(input_msg_orig);
return -EINVAL;
}
nss_match_db_mask_add(&input_mask_param.msg.configure_msg, table_id);
pr_warn("%px: Mask added to instance successfully. %d", ctl, table_id);
- kfree(input_msg_orig);
return count;
}
@@ -240,43 +233,36 @@ static int nss_match_cmd_procfs_config_h
ret = sscanf(value, "%u", &table_id);
if (!ret) {
pr_warn("%px: Cannot convert to integer. Wrong input!!", ctl);
- kfree(input_msg_orig);
return -EINVAL;
}
}
if ((table_id == 0) || (table_id > NSS_MATCH_INSTANCE_MAX)) {
pr_warn("%px: Invalid table_id %d", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
if (nss_match_db_table_validate(table_id)) {
pr_warn("%px: Table is already configured, %d", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
if (!nss_match_db_instance_config_get(&config_msg, &if_num, table_id)) {
pr_warn("%px: Unable to fetch stored configuration %d", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
if (if_num < 0) {
nss_match_warn("%px: Incorrect interface number: %d\n", ctl, if_num);
- kfree(input_msg_orig);
return -EINVAL;
}
if (nss_match_cmd_enable_instance(&config_msg, if_num, table_id)) {
pr_warn("%px: Failed to enable table %d\n", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
pr_warn("%px: Table %d enabled successfully\n", ctl, table_id);
- kfree(input_msg_orig);
return count;
}
@@ -298,14 +284,12 @@ static int nss_match_cmd_procfs_config_h
ret = sscanf(value, "%u", &table_id);
if (!ret) {
pr_warn("%px: Cannot convert to integer. Wrong input!!", ctl);
- kfree(input_msg_orig);
return -EINVAL;
}
}
if (table_id == 0 || table_id > NSS_MATCH_INSTANCE_MAX) {
pr_warn("%px: Invalid table_id: %d", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
@@ -313,7 +297,6 @@ static int nss_match_cmd_procfs_config_h
if (nss_match_db_parse_cmd(table_id, input_msg, &input_rule_param, NSS_MATCH_ADD_RULE)) {
pr_warn("%px: Wrong input", ctl);
- kfree(input_msg_orig);
return -EINVAL;
}
@@ -325,12 +308,10 @@ static int nss_match_cmd_procfs_config_h
if (rule_id < 0) {
pr_warn("%px: Failed to add rule into table %d.\n", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
pr_warn("%px: Rule added to table %d successfully with rule_id: %d\n", ctl, table_id, rule_id);
- kfree(input_msg_orig);
return count;
}
@@ -352,7 +333,6 @@ static int nss_match_cmd_procfs_config_h
if (!(strncasecmp(param, "rule_id", strlen("rule_id")))) {
if (!sscanf(token, "%hu", &rule_id)) {
pr_warn("%px: Cannot convert to integer. Wrong input\n", ctl);
- kfree(input_msg_orig);
return -EINVAL;
}
continue;
@@ -361,36 +341,30 @@ static int nss_match_cmd_procfs_config_h
if (!strncasecmp(param, "table_id", strlen("table_id"))) {
if (!sscanf(token, "%u", &table_id)) {
pr_warn("%px: Cannot convert to integer. Wrong input!!", ctl);
- kfree(input_msg_orig);
return -EINVAL;
}
continue;
}
- kfree(input_msg_orig);
return -EINVAL;
}
if (table_id == 0 || table_id > NSS_MATCH_INSTANCE_MAX) {
pr_warn("%px: Invalid table_id: %d", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
if (rule_id == 0 || rule_id > NSS_MATCH_INSTANCE_RULE_MAX) {
pr_warn("%px: Invalid rule_id: %d", ctl, rule_id);
- kfree(input_msg_orig);
return -EINVAL;
}
if (nss_match_rule_delete(nss_ctx, rule_id, table_id)) {
pr_warn("%px: Failed to delete rule from table %d.\n", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
pr_warn("%px: Rule deleted from table %d successfully\n", ctl, table_id);
- kfree(input_msg_orig);
return count;
}
@@ -410,39 +384,33 @@ static int nss_match_cmd_procfs_config_h
ret = sscanf(token, "%u", &table_id);
if (!ret) {
pr_warn("%px: Cannot convert to integer. Wrong input!!", input_msg);
- kfree(input_msg_orig);
return -EINVAL;
}
}
if (table_id == 0 || table_id > NSS_MATCH_INSTANCE_MAX) {
pr_warn("%px: Invalid table_id: %d", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
if (nss_match_instance_destroy(table_id)) {
pr_warn("%px: Failed to destroy table %d\n", ctl, table_id);
- kfree(input_msg_orig);
return -EINVAL;
}
pr_warn("%px: Table %d destroyed successfully.\n", ctl, table_id);
- kfree(input_msg_orig);
return count;
}
default:
{
pr_warn("%px: Input command is not as per syntax, Please enter a valid command", ctl);
- kfree(input_msg_orig);
return -EINVAL;
}
}
fail:
pr_warn("%px: Wrong input, check help. (cat /proc/sys/dev/nss/match/help)", ctl);
- kfree(input_msg_orig);
return ret;
}
@@ -456,11 +424,12 @@ static int nss_match_cmd_procfs_reset_ne
struct net_device *dev;
uint32_t if_num, type = 0;
int ret;
- char *dev_name;
- char *cmd_buf = nss_match_data;
+ char *pos;
+ char cmd_buf[IFNAMSIZ] = {0};
nss_tx_status_t nss_tx_status;
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
struct nss_ctx_instance *wifili_nss_ctx = nss_wifili_get_context();
+ size_t count = *lenp;
if (!nss_ctx || !wifili_nss_ctx) {
pr_warn("%px: NSS Context not found. wifili_nss_ctx: %px. Reset nexthop failed", nss_ctx, wifili_nss_ctx);
@@ -473,19 +442,30 @@ static int nss_match_cmd_procfs_reset_ne
return ret;
}
+ if (count >= sizeof(cmd_buf)) {
+ nss_match_warn("%px: Input too large: %zu\n", ctl, count);
+ return -EINVAL;
+ }
+
+ memcpy(cmd_buf, buffer, count);
+ cmd_buf[count] = '\0'; /* Ensure null termination */
+
+ if ((pos = strrchr(cmd_buf, '\n')) != NULL) {
+ *pos = '\0';
+ }
+
/*
* Parse and read the devname from command.
*/
- dev_name = strsep(&cmd_buf, "\0");
- dev = dev_get_by_name(&init_net, dev_name);
+ dev = dev_get_by_name(&init_net, cmd_buf);
if (!dev) {
- pr_warn("%px: Cannot find the net device: %s. Reset nexthop failed.\n", nss_ctx, dev_name);
+ pr_warn("%px: Cannot find the net device: %s. Reset nexthop failed.\n", nss_ctx, cmd_buf);
return -ENODEV;
}
if_num = nss_cmn_get_interface_number_by_dev(dev);
if (if_num < 0) {
- pr_warn("%px: Invalid if_num for interface: %s. Reset nexthop failed.\n", nss_ctx, dev_name);
+ pr_warn("%px: Invalid if_num for interface: %s. Reset nexthop failed.\n", nss_ctx, cmd_buf);
dev_put(dev);
return -ENODEV;
}
@@ -529,7 +509,7 @@ static int nss_match_cmd_procfs_set_if_n
int table_id;
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
struct nss_ctx_instance *wifili_nss_ctx = nss_wifili_get_context();
- char *dev_name, *nexthop_msg;
+ char *dev_name, *pos;
char *cmd_buf = NULL;
size_t count = *lenp;
nss_tx_status_t nss_tx_status;
@@ -544,31 +524,28 @@ static int nss_match_cmd_procfs_set_if_n
return -ENOMEM;
}
- cmd_buf = (char *)kzalloc(count + 1, GFP_KERNEL);
- nexthop_msg = cmd_buf;
- if (!cmd_buf) {
- pr_warn("%px: Cannot allocate buffer to read input", nss_ctx);
- return -ENOMEM;
+ if (count >= sizeof(cmd_buf)) {
+ nss_match_warn("%px: Input too large: %zu\n", ctl, count);
+ return -EINVAL;
}
- if (copy_from_user(cmd_buf, buffer, count)) {
- kfree(nexthop_msg);
- pr_warn("%px: Cannot copy user's entry to kernel memory\n", nss_ctx);
- return -EFAULT;
+ memcpy(cmd_buf, buffer, count);
+ cmd_buf[count] = '\0'; /* Ensure null termination */
+
+ if ((pos = strrchr(cmd_buf, '\n')) != NULL) {
+ *pos = '\0';
}
dev_name = strsep(&cmd_buf, " ");
dev = dev_get_by_name(&init_net, dev_name);
if (!dev) {
pr_warn("%px: Cannot find the net device\n", nss_ctx);
- kfree(nexthop_msg);
return -ENODEV;
}
if_num = nss_cmn_get_interface_number_by_dev(dev);
if (if_num < 0) {
pr_warn("%px: Invalid interface number:%d\n", nss_ctx, if_num);
- kfree(nexthop_msg);
dev_put(dev);
return -ENODEV;
}
@@ -576,20 +553,17 @@ static int nss_match_cmd_procfs_set_if_n
if (isdigit(cmd_buf[0])) {
if (!sscanf(cmd_buf, "%u", &nh_if_num)) {
pr_warn("%px, Failed to write the nexthop if_num token to integer\n", nss_ctx);
- kfree(nexthop_msg);
dev_put(dev);
return -EFAULT;
}
} else {
pr_warn("%px: Invalid nexthop interface number.\n", nss_ctx);
- kfree(nexthop_msg);
dev_put(dev);
return -ENODEV;
}
if (nh_if_num < 0) {
pr_warn("%px: Invalid nexthop interface number:%d\n", nss_ctx, if_num);
- kfree(nexthop_msg);
dev_put(dev);
return -ENODEV;
}
@@ -597,7 +571,6 @@ static int nss_match_cmd_procfs_set_if_n
table_id = nss_match_get_table_id_by_ifnum(nh_if_num);
if (table_id <= 0 || table_id > NSS_MATCH_INSTANCE_MAX) {
pr_warn("Invalid match interface. Failed to set %d as nexthop.\n", nh_if_num);
- kfree(nexthop_msg);
dev_put(dev);
return -EFAULT;
}
@@ -614,7 +587,6 @@ static int nss_match_cmd_procfs_set_if_n
nss_tx_status = nss_phys_if_set_nexthop(nss_ctx, if_num, nh_if_num);
} else {
pr_warn("Invalid interface to set nexthop. Failed to set nexthop on if_num %d.\n", if_num);
- kfree(nexthop_msg);
dev_put(dev);
return -EFAULT;
}
@@ -623,7 +595,6 @@ static int nss_match_cmd_procfs_set_if_n
pr_warn("%px: Sending message failed, cannot change nexthop\n", nss_ctx);
}
- kfree(nexthop_msg);
dev_put(dev);
return ret;
}

View File

@@ -1,13 +1,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=qca-nss-dp
PKG_RELEASE:=2
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-dp.git
PKG_SOURCE_URL:=https://github.com/openwrt/qca-nss-dp.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2024-04-16
PKG_SOURCE_VERSION:=5bf8b91e9fc209f175f9a58723b03055ace3d581
PKG_MIRROR_HASH:=c50fefd3debbc01040f900c20da9a9bb6ae36aa72a532362aae1152e83c203a0
PKG_SOURCE_DATE:=2025-05-12
PKG_SOURCE_VERSION:=07b87bf513ffe58ce8dd00eb2edf68b5b9bde518
PKG_MIRROR_HASH:=04f2af2dd30db529b5f016da89405cc405ffb0108c945c4b415a794f0036597f
PKG_BUILD_PARALLEL:=1
PKG_FLAGS:=nonshared
@@ -47,8 +47,7 @@ define Build/Compile
+$(KERNEL_MAKE) $(PKG_JOBS) \
-C "$(LINUX_DIR)" \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
SoC="$(CONFIG_TARGET_SUBTARGET)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(CONFIG_TARGET_SUBTARGET)" \
modules
endef

View File

@@ -1,48 +0,0 @@
From 946381fd6fdabedf2b5a1d8647a49e3da8f1894e Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Fri, 23 Jun 2023 11:28:02 +0200
Subject: [PATCH 1/8] nss-dp: Drop _nocache variants of ioremap()
ioremap_nocache was made equivelant to ioremap and was dropped.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 2 +-
hal/gmac_ops/syn/gmac/syn_if.c | 2 +-
hal/soc_ops/ipq50xx/nss_ipq50xx.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
@@ -279,7 +279,7 @@ int edma_init(void)
/*
* Remap register resource
*/
- edma_hw.reg_base = ioremap_nocache((edma_hw.reg_resource)->start,
+ edma_hw.reg_base = ioremap((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");
--- a/hal/gmac_ops/syn/gmac/syn_if.c
+++ b/hal/gmac_ops/syn/gmac/syn_if.c
@@ -806,7 +806,7 @@ static void *syn_init(struct nss_gmac_ha
* Populate the mac base addresses
*/
shd->nghd.mac_base =
- devm_ioremap_nocache(&dp_priv->pdev->dev, res->start,
+ devm_ioremap(&dp_priv->pdev->dev, res->start,
resource_size(res));
if (!shd->nghd.mac_base) {
netdev_dbg(ndev, "ioremap fail.\n");
--- a/hal/soc_ops/ipq50xx/nss_ipq50xx.c
+++ b/hal/soc_ops/ipq50xx/nss_ipq50xx.c
@@ -89,7 +89,7 @@ static void nss_dp_hal_tcsr_set(void)
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_addr = ioremap((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__);

View File

@@ -1,47 +0,0 @@
From 3357c64b3fc63fe003d5ef02ba7f6abca64d80bf Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Mon, 3 May 2021 20:07:36 +0300
Subject: [PATCH 2/8] edma_tx_rx: support newer kernels time stamping API
Timestamping API has changed in kernel 5.6, so update the implementation
for newer kernels.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 11 +++++++++++
1 file changed, 11 insertions(+)
--- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
@@ -227,10 +227,16 @@ void nss_phy_tstamp_rx_buf(__attribute__
* set to the correct PTP class value by calling ptp_classify_raw
* in drv->rxtstamp function.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
if (ndev && ndev->phydev && ndev->phydev->drv &&
ndev->phydev->drv->rxtstamp)
if(ndev->phydev->drv->rxtstamp(ndev->phydev, skb, 0))
return;
+#else
+ if (ndev && phy_has_rxtstamp(ndev->phydev))
+ if (phy_rxtstamp(ndev->phydev, skb, 0))
+ return;
+#endif
netif_receive_skb(skb);
}
@@ -248,9 +254,14 @@ void nss_phy_tstamp_tx_buf(struct net_de
* set to the correct PTP class value by calling ptp_classify_raw
* in the drv->txtstamp function.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
if (ndev && ndev->phydev && ndev->phydev->drv &&
ndev->phydev->drv->txtstamp)
ndev->phydev->drv->txtstamp(ndev->phydev, skb, 0);
+#else
+ if (ndev && phy_has_txtstamp(ndev->phydev))
+ phy_txtstamp(ndev->phydev, skb, 0);
+#endif
}
EXPORT_SYMBOL(nss_phy_tstamp_tx_buf);

View File

@@ -1,31 +0,0 @@
From c36420c219bf0e03842a11f69193c802eb42030a Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 20 May 2021 14:56:46 +0200
Subject: [PATCH 3/8] EDMA: Fix NAPI packet counting
There is a bug in the NAPI packet counting that will
cause NAPI over budget warnings.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
@@ -459,12 +459,12 @@ int edma_napi(struct napi_struct *napi,
for (i = 0; i < ehw->txcmpl_rings; i++) {
txcmpl_ring = &ehw->txcmpl_ring[i];
- work_done += edma_clean_tx(ehw, txcmpl_ring);
+ edma_clean_tx(ehw, txcmpl_ring);
}
for (i = 0; i < ehw->rxfill_rings; i++) {
rxfill_ring = &ehw->rxfill_ring[i];
- work_done += edma_alloc_rx_buffer(ehw, rxfill_ring);
+ edma_alloc_rx_buffer(ehw, rxfill_ring);
}
/*

View File

@@ -1,41 +0,0 @@
From 158032d3d4e5089afa2aa38c27c6e222ac427820 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 20 May 2021 14:57:46 +0200
Subject: [PATCH 4/8] EDMA: Use NAPI_POLL_WEIGHT as NAPI weight
Currently a weight of 100 is used by the EDMA, according
to upstream max of 64 should be used and that is used for
almost any driver.
They also introduced NAPI_POLL_WEIGHT define which equals
to 64.
So use NAPI_POLL_WEIGHT as the weight.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 2 +-
hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
@@ -845,7 +845,7 @@ static int edma_register_netdevice(struc
*/
if (!edma_hw.napi_added) {
netif_napi_add(netdev, &edma_hw.napi, edma_napi,
- EDMA_NAPI_WORK);
+ NAPI_POLL_WEIGHT);
/*
* Register the interrupt handlers and enable interrupts
*/
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.h
@@ -26,7 +26,6 @@
#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_HAL_START_IFNUM
#define EDMA_MAX_GMACS NSS_DP_HAL_MAX_PORTS
#define EDMA_TX_PKT_MIN_SIZE 33 /* IPQ807x EDMA needs a minimum packet size of 33 bytes */

View File

@@ -1,46 +0,0 @@
From e46c4d526d77916c00fff4fff3237b9c9d0d774d Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 23 Jun 2023 12:04:11 +0200
Subject: [PATCH 5/8] nss-dp: adapt to netif_napi_add() changes
netif_napi_add() removed the weight argument and just uses the default
NAPI_POLL_WEIGHT in background, so for those requiring custom weight use
netif_napi_add_weight() instead.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 4 ++++
hal/dp_ops/syn_gmac_dp/syn_dp.c | 5 +++++
2 files changed, 9 insertions(+)
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
@@ -844,8 +844,12 @@ static int edma_register_netdevice(struc
* NAPI add
*/
if (!edma_hw.napi_added) {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
netif_napi_add(netdev, &edma_hw.napi, edma_napi,
NAPI_POLL_WEIGHT);
+#else
+ netif_napi_add(netdev, &edma_hw.napi, edma_napi);
+#endif
/*
* Register the interrupt handlers and enable interrupts
*/
--- a/hal/dp_ops/syn_gmac_dp/syn_dp.c
+++ b/hal/dp_ops/syn_gmac_dp/syn_dp.c
@@ -189,8 +189,13 @@ static int syn_dp_if_init(struct nss_dp_
}
if (!dev_info->napi_added) {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
netif_napi_add(netdev, &rx_info->napi_rx, syn_dp_napi_poll_rx, SYN_DP_NAPI_BUDGET_RX);
netif_napi_add(netdev, &tx_info->napi_tx, syn_dp_napi_poll_tx, SYN_DP_NAPI_BUDGET_TX);
+#else
+ netif_napi_add_weight(netdev, &rx_info->napi_rx, syn_dp_napi_poll_rx, SYN_DP_NAPI_BUDGET_RX);
+ netif_napi_add_weight(netdev, &tx_info->napi_tx, syn_dp_napi_poll_tx, SYN_DP_NAPI_BUDGET_TX);
+#endif
/*
* Requesting irq. Set IRQ_DISABLE_UNLAZY flag, this flag

View File

@@ -1,183 +0,0 @@
From 5b05b1d7a2d2001d9711856608f61abaf7b9a9a5 Mon Sep 17 00:00:00 2001
From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Date: Fri, 23 Jun 2023 13:34:56 +0200
Subject: [PATCH 6/8] nss_dp_main: Use a 'phy-handle' property to connect to
the PHY
The original method of connecting a PHY to the ethernet controller
requires the "qcom,link-poll", and "qcom,phy-mdio-addr" devicetree
properties. This is redundant. The PHY node already contains the MDIO
address, and attaching a PHY implies "link-poll".
Allow using a "phy-handle" property. Remove the following properties,
as they are no longer used:
* "qcom,link-poll"
* "qcom,phy-mdio-addr"
* "mdio-bus"
* "qcom,forced-speed"
* "qcom,forced-duplex"
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
include/nss_dp_dev.h | 5 +--
nss_dp_main.c | 91 +++++++-------------------------------------
2 files changed, 14 insertions(+), 82 deletions(-)
--- a/include/nss_dp_dev.h
+++ b/include/nss_dp_dev.h
@@ -225,13 +225,10 @@ struct nss_dp_dev {
unsigned long drv_flags; /* Driver specific feature flags */
/* Phy related stuff */
+ struct device_node *phy_node; /* Phy device OF node */
struct phy_device *phydev; /* Phy device */
struct mii_bus *miibus; /* MII bus */
uint32_t phy_mii_type; /* RGMII/SGMII/QSGMII */
- uint32_t phy_mdio_addr; /* Mdio address */
- bool link_poll; /* Link polling enable? */
- uint32_t forced_speed; /* Forced speed? */
- uint32_t forced_duplex; /* Forced duplex? */
uint32_t link_state; /* Current link state */
uint32_t pause; /* Current flow control settings */
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -436,7 +436,7 @@ static int nss_dp_open(struct net_device
netif_start_queue(netdev);
- if (!dp_priv->link_poll) {
+ if (!dp_priv->phydev) {
/* Notify data plane link is up */
if (dp_priv->data_plane_ops->link_state(dp_priv->dpc, 1)) {
netdev_dbg(netdev, "Data plane set link failed\n");
@@ -633,6 +633,12 @@ static int32_t nss_dp_of_get_pdata(struc
return -EFAULT;
}
+ dp_priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
+ if (!dp_priv->phy_node) {
+ pr_err("%s: error parsing phy-handle\n", np->name);
+ return -EFAULT;
+ }
+
if (of_property_read_u32(np, "qcom,mactype", &hal_pdata->mactype)) {
pr_err("%s: error reading mactype\n", np->name);
return -EFAULT;
@@ -653,18 +659,6 @@ static int32_t nss_dp_of_get_pdata(struc
return -EFAULT;
#endif
- dp_priv->link_poll = of_property_read_bool(np, "qcom,link-poll");
- if (of_property_read_u32(np, "qcom,phy-mdio-addr",
- &dp_priv->phy_mdio_addr) && dp_priv->link_poll) {
- pr_err("%s: mdio addr required if link polling is enabled\n",
- np->name);
- return -EFAULT;
- }
-
- of_property_read_u32(np, "qcom,forced-speed", &dp_priv->forced_speed);
- of_property_read_u32(np, "qcom,forced-duplex", &dp_priv->forced_duplex);
-
-
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
maddr = (uint8_t *)of_get_mac_address(np);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 4, 0))
@@ -753,56 +747,6 @@ static int32_t nss_dp_of_get_pdata(struc
return 0;
}
-/*
- * nss_dp_mdio_attach()
- */
-static struct mii_bus *nss_dp_mdio_attach(struct platform_device *pdev)
-{
- struct device_node *mdio_node;
- struct platform_device *mdio_plat;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0))
- struct ipq40xx_mdio_data *mdio_data;
-#endif
-
- /*
- * Find mii_bus using "mdio-bus" handle.
- */
- mdio_node = of_parse_phandle(pdev->dev.of_node, "mdio-bus", 0);
- if (mdio_node) {
- return of_mdio_find_bus(mdio_node);
- }
-
- mdio_node = of_find_compatible_node(NULL, NULL, "qcom,qca-mdio");
- if (!mdio_node) {
- mdio_node = of_find_compatible_node(NULL, NULL,
- "qcom,ipq40xx-mdio");
- if (!mdio_node) {
- dev_err(&pdev->dev, "cannot find mdio node by phandle\n");
- return NULL;
- }
- }
-
- mdio_plat = of_find_device_by_node(mdio_node);
- if (!mdio_plat) {
- dev_err(&pdev->dev, "cannot find platform device from mdio node\n");
- of_node_put(mdio_node);
- return NULL;
- }
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0))
- return dev_get_drvdata(&mdio_plat->dev);
-#else
- mdio_data = dev_get_drvdata(&mdio_plat->dev);
- if (!mdio_data) {
- dev_err(&pdev->dev, "cannot get mii bus reference from device data\n");
- of_node_put(mdio_node);
- return NULL;
- }
-
- return mdio_data->mii_bus;
-#endif
-}
-
#ifdef CONFIG_NET_SWITCHDEV
/*
* nss_dp_is_phy_dev()
@@ -861,7 +805,6 @@ static int32_t nss_dp_probe(struct platf
struct device_node *np = pdev->dev.of_node;
struct nss_gmac_hal_platform_data gmac_hal_pdata;
int32_t ret = 0;
- uint8_t phy_id[MII_BUS_ID_SIZE + 3];
#if defined(NSS_DP_PPE_SUPPORT)
uint32_t vsi_id;
fal_port_t port_id;
@@ -940,22 +883,16 @@ static int32_t nss_dp_probe(struct platf
dp_priv->drv_flags |= NSS_DP_PRIV_FLAG(INIT_DONE);
- if (dp_priv->link_poll) {
- dp_priv->miibus = nss_dp_mdio_attach(pdev);
- if (!dp_priv->miibus) {
- netdev_dbg(netdev, "failed to find miibus\n");
- goto phy_setup_fail;
- }
- snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT,
- dp_priv->miibus->id, dp_priv->phy_mdio_addr);
+ if (dp_priv->phy_node) {
- dp_priv->phydev = phy_connect(netdev, phy_id,
- &nss_dp_adjust_link,
- dp_priv->phy_mii_type);
- if (IS_ERR(dp_priv->phydev)) {
- netdev_dbg(netdev, "failed to connect to phy device\n");
- goto phy_setup_fail;
- }
+ dp_priv->phydev = of_phy_connect(netdev, dp_priv->phy_node,
+ &nss_dp_adjust_link, 0,
+ dp_priv->phy_mii_type);
+ if (!(dp_priv->phydev)) {
+ netdev_err(netdev, "failed to connect to phy device\n");
+ goto phy_setup_fail;
+ }
+ phy_attached_info(dp_priv->phydev);
}
#if defined(NSS_DP_PPE_SUPPORT)

View File

@@ -1,56 +0,0 @@
From c2df713569fe3bb671d1444c7bf758681081053c Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 23 Jun 2022 14:18:50 +0200
Subject: [PATCH 7/8] nss-dp: edma-v1: use NAPI GRO by default
Utilize napi_gro_receive instead of plain netif_receive_skb on EDMA v1.
Usually it provides quite a lot of RX speed improvements, however in some
cases it may lead to decreased performance as there is no checksum
offloading implemented.
In cases where reduced performance is experienced its possible to disable
GRO by using ethtool.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 10 ++++++----
hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c | 8 ++++++--
2 files changed, 12 insertions(+), 6 deletions(-)
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
@@ -597,10 +597,12 @@ drop:
*/
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.
- */
+ struct net_device *netdev = dpc->dev;
+
+ netdev->features |= NETIF_F_GRO;
+ netdev->hw_features |= NETIF_F_GRO;
+ netdev->vlan_features |= NETIF_F_GRO;
+ netdev->wanted_features |= NETIF_F_GRO;
}
/* TODO - check if this is needed */
--- a/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_tx_rx.c
@@ -410,8 +410,12 @@ static uint32_t edma_clean_rx(struct edm
if (unlikely(EDMA_RXPH_SERVICE_CODE_GET(rxph) ==
NSS_PTP_EVENT_SERVICE_CODE))
nss_phy_tstamp_rx_buf(ndev, skb);
- else
- netif_receive_skb(skb);
+ else {
+ if (likely(ndev->features & NETIF_F_GRO))
+ napi_gro_receive(&ehw->napi, skb);
+ else
+ netif_receive_skb(skb);
+ }
next_rx_desc:
/*

View File

@@ -1,50 +0,0 @@
From 53b044f7a21d5cd65ada90a228910e6efbad00fa Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sun, 4 Dec 2022 18:41:36 +0100
Subject: [PATCH 8/8] nss-dp: allow setting netdev name from DTS
Allow reading the desired netdev name from DTS like DSA allows and then
set it as the netdev name during registration.
If label is not defined, simply fallback to kernel ethN enumeration.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
nss_dp_main.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -804,18 +804,29 @@ static int32_t nss_dp_probe(struct platf
struct nss_dp_dev *dp_priv;
struct device_node *np = pdev->dev.of_node;
struct nss_gmac_hal_platform_data gmac_hal_pdata;
+ const char *name = of_get_property(np, "label", NULL);
int32_t ret = 0;
+ int assign_type;
#if defined(NSS_DP_PPE_SUPPORT)
uint32_t vsi_id;
fal_port_t port_id;
#endif
+ if (name) {
+ assign_type = NET_NAME_PREDICTABLE;
+ } else {
+ name = "eth%d";
+ assign_type = NET_NAME_ENUM;
+ }
+
/* TODO: See if we need to do some SoC level common init */
- netdev = alloc_etherdev_mqs(sizeof(struct nss_dp_dev),
- NSS_DP_NETDEV_TX_QUEUE_NUM, NSS_DP_NETDEV_RX_QUEUE_NUM);
+ netdev = alloc_netdev_mqs(sizeof(struct nss_dp_dev),
+ name, assign_type,
+ ether_setup,
+ NSS_DP_NETDEV_TX_QUEUE_NUM, NSS_DP_NETDEV_RX_QUEUE_NUM);
if (!netdev) {
- pr_info("alloc_etherdev() failed\n");
+ dev_err(&pdev->dev, "alloc_netdev_mqs() failed\n");
return -ENOMEM;
}

View File

@@ -1,118 +0,0 @@
From 25ca3308edb67aa0c6c70b83edf0e22b8ae7533f Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 29 Jun 2023 13:52:58 +0200
Subject: [PATCH] nss-dp: switchdev: fix FDB roaming
Try and solve the roaming issue by trying to replicate what NSS bridge
module is doing, but by utilizing switchdev FDB notifiers instead of
adding new notifiers to the bridge code.
We register a new non-blocking switchdev notifier and simply wait for
notification, and then process the SWITCHDEV_FDB_DEL_TO_DEVICE
notifications.
Those tell us that a certain FDB entry should be removed, then a VSI ID
is fetched for the physical PPE port and using that VSI ID and the
notification provided MAC adress existing FDB entry gets removed.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
nss_dp_switchdev.c | 73 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 72 insertions(+), 1 deletion(-)
--- a/nss_dp_switchdev.c
+++ b/nss_dp_switchdev.c
@@ -29,6 +29,10 @@
#include "nss_dp_dev.h"
#include "fal/fal_stp.h"
#include "fal/fal_ctrlpkt.h"
+#if defined(NSS_DP_PPE_SUPPORT)
+#include "fal/fal_fdb.h"
+#include "ref/ref_vsi.h"
+#endif
#define NSS_DP_SWITCH_ID 0
#define NSS_DP_SW_ETHTYPE_PID 0 /* PPE ethtype profile ID for slow protocols */
@@ -534,8 +538,82 @@ static struct notifier_block *nss_dp_sw_
#else
+#if defined(NSS_DP_PPE_SUPPORT)
+/*
+ * nss_dp_switchdev_fdb_del_event
+ *
+ * Used for EDMA v1 to remove old MAC in order to preventing having
+ * duplicate MAC entries in FDB thus and avoid roaming issues.
+ */
+
+static int nss_dp_switchdev_fdb_del_event(struct net_device *netdev,
+ struct switchdev_notifier_fdb_info *fdb_info)
+{
+ struct nss_dp_dev *dp_priv = (struct nss_dp_dev *)netdev_priv(netdev);
+ fal_fdb_entry_t entry;
+ a_uint32_t vsi_id;
+ sw_error_t rv;
+
+ netdev_dbg(netdev, "FDB DEL %pM port %d\n", fdb_info->addr, dp_priv->macid);
+
+ rv = ppe_port_vsi_get(NSS_DP_SWITCH_ID, dp_priv->macid, &vsi_id);
+ if (rv) {
+ netdev_err(netdev, "cannot get VSI ID for port %d\n", dp_priv->macid);
+ return notifier_from_errno(rv);
+ }
+
+ memset(&entry, 0, sizeof(entry));
+ memcpy(&entry.addr, fdb_info->addr, ETH_ALEN);
+ entry.fid = vsi_id;
+
+ rv = fal_fdb_entry_del_bymac(NSS_DP_SWITCH_ID, &entry);
+ if (rv) {
+ netdev_err(netdev, "FDB entry delete failed with MAC %pM and fid %d\n",
+ &entry.addr, entry.fid);
+ return notifier_from_errno(rv);
+ }
+
+ return notifier_from_errno(rv);
+}
+
+/*
+ * nss_dp_switchdev_event_nb
+ *
+ * Non blocking switchdev event for netdevice.
+ * Used for EDMA v1 to remove old MAC and avoid roaming issues.
+ */
+static int nss_dp_switchdev_event_nb(struct notifier_block *unused,
+ unsigned long event, void *ptr)
+{
+ struct net_device *dev = switchdev_notifier_info_to_dev(ptr);
+
+ /*
+ * Handle switchdev event only for physical devices
+ */
+ if (!nss_dp_is_phy_dev(dev)) {
+ return NOTIFY_DONE;
+ }
+
+ switch (event) {
+ case SWITCHDEV_FDB_DEL_TO_DEVICE:
+ return nss_dp_switchdev_fdb_del_event(dev, ptr);
+ default:
+ netdev_dbg(dev, "Switchdev event %lu is not supported\n", event);
+ }
+
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block nss_dp_switchdev_notifier_nb = {
+ .notifier_call = nss_dp_switchdev_event_nb,
+};
+
+static struct notifier_block *nss_dp_sw_ev_nb = &nss_dp_switchdev_notifier_nb;
+
+#else
static struct notifier_block *nss_dp_sw_ev_nb;
+#endif
/*
* nss_dp_bridge_attr_set()
* Sets bridge attributes

View File

@@ -1,10 +0,0 @@
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -18,6 +18,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/if_vlan.h>
#include <linux/version.h>
#include <linux/of.h>
#include <linux/of_net.h>

View File

@@ -1,43 +0,0 @@
From c318c90b824c59539bf2e33618e381293398616c Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 16 Apr 2024 15:02:49 +0200
Subject: [PATCH 1/6] edma_v1: rework hw_reset logic to permit rmmod and insmod
Rework hw_reset logic for edma v1 to permit rmmod and insmod by using
get_exclusive_released variant (assuming the reset control was released)
and manually acquire and release it.
This permits rmmod and insmod without triggering warning or receiving
-EBUSY errors.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
hal/dp_ops/edma_dp/edma_v1/edma_cfg.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/hal/dp_ops/edma_dp/edma_v1/edma_cfg.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_cfg.c
@@ -719,18 +719,22 @@ 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);
+ rst = devm_reset_control_get_exclusive_released(&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_acquire(rst);
+
reset_control_assert(rst);
udelay(100);
reset_control_deassert(rst);
udelay(100);
+ reset_control_release(rst);
+
pr_info("EDMA HW Reset completed succesfully\n");
return 0;

View File

@@ -1,59 +0,0 @@
From 079bfe441b274a8c06474be82e4ccc88599a5e0e Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 16 Apr 2024 16:08:46 +0200
Subject: [PATCH 2/6] nss_dp_switchdev: correctly unregister notifier on
dp_remove
Correctly unregister notifier on dp_remove to fix kernel panic on system
reboot.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
include/nss_dp_dev.h | 1 +
nss_dp_main.c | 4 ++++
nss_dp_switchdev.c | 13 +++++++++++++
3 files changed, 18 insertions(+)
--- a/include/nss_dp_dev.h
+++ b/include/nss_dp_dev.h
@@ -349,6 +349,7 @@ void nss_dp_set_ethtool_ops(struct net_d
*/
#ifdef CONFIG_NET_SWITCHDEV
void nss_dp_switchdev_setup(struct net_device *dev);
+void nss_dp_switchdev_remove(struct net_device *dev);
bool nss_dp_is_phy_dev(struct net_device *dev);
#endif
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -970,6 +970,10 @@ static int nss_dp_remove(struct platform
if (!dp_priv)
continue;
+ #ifdef CONFIG_NET_SWITCHDEV
+ nss_dp_switchdev_remove(dp_priv->netdev);
+ #endif
+
dp_ops = dp_priv->data_plane_ops;
hal_ops = dp_priv->gmac_hal_ops;
--- a/nss_dp_switchdev.c
+++ b/nss_dp_switchdev.c
@@ -648,4 +648,17 @@ void nss_dp_switchdev_setup(struct net_d
switch_init_done = true;
}
+
+void nss_dp_switchdev_remove(struct net_device *dev)
+{
+ if (!switch_init_done)
+ return;
+
+ if (nss_dp_sw_ev_nb)
+ unregister_switchdev_notifier(nss_dp_sw_ev_nb);
+
+ unregister_switchdev_blocking_notifier(&nss_dp_switchdev_notifier);
+
+ switch_init_done = false;
+}
#endif

View File

@@ -1,35 +0,0 @@
From ab7b1a361d51157118e1a61ce6530a59bcef4b61 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 16 Apr 2024 16:10:09 +0200
Subject: [PATCH 3/6] nss_dp_main: swap dp_exit function call
First unregister nss_dp platform devices then cleanup the HAL.
This is to fix kernel panic by cleaning data that needs to be used by
platform driver unregister functions.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
nss_dp_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -1161,6 +1161,8 @@ int __init nss_dp_init(void)
*/
void __exit nss_dp_exit(void)
{
+ platform_driver_unregister(&nss_dp_drv);
+
/*
* TODO Move this to soc_ops
*/
@@ -1168,8 +1170,6 @@ void __exit nss_dp_exit(void)
nss_dp_hal_cleanup();
dp_global_ctx.common_init_done = false;
}
-
- platform_driver_unregister(&nss_dp_drv);
}
module_init(nss_dp_init);

View File

@@ -1,35 +0,0 @@
From 33dd3aa6d0f9cd240d63f53a49157ae44ebccf87 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 16 Apr 2024 16:12:11 +0200
Subject: [PATCH 4/6] nss_dp_main: call unregister_netdev first in dp_remove
and carrifer_off
In dp_remove move unregister_netdev up before calling exit and deinit
and first call netif_carrier_off to stop any traffic from happening and
prevent kernel panics for napi in the middle of transfer.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
nss_dp_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -977,6 +977,9 @@ static int nss_dp_remove(struct platform
dp_ops = dp_priv->data_plane_ops;
hal_ops = dp_priv->gmac_hal_ops;
+ netif_carrier_off(dp_priv->netdev);
+ unregister_netdev(dp_priv->netdev);
+
if (dp_priv->phydev)
phy_disconnect(dp_priv->phydev);
@@ -988,7 +991,6 @@ static int nss_dp_remove(struct platform
#endif
hal_ops->exit(dp_priv->gmac_hal_ctx);
dp_ops->deinit(dp_priv->dpc);
- unregister_netdev(dp_priv->netdev);
free_netdev(dp_priv->netdev);
dp_global_ctx.nss_dp[i] = NULL;
}

View File

@@ -1,26 +0,0 @@
From 655b07b701271bc00952fe64aeb14f993a48a50e Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 16 Apr 2024 16:17:36 +0200
Subject: [PATCH 5/6] nss_dp_main: use phy_detach instead of disconnect in
dp_remove
Use phy_detach instead of disconnect in dp_remove. On Module remove, phy
are already disconnected but they need to be detached to be correctly
reattached later with an insmod.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
nss_dp_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -981,7 +981,7 @@ static int nss_dp_remove(struct platform
unregister_netdev(dp_priv->netdev);
if (dp_priv->phydev)
- phy_disconnect(dp_priv->phydev);
+ phy_detach(dp_priv->phydev);
#if defined(NSS_DP_PPE_SUPPORT)
/*

View File

@@ -1,37 +0,0 @@
From c7c59c6097d94dbab8fc68dae798017bdbc5b3b9 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Tue, 16 Apr 2024 16:22:32 +0200
Subject: [PATCH 6/6] edma_v1: skip edma_disable_port in edma_cleanup
subsequent run
Skip edma_disable_port in edma_cleanup subsequent run as it will cause
the kernel panic as the regs are already freed by previous run of
edma_cleanup. It's use it's not clear but the call is already done in
the first run of edma_cleanup. Maybe an oversight never dropped?
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
@@ -326,9 +326,15 @@ void edma_cleanup(bool is_dp_override)
* Disable EDMA only at module exit time, since NSS firmware
* depends on this setting.
*/
- if (!is_dp_override) {
- edma_disable_port();
- }
+ /* This call will make the kernel panic as reg used by
+ * edma_disable_port are already freed by previous call of
+ * edma_cleanup. Logic is not clear of WHY this is called.
+ * Keep this here for reference if someone EVER wants
+ * to investigate.
+ */
+ // if (!is_dp_override) {
+ // edma_disable_port();
+ // }
return;
}

View File

@@ -1,240 +0,0 @@
From 5ad8cf24897ff903112967a9662cb13ed4cbbf57 Mon Sep 17 00:00:00 2001
From: hzy <hzyitc@outlook.com>
Date: Mon, 22 Apr 2024 21:47:58 +0800
Subject: [PATCH 1/2] WiP: syn-gmac: use standard DMA api
Signed-off-by: hzy <hzyitc@outlook.com>
---
hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c | 14 ++++++--
hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c | 2 ++
hal/dp_ops/syn_gmac_dp/syn_dp_rx.c | 47 +++++++++++++-------------
hal/dp_ops/syn_gmac_dp/syn_dp_tx.c | 23 ++++---------
4 files changed, 42 insertions(+), 44 deletions(-)
diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c
index 8cbbcaaf..1c9006c7 100644
--- a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c
+++ b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c
@@ -26,6 +26,7 @@ static int syn_dp_cfg_rx_setup_desc_queue(struct syn_dp_info *dev_info)
{
struct syn_dp_info_rx *rx_info = &dev_info->dp_info_rx;
struct dma_desc_rx *first_desc = NULL;
+ dma_addr_t dma_addr;
struct net_device *netdev = rx_info->netdev;
netdev_dbg(netdev, "Total size of memory required for Rx Descriptors in Ring Mode = %u\n", (uint32_t)((sizeof(struct dma_desc_rx) * SYN_DP_RX_DESC_SIZE)));
@@ -33,13 +34,15 @@ static int syn_dp_cfg_rx_setup_desc_queue(struct syn_dp_info *dev_info)
/*
* Allocate cacheable descriptors for Rx
*/
- first_desc = kzalloc(sizeof(struct dma_desc_rx) * SYN_DP_RX_DESC_SIZE, GFP_KERNEL);
+ first_desc = dma_alloc_coherent(rx_info->dev,
+ sizeof(struct dma_desc_rx) * SYN_DP_RX_DESC_SIZE,
+ &dma_addr, GFP_KERNEL);
if (!first_desc) {
netdev_dbg(netdev, "Error in Rx Descriptor Memory allocation in Ring mode\n");
return -ENOMEM;
}
- dev_info->rx_desc_dma_addr = (dma_addr_t)virt_to_phys(first_desc);
+ dev_info->rx_desc_dma_addr = dma_addr;
rx_info->rx_desc = first_desc;
syn_dp_gmac_rx_desc_init_ring(rx_info->rx_desc, SYN_DP_RX_DESC_SIZE);
@@ -98,6 +101,10 @@ void syn_dp_cfg_rx_cleanup_rings(struct syn_dp_info *dev_info)
for (i = 0; i < rx_info->busy_rx_desc_cnt; i++) {
rx_skb_index = (rx_skb_index + i) & SYN_DP_RX_DESC_MAX_INDEX;
rxdesc = rx_info->rx_desc;
+
+ dma_unmap_single(rx_info->dev, rxdesc->buffer1,
+ rxdesc->length, DMA_FROM_DEVICE);
+
skb = rx_info->rx_buf_pool[rx_skb_index].skb;
if (unlikely(skb != NULL)) {
dev_kfree_skb_any(skb);
@@ -105,7 +112,8 @@ void syn_dp_cfg_rx_cleanup_rings(struct syn_dp_info *dev_info)
}
}
- kfree(rx_info->rx_desc);
+ dma_free_coherent(rx_info->dev, (sizeof(struct dma_desc_rx) * SYN_DP_RX_DESC_SIZE),
+ rx_info->rx_desc, dev_info->rx_desc_dma_addr);
rx_info->rx_desc = NULL;
dev_info->rx_desc_dma_addr = (dma_addr_t)0;
}
diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c
index bf5e19a0..284e8880 100644
--- a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c
+++ b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c
@@ -91,6 +91,8 @@ void syn_dp_cfg_tx_cleanup_rings(struct syn_dp_info *dev_info)
tx_skb_index = syn_dp_tx_inc_index(tx_skb_index, i);
txdesc = tx_info->tx_desc;
+ dma_unmap_single(tx_info->dev, txdesc->buffer1, txdesc->length, DMA_TO_DEVICE);
+
skb = tx_info->tx_buf_pool[tx_skb_index].skb;
if (unlikely(skb != NULL)) {
dev_kfree_skb_any(skb);
diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c
index 1ddeb7d6..1798d4e7 100644
--- a/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c
+++ b/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c
@@ -73,16 +73,6 @@ static inline void syn_dp_rx_refill_one_desc(struct dma_desc_rx *rx_desc,
*/
static inline void syn_dp_rx_inval_and_flush(struct syn_dp_info_rx *rx_info, uint32_t start, uint32_t end)
{
- /*
- * Batched flush and invalidation of the rx descriptors
- */
- if (end > start) {
- dmac_flush_range_no_dsb((void *)&rx_info->rx_desc[start], (void *)&rx_info->rx_desc[end] + sizeof(struct dma_desc_rx));
- } else {
- dmac_flush_range_no_dsb((void *)&rx_info->rx_desc[start], (void *)&rx_info->rx_desc[SYN_DP_RX_DESC_MAX_INDEX] + sizeof(struct dma_desc_rx));
- dmac_flush_range_no_dsb((void *)&rx_info->rx_desc[0], (void *)&rx_info->rx_desc[end] + sizeof(struct dma_desc_rx));
- }
-
dsb(st);
}
@@ -124,15 +114,19 @@ int syn_dp_rx_refill_page_mode(struct syn_dp_info_rx *rx_info)
break;
}
+ skb_fill_page_desc(skb, 0, pg, 0, PAGE_SIZE);
+
/*
* Get virtual address of allocated page.
*/
page_addr = page_address(pg);
- dma_addr = (dma_addr_t)virt_to_phys(page_addr);
-
- skb_fill_page_desc(skb, 0, pg, 0, PAGE_SIZE);
+ dma_addr = dma_map_page(rx_info->dev, pg, 0, PAGE_SIZE, DMA_FROM_DEVICE);
+ if (unlikely(dma_mapping_error(rx_info->dev, dma_addr))) {
+ dev_kfree_skb(skb);
+ netdev_dbg(netdev, "DMA mapping failed for empty buffer\n");
+ break;
+ }
- dmac_inv_range_no_dsb(page_addr, (page_addr + PAGE_SIZE));
rx_refill_idx = rx_info->rx_refill_idx;
rx_desc = rx_info->rx_desc + rx_refill_idx;
@@ -181,8 +175,15 @@ int syn_dp_rx_refill(struct syn_dp_info_rx *rx_info)
skb_reserve(skb, SYN_DP_SKB_HEADROOM + NET_IP_ALIGN);
- dma_addr = (dma_addr_t)virt_to_phys(skb->data);
- dmac_inv_range_no_dsb((void *)skb->data, (void *)(skb->data + inval_len));
+ dma_addr = dma_map_single(rx_info->dev, skb->data,
+ inval_len,
+ DMA_FROM_DEVICE);
+ if (unlikely(dma_mapping_error(rx_info->dev, dma_addr))) {
+ dev_kfree_skb(skb);
+ netdev_dbg(netdev, "DMA mapping failed for empty buffer\n");
+ break;
+ }
+
rx_refill_idx = rx_info->rx_refill_idx;
rx_desc = rx_info->rx_desc + rx_refill_idx;
@@ -407,12 +408,6 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_info, int budget)
* this code is executing.
*/
end = syn_dp_rx_inc_index(rx_info->rx_idx, busy);
- if (end > start) {
- dmac_inv_range_no_dsb((void *)&rx_info->rx_desc[start], (void *)&rx_info->rx_desc[end] + sizeof(struct dma_desc_rx));
- } else {
- dmac_inv_range_no_dsb((void *)&rx_info->rx_desc[start], (void *)&rx_info->rx_desc[SYN_DP_RX_DESC_MAX_INDEX] + sizeof(struct dma_desc_rx));
- dmac_inv_range_no_dsb((void *)&rx_info->rx_desc[0], (void *)&rx_info->rx_desc[end] + sizeof(struct dma_desc_rx));
- }
dsb(st);
@@ -439,8 +434,12 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_info, int budget)
* speculative prefetch by CPU may have occurred.
*/
frame_length = syn_dp_gmac_get_rx_desc_frame_length(status);
- dmac_inv_range((void *)rx_buf->map_addr_virt,
- (void *)(((uint8_t *)rx_buf->map_addr_virt) + frame_length));
+ if (likely(!rx_info->page_mode))
+ dma_unmap_single(rx_info->dev, rx_desc->buffer1,
+ rx_info->alloc_buf_len, DMA_FROM_DEVICE);
+ else
+ dma_unmap_page(rx_info->dev, rx_desc->buffer1,
+ PAGE_SIZE, DMA_FROM_DEVICE);
prefetch((void *)rx_buf->map_addr_virt);
rx_next_idx = syn_dp_rx_inc_index(rx_idx, 1);
diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c
index c97e252b..6d4adb3f 100644
--- a/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c
+++ b/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c
@@ -104,9 +104,7 @@ static inline struct dma_desc_tx *syn_dp_tx_process_nr_frags(struct syn_dp_info_
BUG_ON(!length);
#endif
- dma_addr = (dma_addr_t)virt_to_phys(frag_addr);
-
- dmac_clean_range_no_dsb(frag_addr, frag_addr + length);
+ dma_addr = dma_map_single(tx_info->dev, frag_addr, length, DMA_TO_DEVICE);
*total_length += length;
tx_desc = syn_dp_tx_set_desc_sg(tx_info, dma_addr, length, DESC_OWN_BY_DMA);
@@ -150,8 +148,7 @@ int syn_dp_tx_nr_frags(struct syn_dp_info_tx *tx_info, struct sk_buff *skb)
/*
* Flush the dma for non-paged skb data
*/
- dma_addr = (dma_addr_t)virt_to_phys(skb->data);
- dmac_clean_range_no_dsb((void *)skb->data, (void *)(skb->data + length));
+ dma_addr = dma_map_single(tx_info->dev, skb->data, length, DMA_TO_DEVICE);
total_len = length;
@@ -256,12 +253,7 @@ int syn_dp_tx_frag_list(struct syn_dp_info_tx *tx_info, struct sk_buff *skb)
return NETDEV_TX_BUSY;
}
- dma_addr = (dma_addr_t)virt_to_phys(skb->data);
-
- /*
- * Flush the data area of the head skb
- */
- dmac_clean_range_no_dsb((void *)skb->data, (void *)(skb->data + length));
+ dma_addr = dma_map_single(tx_info->dev, skb->data, length, DMA_TO_DEVICE);
total_len = length;
@@ -290,9 +282,7 @@ int syn_dp_tx_frag_list(struct syn_dp_info_tx *tx_info, struct sk_buff *skb)
BUG_ON(!length);
#endif
- dma_addr = (dma_addr_t)virt_to_phys(iter_skb->data);
-
- dmac_clean_range_no_dsb((void *)iter_skb->data, (void *)(iter_skb->data + length));
+ dma_addr = dma_map_single(tx_info->dev, iter_skb->data, length, DMA_TO_DEVICE);
total_len += length;
@@ -445,6 +435,7 @@ int syn_dp_tx_complete(struct syn_dp_info_tx *tx_info, int budget)
break;
}
+ dma_unmap_single(tx_info->dev, desc->buffer1, desc->length, DMA_TO_DEVICE);
if (likely(status & DESC_TX_LAST)) {
tx_skb_index = syn_dp_tx_comp_index_get(tx_info);
@@ -571,9 +562,7 @@ int syn_dp_tx(struct syn_dp_info_tx *tx_info, struct sk_buff *skb)
return NETDEV_TX_BUSY;
}
- dma_addr = (dma_addr_t)virt_to_phys(skb->data);
-
- dmac_clean_range_no_dsb((void *)skb->data, (void *)(skb->data + skb->len));
+ dma_addr = dma_map_single(tx_info->dev, skb->data, skb->len, DMA_TO_DEVICE);
/*
* Queue packet to the GMAC rings
--
2.40.1

View File

@@ -1,41 +0,0 @@
From ba430b1a512dc1972807a1dd5a8d31a78ac572ff Mon Sep 17 00:00:00 2001
From: hzy <hzyitc@outlook.com>
Date: Mon, 22 Apr 2024 21:49:18 +0800
Subject: [PATCH 2/2] ipq50xx: use corrent scm function to write tcsr
Signed-off-by: hzy <hzyitc@outlook.com>
---
hal/soc_ops/ipq50xx/nss_ipq50xx.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/hal/soc_ops/ipq50xx/nss_ipq50xx.c b/hal/soc_ops/ipq50xx/nss_ipq50xx.c
index 3e4491c0..e56de1cc 100644
--- a/hal/soc_ops/ipq50xx/nss_ipq50xx.c
+++ b/hal/soc_ops/ipq50xx/nss_ipq50xx.c
@@ -18,7 +18,7 @@
#include <linux/of.h>
#include <linux/ioport.h>
-#include <linux/qcom_scm.h>
+#include <linux/firmware/qcom/qcom_scm.h>
#include "nss_dp_hal.h"
/*
@@ -78,13 +78,8 @@ static void nss_dp_hal_tcsr_set(void)
* If TZ is not enabled, we can write to the register directly.
*/
if (qcom_scm_is_available()) {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
- err = qcom_scm_tcsr_reg_write((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
+ err = qcom_scm_io_writel((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
TCSR_GMAC_AXI_CACHE_OVERRIDE_VALUE);
-#else
- err = qti_scm_tcsr_reg_write((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
- TCSR_GMAC_AXI_CACHE_OVERRIDE_VALUE);
-#endif
if (err) {
pr_err("%s: SCM TCSR write error: %d\n", __func__, err);
}
--
2.40.1

View File

@@ -1,41 +0,0 @@
From 309a1a330ccaa103a7648e944d97a0032116b338 Mon Sep 17 00:00:00 2001
From: hzy <hzyitc@outlook.com>
Date: Mon, 22 Apr 2024 21:50:39 +0800
Subject: [PATCH] nss_dp_main: support fixed-link
Signed-off-by: hzy <hzyitc@outlook.com>
---
nss_dp_main.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/nss_dp_main.c b/nss_dp_main.c
index 9a09edd5..204063bf 100644
--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -619,11 +619,20 @@ static int32_t nss_dp_of_get_pdata(struct device_node *np,
}
dp_priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
- if (!dp_priv->phy_node) {
- pr_err("%s: error parsing phy-handle\n", np->name);
- return -EFAULT;
+ if(!dp_priv->phy_node) {
+ if(of_phy_is_fixed_link(np)) {
+ int ret = of_phy_register_fixed_link(np);
+ if(ret < 0) {
+ pr_err("%s: fail to register fixed-link: %d\n", np->name, ret);
+ return -EFAULT;
+ }
+ }
+ dp_priv->phy_node = of_node_get(np);
}
+ if(!dp_priv->phy_node)
+ pr_err("%s: no phy-handle or fixed-link found\n", np->name);
+
if (of_property_read_u32(np, "qcom,mactype", &hal_pdata->mactype)) {
pr_err("%s: error reading mactype\n", np->name);
return -EFAULT;
--
2.40.1

View File

@@ -1,17 +0,0 @@
--- a/hal/soc_ops/ipq50xx/nss_ipq50xx.c
+++ b/hal/soc_ops/ipq50xx/nss_ipq50xx.c
@@ -18,7 +18,14 @@
#include <linux/of.h>
#include <linux/ioport.h>
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0))
#include <linux/firmware/qcom/qcom_scm.h>
+#else
+#include <linux/qcom_scm.h>
+#endif
+
#include "nss_dp_hal.h"
/*

View File

@@ -4,10 +4,10 @@ PKG_NAME:=qca-nss-drv
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2023-08-06
PKG_SOURCE_DATE:=2024-11-13
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-drv.git
PKG_SOURCE_VERSION:=1ab184034529539f61093184a67d4454cb3eb352
PKG_MIRROR_HASH:=6aa081c0853d3e3b6d78eee588a0967e540b2317d15aef3c3f6f7129925653f7
PKG_SOURCE_VERSION:=d5ee67bd84d1ee7ed81eb6758e62a6db5a0cf4c7
PKG_MIRROR_HASH:=72ebdbce21b5cc24131100f8e45dfcb8188a5963c5864ee497129278f022b740
PKG_BUILD_PARALLEL:=1
PKG_FLAGS:=nonshared

View File

@@ -26,7 +26,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
npd->vphys = res_vphys.start;
- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = nss_ioremap(npd->nphys, resource_size(&res_nphys));
if (!npd->nmap) {
nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
@@ -37,14 +37,14 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
npd->qgic_phys = res_qgic_phys.start;
- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = nss_ioremap(npd->nphys, resource_size(&res_nphys));
if (!npd->nmap) {
nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
}
- npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys));
+ npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys));
+ npd->qgic_map = nss_ioremap(npd->qgic_phys, resource_size(&res_qgic_phys));
if (!npd->qgic_map) {
nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id);
goto out;
@@ -53,7 +53,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
of_node_put(cmn);
- nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
+ nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
+ nss_misc_reset = nss_ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
if (!nss_misc_reset) {
pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev);
return -EFAULT;
@@ -64,14 +64,14 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
npd->qgic_phys = res_qgic_phys.start;
- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = nss_ioremap(npd->nphys, resource_size(&res_nphys));
if (!npd->nmap) {
nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
}
- npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys));
+ npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys));
+ npd->qgic_map = nss_ioremap(npd->qgic_phys, resource_size(&res_qgic_phys));
if (!npd->qgic_map) {
nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id);
goto out;
@@ -80,14 +80,14 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
of_node_put(cmn);
- nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
+ nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
+ nss_misc_reset = nss_ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
if (!nss_misc_reset) {
pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev);
return -EFAULT;
}
- nss_misc_reset_flag = ioremap_nocache(res_nss_misc_reset_flag.start, resource_size(&res_nss_misc_reset_flag));
+ nss_misc_reset_flag = ioremap(res_nss_misc_reset_flag.start, resource_size(&res_nss_misc_reset_flag));
+ nss_misc_reset_flag = nss_ioremap(res_nss_misc_reset_flag.start, resource_size(&res_nss_misc_reset_flag));
if (!nss_misc_reset_flag) {
pr_err("%px: ioremap fail for nss_misc_reset_flag\n", nss_dev);
return -EFAULT;
@@ -98,7 +98,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
npd->vphys = res_vphys.start;
- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = nss_ioremap(npd->nphys, resource_size(&res_nphys));
if (!npd->nmap) {
nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
@@ -107,7 +107,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
of_node_put(cmn);
- fpb_base = ioremap_nocache(res_nss_fpb_base.start, resource_size(&res_nss_fpb_base));
+ fpb_base = ioremap(res_nss_fpb_base.start, resource_size(&res_nss_fpb_base));
+ fpb_base = nss_ioremap(res_nss_fpb_base.start, resource_size(&res_nss_fpb_base));
if (!fpb_base) {
pr_err("%px: ioremap fail for nss_fpb_base\n", nss_dev);
return -EFAULT;
@@ -118,7 +118,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
npd->qgic_phys = res_qgic_phys.start;
- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = nss_ioremap(npd->nphys, resource_size(&res_nphys));
if (!npd->nmap) {
nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
@@ -127,7 +127,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
}
- npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys));
+ npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys));
+ npd->qgic_map = nss_ioremap(npd->qgic_phys, resource_size(&res_qgic_phys));
if (!npd->qgic_map) {
nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id);
goto out;
@@ -136,64 +136,10 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
of_node_put(cmn);
- nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
+ nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
+ nss_misc_reset = nss_ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
if (!nss_misc_reset) {
pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev);
return -EFAULT;
--- a/nss_hal/ipq95xx/nss_hal_pvt.c
+++ b/nss_hal/ipq95xx/nss_hal_pvt.c
@@ -291,7 +291,7 @@ static struct nss_platform_data *__nss_h
npd->vphys = res_vphys.start;
npd->qgic_phys = res_qgic_phys.start;
- npd->nmap = ioremap_nocache(npd->nphys, resource_size(&res_nphys));
+ npd->nmap = ioremap(npd->nphys, resource_size(&res_nphys));
if (!npd->nmap) {
nss_info_always("%px: nss%d: ioremap() fail for nphys\n", nss_ctx, nss_ctx->id);
goto out;
@@ -303,7 +303,7 @@ static struct nss_platform_data *__nss_h
goto out;
}
- npd->qgic_map = ioremap_nocache(npd->qgic_phys, resource_size(&res_qgic_phys));
+ npd->qgic_map = ioremap(npd->qgic_phys, resource_size(&res_qgic_phys));
if (!npd->qgic_map) {
nss_info_always("%px: nss%d: ioremap() fail for qgic map\n", nss_ctx, nss_ctx->id);
goto out;
@@ -608,7 +608,7 @@ static int __nss_hal_common_reset(struct
of_node_put(cmn);
- nss_misc_reset = ioremap_nocache(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
+ nss_misc_reset = ioremap(res_nss_misc_reset.start, resource_size(&res_nss_misc_reset));
if (!nss_misc_reset) {
pr_err("%px: ioremap fail for nss_misc_reset\n", nss_dev);
return -EFAULT;
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -81,9 +81,9 @@ int nss_hal_firmware_load(struct nss_ctx
}
- load_mem = ioremap_nocache(npd->load_addr, nss_fw->size);
+ load_mem = ioremap(npd->load_addr, nss_fw->size);
if (!load_mem) {
- nss_info_always("%px: ioremap_nocache failed: %x", nss_ctx, npd->load_addr);
+ nss_info_always("%px: ioremap failed: %x", nss_ctx, npd->load_addr);
release_firmware(nss_fw);
return rc;
}
--- a/nss_meminfo.c
+++ b/nss_meminfo.c
@@ -736,7 +736,7 @@ bool nss_meminfo_init(struct nss_ctx_ins
/*
* meminfo_start is the label where the start address of meminfo map is stored.
*/
- meminfo_start = (uint32_t *)ioremap_nocache(nss_ctx->load + NSS_MEMINFO_MAP_START_OFFSET,
+ meminfo_start = (uint32_t *)ioremap(nss_ctx->load + NSS_MEMINFO_MAP_START_OFFSET,
NSS_MEMINFO_RESERVE_AREA_SIZE);
if (!meminfo_start) {
nss_info_always("%px: cannot remap meminfo start\n", nss_ctx);
--- a/nss_ppe.c
+++ b/nss_ppe.c
@@ -357,7 +357,7 @@ void nss_ppe_init(void)
@@ -201,7 +147,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
* Get the PPE base address
*/
- ppe_pvt.ppe_base = ioremap_nocache(PPE_BASE_ADDR, PPE_REG_SIZE);
+ ppe_pvt.ppe_base = ioremap(PPE_BASE_ADDR, PPE_REG_SIZE);
+ ppe_pvt.ppe_base = nss_ioremap(PPE_BASE_ADDR, PPE_REG_SIZE);
if (!ppe_pvt.ppe_base) {
nss_warning("DRV can't get PPE base address\n");
return;

View File

@@ -14,42 +14,6 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
nss_hal/nss_hal.c | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
--- a/nss_core.c
+++ b/nss_core.c
@@ -61,7 +61,9 @@
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))))))
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)))) || \
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))))))
#error "Check skb recycle code in this file to match Linux version"
#endif
@@ -2658,7 +2660,7 @@ static inline bool nss_core_skb_can_reus
if (unlikely(irqs_disabled()))
return false;
- if (unlikely(skb_shinfo(nbuf)->tx_flags & SKBTX_DEV_ZEROCOPY))
+ if (unlikely(skb_shinfo(nbuf)->flags & SKBFL_ZEROCOPY_ENABLE))
return false;
if (unlikely(skb_is_nonlinear(nbuf)))
--- a/nss_coredump.c
+++ b/nss_coredump.c
@@ -25,7 +25,11 @@
#include "nss_hal.h"
#include "nss_log.h"
#include <linux/kernel.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
#include <linux/notifier.h> /* for panic_notifier_list */
+#else
+#include <linux/panic_notifier.h>
+#endif
#include <linux/jiffies.h> /* for time */
#include "nss_tx_rx_common.h"
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -27,6 +27,7 @@
@@ -60,3 +24,26 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
#include "nss_hal.h"
#include "nss_arch.h"
@@ -58,9 +59,9 @@ int nss_hal_firmware_load(struct nss_ctx
int rc;
if (nss_ctx->id == 0) {
- rc = request_firmware(&nss_fw, NSS_AP0_IMAGE, &(nss_dev->dev));
+ rc = firmware_request_nowarn(&nss_fw, NSS_AP0_IMAGE, &(nss_dev->dev));
} else if (nss_ctx->id == 1) {
- rc = request_firmware(&nss_fw, NSS_AP1_IMAGE, &(nss_dev->dev));
+ rc = firmware_request_nowarn(&nss_fw, NSS_AP1_IMAGE, &(nss_dev->dev));
} else {
nss_warning("%px: Invalid nss dev: %d\n", nss_ctx, nss_ctx->id);
return -EINVAL;
--- a/nss_data_plane/nss_data_plane_gmac.c
+++ b/nss_data_plane/nss_data_plane_gmac.c
@@ -20,7 +20,7 @@
#include "nss_tx_rx_common.h"
#include <nss_gmac_api_if.h>
-#define NSS_DP_GMAC_SUPPORTED_FEATURES (NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_FRAGLIST | (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO))
+#define NSS_DP_GMAC_SUPPORTED_FEATURES (NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_FRAGLIST | (NETIF_F_TSO | NETIF_F_TSO6))
#define NSS_DATA_PLANE_GMAC_MAX_INTERFACES 4
static DEFINE_SPINLOCK(nss_data_plane_gmac_stats_lock);

View File

@@ -17,7 +17,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
--- a/nss_core.c
+++ b/nss_core.c
@@ -1660,7 +1660,7 @@ static int32_t nss_core_handle_cause_que
@@ -1664,7 +1664,7 @@ static int32_t nss_core_handle_cause_que
*
*/
if (unlikely((buffer_type == N2H_BUFFER_CRYPTO_RESP))) {

View File

@@ -27,7 +27,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
--- a/nss_core.c
+++ b/nss_core.c
@@ -1472,6 +1472,8 @@ static inline void nss_core_handle_empty
@@ -1476,6 +1476,8 @@ static inline void nss_core_handle_empty
uint32_t count, uint32_t hlos_index,
uint16_t mask)
{
@@ -36,7 +36,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
while (count) {
/*
* Since we only return the primary skb, we have no way to unmap
@@ -1525,7 +1527,9 @@ next:
@@ -1529,7 +1531,9 @@ next:
n2h_desc_ring->hlos_index = hlos_index;
if_map->n2h_hlos_index[NSS_IF_N2H_EMPTY_BUFFER_RETURN_QUEUE] = hlos_index;
@@ -47,7 +47,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_CORE_DSB();
}
@@ -1547,6 +1551,7 @@ static int32_t nss_core_handle_cause_que
@@ -1551,6 +1555,7 @@ static int32_t nss_core_handle_cause_que
struct nss_ctx_instance *nss_ctx = int_ctx->nss_ctx;
struct nss_meminfo_ctx *mem_ctx = &nss_ctx->meminfo_ctx;
struct nss_if_mem_map *if_map = mem_ctx->if_map;
@@ -55,7 +55,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
qid = nss_core_cause_to_queue(cause);
@@ -1558,7 +1563,8 @@ static int32_t nss_core_handle_cause_que
@@ -1562,7 +1567,8 @@ static int32_t nss_core_handle_cause_que
n2h_desc_ring = &nss_ctx->n2h_desc_ring[qid];
desc_if = &n2h_desc_ring->desc_ring;
desc_ring = desc_if->desc;
@@ -65,7 +65,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_CORE_DSB();
nss_index = if_map->n2h_nss_index[qid];
@@ -1587,13 +1593,23 @@ static int32_t nss_core_handle_cause_que
@@ -1591,13 +1597,23 @@ static int32_t nss_core_handle_cause_que
start = hlos_index;
end = (hlos_index + count) & mask;
if (end > start) {
@@ -92,7 +92,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
}
/*
@@ -1722,7 +1738,8 @@ next:
@@ -1726,7 +1742,8 @@ next:
n2h_desc_ring->hlos_index = hlos_index;
if_map->n2h_hlos_index[qid] = hlos_index;
@@ -102,7 +102,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_CORE_DSB();
return count;
@@ -1734,11 +1751,12 @@ next:
@@ -1738,11 +1755,12 @@ next:
*/
static void nss_core_init_nss(struct nss_ctx_instance *nss_ctx, struct nss_if_mem_map *if_map)
{
@@ -116,7 +116,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_CORE_DSB();
/*
@@ -1835,6 +1853,7 @@ static void nss_core_alloc_paged_buffers
@@ -1839,6 +1857,7 @@ static void nss_core_alloc_paged_buffers
uint16_t count, int16_t mask, int32_t hlos_index, uint32_t alloc_fail_count,
uint32_t buffer_type, uint32_t buffer_queue, uint32_t stats_index)
{
@@ -124,7 +124,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
struct sk_buff *nbuf;
struct page *npage;
struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[buffer_queue];
@@ -1904,7 +1923,9 @@ static void nss_core_alloc_paged_buffers
@@ -1908,7 +1927,9 @@ static void nss_core_alloc_paged_buffers
/*
* Flush the descriptor
*/
@@ -135,7 +135,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
hlos_index = (hlos_index + 1) & (mask);
count--;
@@ -1918,7 +1939,8 @@ static void nss_core_alloc_paged_buffers
@@ -1922,7 +1943,8 @@ static void nss_core_alloc_paged_buffers
h2n_desc_ring->hlos_index = hlos_index;
if_map->h2n_hlos_index[buffer_queue] = hlos_index;
@@ -145,7 +145,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_CORE_DSB();
NSS_PKT_STATS_INC(&nss_top->stats_drv[stats_index]);
@@ -1931,7 +1953,7 @@ static void nss_core_alloc_paged_buffers
@@ -1935,7 +1957,7 @@ static void nss_core_alloc_paged_buffers
static void nss_core_alloc_jumbo_mru_buffers(struct nss_ctx_instance *nss_ctx, struct nss_if_mem_map *if_map,
int jumbo_mru, uint16_t count, int16_t mask, int32_t hlos_index)
{
@@ -154,7 +154,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
struct sk_buff *nbuf;
struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_BUFFER_QUEUE];
struct h2n_desc_if_instance *desc_if = &h2n_desc_ring->desc_ring;
@@ -1978,7 +2000,9 @@ static void nss_core_alloc_jumbo_mru_buf
@@ -1982,7 +2004,9 @@ static void nss_core_alloc_jumbo_mru_buf
/*
* Flush the descriptor
*/
@@ -165,7 +165,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
hlos_index = (hlos_index + 1) & (mask);
count--;
@@ -1992,7 +2016,8 @@ static void nss_core_alloc_jumbo_mru_buf
@@ -1996,7 +2020,8 @@ static void nss_core_alloc_jumbo_mru_buf
h2n_desc_ring->hlos_index = hlos_index;
if_map->h2n_hlos_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE] = hlos_index;
@@ -175,7 +175,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_CORE_DSB();
NSS_PKT_STATS_INC(&nss_top->stats_drv[NSS_DRV_STATS_TX_EMPTY]);
@@ -2005,6 +2030,7 @@ static void nss_core_alloc_jumbo_mru_buf
@@ -2009,6 +2034,7 @@ static void nss_core_alloc_jumbo_mru_buf
static void nss_core_alloc_max_avail_size_buffers(struct nss_ctx_instance *nss_ctx, struct nss_if_mem_map *if_map,
uint16_t max_buf_size, uint16_t count, int16_t mask, int32_t hlos_index)
{
@@ -183,7 +183,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_BUFFER_QUEUE];
struct h2n_desc_if_instance *desc_if = &h2n_desc_ring->desc_ring;
struct h2n_descriptor *desc_ring = desc_if->desc;
@@ -2012,6 +2038,7 @@ static void nss_core_alloc_max_avail_siz
@@ -2016,6 +2042,7 @@ static void nss_core_alloc_max_avail_siz
uint16_t payload_len = max_buf_size + NET_SKB_PAD;
uint16_t start = hlos_index;
uint16_t prev_hlos_index;
@@ -191,7 +191,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
while (count) {
dma_addr_t buffer;
@@ -2064,13 +2091,26 @@ static void nss_core_alloc_max_avail_siz
@@ -2068,13 +2095,26 @@ static void nss_core_alloc_max_avail_siz
* Flush the descriptors, including the descriptor at prev_hlos_index.
*/
if (prev_hlos_index > start) {
@@ -221,7 +221,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
}
/*
@@ -2081,7 +2121,8 @@ static void nss_core_alloc_max_avail_siz
@@ -2085,7 +2125,8 @@ static void nss_core_alloc_max_avail_siz
h2n_desc_ring->hlos_index = hlos_index;
if_map->h2n_hlos_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE] = hlos_index;
@@ -231,7 +231,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_CORE_DSB();
NSS_PKT_STATS_INC(&nss_top->stats_drv[NSS_DRV_STATS_TX_EMPTY]);
@@ -2094,6 +2135,7 @@ static void nss_core_alloc_max_avail_siz
@@ -2098,6 +2139,7 @@ static void nss_core_alloc_max_avail_siz
static inline void nss_core_handle_empty_buffer_sos(struct nss_ctx_instance *nss_ctx,
struct nss_if_mem_map *if_map, uint16_t max_buf_size)
{
@@ -239,7 +239,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
uint16_t count, size, mask;
int32_t nss_index, hlos_index;
struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_BUFFER_QUEUE];
@@ -2104,7 +2146,8 @@ static inline void nss_core_handle_empty
@@ -2108,7 +2150,8 @@ static inline void nss_core_handle_empty
/*
* Check how many empty buffers could be filled in queue
*/
@@ -249,7 +249,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_CORE_DSB();
nss_index = if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_BUFFER_QUEUE];
@@ -2149,6 +2192,7 @@ static inline void nss_core_handle_empty
@@ -2153,6 +2196,7 @@ static inline void nss_core_handle_empty
static inline void nss_core_handle_paged_empty_buffer_sos(struct nss_ctx_instance *nss_ctx,
struct nss_if_mem_map *if_map, uint16_t max_buf_size)
{
@@ -257,7 +257,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
uint16_t count, size, mask;
int32_t nss_index, hlos_index;
struct hlos_h2n_desc_rings *h2n_desc_ring = &nss_ctx->h2n_desc_rings[NSS_IF_H2N_EMPTY_PAGED_BUFFER_QUEUE];
@@ -2156,7 +2200,8 @@ static inline void nss_core_handle_paged
@@ -2160,7 +2204,8 @@ static inline void nss_core_handle_paged
/*
* Check how many empty buffers could be filled in queue
*/
@@ -267,7 +267,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_CORE_DSB();
nss_index = if_map->h2n_nss_index[NSS_IF_H2N_EMPTY_PAGED_BUFFER_QUEUE];
@@ -2733,9 +2778,11 @@ void nss_skb_reuse(struct sk_buff *nbuf)
@@ -2751,9 +2796,11 @@ void nss_skb_reuse(struct sk_buff *nbuf)
* Sends one skb to NSS FW
*/
static inline int32_t nss_core_send_buffer_simple_skb(struct nss_ctx_instance *nss_ctx,
@@ -281,7 +281,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
struct h2n_descriptor *desc_ring = desc_if->desc;
struct h2n_descriptor *desc;
uint16_t bit_flags;
@@ -2789,7 +2836,8 @@ static inline int32_t nss_core_send_buff
@@ -2807,7 +2854,8 @@ static inline int32_t nss_core_send_buff
(nss_ptr_t)nbuf, (uint16_t)(nbuf->data - nbuf->head), nbuf->len,
sz, (uint32_t)nbuf->priority, mss, bit_flags);
@@ -291,7 +291,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/*
* We are done using the skb fields and can reuse it now
@@ -2813,7 +2861,8 @@ no_reuse:
@@ -2831,7 +2879,8 @@ no_reuse:
(nss_ptr_t)nbuf, (uint16_t)(nbuf->data - nbuf->head), nbuf->len,
(uint16_t)skb_end_offset(nbuf), (uint32_t)nbuf->priority, mss, bit_flags);
@@ -301,7 +301,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_SIMPLE]);
return 1;
@@ -2827,9 +2876,11 @@ no_reuse:
@@ -2845,9 +2894,11 @@ no_reuse:
* Used to differentiate from FRAGLIST
*/
static inline int32_t nss_core_send_buffer_nr_frags(struct nss_ctx_instance *nss_ctx,
@@ -315,7 +315,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
struct h2n_descriptor *desc_ring = desc_if->desc;
struct h2n_descriptor *desc;
const skb_frag_t *frag;
@@ -2869,7 +2920,8 @@ static inline int32_t nss_core_send_buff
@@ -2887,7 +2938,8 @@ static inline int32_t nss_core_send_buff
(nss_ptr_t)NULL, nbuf->data - nbuf->head, nbuf->len - nbuf->data_len,
skb_end_offset(nbuf), (uint32_t)nbuf->priority, mss, bit_flags | H2N_BIT_FLAG_FIRST_SEGMENT);
@@ -325,7 +325,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/*
* Now handle rest of the fragments.
@@ -2893,7 +2945,8 @@ static inline int32_t nss_core_send_buff
@@ -2911,7 +2963,8 @@ static inline int32_t nss_core_send_buff
(nss_ptr_t)NULL, 0, skb_frag_size(frag), skb_frag_size(frag),
nbuf->priority, mss, bit_flags);
@@ -335,7 +335,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
}
/*
@@ -2909,7 +2962,8 @@ static inline int32_t nss_core_send_buff
@@ -2927,7 +2980,8 @@ static inline int32_t nss_core_send_buff
desc->bit_flags &= ~(H2N_BIT_FLAG_DISCARD);
desc->opaque = (nss_ptr_t)nbuf;
@@ -345,7 +345,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_NR_FRAGS]);
return i+1;
@@ -2923,9 +2977,11 @@ static inline int32_t nss_core_send_buff
@@ -2941,9 +2995,11 @@ static inline int32_t nss_core_send_buff
* Used to differentiate from FRAGS
*/
static inline int32_t nss_core_send_buffer_fraglist(struct nss_ctx_instance *nss_ctx,
@@ -359,7 +359,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
struct h2n_descriptor *desc_ring = desc_if->desc;
struct h2n_descriptor *desc;
dma_addr_t buffer;
@@ -2964,7 +3020,8 @@ static inline int32_t nss_core_send_buff
@@ -2982,7 +3038,8 @@ static inline int32_t nss_core_send_buff
(nss_ptr_t)nbuf, nbuf->data - nbuf->head, nbuf->len - nbuf->data_len,
skb_end_offset(nbuf), (uint32_t)nbuf->priority, mss, bit_flags | H2N_BIT_FLAG_FIRST_SEGMENT);
@@ -369,7 +369,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/*
* Walk the frag_list in nbuf
@@ -3017,7 +3074,8 @@ static inline int32_t nss_core_send_buff
@@ -3035,7 +3092,8 @@ static inline int32_t nss_core_send_buff
(nss_ptr_t)iter, iter->data - iter->head, iter->len - iter->data_len,
skb_end_offset(iter), iter->priority, mss, bit_flags);
@@ -379,7 +379,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
i++;
}
@@ -3036,7 +3094,8 @@ static inline int32_t nss_core_send_buff
@@ -3054,7 +3112,8 @@ static inline int32_t nss_core_send_buff
* Update bit flag for last descriptor.
*/
desc->bit_flags |= H2N_BIT_FLAG_LAST_SEGMENT;
@@ -389,7 +389,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
NSS_PKT_STATS_INC(&nss_ctx->nss_top->stats_drv[NSS_DRV_STATS_TX_FRAGLIST]);
return i+1;
@@ -3115,8 +3174,10 @@ int32_t nss_core_send_buffer(struct nss_
@@ -3133,8 +3192,10 @@ int32_t nss_core_send_buffer(struct nss_
* We need to work out if there's sufficent space in our transmit descriptor
* ring to place all the segments of a nbuf.
*/
@@ -401,7 +401,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
nss_index = if_map->h2n_nss_index[qid];
h2n_desc_ring->nss_index_local = nss_index;
count = ((nss_index - hlos_index - 1) + size) & (mask);
@@ -3181,13 +3242,13 @@ int32_t nss_core_send_buffer(struct nss_
@@ -3199,13 +3260,13 @@ int32_t nss_core_send_buffer(struct nss_
count = 0;
if (likely((segments == 0) || is_bounce)) {
count = nss_core_send_buffer_simple_skb(nss_ctx, desc_if, if_num,
@@ -418,7 +418,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
}
if (unlikely(count <= 0)) {
@@ -3211,7 +3272,8 @@ int32_t nss_core_send_buffer(struct nss_
@@ -3229,7 +3290,8 @@ int32_t nss_core_send_buffer(struct nss_
h2n_desc_ring->hlos_index = hlos_index;
if_map->h2n_hlos_index[qid] = hlos_index;
@@ -430,15 +430,14 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
#ifdef CONFIG_DEBUG_KMEMLEAK
--- a/nss_core.h
+++ b/nss_core.h
@@ -105,31 +105,30 @@
#endif
@@ -108,9 +108,22 @@
/*
- * Cache operation
+ * DMA Offset helper
*/
* Cache operation
- */
-#define NSS_CORE_DSB() dsb(sy)
-#define NSS_CORE_DMA_CACHE_MAINT(start, size, dir) nss_core_dma_cache_maint(start, size, dir)
+*/
+#define n2h_desc_index_offset(_index) sizeof(struct n2h_descriptor) * (_index)
+#define h2n_desc_index_offset(_index) sizeof(struct h2n_descriptor) * (_index)
+
@@ -455,11 +454,15 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+#define h2n_hlos_index_to_dma(_if_map_addr, _index) (_if_map_addr) + h2n_hlos_index_offset + (sizeof(uint32_t) * (_index))
+#define n2h_hlos_index_to_dma(_if_map_addr, _index) (_if_map_addr) + n2h_hlos_index_offset + (sizeof(uint32_t) * (_index))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
#define nss_ioremap ioremap_nocache
@@ -119,26 +132,11 @@
#endif
/*
- * nss_core_dma_cache_maint()
- * Perform the appropriate cache op based on direction
+ * Cache operation
*/
- */
-static inline void nss_core_dma_cache_maint(void *start, uint32_t size, int direction)
-{
- switch (direction) {
@@ -476,12 +479,15 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
- BUG();
- }
-}
-
+ * Cache operation
+*/
+#define NSS_CORE_DSB() dsb(sy)
+#define NSS_CORE_DMA_CACHE_MAINT(dev, start, size, dir) BUILD_BUG_ON_MSG(1, \
+ "NSS_CORE_DMA_CACHE_MAINT is deprecated. Fix the code to use correct dma_sync_* API")
#define NSS_DEVICE_IF_START NSS_PHYSICAL_IF_START
#define NSS_IS_IF_TYPE(type, if_num) ((if_num >= NSS_##type##_IF_START) && (if_num < (NSS_##type##_IF_START + NSS_MAX_##type##_INTERFACES)))
--- a/nss_hal/ipq806x/nss_hal_pvt.c
+++ b/nss_hal/ipq806x/nss_hal_pvt.c
@@ -477,10 +477,9 @@ static struct nss_platform_data *__nss_h

View File

@@ -30,7 +30,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
#include <nss_hal.h>
#include <net/dst.h>
#ifdef CONFIG_BRIDGE_NETFILTER
@@ -492,50 +494,38 @@ static void nss_core_handle_crypto_pkt(s
@@ -491,50 +493,38 @@ static void nss_core_handle_crypto_pkt(s
*/
static uint32_t nss_soc_mem_info(void)
{

View File

@@ -1,8 +1,8 @@
--- a/nss_clmap_stats.c
+++ b/nss_clmap_stats.c
@@ -63,7 +63,7 @@ void nss_clmap_stats_session_unregister(
@@ -66,7 +66,7 @@ void nss_clmap_stats_session_unregister(
* nss_clmap_stats_session_register
* Register debug statistic for clmap session.
* Register debug statistic for clmap session.
*/
-bool nss_clmap_stats_session_register(uint32_t if_num, uint32_t if_type, struct net_device *netdev)
+bool nss_clmap_stats_session_register(uint32_t if_num, enum nss_clmap_interface_type if_type, struct net_device *netdev)

View File

@@ -1,6 +1,6 @@
--- a/exports/nss_wifili_if.h
+++ b/exports/nss_wifili_if.h
@@ -2207,7 +2207,7 @@ void nss_wifili_release_external_if(nss_
@@ -2263,7 +2263,7 @@ void nss_wifili_release_external_if(nss_
*/
uint8_t nss_wifili_thread_scheme_alloc(struct nss_ctx_instance *nss_ctx,
int32_t radio_ifnum,

View File

@@ -1,78 +1,54 @@
--- a/nss_hal/fsm9010/nss_hal_pvt.c
+++ b/nss_hal/fsm9010/nss_hal_pvt.c
@@ -291,7 +291,11 @@ static int __nss_hal_request_irq(struct
@@ -291,7 +291,7 @@ static int __nss_hal_request_irq(struct
}
int_ctx->irq = npd->irq[irq_num];
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
+#endif
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
return 0;
}
--- a/nss_hal/ipq50xx/nss_hal_pvt.c
+++ b/nss_hal/ipq50xx/nss_hal_pvt.c
@@ -599,7 +599,11 @@ static int __nss_hal_request_irq(struct
@@ -599,7 +599,7 @@ static int __nss_hal_request_irq(struct
return err;
}
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt);
+#endif
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt);
int_ctx->cause = cause;
err = request_irq(irq, nss_hal_handle_irq, 0, irq_name, int_ctx);
if (err) {
--- a/nss_hal/ipq60xx/nss_hal_pvt.c
+++ b/nss_hal/ipq60xx/nss_hal_pvt.c
@@ -615,62 +615,102 @@ static int __nss_hal_request_irq(struct
@@ -615,62 +615,62 @@ static int __nss_hal_request_irq(struct
irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY);
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_SOS) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
+#endif
int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFERS_SOS;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_sos", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_QUEUE) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT);
+#endif
int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFER_QUEUE;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_queue", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_TX_UNBLOCKED) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT);
+#endif
int_ctx->cause = NSS_N2H_INTR_TX_UNBLOCKED;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss-tx-unblock", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_0) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#endif
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_0;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue0", int_ctx);
}
@@ -80,54 +56,34 @@
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_1) {
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_1;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#endif
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue1", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_2) {
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_2;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#endif
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue2", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_3) {
int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_3;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#endif
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue3", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_COREDUMP_COMPLETE) {
int_ctx->cause = NSS_N2H_INTR_COREDUMP_COMPLETE;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#endif
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_coredump_complete", int_ctx);
}
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PAGED_EMPTY_BUFFER_SOS) {
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
+#endif
int_ctx->cause = NSS_N2H_INTR_PAGED_EMPTY_BUFFERS_SOS;
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_paged_empty_buf_sos", int_ctx);
}
@@ -135,26 +91,18 @@
if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PROFILE_DMA) {
int_ctx->cause = NSS_N2H_INTR_PROFILE_DMA;
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
+#endif
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_profile_dma", int_ctx);
}
--- a/nss_hal/ipq806x/nss_hal_pvt.c
+++ b/nss_hal/ipq806x/nss_hal_pvt.c
@@ -1185,7 +1185,11 @@ static int __nss_hal_request_irq(struct
@@ -1185,7 +1185,7 @@ static int __nss_hal_request_irq(struct
}
int_ctx->irq = npd->irq[irq_num];
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
+#endif
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi, 64);
return 0;
}
@@ -233,18 +181,3 @@
err = request_irq(irq, nss_hal_handle_irq, 0, "nss_profile_dma", int_ctx);
}
--- a/nss_hal/ipq95xx/nss_hal_pvt.c
+++ b/nss_hal/ipq95xx/nss_hal_pvt.c
@@ -889,7 +889,11 @@ static int __nss_hal_request_irq(struct
return err;
}
- netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+ netif_napi_add(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt);
+#else
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt);
+#endif
int_ctx->cause = cause;
err = request_irq(irq, nss_hal_handle_irq, 0, irq_name, int_ctx);
if (err) {

View File

@@ -0,0 +1,18 @@
--- a/nss_dynamic_interface_stats.c
+++ b/nss_dynamic_interface_stats.c
@@ -88,8 +88,15 @@ const char *nss_dynamic_interface_type_n
"NSS_DYNAMIC_INTERFACE_TYPE_RMNET_RX_H2N",
"NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL0",
"NSS_DYNAMIC_INTERFACE_TYPE_WIFILI_EXTERNAL1",
+ "NSS_DYNAMIC_INTERFACE_TYPE_TLS_INNER",
+ "NSS_DYNAMIC_INTERFACE_TYPE_TLS_OUTER",
+ "NSS_DYNAMIC_INTERFACE_TYPE_MIRROR",
+ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_EXT_VDEV_WDS",
"NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_HOST_INNER",
"NSS_DYNAMIC_INTERFACE_TYPE_CAPWAP_OUTER",
+ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_EXT_VDEV_VLAN",
+ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER",
+ "NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER"
};
/*

View File

@@ -0,0 +1,57 @@
--- a/nss_stats.c
+++ b/nss_stats.c
@@ -407,9 +407,9 @@ void nss_stats_create_dentry(char *name,
/*
* gmac_stats_ops
*/
-#ifdef NSS_DATA_PLANE_GENERIC_SUPPORT
-NSS_STATS_DECLARE_FILE_OPERATIONS(gmac);
-#endif
+// #ifdef NSS_DATA_PLANE_GENERIC_SUPPORT
+// NSS_STATS_DECLARE_FILE_OPERATIONS(gmac);
+// #endif
/*
* wt_stats_ops
@@ -464,9 +464,9 @@ void nss_stats_init(void)
/*
* gmac_stats
*/
-#ifdef NSS_DATA_PLANE_GENERIC_SUPPORT
- nss_stats_create_dentry("gmac", &nss_gmac_stats_ops);
-#endif
+// #ifdef NSS_DATA_PLANE_GENERIC_SUPPORT
+// nss_stats_create_dentry("gmac", &nss_gmac_stats_ops);
+// #endif
/*
* Per-project stats
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,6 @@ qca-nss-drv-objs := \
nss_n2h_stats.o \
nss_n2h_strings.o \
nss_pm.o \
- nss_profiler.o \
nss_project.o \
nss_rps.o \
nss_stats.o \
@@ -40,7 +39,6 @@ qca-nss-drv-objs += nss_hal/nss_hal.o
ifneq "$(NSS_DRV_POINT_OFFLOAD)" "y"
qca-nss-drv-objs += \
- nss_gmac_stats.o \
nss_if.o \
nss_if_log.o \
nss_phys_if.o \
@@ -381,7 +379,9 @@ endif
ifeq ($(SoC),$(filter $(SoC),ipq806x))
qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \
- nss_hal/ipq806x/nss_hal_pvt.o
+ nss_hal/ipq806x/nss_hal_pvt.o \
+ nss_gmac_stats.o \
+ nss_profiler.o
ifneq "$(NSS_DRV_C2C_ENABLE)" "n"
ccflags-y += -DNSS_DRV_C2C_ENABLE

View File

@@ -0,0 +1,37 @@
--- a/nss_core.c
+++ b/nss_core.c
@@ -517,7 +517,7 @@ static uint32_t nss_soc_mem_info(void)
goto err_use_default_memsize;
}
- nss_info_always("NSS DDR size is 0x%x\n", (uint32_t) resource_size(&r));
+ nss_info("NSS DDR size is 0x%x\n", (uint32_t) resource_size(&r));
return resource_size(&r);
--- a/nss_hal/ipq95xx/nss_hal_pvt.c
+++ b/nss_hal/ipq95xx/nss_hal_pvt.c
@@ -724,19 +724,19 @@ static int __nss_hal_clock_configure(str
}
}
- nss_info_always("Supported Frequencies - ");
+ nss_info("Supported Frequencies - ");
for (i = 0; i < NSS_FREQ_MAX_SCALE; i++) {
switch (nss_runtime_samples.freq_scale[i].frequency) {
case NSS_FREQ_748:
- nss_info_always("748 MHz ");
+ nss_info("748 MHz ");
break;
case NSS_FREQ_1497:
- nss_info_always("1.497 GHz ");
+ nss_info("1.497 GHz ");
break;
case NSS_FREQ_1689:
- nss_info_always("1.689 GHz ");
+ nss_info("1.689 GHz ");
break;
default:

View File

@@ -0,0 +1,33 @@
--- a/Makefile
+++ b/Makefile
@@ -350,10 +350,17 @@ endif
ifneq "$(NSS_DRV_WIFIOFFLOAD_ENABLE)" "n"
ccflags-y += -DNSS_DRV_WIFIOFFLOAD_ENABLE
+ifneq "$(NSS_DRV_WIFI_LEGACY_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_WIFI_LEGACY_ENABLE
qca-nss-drv-objs += \
nss_wifi.o \
nss_wifi_log.o \
- nss_wifi_stats.o \
+ nss_wifi_stats.o
+ifeq ($(SoC),$(filter $(SoC),ipq806x))
+ccflags-y += -DNSS_HAL_IPQ806x_SUPPORT
+endif
+endif
+qca-nss-drv-objs += \
nss_wifi_vdev.o \
nss_wifili.o \
nss_wifili_log.o \
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -587,7 +587,9 @@ int nss_hal_probe(struct platform_device
if (npd->wifioffload_enabled == NSS_FEATURE_ENABLED) {
nss_top->wifi_handler_id = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_VAP] = nss_dev->id;
+#if defined(NSS_HAL_IPQ806x_SUPPORT)
nss_wifi_register_handler();
+#endif
nss_wifili_register_handler();
#ifdef NSS_DRV_WIFI_EXT_VDEV_ENABLE
nss_wifi_ext_vdev_register_handler();

View File

@@ -0,0 +1,14 @@
--- a/nss_stats.c
+++ b/nss_stats.c
@@ -395,8 +395,9 @@ size_t nss_stats_print(char *node, char
*/
void nss_stats_create_dentry(char *name, const struct file_operations *ops)
{
- if (!debugfs_create_file(name, 0400, nss_top_main.stats_dentry, &nss_top_main, ops)) {
- nss_warning("Failed to create debug entry for subsystem %s\n", name);
+ if (!debugfs_lookup(name, nss_top_main.stats_dentry))
+ if (!debugfs_create_file(name, 0400, nss_top_main.stats_dentry, &nss_top_main, ops)) {
+ nss_warning("Failed to create debug entry for subsystem %s\n", name);
}
}

View File

@@ -0,0 +1,40 @@
--- a/nss_igs.c
+++ b/nss_igs.c
@@ -163,7 +163,7 @@ EXPORT_SYMBOL(nss_igs_register_if);
* nss_igs_get_context()
* Get the IGS context.
*/
-struct nss_ctx_instance *nss_igs_get_context()
+struct nss_ctx_instance *nss_igs_get_context(void)
{
return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.igs_handler_id];
}
@@ -177,8 +177,9 @@ EXPORT_SYMBOL(nss_igs_get_context);
void nss_igs_module_save(struct tc_action_ops *act, struct module *module)
{
nss_assert(act);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
nss_assert(act->type == TCA_ACT_MIRRED_NSS);
-
+#endif
nss_igs_module = module;
}
EXPORT_SYMBOL(nss_igs_module_save);
@@ -188,7 +189,7 @@ EXPORT_SYMBOL(nss_igs_module_save);
* nss_igs_module_get()
* Get the ingress shaping module reference.
*/
-bool nss_igs_module_get()
+bool nss_igs_module_get(void)
{
nss_assert(nss_igs_module);
return try_module_get(nss_igs_module);
@@ -199,7 +200,7 @@ EXPORT_SYMBOL(nss_igs_module_get);
* nss_igs_module_put()
* Release the ingress shaping module reference.
*/
-void nss_igs_module_put()
+void nss_igs_module_put(void)
{
nss_assert(nss_igs_module);
module_put(nss_igs_module);

View File

@@ -1,233 +1,3 @@
--- a/nss_core.c
+++ b/nss_core.c
@@ -65,7 +65,7 @@
(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))))))
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0))))))
#error "Check skb recycle code in this file to match Linux version"
#endif
--- a/nss_dynamic_interface.c
+++ b/nss_dynamic_interface.c
@@ -226,7 +226,7 @@ int nss_dynamic_interface_alloc_node(enu
core_id = nss_top_main.dynamic_interface_table[type];
nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[core_id];
di_data.if_num = -1;
- di_data.response = false;
+ di_data.response = -1;
init_completion(&di_data.complete);
nss_dynamic_interface_msg_init(&ndim, NSS_DYNAMIC_INTERFACE, NSS_DYNAMIC_INTERFACE_ALLOC_NODE,
@@ -285,7 +285,7 @@ nss_tx_status_t nss_dynamic_interface_de
core_id = nss_top_main.dynamic_interface_table[type];
nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[core_id];
- di_data.response = false;
+ di_data.response = -1;
init_completion(&di_data.complete);
if (nss_is_dynamic_interface(if_num) == false) {
--- a/nss_init.c
+++ b/nss_init.c
@@ -592,48 +592,12 @@ static struct ctl_table nss_general_tabl
{ }
};
-static struct ctl_table nss_init_dir[] = {
-#if (NSS_FREQ_SCALE_SUPPORT == 1)
- {
- .procname = "clock",
- .mode = 0555,
- .child = nss_freq_table,
- },
-#endif
- {
- .procname = "general",
- .mode = 0555,
- .child = nss_general_table,
- },
-#if (NSS_SKB_REUSE_SUPPORT == 1)
- {
- .procname = "skb_reuse",
- .mode = 0555,
- .child = nss_skb_reuse_table,
- },
-#endif
- { }
-};
-
-static struct ctl_table nss_root_dir[] = {
- {
- .procname = "nss",
- .mode = 0555,
- .child = nss_init_dir,
- },
- { }
-};
-
-static struct ctl_table nss_root[] = {
- {
- .procname = "dev",
- .mode = 0555,
- .child = nss_root_dir,
- },
- { }
-};
-
-static struct ctl_table_header *nss_dev_header;
+static struct ctl_table_header *nss_clock_header;
+static struct ctl_table_header *nss_skb_header;
+static struct ctl_table_header *nss_general_header;
+static struct ctl_table *nss_clock_table;
+static struct ctl_table *nss_skb_reuse_tabl;
+static struct ctl_table *nss_general_tabl;
/*
* nss_init()
@@ -785,7 +749,16 @@ nss_info("Init NSS driver");
/*
* Register sysctl table.
*/
- nss_dev_header = register_sysctl_table(nss_root);
+ // to avoid multiple calls to `register_sysctl_table`
+ nss_general_header = register_sysctl("dev/nss/general", nss_general_table);
+
+#if (NSS_SKB_REUSE_SUPPORT == 1)
+ nss_skb_header = register_sysctl("dev/nss/skb_reuse", nss_skb_reuse_table);
+#endif
+
+#if (NSS_FREQ_SCALE_SUPPORT == 1)
+ nss_clock_header = register_sysctl("dev/nss/clock", nss_freq_table);
+#endif
/*
* Registering sysctl for ipv4/6 specific config.
@@ -948,8 +921,18 @@ static void __exit nss_cleanup(void)
{
nss_info("Exit NSS driver");
- if (nss_dev_header)
- unregister_sysctl_table(nss_dev_header);
+ if (nss_general_header)
+ unregister_sysctl_table(nss_general_header);
+
+#if (NSS_SKB_REUSE_SUPPORT == 1)
+ if (nss_skb_header)
+ unregister_sysctl_table(nss_skb_header);
+#endif
+
+#if (NSS_FREQ_SCALE_SUPPORT == 1)
+ if (nss_clock_header)
+ unregister_sysctl_table(nss_clock_header);
+#endif
/*
* Unregister n2h specific sysctl
--- a/nss_project.c
+++ b/nss_project.c
@@ -333,33 +333,6 @@ static struct ctl_table nss_project_tabl
{ }
};
-static struct ctl_table nss_project_dir[] = {
- {
- .procname = "project",
- .mode = 0555,
- .child = nss_project_table,
- },
- { }
-};
-
-static struct ctl_table nss_project_root_dir[] = {
- {
- .procname = "nss",
- .mode = 0555,
- .child = nss_project_dir,
- },
- { }
-};
-
-static struct ctl_table nss_project_root[] = {
- {
- .procname = "dev",
- .mode = 0555,
- .child = nss_project_root_dir,
- },
- { }
-};
-
static struct ctl_table_header *nss_project_header;
/*
@@ -368,7 +341,7 @@ static struct ctl_table_header *nss_proj
*/
void nss_project_register_sysctl(void)
{
- nss_project_header = register_sysctl_table(nss_project_root);
+ nss_project_header = register_sysctl("dev/nss/project", nss_project_table);
}
/*
--- a/nss_n2h.c
+++ b/nss_n2h.c
@@ -1904,36 +1904,6 @@ static struct ctl_table nss_n2h_table_mu
{ }
};
-/*
- * This table will be overwritten during single-core registration
- */
-static struct ctl_table nss_n2h_dir[] = {
- {
- .procname = "n2hcfg",
- .mode = 0555,
- .child = nss_n2h_table_multi_core,
- },
- { }
-};
-
-static struct ctl_table nss_n2h_root_dir[] = {
- {
- .procname = "nss",
- .mode = 0555,
- .child = nss_n2h_dir,
- },
- { }
-};
-
-static struct ctl_table nss_n2h_root[] = {
- {
- .procname = "dev",
- .mode = 0555,
- .child = nss_n2h_root_dir,
- },
- { }
-};
-
static struct ctl_table_header *nss_n2h_header;
/*
@@ -2282,8 +2252,7 @@ void nss_n2h_single_core_register_sysctl
/*
* Register sysctl table.
*/
- nss_n2h_dir[0].child = nss_n2h_table_single_core;
- nss_n2h_header = register_sysctl_table(nss_n2h_root);
+ nss_n2h_header = register_sysctl("dev/nss/n2hcfg", nss_n2h_table_single_core);
}
/*
@@ -2381,7 +2350,7 @@ void nss_n2h_multi_core_register_sysctl(
/*
* Register sysctl table.
*/
- nss_n2h_header = register_sysctl_table(nss_n2h_root);
+ nss_n2h_header = register_sysctl("dev/nss/n2hcfg", nss_n2h_table_multi_core);
}
/*
--- a/nss_ppe_vp.c
+++ b/nss_ppe_vp.c
@@ -783,24 +783,6 @@ static struct ctl_table nss_ppe_vp_table
@@ -308,95 +78,6 @@
+ nss_pppoe_header = register_sysctl("dev/nss/pppoe", nss_pppoe_table);
}
/*
--- a/nss_rps.c
+++ b/nss_rps.c
@@ -577,33 +577,6 @@ static struct ctl_table nss_rps_table[]
{ }
};
-static struct ctl_table nss_rps_dir[] = {
- {
- .procname = "rps",
- .mode = 0555,
- .child = nss_rps_table,
- },
- { }
-};
-
-static struct ctl_table nss_rps_root_dir[] = {
- {
- .procname = "nss",
- .mode = 0555,
- .child = nss_rps_dir,
- },
- { }
-};
-
-static struct ctl_table nss_rps_root[] = {
- {
- .procname = "dev",
- .mode = 0555,
- .child = nss_rps_root_dir,
- },
- { }
-};
-
static struct ctl_table_header *nss_rps_header;
/*
@@ -640,7 +613,7 @@ void nss_rps_register_sysctl(void)
/*
* Register sysctl table.
*/
- nss_rps_header = register_sysctl_table(nss_rps_root);
+ nss_rps_header = register_sysctl("dev/nss/rps", nss_rps_table);
}
/*
--- a/nss_stats.c
+++ b/nss_stats.c
@@ -88,32 +88,6 @@ static struct ctl_table nss_stats_table[
{ }
};
-static struct ctl_table nss_stats_dir[] = {
- {
- .procname = "stats",
- .mode = 0555,
- .child = nss_stats_table,
- },
- { }
-};
-
-static struct ctl_table nss_stats_root_dir[] = {
- {
- .procname = "nss",
- .mode = 0555,
- .child = nss_stats_dir,
- },
- { }
-};
-
-static struct ctl_table nss_stats_root[] = {
- {
- .procname = "dev",
- .mode = 0555,
- .child = nss_stats_root_dir,
- },
- { }
-};
static struct ctl_table_header *nss_stats_header;
/*
@@ -125,7 +99,7 @@ void nss_stats_register_sysctl(void)
/*
* Register sysctl table.
*/
- nss_stats_header = register_sysctl_table(nss_stats_root);
+ nss_stats_header = register_sysctl("dev/nss/stats", nss_stats_table);
}
/*
--- a/nss_c2c_tx.c
+++ b/nss_c2c_tx.c
@@ -442,51 +123,6 @@
+ nss_c2c_tx_header = register_sysctl("dev/nss/c2c_tx", nss_c2c_tx_table);
}
/*
--- a/nss_dma.c
+++ b/nss_dma.c
@@ -378,33 +378,6 @@ static struct ctl_table nss_dma_table[]
{ }
};
-static struct ctl_table nss_dma_dir[] = {
- {
- .procname = "dma",
- .mode = 0555,
- .child = nss_dma_table,
- },
- { }
-};
-
-static struct ctl_table nss_dma_root_dir[] = {
- {
- .procname = "nss",
- .mode = 0555,
- .child = nss_dma_dir,
- },
- { }
-};
-
-static struct ctl_table nss_dma_root[] = {
- {
- .procname = "dev",
- .mode = 0555,
- .child = nss_dma_root_dir,
- },
- { }
-};
-
static struct ctl_table_header *nss_dma_header;
/*
@@ -422,7 +395,7 @@ void nss_dma_register_sysctl(void)
/*
* Register sysctl table.
*/
- nss_dma_header = register_sysctl_table(nss_dma_root);
+ nss_dma_header = register_sysctl("dev/nss/dma", nss_dma_table);
}
/*
--- a/nss_ipv4.c
+++ b/nss_ipv4.c
@@ -597,7 +233,7 @@
/*
--- a/nss_pm.c
+++ b/nss_pm.c
@@ -323,6 +323,7 @@ error:
@@ -326,6 +326,7 @@ error:
nss_pm_interface_status_t nss_pm_set_perf_level(void *handle, nss_pm_perf_level_t lvl)
{
#if ((NSS_DT_SUPPORT == 1) && (NSS_FREQ_SCALE_SUPPORT == 1))
@@ -605,12 +241,8 @@
nss_freq_scales_t index;
switch (lvl) {
@@ -335,10 +336,9 @@ nss_pm_interface_status_t nss_pm_set_per
break;
default:
- index = NSS_PM_PERF_LEVEL_IDLE;
+ index = (nss_freq_scales_t)NSS_PM_PERF_LEVEL_IDLE;
@@ -341,7 +342,6 @@ nss_pm_interface_status_t nss_pm_set_per
index = NSS_FREQ_MID_SCALE;
}
-#if !defined(NSS_HAL_IPQ807x_SUPPORT)

View File

@@ -0,0 +1,18 @@
--- a/exports/nss_wifili_if.h
+++ b/exports/nss_wifili_if.h
@@ -751,6 +751,15 @@ struct nss_wifili_stats_notification {
struct nss_wifili_stats stats; /**< Wifili statistics. */
};
+/**
+ * nss_wifili_get_context
+ * Gets the Wi-Fi Li context used in NSS GRE transmit.
+ *
+ * @return
+ * Pointer to the NSS core context.
+ */
+extern struct nss_ctx_instance *nss_wifili_get_context(void);
+
#ifdef __KERNEL__ /* only kernel will use. */
/**

View File

@@ -0,0 +1,88 @@
--- a/nss_n2h.c
+++ b/nss_n2h.c
@@ -1300,11 +1300,11 @@ static int nss_n2h_mitigationcfg_core0_h
}
if (!nss_n2h_core0_mitigation_cfg) {
- printk(KERN_INFO "Disabling NSS MITIGATION\n");
+ dev_info(nss_ctx->dev, "Disabling NSS MITIGATION\n");
nss_n2h_mitigation_cfg(nss_ctx, 0, NSS_CORE_0);
return 0;
}
- printk(KERN_INFO "Invalid input value.Valid value is 0, Runtime re-enabling not supported\n");
+ dev_info(nss_ctx->dev, "Invalid input value.Valid value is 0, Runtime re-enabling not supported\n");
return -EINVAL;
}
@@ -1331,11 +1331,11 @@ static int nss_n2h_mitigationcfg_core1_h
}
if (!nss_n2h_core1_mitigation_cfg) {
- printk(KERN_INFO "Disabling NSS MITIGATION\n");
+ dev_info(nss_ctx->dev, "Disabling NSS MITIGATION\n");
nss_n2h_mitigation_cfg(nss_ctx, 0, NSS_CORE_1);
return 0;
}
- printk(KERN_INFO "Invalid input value.Valid value is 0, Runtime re-enabling not supported\n");
+ dev_info(nss_ctx->dev, "Invalid input value.Valid value is 0, Runtime re-enabling not supported\n");
return -EINVAL;
}
@@ -1367,14 +1367,14 @@ static int nss_n2h_buf_cfg_core0_handler
}
if ((nss_n2h_core0_add_buf_pool_size >= 1) && (nss_n2h_core0_add_buf_pool_size <= NSS_N2H_MAX_BUF_POOL_SIZE)) {
- printk(KERN_INFO "configuring additional NSS pbufs\n");
+ dev_info(nss_ctx->dev, "Configuring additional NSS pbufs\n");
ret = nss_n2h_buf_pool_cfg(nss_ctx, nss_n2h_core0_add_buf_pool_size, NSS_CORE_0);
nss_n2h_core0_add_buf_pool_size = nss_ctx->buf_sz_allocated;
- printk(KERN_INFO "additional pbufs of size %d got added to NSS\n", nss_ctx->buf_sz_allocated);
+ dev_info(nss_ctx->dev, "Additional pbufs of size %d got added to NSS\n", nss_ctx->buf_sz_allocated);
return ret;
}
- printk(KERN_INFO "Invalid input value. should be greater than 1 and less than %d\n", NSS_N2H_MAX_BUF_POOL_SIZE);
+ dev_info(nss_ctx->dev, "Invalid input value. should be greater than 1 and less than %d\n", NSS_N2H_MAX_BUF_POOL_SIZE);
return -EINVAL;
}
@@ -1406,14 +1406,14 @@ static int nss_n2h_buf_cfg_core1_handler
}
if ((nss_n2h_core1_add_buf_pool_size >= 1) && (nss_n2h_core1_add_buf_pool_size <= NSS_N2H_MAX_BUF_POOL_SIZE)) {
- printk(KERN_INFO "configuring additional NSS pbufs\n");
+ dev_info(nss_ctx->dev, "Configuring additional NSS pbufs\n");
ret = nss_n2h_buf_pool_cfg(nss_ctx, nss_n2h_core1_add_buf_pool_size, NSS_CORE_1);
nss_n2h_core1_add_buf_pool_size = nss_ctx->buf_sz_allocated;
- printk(KERN_INFO "additional pbufs of size %d got added to NSS\n", nss_ctx->buf_sz_allocated);
+ dev_info(nss_ctx->dev, "Additional pbufs of size %d got added to NSS\n", nss_ctx->buf_sz_allocated);
return ret;
}
- printk(KERN_INFO "Invalid input value. should be greater than 1 and less than %d\n", NSS_N2H_MAX_BUF_POOL_SIZE);
+ dev_info(nss_ctx->dev, "Invalid input value. should be greater than 1 and less than %d\n", NSS_N2H_MAX_BUF_POOL_SIZE);
return -EINVAL;
}
--- a/nss_core.c
+++ b/nss_core.c
@@ -2283,7 +2283,7 @@ static void nss_core_handle_cause_nonque
nss_core_init_nss(nss_ctx, if_map);
nss_send_ddr_info(nss_ctx);
- nss_info_always("%px: nss core %d booted successfully\n", nss_ctx, nss_ctx->id);
+ dev_info(nss_ctx->dev, "NSS core %d booted successfully\n", nss_ctx->id);
nss_top = nss_ctx->nss_top;
#ifdef NSS_DRV_C2C_ENABLE
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -83,7 +83,7 @@ int nss_hal_firmware_load(struct nss_ctx
return rc;
}
- nss_info("nss_driver - fw of size %d bytes copied to load addr: %x, nss_id : %d\n", (int)nss_fw->size, npd->load_addr, nss_dev->id);
+ dev_info(&nss_dev->dev, "fw of size %d bytes copied to addr: %x, nss_id: %d\n", (int)nss_fw->size, npd->load_addr, nss_ctx->id);
memcpy_toio(load_mem, nss_fw->data, nss_fw->size);
release_firmware(nss_fw);
iounmap(load_mem);

View File

@@ -0,0 +1,11 @@
--- a/nss_virt_if.c
+++ b/nss_virt_if.c
@@ -450,6 +450,8 @@ EXPORT_SYMBOL(nss_virt_if_create_sync_ne
*/
struct nss_virt_if_handle *nss_virt_if_create_sync(struct net_device *netdev)
{
+ if (!nss_ctl_redirect)
+ return NULL;
/*
* NSS_N2H_INTERFACE is the nexthop of the dynamic interface which is created for handling the
* n2h traffic.

View File

@@ -0,0 +1,353 @@
--- a/nss_hal/ipq807x/nss_hal_pvt.c
+++ b/nss_hal/ipq807x/nss_hal_pvt.c
@@ -67,6 +67,20 @@
#define NSS_NC_AXI_CLK "nss-nc-axi-clk"
/*
+ * N2H interrupts
+ */
+#define NSS_IRQ_NAME_EMPTY_BUF_SOS "nss_empty_buf_sos"
+#define NSS_IRQ_NAME_EMPTY_BUF_QUEUE "nss_empty_buf_queue"
+#define NSS_IRQ_NAME_TX_UNBLOCK "nss-tx-unblock"
+#define NSS_IRQ_NAME_QUEUE0 "nss_queue0"
+#define NSS_IRQ_NAME_QUEUE1 "nss_queue1"
+#define NSS_IRQ_NAME_QUEUE2 "nss_queue2"
+#define NSS_IRQ_NAME_QUEUE3 "nss_queue3"
+#define NSS_IRQ_NAME_COREDUMP_COMPLETE "nss_coredump_complete"
+#define NSS_IRQ_NAME_PAGED_EMPTY_BUF_SOS "nss_paged_empty_buf_sos"
+#define NSS_IRQ_NAME_PROFILE_DMA "nss_profile_dma"
+
+/*
* Voltage values
*/
#define NOMINAL_VOLTAGE 1
@@ -654,74 +668,96 @@ static void __nss_hal_send_interrupt(str
static int __nss_hal_request_irq(struct nss_ctx_instance *nss_ctx, struct nss_platform_data *npd, int irq_num)
{
struct int_ctx_instance *int_ctx = &nss_ctx->int_ctx[irq_num];
+ uint32_t cause, napi_wgt;
int err = -1, irq = npd->irq[irq_num];
+ int (*napi_poll_cb)(struct napi_struct *, int) = NULL;
+ const char *irq_name;
irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY);
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_SOS) {
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
- int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFERS_SOS;
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_sos", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_QUEUE) {
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT);
- int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFER_QUEUE;
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_queue", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_TX_UNBLOCKED) {
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT);
- int_ctx->cause = NSS_N2H_INTR_TX_UNBLOCKED;
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss-tx-unblock", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_0) {
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_0;
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue0", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_1) {
- int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_1;
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue1", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_2) {
- int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_2;
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue2", int_ctx);
- }
+ switch (irq_num) {
+ case NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_SOS:
+ napi_poll_cb = nss_core_handle_napi_non_queue;
+ napi_wgt = NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_EMPTY_BUFFERS_SOS;
+ irq_name = NSS_IRQ_NAME_EMPTY_BUF_SOS;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_QUEUE:
+ napi_poll_cb = nss_core_handle_napi_queue;
+ napi_wgt = NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_EMPTY_BUFFER_QUEUE;
+ irq_name = NSS_IRQ_NAME_EMPTY_BUF_QUEUE;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_TX_UNBLOCKED:
+ napi_poll_cb = nss_core_handle_napi_non_queue;
+ napi_wgt = NSS_TX_UNBLOCKED_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_TX_UNBLOCKED;
+ irq_name = NSS_IRQ_NAME_TX_UNBLOCK;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_0:
+ napi_poll_cb = nss_core_handle_napi_queue;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_DATA_QUEUE_0;
+ irq_name = NSS_IRQ_NAME_QUEUE0;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_1:
+ napi_poll_cb = nss_core_handle_napi_queue;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_DATA_QUEUE_1;
+ irq_name = NSS_IRQ_NAME_QUEUE1;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_2:
+ napi_poll_cb = nss_core_handle_napi_queue;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_DATA_QUEUE_2;
+ irq_name = NSS_IRQ_NAME_QUEUE2;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_3:
+ napi_poll_cb = nss_core_handle_napi_queue;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_DATA_QUEUE_3;
+ irq_name = NSS_IRQ_NAME_QUEUE3;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_COREDUMP_COMPLETE:
+ napi_poll_cb = nss_core_handle_napi_emergency;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_COREDUMP_COMPLETE;
+ irq_name = NSS_IRQ_NAME_COREDUMP_COMPLETE;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_PAGED_EMPTY_BUFFER_SOS:
+ napi_poll_cb = nss_core_handle_napi_non_queue;
+ napi_wgt = NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_PAGED_EMPTY_BUFFERS_SOS;
+ irq_name = NSS_IRQ_NAME_PAGED_EMPTY_BUF_SOS;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_PROFILE_DMA:
+ napi_poll_cb = nss_core_handle_napi_sdma;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_PROFILE_DMA;
+ irq_name = NSS_IRQ_NAME_PROFILE_DMA;
+ break;
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_3) {
- int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_3;
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue3", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_COREDUMP_COMPLETE) {
- int_ctx->cause = NSS_N2H_INTR_COREDUMP_COMPLETE;
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_coredump_complete", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PAGED_EMPTY_BUFFER_SOS) {
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
- int_ctx->cause = NSS_N2H_INTR_PAGED_EMPTY_BUFFERS_SOS;
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_paged_empty_buf_sos", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PROFILE_DMA) {
- int_ctx->cause = NSS_N2H_INTR_PROFILE_DMA;
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_profile_dma", int_ctx);
+ default:
+ nss_warning("%px: nss%d: unsupported irq# %d\n", nss_ctx, nss_ctx->id, irq_num);
+ return err;
}
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt);
+ int_ctx->cause = cause;
+ err = request_irq(irq, nss_hal_handle_irq, 0, irq_name, int_ctx);
if (err) {
+ nss_warning("%px: nss%d: request_irq failed for irq# %d\n", nss_ctx, nss_ctx->id, irq_num);
return err;
}
-
int_ctx->irq = irq;
return 0;
}
--- a/nss_hal/ipq60xx/nss_hal_pvt.c
+++ b/nss_hal/ipq60xx/nss_hal_pvt.c
@@ -64,6 +64,20 @@
#define NSS_UTCM_CLK "nss-utcm-clk"
/*
+ * N2H interrupts
+ */
+#define NSS_IRQ_NAME_EMPTY_BUF_SOS "nss_empty_buf_sos"
+#define NSS_IRQ_NAME_EMPTY_BUF_QUEUE "nss_empty_buf_queue"
+#define NSS_IRQ_NAME_TX_UNBLOCK "nss-tx-unblock"
+#define NSS_IRQ_NAME_QUEUE0 "nss_queue0"
+#define NSS_IRQ_NAME_QUEUE1 "nss_queue1"
+#define NSS_IRQ_NAME_QUEUE2 "nss_queue2"
+#define NSS_IRQ_NAME_QUEUE3 "nss_queue3"
+#define NSS_IRQ_NAME_COREDUMP_COMPLETE "nss_coredump_complete"
+#define NSS_IRQ_NAME_PAGED_EMPTY_BUF_SOS "nss_paged_empty_buf_sos"
+#define NSS_IRQ_NAME_PROFILE_DMA "nss_profile_dma"
+
+/*
* Voltage values
*/
#define NOMINAL_VOLTAGE 1
@@ -610,71 +624,94 @@ static void __nss_hal_send_interrupt(str
static int __nss_hal_request_irq(struct nss_ctx_instance *nss_ctx, struct nss_platform_data *npd, int irq_num)
{
struct int_ctx_instance *int_ctx = &nss_ctx->int_ctx[irq_num];
+ uint32_t cause, napi_wgt;
int err = -1, irq = npd->irq[irq_num];
+ int (*napi_poll_cb)(struct napi_struct *, int) = NULL;
+ const char *irq_name;
irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY);
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_SOS) {
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
- int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFERS_SOS;
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_sos", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_QUEUE) {
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT);
- int_ctx->cause = NSS_N2H_INTR_EMPTY_BUFFER_QUEUE;
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_empty_buf_queue", int_ctx);
- }
+ switch (irq_num) {
+ case NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_SOS:
+ napi_poll_cb = nss_core_handle_napi_non_queue;
+ napi_wgt = NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_EMPTY_BUFFERS_SOS;
+ irq_name = NSS_IRQ_NAME_EMPTY_BUF_SOS;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_EMPTY_BUFFER_QUEUE:
+ napi_poll_cb = nss_core_handle_napi_queue;
+ napi_wgt = NSS_EMPTY_BUFFER_RETURN_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_EMPTY_BUFFER_QUEUE;
+ irq_name = NSS_IRQ_NAME_EMPTY_BUF_QUEUE;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_TX_UNBLOCKED:
+ napi_poll_cb = nss_core_handle_napi_non_queue;
+ napi_wgt = NSS_TX_UNBLOCKED_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_TX_UNBLOCKED;
+ irq_name = NSS_IRQ_NAME_TX_UNBLOCK;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_0:
+ napi_poll_cb = nss_core_handle_napi_queue;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_DATA_QUEUE_0;
+ irq_name = NSS_IRQ_NAME_QUEUE0;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_1:
+ napi_poll_cb = nss_core_handle_napi_queue;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_DATA_QUEUE_1;
+ irq_name = NSS_IRQ_NAME_QUEUE1;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_2:
+ napi_poll_cb = nss_core_handle_napi_queue;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_DATA_QUEUE_2;
+ irq_name = NSS_IRQ_NAME_QUEUE2;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_3:
+ napi_poll_cb = nss_core_handle_napi_queue;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_DATA_QUEUE_3;
+ irq_name = NSS_IRQ_NAME_QUEUE3;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_COREDUMP_COMPLETE:
+ napi_poll_cb = nss_core_handle_napi_emergency;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_COREDUMP_COMPLETE;
+ irq_name = NSS_IRQ_NAME_COREDUMP_COMPLETE;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_PAGED_EMPTY_BUFFER_SOS:
+ napi_poll_cb = nss_core_handle_napi_non_queue;
+ napi_wgt = NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_PAGED_EMPTY_BUFFERS_SOS;
+ irq_name = NSS_IRQ_NAME_PAGED_EMPTY_BUF_SOS;
+ break;
+
+ case NSS_HAL_N2H_INTR_PURPOSE_PROFILE_DMA:
+ napi_poll_cb = nss_core_handle_napi_sdma;
+ napi_wgt = NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT;
+ cause = NSS_N2H_INTR_PROFILE_DMA;
+ irq_name = NSS_IRQ_NAME_PROFILE_DMA;
+ break;
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_TX_UNBLOCKED) {
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_TX_UNBLOCKED_PROCESSING_WEIGHT);
- int_ctx->cause = NSS_N2H_INTR_TX_UNBLOCKED;
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss-tx-unblock", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_0) {
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_0;
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue0", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_1) {
- int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_1;
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue1", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_2) {
- int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_2;
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue2", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_DATA_QUEUE_3) {
- int_ctx->cause = NSS_N2H_INTR_DATA_QUEUE_3;
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_queue, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_queue3", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_COREDUMP_COMPLETE) {
- int_ctx->cause = NSS_N2H_INTR_COREDUMP_COMPLETE;
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_emergency, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_coredump_complete", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PAGED_EMPTY_BUFFER_SOS) {
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_non_queue, NSS_EMPTY_BUFFER_SOS_PROCESSING_WEIGHT);
- int_ctx->cause = NSS_N2H_INTR_PAGED_EMPTY_BUFFERS_SOS;
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_paged_empty_buf_sos", int_ctx);
- }
-
- if (irq_num == NSS_HAL_N2H_INTR_PURPOSE_PROFILE_DMA) {
- int_ctx->cause = NSS_N2H_INTR_PROFILE_DMA;
- netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, nss_core_handle_napi_sdma, NSS_DATA_COMMAND_BUFFER_PROCESSING_WEIGHT);
- err = request_irq(irq, nss_hal_handle_irq, 0, "nss_profile_dma", int_ctx);
+ default:
+ nss_warning("%px: nss%d: unsupported irq# %d\n", nss_ctx, nss_ctx->id, irq_num);
+ return err;
}
+ netif_napi_add_weight(&nss_ctx->napi_ndev, &int_ctx->napi, napi_poll_cb, napi_wgt);
+ int_ctx->cause = cause;
+ err = request_irq(irq, nss_hal_handle_irq, 0, irq_name, int_ctx);
if (err) {
+ nss_warning("%px: nss%d: request_irq failed for irq# %d\n", nss_ctx, nss_ctx->id, irq_num);
return err;
}

View File

@@ -0,0 +1,79 @@
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -30,7 +30,6 @@
#include <linux/ethtool.h>
#include "nss_hal.h"
-#include "nss_arch.h"
#include "nss_core.h"
#include "nss_tx_rx_common.h"
#ifdef NSS_DATA_PLANE_GENERIC_SUPPORT
@@ -51,6 +50,57 @@
*/
#define NSS_AP0_IMAGE "qca-nss0.bin"
#define NSS_AP1_IMAGE "qca-nss1.bin"
+#define BUFFER_SIZE 8192
+
+// Function to search for the byte sequence in the buffer
+static unsigned char *search_sequence(const unsigned char *buffer,
+ size_t buffer_size,
+ const unsigned char *sequence,
+ size_t sequence_size)
+{
+ for (size_t i = 0; i <= buffer_size - sequence_size; i++) {
+ if (memcmp(buffer + i, sequence, sequence_size) == 0) {
+ return (unsigned char *)(buffer + i);
+ }
+ }
+ return NULL;
+}
+
+static int nss_hal_firmware_info(struct platform_device *nss_dev,
+ const struct firmware *fw)
+{
+ unsigned char *start_pos, *end_pos;
+ size_t i;
+ unsigned char start_sequence[] = { 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x20 };
+ unsigned char end_sequence[] = { 0x00 };
+ char version[256];
+ bool found = false;
+
+ // Search for the start sequence
+ start_pos = search_sequence(fw->data, fw->size, start_sequence, sizeof(start_sequence));
+ if (start_pos) {
+ start_pos += sizeof(start_sequence);
+
+ end_pos = search_sequence(start_pos, fw->size - (start_pos - fw->data), end_sequence, sizeof(end_sequence));
+ if (end_pos) {
+ // Convert the version information to a string
+ for (i = 0; start_pos + i < end_pos && i < sizeof(version) - 1; i++) {
+ version[i] = start_pos[i];
+ }
+ version[i] = '\0';
+
+ dev_info(&nss_dev->dev, "NSS fw version: %s\n", version);
+ found = true;
+ }
+ }
+
+ if (!found) {
+ dev_err(&nss_dev->dev, "Unable to get NSS fw version\n");
+ return -EINVAL;
+ }
+
+ return 0;
+}
int nss_hal_firmware_load(struct nss_ctx_instance *nss_ctx, struct platform_device *nss_dev, struct nss_platform_data *npd)
{
@@ -83,6 +133,10 @@ int nss_hal_firmware_load(struct nss_ctx
return rc;
}
+ if (nss_ctx->id == 0) {
+ nss_hal_firmware_info(nss_dev, nss_fw);
+ }
+
dev_info(&nss_dev->dev, "fw of size %d bytes copied to addr: %x, nss_id: %d\n", (int)nss_fw->size, npd->load_addr, nss_ctx->id);
memcpy_toio(load_mem, nss_fw->data, nss_fw->size);
release_firmware(nss_fw);

View File

@@ -0,0 +1,201 @@
--- a/exports/nss_capwap.h
+++ b/exports/nss_capwap.h
@@ -284,6 +284,7 @@ struct nss_capwap_dtls_msg {
uint32_t reserved; /**< Reserved field for future use. */
};
+#ifdef NSS_FIRMWARE_VERSION_12_5
/**
* nss_capwap_flow_attr
* Inner Flow attributes.
@@ -293,6 +294,7 @@ struct nss_capwap_flow_attr {
uint32_t flow_id; /**< Flow Identification. */
uint32_t scs_sdwf_id; /**< SCS or SDWF Identification. */
};
+#endif
/**
* nss_capwap_flow_rule_msg
@@ -312,7 +314,11 @@ struct nss_capwap_flow_rule_msg {
/*
* Flow attributes.
*/
+#ifdef NSS_FIRMWARE_VERSION_12_5
struct nss_capwap_flow_attr flow_attr;
+#else
+ uint32_t flow_id; /**< Flow identification. */
+#endif
};
/**
--- a/exports/nss_ipv4.h
+++ b/exports/nss_ipv4.h
@@ -290,7 +290,9 @@ enum nss_ipv4_stats_types {
#define NSS_IPV4_RULE_CREATE_IDENTIFIER_VALID 0x1000
/**< Identifier is valid. */
#define NSS_IPV4_RULE_CREATE_MIRROR_VALID 0x2000 /**< Mirror fields are valid. */
+#ifdef NSS_FIRMWARE_VERSION_12_5
#define NSS_IPV4_RULE_CREATE_RAWIP_VALID 0x4000 /**< RAW IP fields are valid. */
+#endif
/*
* Multicast command rule flags
--- a/exports/nss_pvxlan.h
+++ b/exports/nss_pvxlan.h
@@ -63,8 +63,10 @@ typedef enum nss_pvxlan_msg_type {
NSS_PVXLAN_MSG_TYPE_TUNNEL_DISABLE, /**< Disable the tunnel. */
NSS_PVXLAN_MSG_TYPE_MAC_ADD, /**< Add MAC rule to the database. */
NSS_PVXLAN_MSG_TYPE_MAC_DEL, /**< Remove MAC rule from the database. */
+#ifdef NSS_FIRMWARE_VERSION_12_5
NSS_PVXLAN_MSG_TYPE_CONFIG_VP, /**< VP configuration. */
NSS_PVXLAN_MSG_TYPE_UNCONFIG_VP, /**< VP unconfiguration. */
+#endif
NSS_PVXLAN_MSG_TYPE_MAX, /**< Maximum message type. */
} nss_pvxlan_msg_type_t;
@@ -97,10 +99,12 @@ typedef enum nss_pvxlan_error_response_t
/**< MAC entry allocation failed. */
PVXLAN_ERROR_MSG_MAC_ENTRY_DELETE_FAILED,
/**< MAC entry deletion failed. */
+#ifdef NSS_FIRMWARE_VERSION_12_5
PVXLAN_ERROR_MSG_CONFIG_VP_FAILED,
/**< VP configuration failed. */
PVXLAN_ERROR_MSG_UNCONFIG_VP_FAILED,
/**< VP unconfiguration failed. */
+#endif
NSS_PVXLAN_ERROR_MAX, /**< Maximum error type. */
} nss_pvxlan_error_response_t;
@@ -181,6 +185,7 @@ struct nss_pvxlan_mac_msg {
uint16_t policy_id; /**< Policy ID. */
};
+#ifdef NSS_FIRMWARE_VERSION_12_5
/**
* nss_pvxlan_vp_msg
* VP configuration message.
@@ -192,6 +197,7 @@ struct nss_pvxlan_vp_msg {
int16_t vp_num; /**< VP number. */
bool ppe_to_host; /**< Enable/disable PPE to host mode. */
};
+#endif
/**
* nss_pvxlan_msg
@@ -216,8 +222,10 @@ struct nss_pvxlan_msg {
/**< MAC rule add message. */
struct nss_pvxlan_mac_msg mac_del;
/**< MAC rule delete message. */
+#ifdef NSS_FIRMWARE_VERSION_12_5
struct nss_pvxlan_vp_msg vp_config;
/**< VP configuration message. */
+#endif
} msg; /**< Message payload. */
};
--- a/exports/nss_wifili_if.h
+++ b/exports/nss_wifili_if.h
@@ -1496,8 +1496,10 @@ struct nss_wifili_rx_ctrl_stats {
uint32_t bcast_rcv_bytes; /**< Total number of broadcast bytes received. */
uint32_t defrag_mcast_drop; /**< Total number of defrag multicast dropped packets. */
uint32_t mcast_3addr_drop; /**< Total number of 3 address multicast dropped packets. */
+#ifdef NSS_FIRMWARE_VERSION_12_5
uint32_t ucast_rcv_cnt; /**< Total number of unicast packets received. */
uint32_t ucast_rcv_bytes; /**< Total number of unicast bytes received. */
+#endif
};
/**
@@ -1509,8 +1511,10 @@ struct nss_wifili_retry_ctrl_stats {
uint32_t tx_retry_count; /**< Transmit retry count. */
uint32_t tx_multiple_retry_count; /**< Transmit multiple retry count. */
uint32_t rx_retry_count; /**< Receive retry count. */
+#ifdef NSS_FIRMWARE_VERSION_12_5
uint32_t tx_mpdu_retry_count; /**< Per mpdu retry count. */
uint32_t tx_mpdu_total_retry_count; /**< Total mpdu retry count. */
+#endif
};
/**
--- a/nss_pvxlan_log.c
+++ b/nss_pvxlan_log.c
@@ -36,7 +36,9 @@ static int8_t *nss_pvxlan_log_message_ty
"PVxLAN Disable Tunnel",
"PVxLAN Add MAC rule",
"PVxLAN Delete MAC rule",
+#ifdef NSS_FIRMWARE_VERSION_12_5
"PVxLAN Config VP"
+#endif
};
/*
@@ -54,7 +56,9 @@ static int8_t *nss_pvxlan_log_error_resp
"PVXLAN MAC Table Full",
"PVXLAN MAC Exists",
"PVXLAN MAC Does Not Exist",
+#ifdef NSS_FIRMWARE_VERSION_12_5
"PVXLAN Config VP failed"
+#endif
};
/*
@@ -158,6 +162,7 @@ static void nss_pvxlan_log_mac_del_msg(s
nss_pvxlan_log_mac_msg(npvcm);
}
+#ifdef NSS_FIRMWARE_VERSION_12_5
/*
* nss_pvxlan_log_unconfig_vp_msg()
* Log NSS PVXLAN unconfig VP message.
@@ -181,6 +186,7 @@ static void nss_pvxlan_log_config_vp_msg
vpm->vp_num,
vpm->ppe_to_host ? "enabled" : "disabled");
}
+#endif
/*
* nss_pvxlan_log_verbose()
@@ -213,6 +219,7 @@ static void nss_pvxlan_log_verbose(struc
nss_pvxlan_log_mac_del_msg(npvm);
break;
+#ifdef NSS_FIRMWARE_VERSION_12_5
case NSS_PVXLAN_MSG_TYPE_CONFIG_VP:
nss_pvxlan_log_config_vp_msg(npvm);
break;
@@ -220,6 +227,7 @@ static void nss_pvxlan_log_verbose(struc
case NSS_PVXLAN_MSG_TYPE_UNCONFIG_VP:
nss_pvxlan_log_unconfig_vp_msg(npvm);
break;
+#endif
case NSS_PVXLAN_MSG_TYPE_SYNC_STATS:
break;
--- a/nss_capwap_log.c
+++ b/nss_capwap_log.c
@@ -166,7 +166,11 @@ static void nss_capwap_flow_rule_msg(str
"CAPWAP Destination Port: %d\n"
"CAPWAP Source IP: %x %x %x %x\n"
"CAPWAP Destination IP: %x %x %x %x"
+#ifdef NSS_FIRMWARE_VERSION_12_5
"CAPWAP Flow type:%d Flow ID: %d SCS_SDWF ID: %d",
+#else
+ "CAPWAP Flow ID: %d",
+#endif
ncfrm,
ncfrm->ip_version, ncfrm->protocol,
ncfrm->src_port, ncfrm->dst_port,
@@ -174,9 +178,13 @@ static void nss_capwap_flow_rule_msg(str
ncfrm->src_ip[2], ncfrm->src_ip[3],
ncfrm->dst_ip[0], ncfrm->dst_ip[1],
ncfrm->dst_ip[2], ncfrm->dst_ip[3],
+#ifdef NSS_FIRMWARE_VERSION_12_5
ncfrm->flow_attr.type,
ncfrm->flow_attr.flow_id,
ncfrm->flow_attr.scs_sdwf_id);
+#else
+ ncfrm->flow_id);
+#endif
}
/*

View File

@@ -0,0 +1,88 @@
--- a/exports/nss_bridge.h
+++ b/exports/nss_bridge.h
@@ -273,7 +273,7 @@ nss_tx_status_t nss_bridge_tx_set_mtu_ms
* @return
* Status of the Tx operation.
*/
-nss_tx_status_t nss_bridge_tx_set_mac_addr_msg(uint32_t bridge_if_num, uint8_t *addr);
+nss_tx_status_t nss_bridge_tx_set_mac_addr_msg(uint32_t bridge_if_num, const uint8_t *addr);
/**
* nss_bridge_tx_join_msg
--- a/exports/nss_vlan.h
+++ b/exports/nss_vlan.h
@@ -210,7 +210,7 @@ nss_tx_status_t nss_vlan_tx_set_mtu_msg(
* @return
* Status of the Tx operation.
*/
-nss_tx_status_t nss_vlan_tx_set_mac_addr_msg(uint32_t vlan_if_num, uint8_t *addr);
+nss_tx_status_t nss_vlan_tx_set_mac_addr_msg(uint32_t vlan_if_num, const uint8_t *addr);
/**
* nss_vlan_tx_vsi_attach_msg
--- a/exports/nss_wifi_vdev.h
+++ b/exports/nss_wifi_vdev.h
@@ -1404,7 +1404,7 @@ nss_tx_status_t nss_wifi_vdev_base_set_n
* @return
* Status of the Tx operation.
*/
-nss_tx_status_t nss_wifi_vdev_set_peer_next_hop(struct nss_ctx_instance *nss_ctx, uint32_t nss_if, uint8_t *addr, uint32_t next_hop_if);
+nss_tx_status_t nss_wifi_vdev_set_peer_next_hop(struct nss_ctx_instance *nss_ctx, uint32_t nss_if, const uint8_t *addr, uint32_t next_hop_if);
/*
* nss_wifi_vdev_set_dp_type
--- a/nss_bridge.c
+++ b/nss_bridge.c
@@ -304,7 +304,7 @@ EXPORT_SYMBOL(nss_bridge_tx_set_mtu_msg)
* nss_bridge_tx_set_mac_addr_msg
* API to send change mac addr message to NSS FW
*/
-nss_tx_status_t nss_bridge_tx_set_mac_addr_msg(uint32_t bridge_if_num, uint8_t *addr)
+nss_tx_status_t nss_bridge_tx_set_mac_addr_msg(uint32_t bridge_if_num, const uint8_t *addr)
{
struct nss_ctx_instance *nss_ctx = nss_bridge_get_context();
struct nss_bridge_msg nbm;
--- a/nss_phys_if.c
+++ b/nss_phys_if.c
@@ -402,7 +402,7 @@ nss_tx_status_t nss_phys_if_link_state(s
* nss_phys_if_mac_addr()
* Send a MAC address to physical interface
*/
-nss_tx_status_t nss_phys_if_mac_addr(struct nss_ctx_instance *nss_ctx, uint8_t *addr, uint32_t if_num)
+nss_tx_status_t nss_phys_if_mac_addr(struct nss_ctx_instance *nss_ctx, const uint8_t *addr, uint32_t if_num)
{
struct nss_phys_if_msg nim;
struct nss_if_mac_address_set *nmas;
--- a/nss_phys_if.h
+++ b/nss_phys_if.h
@@ -284,7 +284,7 @@ nss_tx_status_t nss_phys_if_link_state(s
*
* @return nss_tx_status_t Tx status
*/
-nss_tx_status_t nss_phys_if_mac_addr(struct nss_ctx_instance *nss_ctx, uint8_t *addr, uint32_t if_num);
+nss_tx_status_t nss_phys_if_mac_addr(struct nss_ctx_instance *nss_ctx, const uint8_t *addr, uint32_t if_num);
/**
* @brief Send MTU change notification to NSS
--- a/nss_vlan.c
+++ b/nss_vlan.c
@@ -246,7 +246,7 @@ EXPORT_SYMBOL(nss_vlan_tx_set_mtu_msg);
* nss_vlan_tx_set_mac_addr_msg
* API to send change mac addr message to NSS FW
*/
-nss_tx_status_t nss_vlan_tx_set_mac_addr_msg(uint32_t vlan_if_num, uint8_t *addr)
+nss_tx_status_t nss_vlan_tx_set_mac_addr_msg(uint32_t vlan_if_num, const uint8_t *addr)
{
struct nss_ctx_instance *nss_ctx = nss_vlan_get_context();
struct nss_vlan_msg nvm;
--- a/nss_wifi_vdev.c
+++ b/nss_wifi_vdev.c
@@ -274,7 +274,7 @@ EXPORT_SYMBOL(nss_wifi_vdev_base_set_nex
/*
* nss_wifi_vdev_set_peer_next_hop()
*/
-nss_tx_status_t nss_wifi_vdev_set_peer_next_hop(struct nss_ctx_instance *ctx, uint32_t nss_if, uint8_t *addr, uint32_t next_hop_if)
+nss_tx_status_t nss_wifi_vdev_set_peer_next_hop(struct nss_ctx_instance *ctx, uint32_t nss_if, const uint8_t *addr, uint32_t next_hop_if)
{
nss_tx_status_t status;
struct nss_wifi_vdev_msg *wifivdevmsg = kzalloc(sizeof(struct nss_wifi_vdev_msg), GFP_KERNEL);

View File

@@ -0,0 +1,60 @@
--- a/nss_core.c
+++ b/nss_core.c
@@ -92,6 +92,8 @@ static int qos_mem_size = 0;
module_param(qos_mem_size, int, S_IRUGO);
MODULE_PARM_DESC(qos_mem_size, "QoS memory size");
+static int nss_bootstate = 0;
+
/*
* Atomic variables to control jumbo_mru & paged_mode
*/
@@ -2253,6 +2255,19 @@ static inline void nss_core_handle_tx_un
nss_hal_disable_interrupt(nss_ctx, nss_ctx->int_ctx[0].shift_factor, NSS_N2H_INTR_TX_UNBLOCKED);
}
+void nss_bootwait(void)
+{
+ int dead = 10 * 10;
+#if (NSS_MAX_CORES > 1)
+ while (nss_bootstate < 2 && dead-- > 0)
+#else
+ while (!nss_bootstate && dead-- > 0)
+#endif
+ {
+ msleep(100);
+ }
+}
+
/*
* nss_core_handle_cause_nonqueue()
* Handle non-queue interrupt causes (e.g. empty buffer SOS, Tx unblocked)
@@ -2321,6 +2336,9 @@ static void nss_core_handle_cause_nonque
#endif
#endif
}
+ if (unlikely(nss_ctx->state == NSS_CORE_STATE_INITIALIZED)) {
+ nss_bootstate++;
+ }
#if defined(NSS_DRV_EDMA_LITE_ENABLE)
/*
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -850,6 +850,7 @@ int nss_hal_probe(struct platform_device
}
nss_info("%px: All resources initialized and nss core%d has been brought out of reset", nss_ctx, nss_dev->id);
+ nss_bootwait();
goto out;
err_register_irq:
--- a/nss_core.h
+++ b/nss_core.h
@@ -1082,4 +1082,6 @@ extern nss_tx_status_t nss_n2h_cfg_empty
extern nss_tx_status_t nss_n2h_paged_buf_pool_init(struct nss_ctx_instance *nss_ctx);
extern nss_tx_status_t nss_n2h_cfg_qos_mem_size(struct nss_ctx_instance *nss_ctx, uint32_t pool_sz);
+void nss_bootwait(void);
+
#endif /* __NSS_CORE_H */

View File

@@ -0,0 +1,39 @@
--- a/nss_wifi_mesh_strings.c
+++ b/nss_wifi_mesh_strings.c
@@ -80,8 +80,8 @@ struct nss_stats_info nss_wifi_mesh_stri
{"not_found", NSS_STATS_TYPE_SPECIAL},
{"delete_success", NSS_STATS_TYPE_SPECIAL},
{"update_success", NSS_STATS_TYPE_SPECIAL},
- {"mesh_path_expired", NSS_STATS_TYPE_SPECIAL},
- {"mesh_path_refresh_needed", NSS_STATS_TYPE_SPECIAL},
+ {"path_expired", NSS_STATS_TYPE_SPECIAL},
+ {"path_refresh_needed", NSS_STATS_TYPE_SPECIAL},
{"add_requests", NSS_STATS_TYPE_SPECIAL},
{"del_requests", NSS_STATS_TYPE_SPECIAL},
{"update_requests", NSS_STATS_TYPE_SPECIAL},
@@ -91,8 +91,8 @@ struct nss_stats_info nss_wifi_mesh_stri
{"metric_updations", NSS_STATS_TYPE_SPECIAL},
{"block_mesh_fwd_updations", NSS_STATS_TYPE_SPECIAL},
{"delete_failures", NSS_STATS_TYPE_SPECIAL},
- {"mesh_path_dummy_add_failures",NSS_STATS_TYPE_SPECIAL},
- {"mesh_path_dummy_add_success", NSS_STATS_TYPE_SPECIAL}
+ {"path_dummy_add_failures", NSS_STATS_TYPE_SPECIAL},
+ {"path_dummy_add_success", NSS_STATS_TYPE_SPECIAL}
};
@@ -126,10 +126,10 @@ struct nss_stats_info nss_wifi_mesh_stri
{"update_requests", NSS_STATS_TYPE_SPECIAL},
{"mda_updations", NSS_STATS_TYPE_SPECIAL},
{"flag_updations", NSS_STATS_TYPE_SPECIAL},
- {"mesh_proxy_path_dummy_lookup_success", NSS_STATS_TYPE_SPECIAL},
- {"mesh_proxy_path_dummy_lookup_failures", NSS_STATS_TYPE_SPECIAL},
- {"mesh_proxy_path_dummy_add_failures", NSS_STATS_TYPE_SPECIAL},
- {"mesh_proxy_path_dummy_add_success", NSS_STATS_TYPE_SPECIAL}
+ {"proxy_path_dummy_lookup_success", NSS_STATS_TYPE_SPECIAL},
+ {"proxy_path_dummy_lookup_failures", NSS_STATS_TYPE_SPECIAL},
+ {"proxy_path_dummy_add_failures", NSS_STATS_TYPE_SPECIAL},
+ {"proxy_path_dummy_add_success", NSS_STATS_TYPE_SPECIAL}
};
/*

View File

@@ -0,0 +1,195 @@
--- a/nss_rps.c
+++ b/nss_rps.c
@@ -70,7 +70,7 @@ static inline void nss_rps_pri_map_usage
* nss_rps_pri_map_print()
* Sysctl handler for printing rps/pri mapping.
*/
-static int nss_rps_pri_map_print(struct ctl_table *ctl, void __user *buffer,
+static int nss_rps_pri_map_print(void *buffer,
size_t *lenp, loff_t *ppos, int *pri_map)
{
char *r_buf;
@@ -109,7 +109,7 @@ static int nss_rps_pri_map_print(struct
len = scnprintf(r_buf + cp_bytes, 4, "\n");
cp_bytes += len;
- cp_bytes = simple_read_from_buffer(buffer, *lenp, ppos, r_buf, cp_bytes);
+ cp_bytes = memory_read_from_buffer(buffer, *lenp, ppos, r_buf, cp_bytes);
*lenp = cp_bytes;
kfree(r_buf);
return 0;
@@ -119,13 +119,10 @@ static int nss_rps_pri_map_print(struct
* nss_rps_pri_map_parse()
* Sysctl handler for rps/pri mappings.
*/
-static int nss_rps_pri_map_parse(struct ctl_table *ctl, void __user *buffer,
- size_t *lenp, loff_t *ppos, struct nss_rps_pri_map_parse_data *out)
+static int nss_rps_pri_map_parse(void *buffer,
+ size_t *lenp, struct nss_rps_pri_map_parse_data *out)
{
- size_t cp_bytes = 0;
char w_buf[5];
- loff_t w_offset = 0;
- char *str;
unsigned int pri;
int core, res;
@@ -140,14 +137,15 @@ static int nss_rps_pri_map_parse(struct
/*
* It's a write operation
*/
- cp_bytes = simple_write_to_buffer(w_buf, *lenp, &w_offset, buffer, 5);
- if (cp_bytes != *lenp) {
- nss_warning("failed to write to buffer\n");
- return -EFAULT;
+ if (*lenp >= sizeof(w_buf)) {
+ nss_warning("Input too large: %zu\n", *lenp);
+ return -EINVAL;
}
- str = w_buf;
- res = sscanf(str, "%u %d", &pri, &core);
+ memcpy(w_buf, buffer, *lenp);
+ w_buf[*lenp] = '\0'; /* Ensure null termination */
+
+ res = sscanf(w_buf, "%u %d", &pri, &core);
if (res != NSS_RPS_PRI_MAP_PARAM_FIELD_COUNT) {
nss_warning("failed to read the buffer\n");
return -EFAULT;
@@ -407,7 +405,7 @@ static nss_tx_status_t nss_rps_pri_map_c
* Enable NSS RPS.
*/
static int nss_rps_cfg_handler(struct ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx;
@@ -458,7 +456,7 @@ static int nss_rps_cfg_handler(struct ct
* Configure NSS rps_hash_bitmap
*/
static int nss_rps_hash_bitmap_cfg_handler(struct ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx __attribute__((unused)) = &nss_top->nss[0];
@@ -521,7 +519,7 @@ static int nss_rps_hash_bitmap_cfg_handl
* Configure NSS rps_pri_map
*/
static int nss_rps_pri_map_cfg_handler(struct ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[0];
@@ -529,10 +527,10 @@ static int nss_rps_pri_map_cfg_handler(s
int ret, ret_pri_map;
struct nss_rps_pri_map_parse_data out, current_state;
if (!write) {
- return nss_rps_pri_map_print(ctl, buffer, lenp, ppos, nss_rps_pri_map);
+ return nss_rps_pri_map_print(buffer, lenp, ppos, nss_rps_pri_map);
}
- ret = nss_rps_pri_map_parse(ctl, buffer, lenp, ppos, &out);
+ ret = nss_rps_pri_map_parse(buffer, lenp, &out);
if (ret != NSS_SUCCESS) {
nss_rps_pri_map_usage();
--- a/nss_ipv6.c
+++ b/nss_ipv6.c
@@ -595,7 +595,7 @@ void nss_ipv6_free_conn_tables(void)
* nss_ipv6_accel_mode_cfg_handler()
* Configure acceleration mode for IPv6
*/
-static int nss_ipv6_accel_mode_cfg_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_ipv6_accel_mode_cfg_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[0];
@@ -639,7 +639,7 @@ static int nss_ipv6_accel_mode_cfg_handl
* nss_ipv6_dscp_map_cfg_handler()
* Sysctl handler for dscp/pri mappings.
*/
-static int nss_ipv6_dscp_map_cfg_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_ipv6_dscp_map_cfg_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[0];
--- a/nss_ipv4.c
+++ b/nss_ipv4.c
@@ -599,7 +599,7 @@ void nss_ipv4_free_conn_tables(void)
* nss_ipv4_accel_mode_cfg_handler()
* Configure acceleration mode for IPv4
*/
-static int nss_ipv4_accel_mode_cfg_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_ipv4_accel_mode_cfg_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[0];
@@ -643,7 +643,7 @@ static int nss_ipv4_accel_mode_cfg_handl
* nss_ipv4_dscp_map_cfg_handler()
* Sysctl handler for dscp/pri mappings.
*/
-static int nss_ipv4_dscp_map_cfg_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_ipv4_dscp_map_cfg_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[0];
--- a/nss_dscp_map.h
+++ b/nss_dscp_map.h
@@ -46,7 +46,7 @@ struct nss_dscp_map_parse {
* nss_dscp_map_print()
* Sysctl handler for printing dscp/pri mapping.
*/
-static int nss_dscp_map_print(struct ctl_table *ctl, void __user *buffer, size_t *lenp,
+static int nss_dscp_map_print(struct ctl_table *ctl, void *buffer, size_t *lenp,
loff_t *ppos, struct nss_dscp_map_entry *mapping)
{
char *r_buf;
@@ -105,7 +105,7 @@ static int nss_dscp_map_print(struct ctl
len = scnprintf(r_buf + cp_bytes, 4, "\n");
cp_bytes += len;
- cp_bytes = simple_read_from_buffer(buffer, *lenp, ppos, r_buf, cp_bytes);
+ cp_bytes = memory_read_from_buffer(buffer, *lenp, ppos, r_buf, cp_bytes);
*lenp = cp_bytes;
kfree(r_buf);
return 0;
@@ -115,13 +115,11 @@ static int nss_dscp_map_print(struct ctl
* nss_dscp_map_parse()
* Sysctl handler for dscp/pri mappings.
*/
-static int nss_dscp_map_parse(struct ctl_table *ctl, void __user *buffer, size_t *lenp,
+static int nss_dscp_map_parse(struct ctl_table *ctl, void *buffer, size_t *lenp,
loff_t *ppos, struct nss_dscp_map_parse *out)
{
int count;
- size_t cp_bytes = 0;
char w_buf[7];
- loff_t w_offset = 0;
char *str;
char *tokens[NSS_DSCP_MAP_PARAM_FIELD_COUNT];
unsigned int dscp, priority, action;
@@ -135,15 +133,14 @@ static int nss_dscp_map_parse(struct ctl
return -EINVAL;
}
- /*
- * It's a write operation
- */
- cp_bytes = simple_write_to_buffer(w_buf, *lenp, &w_offset, buffer, 7);
- if (cp_bytes != *lenp) {
- nss_warning("failed to write to buffer\n");
- return -EFAULT;
+ if (*lenp >= sizeof(w_buf)) {
+ nss_warning("Input too large: %zu\n", *lenp);
+ return -EINVAL;
}
+ memcpy(w_buf, buffer, *lenp);
+ w_buf[*lenp] = '\0'; /* Ensure null termination */
+
count = 0;
str = w_buf;
tokens[count] = strsep(&str, " ");

View File

@@ -0,0 +1,799 @@
--- a/nss_core.c
+++ b/nss_core.c
@@ -38,6 +38,9 @@
#endif
#endif
#include <linux/etherdevice.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0))
+#include <linux/skbuff_ref.h>
+#endif
#include "nss_tx_rx_common.h"
#ifdef NSS_DATA_PLANE_GENERIC_SUPPORT
@@ -50,26 +53,7 @@
#define NSS_CORE_JUMBO_LINEAR_BUF_SIZE 128
#if (NSS_SKB_REUSE_SUPPORT == 1)
-/*
- * We have validated the skb recycling code within the NSS for the
- * following kernel versions. Before enabling the driver in new kernels,
- * the skb recycle code must be checked against Linux skb handling.
- *
- * Tested on: 3.4, 3.10, 3.14, 3.18, 4.4, 5.4 and 6.6
- */
-#if (!( \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0))))))
-#error "Check skb recycle code in this file to match Linux version"
-#endif
-
static atomic_t max_reuse = ATOMIC_INIT(PAGE_SIZE);
-
#endif /* NSS_SKB_REUSE_SUPPORT */
static int max_ipv4_conn = NSS_DEFAULT_NUM_CONN;
--- a/Makefile
+++ b/Makefile
@@ -598,7 +598,7 @@ ccflags-y += -I$(obj)/nss_hal/include -I
ccflags-y += -I$(obj)/nss_data_plane/hal/include
ccflags-y += -DNSS_PM_DEBUG_LEVEL=0 -DNSS_SKB_REUSE_SUPPORT=1
-ccflags-y += -Wall -Werror
+ccflags-y += -Wall -Werror -Wno-missing-declarations -Wno-missing-prototypes -Wno-empty-body
KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION)))
@@ -630,6 +630,8 @@ qca-nss-drv-objs += \
ccflags-y += -DNSS_FREQ_SCALE_SUPPORT=1
endif
+ccflags-y += -include $(obj)/compat.h
+
ccflags-y += $(NSS_CCFLAGS)
export NSS_CCFLAGS
--- a/nss_init.c
+++ b/nss_init.c
@@ -123,10 +123,17 @@ static inline int nss_probe(struct platf
* nss_remove()
* HLOS device remove callback
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0))
static inline int nss_remove(struct platform_device *nss_dev)
{
return nss_hal_remove(nss_dev);
}
+#else
+static inline void nss_remove(struct platform_device *nss_dev)
+{
+ nss_hal_remove(nss_dev);
+}
+#endif
#if (NSS_DT_SUPPORT == 1)
/*
@@ -136,7 +143,6 @@ struct of_device_id nss_dt_ids[] = {
{ .compatible = "qcom,nss" },
{ .compatible = "qcom,nss0" },
{ .compatible = "qcom,nss1" },
- {},
};
MODULE_DEVICE_TABLE(of, nss_dt_ids);
#endif
@@ -176,7 +182,7 @@ static void nss_reset_frequency_stats_sa
* nss_current_freq_handler()
* Handle Userspace Frequency Change Requests
*/
-static int nss_current_freq_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_current_freq_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret, i;
@@ -236,7 +242,7 @@ static int nss_current_freq_handler(stru
* nss_auto_scale_handler()
* Enables or Disable Auto Scaling
*/
-static int nss_auto_scale_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_auto_scale_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
@@ -301,7 +307,7 @@ static int nss_auto_scale_handler(struct
* nss_get_freq_table_handler()
* Display Support Freq and Ex how to Change.
*/
-static int nss_get_freq_table_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_get_freq_table_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret, i;
@@ -330,7 +336,7 @@ static int nss_get_freq_table_handler(st
* nss_get_average_inst_handler()
* Display AVG Inst Per Ms.
*/
-static int nss_get_average_inst_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_get_average_inst_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
@@ -352,7 +358,7 @@ static int nss_get_average_inst_handler(
* nss_debug_handler()
* Enable NSS debug output
*/
-static int nss_debug_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_debug_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
@@ -372,7 +378,7 @@ static int nss_debug_handler(struct ctl_
* nss_coredump_handler()
* Send Signal To Coredump NSS Cores
*/
-static int nss_coredump_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_coredump_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_ctx_instance *nss_ctx = &nss_top_main.nss[NSS_CORE_0];
int ret;
@@ -397,7 +403,7 @@ static int nss_coredump_handler(struct c
* nss_jumbo_mru_handler()
* Sysctl to modify nss_jumbo_mru
*/
-static int nss_jumbo_mru_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_jumbo_mru_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
@@ -418,7 +424,7 @@ static int nss_jumbo_mru_handler(struct
* Sysctl to modify nss_paged_mode.
*/
-static int nss_paged_mode_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_paged_mode_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
@@ -440,7 +446,7 @@ static int nss_paged_mode_handler(struct
* nss_get_min_reuse_handler()
* Sysctl to get min reuse sizes
*/
-static int nss_get_min_reuse_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_get_min_reuse_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
struct nss_ctx_instance *nss_ctx = NULL;
@@ -467,7 +473,7 @@ static int nss_get_min_reuse_handler(str
* nss_max_reuse_handler()
* Sysctl to modify nss_max_reuse
*/
-static int nss_max_reuse_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_max_reuse_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
@@ -502,8 +508,7 @@ static struct ctl_table nss_skb_reuse_ta
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &nss_max_reuse_handler,
- },
- { }
+ }
};
#endif
@@ -539,8 +544,7 @@ static struct ctl_table nss_freq_table[]
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &nss_get_average_inst_handler,
- },
- { }
+ }
};
#endif
@@ -588,8 +592,7 @@ static struct ctl_table nss_general_tabl
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &nss_paged_mode_handler,
- },
- { }
+ }
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
--- a/nss_stats.c
+++ b/nss_stats.c
@@ -70,7 +70,7 @@ static size_t nss_stats_spacing(uint64_t
* nss_stats_nonzero_handler()
* Handler to take nonzero stats print configuration.
*/
-static int nss_stats_nonzero_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_stats_nonzero_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
@@ -84,8 +84,7 @@ static struct ctl_table nss_stats_table[
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &nss_stats_nonzero_handler,
- },
- { }
+ }
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
@@ -261,7 +260,7 @@ size_t nss_stats_banner(char *lbuf, size
size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "<");
}
- strlcpy(node_upr, node, NSS_STATS_NODE_NAME_MAX);
+ strscpy(node_upr, node, NSS_STATS_NODE_NAME_MAX + 1);
for (i = 0; node_upr[i] != '\0' && i < NSS_STATS_NODE_NAME_MAX; i++) {
node_upr[i] = toupper(node_upr[i]);
}
@@ -326,7 +325,7 @@ size_t nss_stats_print(char *node, char
continue;
}
- strlcpy(stats_string, stats_info[i].stats_name, NSS_STATS_MAX_STR_LENGTH);
+ strscpy(stats_string, stats_info[i].stats_name, NSS_STATS_MAX_STR_LENGTH);
/*
* Converting uppercase to lower case.
@@ -335,7 +334,7 @@ size_t nss_stats_print(char *node, char
stats_string[j] = tolower(stats_string[j]);
}
- strlcpy(node_lwr, node, NSS_STATS_NODE_NAME_MAX);
+ strscpy(node_lwr, node, NSS_STATS_NODE_NAME_MAX + 1);
for (j = 0; node_lwr[j] != '\0' && j < NSS_STATS_NODE_NAME_MAX; j++) {
node_lwr[j] = tolower(node_lwr[j]);
}
--- a/nss_tunipip6_stats.c
+++ b/nss_tunipip6_stats.c
@@ -17,6 +17,10 @@
**************************************************************************
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
+#include <linux/vmalloc.h>
+#endif
+
#include "nss_core.h"
#include "nss_tunipip6.h"
#include "nss_stats.h"
--- /dev/null
+++ b/compat.h
@@ -0,0 +1,14 @@
+// compat.h
+#ifndef _COMPAT_H
+#define _COMPAT_H
+
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
+#include <linux/vmalloc.h>
+#define compat_const const
+#else
+#define compat_const
+#endif
+
+#endif /* _COMPAT_H */
--- a/nss_c2c_tx.c
+++ b/nss_c2c_tx.c
@@ -284,7 +284,7 @@ EXPORT_SYMBOL(nss_c2c_tx_msg_init);
* nss_c2c_tx_performance_test_handler()
* Handles the performance test.
*/
-static int nss_c2c_tx_performance_test_handler(struct ctl_table *ctl, int write,
+static int nss_c2c_tx_performance_test_handler(compat_const struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
@@ -330,8 +330,7 @@ static struct ctl_table nss_c2c_tx_table
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &nss_c2c_tx_performance_test_handler,
- },
- { }
+ }
};
static struct ctl_table_header *nss_c2c_tx_header;
--- a/nss_dma.c
+++ b/nss_dma.c
@@ -285,7 +285,7 @@ EXPORT_SYMBOL(nss_dma_get_context);
* nss_dma_test_handler()
* Handles the performance test.
*/
-static int nss_dma_test_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_dma_test_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_ctx_instance *nss_ctx = nss_dma_get_context();
int cur_state = test_cfg.run.val;
@@ -375,8 +375,7 @@ static struct ctl_table nss_dma_table[]
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
- },
- { }
+ }
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
--- a/nss_ipv4.c
+++ b/nss_ipv4.c
@@ -599,7 +599,7 @@ void nss_ipv4_free_conn_tables(void)
* nss_ipv4_accel_mode_cfg_handler()
* Configure acceleration mode for IPv4
*/
-static int nss_ipv4_accel_mode_cfg_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+static int nss_ipv4_accel_mode_cfg_handler(compat_const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[0];
@@ -643,7 +643,7 @@ static int nss_ipv4_accel_mode_cfg_handl
* nss_ipv4_dscp_map_cfg_handler()
* Sysctl handler for dscp/pri mappings.
*/
-static int nss_ipv4_dscp_map_cfg_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+static int nss_ipv4_dscp_map_cfg_handler(compat_const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[0];
@@ -708,8 +708,7 @@ static struct ctl_table nss_ipv4_table[]
.maxlen = sizeof(struct nss_dscp_map_entry),
.mode = 0644,
.proc_handler = &nss_ipv4_dscp_map_cfg_handler,
- },
- { }
+ }
};
static struct ctl_table_header *nss_ipv4_header;
--- a/nss_ipv6.c
+++ b/nss_ipv6.c
@@ -595,7 +595,7 @@ void nss_ipv6_free_conn_tables(void)
* nss_ipv6_accel_mode_cfg_handler()
* Configure acceleration mode for IPv6
*/
-static int nss_ipv6_accel_mode_cfg_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+static int nss_ipv6_accel_mode_cfg_handler(compat_const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[0];
@@ -639,7 +639,7 @@ static int nss_ipv6_accel_mode_cfg_handl
* nss_ipv6_dscp_map_cfg_handler()
* Sysctl handler for dscp/pri mappings.
*/
-static int nss_ipv6_dscp_map_cfg_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+static int nss_ipv6_dscp_map_cfg_handler(compat_const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[0];
@@ -703,8 +703,7 @@ static struct ctl_table nss_ipv6_table[]
.maxlen = sizeof(struct nss_dscp_map_entry),
.mode = 0644,
.proc_handler = &nss_ipv6_dscp_map_cfg_handler,
- },
- { }
+ }
};
static struct ctl_table_header *nss_ipv6_header;
--- a/nss_log.c
+++ b/nss_log.c
@@ -524,7 +524,7 @@ fail:
* nss_logbuffer_handler()
* Enable NSS debug output
*/
-int nss_logbuffer_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+int nss_logbuffer_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
int core_status;
--- a/nss_n2h.c
+++ b/nss_n2h.c
@@ -357,7 +357,7 @@ static int nss_n2h_get_paged_payload_inf
* nss_n2h_set_empty_buf_pool()
* Sets empty pool buffer
*/
-static int nss_n2h_set_empty_buf_pool(struct ctl_table *ctl, int write,
+static int nss_n2h_set_empty_buf_pool(compat_const struct ctl_table *ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos,
nss_ptr_t core_num, int *new_val)
@@ -459,7 +459,7 @@ failure:
* nss_n2h_set_empty_paged_pool_buf()
* Sets empty paged pool buffer
*/
-static int nss_n2h_set_empty_paged_pool_buf(struct ctl_table *ctl, int write,
+static int nss_n2h_set_empty_paged_pool_buf(compat_const struct ctl_table *ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos,
nss_ptr_t core_num, int *new_val)
@@ -561,7 +561,7 @@ failure:
* nss_n2h_set_water_mark()
* Sets water mark for N2H SOS
*/
-static int nss_n2h_set_water_mark(struct ctl_table *ctl, int write,
+static int nss_n2h_set_water_mark(compat_const struct ctl_table *ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos,
uint32_t core_num, int *low, int *high)
@@ -675,7 +675,7 @@ failure:
* nss_n2h_set_paged_water_mark()
* Sets water mark for paged pool N2H SOS
*/
-static int nss_n2h_set_paged_water_mark(struct ctl_table *ctl, int write,
+static int nss_n2h_set_paged_water_mark(compat_const struct ctl_table *ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos,
uint32_t core_num, int *low, int *high)
@@ -789,7 +789,7 @@ failure:
* nss_n2h_cfg_wifi_pool()
* Sets number of wifi payloads to adjust high water mark for N2H SoS
*/
-static int nss_n2h_cfg_wifi_pool(struct ctl_table *ctl, int write,
+static int nss_n2h_cfg_wifi_pool(compat_const struct ctl_table *ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos,
int *payloads)
@@ -886,7 +886,7 @@ failure:
* nss_n2h_empty_pool_buf_core1_handler()
* Sets the number of empty buffer for core 1
*/
-static int nss_n2h_empty_pool_buf_cfg_core1_handler(struct ctl_table *ctl,
+static int nss_n2h_empty_pool_buf_cfg_core1_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -898,7 +898,7 @@ static int nss_n2h_empty_pool_buf_cfg_co
* nss_n2h_empty_pool_buf_core0_handler()
* Sets the number of empty buffer for core 0
*/
-static int nss_n2h_empty_pool_buf_cfg_core0_handler(struct ctl_table *ctl,
+static int nss_n2h_empty_pool_buf_cfg_core0_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -910,7 +910,7 @@ static int nss_n2h_empty_pool_buf_cfg_co
* nss_n2h_empty_paged_pool_buf_cfg_core1_handler()
* Sets the number of empty paged buffer for core 1
*/
-static int nss_n2h_empty_paged_pool_buf_cfg_core1_handler(struct ctl_table *ctl,
+static int nss_n2h_empty_paged_pool_buf_cfg_core1_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -922,7 +922,7 @@ static int nss_n2h_empty_paged_pool_buf_
* nss_n2h_empty_paged_pool_buf_cfg_core0_handler()
* Sets the number of empty paged buffer for core 0
*/
-static int nss_n2h_empty_paged_pool_buf_cfg_core0_handler(struct ctl_table *ctl,
+static int nss_n2h_empty_paged_pool_buf_cfg_core0_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -934,7 +934,7 @@ static int nss_n2h_empty_paged_pool_buf_
* nss_n2h_water_mark_core1_handler()
* Sets water mark for core 1
*/
-static int nss_n2h_water_mark_core1_handler(struct ctl_table *ctl,
+static int nss_n2h_water_mark_core1_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -947,7 +947,7 @@ static int nss_n2h_water_mark_core1_hand
* nss_n2h_water_mark_core0_handler()
* Sets water mark for core 0
*/
-static int nss_n2h_water_mark_core0_handler(struct ctl_table *ctl,
+static int nss_n2h_water_mark_core0_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -960,7 +960,7 @@ static int nss_n2h_water_mark_core0_hand
* nss_n2h_paged_water_mark_core1_handler()
* Sets paged water mark for core 1
*/
-static int nss_n2h_paged_water_mark_core1_handler(struct ctl_table *ctl,
+static int nss_n2h_paged_water_mark_core1_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -973,7 +973,7 @@ static int nss_n2h_paged_water_mark_core
* nss_n2h_paged_water_mark_core0_handler()
* Sets paged water mark for core 0
*/
-static int nss_n2h_paged_water_mark_core0_handler(struct ctl_table *ctl,
+static int nss_n2h_paged_water_mark_core0_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -986,7 +986,7 @@ static int nss_n2h_paged_water_mark_core
* nss_n2h_wifi_payloads_handler()
* Sets number of wifi payloads
*/
-static int nss_n2h_wifi_payloads_handler(struct ctl_table *ctl,
+static int nss_n2h_wifi_payloads_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -1281,7 +1281,7 @@ failure:
* nss_mitigation_handler()
* Enable NSS MITIGATION
*/
-static int nss_n2h_mitigationcfg_core0_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_n2h_mitigationcfg_core0_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[NSS_CORE_0];
@@ -1312,7 +1312,7 @@ static int nss_n2h_mitigationcfg_core0_h
* nss_mitigation_handler()
* Enable NSS MITIGATION
*/
-static int nss_n2h_mitigationcfg_core1_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_n2h_mitigationcfg_core1_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[NSS_CORE_1];
@@ -1343,7 +1343,7 @@ static int nss_n2h_mitigationcfg_core1_h
* nss_buf_handler()
* Add extra NSS bufs from host memory
*/
-static int nss_n2h_buf_cfg_core0_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_n2h_buf_cfg_core0_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[NSS_CORE_0];
@@ -1382,7 +1382,7 @@ static int nss_n2h_buf_cfg_core0_handler
* nss_n2h_buf_handler()
* Add extra NSS bufs from host memory
*/
-static int nss_n2h_buf_cfg_core1_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_n2h_buf_cfg_core1_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
struct nss_ctx_instance *nss_ctx = &nss_top->nss[NSS_CORE_1];
@@ -1435,7 +1435,7 @@ static void nss_n2h_queue_limit_callback
* nss_n2h_set_queue_limit_sync()
* Sets the n2h queue size limit synchronously.
*/
-static int nss_n2h_set_queue_limit_sync(struct ctl_table *ctl, int write, void __user *buffer,
+static int nss_n2h_set_queue_limit_sync(compat_const struct ctl_table *ctl, int write, void __user *buffer,
size_t *lenp, loff_t *ppos, uint32_t core_id)
{
struct nss_top_instance *nss_top = &nss_top_main;
@@ -1512,7 +1512,7 @@ static int nss_n2h_set_queue_limit_sync(
* nss_n2h_queue_limit_core0_handler()
* Sets the n2h queue size limit for core0
*/
-static int nss_n2h_queue_limit_core0_handler(struct ctl_table *ctl,
+static int nss_n2h_queue_limit_core0_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -1524,7 +1524,7 @@ static int nss_n2h_queue_limit_core0_han
* nss_n2h_queue_limit_core1_handler()
* Sets the n2h queue size limit for core1
*/
-static int nss_n2h_queue_limit_core1_handler(struct ctl_table *ctl,
+static int nss_n2h_queue_limit_core1_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
@@ -1602,7 +1602,7 @@ static nss_tx_status_t nss_n2h_host_bp_c
* nss_n2h_host_bp_cfg_handler()
* Enable n2h back pressure.
*/
-static int nss_n2h_host_bp_cfg_handler(struct ctl_table *ctl, int write,
+static int nss_n2h_host_bp_cfg_handler(compat_const struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos, uint32_t core_id)
{
struct nss_top_instance *nss_top = &nss_top_main;
@@ -1640,7 +1640,7 @@ static int nss_n2h_host_bp_cfg_handler(s
* nss_n2h_host_bp_cfg_core0_handler()
* Enable n2h back pressure in core 0.
*/
-static int nss_n2h_host_bp_cfg_core0_handler(struct ctl_table *ctl, int write,
+static int nss_n2h_host_bp_cfg_core0_handler(compat_const struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
return nss_n2h_host_bp_cfg_handler(ctl, write, buffer, lenp, ppos, NSS_CORE_0);
@@ -1650,7 +1650,7 @@ static int nss_n2h_host_bp_cfg_core0_han
* nss_n2h_host_bp_cfg_core1_handler()
* Enable n2h back pressure in core 1.
*/
-static int nss_n2h_host_bp_cfg_core1_handler(struct ctl_table *ctl, int write,
+static int nss_n2h_host_bp_cfg_core1_handler(compat_const struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
return nss_n2h_host_bp_cfg_handler(ctl, write, buffer, lenp, ppos, NSS_CORE_1);
@@ -1740,9 +1740,7 @@ static struct ctl_table nss_n2h_table_si
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &nss_n2h_get_qos_mem_size_cfg_handler,
- },
-
- { }
+ }
};
static struct ctl_table nss_n2h_table_multi_core[] = {
@@ -1900,8 +1898,7 @@ static struct ctl_table nss_n2h_table_mu
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &nss_n2h_get_qos_mem_size_cfg_handler,
- },
- { }
+ }
};
--- a/nss_ppe_vp.c
+++ b/nss_ppe_vp.c
@@ -215,7 +215,7 @@ static void nss_ppe_vp_callback(void *ap
* Since ath0 has only one type i.e. ath0 is NSS_DYNAMIC_INTERFACE_TYPE_VAP, the above command can be rewritten as
* echo ath0 > /proc/sys/nss/ppe_vp/create => Here 6 can be ignored.
*/
-static nss_if_num_t nss_ppe_vp_parse_vp_cmd(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static nss_if_num_t nss_ppe_vp_parse_vp_cmd(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int32_t if_num;
struct net_device *dev;
@@ -693,7 +693,7 @@ static void nss_ppe_vp_handler(struct ns
* nss_ppe_vp_destroy_handler()
* PPE VP destroy handler.
*/
-static int nss_ppe_vp_destroy_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_ppe_vp_destroy_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_ctx_instance *nss_ctx = nss_ppe_vp_get_context();
int32_t if_num;
@@ -730,7 +730,7 @@ static int nss_ppe_vp_destroy_handler(st
* nss_ppe_vp_create_handler()
* PPE VP create handler.
*/
-static int nss_ppe_vp_create_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int nss_ppe_vp_create_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
int32_t if_num;
struct nss_ctx_instance *nss_ctx = nss_ppe_vp_get_context();
--- a/nss_pppoe.c
+++ b/nss_pppoe.c
@@ -203,7 +203,7 @@ static void nss_pppoe_handler(struct nss
* nss_pppoe_br_accel_mode_handler()
* Enable/disable pppoe bridge acceleration in NSS
*/
-int nss_pppoe_br_accel_mode_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+int nss_pppoe_br_accel_mode_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_ctx_instance *nss_ctx = nss_pppoe_get_context();
struct nss_pppoe_msg npm;
--- a/nss_project.c
+++ b/nss_project.c
@@ -235,7 +235,7 @@ static void nss_project_msg_handler(stru
* Uses proc_dointvec to process data. For a write operation, also sends worker
* thread stats enable messages containing the new value to each NSS core.
*/
-static int nss_project_wt_stats_handler(struct ctl_table *ctl, int write,
+static int nss_project_wt_stats_handler(compat_const struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
@@ -332,8 +332,7 @@ static struct ctl_table nss_project_tabl
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &nss_project_wt_stats_handler,
- },
- { }
+ }
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
--- a/nss_rps.c
+++ b/nss_rps.c
@@ -404,7 +404,7 @@ static nss_tx_status_t nss_rps_pri_map_c
* nss_rps_cfg_handler()
* Enable NSS RPS.
*/
-static int nss_rps_cfg_handler(struct ctl_table *ctl, int write,
+static int nss_rps_cfg_handler(compat_const struct ctl_table *ctl, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
@@ -455,7 +455,7 @@ static int nss_rps_cfg_handler(struct ct
* nss_rps_hash_bitmap_cfg_handler()
* Configure NSS rps_hash_bitmap
*/
-static int nss_rps_hash_bitmap_cfg_handler(struct ctl_table *ctl, int write,
+static int nss_rps_hash_bitmap_cfg_handler(compat_const struct ctl_table *ctl, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
@@ -518,7 +518,7 @@ static int nss_rps_hash_bitmap_cfg_handl
/* nss_rps_pri_map_cfg_handler()
* Configure NSS rps_pri_map
*/
-static int nss_rps_pri_map_cfg_handler(struct ctl_table *ctl, int write,
+static int nss_rps_pri_map_cfg_handler(compat_const struct ctl_table *ctl, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
struct nss_top_instance *nss_top = &nss_top_main;
@@ -571,8 +571,7 @@ static struct ctl_table nss_rps_table[]
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &nss_rps_pri_map_cfg_handler,
- },
- { }
+ }
};
--- a/nss_core.h
+++ b/nss_core.h
@@ -1036,7 +1036,7 @@ extern void nss_stats_clean(void);
*/
extern void nss_log_init(void);
extern bool nss_debug_log_buffer_alloc(uint8_t nss_id, uint32_t nentry);
-extern int nss_logbuffer_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos);
+extern int nss_logbuffer_handler(compat_const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos);
/*
* APIs to set jumbo_mru & paged_mode
--- a/nss_dscp_map.h
+++ b/nss_dscp_map.h
@@ -46,7 +46,7 @@ struct nss_dscp_map_parse {
* nss_dscp_map_print()
* Sysctl handler for printing dscp/pri mapping.
*/
-static int nss_dscp_map_print(struct ctl_table *ctl, void *buffer, size_t *lenp,
+static int nss_dscp_map_print(compat_const struct ctl_table *ctl, void *buffer, size_t *lenp,
loff_t *ppos, struct nss_dscp_map_entry *mapping)
{
char *r_buf;
@@ -115,7 +115,7 @@ static int nss_dscp_map_print(struct ctl
* nss_dscp_map_parse()
* Sysctl handler for dscp/pri mappings.
*/
-static int nss_dscp_map_parse(struct ctl_table *ctl, void *buffer, size_t *lenp,
+static int nss_dscp_map_parse(compat_const struct ctl_table *ctl, void *buffer, size_t *lenp,
loff_t *ppos, struct nss_dscp_map_parse *out)
{
int count;
--- a/nss_n2h_stats.c
+++ b/nss_n2h_stats.c
@@ -46,6 +46,7 @@ static ssize_t nss_n2h_stats_read(struct
size_t size_wr = 0;
ssize_t bytes_read = 0;
uint64_t *stats_shadow;
+ char n2h_tag[7];
char *lbuf = kzalloc(size_al, GFP_KERNEL);
if (unlikely(lbuf == NULL)) {
@@ -69,7 +70,8 @@ static ssize_t nss_n2h_stats_read(struct
stats_shadow[i] = nss_n2h_stats[core][i];
}
spin_unlock_bh(&nss_top_main.stats_lock);
- size_wr += nss_stats_banner(lbuf, size_wr, size_al, "n2h", core);
+ snprintf(n2h_tag, 7, "N2H %d", core);
+ size_wr += nss_stats_banner(lbuf, size_wr, size_al, n2h_tag, NSS_STATS_SINGLE_CORE);
size_wr += nss_stats_print("n2h", NULL, NSS_STATS_SINGLE_INSTANCE
, nss_n2h_strings_stats
, stats_shadow
--- a/nss_n2h.c
+++ b/nss_n2h.c
@@ -998,7 +998,7 @@ static int nss_n2h_wifi_payloads_handler
* nss_n2h_get_qos_mem_size_cfg_handler()
* Gets the QoS memory pool size
*/
-static int nss_n2h_get_qos_mem_size_cfg_handler(struct ctl_table *ctl,
+static int nss_n2h_get_qos_mem_size_cfg_handler(compat_const struct ctl_table *ctl,
int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{

View File

@@ -0,0 +1,33 @@
--- a/nss_core.c
+++ b/nss_core.c
@@ -2704,7 +2704,7 @@
if (unlikely(irqs_disabled()))
return false;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
if (unlikely(skb_shinfo(nbuf)->tx_flags & SKBTX_DEV_ZEROCOPY))
return false;
#else
--- a/nss_coredump.c
+++ b/nss_coredump.c
@@ -26,7 +26,7 @@
#include "nss_log.h"
#include <linux/kernel.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
#include <linux/notifier.h> /* for panic_notifier_list */
#else
#include <linux/panic_notifier.h> /* for panic_notifier_list */
--- a/nss_core.h
+++ b/nss_core.h
@@ -125,7 +125,7 @@
#define h2n_hlos_index_to_dma(_if_map_addr, _index) (_if_map_addr) + h2n_hlos_index_offset + (sizeof(uint32_t) * (_index))
#define n2h_hlos_index_to_dma(_if_map_addr, _index) (_if_map_addr) + n2h_hlos_index_offset + (sizeof(uint32_t) * (_index))
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
#define nss_ioremap ioremap_nocache
#else
#define nss_ioremap ioremap

View File

@@ -4,10 +4,10 @@ PKG_NAME:=qca-nss-ecm
PKG_RELEASE=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2023-10-20
PKG_SOURCE_DATE:=2024-11-06
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-nss-ecm.git
PKG_SOURCE_VERSION:=82b27915fffdbe2cdb2d4eb70e5736ccf92e2560
PKG_MIRROR_HASH:=643895cb187cacfcde337c19dc5a34512acc225c0db1813a15cc1b66523835c4
PKG_SOURCE_VERSION:=30fbfa493d700270ac6c14685290f340b6ead28c
PKG_MIRROR_HASH:=152670e96f95a7001208af21a976e3b666461fde795a56e2937fdb8fe60941ae
PKG_BUILD_PARALLEL:=1
PKG_FLAGS:=nonshared

View File

@@ -5,26 +5,34 @@ Subject: [PATCH 01/12] treewide: componentize the module even more
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
Makefile | 57 +++++++++++++++++++++++++-------
Makefile_61.mk | 1 -
Makefile | 56 +++++++++++++++++++++++++-------
ecm_db/ecm_db_connection.c | 8 +++++
ecm_db/ecm_db_node.c | 4 +++
ecm_interface.c | 8 +++++
frontends/ecm_front_end_common.c | 7 ++++
6 files changed, 72 insertions(+), 13 deletions(-)
5 files changed, 72 insertions(+), 11 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
# ###################################################
# Makefile for the QCA NSS ECM
# ###################################################
-ifneq ($(findstring 6.1., $(KERNELVERSION)),)
+ifneq ($(findstring 6.2., $(KERNELVERSION)),)
include $(obj)/Makefile_61.mk
else
@@ -4,7 +4,6 @@
ifeq ($(ECM_FRONT_END_SFE_ENABLE), y)
@@ -134,9 +134,17 @@ ccflags-$(ECM_INTERFACE_BOND_ENABLE) += -DECM_INTERFACE_BOND_ENABLE
obj-m += examples/ecm_sfe_l2.o
endif
-obj-m +=examples/ecm_ae_select.o
obj-m += ecm.o
ifeq ($(BUILD_ECM_WIFI_PLUGIN),y)
@@ -24,6 +23,9 @@ endif
ifeq ($(EXAMPLES_BUILD_OVS),y)
obj-m += examples/ecm_ovs.o
endif
+ifeq ($(EXAMPLES_BUILD_AE),y)
+obj-m +=examples/ecm_ae_select.o
+endif
ecm-y := \
frontends/cmn/ecm_ae_classifier.o \
@@ -115,10 +117,18 @@ ccflags-$(ECM_INTERFACE_BOND_ENABLE) +=
# Define ECM_INTERFACE_PPPOE_ENABLE=y in order
# to enable support for PPPoE acceleration.
# #############################################################################
@@ -34,29 +42,30 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
+endif
ccflags-$(ECM_INTERFACE_PPPOE_ENABLE) += -DECM_INTERFACE_PPPOE_ENABLE
+# #############################################################################
# #############################################################################
+# Define ECM_INTERFACE_L2TPV2_PPTP_ENABLE=y in order
+# to enable support for l2tpv2 or PPTP detection.
+# #############################################################################
+ccflags-$(ECM_INTERFACE_L2TPV2_PPTP_ENABLE) += -DECM_INTERFACE_L2TPV2_PPTP_ENABLE
+
# #############################################################################
+# #############################################################################
# Define ECM_INTERFACE_L2TPV2_ENABLE=y in order
# to enable support for l2tpv2 acceleration.
@@ -163,6 +171,12 @@ endif
endif
# #############################################################################
@@ -151,6 +161,12 @@ endif
ccflags-$(ECM_INTERFACE_PPP_ENABLE) += -DECM_INTERFACE_PPP_ENABLE
+# #############################################################################
# #############################################################################
+# Define ECM_INTERFACE_GRE_ENABLE=y in order
+# to enable support for GRE detection.
+# #############################################################################
+ccflags-$(ECM_INTERFACE_GRE_ENABLE) += -DECM_INTERFACE_GRE_ENABLE
+
# #############################################################################
+# #############################################################################
# Define ECM_INTERFACE_GRE_TAP_ENABLE=y in order
# to enable support for GRE TAP interface.
@@ -246,7 +260,9 @@ ccflags-$(ECM_INTERFACE_OVS_BRIDGE_ENABLE) += -DECM_INTERFACE_OVS_BRIDGE_ENABLE
# #############################################################################
@@ -233,7 +249,9 @@ ccflags-$(ECM_INTERFACE_OVS_BRIDGE_ENABL
# #############################################################################
# Define ECM_INTERFACE_VLAN_ENABLE=y in order to enable support for VLAN
# #############################################################################
@@ -67,7 +76,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
ccflags-$(ECM_INTERFACE_VLAN_ENABLE) += -DECM_INTERFACE_VLAN_ENABLE
# #############################################################################
@@ -288,7 +304,9 @@ ccflags-$(ECM_CLASSIFIER_OVS_ENABLE) += -DECM_CLASSIFIER_OVS_ENABLE
@@ -275,7 +293,9 @@ ccflags-$(ECM_CLASSIFIER_OVS_ENABLE) +=
# #############################################################################
# Define ECM_CLASSIFIER_MARK_ENABLE=y in order to enable mark classifier.
# #############################################################################
@@ -78,7 +87,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
ecm-$(ECM_CLASSIFIER_MARK_ENABLE) += ecm_classifier_mark.o
ccflags-$(ECM_CLASSIFIER_MARK_ENABLE) += -DECM_CLASSIFIER_MARK_ENABLE
@@ -312,7 +330,9 @@ ccflags-$(ECM_CLASSIFIER_NL_ENABLE) += -DECM_CLASSIFIER_NL_ENABLE
@@ -299,7 +319,9 @@ ccflags-$(ECM_CLASSIFIER_NL_ENABLE) += -
# #############################################################################
# Define ECM_CLASSIFIER_DSCP_ENABLE=y in order to enable DSCP classifier.
# #############################################################################
@@ -89,7 +98,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
ecm-$(ECM_CLASSIFIER_DSCP_ENABLE) += ecm_classifier_dscp.o
ccflags-$(ECM_CLASSIFIER_DSCP_ENABLE) += -DECM_CLASSIFIER_DSCP_ENABLE
ccflags-$(ECM_CLASSIFIER_DSCP_IGS) += -DECM_CLASSIFIER_DSCP_IGS
@@ -331,7 +351,9 @@ ccflags-$(ECM_CLASSIFIER_HYFI_ENABLE) += -DECM_CLASSIFIER_HYFI_ENABLE
@@ -318,7 +340,9 @@ ccflags-$(ECM_CLASSIFIER_HYFI_ENABLE) +=
# the Parental Controls subsystem classifier in ECM. Currently disabled until
# customers require it / if they need to integrate their Parental Controls with it.
# #############################################################################
@@ -100,7 +109,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
ecm-$(ECM_CLASSIFIER_PCC_ENABLE) += ecm_classifier_pcc.o
ccflags-$(ECM_CLASSIFIER_PCC_ENABLE) += -DECM_CLASSIFIER_PCC_ENABLE
@@ -372,27 +394,36 @@ ccflags-$(ECM_NON_PORTED_SUPPORT_ENABLE) += -DECM_NON_PORTED_SUPPORT_ENABLE
@@ -367,27 +391,36 @@ ccflags-$(ECM_NON_PORTED_SUPPORT_ENABLE)
# #############################################################################
# Define ECM_STATE_OUTPUT_ENABLE=y to support XML state output
# #############################################################################
@@ -140,7 +149,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
ccflags-$(ECM_TRACKER_DPI_SUPPORT_ENABLE) += -DECM_TRACKER_DPI_SUPPORT_ENABLE
# #############################################################################
@@ -400,14 +431,18 @@ ccflags-$(ECM_TRACKER_DPI_SUPPORT_ENABLE) += -DECM_TRACKER_DPI_SUPPORT_ENABLE
@@ -395,14 +428,18 @@ ccflags-$(ECM_TRACKER_DPI_SUPPORT_ENABLE
# support for the database keeping lists of connections that are assigned
# on a per TYPE of classifier basis.
# #############################################################################
@@ -161,24 +170,6 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
ccflags-$(ECM_BAND_STEERING_ENABLE) += -DECM_BAND_STEERING_ENABLE
# #############################################################################
@@ -488,7 +523,6 @@ ccflags-y += -DECM_TRACKER_UDP_DEBUG_LEVEL=1
ccflags-y += -DECM_BOND_NOTIFIER_DEBUG_LEVEL=1
ccflags-y += -DECM_INTERFACE_DEBUG_LEVEL=1
ccflags-y += -DECM_STATE_DEBUG_LEVEL=1
-ccflags-y += -DECM_OPENWRT_SUPPORT=1
ccflags-y += -DECM_NOTIFIER_DEBUG_LEVEL=1
ccflags-y += -DECM_AE_CLASSIFIER_DEBUG_LEVEL=1
ccflags-y += -DECM_STATS_DEBUG_LEVEL=1
--- a/Makefile_61.mk
+++ b/Makefile_61.mk
@@ -465,7 +465,6 @@ ccflags-y += -DECM_TRACKER_UDP_DEBUG_LEVEL=1
ccflags-y += -DECM_BOND_NOTIFIER_DEBUG_LEVEL=1
ccflags-y += -DECM_INTERFACE_DEBUG_LEVEL=1
ccflags-y += -DECM_STATE_DEBUG_LEVEL=1
-ccflags-y += -DECM_OPENWRT_SUPPORT=1
ccflags-y += -DECM_NOTIFIER_DEBUG_LEVEL=1
ccflags-y += -DECM_AE_CLASSIFIER_DEBUG_LEVEL=1
ccflags-y += -DECM_STATS_DEBUG_LEVEL=1
--- a/ecm_db/ecm_db_connection.c
+++ b/ecm_db/ecm_db_connection.c
@@ -446,7 +446,9 @@ EXPORT_SYMBOL(ecm_db_connection_make_def
@@ -191,17 +182,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
DEBUG_CHECK_MAGIC(ci, ECM_DB_CONNECTION_INSTANCE_MAGIC, "%px: magic failed\n", ci);
@@ -545,7 +547,9 @@ EXPORT_SYMBOL(ecm_db_connection_data_tot
*/
void ecm_db_connection_data_totals_update_dropped(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets)
{
+#ifdef ECM_DB_ADVANCED_STATS_ENABLE
int32_t i;
+#endif
DEBUG_CHECK_MAGIC(ci, ECM_DB_CONNECTION_INSTANCE_MAGIC, "%px: magic failed\n", ci);
@@ -1539,6 +1543,7 @@ void ecm_db_connection_defunct_all(void)
@@ -1539,6 +1541,7 @@ void ecm_db_connection_defunct_all(void)
}
EXPORT_SYMBOL(ecm_db_connection_defunct_all);
@@ -209,7 +190,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
/*
* ecm_db_connection_defunct_by_classifier()
* Make defunct based on masked fields
@@ -1705,6 +1710,7 @@ next_ci:
@@ -1705,6 +1708,7 @@ next_ci:
ECM_IP_ADDR_TO_OCTAL(dest_addr_mask), dest_port_mask, proto_mask, cnt);
}
}
@@ -217,7 +198,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
/*
* ecm_db_connection_defunct_by_port()
@@ -1994,6 +2000,7 @@ struct ecm_db_node_instance *ecm_db_conn
@@ -1994,6 +1998,7 @@ struct ecm_db_node_instance *ecm_db_conn
}
EXPORT_SYMBOL(ecm_db_connection_node_get_and_ref);
@@ -225,7 +206,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
/*
* ecm_db_connection_mapping_get_and_ref_next()
* Return reference to next connection in the mapping chain in the specified direction.
@@ -2035,6 +2042,7 @@ struct ecm_db_connection_instance *ecm_d
@@ -2035,6 +2040,7 @@ struct ecm_db_connection_instance *ecm_d
return nci;
}
EXPORT_SYMBOL(ecm_db_connection_iface_get_and_ref_next);
@@ -235,19 +216,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
* ecm_db_connection_mapping_get_and_ref()
--- a/ecm_db/ecm_db_node.c
+++ b/ecm_db/ecm_db_node.c
@@ -227,9 +227,11 @@ EXPORT_SYMBOL(ecm_db_node_get_and_ref_ne
*/
int ecm_db_node_deref(struct ecm_db_node_instance *ni)
{
+#ifdef ECM_DB_XREF_ENABLE
#if (DEBUG_LEVEL >= 1)
int dir;
#endif
+#endif
DEBUG_CHECK_MAGIC(ni, ECM_DB_NODE_INSTANCE_MAGIC, "%px: magic failed\n", ni);
spin_lock_bh(&ecm_db_lock);
@@ -489,9 +491,11 @@ EXPORT_SYMBOL(ecm_db_node_iface_get_and_
@@ -489,9 +489,11 @@ EXPORT_SYMBOL(ecm_db_node_iface_get_and_
void ecm_db_node_add(struct ecm_db_node_instance *ni, struct ecm_db_iface_instance *ii, uint8_t *address,
ecm_db_node_final_callback_t final, void *arg)
{
@@ -261,7 +230,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -1509,6 +1509,7 @@ struct neighbour *ecm_interface_ipv6_nei
@@ -1525,6 +1525,7 @@ struct neighbour *ecm_interface_ipv6_nei
*/
bool ecm_interface_is_pptp(struct sk_buff *skb, const struct net_device *out)
{
@@ -269,7 +238,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
struct net_device *in;
/*
@@ -1533,6 +1534,7 @@ bool ecm_interface_is_pptp(struct sk_buf
@@ -1549,6 +1550,7 @@ bool ecm_interface_is_pptp(struct sk_buf
}
dev_put(in);
@@ -277,7 +246,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
return false;
}
@@ -1545,6 +1547,7 @@ bool ecm_interface_is_pptp(struct sk_buf
@@ -1561,6 +1563,7 @@ bool ecm_interface_is_pptp(struct sk_buf
*/
bool ecm_interface_is_l2tp_packet_by_version(struct sk_buff *skb, const struct net_device *out, int ver)
{
@@ -285,7 +254,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
uint32_t flag = 0;
struct net_device *in;
@@ -1577,6 +1580,7 @@ bool ecm_interface_is_l2tp_packet_by_ver
@@ -1593,6 +1596,7 @@ bool ecm_interface_is_l2tp_packet_by_ver
}
dev_put(in);
@@ -293,7 +262,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
return false;
}
@@ -1589,6 +1593,7 @@ bool ecm_interface_is_l2tp_packet_by_ver
@@ -1605,6 +1609,7 @@ bool ecm_interface_is_l2tp_packet_by_ver
*/
bool ecm_interface_is_l2tp_pptp(struct sk_buff *skb, const struct net_device *out)
{
@@ -301,7 +270,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
struct net_device *in;
/*
@@ -1611,6 +1616,7 @@ bool ecm_interface_is_l2tp_pptp(struct s
@@ -1627,6 +1632,7 @@ bool ecm_interface_is_l2tp_pptp(struct s
}
dev_put(in);
@@ -309,7 +278,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
return false;
}
@@ -7127,6 +7133,7 @@ static void ecm_interface_regenerate_con
@@ -7187,6 +7193,7 @@ static void ecm_interface_regenerate_con
return;
}
@@ -317,7 +286,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
for (dir = 0; dir < ECM_DB_OBJ_DIR_MAX; dir++) {
/*
* Re-generate all connections associated with this interface
@@ -7142,6 +7149,7 @@ static void ecm_interface_regenerate_con
@@ -7202,6 +7209,7 @@ static void ecm_interface_regenerate_con
ci[dir] = cin;
}
}
@@ -327,7 +296,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
/*
--- a/frontends/ecm_front_end_common.c
+++ b/frontends/ecm_front_end_common.c
@@ -517,6 +517,7 @@ bool ecm_front_end_gre_proto_is_accel_al
@@ -540,6 +540,7 @@ bool ecm_front_end_gre_proto_is_accel_al
struct nf_conntrack_tuple *reply_tuple,
int ip_version, uint16_t offset)
{
@@ -335,7 +304,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
struct net_device *dev;
struct gre_base_hdr *greh;
@@ -528,10 +529,12 @@ bool ecm_front_end_gre_proto_is_accel_al
@@ -551,10 +552,12 @@ bool ecm_front_end_gre_proto_is_accel_al
/*
* Case 1: PPTP locally terminated
*/
@@ -348,7 +317,7 @@ Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
/*
* Case 2: PPTP pass through
@@ -657,6 +660,10 @@ bool ecm_front_end_gre_proto_is_accel_al
@@ -682,6 +685,10 @@ bool ecm_front_end_gre_proto_is_accel_al
*/
DEBUG_TRACE("%px: GRE IPv%d pass through non NAT - allow acceleration\n", skb, ip_version);
return true;

View File

@@ -1,63 +0,0 @@
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -339,9 +339,9 @@ static struct net_device *ecm_interface_
ECM_IP_ADDR_TO_NIN6_ADDR(addr6, addr);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0))
- dev = (struct net_device *)ipv6_dev_find(&init_net, &addr6, 1);
+ dev = (struct net_device *)ipv6_dev_find_and_hold(&init_net, &addr6, 1);
#else
- dev = (struct net_device *)ipv6_dev_find(&init_net, &addr6, NULL);
+ dev = (struct net_device *)ipv6_dev_find_and_hold(&init_net, &addr6, 1);
#endif
return dev;
}
@@ -802,9 +802,9 @@ static bool ecm_interface_mac_addr_get_i
*/
ECM_IP_ADDR_TO_NIN6_ADDR(daddr, addr);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0))
- local_dev = ipv6_dev_find(&init_net, &daddr, 1);
+ local_dev = ipv6_dev_find_and_hold(&init_net, &daddr, 1);
#else
- local_dev = ipv6_dev_find(&init_net, &daddr, NULL);
+ local_dev = ipv6_dev_find_and_hold(&init_net, &daddr, 1);
#endif
if (local_dev) {
DEBUG_TRACE("%pi6 is a local address\n", &daddr);
--- a/frontends/ecm_front_end_common.c
+++ b/frontends/ecm_front_end_common.c
@@ -103,6 +103,10 @@
#endif
#endif
+#ifdef ECM_IPV6_ENABLE
+#include "ecm_front_end_ipv6.h"
+#endif
+
#ifdef ECM_FRONT_END_FSE_ENABLE
/*
* Callback object for ECM frontend interaction with wlan driver to add/delete FSE rules.
@@ -614,9 +618,9 @@ bool ecm_front_end_gre_proto_is_accel_al
} else {
#ifdef ECM_IPV6_ENABLE
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0))
- dev = ipv6_dev_find(&init_net, &(orig_tuple->src.u3.in6), 1);
+ dev = ipv6_dev_find_and_hold(&init_net, &(orig_tuple->src.u3.in6), 1);
#else
- dev = ipv6_dev_find(&init_net, &(orig_tuple->src.u3.in6), NULL);
+ dev = ipv6_dev_find_and_hold(&init_net, &(orig_tuple->src.u3.in6), 1);
#endif
if (dev) {
/*
@@ -628,9 +632,9 @@ bool ecm_front_end_gre_proto_is_accel_al
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0))
- dev = ipv6_dev_find(&init_net, &(orig_tuple->dst.u3.in6), 1);
+ dev = ipv6_dev_find_and_hold(&init_net, &(orig_tuple->dst.u3.in6), 1);
#else
- dev = ipv6_dev_find(&init_net, &(orig_tuple->dst.u3.in6), NULL);
+ dev = ipv6_dev_find_and_hold(&init_net, &(orig_tuple->dst.u3.in6), 1);
#endif
if (dev) {
/*

View File

@@ -1,88 +0,0 @@
--- a/frontends/nss/ecm_nss_ported_ipv4.c
+++ b/frontends/nss/ecm_nss_ported_ipv4.c
@@ -1213,7 +1213,6 @@ static void ecm_nss_ported_ipv4_connection_accelerate(struct ecm_front_end_conne
#else
struct nf_tcp_net *tn = nf_tcp_pernet(nf_ct_net(ct));
uint32_t tcp_be_liberal = tn->tcp_be_liberal;
- uint32_t tcp_no_window_check = tn->tcp_no_window_check;
#endif
ecm_db_connection_address_get(feci->ci, ECM_DB_OBJ_DIR_FROM, addr);
ecm_front_end_flow_and_return_directions_get(ct, addr, 4, &flow_dir, &return_dir);
@@ -1228,11 +1227,7 @@ static void ecm_nss_ported_ipv4_connection_accelerate(struct ecm_front_end_conne
nircm->tcp_rule.return_max_window = ct->proto.tcp.seen[return_dir].td_maxwin;
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
-#ifdef ECM_OPENWRT_SUPPORT
- if (tcp_be_liberal || tcp_no_window_check
-#else
if (tcp_be_liberal
-#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {
nircm->rule_flags |= NSS_IPV4_RULE_CREATE_FLAG_NO_SEQ_CHECK;
--- a/frontends/nss/ecm_nss_ported_ipv6.c
+++ b/frontends/nss/ecm_nss_ported_ipv6.c
@@ -1133,7 +1133,6 @@ static void ecm_nss_ported_ipv6_connection_accelerate(struct ecm_front_end_conne
#else
struct nf_tcp_net *tn = nf_tcp_pernet(nf_ct_net(ct));
uint32_t tcp_be_liberal = tn->tcp_be_liberal;
- uint32_t tcp_no_window_check = tn->tcp_no_window_check;
#endif
ecm_front_end_flow_and_return_directions_get(ct, src_ip, 6, &flow_dir, &return_dir);
@@ -1147,11 +1146,7 @@ static void ecm_nss_ported_ipv6_connection_accelerate(struct ecm_front_end_conne
nircm->tcp_rule.return_max_window = ct->proto.tcp.seen[return_dir].td_maxwin;
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
-#ifdef ECM_OPENWRT_SUPPORT
- if (tcp_be_liberal || tcp_no_window_check
-#else
if (tcp_be_liberal
-#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {
nircm->rule_flags |= NSS_IPV6_RULE_CREATE_FLAG_NO_SEQ_CHECK;
--- a/frontends/sfe/ecm_sfe_ported_ipv4.c
+++ b/frontends/sfe/ecm_sfe_ported_ipv4.c
@@ -1358,7 +1358,6 @@ static void ecm_sfe_ported_ipv4_connection_accelerate(struct ecm_front_end_conne
#else
struct nf_tcp_net *tn = nf_tcp_pernet(nf_ct_net(ct));
uint32_t tcp_be_liberal = tn->tcp_be_liberal;
- uint32_t tcp_no_window_check = tn->tcp_no_window_check;
#endif
ecm_db_connection_address_get(feci->ci, ECM_DB_OBJ_DIR_FROM, addr);
ecm_front_end_flow_and_return_directions_get(ct, addr, 4, &flow_dir, &return_dir);
@@ -1374,11 +1373,7 @@ static void ecm_sfe_ported_ipv4_connection_accelerate(struct ecm_front_end_conne
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
-#ifdef ECM_OPENWRT_SUPPORT
- if (tcp_be_liberal || tcp_no_window_check
-#else
if (tcp_be_liberal
-#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {
nircm->rule_flags |= SFE_RULE_CREATE_FLAG_NO_SEQ_CHECK;
--- a/frontends/sfe/ecm_sfe_ported_ipv6.c
+++ b/frontends/sfe/ecm_sfe_ported_ipv6.c
@@ -1371,7 +1371,6 @@ static void ecm_sfe_ported_ipv6_connection_accelerate(struct ecm_front_end_conne
#else
struct nf_tcp_net *tn = nf_tcp_pernet(nf_ct_net(ct));
uint32_t tcp_be_liberal = tn->tcp_be_liberal;
- uint32_t tcp_no_window_check = tn->tcp_no_window_check;
#endif
ecm_front_end_flow_and_return_directions_get(ct, src_ip, 6, &flow_dir, &return_dir);
@@ -1385,11 +1384,7 @@ static void ecm_sfe_ported_ipv6_connection_accelerate(struct ecm_front_end_conne
nircm->tcp_rule.return_max_window = ct->proto.tcp.seen[return_dir].td_maxwin;
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
-#ifdef ECM_OPENWRT_SUPPORT
- if (tcp_be_liberal || tcp_no_window_check
-#else
if (tcp_be_liberal
-#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {
nircm->rule_flags |= SFE_RULE_CREATE_FLAG_NO_SEQ_CHECK;

View File

@@ -39,7 +39,7 @@ instead or relying on a downstream api not present upstream.
spin_lock_bh(&ct->lock);
--- a/frontends/sfe/ecm_sfe_ipv4.c
+++ b/frontends/sfe/ecm_sfe_ipv4.c
@@ -562,7 +562,8 @@ sync_conntrack:
@@ -574,7 +574,8 @@ sync_conntrack:
#else
timeouts = nf_ct_timeout_lookup(ct);
if (!timeouts) {
@@ -51,7 +51,7 @@ instead or relying on a downstream api not present upstream.
spin_lock_bh(&ct->lock);
--- a/frontends/sfe/ecm_sfe_ipv6.c
+++ b/frontends/sfe/ecm_sfe_ipv6.c
@@ -556,7 +556,8 @@ sync_conntrack:
@@ -567,7 +567,8 @@ sync_conntrack:
#else
timeouts = nf_ct_timeout_lookup(ct);
if (!timeouts) {

View File

@@ -1,6 +1,6 @@
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -3606,7 +3606,7 @@ identifier_update:
@@ -3640,7 +3640,7 @@ identifier_update:
if (skb && (skb->skb_iif == dev->ifindex)) {
struct pppol2tp_common_addr info;
@@ -9,7 +9,7 @@
DEBUG_TRACE("%px: Net device: %px is MULTILINK PPP - Unknown to the ECM\n", feci, dev);
type_info.unknown.os_specific_ident = dev_interface_num;
@@ -3616,7 +3616,7 @@ identifier_update:
@@ -3650,7 +3650,7 @@ identifier_update:
ii = ecm_interface_unknown_interface_establish(&type_info.unknown, dev_name, dev_interface_num, ae_interface_num, dev_mtu);
return ii;
}

View File

@@ -0,0 +1,22 @@
--- a/ecm_classifier_mscs.c
+++ b/ecm_classifier_mscs.c
@@ -429,7 +429,6 @@ static void ecm_classifier_mscs_process(
struct ecm_db_connection_instance *ci = NULL;
struct ecm_front_end_connection_instance *feci;
ecm_front_end_acceleration_mode_t accel_mode;
- int protocol;
uint32_t became_relevant = 0;
ecm_classifier_mscs_process_callback_t cb = NULL;
bool scs_result = false;
@@ -441,10 +440,10 @@ static void ecm_classifier_mscs_process(
struct net_device *src_dev = NULL;
struct net_device *dest_dev = NULL;
uint64_t slow_pkts;
+ struct ecm_classifier_mscs_get_priority_info get_priority_info = {0};
#ifdef ECM_CLASSIFIER_MSCS_SCS_ENABLE
struct sp_rule_input_params flow_input_params;
struct sp_rule_output_params flow_output_params;
- struct ecm_classifier_mscs_get_priority_info get_priority_info = {0};
struct ecm_classifier_mscs_rule_match_info rule_match_info = {0};
ecm_classifier_mscs_scs_priority_callback_t scs_cb = NULL;
#endif

View File

@@ -0,0 +1,42 @@
--- a/frontends/include/ecm_front_end_common.h
+++ b/frontends/include/ecm_front_end_common.h
@@ -339,15 +339,19 @@ static inline bool ecm_front_end_ppppoe_
fe_type = ecm_front_end_type_get();
switch (fe_type) {
#ifdef ECM_FRONT_END_NSS_ENABLE
+#ifdef ECM_INTERFACE_PPPOE_ENABLE
case ECM_FRONT_END_TYPE_NSS:
ret = (nss_pppoe_get_br_accel_mode() == NSS_PPPOE_BR_ACCEL_MODE_DIS);
break;
#endif
+#endif
#ifdef ECM_FRONT_END_SFE_ENABLE
+#ifdef ECM_INTERFACE_PPPOE_ENABLE
case ECM_FRONT_END_TYPE_SFE:
ret = (sfe_pppoe_get_br_accel_mode() == SFE_PPPOE_BR_ACCEL_MODE_DISABLED);
break;
#endif
+#endif
default:
DEBUG_TRACE("front end type: %d\n", fe_type);
break;
@@ -369,15 +373,19 @@ static inline bool ecm_front_end_ppppoe_
fe_type = ecm_front_end_type_get();
switch (fe_type) {
#ifdef ECM_FRONT_END_NSS_ENABLE
+#ifdef ECM_INTERFACE_PPPOE_ENABLE
case ECM_FRONT_END_TYPE_NSS:
ret = (nss_pppoe_get_br_accel_mode() == NSS_PPPOE_BR_ACCEL_MODE_EN_3T);
break;
#endif
+#endif
#ifdef ECM_FRONT_END_SFE_ENABLE
+#ifdef ECM_INTERFACE_PPPOE_ENABLE
case ECM_FRONT_END_TYPE_SFE:
ret = (sfe_pppoe_get_br_accel_mode() == SFE_PPPOE_BR_ACCEL_MODE_EN_3T);
break;
#endif
+#endif
default:
DEBUG_WARN("front end type: %d is not supported\n", fe_type);
break;

View File

@@ -15,7 +15,7 @@
+EXPORT_SYMBOL(ecm_nss_ipv4_is_conn_limit_reached);
--- a/frontends/nss/ecm_nss_non_ported_ipv4.c
+++ b/frontends/nss/ecm_nss_non_ported_ipv4.c
@@ -1831,6 +1831,7 @@ struct ecm_front_end_connection_instance
@@ -1847,6 +1847,7 @@ struct ecm_front_end_connection_instance
return feci;
}

View File

@@ -12,121 +12,3 @@
#endif
dev_put(to_dev);
continue;
--- a/frontends/ecm_front_end_common.c
+++ b/frontends/ecm_front_end_common.c
@@ -36,6 +36,9 @@
#include <net/addrconf.h>
#include <net/gre.h>
#include <net/xfrm.h>
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(6, 6, 0))
+#include <net/tcx.h>
+#endif
#include <linux/hashtable.h>
#include <net/sch_generic.h>
#ifdef ECM_FRONT_END_PPE_ENABLE
@@ -1169,7 +1173,9 @@
{
.procname = "ecm",
.mode = 0555,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0))
.child = ecm_front_end_sysctl_tbl,
+#endif
},
{ }
};
@@ -1178,7 +1184,9 @@
{
.procname = "net",
.mode = 0555,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0))
.child = ecm_front_end_common_root,
+#endif
},
{ }
};
@@ -1192,7 +1200,7 @@
/*
* Register sysctl table.
*/
- ecm_front_end_ctl_tbl_hdr = register_sysctl_table(ecm_front_end_common_root_dir);
+ ecm_front_end_ctl_tbl_hdr = register_sysctl("net/ecm", ecm_front_end_sysctl_tbl);
#ifdef ECM_FRONT_END_SFE_ENABLE
if (ecm_front_end_ctl_tbl_hdr) {
ecm_sfe_sysctl_tbl_init();
@@ -1712,7 +1720,12 @@
}
BUG_ON(!rcu_read_lock_bh_held());
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
miniq = rcu_dereference_bh(dev->miniq_ingress);
+#else
+ struct bpf_mprog_entry *entry = rcu_dereference_bh(dev->tcx_ingress);
+ miniq = entry ? tcx_entry(entry)->miniq : NULL;
+#endif
if (miniq) {
DEBUG_INFO("Ingress Qdisc is present for device[%s]\n", dev->name);
dev_put(dev);
@@ -1767,7 +1780,12 @@
}
#if defined(CONFIG_NET_CLS_ACT) && defined(CONFIG_NET_EGRESS)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
miniq = rcu_dereference_bh(dev->miniq_egress);
+#else
+ struct bpf_mprog_entry *entry = rcu_dereference_bh(dev->tcx_egress);
+ miniq = entry ? tcx_entry(entry)->miniq : NULL;
+#endif
if (miniq) {
DEBUG_INFO("Egress needed\n");
dev_put(dev);
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -341,7 +341,8 @@
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0))
dev = (struct net_device *)ipv6_dev_find_and_hold(&init_net, &addr6, 1);
#else
- dev = (struct net_device *)ipv6_dev_find_and_hold(&init_net, &addr6, 1);
+ dev = (struct net_device *)ipv6_dev_find(&init_net, &addr6, NULL);
+ dev_hold(dev);
#endif
return dev;
}
@@ -804,7 +805,8 @@
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0))
local_dev = ipv6_dev_find_and_hold(&init_net, &daddr, 1);
#else
- local_dev = ipv6_dev_find_and_hold(&init_net, &daddr, 1);
+ local_dev = ipv6_dev_find(&init_net, &daddr, NULL);
+ dev_hold(local_dev);
#endif
if (local_dev) {
DEBUG_TRACE("%pi6 is a local address\n", &daddr);
@@ -8276,7 +8278,9 @@
{
.procname = "ecm",
.mode = 0555,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0))
.child = ecm_interface_table,
+#endif
},
{ }
};
@@ -8285,7 +8289,9 @@
{
.procname = "net",
.mode = 0555,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0))
.child = ecm_interface_root_dir,
+#endif
},
{ }
};
@@ -8786,7 +8792,7 @@
/*
* Register sysctl table.
*/
- ecm_interface_ctl_table_header = register_sysctl_table(ecm_interface_root);
+ ecm_interface_ctl_table_header = register_sysctl("net/ecm", ecm_interface_table);
result = register_netdevice_notifier(&ecm_interface_netdev_notifier);
if (result != 0) {

View File

@@ -0,0 +1,14 @@
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -4057,7 +4057,11 @@ static uint32_t ecm_interface_multicast_
* For MLO bond netdevice, destination for multicast is bond netdevice itself
* Therefore, slave lookup is not needed.
*/
+#ifdef ECM_FRONT_END_SFE_ENABLE
if (ecm_front_end_is_lag_master(dest_dev) && !bond_is_mlo_device(dest_dev)) {
+#else
+ if (ecm_front_end_is_lag_master(dest_dev)) {
+#endif
/*
* Link aggregation
* Figure out which slave device of the link aggregation will be used to reach the destination.

View File

@@ -0,0 +1,53 @@
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -8014,7 +8014,7 @@ static int ecm_interface_wifi_event_iwev
/*
* Copy the base data structure to get iwe->len
*/
- memcpy(&iwe_buf, pos, IW_EV_LCP_LEN);
+ memcpy(&iwe_buf, pos, min_t(size_t, IW_EV_LCP_LEN, (size_t)(end - pos)));
/*
* Check that len is valid and that we have that much in the buffer.
@@ -8031,10 +8031,10 @@ static int ecm_interface_wifi_event_iwev
dpos = (char *)&iwe_buf.u.data.length;
dlen = dpos - (char *)&iwe_buf;
- memcpy(dpos, pos + IW_EV_LCP_LEN, sizeof(struct iw_event) - dlen);
+ memcpy(dpos, pos + IW_EV_LCP_LEN, min_t(size_t, sizeof(struct iw_event) - dlen, (size_t)(end - pos - IW_EV_LCP_LEN)));
if (custom + iwe->u.data.length > end) {
- DEBUG_WARN("Invalid buffer length received in the event iwe->u.data.length %d\n", iwe->u.data.length);
+ DEBUG_WARN("Invalid buffer length received in the event iwe->u.data.length %d\n", (int)iwe->u.data.length);
return -1;
}
@@ -8042,7 +8042,7 @@ static int ecm_interface_wifi_event_iwev
* Check the flags of iw event if it indicates the IW authorized signal.
*/
if (iwe->u.data.flags == ECM_INTERFACE_WIFI_EVENT_NODE_AUTH) {
- dbuf = kzalloc((iwe->u.data.length + 1), GFP_KERNEL);
+ dbuf = kzalloc(iwe->u.data.length, GFP_KERNEL);
if (!dbuf) {
DEBUG_WARN("Failed to allocated a buffer to process the custom event");
return -1;
@@ -8065,16 +8065,16 @@ static int ecm_interface_wifi_event_iwev
return 0;
}
- if ((iwe->len > sizeof(struct iw_event)) || (iwe->len + pos) > end) {
+ if ((iwe->len > sizeof(struct iw_event)) || (iwe->len + pos > end)) {
return -1;
}
/*
* Do the copy again with the full length.
*/
- memcpy(&iwe_buf, pos, iwe->len);
+ memcpy(&iwe_buf, pos, min_t(size_t, iwe->len, (size_t)(end - pos)));
- if (iwe->cmd == IWEVEXPIRED) {
+ if (iwe->cmd == IWEVEXPIRED && iwe->len >= sizeof(struct iw_event)) {
DEBUG_INFO("STA %pM leaving\n", (uint8_t *)iwe->u.addr.sa_data);
ecm_interface_node_connections_defunct((uint8_t *)iwe->u.addr.sa_data, ECM_DB_IP_VERSION_IGNORE);
} else {

View File

@@ -0,0 +1,20 @@
--- a/frontends/nss/ecm_nss_non_ported_ipv4.c
+++ b/frontends/nss/ecm_nss_non_ported_ipv4.c
@@ -855,7 +855,7 @@ static void ecm_nss_non_ported_ipv4_conn
#endif
break;
case ECM_DB_IFACE_TYPE_RAWIP:
-#ifdef ECM_INTERFACE_RAWIP_ENABLE
+#if defined(NSS_FIRMWARE_VERSION_12_5) && defined(ECM_INTERFACE_RAWIP_ENABLE)
nircm->valid_flags |= NSS_IPV4_RULE_CREATE_RAWIP_VALID;
#else
rule_invalid = true;
@@ -1072,7 +1072,7 @@ static void ecm_nss_non_ported_ipv4_conn
#endif
break;
case ECM_DB_IFACE_TYPE_RAWIP:
-#ifdef ECM_INTERFACE_RAWIP_ENABLE
+#if defined(NSS_FIRMWARE_VERSION_12_5) && defined(ECM_INTERFACE_RAWIP_ENABLE)
nircm->valid_flags |= NSS_IPV4_RULE_CREATE_RAWIP_VALID;
#else
rule_invalid = true;

View File

@@ -0,0 +1,14 @@
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -4057,11 +4057,7 @@ static uint32_t ecm_interface_multicast_
* For MLO bond netdevice, destination for multicast is bond netdevice itself
* Therefore, slave lookup is not needed.
*/
-#ifdef ECM_FRONT_END_SFE_ENABLE
- if (ecm_front_end_is_lag_master(dest_dev) && !bond_is_mlo_device(dest_dev)) {
-#else
if (ecm_front_end_is_lag_master(dest_dev)) {
-#endif
/*
* Link aggregation
* Figure out which slave device of the link aggregation will be used to reach the destination.

View File

@@ -0,0 +1,79 @@
--- a/frontends/ecm_front_end_common.c
+++ b/frontends/ecm_front_end_common.c
@@ -860,7 +860,7 @@ uint64_t ecm_front_end_get_slow_packet_c
* ecm_front_end_ppe_fse_enable_limit_handler()
* Sysctl to enable/disable FSE programming through PPE.
*/
-int ecm_front_end_ppe_fse_enable_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+int ecm_front_end_ppe_fse_enable_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
@@ -895,7 +895,7 @@ int ecm_front_end_ppe_fse_enable_handler
* ecm_front_end_db_conn_limit_handler()
* Database connection limit sysctl node handler.
*/
-int ecm_front_end_db_conn_limit_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+int ecm_front_end_db_conn_limit_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
int ret;
int current_value;
@@ -930,7 +930,7 @@ int ecm_front_end_db_conn_limit_handler(
* ecm_front_end_denied_ports_read()
* Reads the denied ports from the denied ports array and prints.
*/
-static void ecm_front_end_denied_ports_read(void __user *buffer, size_t *lenp, loff_t *ppos, struct hlist_head *denied_ports)
+static void ecm_front_end_denied_ports_read(void *buffer, size_t *lenp, loff_t *ppos, struct hlist_head *denied_ports)
{
char *read_buf;
int i, len;
@@ -966,7 +966,7 @@ static void ecm_front_end_denied_ports_r
len = scnprintf(read_buf + bytes, 4, "\n");
bytes += len;
- bytes = simple_read_from_buffer(buffer, *lenp, ppos, read_buf, bytes);
+ bytes = memory_read_from_buffer(buffer, *lenp, ppos, read_buf, bytes);
*lenp = bytes;
kfree(read_buf);
}
@@ -993,7 +993,7 @@ static inline bool ecm_front_end_is_port
* ecm_front_end_denied_ports_handler()
* Proc handler function for denied ports read/write operation.
*/
-static int ecm_front_end_denied_ports_handler(int write, void __user *buffer, size_t *lenp, loff_t *ppos, struct hlist_head *denied_ports, bool is_udp)
+static int ecm_front_end_denied_ports_handler(int write, void *buffer, size_t *lenp, loff_t *ppos, struct hlist_head *denied_ports, bool is_udp)
{
char *buf;
@@ -1018,10 +1018,9 @@ static int ecm_front_end_denied_ports_ha
count = ECM_FRONT_END_DENIED_PORTS_HTABLE_SIZE * 8 * sizeof(char);
}
- if (copy_from_user(buf, buffer, count)) {
- kfree(pfree);
- return -EFAULT;
- }
+ memcpy(buf, buffer, count);
+ *lenp = count;
+ *ppos += count;
token = strsep(&buf, " ");
if (strlen(token) != 3) {
@@ -1115,7 +1114,7 @@ static int ecm_front_end_denied_ports_ha
* ecm_front_end_udp_denied_ports_handler()
* Proc handler function for UDP denied ports read/write operation.
*/
-static int ecm_front_end_udp_denied_ports_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int ecm_front_end_udp_denied_ports_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
/*
* Usage:
@@ -1135,7 +1134,7 @@ static int ecm_front_end_udp_denied_port
* ecm_front_end_tcp_denied_ports_handler()
* Proc handler function for TCP denied ports read/write operation.
*/
-static int ecm_front_end_tcp_denied_ports_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+static int ecm_front_end_tcp_denied_ports_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
{
/*
* Usage:

View File

@@ -0,0 +1,11 @@
--- a/frontends/nss/ecm_nss_non_ported_ipv6.c
+++ b/frontends/nss/ecm_nss_non_ported_ipv6.c
@@ -342,7 +342,7 @@ static void ecm_nss_non_ported_ipv6_conn
ip_addr_t src_ip;
ip_addr_t dest_ip;
ecm_front_end_acceleration_mode_t result_mode;
-#if defined(ECM_INTERFACE_GRE_TAP_ENABLE) || defined(ECM_INTERFACE_GRE_TUN_ENABLE)
+#if defined(ECM_INTERFACE_GRE_TAP_ENABLE) || defined(ECM_INTERFACE_GRE_TUN_ENABLE) || defined(ECM_INTERFACE_TUNIPIP6_ENABLE)
struct net_device *dev;
#endif

View File

@@ -0,0 +1,482 @@
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -1278,7 +1278,11 @@ static bool ecm_interface_find_route_by_
* it is using to communicate with that IP address.
*/
ECM_IP_ADDR_TO_NIN4_ADDR(be_addr, addr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
ecm_rt->rt.rtv4 = ip_route_output(&init_net, be_addr, 0, 0, 0);
+#else
+ ecm_rt->rt.rtv4 = ip_route_output(&init_net, be_addr, 0, 0, 0, 0);
+#endif
if (IS_ERR(ecm_rt->rt.rtv4)) {
DEBUG_TRACE("No output route to: %pI4n\n", &be_addr);
return false;
@@ -1469,7 +1473,11 @@ struct neighbour *ecm_interface_ipv4_nei
__be32 ipv4_addr;
ECM_IP_ADDR_TO_NIN4_ADDR(ipv4_addr, addr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
rt = ip_route_output(&init_net, ipv4_addr, 0, 0, 0);
+#else
+ rt = ip_route_output(&init_net, ipv4_addr, 0, 0, 0, 0);
+#endif
if (IS_ERR(rt)) {
return NULL;
}
@@ -8274,8 +8282,13 @@ int ecm_interface_wifi_event_stop(void)
* ecm_interface_igs_enabled_handler()
* IGS enabled check sysctl node handler.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
static int ecm_interface_igs_enabled_handler(struct ctl_table *ctl, int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
+#else
+static int ecm_interface_igs_enabled_handler(const struct ctl_table *ctl, int write, void __user *buffer,
+ size_t *lenp, loff_t *ppos)
+#endif
{
int ret;
int current_value;
@@ -8315,7 +8328,11 @@ static int ecm_interface_igs_enabled_han
* ecm_interface_src_check_handler()
* Source interface check sysctl node handler.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
static int ecm_interface_src_check_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#else
+static int ecm_interface_src_check_handler(const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
int ret;
int current_value;
@@ -8369,7 +8386,6 @@ static struct ctl_table ecm_interface_ta
.proc_handler = &ecm_interface_igs_enabled_handler,
},
#endif
- { }
};
#ifdef ECM_INTERFACE_IPSEC_GLUE_LAYER_SUPPORT_ENABLE
--- a/ecm_db/ecm_db_connection.c
+++ b/ecm_db/ecm_db_connection.c
@@ -698,7 +698,7 @@ EXPORT_SYMBOL(ecm_db_connection_node_add
void ecm_db_connection_iface_name_get(struct ecm_db_connection_instance *ci, ecm_db_obj_dir_t dir, char *name_buffer)
{
DEBUG_CHECK_MAGIC(ci, ECM_DB_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", ci);
- strlcpy(name_buffer, ci->node[dir]->iface->name, IFNAMSIZ);
+ strscpy(name_buffer, ci->node[dir]->iface->name, IFNAMSIZ);
}
EXPORT_SYMBOL(ecm_db_connection_iface_name_get);
--- a/ecm_db/ecm_db_iface.c
+++ b/ecm_db/ecm_db_iface.c
@@ -247,7 +247,7 @@ static int ecm_db_iface_state_get_base(s
interface_identifier = ii->interface_identifier;
ae_interface_identifier = ii->ae_interface_identifier;
spin_lock_bh(&ecm_db_lock);
- strlcpy(name, ii->name, IFNAMSIZ);
+ strscpy(name, ii->name, IFNAMSIZ);
mtu = ii->mtu;
spin_unlock_bh(&ecm_db_lock);
@@ -1178,7 +1178,7 @@ void ecm_db_iface_interface_name_get(str
{
DEBUG_CHECK_MAGIC(ii,
ECM_DB_IFACE_INSTANCE_MAGIC, "%px: magic failed", ii);
- strlcpy(name_buffer, ii->name, IFNAMSIZ);
+ strscpy(name_buffer, ii->name, IFNAMSIZ);
}
EXPORT_SYMBOL(ecm_db_iface_interface_name_get);
@@ -2708,7 +2708,7 @@ void ecm_db_iface_add_ethernet(struct ec
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -2760,7 +2760,7 @@ void ecm_db_iface_add_lag(struct ecm_db_
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -2811,7 +2811,7 @@ void ecm_db_iface_add_bridge(struct ecm_
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -2862,7 +2862,7 @@ void ecm_db_iface_add_ovs_bridge(struct
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -2913,7 +2913,7 @@ void ecm_db_iface_add_macvlan(struct ecm
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -2964,7 +2964,7 @@ void ecm_db_iface_add_vlan(struct ecm_db
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3018,7 +3018,7 @@ void ecm_db_iface_add_map_t(struct ecm_d
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3070,7 +3070,7 @@ void ecm_db_iface_add_gre_tun(struct ecm
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3122,7 +3122,7 @@ void ecm_db_iface_add_pppoe(struct ecm_d
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3175,7 +3175,7 @@ void ecm_db_iface_add_pppol2tpv2(struct
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3228,7 +3228,7 @@ void ecm_db_iface_add_pptp(struct ecm_db
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3278,7 +3278,7 @@ void ecm_db_iface_add_unknown(struct ecm
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3327,7 +3327,7 @@ void ecm_db_iface_add_loopback(struct ec
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3386,7 +3386,7 @@ void ecm_db_iface_add_sit(struct ecm_db_
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3436,7 +3436,7 @@ void ecm_db_iface_add_tunipip6(struct ec
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3489,7 +3489,7 @@ void ecm_db_iface_add_ipsec_tunnel(struc
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3541,7 +3541,7 @@ void ecm_db_iface_add_rawip(struct ecm_d
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
@@ -3592,7 +3592,7 @@ void ecm_db_iface_add_ovpn(struct ecm_db
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = type_info->tun_ifnum;
@@ -3643,7 +3643,7 @@ void ecm_db_iface_add_vxlan(struct ecm_d
#endif
ii->arg = arg;
ii->final = final;
- strlcpy(ii->name, name, IFNAMSIZ);
+ strscpy(ii->name, name, IFNAMSIZ);
ii->mtu = mtu;
ii->interface_identifier = interface_identifier;
ii->ae_interface_identifier = ae_interface_identifier;
--- a/frontends/ecm_front_end_common.c
+++ b/frontends/ecm_front_end_common.c
@@ -18,6 +18,7 @@
*/
#include <linux/version.h>
+#include <linux/vmalloc.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/debugfs.h>
@@ -895,7 +896,11 @@ int ecm_front_end_ppe_fse_enable_handler
* ecm_front_end_db_conn_limit_handler()
* Database connection limit sysctl node handler.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
int ecm_front_end_db_conn_limit_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#else
+int ecm_front_end_db_conn_limit_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
int ret;
int current_value;
@@ -1114,7 +1119,11 @@ static int ecm_front_end_denied_ports_ha
* ecm_front_end_udp_denied_ports_handler()
* Proc handler function for UDP denied ports read/write operation.
*/
-static int ecm_front_end_udp_denied_ports_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
+int ecm_front_end_udp_denied_ports_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#else
+int ecm_front_end_udp_denied_ports_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
/*
* Usage:
@@ -1134,7 +1143,11 @@ static int ecm_front_end_udp_denied_port
* ecm_front_end_tcp_denied_ports_handler()
* Proc handler function for TCP denied ports read/write operation.
*/
-static int ecm_front_end_tcp_denied_ports_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
+int ecm_front_end_tcp_denied_ports_handler(struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#else
+int ecm_front_end_tcp_denied_ports_handler(const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
/*
* Usage:
@@ -1181,7 +1194,6 @@ static struct ctl_table ecm_front_end_sy
.mode = 0644,
.proc_handler = &ecm_front_end_tcp_denied_ports_handler,
},
- {}
};
/*
--- a/frontends/sfe/ecm_sfe_common.c
+++ b/frontends/sfe/ecm_sfe_common.c
@@ -308,7 +308,11 @@ void ecm_sfe_common_fast_xmit_set(uint32
* ecm_sfe_fast_xmit_enable_handler()
* Fast transmit sysctl node handler.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
int ecm_sfe_fast_xmit_enable_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#else
+int ecm_sfe_fast_xmit_enable_handler(const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
int ret;
@@ -332,7 +336,11 @@ int ecm_sfe_fast_xmit_enable_handler(str
* ecm_sfe_fse_enable_handler()
* Sysctl to enable/disable FSE programming through ECM SFE frontend.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
int ecm_sfe_fse_enable_handler(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#else
+int ecm_sfe_fse_enable_handler(const struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+#endif
{
int ret;
int current_val;
@@ -467,14 +475,13 @@ static struct ctl_table ecm_sfe_sysctl_t
.proc_handler = &ecm_sfe_mht_enable_handler,
},
#endif
- {}
};
/*
* ecm_sfe_sysctl_tbl_init()
* Register sysctl for SFE
*/
-int ecm_sfe_sysctl_tbl_init()
+int ecm_sfe_sysctl_tbl_init(void)
{
ecm_sfe_ctl_tbl_hdr = register_sysctl(ECM_FRONT_END_SYSCTL_PATH, ecm_sfe_sysctl_tbl);
if (!ecm_sfe_ctl_tbl_hdr) {
@@ -489,7 +496,7 @@ int ecm_sfe_sysctl_tbl_init()
* ecm_sfe_sysctl_tbl_exit()
* Unregister sysctl for SFE
*/
-void ecm_sfe_sysctl_tbl_exit()
+void ecm_sfe_sysctl_tbl_exit(void)
{
if (ecm_sfe_ctl_tbl_hdr) {
unregister_sysctl_table(ecm_sfe_ctl_tbl_hdr);
--- a/ecm_classifier_hyfi.c
+++ b/ecm_classifier_hyfi.c
@@ -437,7 +437,7 @@ static void ecm_classifier_hyfi_get_brid
struct net_device *master;
master = ecm_interface_get_and_hold_dev_master(dev);
if (master) {
- strlcpy(name_buffer, master->name, IFNAMSIZ);
+ strscpy(name_buffer, master->name, IFNAMSIZ);
dev_put(master);
dev_put(dev);
break;
@@ -841,13 +841,13 @@ struct ecm_classifier_hyfi_instance *ecm
/* one of the bridge name is null, typical
* routed connection. Consider valid bridge*/
if (strlen(to_bridge)) {
- strlcpy(chfi->bridge_name, to_bridge, IFNAMSIZ);
+ strscpy(chfi->bridge_name, to_bridge, IFNAMSIZ);
} else if (strlen(from_bridge)) {
- strlcpy(chfi->bridge_name, from_bridge, IFNAMSIZ);
+ strscpy(chfi->bridge_name, from_bridge, IFNAMSIZ);
}
} else if (!strncmp(to_bridge, from_bridge, IFNAMSIZ)) {
/* Pure bridge connection. Consider any one bridge */
- strlcpy(chfi->bridge_name, to_bridge, IFNAMSIZ);
+ strscpy(chfi->bridge_name, to_bridge, IFNAMSIZ);
} else {
/* multi-bridge connection */
chfi->multi_bridge_flow = true;
--- a/examples/ecm_pcc_test.c
+++ b/examples/ecm_pcc_test.c
@@ -716,9 +716,9 @@ static unsigned int ecm_pcc_test_update_
o_feature_flags = rule->feature_flags;
rule->accel = accel;
rule->feature_flags = feature_flags;
- strlcpy(rule->name, name, sizeof(rule->name));
- strlcpy(rule->mirror_info.tuple_mirror_dev, tuple_mirror_dev, IFNAMSIZ);
- strlcpy(rule->mirror_info.tuple_ret_mirror_dev, tuple_ret_mirror_dev, IFNAMSIZ);
+ strscpy(rule->name, name, sizeof(rule->name));
+ strscpy(rule->mirror_info.tuple_mirror_dev, tuple_mirror_dev, IFNAMSIZ);
+ strscpy(rule->mirror_info.tuple_ret_mirror_dev, tuple_ret_mirror_dev, IFNAMSIZ);
rule->ap_info.flow_ap_index = flow_ap_index;
rule->ap_info.return_ap_index = return_ap_index;
spin_unlock_bh(&ecm_pcc_test_rules_lock);
@@ -881,7 +881,7 @@ static unsigned int ecm_pcc_test_add_rul
if (!new_rule)
return 0;
- strlcpy(new_rule->name, name, sizeof(new_rule->name));
+ strscpy(new_rule->name, name, sizeof(new_rule->name));
new_rule->accel = accel;
new_rule->proto = proto;
new_rule->src_port = src_port;
@@ -892,8 +892,8 @@ static unsigned int ecm_pcc_test_add_rul
new_rule->dest_addr = *dest_addr;
new_rule->ipv = ipv;
new_rule->feature_flags = feature_flags;
- strlcpy(new_rule->mirror_info.tuple_mirror_dev, tuple_mirror_dev, IFNAMSIZ);
- strlcpy(new_rule->mirror_info.tuple_ret_mirror_dev, tuple_ret_mirror_dev, IFNAMSIZ);
+ strscpy(new_rule->mirror_info.tuple_mirror_dev, tuple_mirror_dev, IFNAMSIZ);
+ strscpy(new_rule->mirror_info.tuple_ret_mirror_dev, tuple_ret_mirror_dev, IFNAMSIZ);
new_rule->ap_info.flow_ap_index = flow_ap_index;
new_rule->ap_info.return_ap_index = return_ap_index;
INIT_LIST_HEAD(&new_rule->list);
@@ -1024,7 +1024,7 @@ static ssize_t ecm_pcc_test_rule_write(s
/*
* Convert fields
*/
- strlcpy(name, fields[0], sizeof(name));
+ strscpy(name, fields[0], sizeof(name));
name[sizeof(name) - 1] = 0;
if (sscanf(fields[1], "%u", &oper) != 1)
@@ -1072,9 +1072,9 @@ static ssize_t ecm_pcc_test_rule_write(s
return -EINVAL;
}
- strlcpy(tuple_mirror_dev, fields[11], IFNAMSIZ);
+ strscpy(tuple_mirror_dev, fields[11], IFNAMSIZ);
- strlcpy(tuple_ret_mirror_dev, fields[12], IFNAMSIZ);
+ strscpy(tuple_ret_mirror_dev, fields[12], IFNAMSIZ);
if (sscanf(fields[13], "%d", &flow_ap_index) != 1)
goto sscanf_read_error;
--- a/Makefile
+++ b/Makefile
@@ -541,4 +541,10 @@ endif
ccflags-y += -Wall -Werror
+# Kernel 6.12 compat headers
+ccflags-y += -I$(obj)/compat
+
+# GCC 15+ has stricter checks for prototypes and declarations. Silence them
+ccflags-y += -Wno-missing-prototypes -Wno-missing-declarations
+
obj ?= .
--- /dev/null
+++ b/compat/asm/unaligned.h
@@ -0,0 +1,13 @@
+/* Compatibility header for <asm/unaligned.h> moved to <linux/unaligned.h> in kernel 6.10+ */
+#ifndef _ASM_UNALIGNED_H
+#define _ASM_UNALIGNED_H
+
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,10,0)
+#include <linux/unaligned.h>
+#else
+#include_next <asm/unaligned.h>
+#endif
+
+#endif /* _ASM_UNALIGNED_H */

View File

@@ -1,61 +0,0 @@
From 1958e34c4c1b8b4fb62eba693fbd7693536947b9 Mon Sep 17 00:00:00 2001
From: flebourse <francis.lebourse@sfr.fr>
Date: Thu, 23 Dec 2021 16:11:06 +0100
Subject: [PATCH] qca-nss-ecm: fix a memcpy overflow in ecm_db
Calls to ipv6_addr_prefix() trigger a memcpy overflow if the prefix len
argument is greater than 128, cap it at this value.
stack bactrace:
detected buffer overflow in memcpy
Kernel BUG at fortify_panic+0x20/0x24
Internal error: Oops - BUG: 0 [#1] SMP
CPU: 2 PID: 2592 Comm: netifd Not tainted 5.10.80 #0
Hardware name: Xiaomi AX9000 (DT)
Call trace:
fortify_panic+0x20/0x24
ecm_db_exit+0x42c/0x49c [ecm]
ecm_db_exit+0x464/0x49c [ecm]
atomic_notifier_call_chain+0x5c/0x90
ip6_route_add+0x13c/0x1a4
inet6_rtm_newroute+0x98/0xa0
rtnetlink_rcv_msg+0x10c/0x34c
netlink_rcv_skb+0x5c/0x130
rtnetlink_rcv+0x1c/0x2c
netlink_unicast+0x1ec/0x2e0
netlink_sendmsg+0x1a4/0x394
____sys_sendmsg+0x270/0x2b4
___sys_sendmsg+0x7c/0xc0
__sys_sendmsg+0x5c/0xb0
__arm64_sys_sendmsg+0x28/0x34
el0_svc_common.constprop.0+0x88/0x190
do_el0_svc+0x74/0x94
el0_svc+0x14/0x20
el0_sync_handler+0xa8/0x130
el0_sync+0x184/0x1c0
Code: aa0003e1 912b4040 910003fd 97fff56c (d4210000)
Signed-off-By: Francis Le Bourse <francis.lebourse@sfr.fr>
---
ecm_db/ecm_db.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/ecm_db/ecm_db.c
+++ b/ecm_db/ecm_db.c
@@ -298,7 +298,7 @@ static int ecm_db_ipv6_route_table_updat
* Compute ECM connection's prefix destination address by masking it with the
* route config's destination address prefix length.
*/
- ipv6_addr_prefix(&prefix_addr, &ecm_in6, cfg->fc_dst_len);
+ ipv6_addr_prefix(&prefix_addr, &ecm_in6, min(128, cfg->fc_dst_len));
DEBUG_TRACE("dest addr prefix: %pI6 prefix_len: %d ecm_in6: %pI6\n", &prefix_addr, cfg->fc_dst_len, &ecm_in6);
@@ -326,7 +326,7 @@ static int ecm_db_ipv6_route_table_updat
* Compute ECM connection's prefix source address by masking it with the
* route config's destination address prefix length.
*/
- ipv6_addr_prefix(&prefix_addr, &ecm_in6, cfg->fc_dst_len);
+ ipv6_addr_prefix(&prefix_addr, &ecm_in6, min(128, cfg->fc_dst_len));
DEBUG_TRACE("src addr prefix: %pI6 prefix_len: %d ecm_in6: %pI6\n", &prefix_addr, cfg->fc_dst_len, &ecm_in6);

Some files were not shown because too many files have changed in this diff Show More