Compare commits

..
101 Commits
Author SHA1 Message Date
Mattias WalströmandGitHub 3f0a0e3df0 Merge pull request #1034 from kernelkit/update-changelog
Update changelog for v25.04.0
2025-04-30 09:45:26 +02:00
Mattias Walström 3b261b331d Update changelog for v25.04.0 2025-04-30 08:58:56 +02:00
Richard AlpeandGitHub 066ec71736 Merge pull request #1030 from kernelkit/allow-user-sysrepo-access
Allow user sysrepo access
2025-04-29 15:02:39 +02:00
Tobias WaldekranzandGitHub 71295e0e37 Merge pull request #1027 from kernelkit/add-mqprio-quirk
imx8mp-evk: Disable mqprio for eth1
2025-04-28 16:57:36 +02:00
Richard Alpe ac89f94580 sysrepo: allow non-wheel users access to sysrepo data
Non-privileged users in the sys-cli group can now access sysrepo data.

The data is now solely protected by the NCAM rules and not Unix file
permissions. Any stray user that's not part of the (default) sys-cli
group still can't access syrepo, like users added from the shell.

Fixes #932

Signed-off-by: Richard Alpe <richard@bit42.se>
2025-04-28 15:41:09 +02:00
Richard Alpe 399984082f Bump buildroot (still 2025.02.1)
Use new buildroot branching strategy where all our commits are placed
on top of a buildroot release on a branch named BR_RELEASE-kkit.

Signed-off-by: Richard Alpe <richard@bit42.se>
2025-04-28 15:32:10 +02:00
Mattias Walström 3375555911 imx8mp-evk: Disable mqprio for eth1
The kernel just hang, adding a quirk for it.
2025-04-28 13:44:19 +02:00
Tobias WaldekranzandGitHub 794872ca0c Merge pull request #1028 from kernelkit/bump-finit
Bump Finit to v4.12
2025-04-28 08:09:52 +02:00
Joachim Wiberg b7f110dbdc package/finit: bump to v4.12
- Improve notify:s6 readiness compatibility
 - Update `runparts` usage text
 - Fix variable overloading in urandom plugin
 - Fix buffer overwrite in urandom plugin, reported by Aaron Andersen

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-04-28 00:50:30 +02:00
Mattias WalströmandGitHub af20325cc4 Merge pull request #1026 from kernelkit/upgrade-kernel 2025-04-25 18:09:49 +02:00
Mattias Walström 7a5c9d0324 Upgrade kernel to 6.12.25 (LTS)
Also backport some fixes for freescale-imx8mp-evk
2025-04-25 13:04:37 +02:00
Mattias WalströmandGitHub a2533aa9c4 Merge pull request #1025 from kernelkit/upgrade-buildroot 2025-04-25 12:10:52 +02:00
Mattias Walström 4d650bad7f Upgrade buildroot to 2025.02.1 (LTS)
2025.02.1, released April 22nd, 2025

	Changes with potentially large impact:

	- gstreamer1 and related packages: updated from 1.22.x to 1.24.x.
	  1.22.x was already EOL when Buildroot 2025.02 was released, so
	  GStreamer should really already have been udpated to 1.24.x.
	  This update was needed to fix a lot of vulnerabilities.
	- frr: updated from 9.1.3 to 10.3. Version 9 is no longer
	  maintained upstream, and not in any distro either. This update
	  was needed to fix a vulernability.

	Important / security related fixes:

	- libmodsecurity: CVE-2025-27110.
	- tinyxml2: CVE-2024-50615.
	- xserver_xorg-server & xwayland: CVE-2024-9632, CVE-2025-26594,
	    CVE-2025-26595, CVE-2025-26596, CVE-2025-26597,  CVE-2025-26598,
	    CVE-2025-26599, CVE-2025-26600, CVE-2025-26601.
	- exim: CVE-2025-30232.
	- mbedtls: CVE-2025-27809, CVE-2025-27810.
	- libfreeglut: CVE-2024-24258, CVE-2024-24259.
	- libopenh264: CVE-2025-27091.
	- gstreamer1: CVE-2024-47834, CVE-2024-47835, CVE-2024-47778,
	    CVE-2024-47777 CVE-2024-47776, CVE-2024-47775, CVE-2024-47774,
	    CVE-2024-47615, CVE-2024-47613, CVE-2024-47607, CVE-2024-47606,
	    CVE-2024-47603, CVE-2024-47602, CVE-2024-47601, CVE-2024-47600,
	    CVE-2024-47599, CVE-2024-47598, CVE-2024-47597, CVE-2024-47596,
	    CVE-2024-47546, CVE-2024-47545, CVE-2024-47544, CVE-2024-47543,
	    CVE-2024-47542, CVE-2024-47541, CVE-2024-47540, CVE-2024-47539,
	    CVE-2024-47538, CVE-2024-47537.
	- augeas: CVE-2025-2588.
	- libndp: CVE-2024-5564.
	- python-jinja2: CVE-2025-27516.
	- python-django: CVE-2025-26699.
	- libarchive: CVE-2024-57970, CVE-2025-1632.
	- frr: CVE-2024-55553.

	Updated / fixed packages: libmodsecurity, intel-mediadriver,
	intel-vpl-gpu-rt, python-aerich, python-aiohttp, python-maturin,
	python-tortoise-orm, python-sqlalchemy, kodi-pvr-waipu, tor, mc,
	tinyxml2, libgeos, intel-vpl-gpu-rt, intel-mediadriver, ruby,
	ncftp, xserver_xorg-server, exim, mbedtls, gdb, freerdp, uclibc,
	libsoup3, cairo, zabbix, armadillo, spdlog, go, linux, linux-tools,
	gstreamer, linux-header, ethtool, apr, mali-driver, libcoap, libcap
	python-fastapi, python-twisted.

	Test Improvements:

	- linux-tools: selftests: Add path containing BPF binary.
	- testing: make time setting portable.
	- testing: set date in emulated machine.
	- testing: add git runtime test.
	- test_gstreamer1: fix test by using bootlin toolchain.

	Infrastructure updates/fixes:

	- kconfig: Handle backspace (^H) key.
	- xilinx-embeddedsw: fix menuconfig visualization.
	- DEVELOPERS: change arnout's address.
	- support/download/svn: use 'svn info' whith LC_ALL=C
	- glibc: disable on RISC-V ilp32f and lp64f, not supported.
	- dillo: Fix an issue related to _SITE url for make show-info.
	- pkg-stats: add -v/--verbose option

	Build issues/problems solved for packages:

	dillo, freerdp, freeswitch, gdb, glibc, linux-tools,
	mesa3d-demos, ncftp, tesseract-ocr,
	v4l2loopback, zabbix
2025-04-24 20:12:43 +02:00
Tobias WaldekranzandGitHub ff5b71b825 Merge pull request #1019 from kernelkit/move-operational
statd: Move operational from confd to statd (yanger)
2025-04-23 16:18:42 +02:00
Mattias Walström 2b5cf29bb9 statd: Add new README to describe statd
Whats required from your system and what to expect when you run it
outside Infix.
2025-04-23 13:45:50 +02:00
Mattias Walström 513c03a764 statd: Add script to install yang-tools locally (under /home)
This to be able to run statd locally on your computer.
2025-04-23 13:45:50 +02:00
Mattias Walström 5a982ab9ff statd: Allow to specify yanger path 2025-04-23 13:45:50 +02:00
Mattias Walström 4ea451362f yanger: DHCP: Fix bug when search exist but no nameserver
When running a DHCP test `resolvconf -l` looked like this:
admin@client:~$ resolvconf -l
search example.com # e5
admin@client:~$

This resulted in broken result when reading operational data from
system-state (which used resolvonf -l)
2025-04-23 13:45:49 +02:00
Mattias Walström 44be4e57f0 test: statd: Update unit testfiles 2025-04-23 13:45:49 +02:00
Mattias Walström dc0871a093 yanger: Do not fail if rauc or /run/system.json exist
This allowes to run statd on your computer.
2025-04-23 13:45:48 +02:00
Mattias Walström c6b44db18a statd: Move operational from confd to statd (yanger) 2025-04-23 13:45:48 +02:00
Mattias WalströmandGitHub a4def1379c Merge pull request #1018 from kernelkit/clean-srload 2025-04-14 07:40:45 +02:00
Mattias Walström 028ab7c1f9 srload: Cleanup when running outside buildtree
The original syntax did not work and the initial intention,
that root is always required is also false.
2025-04-11 20:31:43 +02:00
Mattias WalströmandGitHub cc03a59725 Merge pull request #1013 from kernelkit/move-yang-models-to-confd
Move yang models to confd
2025-04-11 13:45:26 +02:00
Mattias Walström 092964a10b confd: Install *all* YANG modules from confd
Sysrepo, netopeer etc are still responsible to install the modules in
target directory, this will make that we will discover quickly if something
is updated.

