All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"allan.nielsen@microchip.com" <allan.nielsen@microchip.com>,
	"joergen.andreasen@microchip.com"
	<joergen.andreasen@microchip.com>,
	"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
	"vinicius.gomes@intel.com" <vinicius.gomes@intel.com>,
	"michael.chan@broadcom.com" <michael.chan@broadcom.com>,
	"vishal@chelsio.com" <vishal@chelsio.com>,
	"saeedm@mellanox.com" <saeedm@mellanox.com>,
	"jiri@mellanox.com" <jiri@mellanox.com>,
	"idosch@mellanox.com" <idosch@mellanox.com>,
	"alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>,
	"kuba@kernel.org" <kuba@kernel.org>, Po Liu <po.liu@nxp.com>,
	Leo Li <leoyang.li@nxp.com>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
	"andrew@lunn.ch" <andrew@lunn.ch>,
	"vivien.didelot@gmail.com" <vivien.didelot@gmail.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"horatiu.vultur@microchip.com" <horatiu.vultur@microchip.com>
Subject: Re: [PATCH v6 net-next 5/8] net: dsa: felix: support psfp filter on vsc9959
Date: Wed, 6 Oct 2021 13:13:02 +0000	[thread overview]
Message-ID: <20211006131301.tx42h4kcoacat2jm@skbuf> (raw)
In-Reply-To: <20210930075948.36981-6-xiaoliang.yang_1@nxp.com>

On Thu, Sep 30, 2021 at 03:59:45PM +0800, Xiaoliang Yang 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?

> +	struct netlink_ext_ack *extack = f->common.extack;
> +	struct felix_stream_filter sfi = {0};
> +	const struct flow_action_entry *a;
> +	struct felix_stream *stream_entry;
> +	struct felix_stream stream = {0};
> +	struct ocelot_psfp_list *psfp;
> +	int ret, i;
> +
> +	psfp = &ocelot->psfp;
> +
> +	ret = vsc9959_stream_identify(f, &stream);
> +	if (ret) {
> +		NL_SET_ERR_MSG_MOD(extack, "Only can match on VID, PCP, and dest MAC");
> +		return ret;
> +	}
> +
> +	flow_action_for_each(i, a, &f->rule->action) {
> +		switch (a->id) {
> +		case FLOW_ACTION_GATE:
> +		case FLOW_ACTION_POLICE:
> +		default:
> +			return -EOPNOTSUPP;
> +		}
> +	}
> +
> +	/* Check if stream is set. */
> +	stream_entry = vsc9959_stream_table_lookup(&psfp->stream_list, &stream);
> +	if (stream_entry) {
> +		NL_SET_ERR_MSG_MOD(extack, "This stream is already added");
> +		return -EEXIST;
> +	}
> +
> +	sfi.prio_valid = (stream.prio < 0 ? 0 : 1);
> +	sfi.prio = (sfi.prio_valid ? stream.prio : 0);
> +	sfi.enable = 1;
> +
> +	ret = vsc9959_psfp_sfi_table_add(ocelot, &sfi);
> +	if (ret)
> +		return ret;
> +
> +	stream.sfid = sfi.index;
> +	stream.sfid_valid = 1;
> +	ret = vsc9959_stream_table_add(ocelot, &psfp->stream_list,
> +				       &stream, extack);
> +	if (ret)
> +		vsc9959_psfp_sfi_table_del(ocelot, stream.sfid);
> +
> +	return ret;
> +}

WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"allan.nielsen@microchip.com" <allan.nielsen@microchip.com>,
	"joergen.andreasen@microchip.com"
	<joergen.andreasen@microchip.com>,
	"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
	"vinicius.gomes@intel.com" <vinicius.gomes@intel.com>,
	"michael.chan@broadcom.com" <michael.chan@broadcom.com>,
	"vishal@chelsio.com" <vishal@chelsio.com>,
	"saeedm@mellanox.com" <saeedm@mellanox.com>,
	"jiri@mellanox.com" <jiri@mellanox.com>,
	"idosch@mellanox.com" <idosch@mellanox.com>,
	"alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>,
	"kuba@kernel.org" <kuba@kernel.org>, Po Liu <po.liu@nxp.com>,
	Leo Li <leoyang.li@nxp.com>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
	"andrew@lunn.ch" <andrew@lunn.ch>,
	"vivien.didelot@gmail.com" <vivien.didelot@gmail.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"horatiu.vultur@microchip.com" <horatiu.vultur@microchip.com>
