[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8b0f8c22f6d24461b25001d907b09179@AcuMS.aculab.com>
Date: Thu, 16 Feb 2023 12:40:37 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Manish Chopra' <manishc@...vell.com>,
"kuba@...nel.org" <kuba@...nel.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"aelior@...vell.com" <aelior@...vell.com>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
Bhaskar Upadhaya <bupadhaya@...vell.com>,
"David S . Miller" <davem@...emloft.net>
Subject: RE: [PATCH net] qede: fix interrupt coalescing configuration
From: Manish Chopra
> Sent: 16 February 2023 11:55
>
> On default driver load device gets configured with unexpected
> higher interrupt coalescing values instead of default expected
> values as memory allocated from krealloc() is not supposed to
> be zeroed out and may contain garbage values.
>
> Fix this by allocating the memory of required size first with
> kcalloc() and then use krealloc() to resize and preserve the
> contents across down/up of the interface.
Doesn't any extra memory allocated by krealloc() need to
be zerod ?
David
>
> Signed-off-by: Manish Chopra <manishc@...vell.com>
> Fixes: b0ec5489c480 ("qede: preserve per queue stats across up/down of interface")
> Cc: stable@...r.kernel.org
> Cc: Bhaskar Upadhaya <bupadhaya@...vell.com>
> Cc: David S. Miller <davem@...emloft.net>
> Link: https://bugzilla.redhat.com/show_bug.cgi?id=2160054
> Signed-off-by: Alok Prasad <palok@...vell.com>
> Signed-off-by: Ariel Elior <aelior@...vell.com>
> ---
> drivers/net/ethernet/qlogic/qede/qede_main.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c
> b/drivers/net/ethernet/qlogic/qede/qede_main.c
> index 953f304b8588..af39513db1ba 100644
> --- a/drivers/net/ethernet/qlogic/qede/qede_main.c
> +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
> @@ -970,8 +970,15 @@ static int qede_alloc_fp_array(struct qede_dev *edev)
> goto err;
> }
>
> - mem = krealloc(edev->coal_entry, QEDE_QUEUE_CNT(edev) *
> - sizeof(*edev->coal_entry), GFP_KERNEL);
> + if (!edev->coal_entry) {
> + mem = kcalloc(QEDE_MAX_RSS_CNT(edev),
> + sizeof(*edev->coal_entry), GFP_KERNEL);
> + } else {
> + mem = krealloc(edev->coal_entry,
> + QEDE_QUEUE_CNT(edev) * sizeof(*edev->coal_entry),
> + GFP_KERNEL);
> + }
> +
> if (!mem) {
> DP_ERR(edev, "coalesce entry allocation failed\n");
> kfree(edev->coal_entry);
> --
> 2.27.0
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists