RE: [EXTERNAL] Re: [net-next PATCH v5 05/10] octeontx2-af: Add packet path between representor and VF

From: Geethasowjanya Akula
Date: Wed Jun 19 2024 - 08:16:25 EST




From: Simon Horman <horms@xxxxxxxxxx>
Sent: Tuesday, June 18, 2024 2:09 PM
To: Geethasowjanya Akula <gakula@xxxxxxxxxxx>
Cc: netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; kuba@xxxxxxxxxx; davem@xxxxxxxxxxxxx; pabeni@xxxxxxxxxx; edumazet@xxxxxxxxxx; Sunil Kovvuri Goutham <sgoutham@xxxxxxxxxxx>; Subbaraya Sundeep Bhatta <sbhatta@xxxxxxxxxxx>; Hariprasad Kelam <hkelam@xxxxxxxxxxx>
Subject: [EXTERNAL] Re: [net-next PATCH v5 05/10] octeontx2-af: Add packet path between representor and VF

>> Current HW, do not support in-built switch which will forward pkts
>> between representee and representor. When representor is put under
>> a bridge and pkts needs to be sent to representee, then pkts from
>> representor are sent on a HW internal loopback channel, which again
>> will be punted to ingress pkt parser. Now the rules that this patch
>> installs are the MCAM filters/rules which will match against these
>> pkts and forward them to representee.
>> The rules that this patch installs are for basic
>> representor <=> representee path similar to Tun/TAP between VM and
>> Host.
>>
>> Signed-off-by: Geetha sowjanya <mailto:gakula@xxxxxxxxxxx>

...

>> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_rep.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_rep.c

...

>> +void rvu_rep_update_rules(struct rvu *rvu, u16 pcifunc, bool ena)
>> +{
>> + struct rvu_switch *rswitch = &rvu->rswitch;
>> + struct npc_mcam *mcam = &rvu->hw->mcam;
>> + u32 max = rswitch->used_entries;
>> + int blkaddr;
>> + u16 entry;
>> +
>> + if (!rswitch->used_entries)
>> + return;
>> +
>> + blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
>> +
>> + if (blkaddr < 0)
>> + return;
>> +
>> + rvu_switch_enable_lbk_link(rvu, pcifunc, ena);
>> + mutex_lock(&mcam->lock);
>> + for (entry = 0; entry < max; entry++) {
>> + if (rswitch->entry2pcifunc[entry] == pcifunc)
>> + npc_enable_mcam_entry(rvu, mcam, blkaddr, entry, ena);
>> + }
>> + mutex_unlock(&mcam->lock);
>> +}
>> +
>> +int rvu_rep_pf_init(struct rvu *rvu)
>> +{
>> + u16 pcifunc = rvu->rep_pcifunc;
>> + struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);

>nit: It would be nice to maintain reverse xmas tree order - longest line to
> shortest - for local variable declarations in this file.
>
> Here, I think that could be (completely untested!):
>
> u16 pcifunc = rvu->rep_pcifunc;
> struct rvu_pfvf *pfvf;
>
> pfvf = rvu_get_pfvf(rvu, pcifunc);
>
Will fix it in the next version.

> Edward Cree's tool is useful here:
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ecree->2Dsolarflare_xmastree&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=UiEt_nUeYFctu7JVLXVlXDhTmq_EAfooaZEYInfGuEQ&m=3t8aEWBx0->EE40JxcymujYfnr4381VZ2xrwKywPJdCxiVECpoRedKizncrz_KDOP&s=ekEqLe3i6dMVqmg0TQkbqv8R_C1kKewis3DwghvQ-ow&e=
>
>> +
>> + set_bit(NIXLF_INITIALIZED, &pfvf->flags);
>> + rvu_switch_enable_lbk_link(rvu, pcifunc, true);
>> + rvu_rep_rx_vlan_cfg(rvu, pcifunc);
>> + return 0;
>> +}

...