Subject: Re: [PATCH v6 net-next 5/8] net: dsa: felix: support psfp filter on vsc9959
Date: Wed, 6 Oct 2021 13:13:02 +0000	[thread overview]
Message-ID: <20211006131301.tx42h4kcoacat2jm@skbuf> (raw)
In-Reply-To: <20210930075948.36981-6-xiaoliang.yang_1@nxp.com>

On Thu, Sep 30, 2021 at 03:59:45PM +0800, Xiaoliang Yang 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?

> +	struct netlink_ext_ack *extack = f->common.extack;
> +	struct felix_stream_filter sfi = {0};
> +	const struct flow_action_entry *a;
> +	struct felix_stream *stream_entry;
> +	struct felix_stream stream = {0};
> +	struct ocelot_psfp_list *psfp;
> +	int ret, i;
> +
> +	psfp = &ocelot->psfp;
> +
> +	ret = vsc9959_stream_identify(f, &stream);
> +	if (ret) {
> +		NL_SET_ERR_MSG_MOD(extack, "Only can match on VID, PCP, and dest MAC");
> +		return ret;
> +	}
> +
> +	flow_action_for_each(i, a, &f->rule->action) {
> +		switch (a->id) {
> +		case FLOW_ACTION_GATE:
> +		case FLOW_ACTION_POLICE:
> +		default:
> +			return -EOPNOTSUPP;
> +		}
> +	}
> +
> +	/* Check if stream is set. */
> +	stream_entry = vsc9959_stream_table_lookup(&psfp->stream_list, &stream);
> +	if (stream_entry) {
> +		NL_SET_ERR_MSG_MOD(extack, "This stream is already added");
> +		return -EEXIST;
> +	}
> +
> +	sfi.prio_valid = (stream.prio < 0 ? 0 : 1);
> +	sfi.prio = (sfi.prio_valid ? stream.prio : 0);
> +	sfi.enable = 1;
> +
> +	ret = vsc9959_psfp_sfi_table_add(ocelot, &sfi);
> +	if (ret)
> +		return ret;
> +
> +	stream.sfid = sfi.index;
> +	stream.sfid_valid = 1;
> +	ret = vsc9959_stream_table_add(ocelot, &psfp->stream_list,
> +				       &stream, extack);
> +	if (ret)
> +		vsc9959_psfp_sfi_table_del(ocelot, stream.sfid);
> +
> +	return ret;
> +}
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"allan.nielsen@microchip.com" <allan.nielsen@microchip.com>,
	"joergen.andreasen@microchip.com"
	<joergen.andreasen@microchip.com>,
	"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
	"vinicius.gomes@intel.com" <vinicius.gomes@intel.com>,
	"michael.chan@broadcom.com" <michael.chan@broadcom.com>,
	"vishal@chelsio.com" <vishal@chelsio.com>,
	"saeedm@mellanox.com" <saeedm@mellanox.com>,
	"jiri@mellanox.com" <jiri@mellanox.com>,
	"idosch@mellanox.com" <idosch@mellanox.com>,
	"alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>,
	"kuba@kernel.org" <kuba@kernel.org>, Po Liu <po.liu@nxp.com>,
	Leo Li <leoyang.li@nxp.com>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
	"andrew@lunn.ch" <andrew@lunn.ch>,
	"vivien.didelot@gmail.com" <vivien.didelot@gmail.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"horatiu.vultur@microchip.com" <horatiu.vultur@microchip.com>
Subject: Re: [PATCH v6 net-next 5/8] net: dsa: felix: support psfp filter on vsc9959
Date: Wed, 6 Oct 2021 13:13:02 +0000	[thread overview]
Message-ID: <20211006131301.tx42h4kcoacat2jm@skbuf> (raw)
In-Reply-To: <20210930075948.36981-6-xiaoliang.yang_1@nxp.com>

On Thu, Sep 30, 2021 at 03:59:45PM +0800, Xiaoliang Yang 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?

