net: stmmac: fix oops when split header is enabled#3028
net: stmmac: fix oops when split header is enabled#3028pamolloy merged 1 commit intoadsp-6.12.0-yfrom
Conversation
nunojsa
left a comment
There was a problem hiding this comment.
Just a minor nit. As for the fix itself I don't really know the IP to opinate about it but looks good
| */ | ||
| if (!priv->plat->has_gmac4 && | ||
| /* Not last descriptor */ | ||
| (status & rx_not_ls)) |
There was a problem hiding this comment.
nit: line break seems unnecessary. If I'm not mistaken, checkpatch should even complain about it
There was a problem hiding this comment.
This is for adding the "Not last descriptor" at the right place. checkpatch is OK with it.
There was a problem hiding this comment.
I already got this because of things like the above but might only pop up with --strict or can be a checkpatch false positive. But more importantly, it does not go over the 80 column limit so It's very likely you're getting some comments from the maintainers because the above, AFAICT, is not following linux coding style.
I would rather update the comment (even though the condition is fairly obvious already).
There was a problem hiding this comment.
--strict does not give an error, either. This is a common way to add a comment for only one conditional. This does follow the Linux coding style. The link to the code is for preventing another way to break conditionals into multiple lines (which is required in GNU coding style, so for people who needs to switch between Linux and GNU, this is a common mistake)
But after reading the patch several times, I feels I should also add a comment for the GMAC4 conditional. So I put them in one comment and make the two conditionals in one line.
I also add back the comment from the original code.
I agree they are obvious. I just follow what the original code does.
|
You can submit it mainline and see what folks say. It would be good to add a |
8f28e7c to
15773a9
Compare
|
https://lore.kernel.org/lkml/20251202025421.4560-1-jie.zhang@analog.com/ Just needs an update to the commit message before being applied. |
|
@jiez Did you get a chance to submit an updated patch to the mailing list?
|
|
@pamolloy can we close this one? IIRC, the patch was accepted upstream wasn't it? |
For GMAC4, when split header is enabled, in some rare cases, the hardware does not fill buf2 of the first descriptor with payload. Thus we cannot assume buf2 is always fully filled if it is not the last descriptor. Otherwise, the length of buf2 of the second descriptor will be calculated wrong and cause an oops: Unable to handle kernel paging request at virtual address ffff00019246bfc0 Internal error: Oops: 0000000096000145 [#1] SMP Call trace: dcache_inval_poc+0x28/0x58 dma_direct_sync_single_for_cpu+0x38/0x6c __dma_sync_single_for_cpu+0x34/0x6c stmmac_napi_poll_rx+0x8f0/0xb60 [...] To fix this, the PL bit-field in RDES3 register is used for all descriptors, whether it is the last descriptor or not. Fixes: ec22200 ("net: stmmac: Prepare to add Split Header support") Link: https://lore.kernel.org/lkml/20251202025421.4560-1-jie.zhang@analog.com/ Signed-off-by: Jie Zhang <jie.zhang@analog.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
15773a9 to
83a0a81
Compare
For GMAC4, when split header is enabled, in some rare cases, the hardware does not fill buf2 of the first descriptor with payload. Thus we cannot assume buf2 is always fully filled if it is not the last descriptor. Otherwise, the length of buf2 of the second descriptor will be calculated wrong and cause an oops:
To fix this, the PL bit-field in RDES3 register is used for all descriptors, whether it is the last descriptor or not.
PR Description
necessary to understand them. List any dependencies required for this change.
any space), or simply check them after publishing the PR.
description and try to push all related PRs simultaneously.
PR Type
PR Checklist