netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@nvidia.com>
To: "bridge@lists.linux-foundation.org" 
	<bridge@lists.linux-foundation.org>,
	"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>,
	"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>
Cc: "horatiu.vultur@microchip.com" <horatiu.vultur@microchip.com>
Subject: Re: [PATCH net-next v4 01/10] net: bridge: extend the process of special frames
Date: Mon, 12 Oct 2020 09:12:29 +0000	[thread overview]
Message-ID: <3fc314a2074001f7b39bada2c50529eb2aefd077.camel@nvidia.com> (raw)
In-Reply-To: <20201009143530.2438738-2-henrik.bjoernlund@microchip.com>

On Fri, 2020-10-09 at 14:35 +0000, Henrik Bjoernlund wrote:
> This patch extends the processing of frames in the bridge. Currently MRP
> frames needs special processing and the current implementation doesn't
> allow a nice way to process different frame types. Therefore try to
> improve this by adding a list that contains frame types that need
> special processing. This list is iterated for each input frame and if
> there is a match based on frame type then these functions will be called
> and decide what to do with the frame. It can process the frame then the
> bridge doesn't need to do anything or don't process so then the bridge
> will do normal forwarding.
> 
> Signed-off-by: Henrik Bjoernlund  <henrik.bjoernlund@microchip.com>
> Reviewed-by: Horatiu Vultur  <horatiu.vultur@microchip.com>
> ---
>  net/bridge/br_device.c  |  1 +
>  net/bridge/br_input.c   | 33 ++++++++++++++++++++++++++++++++-
>  net/bridge/br_mrp.c     | 19 +++++++++++++++----
>  net/bridge/br_private.h | 18 ++++++++++++------
>  4 files changed, 60 insertions(+), 11 deletions(-)
> 
[snip]
> diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
> index 345118e35c42..3e62ce2ef8a5 100644
> --- a/net/bridge/br_private.h
> +++ b/net/bridge/br_private.h
> @@ -480,6 +480,8 @@ struct net_bridge {
>  #endif
>  	struct hlist_head		fdb_list;
>  
> +	struct hlist_head		frame_type_list;

Since there will be a v5, I'd suggest to move this struct member in the first
cache line as it will be always used in the bridge fast-path for all cases.
In order to make room for it there you can move port_list after fdb_hash_tbl and
add this in its place, port_list is currently used only when flooding and soon
I'll even change that.

Thanks,
 Nik

> +
>  #if IS_ENABLED(CONFIG_BRIDGE_MRP)
>  	struct list_head		mrp_list;
>  #endif
> @@ -755,6 +757,16 @@ int nbp_backup_change(struct net_bridge_port *p, struct net_device *backup_dev);
>  int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb);
>  rx_handler_func_t *br_get_rx_handler(const struct net_device *dev);
>  
> +struct br_frame_type {
> +	__be16			type;
> +	int			(*frame_handler)(struct net_bridge_port *port,
> +						 struct sk_buff *skb);
> +	struct hlist_node	list;
> +};
> +
> +void br_add_frame(struct net_bridge *br, struct br_frame_type *ft);
> +void br_del_frame(struct net_bridge *br, struct br_frame_type *ft);
> +
>  static inline bool br_rx_handler_check_rcu(const struct net_device *dev)
>  {
>  	return rcu_dereference(dev->rx_handler) == br_get_rx_handler(dev);
> @@ -1417,7 +1429,6 @@ extern int (*br_fdb_test_addr_hook)(struct net_device *dev, unsigned char *addr)
>  #if IS_ENABLED(CONFIG_BRIDGE_MRP)
>  int br_mrp_parse(struct net_bridge *br, struct net_bridge_port *p,
>  		 struct nlattr *attr, int cmd, struct netlink_ext_ack *extack);
> -int br_mrp_process(struct net_bridge_port *p, struct sk_buff *skb);
>  bool br_mrp_enabled(struct net_bridge *br);
>  void br_mrp_port_del(struct net_bridge *br, struct net_bridge_port *p);
>  int br_mrp_fill_info(struct sk_buff *skb, struct net_bridge *br);
> @@ -1429,11 +1440,6 @@ static inline int br_mrp_parse(struct net_bridge *br, struct net_bridge_port *p,
>  	return -EOPNOTSUPP;
>  }
>  
> -static inline int br_mrp_process(struct net_bridge_port *p, struct sk_buff *skb)
> -{
> -	return 0;
> -}
> -
>  static inline bool br_mrp_enabled(struct net_bridge *br)
>  {
>  	return false;


  parent reply	other threads:[~2020-10-12  9:12 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-09 14:35 [PATCH net-next v4 00/10] net: bridge: cfm: Add support for Connectivity Fault Management(CFM) Henrik Bjoernlund
2020-10-09 14:35 ` [PATCH net-next v4 01/10] net: bridge: extend the process of special frames Henrik Bjoernlund
2020-10-09 21:40   ` Nikolay Aleksandrov
2020-10-12  9:12   ` Nikolay Aleksandrov [this message]
2020-10-12 11:57     ` henrik.bjoernlund
2020-10-09 14:35 ` [PATCH net-next v4 02/10] bridge: cfm: Add BRIDGE_CFM to Kconfig Henrik Bjoernlund
2020-10-09 21:39   ` Nikolay Aleksandrov
2020-10-12 13:13     ` henrik.bjoernlund
2020-10-09 21:40   ` Nikolay Aleksandrov
2020-10-09 14:35 ` [PATCH net-next v4 03/10] bridge: uapi: cfm: Added EtherType used by the CFM protocol Henrik Bjoernlund
2020-10-09 21:41   ` Nikolay Aleksandrov
2020-10-12 13:13     ` henrik.bjoernlund
2020-10-09 14:35 ` [PATCH net-next v4 04/10] bridge: cfm: Kernel space implementation of CFM. MEP create/delete Henrik Bjoernlund
2020-10-09 21:42   ` Nikolay Aleksandrov
2020-10-12 13:12     ` henrik.bjoernlund
2020-10-09 14:35 ` [PATCH net-next v4 05/10] bridge: cfm: Kernel space implementation of CFM. CCM frame TX added Henrik Bjoernlund
2020-10-09 21:49   ` Nikolay Aleksandrov
2020-10-12 13:11     ` henrik.bjoernlund
2020-10-09 14:35 ` [PATCH net-next v4 06/10] bridge: cfm: Kernel space implementation of CFM. CCM frame RX added Henrik Bjoernlund
2020-10-09 21:52   ` Nikolay Aleksandrov
2020-10-12 13:11     ` henrik.bjoernlund
2020-10-09 14:35 ` [PATCH net-next v4 07/10] bridge: cfm: Netlink SET configuration Interface Henrik Bjoernlund
2020-10-09 21:53   ` Nikolay Aleksandrov
2020-10-12 13:07     ` henrik.bjoernlund
2020-10-10  1:45   ` Jakub Kicinski
2020-10-12 13:05     ` Henrik Bjoernlund
2020-10-09 14:35 ` [PATCH net-next v4 08/10] bridge: cfm: Netlink GET " Henrik Bjoernlund
2020-10-09 21:56   ` Nikolay Aleksandrov
2020-10-09 21:59     ` Nikolay Aleksandrov
2020-10-12 13:10       ` henrik.bjoernlund
2020-10-12 13:10     ` henrik.bjoernlund
2020-10-09 14:35 ` [PATCH net-next v4 09/10] bridge: cfm: Netlink GET status Interface Henrik Bjoernlund
2020-10-09 22:00   ` Nikolay Aleksandrov
2020-10-12 13:09     ` henrik.bjoernlund
2020-10-09 14:35 ` [PATCH net-next v4 10/10] bridge: cfm: Netlink Notifications Henrik Bjoernlund
2020-10-09 22:03   ` Nikolay Aleksandrov
2020-10-12 13:08     ` henrik.bjoernlund

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=3fc314a2074001f7b39bada2c50529eb2aefd077.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 \
    /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).