linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
To: Joergen Andreasen <joergen.andreasen@microchip.com>
Cc: "Allan W. Nielsen" <allan.nielsen@microchip.com>,
	Vladimir Oltean <olteanv@gmail.com>, Po Liu <po.liu@nxp.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Alexandru Marginean <alexandru.marginean@nxp.com>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	Leo Li <leoyang.li@nxp.com>, Mingkai Hu <mingkai.hu@nxp.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jiri Pirko <jiri@resnulli.us>, Ido Schimmel <idosch@idosch.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	Nikolay Aleksandrov <nikolay@cumulusnetworks.com>,
	Roopa Prabhu <roopa@cumulusnetworks.com>,
	netdev <netdev@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Horatiu Vultur <horatiu.vultur@microchip.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	"linux-devel@linux.nxdi.nxp.com" <linux-devel@linux.nxdi.nxp.com>
Subject: RE: [EXT] Re: [PATCH v2 net-next 03/10] net: mscc: ocelot: allocated rules to different hardware VCAP TCAMs by chain index
Date: Thu, 16 Jul 2020 10:37:40 +0000	[thread overview]
Message-ID: <DB8PR04MB578594DD3C106D8BDE291B95F07F0@DB8PR04MB5785.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20200716085044.wzwdca535aa5oiv4@soft-dev16>

Hi Joergen,


-----Original Message-----
From: Joergen Andreasen <joergen.andreasen@microchip.com> 
Sent: 2020年7月16日 16:51

> >> >> Chain 0:           The default chain - today this is in IS2. If we proceed
> >> >>                     with this as is - then this will change.
> >> >> Chain 1-9999:      These are offloaded by "basic" classification.
> >> >> Chain 10000-19999: These are offloaded in IS1
> >> >>                     Chain 10000: Lookup-0 in IS1, and here we could limit the
> >> >>                                  action to do QoS related stuff (priority
> >> >>                                  update)
> >> >>                     Chain 11000: Lookup-1 in IS1, here we could do VLAN
> >> >>                                  stuff
> >> >>                     Chain 12000: Lookup-2 in IS1, here we could apply the
> >> >>                                  "PAG" which is essentially a GOTO.
> >> >>
> >> >> Chain 20000-29999: These are offloaded in IS2
> >> >>                     Chain 20000-20255: Lookup-0 in IS2, where CHAIN-ID -
> >> >>                                        20000 is the PAG value.
> >> >>                     Chain 21000-21000: Lookup-1 in IS2.
> >> >>
> >> >> All these chains should be optional - users should only need to 
> >> >> configure the chains they need. To make this work, we need to 
> >> >> configure both the desired actions (could be priority update) and the goto action.
> >> >> Remember in HW, all packets goes through this process, while in 
> >> >> SW they only follow the "goto" path.
> >> >>
>>
>> I agree with this chain assignment, following is an example to set rules:
>>
>> 1. Set a matchall rule for each chain, the last chain do not need goto chain action.
>> # tc filter add dev swp0 chain 0 flower skip_sw action goto chain 
>> 10000 # tc filter add dev swp0 chain 10000 flower skip_sw action goto 
>> chain 21000 In driver, use these rules to register the chain.
>>
>> 2. Set normal rules.
>> # tc filter add dev swp0 chain 10000 protocol 802.1Q parent ffff: 
>> flower skip_sw vlan_id 1 vlan_prio 1 action skbedit priority 1 action 
>> goto chain 21000 # tc filter add dev swp0 chain 21000 protocol 802.1Q 
>> parent ffff: flower skip_sw vlan_id 1 vlan_prio 1 action drop
>>
>> In driver, we check if the chain ID has been registered, and goto chain is the same as first matchall rule, if is not, then return error. Each rule need has goto action except last chain.
>>
>> I also have check about chain template, it can not set an action template for each chain, so I think it's no use for our case. If this way to set rules is OK, I will update the patch to do as this.
>>
>> Thanks,
>> Xiaoliang Yang
>

