netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Ido Schimmel <idosch@nvidia.com>,
	Petr Machata <petrm@nvidia.com>,
	Alexander Duyck <alexander.duyck@gmail.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jiri Pirko <jiri@nvidia.com>,
	vivien.didelot@gmail.com
Subject: Re: [RFC PATCH net-next 2/2] net: dsa: felix: offload port priority
Date: Wed, 13 Jan 2021 15:37:49 -0800	[thread overview]
Message-ID: <62d9811f-93e4-9d9b-c159-76c35fa919dc@gmail.com> (raw)
In-Reply-To: <X/+D+2AgnOqCxb2d@lunn.ch>

On 1/13/21 3:36 PM, Andrew Lunn wrote:
> On Wed, Jan 13, 2021 at 05:41:39PM +0200, Vladimir Oltean wrote:
>> From: Vladimir Oltean <vladimir.oltean@nxp.com>
>>
>> Even though we should really share the implementation with the ocelot
>> switchdev driver, that one needs a little bit of rework first, since its
>> struct ocelot_port_tc only supports one tc matchall action at a time,
>> which at the moment is used for port policers. Whereas DSA keeps a list
>> of port-based actions in struct dsa_slave_priv::mall_tc_list, so it is
>> much more easily extensible. It is too tempting to add the implementation
>> for the port priority directly in Felix at the moment, which is what we
>> do.
>>
>> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
>> ---
>>  drivers/net/dsa/ocelot/felix.c | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
>> index 768a74dc462a..5cc42c3aaf0d 100644
>> --- a/drivers/net/dsa/ocelot/felix.c
>> +++ b/drivers/net/dsa/ocelot/felix.c
>> @@ -739,6 +739,20 @@ static void felix_port_policer_del(struct dsa_switch *ds, int port)
>>  	ocelot_port_policer_del(ocelot, port);
>>  }
>>  
>> +static int felix_port_priority_set(struct dsa_switch *ds, int port,
>> +				   struct dsa_mall_skbedit_tc_entry *skbedit)
>> +{
>> +	struct ocelot *ocelot = ds->priv;
>> +
>> +	ocelot_rmw_gix(ocelot,
>> +		       ANA_PORT_QOS_CFG_QOS_DEFAULT_VAL(skbedit->priority),
> 
> No range check? Seems like -ERANGE or similar would help avoid
> surprises when somebody asks for an unsupported priority and it gets
> masked to something much lower.

You are passing the whole dsa_mall_skbedit_tc_entry  structure here,
only to look up priority, would it make sense for now to pass
skbedit->priority as a parameter which would be matching the function
name and what it is dealing with?
-- 
Florian

  reply	other threads:[~2021-01-13 23:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 15:41 [RFC PATCH net-next 0/2] Port-based priority on DSA switches using tc-matchall Vladimir Oltean
2021-01-13 15:41 ` [RFC PATCH net-next 1/2] net: dsa: allow setting port-based QoS priority using tc matchall skbedit Vladimir Oltean
2021-01-13 23:41   ` Andrew Lunn
2021-01-14  0:17     ` Vladimir Oltean
2021-01-14  1:02       ` Andrew Lunn
2022-02-10 18:53         ` Vladimir Oltean
2022-02-11  7:52           ` Petr Machata
2022-02-11 15:29             ` Vladimir Oltean
2022-02-11 16:08               ` Andrew Lunn
2022-02-11 18:24               ` Petr Machata
2022-02-17 15:42                 ` Vladimir Oltean
2022-02-11 15:59           ` Andrew Lunn
2021-01-13 15:41 ` [RFC PATCH net-next 2/2] net: dsa: felix: offload port priority Vladimir Oltean
2021-01-13 23:36   ` Andrew Lunn
2021-01-13 23:37     ` Florian Fainelli [this message]
2021-01-14  0:57       ` 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=62d9811f-93e4-9d9b-c159-76c35fa919dc@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=alexander.duyck@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=idosch@nvidia.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=petrm@nvidia.com \
    --cc=vivien.didelot@gmail.com \
    --cc=xiyou.wangcong@gmail.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).