All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Sathesh B Edara <sedara@marvell.com>
Cc: linux-kernel@vger.kernel.org, sburla@marvell.com,
	vburru@marvell.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	hgani@marvell.com, andrew@lunn.ch, srasheed@marvell.com
Subject: Re: [net PATCH] octeon_ep:fix VF MAC address lifecycle handling
Date: Fri, 12 Sep 2025 18:02:14 +0100	[thread overview]
Message-ID: <20250912170214.GB224143@horms.kernel.org> (raw)
In-Reply-To: <20250911144933.6703-1-sedara@marvell.com>

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
> 
> 

  reply	other threads:[~2025-09-12 17:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-09-15  9:17   ` [EXTERNAL] " Sathesh B Edara
2025-09-16 12:28     ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250912170214.GB224143@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hgani@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sburla@marvell.com \
    --cc=sedara@marvell.com \
    --cc=srasheed@marvell.com \
    --cc=vburru@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.