* [PATCH v2] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create()
@ 2022-11-08 14:06 YueHaibing
2022-11-08 17:58 ` Tariq Toukan
0 siblings, 1 reply; 5+ messages in thread
From: YueHaibing @ 2022-11-08 14:06 UTC (permalink / raw)
To: borisp, saeedm, leon, davem, edumazet, kuba, pabeni, lkayal,
tariqt, markzhang
Cc: netdev, linux-rdma, linux-kernel, YueHaibing
'accel_tcp' is allocted by kvzalloc(), which should freed by kvfree().
Fixes: f52f2faee581 ("net/mlx5e: Introduce flow steering API")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v2: fix the same issue in mlx5e_accel_fs_tcp_destroy() and a commit log typo
---
drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
index 285d32d2fd08..d7c020f72401 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
@@ -365,7 +365,7 @@ void mlx5e_accel_fs_tcp_destroy(struct mlx5e_flow_steering *fs)
for (i = 0; i < ACCEL_FS_TCP_NUM_TYPES; i++)
accel_fs_tcp_destroy_table(fs, i);
- kfree(accel_tcp);
+ kvfree(accel_tcp);
mlx5e_fs_set_accel_tcp(fs, NULL);
}
@@ -397,7 +397,7 @@ int mlx5e_accel_fs_tcp_create(struct mlx5e_flow_steering *fs)
err_destroy_tables:
while (--i >= 0)
accel_fs_tcp_destroy_table(fs, i);
- kfree(accel_tcp);
+ kvfree(accel_tcp);
mlx5e_fs_set_accel_tcp(fs, NULL);
return err;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create()
2022-11-08 14:06 [PATCH v2] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create() YueHaibing
@ 2022-11-08 17:58 ` Tariq Toukan
2022-11-08 19:45 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: Tariq Toukan @ 2022-11-08 17:58 UTC (permalink / raw)
To: YueHaibing, borisp, saeedm, leon, davem, edumazet, kuba, pabeni,
lkayal, tariqt, markzhang
Cc: netdev, linux-rdma, linux-kernel
On 11/8/2022 4:06 PM, YueHaibing wrote:
> 'accel_tcp' is allocted by kvzalloc(), which should freed by kvfree().
>
> Fixes: f52f2faee581 ("net/mlx5e: Introduce flow steering API")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> v2: fix the same issue in mlx5e_accel_fs_tcp_destroy() and a commit log typo
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
> index 285d32d2fd08..d7c020f72401 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
> @@ -365,7 +365,7 @@ void mlx5e_accel_fs_tcp_destroy(struct mlx5e_flow_steering *fs)
> for (i = 0; i < ACCEL_FS_TCP_NUM_TYPES; i++)
> accel_fs_tcp_destroy_table(fs, i);
>
> - kfree(accel_tcp);
> + kvfree(accel_tcp);
> mlx5e_fs_set_accel_tcp(fs, NULL);
> }
>
> @@ -397,7 +397,7 @@ int mlx5e_accel_fs_tcp_create(struct mlx5e_flow_steering *fs)
> err_destroy_tables:
> while (--i >= 0)
> accel_fs_tcp_destroy_table(fs, i);
> - kfree(accel_tcp);
> + kvfree(accel_tcp);
> mlx5e_fs_set_accel_tcp(fs, NULL);
> return err;
> }
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Thanks for your patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create()
2022-11-08 17:58 ` Tariq Toukan
@ 2022-11-08 19:45 ` Eric Dumazet
2022-11-10 7:31 ` Tariq Toukan
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2022-11-08 19:45 UTC (permalink / raw)
To: Tariq Toukan
Cc: YueHaibing, borisp, saeedm, leon, davem, kuba, pabeni, lkayal,
tariqt, markzhang, netdev, linux-rdma, linux-kernel
On Tue, Nov 8, 2022 at 9:58 AM Tariq Toukan <ttoukan.linux@gmail.com> wrote:
>
>
>
> On 11/8/2022 4:06 PM, YueHaibing wrote:
> > 'accel_tcp' is allocted by kvzalloc(), which should freed by kvfree().
> >
> > Fixes: f52f2faee581 ("net/mlx5e: Introduce flow steering API")
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > ---
> > v2: fix the same issue in mlx5e_accel_fs_tcp_destroy() and a commit log typo
> > ---
> > drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
> > index 285d32d2fd08..d7c020f72401 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
> > @@ -365,7 +365,7 @@ void mlx5e_accel_fs_tcp_destroy(struct mlx5e_flow_steering *fs)
> > for (i = 0; i < ACCEL_FS_TCP_NUM_TYPES; i++)
> > accel_fs_tcp_destroy_table(fs, i);
> >
> > - kfree(accel_tcp);
> > + kvfree(accel_tcp);
> > mlx5e_fs_set_accel_tcp(fs, NULL);
> > }
> >
> > @@ -397,7 +397,7 @@ int mlx5e_accel_fs_tcp_create(struct mlx5e_flow_steering *fs)
> > err_destroy_tables:
> > while (--i >= 0)
> > accel_fs_tcp_destroy_table(fs, i);
> > - kfree(accel_tcp);
> > + kvfree(accel_tcp);
> > mlx5e_fs_set_accel_tcp(fs, NULL);
> > return err;
> > }
>
> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
>
> Thanks for your patch.
Although this structure is 64 bytes... Not sure why kvmalloc() has
been used for this small chunk.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create()
2022-11-08 19:45 ` Eric Dumazet
@ 2022-11-10 7:31 ` Tariq Toukan
2022-11-10 11:04 ` YueHaibing
0 siblings, 1 reply; 5+ messages in thread
From: Tariq Toukan @ 2022-11-10 7:31 UTC (permalink / raw)
To: Eric Dumazet
Cc: YueHaibing, borisp, saeedm, leon, davem, kuba, pabeni, lkayal,
tariqt, markzhang, netdev, linux-rdma, linux-kernel
On 11/8/2022 9:45 PM, Eric Dumazet wrote:
> On Tue, Nov 8, 2022 at 9:58 AM Tariq Toukan <ttoukan.linux@gmail.com> wrote:
>>
>>
>>
>> On 11/8/2022 4:06 PM, YueHaibing wrote:
>>> 'accel_tcp' is allocted by kvzalloc(), which should freed by kvfree().
>>>
>>> Fixes: f52f2faee581 ("net/mlx5e: Introduce flow steering API")
>>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>>> ---
>>> v2: fix the same issue in mlx5e_accel_fs_tcp_destroy() and a commit log typo
>>> ---
>>> drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>>> index 285d32d2fd08..d7c020f72401 100644
>>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>>> @@ -365,7 +365,7 @@ void mlx5e_accel_fs_tcp_destroy(struct mlx5e_flow_steering *fs)
>>> for (i = 0; i < ACCEL_FS_TCP_NUM_TYPES; i++)
>>> accel_fs_tcp_destroy_table(fs, i);
>>>
>>> - kfree(accel_tcp);
>>> + kvfree(accel_tcp);
>>> mlx5e_fs_set_accel_tcp(fs, NULL);
>>> }
>>>
>>> @@ -397,7 +397,7 @@ int mlx5e_accel_fs_tcp_create(struct mlx5e_flow_steering *fs)
>>> err_destroy_tables:
>>> while (--i >= 0)
>>> accel_fs_tcp_destroy_table(fs, i);
>>> - kfree(accel_tcp);
>>> + kvfree(accel_tcp);
>>> mlx5e_fs_set_accel_tcp(fs, NULL);
>>> return err;
>>> }
>>
>> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
>>
>> Thanks for your patch.
>
> Although this structure is 64 bytes... Not sure why kvmalloc() has
> been used for this small chunk.
It's a small chunk indeed. Unnecessary usage of kvmalloc.
Although it's not critical (used only in slowpath), it'd be nice to
clean it up and directly call kzalloc, instead of aligning the kfree().
YueHaibing, can you please submit a v3 for this?
Regards,
Tariq
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create()
2022-11-10 7:31 ` Tariq Toukan
@ 2022-11-10 11:04 ` YueHaibing
0 siblings, 0 replies; 5+ messages in thread
From: YueHaibing @ 2022-11-10 11:04 UTC (permalink / raw)
To: Tariq Toukan, Eric Dumazet
Cc: borisp, saeedm, leon, davem, kuba, pabeni, lkayal, tariqt,
markzhang, netdev, linux-rdma, linux-kernel
On 2022/11/10 15:31, Tariq Toukan wrote:
>
>
> On 11/8/2022 9:45 PM, Eric Dumazet wrote:
>> On Tue, Nov 8, 2022 at 9:58 AM Tariq Toukan <ttoukan.linux@gmail.com> wrote:
>>>
>>>
>>>
>>> On 11/8/2022 4:06 PM, YueHaibing wrote:
>>>> 'accel_tcp' is allocted by kvzalloc(), which should freed by kvfree().
>>>>
>>>> Fixes: f52f2faee581 ("net/mlx5e: Introduce flow steering API")
>>>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>>>> ---
>>>> v2: fix the same issue in mlx5e_accel_fs_tcp_destroy() and a commit log typo
>>>> ---
>>>> drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 4 ++--
>>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>>>> index 285d32d2fd08..d7c020f72401 100644
>>>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>>>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c
>>>> @@ -365,7 +365,7 @@ void mlx5e_accel_fs_tcp_destroy(struct mlx5e_flow_steering *fs)
>>>> for (i = 0; i < ACCEL_FS_TCP_NUM_TYPES; i++)
>>>> accel_fs_tcp_destroy_table(fs, i);
>>>>
>>>> - kfree(accel_tcp);
>>>> + kvfree(accel_tcp);
>>>> mlx5e_fs_set_accel_tcp(fs, NULL);
>>>> }
>>>>
>>>> @@ -397,7 +397,7 @@ int mlx5e_accel_fs_tcp_create(struct mlx5e_flow_steering *fs)
>>>> err_destroy_tables:
>>>> while (--i >= 0)
>>>> accel_fs_tcp_destroy_table(fs, i);
>>>> - kfree(accel_tcp);
>>>> + kvfree(accel_tcp);
>>>> mlx5e_fs_set_accel_tcp(fs, NULL);
>>>> return err;
>>>> }
>>>
>>> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
>>>
>>> Thanks for your patch.
>>
>> Although this structure is 64 bytes... Not sure why kvmalloc() has
>> been used for this small chunk.
>
> It's a small chunk indeed. Unnecessary usage of kvmalloc.
>
> Although it's not critical (used only in slowpath), it'd be nice to clean it up and directly call kzalloc, instead of aligning the kfree().
>
> YueHaibing, can you please submit a v3 for this?
Sure, will resend.
>
> Regards,
> Tariq
> .
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-10 11:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08 14:06 [PATCH v2] net/mlx5e: Use kvfree() in mlx5e_accel_fs_tcp_create() YueHaibing
2022-11-08 17:58 ` Tariq Toukan
2022-11-08 19:45 ` Eric Dumazet
2022-11-10 7:31 ` Tariq Toukan
2022-11-10 11:04 ` YueHaibing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox