aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
diff options
context:
space:
mode:
authorHariprasad Kelam <hkelam@marvell.com>2020-11-15 01:23:01 +0530
committerJakub Kicinski <kuba@kernel.org>2020-11-17 13:48:21 -0800
commit4f88ed2cc5afb14c07fdca27ca1aa9122c4fe421 (patch)
tree935d3452c9ed6174c00cc6e43258f3c1fc7500ec /drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
parentocteontx2-pf: Add support for SR-IOV management functions (diff)
downloadlinux-dev-4f88ed2cc5afb14c07fdca27ca1aa9122c4fe421.tar.xz
linux-dev-4f88ed2cc5afb14c07fdca27ca1aa9122c4fe421.zip
octeontx2-af: Handle PF-VF mac address changes
This patch handles the VF mac address changes as given below. 1. mac addr configrued by VF will be retained until VF module unload. 2. mac addr configred by PF for VF will be retained until power cycle. 3. mac addr confgired by PF for its VF can't be overwritten by VF. Signed-off-by: Hariprasad Kelam <hkelam@marvell.com> Signed-off-by: Sunil Goutham <sgoutham@marvell.com> Signed-off-by: Naveen Mamindlapalli <naveenm@marvell.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
index ca50da714112..4ddfdff33a61 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
@@ -938,7 +938,8 @@ static void npc_update_tx_entry(struct rvu *rvu, struct rvu_pfvf *pfvf,
static int npc_install_flow(struct rvu *rvu, int blkaddr, u16 target,
int nixlf, struct rvu_pfvf *pfvf,
struct npc_install_flow_req *req,
- struct npc_install_flow_rsp *rsp, bool enable)
+ struct npc_install_flow_rsp *rsp, bool enable,
+ bool pf_set_vfs_mac)
{
struct rvu_npc_mcam_rule *def_ucast_rule = pfvf->def_ucast_rule;
u64 features, installed_features, missing_features = 0;
@@ -1065,6 +1066,12 @@ update_rule:
if (req->default_rule)
pfvf->def_ucast_rule = rule;
+ /* VF's MAC address is being changed via PF */
+ if (pf_set_vfs_mac) {
+ ether_addr_copy(pfvf->default_mac, req->packet.dmac);
+ ether_addr_copy(pfvf->mac_addr, req->packet.dmac);
+ }
+
if (pfvf->pf_set_vf_cfg && req->vtag0_type == NIX_AF_LFX_RX_VTAG_TYPE7)
rule->vfvlan_cfg = true;
@@ -1078,6 +1085,7 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu,
bool from_vf = !!(req->hdr.pcifunc & RVU_PFVF_FUNC_MASK);
int blkaddr, nixlf, err;
struct rvu_pfvf *pfvf;
+ bool pf_set_vfs_mac = false;
bool enable = true;
u16 target;
@@ -1102,8 +1110,11 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu,
if (!req->hdr.pcifunc)
target = req->vf;
/* PF installing for its VF */
- else if (!from_vf && req->vf)
+ else if (!from_vf && req->vf) {
target = (req->hdr.pcifunc & ~RVU_PFVF_FUNC_MASK) | req->vf;
+ pf_set_vfs_mac = req->default_rule &&
+ (req->features & BIT_ULL(NPC_DMAC));
+ }
/* msg received from PF/VF */
else
target = req->hdr.pcifunc;
@@ -1152,7 +1163,7 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu,
return -EINVAL;
return npc_install_flow(rvu, blkaddr, target, nixlf, pfvf, req, rsp,
- enable);
+ enable, pf_set_vfs_mac);
}
static int npc_delete_flow(struct rvu *rvu, struct rvu_npc_mcam_rule *rule,