netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@nvidia.com>
To: "stephen@networkplumber.org" <stephen@networkplumber.org>,
	"bridge@lists.linux-foundation.org" 
	<bridge@lists.linux-foundation.org>
Cc: "henrik.bjoernlund@microchip.com"
	<henrik.bjoernlund@microchip.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jiri@mellanox.com" <jiri@mellanox.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Roopa Prabhu <roopa@nvidia.com>,
	"idosch@mellanox.com" <idosch@mellanox.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"horatiu.vultur@microchip.com" <horatiu.vultur@microchip.com>,
	"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>
Subject: Re: [Bridge] [PATCH net-next v7 01/10] net: bridge: extend the process of special frames
Date: Tue, 27 Oct 2020 15:09:27 +0000	[thread overview]
Message-ID: <0dd2e57a61d618984648a3bf6373728f61a8fecf.camel@nvidia.com> (raw)
In-Reply-To: <20201027075921.69976131@hermes.local>

On Tue, 2020-10-27 at 07:59 -0700, Stephen Hemminger wrote:
> On Tue, 27 Oct 2020 10:02:42 +0000
> Henrik Bjoernlund via Bridge <bridge@lists.linux-foundation.org> wrote:
> 
> > +/* Return 0 if the frame was not processed otherwise 1
> > + * note: already called with rcu_read_lock
> > + */
> > +static int br_process_frame_type(struct net_bridge_port *p,
> > +				 struct sk_buff *skb)
> > +{
> > +	struct br_frame_type *tmp;
> > +
> > +	hlist_for_each_entry_rcu(tmp, &p->br->frame_type_list, list)
> > +		if (unlikely(tmp->type == skb->protocol))
> > +			return tmp->frame_handler(p, skb);
> > +
> > +	return 0;
> > +}
> 
> Does the linear search of frame types have noticable impact on performance?
> Hint: maybe a bitmap or something would be faster.

I don't think it's necessary to optimize it so early. There are only 2 possible
types so far (with this set included) if CfM and MRP both are in use, if at some
point it grows we can turn it into a hash or bitmap, at the moment a simple and
easier to maintain solution seems better to me. We could mask the search itself
behind a static key and do it only if a protocol is registered to minimize the
impact further.

Cheers,
 Nik



  reply	other threads:[~2020-10-27 16:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 10:02 [PATCH net-next v7 00/10] net: bridge: cfm: Add support for Connectivity Fault Management(CFM) Henrik Bjoernlund
2020-10-27 10:02 ` [PATCH net-next v7 01/10] net: bridge: extend the process of special frames Henrik Bjoernlund
2020-10-27 14:59   ` [Bridge] " Stephen Hemminger
2020-10-27 15:09     ` Nikolay Aleksandrov [this message]
2020-10-27 10:02 ` [PATCH net-next v7 02/10] bridge: cfm: Add BRIDGE_CFM to Kconfig Henrik Bjoernlund
2020-10-27 10:02 ` [PATCH net-next v7 03/10] bridge: uapi: cfm: Added EtherType used by the CFM protocol Henrik Bjoernlund
2020-10-27 10:02 ` [PATCH net-next v7 04/10] bridge: cfm: Kernel space implementation of CFM. MEP create/delete Henrik Bjoernlund
2020-10-27 10:02 ` [PATCH net-next v7 05/10] bridge: cfm: Kernel space implementation of CFM. CCM frame TX added Henrik Bjoernlund
2020-10-27 10:02 ` [PATCH net-next v7 06/10] bridge: cfm: Kernel space implementation of CFM. CCM frame RX added Henrik Bjoernlund
2020-10-27 10:02 ` [PATCH net-next v7 07/10] bridge: cfm: Netlink SET configuration Interface Henrik Bjoernlund
2020-10-27 10:02 ` [PATCH net-next v7 08/10] bridge: cfm: Netlink GET " Henrik Bjoernlund
2020-10-27 10:02 ` [PATCH net-next v7 09/10] bridge: cfm: Netlink GET status Interface Henrik Bjoernlund
2020-10-27 10:02 ` [PATCH net-next v7 10/10] bridge: cfm: Netlink Notifications Henrik Bjoernlund
2020-10-30  2:58 ` [PATCH net-next v7 00/10] net: bridge: cfm: Add support for Connectivity Fault Management(CFM) Jakub Kicinski

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=0dd2e57a61d618984648a3bf6373728f61a8fecf.camel@nvidia.com \
    --to=nikolay@nvidia.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=henrik.bjoernlund@microchip.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@nvidia.com \
    --cc=stephen@networkplumber.org \
    /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).