Compare commits

...
4 Commits
Author SHA1 Message Date
Ejub SabicandTobias Waldekranz 4be5217a36 uboot: import first variable from auxiliary environment
The U-Boot env file is generated by
mkenvimage, which prefixes the variable data with a 4-byte CRC32 by default.
ixpreboot.sh previously imported it with `env import -b` as per uboot docs(-b assume binary format (’0’ separated, “00” terminated).),
which treats the buffer as raw binary and does not strip the CRC.
As a result the first variable's name is parsed a part of CRC.
Later variables import correctly because by then the parser is past the CRC.
Switching to `env import -c` as per uboot docs (-c assume checksum protected environment format.)
makes U-Boot validate and strip the CRC before parsing, so the first variable imports under its real name.

Tested on:
- QEMU

Signed-off-by: Ejub Sabic <ejub1946@outlook.com>
2026-06-16 07:29:29 +02:00
Tobias WaldekranzandGitHub ebb37732f4 Merge pull request #1177 from kernelkit/multi-dsa-tree-fixes
Multi DSA tree fixes
2025-10-02 16:09:19 +02:00
Tobias Waldekranz 94f8d1a700 common: nameif: Handle nested dsa ports
In setups like this...

    CPU
    eth0
     |
.----0----.
| dst0sw0 |
'-1-2-3-4-'
        |
   .----0----.
   | dst1sw0 |
   '-1-2-3-4-'

...both eth0 and dst0sw0p4 are DSA ports. But the latter is _also_ a
physical port as far as devlink is concerned. As a result, it would
first be marked as "internal" and is then instantly reclassified as a
"port".

Catch this condition and stick with the initial "internal"
classification.
2025-10-02 14:51:34 +02:00
Tobias Waldekranz 39b4101d19 common: has-quirk: Add support for matching based on "ethtool -i"
In addition to matching on interface names, add support for matching
on ethtool information.

Example:

    {
        "@ethtool:driver=st_gmac": {
	    "broken-mqprio": true
	}
    }

This would mark any interface using the "st_gmac" driver as having a
broken mqprio implementation. Whereas this:

    {
        "@ethtool:driver=st_gmac;bus-info:30bf0000.ethernet": {
	    "broken-mqprio": true
	}
    }

Only matches an st_gmac-backed interface at the specified location.

As matching becomes more complicated, use the shell implementation
from confd as well, to make sure that they are always in agreement.
2025-10-02 14:51:29 +02:00
4 changed files with 52 additions and 19 deletions
@@ -1,12 +1,49 @@
#!/bin/sh
#!/bin/bash
IFQUIRKSFILE=${IFQUIRKSFILE:-/etc/product/interface-quirks.json}
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
[ -f "$IFQUIRKSFILE" ] || { echo false && exit; }
match()
{
jq -e \
--arg quirk "$quirk" --arg pattern "$1" \
'.[$pattern][$quirk]' "$IFQUIRKSFILE" >/dev/null || return
echo true
exit 0
}
ethtoolmatch()
{
local pattern="${1#@ethtool:}"
grep -qFxvf \
<(ethtool -i "$ifname") \
<(echo -n "$pattern" | awk -v FS="=" -v RS=";" '{ printf("%s: %s\n", $1, $2); }') \
&& return
match "@ethtool:$pattern"
}
for pattern in $(jq -r 'keys[]' "$IFQUIRKSFILE"); do
case "$pattern" in
@ethtool:*)
ethtoolmatch "$pattern"
;;
"$ifname")
match "$ifname"
;;
esac
done
echo "false"
@@ -34,6 +34,12 @@ ports=$(devlink -j port | jq -r '.port[]
| select(.flavour == "physical")
| .netdev')
for iface in $ports; do
# On systems with multiple switch trees, a port may be _both_
# a physical port, registered with devlink, _and_ a DSA
# port. In those cases, hold on to our initial "internal"
# classification.
[ $(ip -j link show dev "$iface" | jq -r '.[0].group') = internal ] && continue
ip link set "$iface" group port
done
+1 -1
View File
@@ -33,7 +33,7 @@ for tgt in "${boot_targets}"; do
setexpr ixmenu_n ${ixmenu_n} + 1
if load ${devtype} ${devnum}:${auxpart} ${loadaddr} /uboot.env; then
env import -b ${loadaddr} ${filesize} BOOT_ORDER DEBUG ethact
env import -c ${loadaddr} ${filesize} BOOT_ORDER DEBUG ethact
fi
if test -n "${DEBUG}"; then
+2 -12
View File
@@ -17,18 +17,8 @@
bool iface_has_quirk(const char *ifname, const char *quirkname)
{
struct json_t *iface, *quirk;
if (!confd.ifquirks)
return false;
iface = json_object_get(confd.ifquirks, ifname);
if (!iface)
return false;
quirk = json_object_get(iface, quirkname);
return quirk ? json_is_true(quirk) : false;
return systemf("[ $(/usr/libexec/infix/has-quirk %s %s) = true ]",
quirkname, ifname) == 0;
}
static bool iface_is_phys(const char *ifname)