* [net PATCH] octeon_ep:fix VF MAC address lifecycle handling
@ 2025-09-11 14:49 Sathesh B Edara
2025-09-12 17:02 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Sathesh B Edara @ 2025-09-11 14:49 UTC (permalink / raw)
To: linux-kernel, sburla, vburru, davem, edumazet, kuba, pabeni,
netdev, hgani, andrew, srasheed
Cc: sedara
Currently, VF MAC address info is not updated when the MAC address is
configured from VF, and it is not cleared when the VF is removed. This
leads to stale or missing MAC information in the PF, which may cause
incorrect state tracking or inconsistencies when VFs are hot-plugged
or reassigned.
Fix this by:
- storing the VF MAC address in the PF when it is set from VF
- clearing the stored VF MAC address when the VF is removed
This ensures that the PF always has correct VF MAC state.
Fixes: cde29af9e68e ("octeon_ep: add PF-VF mailbox communication")
Signed-off-by: Sathesh B Edara <sedara@marvell.com>
---
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
index ebecdd29f3bd..0867fab61b19 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
@@ -196,6 +196,7 @@ static void octep_pfvf_get_mac_addr(struct octep_device *oct, u32 vf_id,
vf_id);
return;
}
+ ether_addr_copy(oct->vf_info[vf_id].mac_addr, rsp->s_set_mac.mac_addr);
rsp->s_set_mac.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK;
}
@@ -205,6 +206,8 @@ static void octep_pfvf_dev_remove(struct octep_device *oct, u32 vf_id,
{
int err;
+ /* Reset VF-specific information maintained by the PF */
+ memset(&oct->vf_info[vf_id], 0, sizeof(struct octep_pfvf_info));
err = octep_ctrl_net_dev_remove(oct, vf_id);
if (err) {
rsp->s.type = OCTEP_PFVF_MBOX_TYPE_RSP_NACK;
--
2.36.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [net PATCH] octeon_ep:fix VF MAC address lifecycle handling
2025-09-11 14:49 [net PATCH] octeon_ep:fix VF MAC address lifecycle handling Sathesh B Edara
@ 2025-09-12 17:02 ` Simon Horman
2025-09-15 9:17 ` [EXTERNAL] " Sathesh B Edara
0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2025-09-12 17:02 UTC (permalink / raw)
To: Sathesh B Edara
Cc: linux-kernel, sburla, vburru, davem, edumazet, kuba, pabeni,
netdev, hgani, andrew, srasheed
On Thu, Sep 11, 2025 at 07:49:33AM -0700, Sathesh B Edara wrote:
> Currently, VF MAC address info is not updated when the MAC address is
> configured from VF, and it is not cleared when the VF is removed. This
> leads to stale or missing MAC information in the PF, which may cause
> incorrect state tracking or inconsistencies when VFs are hot-plugged
> or reassigned.
>
> Fix this by:
> - storing the VF MAC address in the PF when it is set from VF
> - clearing the stored VF MAC address when the VF is removed
>
> This ensures that the PF always has correct VF MAC state.
>
> Fixes: cde29af9e68e ("octeon_ep: add PF-VF mailbox communication")
> Signed-off-by: Sathesh B Edara <sedara@marvell.com>
> ---
> drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> index ebecdd29f3bd..0867fab61b19 100644
> --- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> @@ -196,6 +196,7 @@ static void octep_pfvf_get_mac_addr(struct octep_device *oct, u32 vf_id,
> vf_id);
> return;
> }
> + ether_addr_copy(oct->vf_info[vf_id].mac_addr, rsp->s_set_mac.mac_addr);
> rsp->s_set_mac.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK;
> }
>
> @@ -205,6 +206,8 @@ static void octep_pfvf_dev_remove(struct octep_device *oct, u32 vf_id,
> {
> int err;
>
> + /* Reset VF-specific information maintained by the PF */
> + memset(&oct->vf_info[vf_id], 0, sizeof(struct octep_pfvf_info));
Hi Sathesh,
Can the following be used here?
(completely untested)
eth_zero_addr(oct->vf_info[vf_id].mac_addr);
Or does more of oct->vf_info[vf_id] need to be reset?
> err = octep_ctrl_net_dev_remove(oct, vf_id);
> if (err) {
> rsp->s.type = OCTEP_PFVF_MBOX_TYPE_RSP_NACK;
> --
> 2.36.0
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: [EXTERNAL] Re: [net PATCH] octeon_ep:fix VF MAC address lifecycle handling
2025-09-12 17:02 ` Simon Horman
@ 2025-09-15 9:17 ` Sathesh B Edara
2025-09-16 12:28 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Sathesh B Edara @ 2025-09-15 9:17 UTC (permalink / raw)
To: Simon Horman
Cc: linux-kernel@vger.kernel.org, Satananda Burla,
Veerasenareddy Burru, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
Haseeb Gani, andrew@lunn.ch, Shinas Rasheed
> > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> > b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> > index ebecdd29f3bd..0867fab61b19 100644
> > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> > @@ -196,6 +196,7 @@ static void octep_pfvf_get_mac_addr(struct
> octep_device *oct, u32 vf_id,
> > vf_id);
> > return;
> > }
> > + ether_addr_copy(oct->vf_info[vf_id].mac_addr,
> > +rsp->s_set_mac.mac_addr);
> > rsp->s_set_mac.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK; }
> >
> > @@ -205,6 +206,8 @@ static void octep_pfvf_dev_remove(struct
> > octep_device *oct, u32 vf_id, {
> > int err;
> >
> > + /* Reset VF-specific information maintained by the PF */
> > + memset(&oct->vf_info[vf_id], 0, sizeof(struct octep_pfvf_info));
>
> Hi Sathesh,
>
> Can the following be used here?
> (completely untested)
>
> eth_zero_addr(oct->vf_info[vf_id].mac_addr);
>
> Or does more of oct->vf_info[vf_id] need to be reset?
Hi Simon,
Thank you for your comments.
Yes, in addition to clearing the MAC address, we also need to reset other fields within oct->vf_info[vf_id] to fully clean up the VF-specific state maintained at the PF level.
This ensures that all VF-related configuration and runtime data are properly cleared when the VF is removed.
Thanks,
Sathesh
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [EXTERNAL] Re: [net PATCH] octeon_ep:fix VF MAC address lifecycle handling
2025-09-15 9:17 ` [EXTERNAL] " Sathesh B Edara
@ 2025-09-16 12:28 ` Simon Horman
0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-09-16 12:28 UTC (permalink / raw)
To: Sathesh B Edara
Cc: linux-kernel@vger.kernel.org, Satananda Burla,
Veerasenareddy Burru, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
Haseeb Gani, andrew@lunn.ch, Shinas Rasheed
On Mon, Sep 15, 2025 at 09:17:36AM +0000, Sathesh B Edara wrote:
>
>
> > > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> > > b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> > > index ebecdd29f3bd..0867fab61b19 100644
> > > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> > > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
> > > @@ -196,6 +196,7 @@ static void octep_pfvf_get_mac_addr(struct
> > octep_device *oct, u32 vf_id,
> > > vf_id);
> > > return;
> > > }
> > > + ether_addr_copy(oct->vf_info[vf_id].mac_addr,
> > > +rsp->s_set_mac.mac_addr);
> > > rsp->s_set_mac.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK; }
> > >
> > > @@ -205,6 +206,8 @@ static void octep_pfvf_dev_remove(struct
> > > octep_device *oct, u32 vf_id, {
> > > int err;
> > >
> > > + /* Reset VF-specific information maintained by the PF */
> > > + memset(&oct->vf_info[vf_id], 0, sizeof(struct octep_pfvf_info));
> >
> > Hi Sathesh,
> >
> > Can the following be used here?
> > (completely untested)
> >
> > eth_zero_addr(oct->vf_info[vf_id].mac_addr);
> >
> > Or does more of oct->vf_info[vf_id] need to be reset?
>
> Hi Simon,
> Thank you for your comments.
> Yes, in addition to clearing the MAC address, we also need to reset other fields within oct->vf_info[vf_id] to fully clean up the VF-specific state maintained at the PF level.
> This ensures that all VF-related configuration and runtime data are properly cleared when the VF is removed.
Thanks, in that case this change good to me.
Given that the patch has been marked as Changes Requested, I assume on the
basis of my feedback, if it's not to much trouble could you repost with a
space after the 'octeon_ep:' in the subject.
Subject: [PATCH net] octeon_ep: fix VF MAC address lifecycle handling
Feel free to add:
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-16 12:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-11 14:49 [net PATCH] octeon_ep:fix VF MAC address lifecycle handling Sathesh B Edara
2025-09-12 17:02 ` Simon Horman
2025-09-15 9:17 ` [EXTERNAL] " Sathesh B Edara
2025-09-16 12:28 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).