From: Jakub Kicinski <kuba@kernel.org>
To: Roman Gushchin <roman.gushchin@linux.dev>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Rafal Ozieblo <rafalo@cadence.com>,
Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH net] net: macb: fix a memory corruption in extended buffer descriptor mode
Date: Tue, 11 Apr 2023 18:48:14 -0700 [thread overview]
Message-ID: <20230411184814.5be340a8@kernel.org> (raw)
In-Reply-To: <20230407172402.103168-1-roman.gushchin@linux.dev>
On Fri, 7 Apr 2023 10:24:02 -0700 Roman Gushchin wrote:
> The problem is resolved by extending the MACB_RX_WADDR_SIZE
> in the extended mode.
>
> Fixes: 7b4296148066 ("net: macb: Add support for PTP timestamps in DMA descriptors")
> Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> Co-developed-by: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
> drivers/net/ethernet/cadence/macb.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
> index c1fc91c97cee..1b330f7cfc09 100644
> --- a/drivers/net/ethernet/cadence/macb.h
> +++ b/drivers/net/ethernet/cadence/macb.h
> @@ -826,8 +826,13 @@ struct macb_dma_desc_ptp {
> #define MACB_RX_USED_SIZE 1
> #define MACB_RX_WRAP_OFFSET 1
> #define MACB_RX_WRAP_SIZE 1
> +#ifdef MACB_EXT_DESC
> +#define MACB_RX_WADDR_OFFSET 3
> +#define MACB_RX_WADDR_SIZE 29
> +#else
> #define MACB_RX_WADDR_OFFSET 2
> #define MACB_RX_WADDR_SIZE 30
> +#endif
Changing register definition based on Kconfig seems a bit old school.
Where is the extended descriptor mode enabled? Is it always on if
Kconfig is set or can it be off for some platforms based on other
capabilities? Judging by macb_dma_desc_get_size() small descriptors
can still be used even with EXT_DESC?
If I'm grepping correctly thru the painful macro magic this register
is only used in macb_get_addr(). It'd seem a bit more robust to me
to open code the extraction of the address based on bp->hw_dma_cap
in that one function.
In addition to maintainers please also CC Harini Katakam
<harini.katakam@xilinx.com> on v2.
next prev parent reply other threads:[~2023-04-12 1:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-07 17:24 [PATCH net] net: macb: fix a memory corruption in extended buffer descriptor mode Roman Gushchin
2023-04-11 18:20 ` Roman Gushchin
2023-04-11 18:30 ` Conor Dooley
2023-04-11 21:20 ` Roman Gushchin
2023-04-12 1:48 ` Jakub Kicinski [this message]
2023-04-12 3:13 ` Lars-Peter Clausen
2023-04-12 3:48 ` Roman Gushchin
2023-04-12 4:13 ` Jakub Kicinski
2023-04-12 15:47 ` Nicolas.Ferre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230411184814.5be340a8@kernel.org \
--to=kuba@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rafalo@cadence.com \
--cc=roman.gushchin@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).