RE: [PATCH v6 net-next 5/8] net: dsa: felix: support psfp filter on vsc9959

From: Xiaoliang Yang
Date: Wed Nov 10 2021 - 05:43:25 EST


Hi Vladimir,

> -----Original Message-----
> From: Vladimir Oltean <vladimir.oltean@xxxxxxx>
> Sent: 2021年10月6日 21:13
> To: Xiaoliang Yang <xiaoliang.yang_1@xxxxxxx>
> Cc: davem@xxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> netdev@xxxxxxxxxxxxxxx; allan.nielsen@xxxxxxxxxxxxx;
> joergen.andreasen@xxxxxxxxxxxxx; UNGLinuxDriver@xxxxxxxxxxxxx;
> vinicius.gomes@xxxxxxxxx; michael.chan@xxxxxxxxxxxx;
> vishal@xxxxxxxxxxx; saeedm@xxxxxxxxxxxx; jiri@xxxxxxxxxxxx;
> idosch@xxxxxxxxxxxx; alexandre.belloni@xxxxxxxxxxx; kuba@xxxxxxxxxx; Po
> Liu <po.liu@xxxxxxx>; Leo Li <leoyang.li@xxxxxxx>; f.fainelli@xxxxxxxxx;
> andrew@xxxxxxx; vivien.didelot@xxxxxxxxx; Claudiu Manoil
> <claudiu.manoil@xxxxxxx>; linux-mediatek@xxxxxxxxxxxxxxxxxxx;
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; matthias.bgg@xxxxxxxxx;
> horatiu.vultur@xxxxxxxxxxxxx
> Subject: Re: [PATCH v6 net-next 5/8] net: dsa: felix: support psfp filter on
> vsc9959
>
> On Thu, Oct 6, 2021 at 21:13:45 +0300, Vladimir Oltean wrote:
> > +static int vsc9959_psfp_filter_add(struct ocelot *ocelot,
> > + struct flow_cls_offload *f)
> > +{
>
> Neither the vsc9959_psfp_filter_add nor vsc9959_psfp_filter_del
> implementations take an "int port" as argument. Therefore, when the SFID is
> programmed in the MAC table, it matches on any ingress port that is in the
> same bridging domain as the port pointed towards by the MAC table (and the
> MAC table selects the _destination_ port).
>
> Otherwise said, in this setup:
>
> br0
> / | \
> / | \
> / | \
> swp0 swp1 swp2
>
> bridge vlan add dev swp0 vid 100
> bridge vlan add dev swp1 vid 100
> bridge vlan add dev swp2 vid 100
> bridge fdb add dev swp2 00:01:02:03:04:05 vlan 100 static master tc filter add
> dev swp0 ingress chain 0 pref 49152 flower \
> skip_sw action goto chain 30000
> tc filter add dev swp0 ingress chain 30000 pref 1 \
> protocol 802.1Q flower skip_sw \
> dst_mac 00:01:02:03:04:05 vlan_id 100 \
> action gate base-time 0.000000000 \
> sched-entry OPEN 5000000 -1 -1 \
> sched-entry CLOSE 5000000 -1 -1
>
> The "filter" above will match not only on swp0, but also on packets ingressed
> from swp1.
>
> The hardware provides IGR_SRCPORT_MATCH_ENA and IGR_PORT_MASK bits
> in the Stream Filter RAM (ANA:ANA_TABLES:SFID_MASK). Maybe you could
> program a SFID to match only on the ports on which the user intended?
>
Yes, you are right. I have tested that use IGR_SRCPORT_MATCH_ENA and IGR_PORT_MASK bits can let a SFID to
match only on the designated ports. But this only can match to two ports for each SFID, two ports use the sfid,
sfid+1 as SFID index. I can try to add it in driver, but it will limit user only to match one or two ports for a same
stream.

Thanks,
Xiaoliang