[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKxU2N8EL+ezO1gtLJCU8NDN81eKbpO1gv5DFkSRDSnVtos0-Q@mail.gmail.com>
Date: Wed, 30 Oct 2024 13:50:22 -0700
From: Rosen Penev <rosenp@...il.com>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
Justin Chen <justin.chen@...adcom.com>, Florian Fainelli <florian.fainelli@...adcom.com>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
Rafał Miłecki <rafal@...ecki.pl>,
Sudarsana Kalluru <skalluru@...vell.com>, Manish Chopra <manishc@...vell.com>,
Doug Berger <opendmb@...il.com>, Sabrina Dubroca <sd@...asysnail.net>,
Uwe Kleine-König <u.kleine-koenig@...libre.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] net: broadcom: use ethtool string helpers
On Wed, Oct 30, 2024 at 1:31 PM Jacob Keller <jacob.e.keller@...el.com> wrote:
>
>
>
> On 10/29/2024 5:37 PM, Jakub Kicinski wrote:
> > On Tue, 29 Oct 2024 16:43:15 -0700 Rosen Penev wrote:
> >>>> - memcpy(buf, bnx2x_tests_str_arr + start,
> >>>> - ETH_GSTRING_LEN * BNX2X_NUM_TESTS(bp));
> >>>> + for (i = start; i < BNX2X_NUM_TESTS(bp); i++)
> >>>> + ethtool_puts(&buf, bnx2x_tests_str_arr[i]);
> >>>
> >>> I don't think this is equivalent.
> >> What's wrong here?
> >
> > We used to copy ETH_GSTRING_LEN * BNX2X_NUM_TESTS(bp)
> > but i will no only go from start to BNX2X_NUM_TESTS(bp)
> > IOW the copied length is ETH_GSTRING_LEN * (BNX2X_NUM_TESTS(bp) - start)
> > No?
>
> Hmm. Yea that's right. I'm guessing BNX2X_NUM_TESTS(bp) changes the
> number of tests based on what start would be...
makes sense now.
Loop iteration variable should be ARRAY_SIZE(bnx2x_tests_str_arr),
which is BNX2X_NUM_TESTS_SF.
>
> Probably we could use a static size of the string array instead of
> BNX2X_NUM_TESTS(bp), and that would fix things, but this specific change
> needs more careful review of the surrounding code.
Powered by blists - more mailing lists