Also this enables rm -rf output/target/etc/sysrepo/data/* && make confd-rebuild
This will reinstall all modules again.
2025-04-11 08:21:51 +02:00
Mattias Walström d0277de958 srload: Add support for multiple search directories 2025-04-11 08:21:50 +02:00
Mattias WalströmandGitHub 2df84e20af Merge pull request #1016 from kernelkit/fix-ssh-migrate
Fix migration when SSH server settings exist
2025-04-11 08:20:34 +02:00
Mattias WalströmandGitHub 9de4633c13 Merge pull request #1017 from kernelkit/update-kernel
Upgrade linux kernel to 6.12.23 (LTS)
2025-04-10 19:50:39 +02:00
Mattias Walström 50f955c242 Upgrade linux kernel to 6.12.23 (LTS) 2025-04-10 15:21:36 +02:00
Mattias Walström f2f539b492 Fix migration when SSH server settings exist
This fix #1015
2025-04-10 14:29:56 +02:00
Joachim WibergandGitHub 2b439298fb Merge pull request #1014 from kernelkit/fix-migrate-version 2025-04-09 17:04:06 +02:00
Richard Alpe 2ef759a9d8 confd: remove prefix from version leaf in migrate
Signed-off-by: Richard Alpe <richard@bit42.se>
2025-04-09 15:51:11 +02:00
Mattias WalströmandGitHub 6fe4db8431 Merge pull request #1011 from kernelkit/update-kernel
Update kernel to 6.12.22 (LTS)
2025-04-07 18:44:55 +02:00
Mattias Walström b2525e29e1 Upgrade linux kernel to 6.12.22 (LTS) 2025-04-07 18:26:07 +02:00
Joachim WibergandGitHub 7ef5223fca Merge pull request #1010 from kernelkit/netboot-doc
Netboot HowTo

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-04-07 17:57:56 +02:00
Joachim Wiberg 323bfc9d66 doc: add netboot howto, for developers
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-04-07 17:56:59 +02:00
Mattias WalströmandGitHub d6be23fa6b Merge pull request #1012 from kernelkit/run-migrate-script-locally
Run migrate script locally
2025-04-07 17:07:21 +02:00
Mattias Walström c7c2998e33 Require a valid sha256 checksum for all package downloaded 2025-04-07 16:57:17 +02:00
Mattias Walström 184ed470d7 kernel-refresh.sh: Update linux hash on update 2025-04-07 16:57:17 +02:00
Richard Alpe 75352a9f77 confd: add no log option (-e) to migrate script
Write logs to stderr instead of syslog. Useful when running on a
non-target system.

Signed-off-by: Richard Alpe <richard@bit42.se>
2025-04-07 15:20:54 +02:00
Richard Alpe e3c601f2fd confd: add script path option (-s) to migrate script
This allows a user to run in on any system which has the Infix source
code that contains the modification scripts.

Signed-off-by: Richard Alpe <richard@bit42.se>
2025-04-07 15:09:36 +02:00
Richard Alpe 0ab9e2a36a confd: fix indentation of bin/migrate
Don't mix tabs and spaces.

Signed-off-by: Richard Alpe <richard@bit42.se>
2025-04-07 14:57:17 +02:00
Joachim WibergandGitHub 7b20665cf9 Merge pull request #1004 from kernelkit/new-show-command
Add new show command

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-04-07 14:34:35 +02:00
Mattias WalströmandGitHub 3d86ecd2ee Merge pull request #1005 from kernelkit/fix-images
Change type of disk image
2025-04-07 09:41:01 +02:00
Richard Alpe 403b79d370 test: update unit test data (cli/show-software)
The software list from sysrepo is no longer reversed, the reverse now
happens in cli-pretty. This commit reflects that.

Signed-off-by: Richard Alpe <richard@bit42.se>
2025-04-07 09:06:29 +02:00
Richard Alpe 740ecbcc43 cli: integrate (use) new show command in cli 2025-04-07 09:06:28 +02:00
Richard Alpe 42af6eec30 show: add bash tab-completions
Signed-off-by: Richard Alpe <richard@bit42.se>
2025-04-07 09:06:27 +02:00
Richard Alpe c584af356b show: add new show tool written in python3
The reason for this is:
1) We want to use the same fetch tool for all operational data, to
   avoid having duplicated xpaths scattered across the repo.
2) We want to call this directly from the CLI, which means it need to
   be escape safe. A unprivileged user shall be able to use it but not
   escape into a shell or do other malicious stuff.

Signed-off-by: Richard Alpe <richard@bit42.se>
2025-04-07 09:06:26 +02:00
Richard Alpe 827dc098e4 board/common: deprecate existing show command
There's several reasons for this. The main reason is that it was
developed as an intermediate way of getting system information when
the operational datastore was almost empty. There's not a lot of data
available in the operational datastore and we shall rely on that data
primarily. This command isn't safe to run from a jailed CLI as i
doesn't validate input and run commands directly in the shell, making
it hard to protect against a CLI jail break.

In upcoming patches we will introduce a new show tool that relies
solely on operational data and which sanitize the user input.

Signed-off-by: Richard Alpe <richard@bit42.se>
2025-04-07 09:06:25 +02:00
Richard Alpe bc5dd949d7 cli: fix indentation of infix.xml 2025-04-07 09:06:20 +02:00
Mattias Walström 4a932dec11 Update changelog for 2025.04 2025-04-07 08:20:21 +02:00
Mattias Walström d5c5e38604 CI: Store qcow2 disk images as release artififacts
This to make it easier to use  GNS3 appliance file from
GNS3 marketplace.
2025-04-07 08:16:34 +02:00
Mattias Walström 02080bfb6c qeneth: Move Infix test templates from qeneth to Infix 2025-04-07 08:16:33 +02:00
Mattias Walström d3fa51e4fa Use qcow2 for disk image instead of raw image
This make the release bundle much smaller, the disk image size
change from 512M to 2xsizeof(squashimage)
2025-04-07 08:16:33 +02:00
Mattias Walström 6cfe5f8c58 Fix symlink in release packages
Fix #1002
2025-04-07 08:16:33 +02:00
Mattias Walström b4f3e4eab8 migrate: Fix typo resulting in not logging correctly 2025-04-07 08:16:32 +02:00
Joachim WibergandGitHub b188e781ee Merge pull request #1007 from kernelkit/r2s-fixes
Fix NanoPi R2S Regression

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-04-07 08:16:09 +02:00
Joachim Wiberg 8156179f1b doc: update ChangeLog for v25.04 release cycle
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-04-07 06:22:19 +02:00
Joachim Wiberg 55632eebaa utils: update usage text with example, add -f
- Update usage text for readability, add example
 - Reindent getopts case and add -h
 - Allow 'git rm -f' to remove already staged patches

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-04-07 06:06:42 +02:00
Joachim Wiberg 71b11026bb configs/r2s_defconfig: bump kernel to 6.12.21 (LTS)
- Bump kernel to 6.12.21, same as other tier one boards
 - Fix #1006 byt enabling netlink for ethtool (now works!)
 - Sync defconfigs:
   - LIBXCRYPT now in an rdep of another package
   - Disable FORCE check hashes for now
 - Drop patches for 6.10 tree (r2s kernel)
 - Port RTL8153b patch for R2S LAN LED support

Fixes #1006

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-04-07 05:54:54 +02:00
Joachim Wiberg 2b28733fda confd: set correct file version of migrated files in backup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-04-07 05:32:05 +02:00
Joachim Wiberg 8c115e17c4 board/common: set wheel group on /cfg/backup dir
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-04-07 05:32:05 +02:00
Mattias WalströmandGitHub 10f62f679b Merge pull request #1000 from kernelkit/logging-fixes
Misc. fixes related to logging found in -rc1
2025-03-31 15:08:10 +02:00
Joachim Wiberg fa4f7c6532 doc: update ChangeLog with fixes for -rc1 issues
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 13:49:34 +02:00
Joachim Wiberg 0647541988 patches/sysklogd: sync with latest version in Buildroot 2025.02
Buildroot 2025.02 currently has sysklogd v2.7.0, which has new features,
but also a few bugs.  This commit drops all patches for v2.5.2 and adds
all patches for sysklogd v2.7.2

For more information, see:

 - https://github.com/troglobit/sysklogd/releases/tag/v2.7.1
 - https://github.com/troglobit/sysklogd/releases/tag/v2.7.2

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 13:43:19 +02:00
Joachim Wiberg 2602ddc0b8 board/common: skip product init if no product specific dir
This silences a bogus warning in the log when runparts is called with no
argument.  I.e., when there is no product specific init files available.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 13:35:44 +02:00
Joachim Wiberg 3886b284d3 confd: fix invalid priority argument to logger
There is no such loglevel 'critical', only 'crit' is defined.

For some reason this issue has not been spotted until the upgrade to
Buildroot 2025.02, which includes sysklogd v2.7.0, and Finit v4.11.

Introduced in 3e48af6, when the concept of failure-config was added.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 13:14:34 +02:00
Joachim Wiberg 22a9405d1e confd: shellcheck fixes to load script
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 13:13:43 +02:00
Mattias WalströmandGitHub 2902dccf11 Merge pull request #999 from kernelkit/bump-version
Bump version for v25.03.0 GA
2025-03-31 11:37:27 +02:00
Joachim Wiberg 644374bb29 doc: bump version for v25.03.0 GA
[skip ci]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 11:32:02 +02:00
Tobias WaldekranzandGitHub a868307637 Merge pull request #998 from kernelkit/mvpp2-tcam-fix-main
patches/linux: net: mvpp2: Prevent parser TCAM memory corruption
2025-03-31 11:27:03 +02:00
Tobias Waldekranz d213861e02 patches/linux: net: mvpp2: Prevent parser TCAM memory corruption
[skip ci]
2025-03-31 11:26:27 +02:00
Joachim WibergandGitHub 3d538d4eca Merge pull request #992 from kernelkit/bump-finit
Fix reboot when containers are in setup state

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 11:21:52 +02:00
Joachim WibergandGitHub 06a6dd17f8 Merge pull request #997 from kernelkit/rename-lag-yang
Rename infix-if-lag to correct version
2025-03-31 10:55:17 +02:00
Joachim Wiberg 18659fd45a doc: update ChangeLog for v25.03
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 10:00:00 +02:00
Joachim Wiberg 7253be7619 Allow writing to the ttyd console after Buildroot bump
Fixes #990

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 09:54:14 +02:00
Joachim Wiberg 910749bab1 board/common: send SIGTERM when container is in its setup phase
When stopping a container that is (stuck) in setup state, e.g., fetching
its container image, we need to send SIGTERM to the container wrapper
script rather than forwarding the 'stop' command to podman.

With this fix, and the Finit upgrade, there is no longer a 10 second
timeout before Finit sends SIGKILL to the PID.  Instead, the script now
immediately react to the initial SIGTERM.

Related to issue #980

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 09:54:13 +02:00
Joachim Wiberg 4f9b3146a1 package/finit: bump to v4.11
ChangeLog: https://github.com/troglobit/finit/releases/tag/4.11

Fixes #980

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-31 09:54:10 +02:00
Mattias Walström b026abd0bc Rename infix-if-lag to correct version
Fix libyang warning: [WRN] File name "infix-if-lag@2024-12-08.yang" does not match module revision "2025-03-28".
2025-03-31 09:39:42 +02:00
Tobias WaldekranzandGitHub 08658a37c4 Merge pull request #996 from kernelkit/update-kernel
Upgrade linux kernel to 6.12.21 (LTS)
2025-03-31 08:07:07 +02:00
Mattias Walström 6bbf2d02a8 Upgrade linux kernel to 6.12.21 (LTS) 2025-03-30 21:40:43 +02:00
Mattias WalströmandGitHub 538185c29e Merge pull request #995 from kernelkit/yang-warning
confd: drop unused must expression from infix-if-lag.yang
2025-03-30 21:39:44 +02:00
Joachim Wiberg bd05715ba0 confd: drop unused must expression from infix-if-lag.yang
Fixes #964

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-28 13:11:56 +01:00
Mattias WalströmandGitHub 6960cd30eb Merge pull request #993 from kernelkit/relase-tarball-fixes
.github: preserve symlinks in tarballs
2025-03-28 12:55:35 +01:00
Joachim Wiberg c5c21dec83 .github: preserve symlinks in tarballs
Fixes #991

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2025-03-28 11:15:49 +01:00
Mattias WalströmandGitHub 73de6b6d42 Merge pull request #988 from kernelkit/pre-built-go
Use prebuilt GO toolchain
2025-03-20 10:52:30 +01:00
Mattias Walström f698d5f0ee Use prebuilt GO toolchain
Do NOT built it from source
2025-03-20 08:53:53 +01:00
Mattias WalströmandGitHub 7e59406436 Merge pull request #972 from kernelkit/update-buildroot
Update buildroot to new LTS base (2025.02)
2025-03-20 08:39:26 +01:00
Mattias Walström b8a9dc9743 Update Changelog
[skip ci]
2025-03-17 19:51:46 +01:00
Mattias Walström 1b5aa16652 dnsmasq: Remove relay agent info patch 2025-03-17 19:45:05 +01:00
Mattias Walström 3f491ea785 yangdoc: Add patch to remove pip-tools as requirement
Not used
2025-03-17 19:45:05 +01:00
Mattias Walström 9bdad9bc8b podman: Update podman hash
Just minor change of filename from podman-4.5.0.tar.gz to
podman-4.5.0-go2.tar.gz
2025-03-17 19:45:05 +01:00
Mattias Walström de711b0123 netsnmp: Update patch after toolchain upgrade 2025-03-17 19:45:04 +01:00
Mattias Walström b52c462cfa Update patches for new versions 2025-03-17 19:45:04 +01:00
Mattias Walström f4e75dfecb Update the name in hash file for the packages for fetched from git
Buildroot have change the named for the tar-package
created for a package created from a git repo.
2025-03-17 19:45:03 +01:00
Mattias Walström c5fe10aada busybox: Add patch for the new version 2025-03-17 19:45:03 +01:00
Mattias Walström 97623b989c frr: Add upstream compat patch to work with libyang 3 2025-03-17 19:45:03 +01:00
Mattias Walström ed2a776c55 Remove obsolete patches 2025-03-17 19:45:02 +01:00
Mattias Walström ac4fcb61c6 Update buildroot to new LTS base (2025.02) 2025-03-17 19:45:02 +01:00
Tobias WaldekranzandGitHub 41fa664a86 Merge pull request #984 from kernelkit/update-kernel
Update kernel to 6.12.19 (LTS)
2025-03-13 20:02:07 +01:00
Mattias Walström 4f54cbe975 Update kernel to 6.12.19 (LTS) 2025-03-13 13:31:54 +01:00
265 changed files with 4526 additions and 5612 deletions
+1 -1
View File
@@ -125,7 +125,7 @@ jobs:
cd output/
mv images ${{ steps.vars.outputs.dir }}
ln -s ${{ steps.vars.outputs.dir }} images
tar chfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
tar cfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
- uses: actions/upload-artifact@v4
with:
+13 -3
View File
@@ -85,16 +85,21 @@ jobs:
cd output/
mv images ${{ steps.vars.outputs.dir }}
ln -s ${{ steps.vars.outputs.dir }} images
tar chfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
tar cfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }}
mv legal-info legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}
tar chfz legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}.tar.gz legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}
tar cfz legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}.tar.gz legal-info-${{ matrix.target }}-${{ steps.vars.outputs.ver }}
- uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.target }}
path: output/*.tar.gz
- uses: actions/upload-artifact@v4
with:
name: artifact-disk-image-${{ matrix.target }}
path: output/images/*.qcow2
release:
name: Release Infix ${{ github.ref_name }}
needs: build
@@ -141,6 +146,11 @@ jobs:
for file in *.tar.gz; do
sha256sum $file > $file.sha256
done
if ls *.qcow2 &>/dev/null; then
for file in *.qcow2; do
sha256sum "$file" > "$file.sha256"
done
fi
- name: Extract ChangeLog entry ...
run: |
@@ -155,7 +165,7 @@ jobs:
makeLatest: ${{ steps.rel.outputs.latest }}
discussionCategory: ${{ steps.rel.outputs.cat }}
bodyFile: release.md
artifacts: "*.tar.gz*"
artifacts: "*.tar.gz*,*.qcow2*"
- name: Summary
run: |
-2
View File
@@ -230,7 +230,6 @@ CONFIG_MAC80211_LEDS=y
CONFIG_RFKILL=y
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
# CONFIG_ETHTOOL_NETLINK is not set
CONFIG_PCI=y
CONFIG_PCIEPORTBUS=y
CONFIG_PCI_IOV=y
@@ -481,7 +480,6 @@ CONFIG_I2C=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y
CONFIG_I2C_MUX_PCA954x=y
CONFIG_I2C_DESIGNWARE_PLATFORM=y
CONFIG_I2C_GPIO=m
CONFIG_I2C_RK3X=y
CONFIG_I2C_SLAVE=y
+5 -3
View File
@@ -127,7 +127,7 @@ bootdata=
diskimg=disk.img
bootimg=
bootpart=
tmpimage=$(mktemp)
while getopts "a:b:B:n:s:" opt; do
case ${opt} in
a)
@@ -166,7 +166,7 @@ awk \
-vimgsize=$imgsize \
-vcfgsize=$cfgsize \
-vvarsize=$varsize \
-vdiskimg=$diskimg \
-vdiskimg=$tmpimage \
-vbootimg="$bootimg" -vbootpart="$bootpart" \
'{
sub(/@TOTALSIZE@/, total);
@@ -211,5 +211,7 @@ genimage \
--rootpath "$root" \
--tmppath "$tmp" \
--inputpath "$BINARIES_DIR" \
--outputpath "$BINARIES_DIR" \
--config "$root/genimage.cfg"
qemu-img convert -c -O qcow2 "$tmpimage" "$BINARIES_DIR/$diskimg"
rm "$tmpimage"
+3 -3
View File
@@ -23,7 +23,7 @@ if [ -n "$IMAGE_ID" ]; then
else
NAME="$INFIX_ID"-$(echo "$BR2_ARCH" | tr _ - | sed 's/x86-64/x86_64/')
fi
diskimg=disk.img
diskimg=disk.qcow2
ver()
{
@@ -48,7 +48,7 @@ fi
load_cfg DISK_IMAGE
if [ "$DISK_IMAGE" = "y" ]; then
ixmsg "Creating Disk Image"
diskimg="${NAME}-disk$(ver).img"
diskimg="${NAME}-disk$(ver).qcow2"
bootcfg=
if [ "$DISK_IMAGE_BOOT_DATA" ]; then
bootcfg="-b $DISK_IMAGE_BOOT_DATA -B $DISK_IMAGE_BOOT_OFFSET"
@@ -90,7 +90,7 @@ if [ "$BR2_TARGET_ROOTFS_SQUASHFS" = "y" ]; then
rel=$(ver)
ln -sf rootfs.squashfs "$BINARIES_DIR/${NAME}${rel}.img"
if [ -n "$rel" ]; then
ln -sf "$BINARIES_DIR/${NAME}${rel}.img" "$BINARIES_DIR/${NAME}.img"
ln -sf "${NAME}${rel}.img" "$BINARIES_DIR/${NAME}.img"
fi
fi
+5 -5
View File
@@ -120,7 +120,7 @@ rootfs_args()
echo -n "-device sd-card,drive=mmc "
echo -n "-drive id=mmc,file=$CONFIG_QEMU_ROOTFS,if=none,format=raw "
elif [ "$CONFIG_QEMU_ROOTFS_VSCSI" = "y" ]; then
echo -n "-drive file=$CONFIG_QEMU_ROOTFS.qcow2,if=virtio,format=qcow2,bus=0,unit=0 "
echo -n "-drive file=qemu.qcow2,if=virtio,format=qcow2,bus=0,unit=0 "
fi
}
@@ -316,13 +316,13 @@ gdb_args()
run_qemu()
{
if [ "$CONFIG_QEMU_ROOTFS_VSCSI" = "y" ]; then
if ! qemu-img check "${CONFIG_QEMU_ROOTFS}.qcow2"; then
rm -f "${CONFIG_QEMU_ROOTFS}.qcow2"
if ! qemu-img check "qemu.qcow2"; then
rm -f "qemu.qcow2"
fi
if [ ! -f "${CONFIG_QEMU_ROOTFS}.qcow2" ]; then
if [ ! -f "qemu.qcow2" ]; then
echo "Creating qcow2 disk image for Qemu ..."
qemu-img create -f qcow2 -o backing_file="$CONFIG_QEMU_ROOTFS" \
-F raw "${CONFIG_QEMU_ROOTFS}.qcow2" > /dev/null
-F qcow2 "qemu.qcow2" > /dev/null
fi
fi
@@ -1 +1 @@
service [2345] <!> ttyd -i lo -p 8001 login -- Web terminal daemon (ttyd)
service [2345] <!> ttyd -i lo -W -p 8001 login -- Web terminal daemon (ttyd)
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
if [ $# -lt 2 ]; then
echo "usage: $0 <quirk-name> <ifname>"
exit 1
fi
quirk=$1
ifname=$2
if [ -f "/etc/product/interface-quirks.json" ]; then
echo "$(jq -r --arg iface "$ifname" --arg quirk "$quirk" '.[$iface][$quirk] // "false"' /etc/product/interface-quirks.json)"
else
echo "false"
fi
@@ -39,8 +39,10 @@ fi
# init scripts to prevent select services from starting.
initctl -nbq cond set led
note "Calling runparts $PRODUCT_INIT/S[0-9]+.* start"
/usr/libexec/finit/runparts -bsp "$PRODUCT_INIT"
if [ -d "$PRODUCT_INIT" ]; then
note "Calling runparts $PRODUCT_INIT/S[0-9]+.* start"
/usr/libexec/finit/runparts -bsp "$PRODUCT_INIT"
fi
# Product specific init done.
initctl -nbq cond set product
@@ -43,6 +43,7 @@ while [ "$1" ]; do
txqs="$2"
shift 2
[ $(/usr/libexec/infix/has-quirk "broken-mqprio" "$iface") = "true" ] && echo "Skipping $iface, does not support mqprio" && continue
[ $txqs -lt 2 ] && continue
[ $txqs -gt 8 ] && txqs=8
@@ -4,10 +4,14 @@
# the migrate tool inserts old version in name before .cfg extension.
CONFIG_FILE="/cfg/startup-config.cfg"
BACKUP_FILE="/cfg/backup/startup-config.cfg"
mkdir -p "$(dirname "$BACKUP_FILE")"
BACKUP_DIR="$(dirname "$BACKUP_FILE")"
mkdir -p "$BACKUP_DIR"
chown root:wheel "$BACKUP_DIR"
chmod 0770 "$BACKUP_DIR"
if [ ! -f "$CONFIG_FILE" ]; then
note "No $(basename "$CONFIG_FILE" .cfg) yet, likely factory reset."
logger -I $$ -k -p user.notice -t $(basename "$0") "No $(basename "$CONFIG_FILE" .cfg) yet, likely factory reset."
exit 0
elif migrate -cq "$CONFIG_FILE"; then
exit 0
+42 -4
View File
@@ -39,6 +39,11 @@ err()
[ "$rc" -eq 0 ] || exit "$rc"
}
pidfn()
{
echo "/run/containers/${1}.pid"
}
check()
{
file=$1
@@ -235,7 +240,7 @@ create()
args="$args --read-only --replace --quiet --cgroup-parent=containers $caps"
args="$args --restart=$restart --systemd=false --tz=local $privileged"
args="$args $vol $mount $hostname $entrypoint $env $port $logging"
pidfn=/run/container:${name}.pid
pidfile=/run/container:${name}.pid
[ -n "$quiet" ] || log "---------------------------------------"
[ -n "$quiet" ] || log "Got name: $name image: $image"
@@ -258,8 +263,8 @@ create()
fi
# shellcheck disable=SC2048
log "podman create --name $name --conmon-pidfile=$pidfn $args $image $*"
if podman create --name "$name" --conmon-pidfile="$pidfn" $args "$image" $*; then
log "podman create --name $name --conmon-pidfile=$pidfile $args $image $*"
if podman create --name "$name" --conmon-pidfile="$pidfile" $args "$image" $*; then
[ -n "$quiet" ] || log "Successfully created container $name from $image"
[ -n "$manual" ] || start "$name"
@@ -340,6 +345,24 @@ wrap()
{
name=$1
cmd=$2
pidfile=$(pidfn "$name")
# Containers have three phases: setup, running, and teardown.
# The setup phase may run forever in the background trying to fetch
# the image. It saves its PID in /run/containers/${name}.pid
if [ "$cmd" = "stop" ] && [ -f "$pidfile" ]; then
pid=$(cat "$pidfile")
# Check if setup is still running ...
if kill -0 "$pid" 2>/dev/null; then
kill "$pid"
wait "$pid" 2>/dev/null
fi
rm -f "$pidfile"
return 0
fi
# Skip "echo $name" from podman start in log
podman "$cmd" "$name" >/dev/null
@@ -375,7 +398,14 @@ netrestart()
cleanup()
{
pidfile=$(pidfn "$name")
log "Received signal, exiting."
if [ -n "$name" ] && [ -f "$pidfile" ]; then
log "$name: in setup phase, removing $pidfile ..."
rm -f "$pidfile"
fi
exit 1
}
@@ -574,7 +604,7 @@ if [ -n "$cmd" ]; then
shift
fi
trap cleanup INT TERM
trap cleanup INT HUP TERM
case $cmd in
# Does not work atm., cannot attach to TTY because
@@ -710,6 +740,12 @@ case $cmd in
[ -n "$name" ] || err 1 "setup: missing container name."
script=/run/containers/${name}.sh
[ -x "$script" ] || err 1 "setup: $script does not exist or is not executable."
# Save our PID in case we get stuck here and someone wants to
# stop us, e.g., due to reconfiguration or reboot.
pidfile=$(pidfn "${name}")
echo $$ > "$pidfile"
while ! "$script"; do
log "${name}: setup failed, waiting for network changes ..."
read -t 60 _ < <(ip monitor address route)
@@ -719,6 +755,8 @@ case $cmd in
log "${name}: retrying ..."
sleep 2
done
rm -f "$pidfile"
;;
shell)
if [ -z "$name" ]; then
+10 -6
View File
@@ -13,8 +13,8 @@ BR2_TARGET_GENERIC_ISSUE="Infix by KernelKit"
BR2_INIT_FINIT=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_ROOTFS_DEVICE_TABLE="system/device_table.txt ${BR2_EXTERNAL_INFIX_PATH}/board/common/xattrs"
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set
BR2_ROOTFS_MERGED_USR=y
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set
BR2_SYSTEM_BIN_SH_BASH=y
BR2_TARGET_GENERIC_GETTY_PORT="@console"
BR2_TARGET_GENERIC_GETTY_TERM="xterm"
@@ -27,13 +27,14 @@ BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build
BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.18"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.25"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/linux_defconfig"
BR2_LINUX_KERNEL_INSTALL_TARGET=y
BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL_INFIX_PATH}/board/common/busybox_defconfig"
BR2_PACKAGE_STRACE=y
BR2_PACKAGE_STRESS_NG=y
BR2_PACKAGE_SYSREPO_GROUP="sys-cli"
BR2_PACKAGE_JQ=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_DBUS_CXX=y
@@ -55,8 +56,8 @@ BR2_PACKAGE_PYTHON_GUNICORN=y
BR2_PACKAGE_LIBSSH_OPENSSL=y
BR2_PACKAGE_LIBSSH2=y
BR2_PACKAGE_LIBSSH2_OPENSSL=y
BR2_PACKAGE_LIBXCRYPT=y
BR2_PACKAGE_LIBOPENSSL_BIN=y
BR2_PACKAGE_LIBINPUT=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_NETOPEER2_CLI=y
BR2_PACKAGE_NSS_MDNS=y
@@ -119,6 +120,7 @@ BR2_PACKAGE_HOST_E2FSPROGS=y
BR2_PACKAGE_HOST_ENVIRONMENT_SETUP=y
BR2_PACKAGE_HOST_GENEXT2FS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_GO_BIN=y
BR2_PACKAGE_HOST_RAUC=y
BR2_PACKAGE_HOST_UBOOT_TOOLS=y
BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
@@ -138,6 +140,7 @@ BR2_PACKAGE_CURIOS_HTTPD=y
BR2_PACKAGE_CURIOS_NFTABLES=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_SHOW=y
BR2_PACKAGE_FACTORY=y
BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
@@ -161,11 +164,12 @@ BR2_PACKAGE_PODMAN_DRIVER_DEVICEMAPPER=y
BR2_PACKAGE_PODMAN_DRIVER_VFS=y
BR2_PACKAGE_TETRIS=y
BR2_PACKAGE_ROUSETTE=y
BR2_PACKAGE_LIBINPUT=y
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
BR2_PACKAGE_RAUC_INSTALLATION_STATUS=y
DISK_IMAGE_BOOT_BIN=y
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
BR2_PACKAGE_GETENT=y
TRUSTED_KEYS=y
TRUSTED_KEYS_DEVELOPMENT=y
DISK_IMAGE_BOOT_BIN=y
GNS3_APPLIANCE_RAM=512
GNS3_APPLIANCE_IFNUM=10
+5 -1
View File
@@ -27,13 +27,14 @@ BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build
BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.18"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.25"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/linux_defconfig"
BR2_LINUX_KERNEL_INSTALL_TARGET=y
BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL_INFIX_PATH}/board/common/busybox_defconfig"
BR2_PACKAGE_STRACE=y
BR2_PACKAGE_STRESS_NG=y
BR2_PACKAGE_SYSREPO_GROUP="sys-cli"
BR2_PACKAGE_JQ=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_DBUS_CXX=y
@@ -119,6 +120,7 @@ BR2_PACKAGE_CONFD=y
BR2_PACKAGE_CONFD_TEST_MODE=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_SHOW=y
BR2_PACKAGE_FACTORY=y
BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
@@ -137,6 +139,8 @@ BR2_PACKAGE_MDNS_ALIAS=y
BR2_PACKAGE_LIBINPUT=y
BR2_PACKAGE_ROUSETTE=y
BR2_PACKAGE_RAUC_INSTALLATION_STATUS=y
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
BR2_PACKAGE_GETENT=y
DISK_IMAGE_BOOT_BIN=y
TRUSTED_KEYS=y
TRUSTED_KEYS_DEVELOPMENT=y
+6 -4
View File
@@ -8,7 +8,6 @@ BR2_CCACHE=y
BR2_CCACHE_DIR="${BR2_EXTERNAL_INFIX_PATH}/.ccache"
BR2_ENABLE_DEBUG=y
BR2_GLOBAL_PATCH_DIR="${BR2_EXTERNAL_INFIX_PATH}/patches"
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
BR2_TARGET_GENERIC_HOSTNAME="infix"
BR2_TARGET_GENERIC_ISSUE="Infix by KernelKit"
BR2_INIT_FINIT=y
@@ -30,7 +29,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image
BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BR2_EXTERNAL_INFIX_PATH)/board/aarch64/r2s/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.10.3"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.25"
BR2_LINUX_KERNEL_PATCH="$(BR2_EXTERNAL_INFIX_PATH)/board/aarch64/r2s/rk3328-nanopi-r2s-dts.patch"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/r2s/linux_defconfig"
@@ -42,6 +41,7 @@ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_INFIX_PATH)/board/common/busybox_defconfig"
BR2_PACKAGE_STRACE=y
BR2_PACKAGE_STRESS_NG=y
BR2_PACKAGE_SYSREPO_GROUP="sys-cli"
BR2_PACKAGE_JQ=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_LINUX_FIRMWARE=y
@@ -74,7 +74,6 @@ BR2_PACKAGE_PYTHON_GUNICORN=y
BR2_PACKAGE_LIBSSH_OPENSSL=y
BR2_PACKAGE_LIBSSH2=y
BR2_PACKAGE_LIBSSH2_OPENSSL=y
BR2_PACKAGE_LIBXCRYPT=y
BR2_PACKAGE_LIBOPENSSL_BIN=y
BR2_PACKAGE_LIBINPUT=y
BR2_PACKAGE_LIBCURL_CURL=y
@@ -178,6 +177,7 @@ INFIX_SUPPORT="mailto:kernelkit@googlegroups.com"
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_SHOW=y
BR2_PACKAGE_FACTORY=y
BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
@@ -201,8 +201,10 @@ BR2_PACKAGE_PODMAN_DRIVER_DEVICEMAPPER=y
BR2_PACKAGE_PODMAN_DRIVER_VFS=y
BR2_PACKAGE_TETRIS=y
BR2_PACKAGE_ROUSETTE=y
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
BR2_PACKAGE_RAUC_INSTALLATION_STATUS=y
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
BR2_PACKAGE_GETENT=y
TRUSTED_KEYS=y
TRUSTED_KEYS_DEVELOPMENT=y
# GNS3_APPLIANCE is not set
+4
View File
@@ -39,6 +39,7 @@ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_INFIX_PATH)/board/common/busybox_defconfig"
BR2_PACKAGE_STRACE=y
BR2_PACKAGE_STRESS_NG=y
BR2_PACKAGE_SYSREPO_GROUP="sys-cli"
BR2_PACKAGE_JQ=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_LINUX_FIRMWARE=y
@@ -169,6 +170,7 @@ BR2_PACKAGE_CONFD=y
# BR2_PACKAGE_CONFD_TEST_MODE is not set
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_SHOW=y
BR2_PACKAGE_FACTORY=y
BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
@@ -194,6 +196,8 @@ BR2_PACKAGE_TETRIS=y
BR2_PACKAGE_ROUSETTE=y
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
BR2_PACKAGE_RAUC_INSTALLATION_STATUS=y
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
BR2_PACKAGE_GETENT=y
TRUSTED_KEYS=y
TRUSTED_KEYS_DEVELOPMENT=y
# GNS3_APPLIANCE is not set
+8 -5
View File
@@ -12,8 +12,8 @@ BR2_TARGET_GENERIC_ISSUE="Infix by KernelKit"
BR2_INIT_FINIT=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_ROOTFS_DEVICE_TABLE="system/device_table.txt ${BR2_EXTERNAL_INFIX_PATH}/board/common/xattrs"
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set
BR2_ROOTFS_MERGED_USR=y
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set
BR2_SYSTEM_BIN_SH_BASH=y
BR2_TARGET_GENERIC_GETTY_PORT="@console"
BR2_TARGET_GENERIC_GETTY_TERM="xterm"
@@ -26,7 +26,7 @@ BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_64/post-build.sh ${BR2_EXTERNAL_INF
BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.18"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.25"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/x86_64/linux_defconfig"
BR2_LINUX_KERNEL_INSTALL_TARGET=y
@@ -34,6 +34,7 @@ BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL_INFIX_PATH}/board/common/busybox_defconfig"
BR2_PACKAGE_STRACE=y
BR2_PACKAGE_STRESS_NG=y
BR2_PACKAGE_SYSREPO_GROUP="sys-cli"
BR2_PACKAGE_JQ=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_DBUS_CXX=y
@@ -54,10 +55,8 @@ BR2_PACKAGE_PYTHON_GUNICORN=y
BR2_PACKAGE_LIBSSH_OPENSSL=y
BR2_PACKAGE_LIBSSH2=y
BR2_PACKAGE_LIBSSH2_OPENSSL=y
BR2_PACKAGE_LIBXCRYPT=y
BR2_PACKAGE_LIBOPENSSL_BIN=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_LIBMNL=y
BR2_PACKAGE_NETOPEER2_CLI=y
BR2_PACKAGE_NSS_MDNS=y
BR2_PACKAGE_LINUX_PAM=y
@@ -126,6 +125,7 @@ BR2_PACKAGE_HOST_E2FSPROGS=y
BR2_PACKAGE_HOST_ENVIRONMENT_SETUP=y
BR2_PACKAGE_HOST_GENEXT2FS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_GO_BIN=y
BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_HOST_RAUC=y
BR2_PACKAGE_HOST_UBOOT_TOOLS=y
@@ -142,6 +142,7 @@ BR2_PACKAGE_CURIOS_HTTPD=y
BR2_PACKAGE_CURIOS_NFTABLES=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_SHOW=y
BR2_PACKAGE_FACTORY=y
BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
@@ -165,8 +166,10 @@ BR2_PACKAGE_PODMAN_DRIVER_DEVICEMAPPER=y
BR2_PACKAGE_PODMAN_DRIVER_VFS=y
BR2_PACKAGE_TETRIS=y
BR2_PACKAGE_ROUSETTE=y
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
BR2_PACKAGE_RAUC_INSTALLATION_STATUS=y
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
BR2_PACKAGE_GETENT=y
TRUSTED_KEYS=y
TRUSTED_KEYS_DEVELOPMENT=y
GNS3_APPLIANCE_RAM=512
+6 -5
View File
@@ -7,13 +7,14 @@ BR2_CCACHE=y
BR2_CCACHE_DIR="${BR2_EXTERNAL_INFIX_PATH}/.ccache"
BR2_ENABLE_DEBUG=y
BR2_GLOBAL_PATCH_DIR="${BR2_EXTERNAL_INFIX_PATH}/patches"
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
BR2_TARGET_GENERIC_HOSTNAME="ix"
BR2_TARGET_GENERIC_ISSUE="Infix by KernelKit"
BR2_INIT_FINIT=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_ROOTFS_DEVICE_TABLE="system/device_table.txt ${BR2_EXTERNAL_INFIX_PATH}/board/common/xattrs"
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set
BR2_ROOTFS_MERGED_USR=y
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set
BR2_SYSTEM_BIN_SH_BASH=y
BR2_TARGET_GENERIC_GETTY_PORT="@console"
BR2_TARGET_GENERIC_GETTY_TERM="xterm"
@@ -26,7 +27,7 @@ BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_64/post-build.sh ${BR2_EXTERNAL_INF
BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.18"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.25"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/x86_64/linux_defconfig"
BR2_LINUX_KERNEL_INSTALL_TARGET=y
@@ -34,6 +35,7 @@ BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL_INFIX_PATH}/board/common/busybox_defconfig"
BR2_PACKAGE_STRACE=y
BR2_PACKAGE_STRESS_NG=y
BR2_PACKAGE_SYSREPO_GROUP="sys-cli"
BR2_PACKAGE_JQ=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_DBUS_CXX=y
@@ -50,10 +52,7 @@ BR2_PACKAGE_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_CHECK_SIGN=y
BR2_PACKAGE_UBOOT_TOOLS_MKENVIMAGE=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_LIBSSH_OPENSSL=y
BR2_PACKAGE_LIBSSH2=y
BR2_PACKAGE_LIBSSH2_OPENSSL=y
BR2_PACKAGE_LIBXCRYPT=y
BR2_PACKAGE_LIBOPENSSL_BIN=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_LIBMNL=y
@@ -83,6 +82,7 @@ BR2_PACKAGE_TCPDUMP=y
BR2_PACKAGE_WHOIS=y
BR2_PACKAGE_BASH_COMPLETION=y
BR2_PACKAGE_SUDO=y
BR2_PACKAGE_GETENT=y
BR2_PACKAGE_KMOD_TOOLS=y
BR2_PACKAGE_PWGEN=y
BR2_PACKAGE_RAUC=y
@@ -138,6 +138,7 @@ BR2_PACKAGE_KLISH_PLUGIN_INFIX=y
BR2_PACKAGE_LOWDOWN=y
BR2_PACKAGE_MCD=y
BR2_PACKAGE_MDNS_ALIAS=y
BR2_PACKAGE_SHOW=y
BR2_PACKAGE_ROUSETTE=y
BR2_PACKAGE_RAUC_INSTALLATION_STATUS=y
TRUSTED_KEYS=y
+45 -1
View File
@@ -4,6 +4,48 @@ Change Log
All notable changes to the project are documented in this file.
[v25.04.0][] - 2025-04-30
-------------------------
### Changes
- Upgrade Linux kernel to 6.12.25 (LTS)
- Upgrade Buildroot to 2025.02.1 (LTS)
- Format for disk image (for QEMU) has changed to `qcow2`
### Fixes
- Fix #1002: Broken symlink in release package
- Fix #1006: NanoPi R2S corrupt startup, regression in Infix v25.02.0
- Bump R2S kernel, now same as tier one boards
- Fix #1015: Not possible to save custom SSH settings in startup-config
- Fix group owner and permissions of `/cfg/backup` directory
- Fix extraction of old version for `/cfg/backup/` files
- Fix configuration migration issues when upgrading
[v25.03.0][] - 2025-03-31
-------------------------
> [!IMPORTANT]
> This release is the first with the new Buildroot 2025.02 (LTS)
### Changes
- Upgrade Linux kernel to 6.12.21 (LTS)
- Upgrade Buildroot to 2025.02.0 (LTS)
### Fixes
- Fix #964: YANG schema warning in syslog: missing 'monitor' node for lag
- Fix #980: the system fails to reboot when a container is (stuck), for
whatever reason, in its 'setup' state
- Fix #990: web console, ttyd service, stopped working after upgrade to
Buildroot 2025.02, caused by new (missing) option `--writable`
- Fix TCAM memory corruption in `mvpp2` Ethernet controller
- Fix annoying (but harmless) usage message from the logger tool when
`startup-config` fails to load and the system reverts to failure mode
- Fix harmless log warning for product specific init when no product
specific init scripts are found
- Backport fixes for sysklogd, affecting hostname filtering and periods
in TAG names, pending official backport in Buildroot
[v25.02.0][] - 2025-03-04
-------------------------
@@ -1504,7 +1546,9 @@ Supported YANG models in addition to those used by sysrepo and netopeer:
- N/A
[buildroot]: https://buildroot.org/
[UNRELEASED]: https://github.com/kernelkit/infix/compare/v25.01.0...HEAD
[UNRELEASED]: https://github.com/kernelkit/infix/compare/v25.04.0...HEAD
[v25.04.0]: https://github.com/kernelkit/infix/compare/v25.03.0...v25.04.0
[v25.03.0]: https://github.com/kernelkit/infix/compare/v25.02.0...v25.03.0
[v25.02.0]: https://github.com/kernelkit/infix/compare/v25.01.0...v25.02.0
[v25.01.0]: https://github.com/kernelkit/infix/compare/v24.11.0...v25.01.0
[v24.11.1]: https://github.com/kernelkit/infix/compare/v24.11.0...v24.11.1
+10 -5
View File
@@ -131,6 +131,8 @@ This rebuilds (and installs) `foo` and `bar`, the `all` target calls
on Buildroot to finalize the target filesystem and generate the images.
The final `run` argument is explained below.
### `confd`
The Infix `src/confd/` is the engine of the system. Currently it is a
@@ -217,21 +219,24 @@ structure of an existing one. However, before making any changes, **always discu
them with the Infix core team**. This helps avoid issues later in development and
makes pull request reviews smoother.
Testing
-------
Manual testing can be done using Qemu by calling <kbd>make run</kbd>,
see also [Infix in Virtual Environments](virtual.md).
see also [Infix in Virtual Environments](virtual.md), or on a physical
device by upgrading to the latest build or "[netbooting](netboot.md)"
and running the image from RAM. The latter is how most board porting
work is done -- **much quicker** change-load-test cycles.
The Infix automated test suite is built around Qemu and [Qeneth][2], see:
* [Testing](testing.md)
* [Docker Image](../test/docker/README.md)
With any new feature added to Infix, it is essential to include a
relevant test case. See the
[Test Development](testing.md#test-development) section for guidance
on adding test cases.
With any new feature added to Infix, it is essential to include relevant
test case(s). See the [Test Development](testing.md#test-development)
section for guidance on adding test cases.
Reviewing
+130
View File
@@ -0,0 +1,130 @@
Netboot HowTo
=============
This document describes how to set up network booting U-Boot devices on
a LAN, e.g., when working with an evaluation board or other embedded
system. The most secure way to do this is with a local LAN between a PC
and the device.
Instead of setting up everything in U-Boot to download the Linux Image,
device tree, and initramfs, we will let U-Boot download a script with
instructions to run. When you have multiple systems (boards) this
quickly becomes a lot easier to manage.
> [!NOTE]
> Instructions in this HowTo assume a Debian based development system,
> e.g., Ubuntu or Linux Mint.
## Network Interface Setup
For two dedicated network interfaces, here `eth2` and `eth3` (ymmv), we
create an old-style interfaces config[^1] with the following content:
```
# /etc/network/interfaces.d/gimli
auto eth2
iface eth2 inet static
address 192.168.0.1
netmask 255.255.255.0
auto eth3
iface eth3 inet manual
```
> [!TIP]
> Use configuration file names in `.d/` directories that make sense and
> can easily be remembered. Here we use the hostname of the PC.
## DHCP/TFTP Server Setup
The examples given here use `dnsmasq`, which provides both DHCP and TFTP
server support. The same can be achieved with other implementations.
Similar to `interfaces.d`, dnsmasq has an `/etc/dnsmasq.d` directory so
we can use "snippets" instead of modifying `/etc/dnsmasq.conf` directly.
Add a file called `/etc/dnsmasq.d/gimli`.
Initial content:
```
# Remember IP address handed out to BOOTP clients
bootp-dynamic
# Disable check-if-ip-address-is-already-used
no-ping
# Enable TFTP server, use /srv/ftp, same as any FTP server, useful
# when using the same images for system upgrade as for netbooting.
enable-tftp
tftp-root=/srv/ftp
```
> [!CAUTION]
> First of all, make sure you DO NOT accidentally set up dnsmasq so that
> it starts acting as a DHCP server also on your office LAN! Follow the
> instructions below for more details.
If you have many interfaces used for lab equipment and only one office
LAN interface, then use something like this:
```
# Disable DHCP server on loopback and office LAN (eth0)
except-interface=lo
except-interface=eth0
```
To further lock this down, we only run the DHCP server on each of the
interfaces used for lab equipment, with a dedicated IP range as well:
```
# Currently I have an imx8mp-evk on eth2, so on my system I have a
# symlink bootfile-eth2 -> netboot.scr
interface=eth2
dhcp-range=192.168.0.100,192.168.0.199,1h
dhcp-boot=tag:eth2,bootfile-eth2
```
## Bootfile netboot.scr
The bootfile U-Boot retrieves from the TFTP server is a script that
looks like this, `netboot.sh`:
```sh
setenv ramdisk_addr_r 0x58000000
setenv fdt_addr_r 0x50400000
setenv autoboot off
tftp ${fdt_addr_r} imx8mp-evk/imx8mp-evk.dtb
tftp ${kernel_addr_r} imx8mp-evk/Image
tftp ${ramdisk_addr_r} imx8mp-evk/rootfs.squashfs
setenv bootargs console=ttymxc1,115200 root=/dev/ram0 brd.rd_size=500000 rauc.slot=net
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
```
U-Boot cannot read script files directly, so we need to wrap it with a
FIT format header, this is done by first converting it on the PC:
```
$ mkimage -T script -d netboot.sh netboot.scr
```
The output is `netboot.scr` which we symlink to above in the dnsmasq
setup step.
## U-Boot Commands
U-Boot is a maze of environment variables, some with values, some wrap
commands, and most are undocumented. We will use a prefix for our
variables to ensure we do not overwrite anything you may want to use
later.
```sh
==> setenv ixboot 'dhcp && source \${fileaddr}'
==> saveenv
```
[^1]: To prevent NetworkManager from automatically managing the interfaces.
+1
View File
@@ -34,6 +34,7 @@ source "$BR2_EXTERNAL_INFIX_PATH/package/python-libyang/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/python-statd/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/python-yangdoc/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/skeleton-init-finit/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/show/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/tetris/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/libyang-cpp/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/sysrepo-cpp/Config.in"
+1 -1
View File
@@ -17,7 +17,7 @@ run name:startup log:prio:user.notice norestart <pid/confd> env:/etc/default/con
-- Loading startup-config
# Run if loading startup-config fails for some reason
run name:failure log:prio:user.critical norestart env:/etc/default/confd \
run name:failure log:prio:user.crit norestart env:/etc/default/confd \
if:<run/startup/failure> \
[S] <pid/confd> /usr/libexec/confd/load -t $CONFD_TIMEOUT failure-config \
-- Loading failure-config
+24 -4
View File
@@ -35,13 +35,30 @@ define CONFD_INSTALL_EXTRA
cp $(CONFD_PKGDIR)/avahi.service $(TARGET_DIR)/etc/avahi/services/netconf.service
endef
NETOPEER2_SEARCHPATH=$(TARGET_DIR)/usr/share/yang/modules/netopeer2/
SYSREPO_SEARCHPATH=$(TARGET_DIR)/usr/share/yang/modules/sysrepo/
LIBNETCONF2_SEARCHPATH=$(TARGET_DIR)/usr/share/yang/modules/libnetconf2/
CONFD_SEARCHPATH=$(TARGET_DIR)/usr/share/yang/modules/confd/
TEST_MODE_SEARCHPATH=$(TARGET_DIR)/usr/share/yang/modules/test-mode/
ROUSETTE_SEARCHPATH=$(TARGET_DIR)/usr/share/yang/modules/rousette/
COMMON_SYSREPO_ENV = \
SYSREPO_SHM_PREFIX=$(CONFD_SYSREPO_SHM_PREFIX) \
SYSREPOCTL_EXECUTABLE="$(HOST_DIR)/bin/sysrepoctl" \
SYSREPOCFG_EXECUTABLE="$(HOST_DIR)/bin/sysrepocfg" \
SEARCH_PATH="$(TARGET_DIR)/usr/share/yang/modules/confd/"
SEARCH_PATH="$(NETOPEER2_SEARCHPATH) $(SYSREPO_SEARCHPATH) $(LIBNETCONF2_SEARCHPATH) $(TEST_MODE_SEARCHPATH) $(CONFD_SEARCHPATH) $(ROUSETTE_SEARCHPATH)"
define CONFD_INSTALL_YANG_MODULES
$(COMMON_SYSREPO_ENV) \
$(BR2_EXTERNAL_INFIX_PATH)/utils/srload $(@D)/yang/sysrepo.inc
$(COMMON_SYSREPO_ENV) \
$(BR2_EXTERNAL_INFIX_PATH)/utils/srload $(@D)/yang/libnetconf2.inc
$(COMMON_SYSREPO_ENV) \
$(BR2_EXTERNAL_INFIX_PATH)/utils/srload $(@D)/yang/netopeer2.inc
$(COMMON_SYSREPO_ENV) \
$(BR2_EXTERNAL_INFIX_PATH)/utils/srload $(@D)/yang/rousette.inc
$(COMMON_SYSREPO_ENV) \
$(BR2_EXTERNAL_INFIX_PATH)/utils/srload $(@D)/yang/test-mode.inc
$(COMMON_SYSREPO_ENV) \
$(BR2_EXTERNAL_INFIX_PATH)/utils/srload $(@D)/yang/confd.inc
endef
@@ -54,14 +71,17 @@ endef
endif
define CONFD_PERMISSIONS
/etc/sysrepo/data/ r 660 root wheel - - - - -
/etc/sysrepo/data d 770 root wheel - - - - -
/etc/sysrepo/data/ r 660 root sys-cli - - - - -
/etc/sysrepo/data d 770 root sys-cli - - - - -
endef
define CONFD_EMPTY_SYSREPO
rm -rf $(TARGET_DIR)/etc/sysrepo/data/
endef
define CONFD_CLEANUP
rm -f /dev/shm/$(CONFD_SYSREPO_SHM_PREFIX)*
endef
CONFD_PRE_INSTALL_TARGET_HOOKS += CONFD_EMPTY_SYSREPO
CONFD_PRE_INSTALL_TARGET_HOOKS += CONFD_CLEANUP
CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_EXTRA
CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_YANG_MODULES
+1 -1
View File
@@ -1,3 +1,3 @@
# Locally calculated
sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE
sha256 f8725f39b9d9d45c8ad6fd2cfc3c1c834a80c32b4217a3d07dd8ed7fe4b6e352 faux-df1d569287bc45d8fd880287c00e3874c5627c19-br1.tar.gz
sha256 b385d30b88cab31bf910436ceb1262947bf34a19ca85098c28510e639dc4b37d faux-df1d569287bc45d8fd880287c00e3874c5627c19-git4.tar.gz
+1 -1
View File
@@ -1,5 +1,5 @@
# From https://github.com/troglobit/finit/releases/
sha256 da14f5f05f595e15abc73bbacabfb55e8e1a4c40fc6ca6ab294be34ea437cc82 finit-4.10.tar.gz
sha256 b6a0a2f98c860cf9fe5dfe7e3601d922957ad7880ae29919176ab960b7b96e70 finit-4.12.tar.gz
# Locally calculated
sha256 2fd62c0fe6ea6d1861669f4c87bda83a0b5ceca64f4baa4d16dd078fbd218c14 LICENSE
+1 -1
View File
@@ -4,7 +4,7 @@
#
################################################################################
FINIT_VERSION = 4.10
FINIT_VERSION = 4.12
FINIT_SITE = https://github.com/troglobit/finit/releases/download/$(FINIT_VERSION)
FINIT_LICENSE = MIT
FINIT_LICENSE_FILES = LICENSE
@@ -1,3 +1,3 @@
# Locally calculated
sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE
sha256 b579d0028c8c88ddea27282f03c8c23fa9a758ad47918aeffb048456cf204375 klish-plugin-sysrepo-b693714a1ff5f8021651d7619556afb19945e5e6-br1.tar.gz
sha256 598089ad964594bbbaf2b7d7214d8761c828174eef53b7cfb1cd98517f407d01 klish-plugin-sysrepo-b693714a1ff5f8021651d7619556afb19945e5e6-git4.tar.gz
+1 -1
View File
@@ -1,3 +1,3 @@
# Locally calculated
sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE
sha256 0305355dd29dc276f7957d51e2406907e0c862dfd46f496c8a921df4f3d72a8d klish-019ebd2704e322b5d500f5687d526431e535eec8-br1.tar.gz
sha256 79c9b16b227320fea358114738933ea25be33f8f263d3eec1f83fb603c0c0b22 klish-019ebd2704e322b5d500f5687d526431e535eec8-git4.tar.gz
+1 -1
View File
@@ -1,4 +1,4 @@
# Locally calculated
sha256 6b94f3abc1aabd0c72a7c7d92a77f79dda7c8a0cb3df839a97890b4116a2de2a COPYING
sha256 6bd96a33f41f73d6ca524efa946b5e592227a5dd6dd21f193fadf4be3583552d nghttp2-asio-e877868abe06a83ed0a6ac6e245c07f6f20866b5-br1.tar.gz
sha256 d971c538a31eae5714d2434d90f86794f267615e85e8d2bb0c383e83c300e1ce nghttp2-asio-e877868abe06a83ed0a6ac6e245c07f6f20866b5-git4.tar.gz
+1 -1
View File
@@ -1,3 +1,3 @@
# Locally computed
sha256 830a633630bf6e61f2b8d4ca00efdd9a173ef25cdd49d4a4364c293e088561df podman-4.5.0.tar.gz
sha256 830a633630bf6e61f2b8d4ca00efdd9a173ef25cdd49d4a4364c293e088561df podman-4.5.0-go2.tar.gz
sha256 62fb8a3a9621dc2388174caaabe9c2317b694bb9a1d46c98bcf5655b68f51be3 LICENSE
+6
View File
@@ -0,0 +1,6 @@
config BR2_PACKAGE_SHOW
bool "show"
help
Tool to retrieve and present operational data from sysrepo.
https://github.com/kernelkit/infix
+19
View File
@@ -0,0 +1,19 @@
################################################################################
#
# show
#
################################################################################
SHOW_VERSION = 1.0
SHOW_LICENSE = MIT
SHOW_LICENSE_FILES = LICENSE
SHOW_SITE_METHOD = local
SHOW_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/show
SHOW_REDISTRIBUTE = NO
define SHOW_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
DESTDIR="$(TARGET_DIR)" install
endef
$(eval $(generic-package))
@@ -0,0 +1,97 @@
From 7e93dca4dab6bdbb39fd7f7c0f436839a1eb626e Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Wed, 5 Jul 2023 22:38:56 +0200
Subject: [PATCH 1/2] adduser: clarify adduser -D behavior and add -d for SSH
key login
Organization: Addiva Elektronik
Clarify that -D locks the account (!), then add -d to create an account
for which password login is disabled (*) but the user can log in with
SSH keys.
This also adjusts the long option --disabled-password, which was mapped
to -D, probably mistakenly. With this change BusyBox adduser behaves
the same as Debian's --disabled-login and --disabled-password.
Fixes #10981
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
loginutils/adduser.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index d3c795afa..cf6a0264a 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -62,7 +62,8 @@
//usage: "\n -s SHELL Login shell"
//usage: "\n -G GRP Group"
//usage: "\n -S Create a system user"
-//usage: "\n -D Don't assign a password"
+//usage: "\n -D Don't assign a password (locked account)"
+//usage: "\n -d Like -D but allow login using SSH keys"
//usage: "\n -H Don't create home directory"
//usage: "\n -u UID User id"
//usage: "\n -k SKEL Skeleton directory (/etc/skel)"
@@ -82,10 +83,11 @@
#define OPT_SHELL (1 << 2)
#define OPT_GID (1 << 3)
#define OPT_DONT_SET_PASS (1 << 4)
-#define OPT_SYSTEM_ACCOUNT (1 << 5)
-#define OPT_DONT_MAKE_HOME (1 << 6)
-#define OPT_UID (1 << 7)
-#define OPT_SKEL (1 << 8)
+#define OPT_DISABLED_PASS (1 << 5)
+#define OPT_SYSTEM_ACCOUNT (1 << 6)
+#define OPT_DONT_MAKE_HOME (1 << 7)
+#define OPT_UID (1 << 8)
+#define OPT_SKEL (1 << 9)
/* remix */
/* recoded such that the uid may be passed in *p */
@@ -168,7 +170,8 @@ static const char adduser_longopts[] ALIGN1 =
"gecos\0" Required_argument "g"
"shell\0" Required_argument "s"
"ingroup\0" Required_argument "G"
- "disabled-password\0" No_argument "D"
+ "disabled-password\0" No_argument "d"
+ "disabled-login\0" No_argument "D"
"empty-password\0" No_argument "D"
"system\0" No_argument "S"
"no-create-home\0" No_argument "H"
@@ -202,10 +205,10 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
pw.pw_dir = NULL;
opts = getopt32long(argv, "^"
- "h:g:s:G:DSHu:k:"
+ "h:g:s:G:DdSHu:k:"
/* at least one and at most two non-option args */
/* disable interactive passwd for system accounts */
- "\0" "-1:?2:SD",
+ "\0" "-1:?2:SDd",
adduser_longopts,
&pw.pw_dir, &pw.pw_gecos, &pw.pw_shell,
&usegroup, &uid, &skel
@@ -263,7 +266,8 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
* 8. unix date when login expires (i.e. when it may no longer be used)
*/
/* fields: 2 3 4 5 6 78 */
- p = xasprintf("!:%u:0:99999:7:::", (unsigned)(time(NULL)) / (24*60*60));
+ p = xasprintf("%c:%u:0:99999:7:::", (opts & OPT_DISABLED_PASS) ? '*' : '!',
+ (unsigned)(time(NULL)) / (24*60*60));
/* ignore errors: if file is missing we suppose admin doesn't want it */
update_passwd(bb_path_shadow_file, pw.pw_name, p, NULL);
if (ENABLE_FEATURE_CLEAN_UP)
@@ -305,7 +309,7 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
}
}
- if (!(opts & OPT_DONT_SET_PASS)) {
+ if (!(opts & (OPT_DONT_SET_PASS | OPT_DISABLED_PASS))) {
/* interactively set passwd */
passwd_wrapper(pw.pw_name);
}
--
2.34.1
@@ -0,0 +1,55 @@
From 2a1462d9f6a117cf1a5ae531d36143bd0a55d533 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Wed, 5 Jul 2023 23:48:14 +0200
Subject: [PATCH 2/2] login: add support for shadow passwords
Organization: Addiva Elektronik
login, on fallback from PAM, or when PAM support is not enabled, checks
pw->pw_passwd for locked ("!") or passwordless ("*") accounts. However,
on systems with shadow passwords the first character will always be "x".
This patch adds shadow password support from the passwd tool, letting
the user end up in "Login incorrect" rather than the "login: bad salt"
case, which could be used by an attacker to guess the state of accounts.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
loginutils/login.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/loginutils/login.c b/loginutils/login.c
index b02be2176..0e7f20844 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -345,6 +345,11 @@ int login_main(int argc UNUSED_PARAM, char **argv)
#endif
#if ENABLE_LOGIN_SESSION_AS_CHILD
pid_t child_pid;
+#endif
+#if ENABLE_FEATURE_SHADOWPASSWDS
+ /* Using _r function to avoid pulling in static buffers */
+ struct spwd spw, *result = NULL;
+ char buffer[256];
#endif
IF_FEATURE_UTMP(pid_t my_pid;)
@@ -493,6 +498,16 @@ int login_main(int argc UNUSED_PARAM, char **argv)
goto fake_it;
}
+#if ENABLE_FEATURE_SHADOWPASSWDS
+ if (getspnam_r(pw->pw_name, &spw, buffer, sizeof(buffer), &result)
+ || !result || strcmp(result->sp_namp, pw->pw_name)) {
+ strcpy(username, "UNKNOWN");
+ goto fake_it;
+ } else {
+ pw->pw_passwd = result->sp_pwdp;
+ }
+#endif
+
if (pw->pw_passwd[0] == '!' || pw->pw_passwd[0] == '*')
goto auth_failed;
--
2.34.1
@@ -1,190 +0,0 @@
commit 9ae2b2a466871d936ab79b15c95ba85cbc7d5cd6
Author: Stefan Schlosser <sgs@grmmbl.org>
Date: Fri Aug 23 10:52:17 2024 +0200
dnsmasq: add support for option 82
This patch adds support to insert Option 82 Relay Agent Information (see RFC3046)
into relayed DHCP requests.
When relay has been turned on with --dhcp-relay, the suboptions circuit-id and remote-id
can be configured using directives --dhcp-circuitid and --dhcp-remoteid with a maximum of
4 bytes denoted in hex format:
dhcp-circuitid=set:enterprise,00:11:22:33
dhcp-remoteid=set:enterprise,cc:dd:ee:ff
If circuit-id is not set, dnsmasq will use the interface index instead.
These options usually provide a way to map requests to --dhcp-host and --dhcp-range directives
but dhcp-proxy function uses them already for similar purposes.
The existing option space will be used (no re-negotiation). If it doesn't fit to a packet a warning
"Not enough space to add relay agent information"
will be dropped.
Signed-off-by: Stefan Schlosser <sgs@grmmbl.org>
diff --git dnsmasq-2.90/src/dhcp.c dnsmasq-2.90/src/dhcp.c
index b65facd..4c399eb 100644
--- dnsmasq-2.90/src/dhcp.c
+++ dnsmasq-2.90/src/dhcp.c
@@ -1117,7 +1117,10 @@ static int relay_upstream4(int iface_index, struct dhcp_packet *mess, size_t sz)
/* plug in our address */
mess->giaddr.s_addr = relay->local.addr4.s_addr;
}
-
+
+ /* add relay agent information */
+ add_relay_agent_info(relay, mess, sz);
+
to.sa.sa_family = AF_INET;
to.in.sin_addr = relay->server.addr4;
to.in.sin_port = htons(relay->port);
diff --git dnsmasq-2.90/src/dnsmasq.h dnsmasq-2.90/src/dnsmasq.h
index e455c3f..73cb94e 100644
--- dnsmasq-2.90/src/dnsmasq.h
+++ dnsmasq-2.90/src/dnsmasq.h
@@ -1902,3 +1902,6 @@ int add_update_server(int flags,
const char *interface,
const char *domain,
union all_addr *local_addr);
+
+
+int add_relay_agent_info(struct dhcp_relay *relay, struct dhcp_packet *mess, size_t sz);
diff --git dnsmasq-2.90/src/rfc2131.c dnsmasq-2.90/src/rfc2131.c
index 68834ea..05a4faa 100644
--- dnsmasq-2.90/src/rfc2131.c
+++ dnsmasq-2.90/src/rfc2131.c
@@ -2812,4 +2812,129 @@ static void apply_delay(u32 xid, time_t recvtime, struct dhcp_netid *netid)
}
}
+struct relay_info {
+ struct {
+ unsigned char *data;
+ int len;
+ } circuit;
+ struct {
+ unsigned char *data;
+ int len;
+ } remote;
+};
+
+static inline int subopt_add(unsigned char *ptr, size_t size,
+ int subopt, unsigned char *buf, int len)
+{
+ if ((len + 2) > size)
+ {
+ my_syslog(MS_DHCP | LOG_WARNING, "No space for relay sub option %d", subopt);
+ return 0;
+ }
+
+ *(ptr++) = subopt;
+ *(ptr++) = len;
+ memcpy(ptr, buf, len);
+
+ return (len + 2);
+}
+
+static int option_add(struct dhcp_packet *mess, size_t sz,
+ struct relay_info *info)
+{
+ unsigned char *start = &mess->options[0] + sizeof(u32);
+ unsigned char *end = (unsigned char *)mess + sz;
+ unsigned char *optend = NULL;
+ unsigned char opt[64], *sub, *p;
+ int size, len = 0;
+ int ret = -1;
+
+ sub = &opt[2];
+ size = sizeof(opt) - 2;
+
+ if (info->circuit.len > 0)
+ len += subopt_add(sub+len, size-len,
+ SUBOPT_CIRCUIT_ID,
+ info->circuit.data,
+ info->circuit.len);
+
+ if (info->remote.len > 0)
+ len += subopt_add(sub+len, size-len,
+ SUBOPT_REMOTE_ID,
+ info->remote.data,
+ info->remote.len);
+
+ if (len == 0)
+ return 0; /* Nothing to add */
+
+ opt[0] = OPTION_AGENT_ID;
+ opt[1] = len;
+ len += 2;
+
+ /* find option end */
+ optend = option_find1(start, end, OPTION_END, 1);
+ if (!optend)
+ return -1;
+
+ *optend = 0;
+
+ p = dhcp_skip_opts(start);
+ if ((p + len + 1) >= end)
+ {
+ my_syslog(MS_DHCP | LOG_WARNING, "Not enough space to add relay agent information");
+ goto out;
+ }
+
+ memcpy(p, opt, len);
+ optend = p + len;
+
+ ret = 0;
+out:
+ *optend = OPTION_END;
+ return ret;
+}
+
+int add_relay_agent_info(struct dhcp_relay *relay, struct dhcp_packet *mess, size_t sz)
+{
+ struct dhcp_vendor *vendor;
+ struct relay_info info;
+ int ifindex;
+
+ if (option_find(mess, sz, OPTION_AGENT_ID, 1))
+ return 0; /* don't alter any existing relay agent info */
+
+ /* lookup circuit-id and remote-id */
+ info.circuit.len = info.remote.len = 0;
+
+ for (vendor = daemon->dhcp_vendors; vendor; vendor = vendor->next)
+ {
+ if (vendor->match_type == MATCH_CIRCUIT)
+ {
+ if (info.circuit.len == 0)
+ {
+ info.circuit.data = vendor->data;
+ info.circuit.len = vendor->len;
+ }
+ }
+ else if (vendor->match_type == MATCH_REMOTE)
+ {
+ if (info.remote.len == 0)
+ {
+ info.remote.data = vendor->data;
+ info.remote.len = vendor->len;
+ }
+ }
+ }
+
+ /* use interface index as circuit-id if not specified */
+ if (info.circuit.len == 0)
+ {
+ ifindex = htonl(relay->iface_index);
+ info.circuit.data = &ifindex;
+ info.circuit.len = sizeof(ifindex);
+ }
+
+ return option_add(mess, sz, &info);
+}
+
#endif /* HAVE_DHCP */
@@ -1,29 +0,0 @@
From 9b2f6b94132d14b1d2d2a7d3b65bac4f3a056aac Mon Sep 17 00:00:00 2001
From: Mohan Prasad J <mohan.prasad@microchip.com>
Date: Mon, 4 Nov 2024 04:04:07 +0530
Subject: netlink: settings: Fix for wrong auto-negotiation state
Auto-negotiation state in json format showed the
opposite state due to wrong comparison.
Fix for returning the correct auto-neg state implemented.
Signed-off-by: Mohan Prasad J <mohan.prasad@microchip.com>
---
netlink/settings.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/netlink/settings.c b/netlink/settings.c
index dbfb520..b9b3ba9 100644
--- a/netlink/settings.c
+++ b/netlink/settings.c
@@ -546,7 +546,7 @@ int linkmodes_reply_cb(const struct nlmsghdr *nlhdr, void *data)
(autoneg == AUTONEG_DISABLE) ? "off" : "on");
else
print_bool(PRINT_JSON, "auto-negotiation", NULL,
- autoneg == AUTONEG_DISABLE);
+ autoneg != AUTONEG_DISABLE);
}
if (tb[ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG]) {
uint8_t val;
--
cgit 1.2.3-korg
@@ -1,22 +0,0 @@
diff --git a/lib/yang.c b/lib/yang.c
index ef1cf898a..c780b8e8c 100644
--- a/lib/yang.c
+++ b/lib/yang.c
@@ -647,7 +647,7 @@ struct yang_data *yang_data_list_find(const struct list *list,
}
/* Make libyang log its errors using FRR logging infrastructure. */
-static void ly_log_cb(LY_LOG_LEVEL level, const char *msg, const char *path)
+static void ly_log_cb(LY_LOG_LEVEL level, const char *msg, const char *path, uint64_t line)
{
int priority = LOG_ERR;
@@ -742,7 +742,7 @@ struct ly_ctx *yang_ctx_new_setup(bool embedded_modules, bool explicit_compile)
void yang_init(bool embedded_modules, bool defer_compile)
{
/* Initialize libyang global parameters that affect all containers. */
- ly_set_log_clb(ly_log_cb, 1);
+ ly_set_log_clb(ly_log_cb);
ly_log_options(LY_LOLOG | LY_LOSTORE);
/* Initialize libyang container for native models. */
@@ -0,0 +1,67 @@
diff -urN frr-9.1.3.orig/lib/yang.c frr-9.1.3/lib/yang.c
--- frr-9.1.3.orig/lib/yang.c 2024-12-27 22:06:42.000000000 +0100
+++ frr-9.1.3/lib/yang.c 2025-03-04 12:23:06.723640114 +0100
@@ -10,11 +10,23 @@
#include "lib_errors.h"
#include "yang.h"
#include "yang_translator.h"
+#include <libyang/version.h>
#include "northbound.h"
DEFINE_MTYPE_STATIC(LIB, YANG_MODULE, "YANG module");
DEFINE_MTYPE_STATIC(LIB, YANG_DATA, "YANG data structure");
+/* Safe to remove after libyang 2.2.8 */
+#if (LY_VERSION_MAJOR < 3)
+#define yang_lyd_find_xpath3(ctx_node, tree, xpath, format, prefix_data, vars, \
+ set) \
+ lyd_find_xpath3(ctx_node, tree, xpath, vars, set)
+#else
+#define yang_lyd_find_xpath3(ctx_node, tree, xpath, format, prefix_data, vars, \
+ set) \
+ lyd_find_xpath3(ctx_node, tree, xpath, LY_VALUE_JSON, NULL, vars, set)
+#endif
+
/* libyang container. */
struct ly_ctx *ly_native_ctx;
@@ -657,7 +669,12 @@
}
/* Make libyang log its errors using FRR logging infrastructure. */
-static void ly_log_cb(LY_LOG_LEVEL level, const char *msg, const char *path)
+static void ly_zlog_cb(LY_LOG_LEVEL level, const char *msg, const char *data_path
+#if !(LY_VERSION_MAJOR < 3)
+ ,
+ const char *schema_path, uint64_t line
+#endif
+)
{
int priority = LOG_ERR;
@@ -674,8 +691,14 @@
break;
}
- if (path)
- zlog(priority, "libyang: %s (%s)", msg, path);
+ if (data_path)
+ zlog(priority, "libyang: %s (%s)", msg, data_path);
+#if !(LY_VERSION_MAJOR < 3)
+ else if (schema_path)
+ zlog(priority, "libyang %s (%s)\n", msg, schema_path);
+ else if (line)
+ zlog(priority, "libyang %s (line %" PRIu64 ")\n", msg, line);
+#endif
else
zlog(priority, "libyang: %s", msg);
}
@@ -752,7 +775,7 @@
void yang_init(bool embedded_modules, bool defer_compile)
{
/* Initialize libyang global parameters that affect all containers. */
- ly_set_log_clb(ly_log_cb, 1);
+ ly_set_log_clb(ly_zlog_cb);
ly_log_options(LY_LOLOG | LY_LOSTORE);
/* Initialize libyang container for native models. */
@@ -0,0 +1,30 @@
From 5f37809521acda432d77aa4028b74c5713c2d988 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Wed, 20 Nov 2024 15:53:21 +0100
Subject: [PATCH 2/2] staticd: Re-enable split config support
Organization: Addiva Elektronik
Because we can.
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
staticd/static_main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/staticd/static_main.c b/staticd/static_main.c
index 165fb4d65..59e924c83 100644
--- a/staticd/static_main.c
+++ b/staticd/static_main.c
@@ -128,8 +128,7 @@ FRR_DAEMON_INFO(staticd, STATIC, .vty_port = STATIC_VTY_PORT,
.privs = &static_privs, .yang_modules = staticd_yang_modules,
.n_yang_modules = array_size(staticd_yang_modules),
-
- .flags = FRR_NO_SPLIT_CONFIG);
+ );
int main(int argc, char **argv, char **envp)
{
--
2.43.0
@@ -1,236 +0,0 @@
From c2251e09714b9715ee5ece18aa1096bc08cb8f6d Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Mon, 4 Mar 2024 16:47:28 +0100
Subject: [PATCH 1/5] net: bridge: avoid classifying unknown multicast as
mrouters_only
Organization: Addiva Elektronik
Unknown multicast, MAC/IPv4/IPv6, should always be flooded according to
the per-port mcast_flood setting, as well as to detected and configured
mcast_router ports.
This patch drops the mrouters_only classifier of unknown IP multicast
and moves the flow handling from br_multicast_flood() to br_flood().
This in turn means br_flood() must know about multicast router ports.
Because a multicast router should always receive both known and unknown
multicast.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
include/uapi/linux/if_bridge.h | 1 +
net/bridge/br.c | 5 +++++
net/bridge/br_device.c | 10 ++++++----
net/bridge/br_forward.c | 14 ++++++++++++--
net/bridge/br_input.c | 2 +-
net/bridge/br_multicast.c | 11 +++++++++--
net/bridge/br_private.h | 18 ++++++++++++++++--
7 files changed, 50 insertions(+), 11 deletions(-)
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index a5b743a2f775..3bffc39d7800 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -830,6 +830,7 @@ enum br_boolopt_id {
BR_BOOLOPT_NO_LL_LEARN,
BR_BOOLOPT_MCAST_VLAN_SNOOPING,
BR_BOOLOPT_MST_ENABLE,
+ BR_BOOLOPT_MCAST_FLOOD_ALWAYS,
BR_BOOLOPT_MAX
};
diff --git a/net/bridge/br.c b/net/bridge/br.c
index 2cab878e0a39..006fb2e5eafb 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -277,6 +277,9 @@ int br_boolopt_toggle(struct net_bridge *br, enum br_boolopt_id opt, bool on,
case BR_BOOLOPT_MST_ENABLE:
err = br_mst_set_enabled(br, on, extack);
break;
+ case BR_BOOLOPT_MCAST_FLOOD_ALWAYS:
+ br_opt_toggle(br, BROPT_MCAST_FLOOD_ALWAYS, on);
+ break;
default:
/* shouldn't be called with unsupported options */
WARN_ON(1);
@@ -295,6 +298,8 @@ int br_boolopt_get(const struct net_bridge *br, enum br_boolopt_id opt)
return br_opt_get(br, BROPT_MCAST_VLAN_SNOOPING_ENABLED);
case BR_BOOLOPT_MST_ENABLE:
return br_opt_get(br, BROPT_MST_ENABLED);
+ case BR_BOOLOPT_MCAST_FLOOD_ALWAYS:
+ return br_opt_get(br, BROPT_MCAST_FLOOD_ALWAYS);
default:
/* shouldn't be called with unsupported options */
WARN_ON(1);
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index fb1115857e49..6aac21d86d37 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -87,10 +87,10 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
dest = eth_hdr(skb)->h_dest;
if (is_broadcast_ether_addr(dest)) {
- br_flood(br, skb, BR_PKT_BROADCAST, false, true, vid);
+ br_flood(br, skb, NULL, BR_PKT_BROADCAST, false, true, vid);
} else if (is_multicast_ether_addr(dest)) {
if (unlikely(netpoll_tx_running(dev))) {
- br_flood(br, skb, BR_PKT_MULTICAST, false, true, vid);
+ br_flood(br, skb, brmctx, BR_PKT_MULTICAST, false, true, vid);
goto out;
}
if (br_multicast_rcv(&brmctx, &pmctx_null, vlan, skb, vid)) {
@@ -103,11 +103,11 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst))
br_multicast_flood(mdst, skb, brmctx, false, true);
else
- br_flood(br, skb, BR_PKT_MULTICAST, false, true, vid);
+ br_flood(br, skb, brmctx, BR_PKT_MULTICAST, false, true, vid);
} else if ((dst = br_fdb_find_rcu(br, dest, vid)) != NULL) {
br_forward(dst->dst, skb, false, true);
} else {
- br_flood(br, skb, BR_PKT_UNICAST, false, true, vid);
+ br_flood(br, skb, NULL, BR_PKT_UNICAST, false, true, vid);
}
out:
rcu_read_unlock();
@@ -524,6 +524,8 @@ void br_dev_setup(struct net_device *dev)
br->bridge_ageing_time = br->ageing_time = BR_DEFAULT_AGEING_TIME;
dev->max_mtu = ETH_MAX_MTU;
+ br_opt_toggle(br, BROPT_MCAST_FLOOD_ALWAYS, false);
+
br_netfilter_rtable_init(br);
br_stp_timer_init(br);
br_multicast_init(br);
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index e19b583ff2c6..1094364d96e0 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -198,14 +198,19 @@ static struct net_bridge_port *maybe_deliver(
/* called under rcu_read_lock */
void br_flood(struct net_bridge *br, struct sk_buff *skb,
- enum br_pkt_type pkt_type, bool local_rcv, bool local_orig,
- u16 vid)
+ struct net_bridge_mcast *brmctx, enum br_pkt_type pkt_type,
+ bool local_rcv, bool local_orig, u16 vid)
{
+ struct net_bridge_port *rport = NULL;
struct net_bridge_port *prev = NULL;
+ struct hlist_node *rp = NULL;
struct net_bridge_port *p;
br_tc_skb_miss_set(skb, pkt_type != BR_PKT_BROADCAST);
+ if (pkt_type == BR_PKT_MULTICAST)
+ rp = br_multicast_get_first_rport_node(brmctx, skb);
+
list_for_each_entry_rcu(p, &br->port_list, list) {
/* Do not flood unicast traffic to ports that turn it off, nor
* other traffic if flood off, except for traffic we originate
@@ -216,6 +221,11 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb,
continue;
break;
case BR_PKT_MULTICAST:
+ rport = br_multicast_rport_from_node_skb(rp, skb);
+ if (rport == p) {
+ rp = rcu_dereference(hlist_next_rcu(rp));
+ break;
+ }
if (!(p->flags & BR_MCAST_FLOOD) && skb->dev != br->dev)
continue;
break;
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index ceaa5a89b947..e54d648db7de 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -212,7 +212,7 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb
br_forward(dst->dst, skb, local_rcv, false);
} else {
if (!mcast_hit)
- br_flood(br, skb, pkt_type, local_rcv, false, vid);
+ br_flood(br, skb, brmctx, pkt_type, local_rcv, false, vid);
else
br_multicast_flood(mdst, skb, brmctx, local_rcv, false);
}
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 9a1cb5079a7a..dc49df4f92a8 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -3776,6 +3776,11 @@ static void br_multicast_err_count(const struct net_bridge *br,
u64_stats_update_end(&pstats->syncp);
}
+static bool br_flood_mrouters(const struct net_bridge *br)
+{
+ return br_opt_get(br, BROPT_MCAST_FLOOD_ALWAYS) ? false : true;
+}
+
static void br_multicast_pim(struct net_bridge_mcast *brmctx,
struct net_bridge_mcast_port *pmctx,
const struct sk_buff *skb)
@@ -3822,7 +3827,8 @@ static int br_multicast_ipv4_rcv(struct net_bridge_mcast *brmctx,
if (err == -ENOMSG) {
if (!ipv4_is_local_multicast(ip_hdr(skb)->daddr)) {
- BR_INPUT_SKB_CB(skb)->mrouters_only = 1;
+ BR_INPUT_SKB_CB(skb)->mrouters_only =
+ br_flood_mrouters(brmctx->br);
} else if (pim_ipv4_all_pim_routers(ip_hdr(skb)->daddr)) {
if (ip_hdr(skb)->protocol == IPPROTO_PIM)
br_multicast_pim(brmctx, pmctx, skb);
@@ -3891,7 +3897,8 @@ static int br_multicast_ipv6_rcv(struct net_bridge_mcast *brmctx,
if (err == -ENOMSG || err == -ENODATA) {
if (!ipv6_addr_is_ll_all_nodes(&ipv6_hdr(skb)->daddr))
- BR_INPUT_SKB_CB(skb)->mrouters_only = 1;
+ BR_INPUT_SKB_CB(skb)->mrouters_only =
+ br_flood_mrouters(brmctx->br);
if (err == -ENODATA &&
ipv6_addr_is_all_snoopers(&ipv6_hdr(skb)->daddr))
br_ip6_multicast_mrd_rcv(brmctx, pmctx, skb);
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index d4bedc87b1d8..dfd6e2cdd13e 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -483,6 +483,7 @@ enum net_bridge_opts {
BROPT_VLAN_BRIDGE_BINDING,
BROPT_MCAST_VLAN_SNOOPING_ENABLED,
BROPT_MST_ENABLED,
+ BROPT_MCAST_FLOOD_ALWAYS,
};
struct net_bridge {
@@ -886,8 +887,8 @@ void br_forward(const struct net_bridge_port *to, struct sk_buff *skb,
bool local_rcv, bool local_orig);
int br_forward_finish(struct net *net, struct sock *sk, struct sk_buff *skb);
void br_flood(struct net_bridge *br, struct sk_buff *skb,
- enum br_pkt_type pkt_type, bool local_rcv, bool local_orig,
- u16 vid);
+ struct net_bridge_mcast *brmctx, enum br_pkt_type pkt_type,
+ bool local_rcv, bool local_orig, u16 vid);
/* return true if both source port and dest port are isolated */
static inline bool br_skb_isolated(const struct net_bridge_port *to,
@@ -1408,6 +1409,19 @@ static inline void br_multicast_flood(struct net_bridge_mdb_entry *mdst,
{
}
+static inline struct hlist_node *
+br_multicast_get_first_rport_node(struct net_bridge_mcast *brmctx,
+ struct sk_buff *skb)
+{
+ return NULL;
+}
+
+static inline struct net_bridge_port *
+br_multicast_rport_from_node_skb(struct hlist_node *rp, struct sk_buff *skb)
+{
+ return NULL;
+}
+
static inline bool br_multicast_is_router(struct net_bridge_mcast *brmctx,
struct sk_buff *skb)
{
--
2.43.0
@@ -1,37 +0,0 @@
From 75edfa9b690b65423aa3e63ed5870d565950d9bb Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Tue, 5 Mar 2024 06:44:41 +0100
Subject: [PATCH 2/5] net: bridge: Ignore router ports when forwarding L2
multicast
Organization: Addiva Elektronik
Multicast router ports are either statically configured or learned from
control protocol traffic (IGMP/MLD/PIM). These protocols regulate IP
multicast -- MAC multicast should always be forwarded through flooding
of unknown multicast or using permanent MDB entries.
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
net/bridge/br_private.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index dfd6e2cdd13e..7aabf8bd7da2 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -1086,7 +1086,10 @@ br_multicast_get_first_rport_node(struct net_bridge_mcast *brmctx,
if (skb->protocol == htons(ETH_P_IPV6))
return rcu_dereference(hlist_first_rcu(&brmctx->ip6_mc_router_list));
#endif
- return rcu_dereference(hlist_first_rcu(&brmctx->ip4_mc_router_list));
+ if (skb->protocol == htons(ETH_P_IP))
+ return rcu_dereference(hlist_first_rcu(&brmctx->ip4_mc_router_list));
+
+ return NULL;
}
static inline struct net_bridge_port *
--
2.43.0
@@ -1,190 +0,0 @@
From 2d2ac57a7d9354c2c1fa796659e33496fc8e918d Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Thu, 4 Apr 2024 16:36:30 +0200
Subject: [PATCH 3/5] net: bridge: drop delay for applying strict multicast
filtering
Organization: Addiva Elektronik
This *local* patch drops the initial delay before applying strict multicast
filtering, introduced in [1] and recently updated in [2].
The main reason for this patch is RFC conformance and customer expectations.
At power on we assume the querier role by default and are expected to stop
unknown flooding as soon as we have a membership report in place, not after
10 seconds.
A proper fix for upstreaming could be to add a knob to disable the delay.
[1]: https://lore.kernel.org/netdev/1375311980-25575-1-git-send-email-linus.luessing@web.de/
[2]: https://lore.kernel.org/netdev/20240127175033.9640-1-linus.luessing@c0d3.blue/
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
net/bridge/br_multicast.c | 42 +++++++--------------------------------
net/bridge/br_private.h | 4 +---
2 files changed, 8 insertions(+), 38 deletions(-)
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index dc49df4f92a8..47c0625c5553 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -1762,10 +1762,6 @@ static void br_ip6_multicast_querier_expired(struct timer_list *t)
}
#endif
-static void br_multicast_query_delay_expired(struct timer_list *t)
-{
-}
-
static void br_multicast_select_own_querier(struct net_bridge_mcast *brmctx,
struct br_ip *ip,
struct sk_buff *skb)
@@ -3198,12 +3194,8 @@ int br_multicast_dump_querier_state(struct sk_buff *skb,
static void
br_multicast_update_query_timer(struct net_bridge_mcast *brmctx,
- struct bridge_mcast_other_query *query,
- unsigned long max_delay)
+ struct bridge_mcast_other_query *query)
{
- if (!timer_pending(&query->timer))
- mod_timer(&query->delay_timer, jiffies + max_delay);
-
mod_timer(&query->timer, jiffies + brmctx->multicast_querier_interval);
}
@@ -3394,13 +3386,12 @@ static void
br_ip4_multicast_query_received(struct net_bridge_mcast *brmctx,
struct net_bridge_mcast_port *pmctx,
struct bridge_mcast_other_query *query,
- struct br_ip *saddr,
- unsigned long max_delay)
+ struct br_ip *saddr)
{
if (!br_multicast_select_querier(brmctx, pmctx, saddr))
return;
- br_multicast_update_query_timer(brmctx, query, max_delay);
+ br_multicast_update_query_timer(brmctx, query);
br_ip4_multicast_mark_router(brmctx, pmctx);
}
@@ -3409,13 +3400,12 @@ static void
br_ip6_multicast_query_received(struct net_bridge_mcast *brmctx,
struct net_bridge_mcast_port *pmctx,
struct bridge_mcast_other_query *query,
- struct br_ip *saddr,
- unsigned long max_delay)
+ struct br_ip *saddr)
{
if (!br_multicast_select_querier(brmctx, pmctx, saddr))
return;
- br_multicast_update_query_timer(brmctx, query, max_delay);
+ br_multicast_update_query_timer(brmctx, query);
br_ip6_multicast_mark_router(brmctx, pmctx);
}
#endif
@@ -3469,7 +3459,7 @@ static void br_ip4_multicast_query(struct net_bridge_mcast *brmctx,
br_ip4_multicast_query_received(brmctx, pmctx,
&brmctx->ip4_other_query,
- &saddr, max_delay);
+ &saddr);
goto out;
}
@@ -3557,7 +3547,7 @@ static int br_ip6_multicast_query(struct net_bridge_mcast *brmctx,
br_ip6_multicast_query_received(brmctx, pmctx,
&brmctx->ip6_other_query,
- &saddr, max_delay);
+ &saddr);
goto out;
} else if (!group) {
goto out;
@@ -4065,8 +4055,6 @@ void br_multicast_ctx_init(struct net_bridge *br,
br_ip4_multicast_local_router_expired, 0);
timer_setup(&brmctx->ip4_other_query.timer,
br_ip4_multicast_querier_expired, 0);
- timer_setup(&brmctx->ip4_other_query.delay_timer,
- br_multicast_query_delay_expired, 0);
timer_setup(&brmctx->ip4_own_query.timer,
br_ip4_multicast_query_expired, 0);
#if IS_ENABLED(CONFIG_IPV6)
@@ -4074,8 +4062,6 @@ void br_multicast_ctx_init(struct net_bridge *br,
br_ip6_multicast_local_router_expired, 0);
timer_setup(&brmctx->ip6_other_query.timer,
br_ip6_multicast_querier_expired, 0);
- timer_setup(&brmctx->ip6_other_query.delay_timer,
- br_multicast_query_delay_expired, 0);
timer_setup(&brmctx->ip6_own_query.timer,
br_ip6_multicast_query_expired, 0);
#endif
@@ -4210,12 +4196,10 @@ static void __br_multicast_stop(struct net_bridge_mcast *brmctx)
{
del_timer_sync(&brmctx->ip4_mc_router_timer);
del_timer_sync(&brmctx->ip4_other_query.timer);
- del_timer_sync(&brmctx->ip4_other_query.delay_timer);
del_timer_sync(&brmctx->ip4_own_query.timer);
#if IS_ENABLED(CONFIG_IPV6)
del_timer_sync(&brmctx->ip6_mc_router_timer);
del_timer_sync(&brmctx->ip6_other_query.timer);
- del_timer_sync(&brmctx->ip6_other_query.delay_timer);
del_timer_sync(&brmctx->ip6_own_query.timer);
#endif
}
@@ -4643,8 +4627,6 @@ EXPORT_SYMBOL_GPL(br_multicast_router);
int br_multicast_set_querier(struct net_bridge_mcast *brmctx, unsigned long val)
{
- unsigned long max_delay;
-
val = !!val;
spin_lock_bh(&brmctx->br->multicast_lock);
@@ -4655,19 +4637,9 @@ int br_multicast_set_querier(struct net_bridge_mcast *brmctx, unsigned long val)
if (!val)
goto unlock;
- max_delay = brmctx->multicast_query_response_interval;
-
- if (!timer_pending(&brmctx->ip4_other_query.timer))
- mod_timer(&brmctx->ip4_other_query.delay_timer,
- jiffies + max_delay);
-
br_multicast_start_querier(brmctx, &brmctx->ip4_own_query);
#if IS_ENABLED(CONFIG_IPV6)
- if (!timer_pending(&brmctx->ip6_other_query.timer))
- mod_timer(&brmctx->ip6_other_query.delay_timer,
- jiffies + max_delay);
-
br_multicast_start_querier(brmctx, &brmctx->ip6_own_query);
#endif
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 7aabf8bd7da2..43fff09dfb71 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -78,7 +78,6 @@ struct bridge_mcast_own_query {
/* other querier */
struct bridge_mcast_other_query {
struct timer_list timer;
- struct timer_list delay_timer;
};
/* selected querier */
@@ -1164,8 +1163,7 @@ __br_multicast_querier_exists(struct net_bridge_mcast *brmctx,
own_querier_enabled = false;
}
- return !timer_pending(&querier->delay_timer) &&
- (own_querier_enabled || timer_pending(&querier->timer));
+ return own_querier_enabled || timer_pending(&querier->timer);
}
static inline bool br_multicast_querier_exists(struct net_bridge_mcast *brmctx,
--
2.43.0
@@ -1,49 +0,0 @@
From c7818c4273ef1705d6e153f5e4eda683d68f59be Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Mon, 29 Apr 2024 15:14:51 +0200
Subject: [PATCH 4/5] usb: core: adjust log level for unauthorized devices
Organization: Addiva Elektronik
The fact that a USB device currently is not authorized is not an error,
so let's adjust the log level so these messages slip below radar for the
commonly used 'quiet' log level.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
drivers/usb/core/driver.c | 4 ++--
drivers/usb/core/generic.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index e02ba15f6e34..3fe4d15cd6db 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -335,10 +335,10 @@ static int usb_probe_interface(struct device *dev)
return error;
if (udev->authorized == 0) {
- dev_err(&intf->dev, "Device is not authorized for usage\n");
+ dev_warn(&intf->dev, "Device is not authorized for usage\n");
return error;
} else if (intf->authorized == 0) {
- dev_err(&intf->dev, "Interface %d is not authorized for usage\n",
+ dev_warn(&intf->dev, "Interface %d is not authorized for usage\n",
intf->altsetting->desc.bInterfaceNumber);
return error;
}
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
index b134bff5c3fe..60575a01a810 100644
--- a/drivers/usb/core/generic.c
+++ b/drivers/usb/core/generic.c
@@ -247,7 +247,7 @@ int usb_generic_driver_probe(struct usb_device *udev)
* with the driver core and lets interface drivers bind to them.
*/
if (udev->authorized == 0)
- dev_err(&udev->dev, "Device is not authorized for usage\n");
+ dev_warn(&udev->dev, "Device is not authorized for usage\n");
else {
c = usb_choose_configuration(udev);
if (c >= 0) {
--
2.43.0
@@ -1,24 +1,19 @@
From 38625958e097c63ec25fddfbbf606c4b157cd058 Mon Sep 17 00:00:00 2001
From 74f8ab9d77486305e12a075ad94d87f404429f66 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 12 Mar 2024 10:27:24 +0100
Subject: [PATCH 01/26] [FIX] net: dsa: mv88e6xxx: Fix timeout on waiting for
Subject: [PATCH 01/35] [FIX] net: dsa: mv88e6xxx: Fix timeout on waiting for
PPU on 6393X
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
In a multi-chip setup, delays of up to 750ms are observed before the
device (6393X) signals completion of PPU initialization (Global 1,
register 0, bit 15). Therefore, increase the timeout threshold to 1s.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 284270a4ade1..1f0b0c07ed9d 100644
index df1df6015412..54c99357540d 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -86,7 +86,7 @@ int mv88e6xxx_write(struct mv88e6xxx_chip *chip, int addr, int reg, u16 val)
@@ -30,6 +25,3 @@ index 284270a4ade1..1f0b0c07ed9d 100644
u16 data;
int err;
int i;
--
2.43.0
@@ -1,11 +1,8 @@
From b41039e6b8db5a484950aa8e839d13029c7f0424 Mon Sep 17 00:00:00 2001
From bf88305dd98a52f698c6f866b76645a48728d628 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Wed, 27 Mar 2024 15:52:43 +0100
Subject: [PATCH 02/26] net: dsa: mv88e6xxx: Improve indirect register access
Subject: [PATCH 02/35] net: dsa: mv88e6xxx: Improve indirect register access
perf on 6393
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
When operating in multi-chip mode, the 6393 family maps a subset of
@@ -16,8 +13,6 @@ previous families).
Therefore, add a new set of SMI operations which remaps accesses to
such registers to the corresponding directly addressable register. All
other accesses use the regular indirect interface.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 7 +++
drivers/net/dsa/mv88e6xxx/global1.h | 3 ++
@@ -27,10 +22,10 @@ Signed-off-by: Mattias Walström <lazzer@gmail.com>
5 files changed, 119 insertions(+)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 1f0b0c07ed9d..f9d892d036be 100644
index 54c99357540d..f6611496dc0f 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -6472,6 +6472,13 @@ static int mv88e6xxx_detect(struct mv88e6xxx_chip *chip)
@@ -6532,6 +6532,13 @@ static int mv88e6xxx_detect(struct mv88e6xxx_chip *chip)
/* Update the compatible info with the probed one */
chip->info = info;
@@ -214,6 +209,3 @@ index c6c71d5757f5..788cf68b7b33 100644
int mv88e6xxx_smi_init(struct mv88e6xxx_chip *chip,
struct mii_bus *bus, int sw_addr);
--
2.43.0
@@ -1,11 +1,8 @@
From 31d3700b09b634676ab88f0f3469538903b12ace Mon Sep 17 00:00:00 2001
From be5cc28a5bac1bc968a2d6b9892cc64d41aad9ac Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Mon, 22 Apr 2024 23:18:01 +0200
Subject: [PATCH 03/26] net: dsa: mv88e6xxx: Honor ports being managed via
Subject: [PATCH 03/35] net: dsa: mv88e6xxx: Honor ports being managed via
in-band-status
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
Keep all link parameters in their unforced states when the port is
@@ -16,14 +13,12 @@ USXGMII autoneg)
This state is the default set up by mv88e6xxx_port_setup_mac(), so all
we have to do is to make the phylink MAC callbacks no-ops in cases
when in-band-status is being used.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index f9d892d036be..98bd635b0ba9 100644
index f6611496dc0f..216fbcfcd476 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -964,6 +964,9 @@ static void mv88e6xxx_mac_link_down(struct phylink_config *config,
@@ -46,6 +41,3 @@ index f9d892d036be..98bd635b0ba9 100644
ops = chip->info->ops;
mv88e6xxx_reg_lock(chip);
--
2.43.0
@@ -1,11 +1,8 @@
From d048a31995fa82ccde7dc12df27b8162ae31762c Mon Sep 17 00:00:00 2001
From 0e7940b52ab43e1e97d523d8900927f2b82a54fe Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Wed, 24 Apr 2024 22:41:04 +0200
Subject: [PATCH 04/26] net: dsa: mv88e6xxx: Limit rsvd2cpu policy to user
Subject: [PATCH 04/35] net: dsa: mv88e6xxx: Limit rsvd2cpu policy to user
ports on 6393X
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
For packets with a DA in the IEEE reserved L2 group range, originating
@@ -32,8 +29,6 @@ Before this change, due to rsvd2cpu being enabled on the CPU port, the
switch would try to trap it back to the CPU. Given that the CPU is
trusted, instead assume that it indeed meant for the packet to be
forwarded like any other.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/port.c | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
@@ -101,6 +96,3 @@ index 04053fdc6489..f25fb3214acb 100644
if (err)
return err;
--
2.43.0
@@ -1,16 +1,11 @@
From a255c151a82221cccc896d6be5817c037cc563bb Mon Sep 17 00:00:00 2001
From 6a7421879866a712d127e6588744019668b4d1bc Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 16 Nov 2023 19:44:32 +0100
Subject: [PATCH 05/26] net: dsa: mv88e6xxx: Add LED infrastructure
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [PATCH 05/35] net: dsa: mv88e6xxx: Add LED infrastructure
Organization: Wires
Parse DT for LEDs and register them for devices that support it,
though no actual implementations exist yet.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/Makefile | 1 +
drivers/net/dsa/mv88e6xxx/chip.c | 5 +-
@@ -34,7 +29,7 @@ index a9a9651187db..6720d9303914 100644
mv88e6xxx-objs += pcs-6352.o
mv88e6xxx-objs += pcs-639x.o
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 98bd635b0ba9..97cebc490fac 100644
index 216fbcfcd476..8d386766d1ec 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -37,6 +37,7 @@
@@ -45,7 +40,7 @@ index 98bd635b0ba9..97cebc490fac 100644
#include "phy.h"
#include "port.h"
#include "ptp.h"
@@ -4115,7 +4116,9 @@ static int mv88e6xxx_port_setup(struct dsa_switch *ds, int port)
@@ -4171,7 +4172,9 @@ static int mv88e6xxx_port_setup(struct dsa_switch *ds, int port)
return err;
}
@@ -314,6 +309,3 @@ index 000000000000..8afa2a0c0527
+int mv88e6xxx_port_setup_leds(struct dsa_switch *ds, int port);
+
+#endif /* _MV88E6XXX_LEDS_H */
--
2.43.0
@@ -1,18 +1,13 @@
From 2d2c9fdd45ab42b725b4a063b4444661b30bc59c Mon Sep 17 00:00:00 2001
From 2190bebac9c7205a4a513eabed45dc9cb3dee2bd Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 16 Nov 2023 21:59:35 +0100
Subject: [PATCH 06/26] net: dsa: mv88e6xxx: Add LED support for 6393X
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [PATCH 06/35] net: dsa: mv88e6xxx: Add LED support for 6393X
Organization: Wires
Trigger support:
- "none"
- "timer"
- "netdev"
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 1 +
drivers/net/dsa/mv88e6xxx/leds.c | 229 +++++++++++++++++++++++++++++++
@@ -22,10 +17,10 @@ Signed-off-by: Mattias Walström <lazzer@gmail.com>
5 files changed, 272 insertions(+)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 97cebc490fac..e8edf3970940 100644
index 8d386766d1ec..3cc41fea6d41 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -5627,6 +5627,7 @@ static const struct mv88e6xxx_ops mv88e6393x_ops = {
@@ -5685,6 +5685,7 @@ static const struct mv88e6xxx_ops mv88e6393x_ops = {
.gpio_ops = &mv88e6352_gpio_ops,
.avb_ops = &mv88e6390_avb_ops,
.ptp_ops = &mv88e6352_ptp_ops,
@@ -362,6 +357,3 @@ index ddadeb9bfdae..7157864dc20f 100644
int mv88e6393x_set_egress_port(struct mv88e6xxx_chip *chip,
enum mv88e6xxx_egress_direction direction,
int port);
--
2.43.0
@@ -1,11 +1,8 @@
From 91465d6568ea89cdf9e0092c1ff35a757aef5116 Mon Sep 17 00:00:00 2001
From c587f8b5fa584efc53e09f110bfbd9e09f0deff5 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 28 May 2024 10:38:42 +0200
Subject: [PATCH 07/26] net: dsa: tag_dsa: Use tag priority as initial
Subject: [PATCH 07/35] net: dsa: tag_dsa: Use tag priority as initial
skb->priority
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
Use the 3-bit priority field from the DSA tag as the initial packet
@@ -22,8 +19,6 @@ Ideally we could then map this priority to an internal one, like we
can do with an "ingress-qos-map" on VLAN interfaces. Until that is
implemented, support the setup that is likely to be the most common; a
1:1 mapping from FPri to skb->priority.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
net/dsa/tag_dsa.c | 7 +++++++
1 file changed, 7 insertions(+)
@@ -46,6 +41,3 @@ index 2a2c4fb61a65..a00ae6bf2971 100644
return skb;
}
--
2.43.0
@@ -1,11 +1,8 @@
From fb892bdcfd4b7784a0506058b3e56c6055b4e4e8 Mon Sep 17 00:00:00 2001
From a0797da07ca347ed3a8092124fef77963a52cdcb Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 16 Jan 2024 16:00:55 +0100
Subject: [PATCH 08/26] net: dsa: Support MDB memberships whose L2 addresses
Subject: [PATCH 08/35] net: dsa: Support MDB memberships whose L2 addresses
overlap
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
Multiple IP multicast groups (32 for v4, 2^80 for v6) map to the same
@@ -32,8 +29,6 @@ as long as the count is positive. Fortunately, all the infrastructure
needed to do this is already in place, since it is also needed on CPU
and DSA ports. Thus, "implement" this by simply removing the guards
which previously skipped reference countung on user ports.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
net/dsa/switch.c | 16 ----------------
1 file changed, 16 deletions(-)
@@ -72,6 +67,3 @@ index 3d2feeea897b..628e8a884dde 100644
mutex_lock(&dp->addr_lists_lock);
a = dsa_mac_addr_find(&dp->mdbs, mdb->addr, mdb->vid, db);
--
2.43.0
@@ -1,13 +1,9 @@
From a569ea3aa01cea0eef5181f1a4d5f06260c3ca6a Mon Sep 17 00:00:00 2001
From e548e14cc271efa568a39afcb8f71bd5a48cf446 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 21 Mar 2024 19:12:15 +0100
Subject: [PATCH 09/26] net: dsa: Support EtherType based priority overrides
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [PATCH 09/35] net: dsa: Support EtherType based priority overrides
Organization: Wires
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
include/net/dsa.h | 4 ++++
net/dsa/user.c | 56 +++++++++++++++++++++++++++++++++++++++++++++--
@@ -116,6 +112,3 @@ index 64f660d2334b..e13fb22e2c2b 100644
}
break;
case IEEE_8021QAZ_APP_SEL_DSCP:
--
2.43.0
@@ -1,14 +1,10 @@
From 8e61cdafeabd25b88e591d7f9593fbc65453328a Mon Sep 17 00:00:00 2001
From 63e47b33b09221310e2f6f33478a1b07c4706f00 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Fri, 22 Mar 2024 16:15:43 +0100
Subject: [PATCH 10/26] net: dsa: mv88e6xxx: Support EtherType based priority
Subject: [PATCH 10/35] net: dsa: mv88e6xxx: Support EtherType based priority
overrides
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 64 +++++++++++++++++++++++++++++
drivers/net/dsa/mv88e6xxx/chip.h | 21 ++++++++++
@@ -19,7 +15,7 @@ Signed-off-by: Mattias Walström <lazzer@gmail.com>
6 files changed, 207 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index e8edf3970940..3151df2a27c7 100644
index 3cc41fea6d41..182d3a0e75c8 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1715,6 +1715,11 @@ static int mv88e6xxx_rmu_setup(struct mv88e6xxx_chip *chip)
@@ -34,7 +30,7 @@ index e8edf3970940..3151df2a27c7 100644
if (chip->info->ops->pot_clear)
return chip->info->ops->pot_clear(chip);
@@ -3386,6 +3391,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
@@ -3427,6 +3432,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
chip->ports[port].chip = chip;
chip->ports[port].port = port;
@@ -42,7 +38,7 @@ index e8edf3970940..3151df2a27c7 100644
err = mv88e6xxx_port_setup_mac(chip, port, LINK_UNFORCED,
SPEED_UNFORCED, DUPLEX_UNFORCED,
@@ -6532,6 +6538,7 @@ static struct mv88e6xxx_chip *mv88e6xxx_alloc_chip(struct device *dev)
@@ -6592,6 +6598,7 @@ static struct mv88e6xxx_chip *mv88e6xxx_alloc_chip(struct device *dev)
chip->dev = dev;
mutex_init(&chip->reg_lock);
@@ -50,7 +46,7 @@ index e8edf3970940..3151df2a27c7 100644
INIT_LIST_HEAD(&chip->mdios);
idr_init(&chip->policies);
INIT_LIST_HEAD(&chip->msts);
@@ -7064,6 +7071,61 @@ static int mv88e6xxx_crosschip_lag_leave(struct dsa_switch *ds, int sw_index,
@@ -7131,6 +7138,61 @@ static int mv88e6xxx_crosschip_lag_leave(struct dsa_switch *ds, int sw_index,
return err_sync ? : err_pvt;
}
@@ -112,7 +108,7 @@ index e8edf3970940..3151df2a27c7 100644
static const struct phylink_mac_ops mv88e6xxx_phylink_mac_ops = {
.mac_select_pcs = mv88e6xxx_mac_select_pcs,
.mac_prepare = mv88e6xxx_mac_prepare,
@@ -7133,6 +7195,8 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
@@ -7200,6 +7262,8 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
.crosschip_lag_change = mv88e6xxx_crosschip_lag_change,
.crosschip_lag_join = mv88e6xxx_crosschip_lag_join,
.crosschip_lag_leave = mv88e6xxx_crosschip_lag_leave,
@@ -374,6 +370,3 @@ index 7157864dc20f..7edb04c41ac8 100644
int mv88e6xxx_port_set_message_port(struct mv88e6xxx_chip *chip, int port,
bool message_port);
int mv88e6xxx_port_set_trunk(struct mv88e6xxx_chip *chip, int port,
--
2.43.0
@@ -1,10 +1,7 @@
From 9ddfb92b70bd73bacd358b699d30a8b8fd05b813 Mon Sep 17 00:00:00 2001
From d6d9d65123b6559194254079b39654883f984f13 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 28 May 2024 11:04:22 +0200
Subject: [PATCH 11/26] net: dsa: mv88e6xxx: Add mqprio qdisc support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [PATCH 11/35] net: dsa: mv88e6xxx: Add mqprio qdisc support
Organization: Wires
Add support for attaching mqprio qdisc's to mv88e6xxx ports and use
@@ -27,15 +24,13 @@ are effectively only specifying the QPri.
Since FPri is always a 3-bit field, even on older chips with only 4
physical queues, always report 8 queues and let the chip's policy
handle the mapping down to the "real" number.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 70 ++++++++++++++++++++++++++++++++
net/dsa/tag_dsa.c | 4 +-
2 files changed, 73 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 3151df2a27c7..f50ad71bb28b 100644
index 182d3a0e75c8..e73a4c2f0392 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -31,6 +31,7 @@
@@ -46,7 +41,7 @@ index 3151df2a27c7..f50ad71bb28b 100644
#include "chip.h"
#include "devlink.h"
@@ -7126,6 +7127,68 @@ static int mv88e6xxx_port_del_etype_prio(struct dsa_switch *ds, int port,
@@ -7193,6 +7194,68 @@ static int mv88e6xxx_port_del_etype_prio(struct dsa_switch *ds, int port,
return err;
}
@@ -115,7 +110,7 @@ index 3151df2a27c7..f50ad71bb28b 100644
static const struct phylink_mac_ops mv88e6xxx_phylink_mac_ops = {
.mac_select_pcs = mv88e6xxx_mac_select_pcs,
.mac_prepare = mv88e6xxx_mac_prepare,
@@ -7197,6 +7260,7 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
@@ -7264,6 +7327,7 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
.crosschip_lag_leave = mv88e6xxx_crosschip_lag_leave,
.port_add_etype_prio = mv88e6xxx_port_add_etype_prio,
.port_del_etype_prio = mv88e6xxx_port_del_etype_prio,
@@ -123,7 +118,7 @@ index 3151df2a27c7..f50ad71bb28b 100644
};
static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip)
@@ -7223,6 +7287,12 @@ static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip)
@@ -7290,6 +7354,12 @@ static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip)
*/
ds->num_lag_ids = mv88e6xxx_has_lag(chip) ? 16 : 0;
@@ -160,6 +155,3 @@ index a00ae6bf2971..55c296e0b5b0 100644
dsa_header[3] = vid & 0xff;
}
--
2.43.0
@@ -1,11 +1,8 @@
From fcf728f4442e961fc8361bba0d58aba8712f6893 Mon Sep 17 00:00:00 2001
From 0873cb85051b8c483d11570cb2b3ad3da6b7ca4c Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Wed, 29 May 2024 13:20:41 +0200
Subject: [PATCH 12/26] net: dsa: mv88e6xxx: Use VLAN prio over IP when both
Subject: [PATCH 12/35] net: dsa: mv88e6xxx: Use VLAN prio over IP when both
are available
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
Switch the priority sourcing precdence to prefer VLAN PCP over IP
@@ -25,17 +22,15 @@ main reasons for choosing the new default:
packet's priority. As the packet then moves through the network
core over trusted VLAN trunks, the packet should keep its original
priority, independent of what inner protocol fields may indicate.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index f50ad71bb28b..2a46bf5f3da8 100644
index e73a4c2f0392..9988fc3983d1 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3402,9 +3402,13 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
@@ -3443,9 +3443,13 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
/* Port Control: disable Drop-on-Unlock, disable Drop-on-Lock,
* disable Header mode, enable IGMP/MLD snooping, disable VLAN
@@ -52,7 +47,7 @@ index f50ad71bb28b..2a46bf5f3da8 100644
*
* If this is the CPU link, use DSA or EDSA tagging depending
* on which tagging mode was configured.
@@ -3415,6 +3419,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
@@ -3456,6 +3460,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
* forwarding of unknown unicasts and multicasts.
*/
reg = MV88E6185_PORT_CTL0_USE_TAG | MV88E6185_PORT_CTL0_USE_IP |
@@ -60,6 +55,3 @@ index f50ad71bb28b..2a46bf5f3da8 100644
MV88E6XXX_PORT_CTL0_STATE_FORWARDING;
/* Forward any IPv4 IGMP or IPv6 MLD frames received
* by a USER port to the CPU port to allow snooping.
--
2.43.0
@@ -1,11 +1,8 @@
From c7fb329301a2889540d6416b1ec9145a00de443c Mon Sep 17 00:00:00 2001
From 6976a38c8392241021a7bc5053a1f4c4d6447956 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 26 Nov 2024 19:45:59 +0100
Subject: [PATCH 13/26] [FIX] net: dsa: mv88e6xxx: Trap locally terminated
Subject: [PATCH 13/35] [FIX] net: dsa: mv88e6xxx: Trap locally terminated
VLANs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
Before this change, in a setup like the following, packets assigned to
@@ -27,8 +24,6 @@ a VLAN upper interface, rather than to offload bridge VLANs, are
marked as policy entries. As the VTU policy of user ports is already
set to TRAP (to ensure proper standalone port operation), this will
cause all packets assigned to these VLANs to properly terminated.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 33 ++++++++++++++++++--------------
include/net/switchdev.h | 4 ++++
@@ -36,10 +31,10 @@ Signed-off-by: Mattias Walström <lazzer@gmail.com>
3 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 2a46bf5f3da8..785cd3d0e2b1 100644
index 9988fc3983d1..74fca098b11a 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -2631,7 +2631,7 @@ static int mv88e6xxx_port_broadcast_sync(struct mv88e6xxx_chip *chip, int port,
@@ -2665,7 +2665,7 @@ static int mv88e6xxx_port_broadcast_sync(struct mv88e6xxx_chip *chip, int port,
}
static int mv88e6xxx_port_vlan_join(struct mv88e6xxx_chip *chip, int port,
@@ -48,7 +43,7 @@ index 2a46bf5f3da8..785cd3d0e2b1 100644
{
const u8 non_member = MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER;
struct mv88e6xxx_vtu_entry vlan;
@@ -2643,9 +2643,7 @@ static int mv88e6xxx_port_vlan_join(struct mv88e6xxx_chip *chip, int port,
@@ -2677,9 +2677,7 @@ static int mv88e6xxx_port_vlan_join(struct mv88e6xxx_chip *chip, int port,
if (!vlan.valid) {
memset(&vlan, 0, sizeof(vlan));
@@ -59,7 +54,7 @@ index 2a46bf5f3da8..785cd3d0e2b1 100644
err = mv88e6xxx_atu_new(chip, &vlan.fid);
if (err)
@@ -2668,6 +2666,9 @@ static int mv88e6xxx_port_vlan_join(struct mv88e6xxx_chip *chip, int port,
@@ -2702,6 +2700,9 @@ static int mv88e6xxx_port_vlan_join(struct mv88e6xxx_chip *chip, int port,
if (err)
return err;
} else if (vlan.member[port] != member) {
@@ -69,7 +64,7 @@ index 2a46bf5f3da8..785cd3d0e2b1 100644
vlan.member[port] = member;
err = mv88e6xxx_vtu_loadpurge(chip, &vlan);
@@ -2714,7 +2715,8 @@ static int mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port,
@@ -2748,7 +2749,8 @@ static int mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port,
mv88e6xxx_reg_lock(chip);
@@ -79,7 +74,7 @@ index 2a46bf5f3da8..785cd3d0e2b1 100644
if (err) {
dev_err(ds->dev, "p%d: failed to add VLAN %d%c\n", port,
vlan->vid, untagged ? 'u' : 't');
@@ -3454,14 +3456,17 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
@@ -3495,14 +3497,17 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
if (err)
return err;
@@ -104,7 +99,7 @@ index 2a46bf5f3da8..785cd3d0e2b1 100644
chip->info->ops->port_set_policy) {
err = chip->info->ops->port_set_policy(chip, port,
MV88E6XXX_POLICY_MAPPING_VTU,
@@ -3491,7 +3496,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
@@ -3532,7 +3537,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
*/
err = mv88e6xxx_port_vlan_join(chip, port, MV88E6XXX_VID_STANDALONE,
MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNMODIFIED,
@@ -113,7 +108,7 @@ index 2a46bf5f3da8..785cd3d0e2b1 100644
if (err)
return err;
@@ -3505,7 +3510,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
@@ -3546,7 +3551,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
*/
err = mv88e6xxx_port_vlan_join(chip, port, MV88E6XXX_VID_BRIDGED,
MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_UNMODIFIED,
@@ -159,6 +154,3 @@ index e13fb22e2c2b..f45e313f1dd0 100644
};
struct dsa_switch *ds = dp->ds;
struct netdev_hw_addr *ha;
--
2.43.0
@@ -1,11 +1,8 @@
From 31909f3d1f148d0bee1047abb76b890bf40bcb94 Mon Sep 17 00:00:00 2001
From 8eb1da2d6b87c0b997a1a9de6d0b964ff8a3134e Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 19 Sep 2023 18:38:10 +0200
Subject: [PATCH 14/26] net: phy: marvell10g: Support firmware loading on
Subject: [PATCH 14/35] net: phy: marvell10g: Support firmware loading on
88X3310
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
When probing, if a device is waiting for firmware to be loaded into
@@ -14,8 +11,6 @@ its RAM, ask userspace for the binary and load it over XMDIO.
We have no choice but to bail out of the probe if firmware is not
available, as the device does not have any built-in image on which to
fall back.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/phy/marvell10g.c | 161 +++++++++++++++++++++++++++++++++++
1 file changed, 161 insertions(+)
@@ -239,6 +234,3 @@ index 6642eb642d4b..79d9483419c0 100644
MODULE_DESCRIPTION("Marvell Alaska X/M multi-gigabit Ethernet PHY driver");
+MODULE_FIRMWARE("mrvl/x3310fw.hdr");
MODULE_LICENSE("GPL");
--
2.43.0
@@ -1,18 +1,13 @@
From c7c930ee6d4003f8fda995b03cf7cbaf148ea58e Mon Sep 17 00:00:00 2001
From c33528ebee1cd9f876b41a85f5435d6b37f1b511 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 21 Nov 2023 20:15:24 +0100
Subject: [PATCH 15/26] net: phy: marvell10g: Fix power-up when strapped to
Subject: [PATCH 15/35] net: phy: marvell10g: Fix power-up when strapped to
start powered down
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
On devices which are hardware strapped to start powered down (PDSTATE
== 1), make sure that we clear the power-down bit on all units
affected by this setting.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/phy/marvell10g.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
@@ -48,6 +43,3 @@ index 79d9483419c0..268484092776 100644
/* Sometimes, the power down bit doesn't clear immediately, and
* a read of this register causes the bit not to clear. Delay
--
2.43.0
@@ -1,10 +1,7 @@
From 16fb7c5087266f173d8a5a3bf72f6798f702038f Mon Sep 17 00:00:00 2001
From b825b8b6490df0893c6172971db4a4ec45164ee9 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Wed, 15 Nov 2023 20:58:42 +0100
Subject: [PATCH 16/26] net: phy: marvell10g: Add LED support for 88X3310
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [PATCH 16/35] net: phy: marvell10g: Add LED support for 88X3310
Organization: Wires
Pickup the LEDs from the state in which the hardware reset or
@@ -20,8 +17,6 @@ Trigger support:
software blinking
- "netdev": Offload link or duplex information to the solid behavior;
tx and/or rx activity to blink behavior.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/phy/marvell10g.c | 422 +++++++++++++++++++++++++++++++++++
1 file changed, 422 insertions(+)
@@ -515,6 +510,3 @@ index 268484092776..9f8475b67ef7 100644
},
{
.phy_id = MARVELL_PHY_ID_88X3310,
--
2.43.0
@@ -1,11 +1,8 @@
From 1c7ecd73741ecb39efd3b51720c81a15cf22e464 Mon Sep 17 00:00:00 2001
From a9248de91e771540c92774998111166732eba59a Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 12 Dec 2023 09:51:05 +0100
Subject: [PATCH 17/26] net: phy: marvell10g: Support LEDs tied to a single
Subject: [PATCH 17/35] net: phy: marvell10g: Support LEDs tied to a single
media side
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
In a combo-port setup, i.e. where both the copper and fiber interface
@@ -17,8 +14,6 @@ tied to a particular media side, and use that information to refine
the offloading of the "netdev" trigger, such that LEDs attached to the
RJ45 jack only lights up when a copper link is established, and vice
versa for the SFP cage.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/phy/marvell10g.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
@@ -78,6 +73,3 @@ index 9f8475b67ef7..82b2e9b55b67 100644
/* mv3310_led_polarity_set() will not be called unless the
* device tree specifies a mode that of_phy_led() considers to
* be a non-default configuration. I.e., something other than
--
2.43.0
@@ -1,10 +1,7 @@
From c6dd269683ee65b1a2879692379fba13cae40bd5 Mon Sep 17 00:00:00 2001
From 9ca2c21e070baa0b3c7aca376f6bb9aaa0c801ea Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Wed, 27 Mar 2024 10:10:19 +0100
Subject: [PATCH 18/26] net: phy: Do not resume PHY when attaching
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [PATCH 18/35] net: phy: Do not resume PHY when attaching
Organization: Wires
The PHY should not start negotiating with its link-partner until
@@ -18,17 +15,15 @@ Otherwise, drivers that attached to their PHYs during
probing (e.g. DSA) would end up with a physical link being
established, even though the corresponding interface was still
administratively down.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/phy/phy_device.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 499797646580..0acfef4fe43e 100644
index 8af44224480f..a2e386e9fafc 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1634,7 +1634,6 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
@@ -1661,7 +1661,6 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
if (err)
goto error;
@@ -36,6 +31,3 @@ index 499797646580..0acfef4fe43e 100644
if (!phydev->is_on_sfp_module)
phy_led_triggers_register(phydev);
--
2.43.0
@@ -1,11 +1,8 @@
From 604f9a09bf90c6dcec29b946851c59847ad368a7 Mon Sep 17 00:00:00 2001
From 4a731f968cb458ea29e9fa0b710b87607d01c18b Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Mon, 4 Mar 2024 16:47:28 +0100
Subject: [PATCH 19/26] net: bridge: avoid classifying unknown multicast as
Subject: [PATCH 19/35] net: bridge: avoid classifying unknown multicast as
mrouters_only
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
Unknown multicast, MAC/IPv4/IPv6, should always be flooded according to
@@ -19,7 +16,6 @@ Because a multicast router should always receive both known and unknown
multicast.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
include/uapi/linux/if_bridge.h | 1 +
net/bridge/br.c | 5 +++++
@@ -235,6 +231,3 @@ index 041f6e571a20..40651b07df94 100644
static inline bool br_multicast_is_router(struct net_bridge_mcast *brmctx,
struct sk_buff *skb)
{
--
2.43.0
@@ -1,11 +1,8 @@
From 8c489b7e9abc123d1808546cd1dd8428b5482088 Mon Sep 17 00:00:00 2001
From e2cfbf7c107e5ab73bd16d1ffecd30bdcb8c8a63 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Tue, 5 Mar 2024 06:44:41 +0100
Subject: [PATCH 20/26] net: bridge: Ignore router ports when forwarding L2
Subject: [PATCH 20/35] net: bridge: Ignore router ports when forwarding L2
multicast
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
Multicast router ports are either statically configured or learned from
@@ -15,7 +12,6 @@ of unknown multicast or using permanent MDB entries.
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
net/bridge/br_private.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
@@ -36,6 +32,3 @@ index 40651b07df94..e90b4f5cab76 100644
}
static inline struct net_bridge_port *
--
2.43.0
@@ -1,11 +1,8 @@
From 55e616c4e37d316b5d9266390dc13531d0bbd765 Mon Sep 17 00:00:00 2001
From 1f19092b74eaaef88314e97e9b89012328bd857d Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Thu, 4 Apr 2024 16:36:30 +0200
Subject: [PATCH 21/26] net: bridge: drop delay for applying strict multicast
Subject: [PATCH 21/35] net: bridge: drop delay for applying strict multicast
filtering
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
This *local* patch drops the initial delay before applying strict multicast
@@ -22,7 +19,6 @@ A proper fix for upstreaming could be to add a knob to disable the delay.
[2]: https://lore.kernel.org/netdev/20240127175033.9640-1-linus.luessing@c0d3.blue/
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
net/bridge/br_multicast.c | 42 +++++++--------------------------------
net/bridge/br_private.h | 4 +---
@@ -189,6 +185,3 @@ index e90b4f5cab76..73b78c594564 100644
}
static inline bool br_multicast_querier_exists(struct net_bridge_mcast *brmctx,
--
2.43.0
@@ -1,11 +1,8 @@
From 186ecab132b86588eb6c1e93bcc33f3c5cc95c03 Mon Sep 17 00:00:00 2001
From 63019c809c938f5233386d39cf53543ed2144850 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Thu, 16 May 2024 14:51:54 +0200
Subject: [PATCH 22/26] net: bridge: Differentiate MDB additions from
Subject: [PATCH 22/35] net: bridge: Differentiate MDB additions from
modifications
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
Before this change, the reception of an IGMPv3 report (and analogously
@@ -24,8 +21,6 @@ generated.
Therefore, discriminate new groups from changes to existing groups by
introducing a RTM_SETMDB events to be used in the latter scenario.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
include/uapi/linux/rtnetlink.h | 2 ++
net/bridge/br_mdb.c | 4 ++--
@@ -107,6 +102,3 @@ index 34be07a1fd00..9c8bf38e0079 100644
unlock_continue:
spin_unlock(&brmctx->br->multicast_lock);
}
--
2.43.0
@@ -1,11 +1,8 @@
From e31128eb97256ae37bda13e8c02a1f53b92b3524 Mon Sep 17 00:00:00 2001
From 2673b004d9a30833428a799245e3c57fd9acb330 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Fri, 24 Nov 2023 23:29:55 +0100
Subject: [PATCH 23/26] nvmem: layouts: onie-tlv: Let device probe even when
Subject: [PATCH 23/35] nvmem: layouts: onie-tlv: Let device probe even when
TLV is invalid
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
Before this change, probing an NVMEM device, expected to contain a
@@ -16,8 +13,6 @@ be successfully probed.
Therefore, settle for reporting data corruption issues in the log, and
simply refrain from registering any cells in those cases.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/nvmem/layouts/onie-tlv.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
@@ -53,6 +48,3 @@ index 0967a32319a2..48547d5bb502 100644
data = table + hdr_len;
ret = onie_tlv_add_cells(dev, nvmem, data_len, data);
--
2.43.0
@@ -1,10 +1,7 @@
From 1e31630dd13b534d70440826df9c3b01c85966e7 Mon Sep 17 00:00:00 2001
From d7519317b32dcd332a359d42a447b2c74eeacd01 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Mon, 29 Apr 2024 15:14:51 +0200
Subject: [PATCH 24/26] usb: core: adjust log level for unauthorized devices
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [PATCH 24/35] usb: core: adjust log level for unauthorized devices
Organization: Wires
The fact that a USB device currently is not authorized is not an error,
@@ -12,7 +9,6 @@ so let's adjust the log level so these messages slip below radar for the
commonly used 'quiet' log level.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/usb/core/driver.c | 4 ++--
drivers/usb/core/generic.c | 2 +-
@@ -48,6 +44,3 @@ index b134bff5c3fe..60575a01a810 100644
else {
c = usb_choose_configuration(udev);
if (c >= 0) {
--
2.43.0
@@ -1,11 +1,8 @@
From cfb28602d7b9425f75fc37acdb123634e5717c2a Mon Sep 17 00:00:00 2001
From 67dfe75bf1517162845725e0fac83dafa37c701d Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Thu, 16 Jan 2025 12:35:12 +0100
Subject: [PATCH 25/26] net: dsa: mv88e6xxx: collapse disabled state into
Subject: [PATCH 25/35] net: dsa: mv88e6xxx: collapse disabled state into
blocking
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
This patch changes the behavior of switchcore ports wrt. the port state.
@@ -21,7 +18,6 @@ each member port, preventing LACPDUs from passing through to qualify the
link and become active.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/port.c | 2 --
1 file changed, 2 deletions(-)
@@ -39,6 +35,3 @@ index 84900814c456..91e58297594c 100644
case BR_STATE_BLOCKING:
case BR_STATE_LISTENING:
state = MV88E6XXX_PORT_CTL0_STATE_BLOCKING;
--
2.43.0
@@ -1,11 +1,8 @@
From 5474cc6141ebdb748eea0b4ee6b79cce8b084585 Mon Sep 17 00:00:00 2001
From 2b29bd6a4b0851dfe2beff03e4c8a59a9d6c201b Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Wed, 12 Feb 2025 22:03:14 +0100
Subject: [PATCH 26/26] net: dsa: mv88e6xxx: Only activate LAG offloading when
Subject: [PATCH 26/35] net: dsa: mv88e6xxx: Only activate LAG offloading when
bridged
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
The current port isolation scheme for mv88e6xxx is detailed here:
@@ -49,17 +46,15 @@ existing port isolation to work as intended.
Before joining a bridge, the offload does not offer any performance
benefit anyway. All ingressing packet will always have to go to the
CPU; egress traffic always relies on software hashing.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 42 +++++++++++++++-----------------
1 file changed, 20 insertions(+), 22 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 785cd3d0e2b1..37e79d52c175 100644
index 74fca098b11a..df7ea44da912 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3065,6 +3065,7 @@ static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
@@ -3106,6 +3106,7 @@ static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
struct netlink_ext_ack *extack)
{
struct mv88e6xxx_chip *chip = ds->priv;
@@ -67,7 +62,7 @@ index 785cd3d0e2b1..37e79d52c175 100644
int err;
mv88e6xxx_reg_lock(chip);
@@ -3073,6 +3074,13 @@ static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
@@ -3114,6 +3115,13 @@ static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
if (err)
goto unlock;
@@ -81,7 +76,7 @@ index 785cd3d0e2b1..37e79d52c175 100644
err = mv88e6xxx_port_set_map_da(chip, port, true);
if (err)
goto unlock;
@@ -3117,6 +3125,14 @@ static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port,
@@ -3158,6 +3166,14 @@ static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port,
"port %d failed to restore map-DA: %pe\n",
port, ERR_PTR(err));
@@ -96,7 +91,7 @@ index 785cd3d0e2b1..37e79d52c175 100644
err = mv88e6xxx_port_commit_pvid(chip, port);
if (err)
dev_err(ds->dev,
@@ -6992,30 +7008,13 @@ static int mv88e6xxx_port_lag_join(struct dsa_switch *ds, int port,
@@ -7059,30 +7075,13 @@ static int mv88e6xxx_port_lag_join(struct dsa_switch *ds, int port,
struct netlink_ext_ack *extack)
{
struct mv88e6xxx_chip *chip = ds->priv;
@@ -128,7 +123,7 @@ index 785cd3d0e2b1..37e79d52c175 100644
mv88e6xxx_reg_unlock(chip);
return err;
}
@@ -7024,13 +7023,12 @@ static int mv88e6xxx_port_lag_leave(struct dsa_switch *ds, int port,
@@ -7091,13 +7090,12 @@ static int mv88e6xxx_port_lag_leave(struct dsa_switch *ds, int port,
struct dsa_lag lag)
{
struct mv88e6xxx_chip *chip = ds->priv;
@@ -145,6 +140,3 @@ index 785cd3d0e2b1..37e79d52c175 100644
}
static int mv88e6xxx_crosschip_lag_change(struct dsa_switch *ds, int sw_index,
--
2.43.0
@@ -1,9 +1,9 @@
From daba70e7782b704224396f0d86dcd91b4713e064 Mon Sep 17 00:00:00 2001
From b459641eb229d46a2dabcc29f060c7eaed27fb32 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 11 Aug 2024 11:27:35 +0200
Subject: [PATCH 5/5] net: usb: r8152: add r8153b support for link/activity
Subject: [PATCH 27/35] net: usb: r8152: add r8153b support for link/activity
LEDs
Organization: Addiva Elektronik
Organization: Wires
This patch adds support for the link/activity LEDs on the NanoPi R2S
and OrangePi R1 Plus.
@@ -19,7 +19,7 @@ Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
1 file changed, 8 insertions(+)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 19df1cd9f072..810477991810 100644
index 96fa3857d8e2..cddb025aa56b 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -41,6 +41,11 @@
@@ -34,7 +34,7 @@ index 19df1cd9f072..810477991810 100644
#define R8152_PHY_ID 32
#define PLA_IDR 0xc000
@@ -7296,6 +7301,9 @@ static void r8153b_init(struct r8152 *tp)
@@ -7307,6 +7312,9 @@ static void r8153b_init(struct r8152 *tp)
ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN);
ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data);
@@ -44,6 +44,3 @@ index 19df1cd9f072..810477991810 100644
rtl_tally_reset(tp);
tp->coalesce = 15000; /* 15 us */
--
2.43.0
@@ -0,0 +1,46 @@
From 5059085e17b7967a8ed10f10c0cfbe1413a6955c Mon Sep 17 00:00:00 2001
From: Liu Ying <victor.liu@nxp.com>
Date: Mon, 4 Nov 2024 11:27:58 +0800
Subject: [PATCH 28/35] drm: of: Get MEDIA_BUS_FMT_RGB101010_1X7X5_{JEIDA,
SPWG} LVDS data mappings
Organization: Wires
Add MEDIA_BUS_FMT_RGB101010_1X7X5_{JEIDA,SPWG} support in
drm_of_lvds_get_data_mapping() function implementation so that function
callers may get the two LVDS data mappings.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241104032806.611890-6-victor.liu@nxp.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/drm_of.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index 177b600895d3..89863a35c731 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -410,7 +410,9 @@ EXPORT_SYMBOL_GPL(drm_of_lvds_get_dual_link_pixel_order);
* Return:
* * MEDIA_BUS_FMT_RGB666_1X7X3_SPWG - data-mapping is "jeida-18"
* * MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA - data-mapping is "jeida-24"
+ * * MEDIA_BUS_FMT_RGB101010_1X7X5_JEIDA - data-mapping is "jeida-30"
* * MEDIA_BUS_FMT_RGB888_1X7X4_SPWG - data-mapping is "vesa-24"
+ * * MEDIA_BUS_FMT_RGB101010_1X7X5_SPWG - data-mapping is "vesa-30"
* * -EINVAL - the "data-mapping" property is unsupported
* * -ENODEV - the "data-mapping" property is missing
*/
@@ -427,8 +429,12 @@ int drm_of_lvds_get_data_mapping(const struct device_node *port)
return MEDIA_BUS_FMT_RGB666_1X7X3_SPWG;
if (!strcmp(mapping, "jeida-24"))
return MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
+ if (!strcmp(mapping, "jeida-30"))
+ return MEDIA_BUS_FMT_RGB101010_1X7X5_JEIDA;
if (!strcmp(mapping, "vesa-24"))
return MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
+ if (!strcmp(mapping, "vesa-30"))
+ return MEDIA_BUS_FMT_RGB101010_1X7X5_SPWG;
return -EINVAL;
}
@@ -0,0 +1,147 @@
From 0f483d196dab387a4ad31342ab1ad5d4c75d5bf8 Mon Sep 17 00:00:00 2001
From: Liu Ying <victor.liu@nxp.com>
Date: Mon, 4 Nov 2024 11:27:59 +0800
Subject: [PATCH 29/35] drm: of: Add
drm_of_lvds_get_dual_link_pixel_order_sink()
Organization: Wires
drm_of_lvds_get_dual_link_pixel_order() gets LVDS dual-link source pixel
order. Similar to it, add it's counterpart function
drm_of_lvds_get_dual_link_pixel_order_sink() to get LVDS dual-link sink
pixel order.
Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241104032806.611890-7-victor.liu@nxp.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/drm_of.c | 76 ++++++++++++++++++++++++++++++++++------
include/drm/drm_of.h | 9 +++++
2 files changed, 74 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index 89863a35c731..5c2abc9eca9c 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -341,8 +341,23 @@ static int drm_of_lvds_get_remote_pixels_type(
return pixels_type;
}
+static int __drm_of_lvds_get_dual_link_pixel_order(int p1_pt, int p2_pt)
+{
+ /*
+ * A valid dual-lVDS bus is found when one port is marked with
+ * "dual-lvds-even-pixels", and the other port is marked with
+ * "dual-lvds-odd-pixels", bail out if the markers are not right.
+ */
+ if (p1_pt + p2_pt != DRM_OF_LVDS_EVEN + DRM_OF_LVDS_ODD)
+ return -EINVAL;
+
+ return p1_pt == DRM_OF_LVDS_EVEN ?
+ DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS :
+ DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS;
+}
+
/**
- * drm_of_lvds_get_dual_link_pixel_order - Get LVDS dual-link pixel order
+ * drm_of_lvds_get_dual_link_pixel_order - Get LVDS dual-link source pixel order
* @port1: First DT port node of the Dual-link LVDS source
* @port2: Second DT port node of the Dual-link LVDS source
*
@@ -387,19 +402,58 @@ int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1,
if (remote_p2_pt < 0)
return remote_p2_pt;
- /*
- * A valid dual-lVDS bus is found when one remote port is marked with
- * "dual-lvds-even-pixels", and the other remote port is marked with
- * "dual-lvds-odd-pixels", bail out if the markers are not right.
- */
- if (remote_p1_pt + remote_p2_pt != DRM_OF_LVDS_EVEN + DRM_OF_LVDS_ODD)
+ return __drm_of_lvds_get_dual_link_pixel_order(remote_p1_pt, remote_p2_pt);
+}
+EXPORT_SYMBOL_GPL(drm_of_lvds_get_dual_link_pixel_order);
+
+/**
+ * drm_of_lvds_get_dual_link_pixel_order_sink - Get LVDS dual-link sink pixel order
+ * @port1: First DT port node of the Dual-link LVDS sink
+ * @port2: Second DT port node of the Dual-link LVDS sink
+ *
+ * An LVDS dual-link connection is made of two links, with even pixels
+ * transitting on one link, and odd pixels on the other link. This function
+ * returns, for two ports of an LVDS dual-link sink, which port shall transmit
+ * the even and odd pixels, based on the requirements of the sink.
+ *
+ * The pixel order is determined from the dual-lvds-even-pixels and
+ * dual-lvds-odd-pixels properties in the sink's DT port nodes. If those
+ * properties are not present, or if their usage is not valid, this function
+ * returns -EINVAL.
+ *
+ * If either port is not connected, this function returns -EPIPE.
+ *
+ * @port1 and @port2 are typically DT sibling nodes, but may have different
+ * parents when, for instance, two separate LVDS decoders receive the even and
+ * odd pixels.
+ *
+ * Return:
+ * * DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS - @port1 receives even pixels and @port2
+ * receives odd pixels
+ * * DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS - @port1 receives odd pixels and @port2
+ * receives even pixels
+ * * -EINVAL - @port1 or @port2 are NULL
+ * * -EPIPE - when @port1 or @port2 are not connected
+ */
+int drm_of_lvds_get_dual_link_pixel_order_sink(struct device_node *port1,
+ struct device_node *port2)
+{
+ int sink_p1_pt, sink_p2_pt;
+
+ if (!port1 || !port2)
return -EINVAL;
- return remote_p1_pt == DRM_OF_LVDS_EVEN ?
- DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS :
- DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS;
+ sink_p1_pt = drm_of_lvds_get_port_pixels_type(port1);
+ if (!sink_p1_pt)
+ return -EPIPE;
+
+ sink_p2_pt = drm_of_lvds_get_port_pixels_type(port2);
+ if (!sink_p2_pt)
+ return -EPIPE;
+
+ return __drm_of_lvds_get_dual_link_pixel_order(sink_p1_pt, sink_p2_pt);
}
-EXPORT_SYMBOL_GPL(drm_of_lvds_get_dual_link_pixel_order);
+EXPORT_SYMBOL_GPL(drm_of_lvds_get_dual_link_pixel_order_sink);
/**
* drm_of_lvds_get_data_mapping - Get LVDS data mapping
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index 02d1cdd7f798..7f0256dae3f1 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -52,6 +52,8 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
struct drm_bridge **bridge);
int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1,
const struct device_node *port2);
+int drm_of_lvds_get_dual_link_pixel_order_sink(struct device_node *port1,
+ struct device_node *port2);
int drm_of_lvds_get_data_mapping(const struct device_node *port);
int drm_of_get_data_lanes_count(const struct device_node *endpoint,
const unsigned int min, const unsigned int max);
@@ -109,6 +111,13 @@ drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1,
return -EINVAL;
}
+static inline int
+drm_of_lvds_get_dual_link_pixel_order_sink(struct device_node *port1,
+ struct device_node *port2)
+{
+ return -EINVAL;
+}
+
static inline int
drm_of_lvds_get_data_mapping(const struct device_node *port)
{
@@ -0,0 +1,80 @@
From 901dd3cc12ff3e8ac7f361892ee04cfb44a4df76 Mon Sep 17 00:00:00 2001
From: Liu Ying <victor.liu@nxp.com>
Date: Mon, 4 Nov 2024 11:28:00 +0800
Subject: [PATCH 30/35] dt-bindings: display: lvds-data-mapping: Add 30-bit RGB
pixel data mappings
Organization: Wires
Add "jeida-30" and "vesa-30" data mappings that are compatible with JEIDA
and VESA respectively.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241104032806.611890-8-victor.liu@nxp.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
.../bindings/display/lvds-data-mapping.yaml | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/Documentation/devicetree/bindings/display/lvds-data-mapping.yaml b/Documentation/devicetree/bindings/display/lvds-data-mapping.yaml
index d68982fe2e9b..ab842594feb9 100644
--- a/Documentation/devicetree/bindings/display/lvds-data-mapping.yaml
+++ b/Documentation/devicetree/bindings/display/lvds-data-mapping.yaml
@@ -26,12 +26,17 @@ description: |
Device compatible with those specifications have been marketed under the
FPD-Link and FlatLink brands.
+ This bindings also supports 30-bit data mapping compatible with JEIDA and
+ VESA.
+
properties:
data-mapping:
enum:
- jeida-18
- jeida-24
+ - jeida-30
- vesa-24
+ - vesa-30
description: |
The color signals mapping order.
@@ -60,6 +65,19 @@ properties:
DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B7__><__B6__><__B5__><__B4__><
DATA3 ><_CTL3_><__B1__><__B0__><__G1__><__G0__><__R1__><__R0__><
+ - "jeida-30" - 30-bit data mapping compatible with JEIDA and VESA. Data
+ are transferred as follows on 5 LVDS lanes.
+
+ Slot 0 1 2 3 4 5 6
+ ________________ _________________
+ Clock \_______________________/
+ ______ ______ ______ ______ ______ ______ ______
+ DATA0 ><__G4__><__R9__><__R8__><__R7__><__R6__><__R5__><__R4__><
+ DATA1 ><__B5__><__B4__><__G9__><__G8__><__G7__><__G6__><__G5__><
+ DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B9__><__B8__><__B7__><__B6__><
+ DATA3 ><_CTL3_><__B3__><__B2__><__G3__><__G2__><__R3__><__R2__><
+ DATA4 ><_CTL3_><__B1__><__B0__><__G1__><__G0__><__R1__><__R0__><
+
- "vesa-24" - 24-bit data mapping compatible with the [VESA] specification.
Data are transferred as follows on 4 LVDS lanes.
@@ -72,6 +90,19 @@ properties:
DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B5__><__B4__><__B3__><__B2__><
DATA3 ><_CTL3_><__B7__><__B6__><__G7__><__G6__><__R7__><__R6__><
+ - "vesa-30" - 30-bit data mapping compatible with VESA. Data are
+ transferred as follows on 5 LVDS lanes.
+
+ Slot 0 1 2 3 4 5 6
+ ________________ _________________
+ Clock \_______________________/
+ ______ ______ ______ ______ ______ ______ ______
+ DATA0 ><__G0__><__R5__><__R4__><__R3__><__R2__><__R1__><__R0__><
+ DATA1 ><__B1__><__B0__><__G5__><__G4__><__G3__><__G2__><__G1__><
+ DATA2 ><_CTL2_><_CTL1_><_CTL0_><__B5__><__B4__><__B3__><__B2__><
+ DATA3 ><_CTL3_><__B7__><__B6__><__G7__><__G6__><__R7__><__R6__><
+ DATA4 ><_CTL3_><__B9__><__B8__><__G9__><__G8__><__R9__><__R8__><
+
Control signals are mapped as follows.
CTL0: HSync
@@ -0,0 +1,187 @@
From 34bc3735912c7af9b7c1f600bac60482d1879c3f Mon Sep 17 00:00:00 2001
From: Liu Ying <victor.liu@nxp.com>
Date: Mon, 4 Nov 2024 11:28:01 +0800
Subject: [PATCH 31/35] dt-bindings: display: Document dual-link LVDS display
common properties
Organization: Wires
Dual-link LVDS displays receive odd pixels and even pixels separately from
dual LVDS links. One link receives odd pixels and the other receives even
pixels. Some of those displays may also use only one LVDS link to receive
all pixels, being odd and even agnostic. Document common properties for
those displays by extending LVDS display common properties defined in
lvds.yaml.
Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241104032806.611890-9-victor.liu@nxp.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
.../bindings/display/lvds-dual-ports.yaml | 63 +++++++++++++++++++
.../display/panel/advantech,idk-2121wr.yaml | 14 +----
.../panel/panel-simple-lvds-dual-ports.yaml | 20 +-----
3 files changed, 65 insertions(+), 32 deletions(-)
create mode 100644 Documentation/devicetree/bindings/display/lvds-dual-ports.yaml
diff --git a/Documentation/devicetree/bindings/display/lvds-dual-ports.yaml b/Documentation/devicetree/bindings/display/lvds-dual-ports.yaml
new file mode 100644
index 000000000000..785701fe1590
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/lvds-dual-ports.yaml
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/lvds-dual-ports.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Dual-link LVDS Display Common Properties
+
+maintainers:
+ - Liu Ying <victor.liu@nxp.com>
+
+description: |
+ Common properties for LVDS displays with dual LVDS links. Extend LVDS display
+ common properties defined in lvds.yaml.
+
+ Dual-link LVDS displays receive odd pixels and even pixels separately from
+ the dual LVDS links. One link receives odd pixels and the other receives
+ even pixels. Some of those displays may also use only one LVDS link to
+ receive all pixels, being odd and even agnostic.
+
+allOf:
+ - $ref: lvds.yaml#
+
+properties:
+ ports:
+ $ref: /schemas/graph.yaml#/properties/ports
+
+ patternProperties:
+ '^port@[01]$':
+ $ref: /schemas/graph.yaml#/$defs/port-base
+ unevaluatedProperties: false
+ description: |
+ port@0 represents the first LVDS input link.
+ port@1 represents the second LVDS input link.
+
+ properties:
+ dual-lvds-odd-pixels:
+ type: boolean
+ description: LVDS input link for odd pixels
+
+ dual-lvds-even-pixels:
+ type: boolean
+ description: LVDS input link for even pixels
+
+ oneOf:
+ - required: [dual-lvds-odd-pixels]
+ - required: [dual-lvds-even-pixels]
+ - properties:
+ dual-lvds-odd-pixels: false
+ dual-lvds-even-pixels: false
+
+ anyOf:
+ - required:
+ - port@0
+ - required:
+ - port@1
+
+required:
+ - ports
+
+additionalProperties: true
+
+...
diff --git a/Documentation/devicetree/bindings/display/panel/advantech,idk-2121wr.yaml b/Documentation/devicetree/bindings/display/panel/advantech,idk-2121wr.yaml
index 2e8dbdb5a3d5..05ca3b2385f8 100644
--- a/Documentation/devicetree/bindings/display/panel/advantech,idk-2121wr.yaml
+++ b/Documentation/devicetree/bindings/display/panel/advantech,idk-2121wr.yaml
@@ -20,6 +20,7 @@ description: |
dual-lvds-odd-pixels or dual-lvds-even-pixels).
allOf:
+ - $ref: /schemas/display/lvds-dual-ports.yaml#
- $ref: panel-common.yaml#
properties:
@@ -44,22 +45,10 @@ properties:
properties:
port@0:
- $ref: /schemas/graph.yaml#/$defs/port-base
- unevaluatedProperties: false
- description: The sink for odd pixels.
- properties:
- dual-lvds-odd-pixels: true
-
required:
- dual-lvds-odd-pixels
port@1:
- $ref: /schemas/graph.yaml#/$defs/port-base
- unevaluatedProperties: false
- description: The sink for even pixels.
- properties:
- dual-lvds-even-pixels: true
-
required:
- dual-lvds-even-pixels
@@ -75,7 +64,6 @@ required:
- height-mm
- data-mapping
- panel-timing
- - ports
examples:
- |+
diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple-lvds-dual-ports.yaml b/Documentation/devicetree/bindings/display/panel/panel-simple-lvds-dual-ports.yaml
index 10ed4b57232b..e80fc7006984 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple-lvds-dual-ports.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple-lvds-dual-ports.yaml
@@ -22,6 +22,7 @@ description: |
If the panel is more advanced a dedicated binding file is required.
allOf:
+ - $ref: /schemas/display/lvds-dual-ports.yaml#
- $ref: panel-common.yaml#
properties:
@@ -55,28 +56,10 @@ properties:
properties:
port@0:
- $ref: /schemas/graph.yaml#/$defs/port-base
- unevaluatedProperties: false
- description: The first sink port.
-
- properties:
- dual-lvds-odd-pixels:
- type: boolean
- description: The first sink port for odd pixels.
-
required:
- dual-lvds-odd-pixels
port@1:
- $ref: /schemas/graph.yaml#/$defs/port-base
- unevaluatedProperties: false
- description: The second sink port.
-
- properties:
- dual-lvds-even-pixels:
- type: boolean
- description: The second sink port for even pixels.
-
required:
- dual-lvds-even-pixels
@@ -88,7 +71,6 @@ unevaluatedProperties: false
required:
- compatible
- - ports
- power-supply
examples:
@@ -0,0 +1,278 @@
From 40d2762755d7f6b404edb1e2baa28ef62e8b4973 Mon Sep 17 00:00:00 2001
From: Liu Ying <victor.liu@nxp.com>
Date: Mon, 4 Nov 2024 11:28:02 +0800
Subject: [PATCH 32/35] dt-bindings: display: bridge: Add ITE IT6263 LVDS to
HDMI converter
Organization: Wires
Document ITE IT6263 LVDS to HDMI converter.
Product link:
https://www.ite.com.tw/en/product/cate1/IT6263
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241104032806.611890-10-victor.liu@nxp.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
.../bindings/display/bridge/ite,it6263.yaml | 250 ++++++++++++++++++
1 file changed, 250 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/bridge/ite,it6263.yaml
diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6263.yaml b/Documentation/devicetree/bindings/display/bridge/ite,it6263.yaml
new file mode 100644
index 000000000000..0a10e10d80ff
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6263.yaml
@@ -0,0 +1,250 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/ite,it6263.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ITE IT6263 LVDS to HDMI converter
+
+maintainers:
+ - Liu Ying <victor.liu@nxp.com>
+
+description: |
+ The IT6263 is a high-performance single-chip De-SSC(De-Spread Spectrum) LVDS
+ to HDMI converter. Combined with LVDS receiver and HDMI 1.4a transmitter,
+ the IT6263 supports LVDS input and HDMI 1.4 output by conversion function.
+ The built-in LVDS receiver can support single-link and dual-link LVDS inputs,
+ and the built-in HDMI transmitter is fully compliant with HDMI 1.4a/3D, HDCP
+ 1.2 and backward compatible with DVI 1.0 specification.
+
+ The IT6263 also encodes and transmits up to 8 channels of I2S digital audio,
+ with sampling rate up to 192KHz and sample size up to 24 bits. In addition,
+ an S/PDIF input port takes in compressed audio of up to 192KHz frame rate.
+
+ The newly supported High-Bit Rate(HBR) audio by HDMI specifications v1.3 is
+ provided by the IT6263 in two interfaces: the four I2S input ports or the
+ S/PDIF input port. With both interfaces the highest possible HBR frame rate
+ is supported at up to 768KHz.
+
+allOf:
+ - $ref: /schemas/display/lvds-dual-ports.yaml#
+
+properties:
+ compatible:
+ const: ite,it6263
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+ description: audio master clock
+
+ clock-names:
+ const: mclk
+
+ data-mapping:
+ enum:
+ - jeida-18
+ - jeida-24
+ - jeida-30
+ - vesa-24
+ - vesa-30
+
+ reset-gpios:
+ maxItems: 1
+
+ ivdd-supply:
+ description: 1.8V digital logic power
+
+ ovdd-supply:
+ description: 3.3V I/O pin power
+
+ txavcc18-supply:
+ description: 1.8V HDMI analog frontend power
+
+ txavcc33-supply:
+ description: 3.3V HDMI analog frontend power
+
+ pvcc1-supply:
+ description: 1.8V HDMI frontend core PLL power
+
+ pvcc2-supply:
+ description: 1.8V HDMI frontend filter PLL power
+
+ avcc-supply:
+ description: 3.3V LVDS frontend power
+
+ anvdd-supply:
+ description: 1.8V LVDS frontend analog power
+
+ apvdd-supply:
+ description: 1.8V LVDS frontend PLL power
+
+ "#sound-dai-cells":
+ const: 0
+
+ ite,i2s-audio-fifo-sources:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ minItems: 1
+ maxItems: 4
+ items:
+ enum: [0, 1, 2, 3]
+ description:
+ Each array element indicates the pin number of an I2S serial data input
+ line which is connected to an audio FIFO, from audio FIFO0 to FIFO3.
+
+ ite,rl-channel-swap-audio-sources:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ minItems: 1
+ maxItems: 4
+ uniqueItems: true
+ items:
+ enum: [0, 1, 2, 3]
+ description:
+ Each array element indicates an audio source whose right channel and left
+ channel are swapped by this converter. For I2S, the element is the pin
+ number of an I2S serial data input line. For S/PDIF, the element is always
+ 0.
+
+ ports:
+ $ref: /schemas/graph.yaml#/properties/ports
+
+ properties:
+ port@0: true
+
+ port@1:
+ oneOf:
+ - required: [dual-lvds-odd-pixels]
+ - required: [dual-lvds-even-pixels]
+
+ port@2:
+ $ref: /schemas/graph.yaml#/properties/port
+ description: video port for the HDMI output
+
+ port@3:
+ $ref: /schemas/graph.yaml#/properties/port
+ description: sound input port
+
+ required:
+ - port@0
+ - port@2
+
+required:
+ - compatible
+ - reg
+ - data-mapping
+ - ivdd-supply
+ - ovdd-supply
+ - txavcc18-supply
+ - txavcc33-supply
+ - pvcc1-supply
+ - pvcc2-supply
+ - avcc-supply
+ - anvdd-supply
+ - apvdd-supply
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ /* single-link LVDS input */
+ #include <dt-bindings/gpio/gpio.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ hdmi@4c {
+ compatible = "ite,it6263";
+ reg = <0x4c>;
+ data-mapping = "jeida-24";
+ reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+ ivdd-supply = <&reg_buck5>;
+ ovdd-supply = <&reg_vext_3v3>;
+ txavcc18-supply = <&reg_buck5>;
+ txavcc33-supply = <&reg_vext_3v3>;
+ pvcc1-supply = <&reg_buck5>;
+ pvcc2-supply = <&reg_buck5>;
+ avcc-supply = <&reg_vext_3v3>;
+ anvdd-supply = <&reg_buck5>;
+ apvdd-supply = <&reg_buck5>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+
+ it6263_lvds_link1: endpoint {
+ remote-endpoint = <&ldb_lvds_ch0>;
+ };
+ };
+
+ port@2 {
+ reg = <2>;
+
+ it6263_out: endpoint {
+ remote-endpoint = <&hdmi_in>;
+ };
+ };
+ };
+ };
+ };
+
+ - |
+ /* dual-link LVDS input */
+ #include <dt-bindings/gpio/gpio.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ hdmi@4c {
+ compatible = "ite,it6263";
+ reg = <0x4c>;
+ data-mapping = "jeida-24";
+ reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+ ivdd-supply = <&reg_buck5>;
+ ovdd-supply = <&reg_vext_3v3>;
+ txavcc18-supply = <&reg_buck5>;
+ txavcc33-supply = <&reg_vext_3v3>;
+ pvcc1-supply = <&reg_buck5>;
+ pvcc2-supply = <&reg_buck5>;
+ avcc-supply = <&reg_vext_3v3>;
+ anvdd-supply = <&reg_buck5>;
+ apvdd-supply = <&reg_buck5>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ dual-lvds-odd-pixels;
+
+ it6263_lvds_link1_dual: endpoint {
+ remote-endpoint = <&ldb_lvds_ch0>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ dual-lvds-even-pixels;
+
+ it6263_lvds_link2_dual: endpoint {
+ remote-endpoint = <&ldb_lvds_ch1>;
+ };
+ };
+
+ port@2 {
+ reg = <2>;
+
+ it6263_out_dual: endpoint {
+ remote-endpoint = <&hdmi_in>;
+ };
+ };
+ };
+ };
+ };
@@ -0,0 +1,966 @@
From aa3f6b62a24979e579323e77c8900064e7c725f1 Mon Sep 17 00:00:00 2001
From: Liu Ying <victor.liu@nxp.com>
Date: Mon, 4 Nov 2024 11:28:03 +0800
Subject: [PATCH 33/35] drm/bridge: Add ITE IT6263 LVDS to HDMI converter
Organization: Wires
Add basic HDMI video output support. Currently, only RGB888 output
pixel format is supported. At the LVDS input side, the driver
supports single LVDS link and dual LVDS links with "jeida-24" LVDS
mapping.
Product link:
https://www.ite.com.tw/en/product/cate1/IT6263
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Tested-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241104032806.611890-11-victor.liu@nxp.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/Kconfig | 11 +
drivers/gpu/drm/bridge/Makefile | 1 +
drivers/gpu/drm/bridge/ite-it6263.c | 898 ++++++++++++++++++++++++++++
3 files changed, 910 insertions(+)
create mode 100644 drivers/gpu/drm/bridge/ite-it6263.c
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 3eb955333c80..676286542706 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -90,6 +90,17 @@ config DRM_FSL_LDB
help
Support for i.MX8MP DPI-to-LVDS on-SoC encoder.
+config DRM_ITE_IT6263
+ tristate "ITE IT6263 LVDS/HDMI bridge"
+ depends on OF
+ select DRM_DISPLAY_HDMI_STATE_HELPER
+ select DRM_DISPLAY_HELPER
+ select DRM_BRIDGE_CONNECTOR
+ select DRM_KMS_HELPER
+ select REGMAP_I2C
+ help
+ ITE IT6263 LVDS to HDMI bridge chip driver.
+
config DRM_ITE_IT6505
tristate "ITE IT6505 DisplayPort bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 7df87b582dca..f3776dd473fd 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
obj-$(CONFIG_DRM_CROS_EC_ANX7688) += cros-ec-anx7688.o
obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
obj-$(CONFIG_DRM_FSL_LDB) += fsl-ldb.o
+obj-$(CONFIG_DRM_ITE_IT6263) += ite-it6263.o
obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
obj-$(CONFIG_DRM_LONTIUM_LT8912B) += lontium-lt8912b.o
obj-$(CONFIG_DRM_LONTIUM_LT9211) += lontium-lt9211.o
diff --git a/drivers/gpu/drm/bridge/ite-it6263.c b/drivers/gpu/drm/bridge/ite-it6263.c
new file mode 100644
index 000000000000..cbabd4e20d3e
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6263.c
@@ -0,0 +1,898 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2024 NXP
+ */
+
+#include <linux/bitfield.h>
+#include <linux/bits.h>
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
+#include <linux/hdmi.h>
+#include <linux/i2c.h>
+#include <linux/media-bus-format.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+
+#include <drm/display/drm_hdmi_helper.h>
+#include <drm/display/drm_hdmi_state_helper.h>
+#include <drm/drm_atomic.h>
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_atomic_state_helper.h>
+#include <drm/drm_bridge.h>
+#include <drm/drm_bridge_connector.h>
+#include <drm/drm_connector.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_edid.h>
+#include <drm/drm_of.h>
+#include <drm/drm_probe_helper.h>
+
+/* -----------------------------------------------------------------------------
+ * LVDS registers
+ */
+
+/* LVDS software reset registers */
+#define LVDS_REG_05 0x05
+#define REG_SOFT_P_RST BIT(1)
+
+/* LVDS system configuration registers */
+/* 0x0b */
+#define LVDS_REG_0B 0x0b
+#define REG_SSC_PCLK_RF BIT(0)
+#define REG_LVDS_IN_SWAP BIT(1)
+
+/* LVDS test pattern gen control registers */
+/* 0x2c */
+#define LVDS_REG_2C 0x2c
+#define REG_COL_DEP GENMASK(1, 0)
+#define BIT8 FIELD_PREP(REG_COL_DEP, 1)
+#define OUT_MAP BIT(4)
+#define JEIDA 0
+#define REG_DESSC_ENB BIT(6)
+#define DMODE BIT(7)
+#define DISO BIT(7)
+#define SISO 0
+
+#define LVDS_REG_3C 0x3c
+#define LVDS_REG_3F 0x3f
+#define LVDS_REG_47 0x47
+#define LVDS_REG_48 0x48
+#define LVDS_REG_4F 0x4f
+#define LVDS_REG_52 0x52
+
+/* -----------------------------------------------------------------------------
+ * HDMI registers are separated into three banks:
+ * 1) HDMI register common bank: 0x00 ~ 0x2f
+ */
+
+/* HDMI genernal registers */
+#define HDMI_REG_SW_RST 0x04
+#define SOFTREF_RST BIT(5)
+#define SOFTA_RST BIT(4)
+#define SOFTV_RST BIT(3)
+#define AUD_RST BIT(2)
+#define HDCP_RST BIT(0)
+#define HDMI_RST_ALL (SOFTREF_RST | SOFTA_RST | SOFTV_RST | \
+ AUD_RST | HDCP_RST)
+
+#define HDMI_REG_SYS_STATUS 0x0e
+#define HPDETECT BIT(6)
+#define TXVIDSTABLE BIT(4)
+
+#define HDMI_REG_BANK_CTRL 0x0f
+#define REG_BANK_SEL BIT(0)
+
+/* HDMI System DDC control registers */
+#define HDMI_REG_DDC_MASTER_CTRL 0x10
+#define MASTER_SEL_HOST BIT(0)
+
+#define HDMI_REG_DDC_HEADER 0x11
+
+#define HDMI_REG_DDC_REQOFF 0x12
+#define HDMI_REG_DDC_REQCOUNT 0x13
+#define HDMI_REG_DDC_EDIDSEG 0x14
+
+#define HDMI_REG_DDC_CMD 0x15
+#define DDC_CMD_EDID_READ 0x3
+#define DDC_CMD_FIFO_CLR 0x9
+
+#define HDMI_REG_DDC_STATUS 0x16
+#define DDC_DONE BIT(7)
+#define DDC_NOACK BIT(5)
+#define DDC_WAITBUS BIT(4)
+#define DDC_ARBILOSE BIT(3)
+#define DDC_ERROR (DDC_NOACK | DDC_WAITBUS | DDC_ARBILOSE)
+
+#define HDMI_DDC_FIFO_BYTES 32
+#define HDMI_REG_DDC_READFIFO 0x17
+#define HDMI_REG_LVDS_PORT 0x1d /* LVDS input control I2C addr */
+#define HDMI_REG_LVDS_PORT_EN 0x1e
+#define LVDS_INPUT_CTRL_I2C_ADDR 0x33
+
+/* -----------------------------------------------------------------------------
+ * 2) HDMI register bank0: 0x30 ~ 0xff
+ */
+
+/* HDMI AFE registers */
+#define HDMI_REG_AFE_DRV_CTRL 0x61
+#define AFE_DRV_PWD BIT(5)
+#define AFE_DRV_RST BIT(4)
+
+#define HDMI_REG_AFE_XP_CTRL 0x62
+#define AFE_XP_GAINBIT BIT(7)
+#define AFE_XP_ER0 BIT(4)
+#define AFE_XP_RESETB BIT(3)
+
+#define HDMI_REG_AFE_ISW_CTRL 0x63
+
+#define HDMI_REG_AFE_IP_CTRL 0x64
+#define AFE_IP_GAINBIT BIT(7)
+#define AFE_IP_ER0 BIT(3)
+#define AFE_IP_RESETB BIT(2)
+
+/* HDMI input data format registers */
+#define HDMI_REG_INPUT_MODE 0x70
+#define IN_RGB 0x00
+
+/* HDMI general control registers */
+#define HDMI_REG_HDMI_MODE 0xc0
+#define TX_HDMI_MODE BIT(0)
+
+#define HDMI_REG_GCP 0xc1
+#define AVMUTE BIT(0)
+#define HDMI_COLOR_DEPTH GENMASK(6, 4)
+#define HDMI_COLOR_DEPTH_24 FIELD_PREP(HDMI_COLOR_DEPTH, 4)
+
+#define HDMI_REG_PKT_GENERAL_CTRL 0xc6
+#define HDMI_REG_AVI_INFOFRM_CTRL 0xcd
+#define ENABLE_PKT BIT(0)
+#define REPEAT_PKT BIT(1)
+
+/* -----------------------------------------------------------------------------
+ * 3) HDMI register bank1: 0x130 ~ 0x1ff (HDMI packet registers)
+ */
+
+/* AVI packet registers */
+#define HDMI_REG_AVI_DB1 0x158
+#define HDMI_REG_AVI_DB2 0x159
+#define HDMI_REG_AVI_DB3 0x15a
+#define HDMI_REG_AVI_DB4 0x15b
+#define HDMI_REG_AVI_DB5 0x15c
+#define HDMI_REG_AVI_CSUM 0x15d
+#define HDMI_REG_AVI_DB6 0x15e
+#define HDMI_REG_AVI_DB7 0x15f
+#define HDMI_REG_AVI_DB8 0x160
+#define HDMI_REG_AVI_DB9 0x161
+#define HDMI_REG_AVI_DB10 0x162
+#define HDMI_REG_AVI_DB11 0x163
+#define HDMI_REG_AVI_DB12 0x164
+#define HDMI_REG_AVI_DB13 0x165
+
+#define HDMI_AVI_DB_CHUNK1_SIZE (HDMI_REG_AVI_DB5 - HDMI_REG_AVI_DB1 + 1)
+#define HDMI_AVI_DB_CHUNK2_SIZE (HDMI_REG_AVI_DB13 - HDMI_REG_AVI_DB6 + 1)
+
+/* IT6263 data sheet Rev0.8: LVDS RX supports input clock rate up to 150MHz. */
+#define MAX_PIXEL_CLOCK_KHZ 150000
+
+/* IT6263 programming guide Ver0.90: PCLK_HIGH for TMDS clock over 80MHz. */
+#define HIGH_PIXEL_CLOCK_KHZ 80000
+
+/*
+ * IT6263 data sheet Rev0.8: HDMI TX supports link speeds of up to 2.25Gbps
+ * (link clock rate of 225MHz).
+ */
+#define MAX_HDMI_TMDS_CHAR_RATE_HZ 225000000
+
+struct it6263 {
+ struct device *dev;
+ struct i2c_client *hdmi_i2c;
+ struct i2c_client *lvds_i2c;
+ struct regmap *hdmi_regmap;
+ struct regmap *lvds_regmap;
+ struct drm_bridge bridge;
+ struct drm_bridge *next_bridge;
+ int lvds_data_mapping;
+ bool lvds_dual_link;
+ bool lvds_link12_swap;
+};
+
+static inline struct it6263 *bridge_to_it6263(struct drm_bridge *bridge)
+{
+ return container_of(bridge, struct it6263, bridge);
+}
+
+static bool it6263_hdmi_writeable_reg(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case HDMI_REG_SW_RST:
+ case HDMI_REG_BANK_CTRL:
+ case HDMI_REG_DDC_MASTER_CTRL:
+ case HDMI_REG_DDC_HEADER:
+ case HDMI_REG_DDC_REQOFF:
+ case HDMI_REG_DDC_REQCOUNT:
+ case HDMI_REG_DDC_EDIDSEG:
+ case HDMI_REG_DDC_CMD:
+ case HDMI_REG_LVDS_PORT:
+ case HDMI_REG_LVDS_PORT_EN:
+ case HDMI_REG_AFE_DRV_CTRL:
+ case HDMI_REG_AFE_XP_CTRL:
+ case HDMI_REG_AFE_ISW_CTRL:
+ case HDMI_REG_AFE_IP_CTRL:
+ case HDMI_REG_INPUT_MODE:
+ case HDMI_REG_HDMI_MODE:
+ case HDMI_REG_GCP:
+ case HDMI_REG_PKT_GENERAL_CTRL:
+ case HDMI_REG_AVI_INFOFRM_CTRL:
+ case HDMI_REG_AVI_DB1:
+ case HDMI_REG_AVI_DB2:
+ case HDMI_REG_AVI_DB3:
+ case HDMI_REG_AVI_DB4:
+ case HDMI_REG_AVI_DB5:
+ case HDMI_REG_AVI_CSUM:
+ case HDMI_REG_AVI_DB6:
+ case HDMI_REG_AVI_DB7:
+ case HDMI_REG_AVI_DB8:
+ case HDMI_REG_AVI_DB9:
+ case HDMI_REG_AVI_DB10:
+ case HDMI_REG_AVI_DB11:
+ case HDMI_REG_AVI_DB12:
+ case HDMI_REG_AVI_DB13:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool it6263_hdmi_readable_reg(struct device *dev, unsigned int reg)
+{
+ if (it6263_hdmi_writeable_reg(dev, reg))
+ return true;
+
+ switch (reg) {
+ case HDMI_REG_SYS_STATUS:
+ case HDMI_REG_DDC_STATUS:
+ case HDMI_REG_DDC_READFIFO:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool it6263_hdmi_volatile_reg(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case HDMI_REG_SW_RST:
+ case HDMI_REG_SYS_STATUS:
+ case HDMI_REG_DDC_STATUS:
+ case HDMI_REG_DDC_READFIFO:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static const struct regmap_range_cfg it6263_hdmi_range_cfg = {
+ .range_min = 0x00,
+ .range_max = HDMI_REG_AVI_DB13,
+ .selector_reg = HDMI_REG_BANK_CTRL,
+ .selector_mask = REG_BANK_SEL,
+ .selector_shift = 0,
+ .window_start = 0x00,
+ .window_len = 0x100,
+};
+
+static const struct regmap_config it6263_hdmi_regmap_config = {
+ .name = "it6263-hdmi",
+ .reg_bits = 8,
+ .val_bits = 8,
+ .writeable_reg = it6263_hdmi_writeable_reg,
+ .readable_reg = it6263_hdmi_readable_reg,
+ .volatile_reg = it6263_hdmi_volatile_reg,
+ .max_register = HDMI_REG_AVI_DB13,
+ .ranges = &it6263_hdmi_range_cfg,
+ .num_ranges = 1,
+ .cache_type = REGCACHE_MAPLE,
+};
+
+static bool it6263_lvds_writeable_reg(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case LVDS_REG_05:
+ case LVDS_REG_0B:
+ case LVDS_REG_2C:
+ case LVDS_REG_3C:
+ case LVDS_REG_3F:
+ case LVDS_REG_47:
+ case LVDS_REG_48:
+ case LVDS_REG_4F:
+ case LVDS_REG_52:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool it6263_lvds_readable_reg(struct device *dev, unsigned int reg)
+{
+ return it6263_lvds_writeable_reg(dev, reg);
+}
+
+static bool it6263_lvds_volatile_reg(struct device *dev, unsigned int reg)
+{
+ return reg == LVDS_REG_05;
+}
+
+static const struct regmap_config it6263_lvds_regmap_config = {
+ .name = "it6263-lvds",
+ .reg_bits = 8,
+ .val_bits = 8,
+ .writeable_reg = it6263_lvds_writeable_reg,
+ .readable_reg = it6263_lvds_readable_reg,
+ .volatile_reg = it6263_lvds_volatile_reg,
+ .max_register = LVDS_REG_52,
+ .cache_type = REGCACHE_MAPLE,
+};
+
+static const char * const it6263_supplies[] = {
+ "ivdd", "ovdd", "txavcc18", "txavcc33", "pvcc1", "pvcc2",
+ "avcc", "anvdd", "apvdd"
+};
+
+static int it6263_parse_dt(struct it6263 *it)
+{
+ struct device *dev = it->dev;
+ struct device_node *port0, *port1;
+ int ret = 0;
+
+ it->lvds_data_mapping = drm_of_lvds_get_data_mapping(dev->of_node);
+ if (it->lvds_data_mapping < 0) {
+ dev_err(dev, "%pOF: invalid or missing %s DT property: %d\n",
+ dev->of_node, "data-mapping", it->lvds_data_mapping);
+ return it->lvds_data_mapping;
+ }
+
+ it->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 2, 0);
+ if (IS_ERR(it->next_bridge))
+ return dev_err_probe(dev, PTR_ERR(it->next_bridge),
+ "failed to get next bridge\n");
+
+ port0 = of_graph_get_port_by_id(dev->of_node, 0);
+ port1 = of_graph_get_port_by_id(dev->of_node, 1);
+ if (port0 && port1) {
+ int order;
+
+ it->lvds_dual_link = true;
+ order = drm_of_lvds_get_dual_link_pixel_order_sink(port0, port1);
+ if (order < 0) {
+ dev_err(dev,
+ "failed to get dual link pixel order: %d\n",
+ order);
+ ret = order;
+ } else if (order == DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS) {
+ it->lvds_link12_swap = true;
+ }
+ } else if (port1) {
+ ret = -EINVAL;
+ dev_err(dev, "single input LVDS port1 is not supported\n");
+ } else if (!port0) {
+ ret = -EINVAL;
+ dev_err(dev, "no input LVDS port\n");
+ }
+
+ of_node_put(port0);
+ of_node_put(port1);
+
+ return ret;
+}
+
+static inline void it6263_hw_reset(struct gpio_desc *reset_gpio)
+{
+ if (!reset_gpio)
+ return;
+
+ gpiod_set_value_cansleep(reset_gpio, 0);
+ fsleep(1000);
+ gpiod_set_value_cansleep(reset_gpio, 1);
+ /* The chip maker says the low pulse should be at least 40ms. */
+ fsleep(40000);
+ gpiod_set_value_cansleep(reset_gpio, 0);
+ /* addtional time to wait the high voltage to be stable */
+ fsleep(5000);
+}
+
+static inline int it6263_lvds_set_i2c_addr(struct it6263 *it)
+{
+ int ret;
+
+ ret = regmap_write(it->hdmi_regmap, HDMI_REG_LVDS_PORT,
+ LVDS_INPUT_CTRL_I2C_ADDR << 1);
+ if (ret)
+ return ret;
+
+ return regmap_write(it->hdmi_regmap, HDMI_REG_LVDS_PORT_EN, BIT(0));
+}
+
+static inline void it6263_lvds_reset(struct it6263 *it)
+{
+ /* AFE PLL reset */
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_3C, BIT(0), 0x0);
+ fsleep(1000);
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_3C, BIT(0), BIT(0));
+
+ /* software pixel clock domain reset */
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_05, REG_SOFT_P_RST,
+ REG_SOFT_P_RST);
+ fsleep(1000);
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_05, REG_SOFT_P_RST, 0x0);
+ fsleep(10000);
+}
+
+static inline void it6263_lvds_set_interface(struct it6263 *it)
+{
+ /* color depth */
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, REG_COL_DEP, BIT8);
+ /* output mapping */
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, OUT_MAP, JEIDA);
+
+ if (it->lvds_dual_link) {
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, DMODE, DISO);
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_52, BIT(1), BIT(1));
+ } else {
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, DMODE, SISO);
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_52, BIT(1), 0);
+ }
+}
+
+static inline void it6263_lvds_set_afe(struct it6263 *it)
+{
+ regmap_write(it->lvds_regmap, LVDS_REG_3C, 0xaa);
+ regmap_write(it->lvds_regmap, LVDS_REG_3F, 0x02);
+ regmap_write(it->lvds_regmap, LVDS_REG_47, 0xaa);
+ regmap_write(it->lvds_regmap, LVDS_REG_48, 0x02);
+ regmap_write(it->lvds_regmap, LVDS_REG_4F, 0x11);
+
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_0B, REG_SSC_PCLK_RF,
+ REG_SSC_PCLK_RF);
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_3C, 0x07, 0);
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, REG_DESSC_ENB,
+ REG_DESSC_ENB);
+}
+
+static inline void it6263_lvds_sys_cfg(struct it6263 *it)
+{
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_0B, REG_LVDS_IN_SWAP,
+ it->lvds_link12_swap ? REG_LVDS_IN_SWAP : 0);
+}
+
+static inline void it6263_lvds_config(struct it6263 *it)
+{
+ it6263_lvds_reset(it);
+ it6263_lvds_set_interface(it);
+ it6263_lvds_set_afe(it);
+ it6263_lvds_sys_cfg(it);
+}
+
+static inline void it6263_hdmi_config(struct it6263 *it)
+{
+ regmap_write(it->hdmi_regmap, HDMI_REG_SW_RST, HDMI_RST_ALL);
+ regmap_write(it->hdmi_regmap, HDMI_REG_INPUT_MODE, IN_RGB);
+ regmap_write_bits(it->hdmi_regmap, HDMI_REG_GCP, HDMI_COLOR_DEPTH,
+ HDMI_COLOR_DEPTH_24);
+}
+
+static enum drm_connector_status it6263_detect(struct it6263 *it)
+{
+ unsigned int val;
+
+ regmap_read(it->hdmi_regmap, HDMI_REG_SYS_STATUS, &val);
+ if (val & HPDETECT)
+ return connector_status_connected;
+ else
+ return connector_status_disconnected;
+}
+
+static int it6263_read_edid(void *data, u8 *buf, unsigned int block, size_t len)
+{
+ struct it6263 *it = data;
+ struct regmap *regmap = it->hdmi_regmap;
+ unsigned int start = (block % 2) * EDID_LENGTH;
+ unsigned int segment = block >> 1;
+ unsigned int count, val;
+ int ret;
+
+ regmap_write(regmap, HDMI_REG_DDC_MASTER_CTRL, MASTER_SEL_HOST);
+ regmap_write(regmap, HDMI_REG_DDC_HEADER, DDC_ADDR << 1);
+ regmap_write(regmap, HDMI_REG_DDC_EDIDSEG, segment);
+
+ while (len) {
+ /* clear DDC FIFO */
+ regmap_write(regmap, HDMI_REG_DDC_CMD, DDC_CMD_FIFO_CLR);
+
+ ret = regmap_read_poll_timeout(regmap, HDMI_REG_DDC_STATUS,
+ val, val & DDC_DONE,
+ 2000, 10000);
+ if (ret) {
+ dev_err(it->dev, "failed to clear DDC FIFO:%d\n", ret);
+ return ret;
+ }
+
+ count = len > HDMI_DDC_FIFO_BYTES ? HDMI_DDC_FIFO_BYTES : len;
+
+ /* fire the read command */
+ regmap_write(regmap, HDMI_REG_DDC_REQOFF, start);
+ regmap_write(regmap, HDMI_REG_DDC_REQCOUNT, count);
+ regmap_write(regmap, HDMI_REG_DDC_CMD, DDC_CMD_EDID_READ);
+
+ start += count;
+ len -= count;
+
+ ret = regmap_read_poll_timeout(regmap, HDMI_REG_DDC_STATUS, val,
+ val & (DDC_DONE | DDC_ERROR),
+ 20000, 250000);
+ if (ret && !(val & DDC_ERROR)) {
+ dev_err(it->dev, "failed to read EDID:%d\n", ret);
+ return ret;
+ }
+
+ if (val & DDC_ERROR) {
+ dev_err(it->dev, "DDC error\n");
+ return -EIO;
+ }
+
+ /* cache to buffer */
+ for (; count > 0; count--) {
+ regmap_read(regmap, HDMI_REG_DDC_READFIFO, &val);
+ *(buf++) = val;
+ }
+ }
+
+ return 0;
+}
+
+static int it6263_bridge_atomic_check(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
+{
+ return drm_atomic_helper_connector_hdmi_check(conn_state->connector,
+ conn_state->state);
+}
+
+static void
+it6263_bridge_atomic_disable(struct drm_bridge *bridge,
+ struct drm_bridge_state *old_bridge_state)
+{
+ struct it6263 *it = bridge_to_it6263(bridge);
+
+ regmap_write_bits(it->hdmi_regmap, HDMI_REG_GCP, AVMUTE, AVMUTE);
+ regmap_write(it->hdmi_regmap, HDMI_REG_PKT_GENERAL_CTRL, 0);
+ regmap_write(it->hdmi_regmap, HDMI_REG_AFE_DRV_CTRL,
+ AFE_DRV_RST | AFE_DRV_PWD);
+}
+
+static void
+it6263_bridge_atomic_enable(struct drm_bridge *bridge,
+ struct drm_bridge_state *old_bridge_state)
+{
+ struct drm_atomic_state *state = old_bridge_state->base.state;
+ struct it6263 *it = bridge_to_it6263(bridge);
+ const struct drm_crtc_state *crtc_state;
+ struct regmap *regmap = it->hdmi_regmap;
+ const struct drm_display_mode *mode;
+ struct drm_connector *connector;
+ bool is_stable = false;
+ struct drm_crtc *crtc;
+ unsigned int val;
+ bool pclk_high;
+ int i, ret;
+
+ connector = drm_atomic_get_new_connector_for_encoder(state,
+ bridge->encoder);
+ crtc = drm_atomic_get_new_connector_state(state, connector)->crtc;
+ crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
+ mode = &crtc_state->adjusted_mode;
+
+ regmap_write(regmap, HDMI_REG_HDMI_MODE, TX_HDMI_MODE);
+
+ drm_atomic_helper_connector_hdmi_update_infoframes(connector, state);
+
+ /* HDMI AFE setup */
+ pclk_high = mode->clock > HIGH_PIXEL_CLOCK_KHZ;
+ regmap_write(regmap, HDMI_REG_AFE_DRV_CTRL, AFE_DRV_RST);
+ if (pclk_high)
+ regmap_write(regmap, HDMI_REG_AFE_XP_CTRL,
+ AFE_XP_GAINBIT | AFE_XP_RESETB);
+ else
+ regmap_write(regmap, HDMI_REG_AFE_XP_CTRL,
+ AFE_XP_ER0 | AFE_XP_RESETB);
+ regmap_write(regmap, HDMI_REG_AFE_ISW_CTRL, 0x10);
+ if (pclk_high)
+ regmap_write(regmap, HDMI_REG_AFE_IP_CTRL,
+ AFE_IP_GAINBIT | AFE_IP_RESETB);
+ else
+ regmap_write(regmap, HDMI_REG_AFE_IP_CTRL,
+ AFE_IP_ER0 | AFE_IP_RESETB);
+
+ /* HDMI software video reset */
+ regmap_write_bits(regmap, HDMI_REG_SW_RST, SOFTV_RST, SOFTV_RST);
+ fsleep(1000);
+ regmap_write_bits(regmap, HDMI_REG_SW_RST, SOFTV_RST, 0);
+
+ /* reconfigure LVDS and retry several times in case video is instable */
+ for (i = 0; i < 3; i++) {
+ ret = regmap_read_poll_timeout(regmap, HDMI_REG_SYS_STATUS, val,
+ val & TXVIDSTABLE,
+ 20000, 500000);
+ if (!ret) {
+ is_stable = true;
+ break;
+ }
+
+ it6263_lvds_config(it);
+ }
+
+ if (!is_stable)
+ dev_warn(it->dev, "failed to wait for video stable\n");
+
+ /* HDMI AFE reset release and power up */
+ regmap_write(regmap, HDMI_REG_AFE_DRV_CTRL, 0);
+
+ regmap_write_bits(regmap, HDMI_REG_GCP, AVMUTE, 0);
+
+ regmap_write(regmap, HDMI_REG_PKT_GENERAL_CTRL, ENABLE_PKT | REPEAT_PKT);
+}
+
+static enum drm_mode_status
+it6263_bridge_mode_valid(struct drm_bridge *bridge,
+ const struct drm_display_info *info,
+ const struct drm_display_mode *mode)
+{
+ unsigned long long rate;
+
+ rate = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB);
+ if (rate == 0)
+ return MODE_NOCLOCK;
+
+ return bridge->funcs->hdmi_tmds_char_rate_valid(bridge, mode, rate);
+}
+
+static int it6263_bridge_attach(struct drm_bridge *bridge,
+ enum drm_bridge_attach_flags flags)
+{
+ struct it6263 *it = bridge_to_it6263(bridge);
+ struct drm_connector *connector;
+ int ret;
+
+ ret = drm_bridge_attach(bridge->encoder, it->next_bridge, bridge,
+ flags | DRM_BRIDGE_ATTACH_NO_CONNECTOR);
+ if (ret < 0)
+ return ret;
+
+ if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
+ return 0;
+
+ connector = drm_bridge_connector_init(bridge->dev, bridge->encoder);
+ if (IS_ERR(connector)) {
+ ret = PTR_ERR(connector);
+ dev_err(it->dev, "failed to initialize bridge connector: %d\n",
+ ret);
+ return ret;
+ }
+
+ drm_connector_attach_encoder(connector, bridge->encoder);
+
+ return 0;
+}
+
+static enum drm_connector_status it6263_bridge_detect(struct drm_bridge *bridge)
+{
+ struct it6263 *it = bridge_to_it6263(bridge);
+
+ return it6263_detect(it);
+}
+
+static const struct drm_edid *
+it6263_bridge_edid_read(struct drm_bridge *bridge,
+ struct drm_connector *connector)
+{
+ struct it6263 *it = bridge_to_it6263(bridge);
+
+ return drm_edid_read_custom(connector, it6263_read_edid, it);
+}
+
+static u32 *
+it6263_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state,
+ u32 output_fmt,
+ unsigned int *num_input_fmts)
+{
+ struct it6263 *it = bridge_to_it6263(bridge);
+ u32 *input_fmts;
+
+ *num_input_fmts = 0;
+
+ if (it->lvds_data_mapping != MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA)
+ return NULL;
+
+ input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL);
+ if (!input_fmts)
+ return NULL;
+
+ input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
+ *num_input_fmts = 1;
+
+ return input_fmts;
+}
+
+static enum drm_mode_status
+it6263_hdmi_tmds_char_rate_valid(const struct drm_bridge *bridge,
+ const struct drm_display_mode *mode,
+ unsigned long long tmds_rate)
+{
+ if (mode->clock > MAX_PIXEL_CLOCK_KHZ)
+ return MODE_CLOCK_HIGH;
+
+ if (tmds_rate > MAX_HDMI_TMDS_CHAR_RATE_HZ)
+ return MODE_CLOCK_HIGH;
+
+ return MODE_OK;
+}
+
+static int it6263_hdmi_clear_infoframe(struct drm_bridge *bridge,
+ enum hdmi_infoframe_type type)
+{
+ struct it6263 *it = bridge_to_it6263(bridge);
+
+ if (type == HDMI_INFOFRAME_TYPE_AVI)
+ regmap_write(it->hdmi_regmap, HDMI_REG_AVI_INFOFRM_CTRL, 0);
+ else
+ dev_dbg(it->dev, "unsupported HDMI infoframe 0x%x\n", type);
+
+ return 0;
+}
+
+static int it6263_hdmi_write_infoframe(struct drm_bridge *bridge,
+ enum hdmi_infoframe_type type,
+ const u8 *buffer, size_t len)
+{
+ struct it6263 *it = bridge_to_it6263(bridge);
+ struct regmap *regmap = it->hdmi_regmap;
+
+ if (type != HDMI_INFOFRAME_TYPE_AVI) {
+ dev_dbg(it->dev, "unsupported HDMI infoframe 0x%x\n", type);
+ return 0;
+ }
+
+ /* write the first AVI infoframe data byte chunk(DB1-DB5) */
+ regmap_bulk_write(regmap, HDMI_REG_AVI_DB1,
+ &buffer[HDMI_INFOFRAME_HEADER_SIZE],
+ HDMI_AVI_DB_CHUNK1_SIZE);
+
+ /* write the second AVI infoframe data byte chunk(DB6-DB13) */
+ regmap_bulk_write(regmap, HDMI_REG_AVI_DB6,
+ &buffer[HDMI_INFOFRAME_HEADER_SIZE +
+ HDMI_AVI_DB_CHUNK1_SIZE],
+ HDMI_AVI_DB_CHUNK2_SIZE);
+
+ /* write checksum */
+ regmap_write(regmap, HDMI_REG_AVI_CSUM, buffer[3]);
+
+ regmap_write(regmap, HDMI_REG_AVI_INFOFRM_CTRL, ENABLE_PKT | REPEAT_PKT);
+
+ return 0;
+}
+
+static const struct drm_bridge_funcs it6263_bridge_funcs = {
+ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
+ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
+ .atomic_reset = drm_atomic_helper_bridge_reset,
+ .attach = it6263_bridge_attach,
+ .mode_valid = it6263_bridge_mode_valid,
+ .atomic_disable = it6263_bridge_atomic_disable,
+ .atomic_enable = it6263_bridge_atomic_enable,
+ .atomic_check = it6263_bridge_atomic_check,
+ .detect = it6263_bridge_detect,
+ .edid_read = it6263_bridge_edid_read,
+ .atomic_get_input_bus_fmts = it6263_bridge_atomic_get_input_bus_fmts,
+ .hdmi_tmds_char_rate_valid = it6263_hdmi_tmds_char_rate_valid,
+ .hdmi_clear_infoframe = it6263_hdmi_clear_infoframe,
+ .hdmi_write_infoframe = it6263_hdmi_write_infoframe,
+};
+
+static int it6263_probe(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+ struct gpio_desc *reset_gpio;
+ struct it6263 *it;
+ int ret;
+
+ it = devm_kzalloc(dev, sizeof(*it), GFP_KERNEL);
+ if (!it)
+ return -ENOMEM;
+
+ it->dev = dev;
+ it->hdmi_i2c = client;
+
+ it->hdmi_regmap = devm_regmap_init_i2c(client,
+ &it6263_hdmi_regmap_config);
+ if (IS_ERR(it->hdmi_regmap))
+ return dev_err_probe(dev, PTR_ERR(it->hdmi_regmap),
+ "failed to init I2C regmap for HDMI\n");
+
+ reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(reset_gpio))
+ return dev_err_probe(dev, PTR_ERR(reset_gpio),
+ "failed to get reset gpio\n");
+
+ ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(it6263_supplies),
+ it6263_supplies);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to get power supplies\n");
+
+ ret = it6263_parse_dt(it);
+ if (ret)
+ return ret;
+
+ it6263_hw_reset(reset_gpio);
+
+ ret = it6263_lvds_set_i2c_addr(it);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to set I2C addr\n");
+
+ it->lvds_i2c = devm_i2c_new_dummy_device(dev, client->adapter,
+ LVDS_INPUT_CTRL_I2C_ADDR);
+ if (IS_ERR(it->lvds_i2c))
+ dev_err_probe(it->dev, PTR_ERR(it->lvds_i2c),
+ "failed to allocate I2C device for LVDS\n");
+
+ it->lvds_regmap = devm_regmap_init_i2c(it->lvds_i2c,
+ &it6263_lvds_regmap_config);
+ if (IS_ERR(it->lvds_regmap))
+ return dev_err_probe(dev, PTR_ERR(it->lvds_regmap),
+ "failed to init I2C regmap for LVDS\n");
+
+ it6263_lvds_config(it);
+ it6263_hdmi_config(it);
+
+ i2c_set_clientdata(client, it);
+
+ it->bridge.funcs = &it6263_bridge_funcs;
+ it->bridge.of_node = dev->of_node;
+ /* IT6263 chip doesn't support HPD interrupt. */
+ it->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID |
+ DRM_BRIDGE_OP_HDMI;
+ it->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
+ it->bridge.vendor = "ITE";
+ it->bridge.product = "IT6263";
+
+ return devm_drm_bridge_add(dev, &it->bridge);
+}
+
+static const struct of_device_id it6263_of_match[] = {
+ { .compatible = "ite,it6263", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, it6263_of_match);
+
+static const struct i2c_device_id it6263_i2c_ids[] = {
+ { "it6263", 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, it6263_i2c_ids);
+
+static struct i2c_driver it6263_driver = {
+ .probe = it6263_probe,
+ .driver = {
+ .name = "it6263",
+ .of_match_table = it6263_of_match,
+ },
+ .id_table = it6263_i2c_ids,
+};
+module_i2c_driver(it6263_driver);
+
+MODULE_DESCRIPTION("ITE Tech. Inc. IT6263 LVDS/HDMI bridge");
+MODULE_AUTHOR("Liu Ying <victor.liu@nxp.com>");
+MODULE_LICENSE("GPL");
@@ -0,0 +1,82 @@
From 40dbdab340dfc6c4392479d726999db6b4ed2713 Mon Sep 17 00:00:00 2001
From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Date: Thu, 5 Dec 2024 09:02:10 +0100
Subject: [PATCH 34/35] drm/bridge: ite-it6263: Support VESA-24 input format
Organization: Wires
Introduce it6263_is_input_bus_fmt_valid() and refactor the
it6263_bridge_atomic_get_input_bus_fmts() function to support VESA-24
format by selecting the LVDS input format based on the LVDS data mapping
and thereby support both JEIDA-24 and VESA-24 input formats.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Liu Ying <victor.liu@nxp.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241205080210.1285385-1-tommaso.merciai.xr@bp.renesas.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/ite-it6263.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6263.c b/drivers/gpu/drm/bridge/ite-it6263.c
index cbabd4e20d3e..3fc5c6795487 100644
--- a/drivers/gpu/drm/bridge/ite-it6263.c
+++ b/drivers/gpu/drm/bridge/ite-it6263.c
@@ -48,6 +48,7 @@
#define REG_COL_DEP GENMASK(1, 0)
#define BIT8 FIELD_PREP(REG_COL_DEP, 1)
#define OUT_MAP BIT(4)
+#define VESA BIT(4)
#define JEIDA 0
#define REG_DESSC_ENB BIT(6)
#define DMODE BIT(7)
@@ -428,12 +429,30 @@ static inline void it6263_lvds_reset(struct it6263 *it)
fsleep(10000);
}
+static inline bool it6263_is_input_bus_fmt_valid(int input_fmt)
+{
+ switch (input_fmt) {
+ case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA:
+ case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG:
+ return true;
+ }
+ return false;
+}
+
static inline void it6263_lvds_set_interface(struct it6263 *it)
{
+ u8 fmt;
+
/* color depth */
regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, REG_COL_DEP, BIT8);
+
+ if (it->lvds_data_mapping == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG)
+ fmt = VESA;
+ else
+ fmt = JEIDA;
+
/* output mapping */
- regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, OUT_MAP, JEIDA);
+ regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, OUT_MAP, fmt);
if (it->lvds_dual_link) {
regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, DMODE, DISO);
@@ -714,14 +733,14 @@ it6263_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
*num_input_fmts = 0;
- if (it->lvds_data_mapping != MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA)
+ if (!it6263_is_input_bus_fmt_valid(it->lvds_data_mapping))
return NULL;
input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL);
if (!input_fmts)
return NULL;
- input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
+ input_fmts[0] = it->lvds_data_mapping;
*num_input_fmts = 1;
return input_fmts;
@@ -0,0 +1,36 @@
From ee2b394cbd2efd3a38151bfb5b244012ab0f05b8 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter@linaro.org>
Date: Tue, 12 Nov 2024 13:23:03 +0300
Subject: [PATCH 35/35] drm/bridge: ite-it6263: Prevent error pointer
dereference in probe()
Organization: Wires
If devm_i2c_new_dummy_device() fails then we were supposed to return an
error code, but instead the function continues and will crash on the next
line. Add the missing return statement.
Fixes: 049723628716 ("drm/bridge: Add ITE IT6263 LVDS to HDMI converter")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Liu Ying <victor.liu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Link: https://patchwork.freedesktop.org/patch/msgid/804a758b-f2e7-4116-b72d-29bc8905beed@stanley.mountain
---
drivers/gpu/drm/bridge/ite-it6263.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6263.c b/drivers/gpu/drm/bridge/ite-it6263.c
index 3fc5c6795487..9608e83ca894 100644
--- a/drivers/gpu/drm/bridge/ite-it6263.c
+++ b/drivers/gpu/drm/bridge/ite-it6263.c
@@ -864,8 +864,8 @@ static int it6263_probe(struct i2c_client *client)
it->lvds_i2c = devm_i2c_new_dummy_device(dev, client->adapter,
LVDS_INPUT_CTRL_I2C_ADDR);
if (IS_ERR(it->lvds_i2c))
- dev_err_probe(it->dev, PTR_ERR(it->lvds_i2c),
- "failed to allocate I2C device for LVDS\n");
+ return dev_err_probe(it->dev, PTR_ERR(it->lvds_i2c),
+ "failed to allocate I2C device for LVDS\n");
it->lvds_regmap = devm_regmap_init_i2c(it->lvds_i2c,
&it6263_lvds_regmap_config);
+2 -3
View File
@@ -1,3 +1,2 @@
# Locally calculated
sha256 9ac322d85bcf98a04667d929f5c2666b15bd58c6c2d68dd512c72acbced07d04 linux-6.8.2.tar.xz
sha256 fa5f22fd67dd05812d39dca579320c493048e26c4a556048a12385e7ae6fc698 linux-6.10.3.tar.xz
# Calculated with ../utils/kernel-refresh.sh
sha256 c8af780f6f613ca24622116e4c512a764335ab66e75c6643003c16e49a8e3b90 linux-6.12.25.tar.xz
+12 -2
View File
@@ -1,5 +1,15 @@
--- a/agent/snmpd.c 2023-11-10 08:51:59.539942616 +0100
+++ b/agent/snmpd.c 2023-11-10 08:56:27.719112830 +0100
diff -urN netsnmp-5.9.3.orig/agent/snmpd.c netsnmp-5.9.3/agent/snmpd.c
--- netsnmp-5.9.3.orig/agent/snmpd.c 2025-03-04 18:09:48.420162455 +0100
+++ netsnmp-5.9.3/agent/snmpd.c 2025-03-04 18:13:48.149281606 +0100
@@ -123,7 +123,7 @@
# define PATH_MAX 255
# endif
#endif
-
+#include <sys/stat.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "agent_global_vars.h"
@@ -179,6 +179,7 @@
#define TIMETICK 500000L
@@ -0,0 +1,30 @@
From 1aed761c6e4148d2800b73500df769dfee4fea6e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= <lazzer@gmail.com>
Date: Wed, 5 Mar 2025 08:38:22 +0100
Subject: [PATCH] Remove pip-tools as a requirement
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Wires
It is not used.
Signed-off-by: Mattias Walström <lazzer@gmail.com>
---
pyproject.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyproject.toml b/pyproject.toml
index 5b4eb3e..66b735b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,5 +1,5 @@
[build-system]
-requires = ["setuptools", "wheel", "pip-tools"]
+requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
[project]
--
2.43.0
@@ -17,11 +17,11 @@ Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
src/main.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/src/main.c b/src/main.c
index 70bb7b5..cfc8607 100644
--- a/src/main.c
+++ b/src/main.c
@@ -9,6 +9,7 @@
diff -urN rauc-1.13.orig/src/main.c rauc-1.13/src/main.c
--- rauc-1.13.orig/src/main.c 2025-03-04 14:55:59.671534612 +0100
+++ rauc-1.13/src/main.c 2025-03-04 14:57:13.022772424 +0100
@@ -10,6 +10,7 @@
#include <locale.h>
#include <stdio.h>
#include <string.h>
@@ -29,7 +29,7 @@ index 70bb7b5..cfc8607 100644
#include <sys/ioctl.h>
#include <unistd.h>
@@ -1961,6 +1962,38 @@ static gboolean unknown_start(int argc, char **argv)
@@ -2460,6 +2461,38 @@
return TRUE;
}
@@ -68,25 +68,25 @@ index 70bb7b5..cfc8607 100644
typedef enum {
UNKNOWN = 0,
INSTALL,
@@ -2142,7 +2175,7 @@ static void create_option_groups(void)
@@ -2676,7 +2709,7 @@
static void cmdline_handler(int argc, char **argv)
{
- gboolean help = FALSE, debug = FALSE, version = FALSE;
+ gboolean help = FALSE, debug = FALSE, use_syslog = FALSE, version = FALSE;
gchar *confpath = NULL, *keyring = NULL, **intermediate = NULL, *mount = NULL;
g_autofree gchar *confpath = NULL, *keyring = NULL, *mount = NULL;
char *cmdarg = NULL;
g_autoptr(GOptionContext) context = NULL;
@@ -2155,6 +2188,7 @@ static void cmdline_handler(int argc, char **argv)
{"intermediate", '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &intermediate, "intermediate CA file name", "PEMFILE"},
@@ -2690,6 +2723,7 @@
{"intermediate", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME_ARRAY, &intermediate, "intermediate CA file or PKCS#11 URL", "PEMFILE|PKCS11-URL"},
{"mount", '\0', 0, G_OPTION_ARG_FILENAME, &mount, "mount prefix", "PATH"},
{"debug", 'd', 0, G_OPTION_ARG_NONE, &debug, "enable debug output", NULL},
+ {"syslog", 's', 0, G_OPTION_ARG_NONE, &use_syslog, "use syslog instead of stdout", NULL},
{"version", '\0', 0, G_OPTION_ARG_NONE, &version, "display version", NULL},
{"help", 'h', 0, G_OPTION_ARG_NONE, &help, NULL, NULL},
{"help", 'h', 0, G_OPTION_ARG_NONE, &help, "display help and exit", NULL},
{0}
@@ -2269,6 +2303,15 @@ static void cmdline_handler(int argc, char **argv)
g_message("Debug log domains: '%s'", domains);
@@ -2816,6 +2850,15 @@
);
}
+ if (use_syslog) {
@@ -101,6 +101,3 @@ index 70bb7b5..cfc8607 100644
/* get first parameter without dashes */
for (gint i = 1; i <= argc; i++) {
if (argv[i] && !g_str_has_prefix(argv[i], "-")) {
--
2.34.1
@@ -1,29 +0,0 @@
From 6d1d38458c911b281fa7da59ce01cec590bc1c64 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Thu, 23 Nov 2023 17:16:16 +0100
Subject: [PATCH 1/2] src/bundle: enable tftp protocol
Organization: Addiva Elektronik
Despite its age, TFTP still reigns strong in some sectors. Enable it
for KernelKit//Infix.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/bundle.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/bundle.c b/src/bundle.c
index 05d4e72..b70e191 100644
--- a/src/bundle.c
+++ b/src/bundle.c
@@ -1322,6 +1322,7 @@ static gboolean is_remote_scheme(const gchar *scheme)
{
return (g_strcmp0(scheme, "http") == 0) ||
(g_strcmp0(scheme, "https") == 0) ||
+ (g_strcmp0(scheme, "tftp") == 0) ||
(g_strcmp0(scheme, "sftp") == 0) ||
(g_strcmp0(scheme, "ftp") == 0);
}
--
2.34.1
@@ -1,117 +0,0 @@
From ad9a464806fe27fe65d403f56f1dc701f7d0a10a Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Wed, 24 Apr 2024 13:19:09 +0200
Subject: [PATCH 01/17] Fix #72: loss of raw kernel log messages to console
Organization: Addiva Elektronik
This patch adds a command line flag `-l` to keep kernel logs to console.
A feature requested by embedded Linux users which often navigate issues
by console output.
With properly configured kernel logging, e.g., `quiet`, only error and
above in severity is logged by the kernel directly to the console. So
for most users this would be a useful behavior.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
man/syslogd.8 | 18 +++++++++++++++++-
src/syslogd.c | 10 +++++++++-
src/syslogd.h | 4 ++--
3 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/man/syslogd.8 b/man/syslogd.8
index dcfb564..70f1b8b 100644
--- a/man/syslogd.8
+++ b/man/syslogd.8
@@ -38,7 +38,7 @@
.Nd log systems messages
.Sh SYNOPSIS
.Nm
-.Op Fl ?468AcdFHKknsTtv
+.Op Fl ?468AcdFHKklnsTtv
.Op Fl a Ar addr[/len][:port]
.Op Fl a Ar name[:port]
.Op Fl b Ar addr[:port]
@@ -292,6 +292,22 @@ Usually the
.Dq kern
facility is reserved for messages read directly from
.Pa /dev/kmsg .
+.It Fl l
+Keep kernel console logging. By default
+.Nm
+call
+.Xr klogctl 2
+to disable the kernel's logging to console after having opened
+.Pa /dev/kmsg .
+With this option the kernel's log level can be adjusted using
+.Xr sysctl 8 ,
+or the kernel command line, to suit your logging needs to the console.
+.Pp
+Please note, this does not affect logging of kernel messages, see
+.Fl K ,
+only what the kernel logs to
+.Pa /dev/console .
+Also, this is only applicable to Linux.
.It Fl m Ar interval
Select the number of minutes between
.Dq mark
diff --git a/src/syslogd.c b/src/syslogd.c
index c02d064..c9ea7fd 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -154,6 +154,7 @@ static int RemoteHostname; /* Log remote hostname from the message */
static int KernLog = 1; /* Track kernel logs by default */
static int KeepKernFac; /* Keep remotely logged kernel facility */
static int KeepKernTime; /* Keep kernel timestamp, evern after initial read */
+static int KeepKernConsole; /* Keep kernel logging to console */
static off_t RotateSz = 0; /* Max file size (bytes) before rotating, disabled by default */
static int RotateCnt = 5; /* Max number (count) of log files to keep, set with -c <NUM> */
@@ -363,6 +364,9 @@ int usage(int code)
" -H Use hostname from message instead of address for remote messages\n"
" -K Disable kernel logging, useful in container use-cases\n"
" -k Allow logging with facility 'kernel', otherwise remapped to 'user'\n"
+#ifdef __linux__
+ " -l Keep kernel logging to console, use sysctl to adjust kernel.printk\n"
+#endif
" -m MINS Interval between MARK messages, 0 to disable, default: 20 min\n"
" -n Disable DNS query for every request\n"
" -P FILE File to store the process ID, default: %s\n"
@@ -397,7 +401,7 @@ int main(int argc, char *argv[])
char *ptr;
int ch;
- while ((ch = getopt(argc, argv, "468Aa:b:C:cdHFf:Kkm:nP:p:r:sTtv?")) != EOF) {
+ while ((ch = getopt(argc, argv, "468Aa:b:C:cdHFf:Kklm:nP:p:r:sTtv?")) != EOF) {
switch ((char)ch) {
case '4':
family = PF_INET;
@@ -464,6 +468,10 @@ int main(int argc, char *argv[])
KeepKernFac = 1;
break;
+ case 'l':
+ KeepKernConsole = 1;
+ break;
+
case 'm': /* mark interval */
MarkInterval = atoi(optarg) * 60;
break;
diff --git a/src/syslogd.h b/src/syslogd.h
index 68ceafb..1703df2 100644
--- a/src/syslogd.h
+++ b/src/syslogd.h
@@ -169,8 +169,8 @@
#define SYSLOG_ACTION_CONSOLE_ON 7
#ifdef __linux__
-#define kern_console_off() klogctl(SYSLOG_ACTION_CONSOLE_OFF, NULL, 0)
-#define kern_console_on() klogctl(SYSLOG_ACTION_CONSOLE_ON, NULL, 0)
+#define kern_console_off() if (!KeepKernConsole) klogctl(SYSLOG_ACTION_CONSOLE_OFF, NULL, 0)
+#define kern_console_on() if (!KeepKernConsole) klogctl(SYSLOG_ACTION_CONSOLE_ON, NULL, 0)
#else
#define kern_console_off() do { } while (0)
#define kern_console_on() do { } while (0)
--
2.43.0
@@ -1,177 +0,0 @@
From 7e0882688b0ea459c850e6e0ace66cca7100fd0a Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Fri, 12 Jul 2024 22:54:51 +0200
Subject: [PATCH 02/17] Fix #80: add global log rotation options to .conf file
Organization: Addiva Elektronik
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
man/syslog.conf.5 | 20 ++++++++++++++++----
src/syslogd.c | 36 ++++++++++++++++++++++++++++++++++--
syslog.conf | 14 +++++++++++---
3 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/man/syslog.conf.5 b/man/syslog.conf.5
index 73c11e1..030c377 100644
--- a/man/syslog.conf.5
+++ b/man/syslog.conf.5
@@ -71,6 +71,9 @@ OPTION := [OPTION,]
secure_mode [0,1,2]
+rotate_size SIZE
+rotate_count NUMBER
+
include /etc/syslog.d/*.conf
notify /path/to/script-on-rotate
.Ed
@@ -107,6 +110,15 @@ a file can reach before it is rotated, and later compressed. This
feature is mostly intended for embedded systems that do not want to have
cron or a separate log rotate daemon.
.Pp
+The
+.Ql rotate_size SIZE
+and
+.Ql rotate_count COUNT
+are the same as the
+.Nm syslogd Fl r Ar SIZE:COUNT
+command line option. Remember, command line options take precedence
+over .conf file settings.
+.Pp
.Sy Note:
the permissions of the rotated files are kept. Meaning the
administrator can create all log files, before starting
@@ -120,13 +132,13 @@ permissions.
Comments, lines starting with a hash mark ('#'), and empty lines are
ignored. If an error occurs during parsing the whole line is ignored.
.Pp
-Additional options include
+The
.Ql secure_mode <0-2>
-which is the same as the
+option is the same as the
.Nm syslogd Fl s
-commandline option.
+command line option.
.Sy Note:
-command line option always wins, so you need to drop
+again, command line option always wins, so you need to drop
.Fl s
from the command line to use this .conf file option instead.
.Pp
diff --git a/src/syslogd.c b/src/syslogd.c
index c9ea7fd..5061376 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -156,6 +156,7 @@ static int KeepKernFac; /* Keep remotely logged kernel facility */
static int KeepKernTime; /* Keep kernel timestamp, evern after initial read */
static int KeepKernConsole; /* Keep kernel logging to console */
+static int rotate_opt; /* Set if command line option has been given (wins) */
static off_t RotateSz = 0; /* Max file size (bytes) before rotating, disabled by default */
static int RotateCnt = 5; /* Max number (count) of log files to keep, set with -c <NUM> */
@@ -180,13 +181,17 @@ static SIMPLEQ_HEAD(, allowedpeer) aphead = SIMPLEQ_HEAD_INITIALIZER(aphead);
* parser moves the argument to the beginning of the parsed line.
*/
char *secure_str; /* string value of secure_mode */
+char *rotate_sz_str; /* string value of RotateSz */
+char *rotate_cnt_str; /* string value of RotateCnt */
const struct cfkey {
const char *key;
char **var;
} cfkey[] = {
- { "notify", NULL },
- { "secure_mode", &secure_str },
+ { "notify", NULL },
+ { "secure_mode", &secure_str },
+ { "rotate_size", &rotate_sz_str },
+ { "rotate_count", &rotate_cnt_str },
};
/* Function prototypes. */
@@ -499,6 +504,7 @@ int main(int argc, char *argv[])
case 'r':
parse_rotation(optarg, &RotateSz, &RotateCnt);
+ rotate_opt++;
break;
case 's':
@@ -3296,6 +3302,32 @@ static int cfparse(FILE *fp, struct files *newf, struct notifiers *newn)
secure_str = NULL;
}
+ if (rotate_sz_str) {
+ if (rotate_opt) {
+ logit("Skipping 'rotate_size', already set on command line.");
+ } else {
+ int val = strtobytes(rotate_sz_str);
+ if (val > 0)
+ RotateSz = val;
+ }
+
+ free(rotate_sz_str);
+ rotate_sz_str = NULL;
+ }
+
+ if (rotate_cnt_str) {
+ if (rotate_opt) {
+ logit("Skipping 'rotate_count', already set on command line.");
+ } else {
+ int val = atoi(rotate_cnt_str);
+ if (val > 0)
+ RotateCnt = val;
+ }
+
+ free(rotate_cnt_str);
+ rotate_cnt_str = NULL;
+ }
+
return 0;
}
diff --git a/syslog.conf b/syslog.conf
index c4c7525..52161a1 100644
--- a/syslog.conf
+++ b/syslog.conf
@@ -42,9 +42,11 @@ mail.err /var/log/mail.err
cron,daemon.none;\
mail,news.none -/var/log/messages
-# Store all critical eventes, except kernel logs in critical
#
-#*.=crit;kern.none /var/log/critical
+# Store all critical events, except kernel logs, in critical RFC5424 format.
+# Overide global log rotation settings, rotate every 10MiB, keep 5 old logs,
+#
+#*.=crit;kern.none /var/log/critical ;rotate=10M:5,RFC5424
# Example of sending events to remote syslog server.
# All events from notice and above, except auth, authpriv
@@ -60,7 +62,7 @@ mail.err /var/log/mail.err
# Priority alert and above are sent to the operator
#
-#*.alert root,joey
+#*.alert root,joey
#
# Secure mode, same as -s, none(0), on(1), full(2). When enabled
@@ -70,6 +72,12 @@ mail.err /var/log/mail.err
#
secure_mode 1
+#
+# Global log rotation, same as -r SIZE:COUNT, command line wins.
+#
+#rotate_size 1M
+#rotate_count 5
+
#
# Include all config files in /etc/syslog.d/
#
--
2.43.0
@@ -1,102 +0,0 @@
From a2c47f81bf3d358dddb475cbaa8125f2cb776587 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 14 Jul 2024 09:19:01 +0200
Subject: [PATCH 03/17] Refactor, rely on global file rotation if not set
per-file
Organization: Addiva Elektronik
Instead of initializing per-file rotation with global values, leave them
unset to allow global settings to be changed from config file.
This changes the semantics so that it is no longer possible to disable
log rotation on a per-file basis.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/syslogd.c | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/src/syslogd.c b/src/syslogd.c
index 5061376..fa8964b 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -1732,21 +1732,34 @@ static void logmsg(struct buf_msg *buffer)
static void logrotate(struct filed *f)
{
struct stat statf;
+ off_t sz;
- if (!f->f_rotatesz)
+ if (!f->f_rotatesz && !RotateSz)
return;
+ if (f->f_rotatesz)
+ sz = f->f_rotatesz;
+ else
+ sz = RotateSz;
+
if (fstat(f->f_file, &statf))
return;
/* bug (mostly harmless): can wrap around if file > 4gb */
- if (S_ISREG(statf.st_mode) && statf.st_size > f->f_rotatesz)
+ if (S_ISREG(statf.st_mode) && statf.st_size > sz)
rotate_file(f, &statf);
}
static void rotate_file(struct filed *f, struct stat *stp_or_null)
{
- if (f->f_rotatecount > 0) { /* always 0..999 */
+ int cnt;
+
+ if (f->f_rotatecount)
+ cnt = f->f_rotatecount;
+ else
+ cnt = RotateCnt;
+
+ if (cnt > 0) { /* always 0..999 */
struct stat st_stack;
int len = strlen(f->f_un.f_fname) + 10 + 5;
int i;
@@ -1754,7 +1767,7 @@ static void rotate_file(struct filed *f, struct stat *stp_or_null)
char newFile[len];
/* First age zipped log files */
- for (i = f->f_rotatecount; i > 1; i--) {
+ for (i = cnt; i > 1; i--) {
snprintf(oldFile, len, "%s.%d.gz", f->f_un.f_fname, i - 1);
snprintf(newFile, len, "%s.%d.gz", f->f_un.f_fname, i);
@@ -1808,7 +1821,14 @@ static void rotate_all_files(void)
struct filed *f;
SIMPLEQ_FOREACH(f, &fhead, f_link) {
- if (f->f_type == F_FILE && f->f_rotatesz)
+ off_t sz;
+
+ if (f->f_rotatesz)
+ sz = f->f_rotatesz;
+ else
+ sz = RotateSz;
+
+ if (f->f_type == F_FILE && sz)
rotate_file(f, NULL);
}
}
@@ -3140,13 +3160,6 @@ static struct filed *cfline(char *line)
break;
case F_FILE:
- /* default rotate from command line */
- if (f->f_rotatesz == 0) {
- f->f_rotatecount = RotateCnt;
- f->f_rotatesz = RotateSz;
- }
- /* fallthrough */
-
default:
/* All other targets default to RFC3164 */
if (f->f_flags & (RFC3164 | RFC5424))
--
2.43.0
@@ -1,67 +0,0 @@
From 0366909927cebecdf6c35b83a976a25c529043e1 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 14 Jul 2024 09:26:50 +0200
Subject: [PATCH 04/17] Allow per-file rotation settings to set only one value
Organization: Addiva Elektronik
This change makes it possible to set rotate=2M, or rotate=:5, and then
rely on the global settings for the other.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
man/syslog.conf.5 | 10 ++++++++--
src/syslogd.c | 7 +++----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/man/syslog.conf.5 b/man/syslog.conf.5
index 030c377..f436dc3 100644
--- a/man/syslog.conf.5
+++ b/man/syslog.conf.5
@@ -67,7 +67,10 @@ ACTION := /path/to/file
OPTION := [OPTION,]
|= RFC3164
|= RFC5424
- |= rotate=SIZE:COUNT
+ |= rotate=ROT
+ROT := SIZE:COUNT
+ |= SIZE
+ |= :COUNT
secure_mode [0,1,2]
@@ -108,7 +111,10 @@ The log rotation, which is only relevant for files, details the max
.Ar SIZE:COUNT
a file can reach before it is rotated, and later compressed. This
feature is mostly intended for embedded systems that do not want to have
-cron or a separate log rotate daemon.
+cron or a separate log rotate daemon. It is possible to specify only
+size or count, in which case the global setting covers the other. E.g.,
+to set only the rotation count, use:
+.Ar rotate=:COUNT .
.Pp
The
.Ql rotate_size SIZE
diff --git a/src/syslogd.c b/src/syslogd.c
index fa8964b..2264a75 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -2876,13 +2876,12 @@ static void cfrot(char *ptr, struct filed *f)
*c++ = 0;
cnt = atoi(c);
}
+ if (cnt > 0)
+ f->f_rotatecount = cnt;
sz = strtobytes(ptr);
- if (sz > 0 && cnt > 0) {
- logit("Set rotate size %d bytes, %d rotations\n", sz, cnt);
- f->f_rotatecount = cnt;
+ if (sz > 0)
f->f_rotatesz = sz;
- }
}
static int cfopt(char **ptr, const char *opt)
--
2.43.0
@@ -1,150 +0,0 @@
From a1dc835fd5d11ce0dd6d9983c1aa2ca188460ac9 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 14 Jul 2024 17:46:41 +0200
Subject: [PATCH 05/17] Fix #81: blocking delay for unreachable remote
Organization: Addiva Elektronik
This patch fixes a blocking delay when a named remote action is set up.
On GLIBC systems, with the default resolver setup, this may be as long
as 10 seconds, meaning syslogd retried nslookup() every log message,
which in turn lead to snail speed on logging to other targets.
Additionally it re-enables the warning for failure to resolve the DNS
name -- a user is likely very interested in why they are not seeing any
logs on their remote server. Logs age out, so logging in to a device
which may have logged this once is not very useful.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
configure.ac | 12 ++++++++++++
src/syslogd.c | 27 ++++++++++++++++-----------
src/syslogd.h | 5 ++++-
3 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/configure.ac b/configure.ac
index c370877..cf2488a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,10 @@ AC_CHECK_FUNCS([setsid])
AC_CHECK_FUNCS([getprogname strtobytes])
# Command line options
+AC_ARG_WITH(dns-delay,
+ AS_HELP_STRING([--with-dns-delay=SEC], [Retry delay resolving DNS names, default: 60]),
+ [dns_delay=$withval], [dns_delay='no'])
+
AC_ARG_WITH(suspend-time,
AS_HELP_STRING([--with-suspend-time=SEC], [Retry delay for sending to remote, default: 180]),
[suspend_time=$withval], [suspend_time='no'])
@@ -82,6 +86,13 @@ AC_ARG_WITH(logger,
AS_IF([test "x$logger" != "xno"], with_logger="yes", with_logger="no")
AM_CONDITIONAL([ENABLE_LOGGER], [test "x$with_logger" != "xno"])
+AS_IF([test "x$dns_delay" != "xno"],[
+ AS_IF([test "x$dns_delay" = "xyes"],[
+ AC_MSG_ERROR([Must supply argument])])
+ ]
+ AC_DEFINE_UNQUOTED(INET_DNS_DELAY, $dns_delay, [Retry delay for resolving DNS names, default: 60]),
+ dns_delay=60)
+
AS_IF([test "x$suspend_time" != "xno"],[
AS_IF([test "x$suspend_time" = "xyes"],[
AC_MSG_ERROR([Must supply argument])])
@@ -134,6 +145,7 @@ cat <<EOF
Optional features:
logger.........: $with_logger
+ dns retry delay: $dns_delay sec
suspend time...: $suspend_time sec
systemd........: $with_systemd
diff --git a/src/syslogd.c b/src/syslogd.c
index 2264a75..c838c36 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -837,6 +837,11 @@ static void inet_cb(int sd, void *arg)
parsemsg(hname, msg);
}
+/*
+ * Depending on the setup of /etc/resolv.conf, and the system resolver,
+ * a call to this function may be blocked for 10 seconds, or even more,
+ * waiting for a response. See https://serverfault.com/a/562108/122484
+ */
static int nslookup(const char *host, const char *service, struct addrinfo **ai)
{
struct addrinfo hints;
@@ -2405,8 +2410,8 @@ static void forw_lookup(struct filed *f)
char *host = f->f_un.f_forw.f_hname;
char *serv = f->f_un.f_forw.f_serv;
struct addrinfo *ai;
+ time_t now, diff;
int err, first;
- time_t diff;
if (SecureMode > 1) {
if (f->f_un.f_forw.f_addr)
@@ -2419,27 +2424,27 @@ static void forw_lookup(struct filed *f)
/* Called from cfline() for initial lookup? */
first = f->f_type == F_UNUSED ? 1 : 0;
+ now = timer_now();
+ diff = now - f->f_time;
+
/*
- * Not INET_SUSPEND_TIME, but back off a few seconds at least
- * to prevent syslogd from hammering the resolver for every
- * little message that is logged. E.g., at boot when we read
- * the kernel ring buffer.
+ * Back off a minute to prevent unnecessary delays on other log
+ * targets due to being blockd in nslookup(). This means bootup
+ * log messages may not be logged for named remote targets since
+ * networking may not be available until later.
*/
- diff = timer_now() - f->f_time;
- if (!first && diff < 5)
+ if (!first && diff < INET_DNS_DELAY)
return;
err = nslookup(host, serv, &ai);
if (err) {
f->f_type = F_FORW_UNKN;
- f->f_time = timer_now();
- if (!first && !(f->f_flags & SUSP_RETR))
+ f->f_time = now;
+ if (!first)
WARN("Failed resolving '%s:%s': %s", host, serv, gai_strerror(err));
- f->f_flags |= SUSP_RETR; /* Retry silently */
return;
}
- f->f_flags &= ~SUSP_RETR;
f->f_type = F_FORW;
f->f_un.f_forw.f_addr = ai;
f->f_prevcount = 0;
diff --git a/src/syslogd.h b/src/syslogd.h
index 1703df2..a14b6a0 100644
--- a/src/syslogd.h
+++ b/src/syslogd.h
@@ -119,6 +119,10 @@
#define MAXUNAMES 20 /* maximum number of user names */
#define MAXFNAME 200 /* max file pathname length */
+#ifndef INET_DNS_DELAY
+#define INET_DNS_DELAY 60
+#endif
+
#ifndef INET_SUSPEND_TIME
#define INET_SUSPEND_TIME 180 /* equal to 3 minutes */
#endif
@@ -185,7 +189,6 @@
#define MARK 0x008 /* this message is a mark */
#define RFC3164 0x010 /* format log message according to RFC 3164 */
#define RFC5424 0x020 /* format log message according to RFC 5424 */
-#define SUSP_RETR 0x040 /* suspend/forw_unkn, retrying nslookup */
/* Syslog timestamp formats. */
#define BSDFMT_DATELEN 0
--
2.43.0
@@ -1,40 +0,0 @@
From 2d626af27e8f3115175749d183a8b7f91849bf10 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Sun, 14 Jul 2024 17:43:39 +0200
Subject: [PATCH 06/17] Fix annoying gcc warning in rotate_file()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Addiva Elektronik
syslogd.c: In function rotate_file:
syslogd.c:1787:69: warning: %s directive output between 0 and 2147483646 bytes may cause result to exceed INT_MAX [-Wformat-truncation=]
1787 | snprintf(cmd, sizeof(cmd), "gzip -f %s", newFile);
| ^~
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/syslogd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/syslogd.c b/src/syslogd.c
index c838c36..461bbb1 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -1786,10 +1786,11 @@ static void rotate_file(struct filed *f, struct stat *stp_or_null)
snprintf(newFile, len, "%s.%d", f->f_un.f_fname, i);
if (!rename(oldFile, newFile) && i > 0) {
- size_t clen = 18 + strlen(newFile) + 1;
+ const char *gzip = "gzip -f";
+ size_t clen = strlen(gzip) + len + 1;
char cmd[clen];
- snprintf(cmd, sizeof(cmd), "gzip -f %s", newFile);
+ snprintf(cmd, clen, "%s %s", gzip, newFile);
system(cmd);
}
}
--
2.43.0
@@ -1,239 +0,0 @@
From 2aa73f85580614b9162aaaa74b2a9e817c6396bd Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Mon, 15 Jul 2024 10:46:50 +0200
Subject: [PATCH 07/17] Refactor cfparse() to add a per-keyword parser
Organization: Addiva Elektronik
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/syslogd.c | 74 +++++++++++++++++++++++++++------------------------
src/syslogd.h | 2 +-
2 files changed, 40 insertions(+), 36 deletions(-)
diff --git a/src/syslogd.c b/src/syslogd.c
index 461bbb1..452513f 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -163,7 +163,7 @@ static int RotateCnt = 5; /* Max number (count) of log files to keep, set wi
/*
* List of notifiers
*/
-static SIMPLEQ_HEAD(notifiers, notifier) nothead = SIMPLEQ_HEAD_INITIALIZER(nothead);
+static TAILQ_HEAD(notifiers, notifier) nothead = TAILQ_HEAD_INITIALIZER(nothead);
/*
* List of peers and sockets for binding.
@@ -184,16 +184,6 @@ char *secure_str; /* string value of secure_mode */
char *rotate_sz_str; /* string value of RotateSz */
char *rotate_cnt_str; /* string value of RotateCnt */
-const struct cfkey {
- const char *key;
- char **var;
-} cfkey[] = {
- { "notify", NULL },
- { "secure_mode", &secure_str },
- { "rotate_size", &rotate_sz_str },
- { "rotate_count", &rotate_cnt_str },
-};
-
/* Function prototypes. */
static int allowaddr(char *s);
void untty(void);
@@ -221,10 +211,10 @@ static void signal_init(void);
static void boot_time_init(void);
static void init(void);
static int strtobytes(char *arg);
-static int cfparse(FILE *fp, struct files *newf, struct notifiers *newn);
+static int cfparse(FILE *fp, struct files *newf);
int decode(char *name, struct _code *codetab);
static void logit(char *, ...);
-static void notifier_add(struct notifiers *newn, const char *program);
+static void notifier_add(char *program, void *arg);
static void notifier_invoke(const char *logfile);
static void notifier_free_all(void);
void reload(int);
@@ -233,6 +223,20 @@ static int validate(struct sockaddr *sa, const char *hname);
static int waitdaemon(int);
static void timedout(int);
+/*
+ * Configuration file keywords, variables, and optional callbacks
+ */
+const struct cfkey {
+ const char *key;
+ char **var;
+ void (*cb)(char *, void *);
+ void *arg;
+} cfkey[] = {
+ { "notify", NULL, notifier_add, &nothead },
+ { "rotate_size", &rotate_sz_str, NULL, NULL },
+ { "rotate_count", &rotate_cnt_str, NULL, NULL },
+ { "secure_mode", &secure_str, NULL, NULL },
+};
/*
* Very basic, and incomplete, check if we're running in a container.
@@ -1816,7 +1820,7 @@ static void rotate_file(struct filed *f, struct stat *stp_or_null)
return;
}
- if (!SIMPLEQ_EMPTY(&nothead))
+ if (!TAILQ_EMPTY(&nothead))
notifier_invoke(f->f_un.f_fname);
}
ftruncate(f->f_file, 0);
@@ -2708,7 +2712,6 @@ static void boot_time_init(void)
*/
static void init(void)
{
- struct notifiers newn = SIMPLEQ_HEAD_INITIALIZER(newn);
struct files newf = SIMPLEQ_HEAD_INITIALIZER(newf);
struct filed *f;
struct peer *pe;
@@ -2762,6 +2765,11 @@ static void init(void)
*/
tzset();
+ /*
+ * Free all notifiers
+ */
+ notifier_free_all();
+
/*
* Read configuration file(s)
*/
@@ -2776,7 +2784,7 @@ static void init(void)
}
}
- if (cfparse(fp, &newf, &newn)) {
+ if (cfparse(fp, &newf)) {
fclose(fp);
return;
}
@@ -2789,13 +2797,6 @@ static void init(void)
fhead = newf;
- /*
- * Free all notifiers
- */
- notifier_free_all();
-
- nothead = newn;
-
/*
* Open or close sockets for local and remote communication
*/
@@ -2815,11 +2816,12 @@ static void init(void)
Initialized = 1;
if (Debug) {
- if (!SIMPLEQ_EMPTY(&nothead)) {
+ if (!TAILQ_EMPTY(&nothead)) {
struct notifier *np;
- SIMPLEQ_FOREACH(np, &nothead, n_link)
+ TAILQ_FOREACH(np, &nothead, n_link) {
printf("notify %s\n", np->n_program);
+ }
printf("\n");
}
@@ -3208,6 +3210,8 @@ const struct cfkey *cfkey_match(char *cline)
if (cfk->var)
*cfk->var = strdup(p);
+ else if (cfk->cb)
+ cfk->cb(p, cfk->arg);
else
memmove(cline, p, strlen(p) + 1);
@@ -3220,7 +3224,7 @@ const struct cfkey *cfkey_match(char *cline)
/*
* Parse .conf file and append to list
*/
-static int cfparse(FILE *fp, struct files *newf, struct notifiers *newn)
+static int cfparse(FILE *fp, struct files *newf)
{
const struct cfkey *cfk;
struct filed *f;
@@ -3286,7 +3290,7 @@ static int cfparse(FILE *fp, struct files *newf, struct notifiers *newn)
}
logit("Parsing %s ...\n", gl.gl_pathv[i]);
- cfparse(fpi, newf, newn);
+ cfparse(fpi, newf);
fclose(fpi);
}
globfree(&gl);
@@ -3294,11 +3298,8 @@ static int cfparse(FILE *fp, struct files *newf, struct notifiers *newn)
}
cfk = cfkey_match(cline);
- if (cfk) {
- if (!strcmp(cfk->key, "notify"))
- notifier_add(newn, cline);
+ if (cfk)
continue;
- }
f = cfline(cline);
if (!f)
@@ -3681,8 +3682,10 @@ static void logit(char *fmt, ...)
fflush(stdout);
}
-static void notifier_add(struct notifiers *newn, const char *program)
+static void notifier_add(char *program, void *arg)
{
+ struct notifiers *newn = (struct notifiers *)arg;
+
while (*program && isspace(*program))
++program;
@@ -3701,7 +3704,7 @@ static void notifier_add(struct notifiers *newn, const char *program)
ERR("Cannot allocate memory for a notify program");
return;
}
- SIMPLEQ_INSERT_TAIL(newn, np, n_link);
+ TAILQ_INSERT_TAIL(newn, np, n_link);
} else
logit("notify: non-existing, or not executable program\n");
}
@@ -3714,7 +3717,7 @@ static void notifier_invoke(const char *logfile)
logit("notify: rotated %s, invoking hooks\n", logfile);
- SIMPLEQ_FOREACH(np, &nothead, n_link) {
+ TAILQ_FOREACH(np, &nothead, n_link) {
childpid = fork();
switch (childpid) {
@@ -3739,7 +3742,8 @@ static void notifier_free_all(void)
{
struct notifier *np, *npnext;
- SIMPLEQ_FOREACH_SAFE(np, &nothead, n_link, npnext) {
+ TAILQ_FOREACH_SAFE(np, &nothead, n_link, npnext) {
+ TAILQ_REMOVE(&nothead, np, n_link);
free(np->n_program);
free(np);
}
diff --git a/src/syslogd.h b/src/syslogd.h
index a14b6a0..14c66a7 100644
--- a/src/syslogd.h
+++ b/src/syslogd.h
@@ -314,7 +314,7 @@ struct filed {
* Log rotation notifiers
*/
struct notifier {
- SIMPLEQ_ENTRY(notifier) n_link;
+ TAILQ_ENTRY(notifier) n_link;
char *n_program;
};
--
2.43.0
@@ -1,42 +0,0 @@
From c15bb6208cdd0e0629a28c10cb448a11aa7a1624 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Mon, 15 Jul 2024 14:24:08 +0200
Subject: [PATCH 08/17] Fix gcc warning in vsyslogp_r()
Organization: Addiva Elektronik
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/syslog.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/syslog.c b/src/syslog.c
index 1510258..fbbdfdf 100644
--- a/src/syslog.c
+++ b/src/syslog.c
@@ -267,7 +267,7 @@ vsyslogp_r(int pri, struct syslog_data *data, const char *msgid,
/* Default log format is RFC5424, continues below BSD format */
if (data->log_stat & LOG_RFC3164) {
const char *tag = data->log_tag;
- char tmp[33];
+ char tmp[256];
if (!(data->log_stat & LOG_NLOG)) {
prlen = snprintf(p, tbuf_left, "<%d>", pri);
@@ -303,12 +303,12 @@ vsyslogp_r(int pri, struct syslog_data *data, const char *msgid,
/*
* When sending remote we MUST follow RFC3164 sec 4.1.3,
- * otherwise we "cheat" and allow max lenght hostname,
+ * otherwise we "cheat" and allow max length hostname,
* for either log file or local syslogd -- it is up to
* the local syslogd then to fulfill RFC req. on output
*/
if (data->log_host) {
- strlcpy(tmp, data->log_tag, sizeof(tbuf));
+ strlcpy(tmp, data->log_tag, sizeof(tmp));
tag = tmp;
}
--
2.43.0
@@ -1,285 +0,0 @@
From f5fae387b92e81cc1f1f9e8f6656b20bb9e2e929 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Mon, 15 Jul 2024 14:57:54 +0200
Subject: [PATCH 09/17] Fix #83: add support for listen addr:port to .conf file
Organization: Addiva Elektronik
This complements the command line '-b addr:port' support with a 'listen'
directive in the .conf file. The command line listen directives are in
this implementation treated as "static" and cannot be removed using the
.conf file.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/syslogd.c | 104 +++++++++++++++++++++++++++++++++++++++++---------
src/syslogd.h | 3 +-
2 files changed, 88 insertions(+), 19 deletions(-)
diff --git a/src/syslogd.c b/src/syslogd.c
index 452513f..8ad5109 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -168,12 +168,12 @@ static TAILQ_HEAD(notifiers, notifier) nothead = TAILQ_HEAD_INITIALIZER(nothead)
/*
* List of peers and sockets for binding.
*/
-static SIMPLEQ_HEAD(, peer) pqueue = SIMPLEQ_HEAD_INITIALIZER(pqueue);
+static TAILQ_HEAD(peers, peer) pqueue = TAILQ_HEAD_INITIALIZER(pqueue);
/*
* List fo peers allowed to log to us.
*/
-static SIMPLEQ_HEAD(, allowedpeer) aphead = SIMPLEQ_HEAD_INITIALIZER(aphead);
+static SIMPLEQ_HEAD(allowed, allowedpeer) aphead = SIMPLEQ_HEAD_INITIALIZER(aphead);
/*
* central list of recognized configuration keywords with an optional
@@ -211,6 +211,7 @@ static void signal_init(void);
static void boot_time_init(void);
static void init(void);
static int strtobytes(char *arg);
+static void cflisten(char *ptr, void *arg);
static int cfparse(FILE *fp, struct files *newf);
int decode(char *name, struct _code *codetab);
static void logit(char *, ...);
@@ -232,6 +233,7 @@ const struct cfkey {
void (*cb)(char *, void *);
void *arg;
} cfkey[] = {
+ { "listen", NULL, cflisten, NULL },
{ "notify", NULL, notifier_add, &nothead },
{ "rotate_size", &rotate_sz_str, NULL, NULL },
{ "rotate_count", &rotate_cnt_str, NULL, NULL },
@@ -276,11 +278,24 @@ static int addpeer(struct peer *pe0)
{
struct peer *pe;
+ TAILQ_FOREACH(pe, &pqueue, pe_link) {
+ if (((pe->pe_name == NULL && pe0->pe_name == NULL) ||
+ (pe->pe_name != NULL && pe0->pe_name != NULL && strcmp(pe->pe_name, pe0->pe_name) == 0)) &&
+ ((pe->pe_serv == NULL && pe0->pe_serv == NULL) ||
+ (pe->pe_serv != NULL && pe0->pe_serv != NULL && strcmp(pe->pe_serv, pe0->pe_serv) == 0))) {
+ /* update flags */
+ pe->pe_mark = pe0->pe_mark;
+ pe->pe_mode = pe0->pe_mode;
+
+ return 0;
+ }
+ }
+
pe = calloc(1, sizeof(*pe));
if (pe == NULL)
err(1, "malloc failed");
*pe = *pe0;
- SIMPLEQ_INSERT_TAIL(&pqueue, pe, pe_link);
+ TAILQ_INSERT_TAIL(&pqueue, pe, pe_link);
return 0;
}
@@ -406,7 +421,6 @@ int main(int argc, char *argv[])
pid_t ppid = 1;
int no_sys = 0;
int pflag = 0;
- int bflag = 0;
char *ptr;
int ch;
@@ -434,13 +448,13 @@ int main(int argc, char *argv[])
break;
case 'b':
- bflag = 1;
ptr = strchr(optarg, ':');
if (ptr)
*ptr++ = 0;
addpeer(&(struct peer) {
.pe_name = optarg,
.pe_serv = ptr,
+ .pe_mark = -1,
});
break;
@@ -503,6 +517,7 @@ int main(int argc, char *argv[])
addpeer(&(struct peer) {
.pe_name = optarg,
.pe_mode = 0666,
+ .pe_mark = -1,
});
break;
@@ -538,13 +553,6 @@ int main(int argc, char *argv[])
if ((argc -= optind))
return usage(1);
- /* Default to listen to :514 (syslog/udp) */
- if (!bflag)
- addpeer(&(struct peer) {
- .pe_name = NULL,
- .pe_serv = "syslog",
- });
-
/* Figure out where to read system log messages from */
if (!pflag) {
/* Do we run under systemd-journald (Requires=syslog.socket)? */
@@ -556,6 +564,7 @@ int main(int argc, char *argv[])
addpeer(&(struct peer) {
.pe_name = _PATH_LOG,
.pe_mode = 0666,
+ .pe_mark = -1,
});
}
}
@@ -2545,7 +2554,9 @@ void die(int signo)
/*
* Close all UNIX and inet sockets
*/
- SIMPLEQ_FOREACH_SAFE(pe, &pqueue, pe_link, next) {
+ TAILQ_FOREACH_SAFE(pe, &pqueue, pe_link, next) {
+ TAILQ_REMOVE(&pqueue, pe, pe_link);
+
for (size_t i = 0; i < pe->pe_socknum; i++) {
logit("Closing socket %d ...\n", pe->pe_sock[i]);
socket_close(pe->pe_sock[i]);
@@ -2713,8 +2724,9 @@ static void boot_time_init(void)
static void init(void)
{
struct files newf = SIMPLEQ_HEAD_INITIALIZER(newf);
+ struct peer *pe, *penext;
struct filed *f;
- struct peer *pe;
+ int bflag = 0;
FILE *fp;
char *p;
@@ -2765,6 +2777,16 @@ static void init(void)
*/
tzset();
+ /*
+ * mark
+ */
+ TAILQ_FOREACH(pe, &pqueue, pe_link) {
+ if (pe->pe_mark == -1)
+ continue;
+
+ pe->pe_mark = 1;
+ }
+
/*
* Free all notifiers
*/
@@ -2797,10 +2819,31 @@ static void init(void)
fhead = newf;
+ /*
+ * Ensure a default listen *:514 exists (compat)
+ */
+ TAILQ_FOREACH(pe, &pqueue, pe_link) {
+ if (pe->pe_mark == 1)
+ continue; /* marked for deletion */
+ if (pe->pe_name && pe->pe_name[0] == '/')
+ continue; /* named pipe */
+ if (pe->pe_name || pe->pe_serv) {
+ bflag = 1;
+ break; /* static or from .conf */
+ }
+ }
+ if (!bflag) {
+ /* Default to listen to :514 (syslog/udp) */
+ addpeer(&(struct peer) {
+ .pe_name = NULL,
+ .pe_serv = "514",
+ });
+ }
+
/*
* Open or close sockets for local and remote communication
*/
- SIMPLEQ_FOREACH(pe, &pqueue, pe_link) {
+ TAILQ_FOREACH(pe, &pqueue, pe_link) {
if (pe->pe_name && pe->pe_name[0] == '/') {
create_unix_socket(pe);
} else {
@@ -2808,11 +2851,23 @@ static void init(void)
socket_close(pe->pe_sock[i]);
pe->pe_socknum = 0;
- if (SecureMode < 2)
+ /* skip any marked for deletion */
+ if (SecureMode < 2 && pe->pe_mark <= 0)
create_inet_socket(pe);
}
}
+ /*
+ * Sweep
+ */
+ TAILQ_FOREACH_SAFE(pe, &pqueue, pe_link, penext) {
+ if (pe->pe_mark <= 0)
+ continue;
+
+ TAILQ_REMOVE(&pqueue, pe, pe_link);
+ free(pe);
+ }
+
Initialized = 1;
if (Debug) {
@@ -2874,6 +2929,19 @@ static void init(void)
logit("syslogd: restarted.\n");
}
+static void cflisten(char *ptr, void *arg)
+{
+ char *peer = ptr;
+
+ ptr = strchr(peer, ':');
+ if (ptr)
+ *ptr++ = 0;
+ addpeer(&(struct peer) {
+ .pe_name = peer,
+ .pe_serv = ptr,
+ });
+}
+
static void cfrot(char *ptr, struct filed *f)
{
char *c;
@@ -3096,7 +3164,7 @@ static struct filed *cfline(char *line)
if (bp)
*bp++ = 0;
else
- bp = "syslog"; /* default: 514/udp */
+ bp = "514"; /* default: 514/udp */
strlcpy(f->f_un.f_forw.f_hname, p, sizeof(f->f_un.f_forw.f_hname));
strlcpy(f->f_un.f_forw.f_serv, bp, sizeof(f->f_un.f_forw.f_serv));
@@ -3426,7 +3494,7 @@ static int allowaddr(char *s)
goto err;
}
} else {
- if ((se = getservbyname("syslog", "udp")))
+ if ((se = getservbyname("514", "udp")))
ap->port = ntohs(se->s_port);
else
/* sanity, should not happen */
diff --git a/src/syslogd.h b/src/syslogd.h
index 14c66a7..d74c0ed 100644
--- a/src/syslogd.h
+++ b/src/syslogd.h
@@ -225,9 +225,10 @@
* Struct to hold records of peers and sockets
*/
struct peer {
- SIMPLEQ_ENTRY(peer) pe_link;
+ TAILQ_ENTRY(peer) pe_link;
const char *pe_name;
const char *pe_serv;
+ int pe_mark;
mode_t pe_mode;
int pe_sock[16];
size_t pe_socknum;
--
2.43.0
@@ -1,346 +0,0 @@
From ad8dedd04a979279d245b53a60311ad91acaaf14 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Mon, 15 Jul 2024 15:02:32 +0200
Subject: [PATCH 10/17] Fix #82: retry creating UNIX and network sockets on
failure
Organization: Addiva Elektronik
When starting up, or on SIGHUP, syslogd may fail to create a UNIX socket
or (bind) an Internet socket. The latter may be because the system is
in bootstrap and the interface and/or address syslogd tries to bind() to
does not yet exist.
This commit adds a very basic retry loop every five seconds.
Also, with the new retry logic it was deemed worth it to increase the
logging from syslogd itself. I.e., when failing to create a socket,
or when retrying and succeeding, as well as when closing sockets. In
particular when opening and closing Internet facing ports.
Since startup, or reconfiguration, is not failure to send() the we do
not want to inadvertedly trigger F_FORW_SUSP for remote log actions.
This is the reason for the ENONET error code from socket_ffs(), to
ensure we retry sending to remote on the next log message instead of
waiting 180 sec. Ordering at boot, or reconf, is also the reason for
setting Initialized earlier -- this prevents inadvertedly logging to the
console instead of to a file that actually is open. We can usually log
to file but maybe not yet to a remote.
To not terrify casual readers of the logs, messages for opening and
closing Inet (Internet) sockets are tracked from what context they were
opened in. Context, in this context, is the secure_mode switch in which
syslogd only opens UDP sockets for sending messages to other syslog
servers, i.e., without binding to a server port.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/socket.c | 1 +
src/syslogd.c | 145 +++++++++++++++++++++++++++++++++++---------------
2 files changed, 102 insertions(+), 44 deletions(-)
diff --git a/src/socket.c b/src/socket.c
index 4b64888..8c32dac 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -217,6 +217,7 @@ int socket_ffs(int family)
return entry->sd;
}
+ errno = ENONET;
return -1;
}
diff --git a/src/syslogd.c b/src/syslogd.c
index 8ad5109..402a85e 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -160,6 +160,9 @@ static int rotate_opt; /* Set if command line option has been given
static off_t RotateSz = 0; /* Max file size (bytes) before rotating, disabled by default */
static int RotateCnt = 5; /* Max number (count) of log files to keep, set with -c <NUM> */
+struct timeval *retry = NULL; /* Set by init() to &init_tv whenever retry jobs exist */
+struct timeval init_tv = { 5, 0 }; /* Retry every 5 seconds. */
+
/*
* List of notifiers
*/
@@ -209,6 +212,7 @@ void debug_switch();
void die(int sig);
static void signal_init(void);
static void boot_time_init(void);
+static void retry_init(void);
static void init(void);
static int strtobytes(char *arg);
static void cflisten(char *ptr, void *arg);
@@ -642,7 +646,7 @@ no_klogd:
for (;;) {
int rc;
- rc = socket_poll(NULL);
+ rc = socket_poll(retry);
if (restart > 0) {
restart--;
logit("\nReceived SIGHUP, reloading syslogd.\n");
@@ -660,8 +664,11 @@ no_klogd:
rotate_all_files();
}
- if (rc < 0 && errno != EINTR)
- ERR("select()");
+ if (rc < 0) {
+ if (errno != EINTR)
+ ERR("select()");
+ } else if (rc == 0)
+ retry_init();
if (KernLog)
sys_seqno_save();
@@ -769,14 +776,14 @@ static void unix_cb(int sd, void *arg)
parsemsg(LocalHostName, msg);
}
-static void create_unix_socket(struct peer *pe)
+static int create_unix_socket(struct peer *pe)
{
struct sockaddr_un sun;
struct addrinfo ai;
int sd = -1;
if (pe->pe_socknum)
- return; /* Already set up */
+ return 0; /* Already set up */
memset(&ai, 0, sizeof(ai));
ai.ai_addr = (struct sockaddr *)&sun;
@@ -790,11 +797,12 @@ static void create_unix_socket(struct peer *pe)
if (sd < 0)
goto err;
- logit("Created UNIX socket %d ...\n", sd);
+ NOTE("Created UNIX socket %s", sun.sun_path);
pe->pe_sock[pe->pe_socknum++] = sd;
- return;
+ return 0;
err:
ERR("cannot create %s", pe->pe_name);
+ return 1;
}
static void unmapped(struct sockaddr *sa)
@@ -866,7 +874,7 @@ static int nslookup(const char *host, const char *service, struct addrinfo **ai)
/* Reset resolver cache and retry name lookup */
res_init();
- logit("nslookup '%s:%s'\n", node ?: "none", service);
+ logit("nslookup '%s:%s'\n", node ?: "*", service);
memset(&hints, 0, sizeof(hints));
hints.ai_flags = !node ? AI_PASSIVE : 0;
hints.ai_family = family;
@@ -875,22 +883,25 @@ static int nslookup(const char *host, const char *service, struct addrinfo **ai)
return getaddrinfo(node, service, &hints, ai);
}
-static void create_inet_socket(struct peer *pe)
+static int create_inet_socket(struct peer *pe)
{
struct addrinfo *ai, *res;
- int sd, err;
+ int err, rc = 0;
+
+ if (pe->pe_socknum)
+ return 0; /* Already set up */
err = nslookup(pe->pe_name, pe->pe_serv, &res);
if (err) {
- ERRX("%s/udp service unknown: %s", pe->pe_serv,
- gai_strerror(err));
- return;
+ ERRX("%s:%s/udp service unknown: %s", pe->pe_name ?: "*", pe->pe_serv, gai_strerror(err));
+ return 1;
}
for (ai = res; ai; ai = ai->ai_next) {
+ int sd;
+
if (pe->pe_socknum + 1 >= NELEMS(pe->pe_sock)) {
- WARN("Only %zd IP addresses per socket supported.",
- NELEMS(pe->pe_sock));
+ WARN("Only %zd IP addresses per socket supported.", NELEMS(pe->pe_sock));
break;
}
@@ -900,15 +911,35 @@ static void create_inet_socket(struct peer *pe)
ai->ai_flags &= ~AI_SECURE;
sd = socket_create(ai, inet_cb, NULL);
- if (sd < 0)
+ if (sd < 0) {
+ WARN("Failed creating socket for %s:%s: %s", pe->pe_name ?: "*",
+ pe->pe_serv, strerror(errno));
+ rc = 1;
continue;
+ }
- logit("Created inet socket %d for %s:%s ...\n", sd,
- pe->pe_name, pe->pe_serv);
+ if (!SecureMode) {
+ pe->pe_mode |= 01000;
+ NOTE("Opened inet socket %s:%s", pe->pe_name ?: "*", pe->pe_serv);
+ }
pe->pe_sock[pe->pe_socknum++] = sd;
}
freeaddrinfo(res);
+ if (rc && pe->pe_socknum == 0)
+ return rc;
+
+ return 0;
+}
+
+static void close_socket(struct peer *pe)
+{
+ for (size_t i = 0; i < pe->pe_socknum; i++) {
+ if (pe->pe_mode & 01000)
+ NOTE("Closing inet socket %s:%s", pe->pe_name ?: "*", pe->pe_serv);
+ socket_close(pe->pe_sock[i]);
+ }
+ pe->pe_socknum = 0;
}
void untty(void)
@@ -1947,6 +1978,7 @@ void fprintlog_write(struct filed *f, struct iovec *iov, int iovcnt, int flags)
if (lsent != len) {
switch (errno) {
case ENOBUFS:
+ case ENONET: /* returned by socket_ffs() */
case ENETDOWN:
case ENETUNREACH:
case EHOSTUNREACH:
@@ -2556,11 +2588,7 @@ void die(int signo)
*/
TAILQ_FOREACH_SAFE(pe, &pqueue, pe_link, next) {
TAILQ_REMOVE(&pqueue, pe, pe_link);
-
- for (size_t i = 0; i < pe->pe_socknum; i++) {
- logit("Closing socket %d ...\n", pe->pe_sock[i]);
- socket_close(pe->pe_sock[i]);
- }
+ close_socket(pe);
free(pe);
}
@@ -2718,6 +2746,31 @@ static void boot_time_init(void)
#endif
}
+/*
+ * Used by init() to trigger retries of, e.g., binding to interfaces.
+ */
+static void retry_init(void)
+{
+ struct peer *pe;
+ int fail = 0;
+
+ logit("Retrying socket init ...\n");
+ TAILQ_FOREACH(pe, &pqueue, pe_link) {
+ if (pe->pe_name && pe->pe_name[0] == '/') {
+ fail |= create_unix_socket(pe);
+ } else {
+ /* skip any marked for deletion */
+ if (SecureMode < 2)
+ fail |= create_inet_socket(pe);
+ }
+ }
+
+ if (!fail) {
+ logit("Socket re-init done.\n");
+ retry = NULL;
+ }
+}
+
/*
* INIT -- Initialize syslogd from configuration table
*/
@@ -2725,8 +2778,8 @@ static void init(void)
{
struct files newf = SIMPLEQ_HEAD_INITIALIZER(newf);
struct peer *pe, *penext;
+ int bflag = 0, fail = 0;
struct filed *f;
- int bflag = 0;
FILE *fp;
char *p;
@@ -2840,23 +2893,6 @@ static void init(void)
});
}
- /*
- * Open or close sockets for local and remote communication
- */
- TAILQ_FOREACH(pe, &pqueue, pe_link) {
- if (pe->pe_name && pe->pe_name[0] == '/') {
- create_unix_socket(pe);
- } else {
- for (size_t i = 0; i < pe->pe_socknum; i++)
- socket_close(pe->pe_sock[i]);
- pe->pe_socknum = 0;
-
- /* skip any marked for deletion */
- if (SecureMode < 2 && pe->pe_mark <= 0)
- create_inet_socket(pe);
- }
- }
-
/*
* Sweep
*/
@@ -2865,11 +2901,35 @@ static void init(void)
continue;
TAILQ_REMOVE(&pqueue, pe, pe_link);
+ close_socket(pe);
free(pe);
}
Initialized = 1;
+ flog(LOG_SYSLOG | LOG_INFO, "syslogd v" VERSION ": restart.");
+ logit("syslogd: restarted.\n");
+
+ /*
+ * Open or close sockets for local and remote communication
+ * These may be delayed, so start local logging first.
+ */
+ TAILQ_FOREACH(pe, &pqueue, pe_link) {
+ if (pe->pe_name && pe->pe_name[0] == '/') {
+ fail |= create_unix_socket(pe);
+ } else {
+ close_socket(pe);
+
+ if (SecureMode < 2)
+ fail |= create_inet_socket(pe);
+ }
+ }
+
+ if (fail)
+ retry = &init_tv;
+ else
+ retry = NULL;
+
if (Debug) {
if (!TAILQ_EMPTY(&nothead)) {
struct notifier *np;
@@ -2924,9 +2984,6 @@ static void init(void)
printf("\n");
}
}
-
- flog(LOG_SYSLOG | LOG_INFO, "syslogd v" VERSION ": restart.");
- logit("syslogd: restarted.\n");
}
static void cflisten(char *ptr, void *arg)
--
2.43.0
@@ -1,30 +0,0 @@
From 87ccd3eb37087ffb4b5f5b0322a558522a705215 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Thu, 18 Jul 2024 11:42:36 +0200
Subject: [PATCH 11/17] Read *.conf files from include/ directories sorted
Organization: Addiva Elektronik
No point in "saving time" on this operation. It is more important to
users that we read the files in a predefined order, alphabetically.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/syslogd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/syslogd.c b/src/syslogd.c
index 402a85e..87da475 100644
--- a/src/syslogd.c
+++ b/src/syslogd.c
@@ -3400,7 +3400,7 @@ static int cfparse(FILE *fp, struct files *newf)
p++;
logit("Searching for %s ...\n", p);
- if (glob(p, GLOB_NOSORT, NULL, &gl))
+ if (glob(p, 0, NULL, &gl))
logit("No files match %s\n", p);
for (size_t i = 0; i < gl.gl_pathc; i++) {
--
2.43.0

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