Re: [patch net-next 3/4] mlxsw: Add interface to access registers and process events

2015-07-24 Thread Elad Raz


Sent from my iPhone

 On Jul 24, 2015, at 08:14, Scott Feldman sfel...@gmail.com wrote:
 
 On Thu, Jul 23, 2015 at 8:43 AM, Jiri Pirko j...@resnulli.us wrote:
 From: Ido Schimmel ido...@mellanox.com
 
 Add the ability to construct mailbox-style register access messages
 called EMADs with provisions to construct and parse the registers payload.
 Implement EMAD transaction layer which is responsible for the reliable
 transmission of EMADs.
 Also, add an infrastructure used by the switch driver to register for
 particular events generated by the device.
 
 What is this EMADs used for?  Is this for intra-switch or inter-switch
 communications?

Ethernet management datagram.
It's command encoding wrap as a packet. It used for host interface 
communication as well as multi-silicon support.--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch net-next 3/4] mlxsw: Add interface to access registers and process events

2015-07-24 Thread Andy Gospodarek
On Fri, Jul 24, 2015 at 07:24:53AM +0200, Jiri Pirko wrote:
 Thu, Jul 23, 2015 at 11:12:20PM CEST, go...@cumulusnetworks.com wrote:
 On Thu, Jul 23, 2015 at 05:43:35PM +0200, Jiri Pirko wrote:
  From: Ido Schimmel ido...@mellanox.com
  
  Add the ability to construct mailbox-style register access messages
  called EMADs with provisions to construct and parse the registers payload.
  Implement EMAD transaction layer which is responsible for the reliable
  transmission of EMADs.
  Also, add an infrastructure used by the switch driver to register for
  particular events generated by the device.
  
  Signed-off-by: Ido Schimmel ido...@mellanox.com
  Signed-off-by: Jiri Pirko j...@mellanox.com
  Signed-off-by: Elad Raz el...@mellanox.com
  ---
   drivers/net/ethernet/mellanox/mlxsw/core.c |  736 
   drivers/net/ethernet/mellanox/mlxsw/core.h |   21 +
   drivers/net/ethernet/mellanox/mlxsw/emad.h |  127 +++
   drivers/net/ethernet/mellanox/mlxsw/port.h |   19 +
   drivers/net/ethernet/mellanox/mlxsw/reg.h  | 1289 
  
   5 files changed, 2192 insertions(+)
   create mode 100644 drivers/net/ethernet/mellanox/mlxsw/emad.h
   create mode 100644 drivers/net/ethernet/mellanox/mlxsw/reg.h
  
  diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c 
  b/drivers/net/ethernet/mellanox/mlxsw/core.c
  index 211ec9b..bd0f692 100644
  --- a/drivers/net/ethernet/mellanox/mlxsw/core.c
  +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
 [...]
  +  struct list_head event_listener_list;
  +  struct {
  +  struct sk_buff *resp_skb;
  +  u64 tid;
  +  wait_queue_head_t wait;
  +  bool trans_active;
  +  struct mutex lock; /* One EMAD transaction at a time. */
  +  bool use_emad;
  +  } emad;
 struct mlxsw_core_pcpu_stats __percpu *pcpu_stats;
 struct dentry *dbg_dir;
 struct {
 [...]
 }
   
 INIT_LIST_HEAD(mlxsw_core-rx_listener_list);
  +  INIT_LIST_HEAD(mlxsw_core-event_listener_list);
 mlxsw_core-driver = mlxsw_driver;
 mlxsw_core-bus = mlxsw_bus;
 mlxsw_core-bus_priv = bus_priv;
 [...]
  +  /* No reason to save item if we did not manage to register an RX
  +   * listener for it.
  +   */
  +  list_add_rcu(el_item-list, mlxsw_core-event_listener_list);
  +
 
 I see where 'event_listener_list' is defined and where entries are
 added/removed, but where is the code that would receive these events and
 presumably search this list so all handlers registered (currently just
 PUDE) can handle events?
 
 That is handled by calling mlxsw_core_rx_listener_register.
 that will add each event handler as a item to mlxsw_core-rx_listener_list
 These rx_listeners are called from mlxsw_core_skb_receive.
 So event is here a special case of rx_listener. The event list is used
 just to contain struct mlxsw_event_listener_item instances.
 

Thanks for the explanation!  I missed how that was called the first time
I went through this.

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch net-next 3/4] mlxsw: Add interface to access registers and process events

2015-07-23 Thread Jiri Pirko
Thu, Jul 23, 2015 at 11:12:20PM CEST, go...@cumulusnetworks.com wrote:
On Thu, Jul 23, 2015 at 05:43:35PM +0200, Jiri Pirko wrote:
 From: Ido Schimmel ido...@mellanox.com
 
 Add the ability to construct mailbox-style register access messages
 called EMADs with provisions to construct and parse the registers payload.
 Implement EMAD transaction layer which is responsible for the reliable
 transmission of EMADs.
 Also, add an infrastructure used by the switch driver to register for
 particular events generated by the device.
 
 Signed-off-by: Ido Schimmel ido...@mellanox.com
 Signed-off-by: Jiri Pirko j...@mellanox.com
 Signed-off-by: Elad Raz el...@mellanox.com
 ---
  drivers/net/ethernet/mellanox/mlxsw/core.c |  736 
  drivers/net/ethernet/mellanox/mlxsw/core.h |   21 +
  drivers/net/ethernet/mellanox/mlxsw/emad.h |  127 +++
  drivers/net/ethernet/mellanox/mlxsw/port.h |   19 +
  drivers/net/ethernet/mellanox/mlxsw/reg.h  | 1289 
 
  5 files changed, 2192 insertions(+)
  create mode 100644 drivers/net/ethernet/mellanox/mlxsw/emad.h
  create mode 100644 drivers/net/ethernet/mellanox/mlxsw/reg.h
 
 diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c 
 b/drivers/net/ethernet/mellanox/mlxsw/core.c
 index 211ec9b..bd0f692 100644
 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c
 +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
[...]
 +struct list_head event_listener_list;
 +struct {
 +struct sk_buff *resp_skb;
 +u64 tid;
 +wait_queue_head_t wait;
 +bool trans_active;
 +struct mutex lock; /* One EMAD transaction at a time. */
 +bool use_emad;
 +} emad;
  struct mlxsw_core_pcpu_stats __percpu *pcpu_stats;
  struct dentry *dbg_dir;
  struct {
[...]
  }
  
  INIT_LIST_HEAD(mlxsw_core-rx_listener_list);
 +INIT_LIST_HEAD(mlxsw_core-event_listener_list);
  mlxsw_core-driver = mlxsw_driver;
  mlxsw_core-bus = mlxsw_bus;
  mlxsw_core-bus_priv = bus_priv;
[...]
 +/* No reason to save item if we did not manage to register an RX
 + * listener for it.
 + */
 +list_add_rcu(el_item-list, mlxsw_core-event_listener_list);
 +

I see where 'event_listener_list' is defined and where entries are
added/removed, but where is the code that would receive these events and
presumably search this list so all handlers registered (currently just
PUDE) can handle events?

That is handled by calling mlxsw_core_rx_listener_register.
that will add each event handler as a item to mlxsw_core-rx_listener_list
These rx_listeners are called from mlxsw_core_skb_receive.
So event is here a special case of rx_listener. The event list is used
just to contain struct mlxsw_event_listener_item instances.

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch net-next 3/4] mlxsw: Add interface to access registers and process events

2015-07-23 Thread Jiri Pirko
Fri, Jul 24, 2015 at 07:13:42AM CEST, sfel...@gmail.com wrote:
On Thu, Jul 23, 2015 at 8:43 AM, Jiri Pirko j...@resnulli.us wrote:
 From: Ido Schimmel ido...@mellanox.com

 Add the ability to construct mailbox-style register access messages
 called EMADs with provisions to construct and parse the registers payload.
 Implement EMAD transaction layer which is responsible for the reliable
 transmission of EMADs.
 Also, add an infrastructure used by the switch driver to register for
 particular events generated by the device.

What is this EMADs used for?  Is this for intra-switch or inter-switch
communications?

It is used for passing configuration messages to/from switch device.
It is also used for events. EMADS are passed inside skb like ordinary
packets. They do not leave the switch.

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch net-next 3/4] mlxsw: Add interface to access registers and process events

2015-07-23 Thread Scott Feldman
On Thu, Jul 23, 2015 at 8:43 AM, Jiri Pirko j...@resnulli.us wrote:
 From: Ido Schimmel ido...@mellanox.com

 Add the ability to construct mailbox-style register access messages
 called EMADs with provisions to construct and parse the registers payload.
 Implement EMAD transaction layer which is responsible for the reliable
 transmission of EMADs.
 Also, add an infrastructure used by the switch driver to register for
 particular events generated by the device.

What is this EMADs used for?  Is this for intra-switch or inter-switch
communications?
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch net-next 3/4] mlxsw: Add interface to access registers and process events

2015-07-23 Thread Andy Gospodarek
On Thu, Jul 23, 2015 at 05:43:35PM +0200, Jiri Pirko wrote:
 From: Ido Schimmel ido...@mellanox.com
 
 Add the ability to construct mailbox-style register access messages
 called EMADs with provisions to construct and parse the registers payload.
 Implement EMAD transaction layer which is responsible for the reliable
 transmission of EMADs.
 Also, add an infrastructure used by the switch driver to register for
 particular events generated by the device.
 
 Signed-off-by: Ido Schimmel ido...@mellanox.com
 Signed-off-by: Jiri Pirko j...@mellanox.com
 Signed-off-by: Elad Raz el...@mellanox.com
 ---
  drivers/net/ethernet/mellanox/mlxsw/core.c |  736 
  drivers/net/ethernet/mellanox/mlxsw/core.h |   21 +
  drivers/net/ethernet/mellanox/mlxsw/emad.h |  127 +++
  drivers/net/ethernet/mellanox/mlxsw/port.h |   19 +
  drivers/net/ethernet/mellanox/mlxsw/reg.h  | 1289 
 
  5 files changed, 2192 insertions(+)
  create mode 100644 drivers/net/ethernet/mellanox/mlxsw/emad.h
  create mode 100644 drivers/net/ethernet/mellanox/mlxsw/reg.h
 
 diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c 
 b/drivers/net/ethernet/mellanox/mlxsw/core.c
 index 211ec9b..bd0f692 100644
 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c
 +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
[...]
 + struct list_head event_listener_list;
 + struct {
 + struct sk_buff *resp_skb;
 + u64 tid;
 + wait_queue_head_t wait;
 + bool trans_active;
 + struct mutex lock; /* One EMAD transaction at a time. */
 + bool use_emad;
 + } emad;
   struct mlxsw_core_pcpu_stats __percpu *pcpu_stats;
   struct dentry *dbg_dir;
   struct {
[...]
   }
  
   INIT_LIST_HEAD(mlxsw_core-rx_listener_list);
 + INIT_LIST_HEAD(mlxsw_core-event_listener_list);
   mlxsw_core-driver = mlxsw_driver;
   mlxsw_core-bus = mlxsw_bus;
   mlxsw_core-bus_priv = bus_priv;
[...]
 + /* No reason to save item if we did not manage to register an RX
 +  * listener for it.
 +  */
 + list_add_rcu(el_item-list, mlxsw_core-event_listener_list);
 +

I see where 'event_listener_list' is defined and where entries are
added/removed, but where is the code that would receive these events and
presumably search this list so all handlers registered (currently just
PUDE) can handle events?
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html