> +	struct netlink_ext_ack *extack = f->common.extack;
> +	struct felix_stream_filter sfi = {0};
> +	const struct flow_action_entry *a;
> +	struct felix_stream *stream_entry;
> +	struct felix_stream stream = {0};
> +	struct ocelot_psfp_list *psfp;
> +	int ret, i;
> +
> +	psfp = &ocelot->psfp;
> +
> +	ret = vsc9959_stream_identify(f, &stream);
> +	if (ret) {
> +		NL_SET_ERR_MSG_MOD(extack, "Only can match on VID, PCP, and dest MAC");
> +		return ret;
> +	}
> +
> +	flow_action_for_each(i, a, &f->rule->action) {
> +		switch (a->id) {
> +		case FLOW_ACTION_GATE:
> +		case FLOW_ACTION_POLICE:
> +		default:
> +			return -EOPNOTSUPP;
> +		}
> +	}
> +
> +	/* Check if stream is set. */
> +	stream_entry = vsc9959_stream_table_lookup(&psfp->stream_list, &stream);
> +	if (stream_entry) {
> +		NL_SET_ERR_MSG_MOD(extack, "This stream is already added");
> +		return -EEXIST;
> +	}
> +
> +	sfi.prio_valid = (stream.prio < 0 ? 0 : 1);
> +	sfi.prio = (sfi.prio_valid ? stream.prio : 0);
> +	sfi.enable = 1;
> +
> +	ret = vsc9959_psfp_sfi_table_add(ocelot, &sfi);
> +	if (ret)
> +		return ret;
> +
> +	stream.sfid = sfi.index;
> +	stream.sfid_valid = 1;
> +	ret = vsc9959_stream_table_add(ocelot, &psfp->stream_list,
> +				       &stream, extack);
> +	if (ret)
> +		vsc9959_psfp_sfi_table_del(ocelot, stream.sfid);
> +
> +	return ret;
> +}
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-10-06 13:13 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30  7:59 [PATCH v6 net-next 0/8] net: dsa: felix: psfp support on vsc9959 Xiaoliang Yang
2021-09-30  7:59 ` Xiaoliang Yang
2021-09-30  7:59 ` Xiaoliang Yang
2021-09-30  7:59 ` [PATCH v6 net-next 1/8] net: mscc: ocelot: serialize access to the MAC table Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59 ` [PATCH v6 net-next 2/8] net: mscc: ocelot: add MAC table stream learn and lookup operations Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59 ` [PATCH v6 net-next 3/8] net: mscc: ocelot: set vcap IS2 chain to goto PSFP chain Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59 ` [PATCH v6 net-next 4/8] net: mscc: ocelot: add gate and police action offload to PSFP Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59 ` [PATCH v6 net-next 5/8] net: dsa: felix: support psfp filter on vsc9959 Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-10-06 13:13   ` Vladimir Oltean [this message]
2021-10-06 13:13     ` Vladimir Oltean
2021-10-06 13:13     ` Vladimir Oltean
2021-11-10 10:43     ` Xiaoliang Yang
2021-11-10 10:43       ` Xiaoliang Yang
2021-11-10 10:43       ` Xiaoliang Yang
2021-09-30  7:59 ` [PATCH v6 net-next 6/8] net: dsa: felix: add stream gate settings for psfp Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59 ` [PATCH v6 net-next 7/8] net: mscc: ocelot: use index to set vcap policer Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59 ` [PATCH v6 net-next 8/8] net: dsa: felix: use vcap policer to set flow meter for psfp Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-09-30  7:59   ` Xiaoliang Yang
2021-10-01 22:11 ` [PATCH v6 net-next 0/8] net: dsa: felix: psfp support on vsc9959 Jakub Kicinski
2021-10-01 22:46   ` Vladimir Oltean
2021-10-01 22:59     ` Jakub Kicinski
2021-10-01 23:17       ` Vladimir Oltean
2021-10-06 12:12         ` Vladimir Oltean
2021-11-10 10:32           ` Xiaoliang Yang

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=20211006131301.tx42h4kcoacat2jm@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.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@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=joergen.andreasen@microchip.com \
    --cc=kuba@kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=po.liu@nxp.com \
    --cc=saeedm@mellanox.com \
    --cc=vinicius.gomes@intel.com \
    --cc=vishal@chelsio.com \
    --cc=vivien.didelot@gmail.com \
    --cc=xiaoliang.yang_1@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 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.