2023-11-29 05:24:28

by Subbaraya Sundeep Bhatta

[permalink] [raw]
Subject: [PATCH v2 net] octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam

All the mailbox messages sent to AF needs to be guarded
by mutex lock. Add the missing lock in otx2_get_pauseparam
function.

Fixes: 75f36270990c ("octeontx2-pf: Support to enable/disable pause frames via ethtool")
Signed-off-by: Subbaraya Sundeep <[email protected]>
---
v2 changes:
Added maintainers of AF driver too

drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index 9efcec5..53f6258 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -334,9 +334,12 @@ static void otx2_get_pauseparam(struct net_device *netdev,
if (is_otx2_lbkvf(pfvf->pdev))
return;

+ mutex_lock(&pfvf->mbox.lock);
req = otx2_mbox_alloc_msg_cgx_cfg_pause_frm(&pfvf->mbox);
- if (!req)
+ if (!req) {
+ mutex_unlock(&pfvf->mbox.lock);
return;
+ }

if (!otx2_sync_mbox_msg(&pfvf->mbox)) {
rsp = (struct cgx_pause_frm_cfg *)
@@ -344,6 +347,7 @@ static void otx2_get_pauseparam(struct net_device *netdev,
pause->rx_pause = rsp->rx_pause;
pause->tx_pause = rsp->tx_pause;
}
+ mutex_unlock(&pfvf->mbox.lock);
}

static int otx2_set_pauseparam(struct net_device *netdev,
--
2.7.4


2023-11-29 17:26:58

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH v2 net] octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam

On Wed, Nov 29, 2023 at 10:53:42AM +0530, Subbaraya Sundeep wrote:
> All the mailbox messages sent to AF needs to be guarded
> by mutex lock. Add the missing lock in otx2_get_pauseparam
> function.
>
> Fixes: 75f36270990c ("octeontx2-pf: Support to enable/disable pause frames via ethtool")
> Signed-off-by: Subbaraya Sundeep <[email protected]>
> ---
> v2 changes:
> Added maintainers of AF driver too

Hi Subbaraya,

I was expecting an update to locking in otx2_dcbnl_ieee_setpfc()
Am I missing something here?

Link: https://lore.kernel.org/all/CO1PR18MB4666C2C1D1284F425E4C9F38A183A@CO1PR18MB4666.namprd18.prod.outlook.com/

>
> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> index 9efcec5..53f6258 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> @@ -334,9 +334,12 @@ static void otx2_get_pauseparam(struct net_device *netdev,
> if (is_otx2_lbkvf(pfvf->pdev))
> return;
>
> + mutex_lock(&pfvf->mbox.lock);
> req = otx2_mbox_alloc_msg_cgx_cfg_pause_frm(&pfvf->mbox);
> - if (!req)
> + if (!req) {
> + mutex_unlock(&pfvf->mbox.lock);
> return;
> + }
>
> if (!otx2_sync_mbox_msg(&pfvf->mbox)) {
> rsp = (struct cgx_pause_frm_cfg *)
> @@ -344,6 +347,7 @@ static void otx2_get_pauseparam(struct net_device *netdev,
> pause->rx_pause = rsp->rx_pause;
> pause->tx_pause = rsp->tx_pause;
> }
> + mutex_unlock(&pfvf->mbox.lock);
> }
>
> static int otx2_set_pauseparam(struct net_device *netdev,
> --
> 2.7.4
>

2023-11-30 04:37:05

by Subbaraya Sundeep Bhatta

[permalink] [raw]
Subject: RE: [EXT] Re: [PATCH v2 net] octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam

Hi Simon,

>-----Original Message-----
>From: Simon Horman <[email protected]>
>Sent: Wednesday, November 29, 2023 10:57 PM
>To: Subbaraya Sundeep Bhatta <[email protected]>
>Cc: [email protected]; [email protected]; [email protected];
>[email protected]; [email protected]; [email protected]; Sunil
>Kovvuri Goutham <[email protected]>; Geethasowjanya Akula
><[email protected]>; Hariprasad Kelam <[email protected]>; Linu
>Cherian <[email protected]>; Jerin Jacob Kollanukkaran
><[email protected]>
>Subject: [EXT] Re: [PATCH v2 net] octeontx2-pf: Add missing mutex lock in
>otx2_get_pauseparam
>
>External Email
>
>----------------------------------------------------------------------
>On Wed, Nov 29, 2023 at 10:53:42AM +0530, Subbaraya Sundeep wrote:
>> All the mailbox messages sent to AF needs to be guarded by mutex lock.
>> Add the missing lock in otx2_get_pauseparam function.
>>
>> Fixes: 75f36270990c ("octeontx2-pf: Support to enable/disable pause
>> frames via ethtool")
>> Signed-off-by: Subbaraya Sundeep <[email protected]>
>> ---
>> v2 changes:
>> Added maintainers of AF driver too
>
>Hi Subbaraya,
>
>I was expecting an update to locking in otx2_dcbnl_ieee_setpfc() Am I missing
>something here?
>
I will send it as separate patch since both are unrelated and I have to write two Fixes
in commit description.

Thanks,
Sundeep

>Link: https://urldefense.proofpoint.com/v2/url?u=https-
>3A__lore.kernel.org_all_CO1PR18MB4666C2C1D1284F425E4C9F38A183A-
>40CO1PR18MB4666.namprd18.prod.outlook.com_&d=DwIBAg&c=nKjWec2b6
>R0mOyPaz7xtfQ&r=wYboOaw70DU5hRM5HDwORJx_MfD-
>hXXKii2eobNikgU&m=Ds2khmm7pm9NaX3QpUwPGiIsVYvkzFPCdEKh3QVWw4
>-54ZzgzD-
>KjwxrOYkhVmPj&s=q_928NBo4GzHDgDQotxtbxnd8_en9eflVGT9v8rAb9Y&e=
>
>>
>> drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
>> b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
>> index 9efcec5..53f6258 100644
>> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
>> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
>> @@ -334,9 +334,12 @@ static void otx2_get_pauseparam(struct net_device
>*netdev,
>> if (is_otx2_lbkvf(pfvf->pdev))
>> return;
>>
>> + mutex_lock(&pfvf->mbox.lock);
>> req = otx2_mbox_alloc_msg_cgx_cfg_pause_frm(&pfvf->mbox);
>> - if (!req)
>> + if (!req) {
>> + mutex_unlock(&pfvf->mbox.lock);
>> return;
>> + }
>>
>> if (!otx2_sync_mbox_msg(&pfvf->mbox)) {
>> rsp = (struct cgx_pause_frm_cfg *)
>> @@ -344,6 +347,7 @@ static void otx2_get_pauseparam(struct net_device
>*netdev,
>> pause->rx_pause = rsp->rx_pause;
>> pause->tx_pause = rsp->tx_pause;
>> }
>> + mutex_unlock(&pfvf->mbox.lock);
>> }
>>
>> static int otx2_set_pauseparam(struct net_device *netdev,
>> --
>> 2.7.4
>>

2023-11-30 16:25:03

by Simon Horman

[permalink] [raw]
Subject: Re: [EXT] Re: [PATCH v2 net] octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam

On Thu, Nov 30, 2023 at 04:36:22AM +0000, Subbaraya Sundeep Bhatta wrote:
> Hi Simon,
>
> >-----Original Message-----
> >From: Simon Horman <[email protected]>
> >Sent: Wednesday, November 29, 2023 10:57 PM
> >To: Subbaraya Sundeep Bhatta <[email protected]>
> >Cc: [email protected]; [email protected]; [email protected];
> >[email protected]; [email protected]; [email protected]; Sunil
> >Kovvuri Goutham <[email protected]>; Geethasowjanya Akula
> ><[email protected]>; Hariprasad Kelam <[email protected]>; Linu
> >Cherian <[email protected]>; Jerin Jacob Kollanukkaran
> ><[email protected]>
> >Subject: [EXT] Re: [PATCH v2 net] octeontx2-pf: Add missing mutex lock in
> >otx2_get_pauseparam
> >
> >External Email
> >
> >----------------------------------------------------------------------
> >On Wed, Nov 29, 2023 at 10:53:42AM +0530, Subbaraya Sundeep wrote:
> >> All the mailbox messages sent to AF needs to be guarded by mutex lock.
> >> Add the missing lock in otx2_get_pauseparam function.
> >>
> >> Fixes: 75f36270990c ("octeontx2-pf: Support to enable/disable pause
> >> frames via ethtool")
> >> Signed-off-by: Subbaraya Sundeep <[email protected]>
> >> ---
> >> v2 changes:
> >> Added maintainers of AF driver too
> >
> >Hi Subbaraya,
> >
> >I was expecting an update to locking in otx2_dcbnl_ieee_setpfc() Am I missing
> >something here?
> >
> I will send it as separate patch since both are unrelated and I have to write two Fixes
> in commit description.

Understood.

In that case I am happy with this patch.

Reviewed-by: Simon Horman <[email protected]>

2023-12-01 11:11:21

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH v2 net] octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

On Wed, 29 Nov 2023 10:53:42 +0530 you wrote:
> All the mailbox messages sent to AF needs to be guarded
> by mutex lock. Add the missing lock in otx2_get_pauseparam
> function.
>
> Fixes: 75f36270990c ("octeontx2-pf: Support to enable/disable pause frames via ethtool")
> Signed-off-by: Subbaraya Sundeep <[email protected]>
>
> [...]

Here is the summary with links:
- [v2,net] octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam
https://git.kernel.org/netdev/net/c/9572c949385a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html