> I agree that you cannot set an action template for each chain but you can set a match template which for example can be used for setting up which IS1 key to generate for the device/port.
> The template ensures that you cannot add an illegal match.
> I have attached a snippet from a testcase I wrote in order to test these ideas.
> Note that not all actions are valid for the hardware.
>
> SMAC       = "00:00:00:11:11:11"
> DMAC       = "00:00:00:dd:dd:dd"
> VID1       = 0x10
> VID2       = 0x20
> PCP1       = 3
> PCP2       = 5
> DEI        = 1
> SIP        = "10.10.0.1"
> DIP        = "10.10.0.2"
>
> IS1_L0     = 10000 # IS1 lookup 0
> IS1_L1     = 11000 # IS1 lookup 1
> IS1_L2     = 12000 # IS1 lookup 2
>
> IS2_L0     = 20000 # IS2 lookup 0 # IS2 20000 - 20255 -> pag 0-255
> IS2_L0_P1  = 20001 # IS2 lookup 0 pag 1
> IS2_L0_P2  = 20002 # IS2 lookup 0 pag 2
>
> IS2_L1     = 21000 # IS2 lookup 1
>
> $skip = "skip_hw" # or "skip_sw"
>
> test "Chain templates and goto" do
>     t_i "'prio #' sets the sequence of filters. Lowest number = highest priority = checked first. 0..0xffff"
>     t_i "'handle #' is a reference to the filter. Use this is if you need to reference the filter later. 0..0xffffffff"
>     t_i "'chain #' is the chain to use. Chain 0 is the default. Different chains can have different templates. 0..0xffffffff"
>     $ts.dut.run "tc qdisc add dev #{$dp[0]} clsact"
>
>     t_i "Add templates"
>     t_i "Configure the VCAP port configuration to match the shortest key that fulfill the purpose"

>     t_i "Create a template that sets IS1 lookup 0 to generate S1_NORMAL with S1_DMAC_DIP_ENA"
>     t_i "If you match on both src and dst you will generate S1_7TUPLE"
>     $ts.dut.run "tc chain add dev #{$dp[0]} ingress protocol ip chain #{IS1_L0} flower #{$skip} "\
>                 "dst_mac 00:00:00:00:00:00 "\
>                 "dst_ip 0.0.0.0 "
>
>     t_i "Create a template that sets IS1 lookup 1 to generate S1_5TUPLE_IP4"
>     $ts.dut.run "tc chain add dev #{$dp[0]} ingress protocol ip chain #{IS1_L1} flower #{$skip} "\
>                 "src_ip 0.0.0.0 "\
>                 "dst_ip 0.0.0.0 "
>
>     t_i "Create a template that sets IS1 lookup 2 to generate S1_DBL_VID"
>     $ts.dut.run "tc chain add dev #{$dp[0]} ingress protocol 802.1ad chain #{IS1_L2} flower #{$skip} "\
>                 "vlan_id 0 "\
>                 "vlan_prio 0 "\
>                 "vlan_ethtype 802.1q "\
>                 "cvlan_id 0 "\
>                 "cvlan_prio 0 "
>
>     $ts.dut.run "tc chain show dev #{$dp[0]} ingress"

Why you set different filter keys on different lookup? Each lookup only filter one type of keys?
If I want to filter a same key like dst_mac and do both QoS classified action and vlan modify action, how to implement this in the same chain #{IS1_L0} ?

I think it's more reasonable to distinguish different lookup by different action like this:
IS1_L0     = 10000 # IS1 lookup 0	# do QoS classified action
IS1_L1     = 11000 # IS1 lookup 1	# do vlan modify action
IS1_L2     = 12000 # IS1 lookup 2	# do goto PAG action

IS2_L0     = 20000 # IS2 lookup 0 # IS2 20000 - 20255 -> pag 0-255
IS2_L1 	  = 21000 # IS2 lookup 1

