Bug 279352 - dpaa2 (dpni0 device): interface goes catatonic periodically
Summary: dpaa2 (dpni0 device): interface goes catatonic periodically
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: 14.0-RELEASE
Hardware: arm64 Any
: --- Affects Only Me
Assignee: Dmitry Salychev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-27 16:40 UTC by Justin Hibbits
Modified: 2026-11-05 19:22 UTC (History)
3 users (show)

See Also:
linimon: mfc-stable14?


Attachments
Output of sysctl and top from working dpaa2 period (8.20 KB, text/plain)
2024-06-03 14:00 UTC, Justin Hibbits
no flags Details
Output of sysctl and top from failing dpaa2 period (5.67 KB, text/plain)
2024-06-05 19:04 UTC, Justin Hibbits
no flags Details
Output of sysctl and top from failing dpaa2 period (take 2) (6.61 KB, text/plain)
2024-06-06 13:11 UTC, Justin Hibbits
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Hibbits freebsd_committer freebsd_triage 2024-05-27 16:40:04 UTC
On my Honeycomb LX2 system the dpni0 device suddenly stops working after a while, and the only way to get it working, short of rebooting, is to physically flap the connection, by either pulling the ethernet cable or disabling and re-enabling the port through the switch it's connected to.  I don't see any logs leading up to the problem state.

Some details that may be interesting: multiple VNET jails, plus one VLAN.

I'm willing to run most any dtrace script to narrow down the problem, or test a patch against 14.0-RELEASE to fix the problem.
Comment 1 Bjoern A. Zeeb freebsd_committer freebsd_triage 2024-05-27 22:12:47 UTC
Is this related to 964b3408fa872178aacf58f2d84dc43564ec0aa7 ?

Hmm are you willing to patch the kernel to add some more sysctl/stats?  I have a local patch (somewhere in the multitude of updates in a local branch) that adds the internal view on the links to sysctls which would likely also be as helpful as ifconfig -mv dpni0 in that case?


