qede: fix interrupt coalescing configuration
Subsystems (4)
PATCH 1/1 qede: fix interrupt coalescing configuration
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.
--- drivers/net/ethernet/qlogic/qede/qede_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_main.c +9 -2
@@ -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);
Signature · 1 line
2.27.0
From: Manish Chopra
Quoted 10 lines
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 usekrealloc()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
Quoted 37 lines
Signed-off-by Manish Chopra <[email protected]>Fixes b0ec5489c480 ("qede: preserve per queue stats across up/down of interface")Cc Bhaskar Upadhaya <[email protected]>Cc David S. Miller <[email protected]>Signed-off-by Alok Prasad <[email protected]>Signed-off-by Ariel Elior <[email protected]>--- drivers/net/ethernet/qlogic/qede/qede_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)drivers/net/ethernet/qlogic/qede/qede_main.c +9
-3@@ -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); --
Quoted 1 line
2.27.0
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Quoted 20 lines
-----Original Message-----
From: David Laight <[email protected]>
Sent: Thursday, February 16, 2023 6:11 PM
To: Manish Chopra <[email protected]>; [email protected]
Cc: [email protected]; Ariel Elior <[email protected]>; [email protected]; Bhaskar Upadhaya <[email protected]>; David S . Miller <[email protected]>
Subject: [EXT] RE: [PATCH net] qede: fix interrupt coalescing configurationExternal Email
----------------------------------------------------------------------
From: Manish ChopraQuoted 7 lines
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.
Quoted 5 lines
Quoted 3 lines
Fix this by allocating the memory of required size first with
kcalloc()and then usekrealloc()to resize and preserve the contents across down/up of the interface.Doesn't any extra memory allocated by
krealloc()need to be zerod ?
Hi David,
Driver will not attempt to allocate the size (using krealloc()) which is greater than the size initially allocated by kcalloc() ever.
Thanks,
Manish
Quoted 57 lines
David
Quoted 10 lines
Signed-off-by Manish Chopra <[email protected]>Fixes b0ec5489c480 ("qede: preserve per queue stats across up/down ofinterface")
Cc: [email protected]
Cc: Bhaskar Upadhaya <[email protected]>
Cc: David S. Miller <[email protected]>
Link:
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugzilla.redhat.c
om_show-5Fbug.cgi-3Fid-3D2160054&d=DwIFaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=b
Quoted 1 line
MTgx2X48QVXyXOEL8ALyI4dsWoR-m74c5n3d-
ruJI8&m=yxUlxYqV9xzhL4ZcgCffdrxKT
Quoted 1 line
6qVQqXE6JdE28XtyOwxInnkbtBiM1lxjYJCI0Wm&s=uz96PudLovEFy3W0_IpBM wBWwGkl
drivers/net/ethernet/qlogic/qede/qede_main.c static int qede_alloc_fp_array(struct qede_dev
Quoted 13 lines
88SQR0pJXP0k-5I&e=
Signed-off-by Alok Prasad <[email protected]>Signed-off-by Ariel Elior <[email protected]>--- drivers/net/ethernet/qlogic/qede/qede_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)drivers/net/ethernet/qlogic/qede/qede_main.c +0
-0@@ -970,8 +970,15 @@ static int qede_alloc_fp_array(struct qede_dev*edev)
Quoted 17 lines
drivers/net/ethernet/qlogic/qede/qede_main.c +9
-2goto 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" );Quoted 3 lines
kfree(edev->coal_entry);
--
2.27.0-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 10 lines · On Thu, 16 Feb 2023 03:54:47 -0800 you wrote:
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 usekrealloc()to resize and preserve the contents across down/up of the interface.[...]
Here is the summary with links:
- [net] qede: fix interrupt coalescing configuration
https://git.kernel.org/netdev/net/c/908d4bb7c54c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html