From: Simon Horman <horms@kernel.org>
To: Hariprasad Kelam <hkelam@marvell.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kuba@kernel.org, davem@davemloft.net, sgoutham@marvell.com,
gakula@marvell.com, jerinj@marvell.com, lcherian@marvell.com,
sbhatta@marvell.com, naveenm@marvell.com, edumazet@google.com,
pabeni@redhat.com, andrew+netdev@lunn.ch, bbhushan2@marvell.com
Subject: Re: [net-next 1/4] Octeontx2-af: Add programmed macaddr to RVU pfvf
Date: Thu, 17 Jul 2025 13:31:18 +0100 [thread overview]
Message-ID: <20250717123118.GB27043@horms.kernel.org> (raw)
In-Reply-To: <20250716164158.1537269-2-hkelam@marvell.com>
On Wed, Jul 16, 2025 at 10:11:55PM +0530, Hariprasad Kelam wrote:
> Octeontx2/CN10k MAC block supports DMAC filters. DMAC filters
> can be installed on the interface through ethtool.
>
> When a user installs a DMAC filter, the interface's MAC address
> is implicitly added to the filter list. To ensure consistency,
> this MAC address must be kept in sync with the pfvf->mac_addr field,
> which is used to install MAC-based NPC rules.
>
> This patch updates the pfvf->mac_addr field with the programmed MAC
> address and also enables VF interfaces to install DMAC filters.
>
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> ---
> .../ethernet/marvell/octeontx2/af/rvu_cgx.c | 23 ++++++++-----------
> 1 file changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
> index 890a1a5df2de..dd589f9b10da 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
> @@ -682,16 +682,19 @@ int rvu_mbox_handler_cgx_mac_addr_set(struct rvu *rvu,
> struct cgx_mac_addr_set_or_get *rsp)
> {
> int pf = rvu_get_pf(rvu->pdev, req->hdr.pcifunc);
> + struct rvu_pfvf *pfvf;
> u8 cgx_id, lmac_id;
>
> - if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
> - return -EPERM;
> + if (!is_pf_cgxmapped(rvu, pf))
> + return LMAC_AF_ERR_PF_NOT_MAPPED;
>
> if (rvu_npc_exact_has_match_table(rvu))
> return rvu_npc_exact_mac_addr_set(rvu, req, rsp);
>
> rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
>
> + pfvf = &rvu->pf[pf];
> + memcpy(pfvf->mac_addr, req->mac_addr, ETH_ALEN);
nit: I think ether_addr_copy() can be used here.
> cgx_lmac_addr_set(cgx_id, lmac_id, req->mac_addr);
>
> return 0;
> @@ -769,20 +772,12 @@ int rvu_mbox_handler_cgx_mac_addr_get(struct rvu *rvu,
> struct cgx_mac_addr_set_or_get *req,
> struct cgx_mac_addr_set_or_get *rsp)
> {
> - int pf = rvu_get_pf(rvu->pdev, req->hdr.pcifunc);
> - u8 cgx_id, lmac_id;
> - int rc = 0;
> - u64 cfg;
> + struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc);
>
> - if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
> - return -EPERM;
> -
> - rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
> + if (!is_pf_cgxmapped(rvu, rvu_get_pf(rvu->pdev, req->hdr.pcifunc)))
> + return LMAC_AF_ERR_PF_NOT_MAPPED;
>
> - rsp->hdr.rc = rc;
> - cfg = cgx_lmac_addr_get(cgx_id, lmac_id);
> - /* copy 48 bit mac address to req->mac_addr */
> - u64_to_ether_addr(cfg, rsp->mac_addr);
> + memcpy(rsp->mac_addr, pfvf->mac_addr, ETH_ALEN);
Ditto.
> return 0;
> }
>
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2025-07-17 12:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 16:41 [net-next 0/4] Octeontx2-af: RPM: misc feaures Hariprasad Kelam
2025-07-16 16:41 ` [net-next 1/4] Octeontx2-af: Add programmed macaddr to RVU pfvf Hariprasad Kelam
2025-07-17 12:31 ` Simon Horman [this message]
2025-07-16 16:41 ` [net-next 2/4] Octeontx2-af: Disable stale DMAC filters Hariprasad Kelam
2025-07-17 12:33 ` Simon Horman
2025-07-16 16:41 ` [net-next 3/4] Octeontx2-af: RPM: Update DMA mask Hariprasad Kelam
2025-07-17 12:35 ` Simon Horman
2025-07-16 16:41 ` [net-next 4/4] Octeontx2-af: Debugfs support for firmware data Hariprasad Kelam
2025-07-16 17:26 ` ALOK TIWARI
2025-07-17 12:38 ` 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=20250717123118.GB27043@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bbhushan2@marvell.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gakula@marvell.com \
--cc=hkelam@marvell.com \
--cc=jerinj@marvell.com \
--cc=kuba@kernel.org \
--cc=lcherian@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=naveenm@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@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.