Side comment, does the VLAN work for you on 14.0 w/o lowering the MTU?
Comment 2 Justin Hibbits freebsd_committer freebsd_triage 2024-05-27 22:30:46 UTC
(In reply to Bjoern A. Zeeb from comment #1)

Not sure, it could be related to that change.  Though in my case it starts working at boot, and just stops after a while, but "a while" seems to change (could be a day, could be a month between having to do the unplug dance).

I haven't changed the MTU at all on the VLAN, so just doing whatever is default.

Here's the ifconfig -mv output:

dpni0: flags=1008943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
        options=80028<VLAN_MTU,JUMBO_MTU,LINKSTATE>
        capabilities=8002b<RXCSUM,TXCSUM,VLAN_MTU,JUMBO_MTU,LINKSTATE>
        ether YY:YY:YY:YY:YY:YY
        inet XXX.XXX.XXX.XXX netmask 0xffffff00 broadcast XXX.XXX.XXX.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        supported media:
                media autoselect
                media 1000baseT mediaopt full-duplex,master
                media 1000baseT mediaopt full-duplex
                media 1000baseSX mediaopt full-duplex
                media 100baseTX mediaopt full-duplex
                media 100baseTX
                media 10baseT/UTP mediaopt full-duplex
                media 10baseT/UTP
                media none
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

I'll gladly test a patch you throw at me, as long as it's against 14.0 (not adventurous enough to run -CURRENT on my NAS :) )
Comment 3 Dmitry Salychev freebsd_committer freebsd_triage 2024-06-03 11:36:24 UTC
(In reply to Justin Hibbits from comment #0)

Could you show an output of:

1. sysctl dev.dpaa2_ni
2. top -SjwHPz -mcpu
3. vmstat -i | grep dpaa2

on a normally working system and after a moment when dpni0 stops working?
Comment 4 Dmitry Salychev freebsd_committer freebsd_triage 2024-06-03 13:16:41 UTC
Btw, were you stressing your NAS anyhow, i.e. was dpni0 pushed to max throughput at 1500 MTU (~970 Mbps, 121 MB/s)?
Comment 5 Justin Hibbits freebsd_committer freebsd_triage 2024-06-03 13:55:59 UTC
(In reply to Dmitry Salychev from comment #3)

My NAS is rarely stressed, though sometimes (not every time) when I do pkg upgrades the issue does hit, but often it's pretty idle when the issue hits.  I just set up a script to check the link every minute and dump the sysctl and top output to files when it fails to ping my router.  I'll attach those when it happens, and I'll attach the "good" ones now.
Comment 6 Justin Hibbits freebsd_committer freebsd_triage 2024-06-03 14:00:38 UTC
Created attachment 251195 [details]
Output of sysctl and top from working dpaa2 period
Comment 7 Dmitry Salychev freebsd_committer freebsd_triage 2024-06-03 17:25:42 UTC
(In reply to Justin Hibbits from comment #6)

Could you include vmstat output as well?

Regarding the "bad" state of the dpni0, it isn't possible to get it back to work without rebooting but re-plugging a cable back, is it?
Comment 8 Dmitry Salychev freebsd_committer freebsd_triage 2024-06-03 17:34:01 UTC
And "uname -apKU", please :)
Comment 9 Justin Hibbits freebsd_committer freebsd_triage 2024-06-03 17:37:26 UTC
(In reply to Dmitry Salychev from comment #8)

FreeBSD alexandria.knownspace 14.0-RELEASE-p3 FreeBSD 14.0-RELEASE-p3 #0: Mon Dec 11 05:07:37 UTC 2023     root@arm64-builder.daemonology.net:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64 aarch64 1400097 1400097
Comment 10 Justin Hibbits freebsd_committer freebsd_triage 2024-06-05 19:04:39 UTC
Created attachment 251240 [details]
Output of sysctl and top from failing dpaa2 period

Took a few days, but here's the output shortly after failure.
Comment 11 Bjoern A. Zeeb freebsd_committer freebsd_triage 2024-06-05 20:35:21 UTC
Comment on attachment 251240 [details]
Output of sysctl and top from failing dpaa2 period

How did you fix it?
Sorry, no ifconfig -vm output; can you add that to the script?
I am still working on the patches, sorry.

does an ifconfig dpni0 media auto  or something like this fix it without having to walk to the machine?
Comment 12 Justin Hibbits freebsd_committer freebsd_triage 2024-06-05 20:46:38 UTC
(In reply to Bjoern A. Zeeb from comment #11)

I can try the `ifconfig dpni0 media auto` when it stops again.  If at my computer I restore it by flapping the port on my switch.

I added ifconfig -vm to my script and restarted it.

@dsl what vmstat output would you like to see?  Had missed that earlier.
Comment 13 Bjoern A. Zeeb freebsd_committer freebsd_triage 2024-06-05 21:18:25 UTC
(In reply to Justin Hibbits from comment #12)

Thanks; of media none; followed by media auto;  simply toggling it should do the trick.
Comment 14 Justin Hibbits freebsd_committer freebsd_triage 2024-06-06 13:11:51 UTC
Created attachment 251252 [details]
Output of sysctl and top from failing dpaa2 period (take 2)

This one includes vmstat and ifconfig outputs, too.

@bz `ifconfig dpni0 media none; ifconfig dpni0 media auto` worked to restore, so this can be a workaround for now.
Comment 15 Justin Hibbits freebsd_committer freebsd_triage 2024-06-25 15:16:28 UTC
Could this be PHY related, not necessarily dpni related?  This board has an Atheros PHY (atphy0); I don't see any debug sysctls for atphy, or any miibus for that matter, so have nothing more I can provide without help.
Comment 16 Bjoern A. Zeeb freebsd_committer freebsd_triage 2024-08-16 11:24:00 UTC
(In reply to Justin Hibbits from comment #15)

I also saw it with rgephy after about 50-60 days on a different board.

So with my changed driver I sometimes see:

[3300001.688880] dpaa2_dpmac3: sc->link_state 2 == link_state 2. Forcing update.
[3300001.688926] dpaa2_dpmac3: sc->link_state 2 == link_state 2. Forcing update.
[3300002.735026] dpaa2_dpmac3: sc->link_state 2 == link_state 2. Forcing update.

which, I think, means we get an interrupt for it but there was no change.
But that's not this issue.


Then I found this in the logs:

[4524430.543893] dpni3: link state changed to DOWN
[4524430.546210] dpni3: 2 link states coalesced
[4524430.546215] dpni3: link state changed to DOWN
[4524430.553694] dpni3: link state changed to UP
[4549124.900410] dpni3: promiscuous mode enabled
[4549138.670429] dpni3: promiscuous mode disabled

I assume the promisc was when I started to debug it 6-7 hours later:


dev.dpaa2_ni.3 stats did not show much but the extra sysctl I have here said (note the DOWN):

# sysctl dev.dpaa2_ni.3.link
dev.dpaa2_ni.3.link:
Link State: DOWN (IGNORE)
Link Rate: 0
Link Options: 0
Link Speed Capabilities: 000000000000000000
Link Speed Advertised for autoneg: 000000000000000000

So "ni" thought the link was down.


ifconfig obviously did not think like that:

# ifconfig -m dpni3
dpni3: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
        options=8002b<RXCSUM,TXCSUM,VLAN_MTU,JUMBO_MTU,LINKSTATE>
        capabilities=8002b<RXCSUM,TXCSUM,VLAN_MTU,JUMBO_MTU,LINKSTATE>
        ether ....
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        supported media:
                media autoselect
                media 1000baseT mediaopt full-duplex,master
                media 1000baseT mediaopt full-duplex
                media 100baseTX mediaopt full-duplex
                media 100baseTX
                media 10baseT/UTP mediaopt full-duplex
                media 10baseT/UTP
                media none
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>


Trying to fix it again:

# ifconfig dpni3 media autoselect
dpaa2_dpmac3: sc->link_state 1 == link_state 1. Forcing update.

And after that:

# sysctl dev.dpaa2_ni.3.link
dev.dpaa2_ni.3.link:
Link State: UP (IGNORE)
Link Rate: 0
Link Options: 0
Link Speed Capabilities: 000000000000000000
Link Speed Advertised for autoneg: 000000000000000000

And "ni" thinks the link is UP again and all started working again.

This is what was in the log:

[4558309.018357] dpaa2_dpmac3: sc->link_state 1 == link_state 1. Forcing update.
[4558309.026876] dpni3: link state changed to DOWN
[4558313.000454] dpni3: link state changed to UP

For reference the "link_state" numbers (2 above and the 1 down here) come from sys/net if I remember the code correctly:
#define LINK_STATE_UNKNOWN      0       /* link invalid/unknown */
#define LINK_STATE_DOWN         1       /* link is down */
#define LINK_STATE_UP           2       /* link is up */


So when this all happened the internal link_state was indeed DOWN and not UP though the last "link state changed" message logged was to "UP" before.

I am still confused a bit and will try to add a bootverbose log for all internal "link_state" changes to see.
I'll also try again (as I find time) to push some of these changes into review so you guys can use them for debugging as well.


Hope this helps to start solving the mystery.
Comment 17 Bjoern A. Zeeb freebsd_committer freebsd_triage 2024-10-15 12:57:06 UTC
After 115 days of uptime on the test machine I got the problem too.

dpni though it was up;

dev.dpaa2_ni.3.link: 
Link State: UP (IGNORE)
Link Rate: 0
Link Options: 0
Link Speed Capabilities: 000000000000000000
Link Speed Advertised for autoneg: 000000000000000000


changing media options did not help either;  I had to down and up the interface.

This time no logging about any interrupts but that machine does not have the "log it all under bootverbose" change yet so possibly there were some we missed.
Comment 18 commit-hook freebsd_committer freebsd_triage 2026-04-21 09:39:21 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=c8cd633d78d04ff535960002ac9d1ab20f74b201

commit c8cd633d78d04ff535960002ac9d1ab20f74b201
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-02-17 03:04:41 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-04-21 09:37:19 +0000

    dpaa2: ni: add more stats and link information

    In addition to the locally generated statistics counters, dpaa2 ni
    provides a larger set of counters than we currently export via
    sysctl.  Add (most of) the missing counters and descriptions.
    Around Page 3/4 there are some things left to do if we want.
    Also the manual was not clear on the descriptions of 3/0 and 3/1.

    The second half of the change adds another sysctl note which exports
    the link-state, speed, and capabilities set as a text-blob.  This is
    especially interesting in case the "ni" stops passing packets.
    From what I have found in that case the (internal) link state of the
    ni goes DOWN but we do not see an interrupt for a link-state change.

    Being able to diagnose the state helps to (manually) fix it for now
    by changing the media status to 10BaseT or none and then back to auto.
    That usually brings the internal link state back UP.

    MFC after:      3 days
    PR:             279352
    Reviewed by:    dsl, tuexen
    Differential Revision: https://reviews.freebsd.org/D55321

 sys/dev/dpaa2/dpaa2_ni.c | 129 +++++++++++++++++++++++++++++++++++++++++------
 sys/dev/dpaa2/dpaa2_ni.h |   5 +-
 sys/dev/dpaa2/dpaa2_rc.c |   9 ++--
 3 files changed, 120 insertions(+), 23 deletions(-)
Comment 19 commit-hook freebsd_committer freebsd_triage 2026-04-22 22:47:45 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5cfbcaa13fb3176dc92574382558f4c4dbfc7d41

commit 5cfbcaa13fb3176dc92574382558f4c4dbfc7d41
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-02-17 03:04:41 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-04-22 22:47:17 +0000

    dpaa2: ni: add more stats and link information

    In addition to the locally generated statistics counters, dpaa2 ni
    provides a larger set of counters than we currently export via
    sysctl.  Add (most of) the missing counters and descriptions.
    Around Page 3/4 there are some things left to do if we want.
    Also the manual was not clear on the descriptions of 3/0 and 3/1.

    The second half of the change adds another sysctl note which exports
    the link-state, speed, and capabilities set as a text-blob.  This is
    especially interesting in case the "ni" stops passing packets.
    From what I have found in that case the (internal) link state of the
    ni goes DOWN but we do not see an interrupt for a link-state change.

    Being able to diagnose the state helps to (manually) fix it for now
    by changing the media status to 10BaseT or none and then back to auto.
    That usually brings the internal link state back UP.

    PR:             279352
    Reviewed by:    dsl, tuexen
    Differential Revision: https://reviews.freebsd.org/D55321

    (cherry picked from commit c8cd633d78d04ff535960002ac9d1ab20f74b201)

 sys/dev/dpaa2/dpaa2_ni.c | 129 +++++++++++++++++++++++++++++++++++++++++------
 sys/dev/dpaa2/dpaa2_ni.h |   5 +-
 sys/dev/dpaa2/dpaa2_rc.c |   9 ++--
 3 files changed, 120 insertions(+), 23 deletions(-)
Comment 20 Dmitry Salychev freebsd_committer freebsd_triage 2026-11-01 17:47:37 UTC
Please, try https://reviews.freebsd.org/D61079
Comment 21 Dmitry Salychev freebsd_committer freebsd_triage 2026-11-03 15:59:40 UTC
(In reply to Justin Hibbits from comment #15)

just pinging to let you know there's a patch to test
Comment 22 Justin Hibbits freebsd_committer freebsd_triage 2026-11-05 16:46:49 UTC
(In reply to Dmitry Salychev from comment #21)

I saw the review.  I'll try to make some time to test.  I actually haven't seen any problems (nothing in my logs) since upgrading to 15.x, while with 14.x I was seeing multiple reset logs a day every few days.
Comment 23 Dmitry Salychev freebsd_committer freebsd_triage 2026-11-05 19:22:20 UTC
(In reply to Justin Hibbits from comment #22)

I'm seeing dpaa2_niX interrupts generated often (i.e. link state change) with the 16.0-CURRENT ofter without this patch. Not sure about releases though.