So it’s no need to add templates, each lookup can support filtering mac, IP or vlan tag, but only support one action.

Thanks,
Xiaoliang

  reply	other threads:[~2020-07-16 10:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02  5:18 [PATCH v2 net-next 00/10] net: ocelot: VCAP IS1 and ES0 support Xiaoliang Yang
2020-06-02  5:18 ` [PATCH v2 net-next 01/10] net: mscc: ocelot: introduce a new ocelot_target_{read,write} API Xiaoliang Yang
2020-06-02  5:18 ` [PATCH v2 net-next 02/10] net: mscc: ocelot: generalize existing code for VCAP Xiaoliang Yang
2020-06-02  5:18 ` [PATCH v2 net-next 03/10] net: mscc: ocelot: allocated rules to different hardware VCAP TCAMs by chain index Xiaoliang Yang
2020-06-02  8:36   ` Allan W. Nielsen
2020-06-03 10:04     ` Vladimir Oltean
2020-06-08 13:56       ` Allan W. Nielsen
2020-06-09 12:55         ` Vladimir Oltean
2020-06-10 18:18           ` Allan W. Nielsen
2020-07-16  6:49             ` [EXT] " Xiaoliang Yang
2020-07-16  8:50               ` Joergen Andreasen
2020-07-16 10:37                 ` Xiaoliang Yang [this message]
2020-07-16 14:45                   ` Vladimir Oltean
2020-07-17  7:34                     ` Joergen Andreasen
2020-07-17  9:08                       ` Vladimir Oltean
2020-07-17 19:10                         ` Allan W. Nielsen
2020-07-20 11:04                           ` Xiaoliang Yang
2020-06-02  5:18 ` [PATCH v2 net-next 04/10] net: mscc: ocelot: change vcap to be compatible with full and quad entry Xiaoliang Yang
2020-06-02  5:18 ` [PATCH v2 net-next 05/10] net: mscc: ocelot: VCAP IS1 support Xiaoliang Yang
2020-06-02 16:16   ` Jakub Kicinski
2020-06-02  5:18 ` [PATCH v2 net-next 06/10] net: mscc: ocelot: VCAP ES0 support Xiaoliang Yang
2020-06-02 16:17   ` Jakub Kicinski
2020-06-02  5:18 ` [PATCH v2 net-next 07/10] net: mscc: ocelot: multiple actions support Xiaoliang Yang
2020-06-02  5:18 ` [PATCH v2 net-next 08/10] net: ocelot: return error if rule is not found Xiaoliang Yang
2020-06-02  5:18 ` [PATCH v2 net-next 09/10] net: dsa: felix: correct VCAP IS2 keys offset Xiaoliang Yang
2020-06-02  5:18 ` [PATCH v2 net-next 10/10] net: dsa: tag_ocelot: use VLAN information from tagging header when available Xiaoliang Yang
2020-06-02  8:03 ` [PATCH v2 net-next 00/10] net: ocelot: VCAP IS1 and ES0 support Vladimir Oltean
2020-06-02  8:49   ` [EXT] " Xiaoliang Yang
2020-06-09 11:35     ` Vladimir Oltean

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=DB8PR04MB578594DD3C106D8BDE291B95F07F0@DB8PR04MB5785.eurprd04.prod.outlook.com \
    --to=xiaoliang.yang_1@nxp.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandru.marginean@nxp.com \
    --cc=allan.nielsen@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=idosch@idosch.org \
    --cc=jiri@resnulli.us \
    --cc=joergen.andreasen@microchip.com \
    --cc=kuba@kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-devel@linux.nxdi.nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingkai.hu@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=olteanv@gmail.com \
    --cc=po.liu@nxp.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=vinicius.gomes@intel.com \
    --cc=vivien.didelot@gmail.com \
    --cc=vladimir.oltean@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).