All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 00/10] net/hsr: Use list_head+rcu, better frame dispatch, etc.
@ 2014-07-04 21:33 Arvid Brodin
  2014-07-08 18:45 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Arvid Brodin @ 2014-07-04 21:33 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

This patch series is meant to improve the HSR code in several ways:

* Better code readability.
* In general, make the code structure more like the net/bridge code (HSR 
  operates similarly to a bridge, but uses the HSR-specific frame headers to 
  break up rings, instead of the STP protocol).
* Better handling of HSR ports' net_device features.
* Use list_head and the _rcu list traversing routines instead of array of slave 
  devices.
* Make it easy to support HSR Interlink devices (for future Redbox/Quadbox 
  support).
* Somewhat better throughput on non-HAVE_EFFICIENT_UNALIGNED_ACCESS archs, due 
  to lesser copying of skb data.

The code has been tested in a ring together with other HSR nodes running 
unchanged code, on both avr32 and x86_64. There should only be one minor change 
in behaviour from a user perspective:

* Anyone using the Netlink HSR_C_GET_NODE_LIST message to dump the internal 
  node database will notice that the database now also contains the self node.

All patches pass 'checkpatch.pl --ignore CAMELCASE --max-line-length=83 
--strict' with only CHECKs, each of which have been deliberately left in place.

The final code passes sparse checks with no output.


Arvid Brodin (10):
  net/hsr: Better variable names and update of contact info.
  net/hsr: Switch from dev_add_pack() to netdev_rx_handler_register()
  net/hsr: Move to per-hsr device prune timer.
  net/hsr: Operstate handling cleanup.
  net/hsr: Move slave init to hsr_slave.c.
  net/hsr: Use list_head (and rcu) instead of array for slave devices.
  net/hsr: Implemented .ndo_fix_features (better device features
    handling).
  net/hsr: Added SET_NETDEV_DEVTYPE and features |= NETIF_F_NETNS_LOCAL
    to dev_setup.
  net/hsr: Better frame dispatch
  net/hsr: Fix NULL pointer dereference on incomplete hsr_newlink()
    params.

 net/hsr/Makefile       |   3 +-
 net/hsr/hsr_device.c   | 580 +++++++++++++++++++++----------------------------
 net/hsr/hsr_device.h   |  12 +-
 net/hsr/hsr_forward.c  | 368 +++++++++++++++++++++++++++++++
 net/hsr/hsr_forward.h  |  20 ++
 net/hsr/hsr_framereg.c | 481 ++++++++++++++++++++--------------------
 net/hsr/hsr_framereg.h |  45 ++--
 net/hsr/hsr_main.c     | 425 ++++--------------------------------
 net/hsr/hsr_main.h     |  61 ++++--
 net/hsr/hsr_netlink.c  | 102 +++++----
 net/hsr/hsr_netlink.h  |  11 +-
 net/hsr/hsr_slave.c    | 196 +++++++++++++++++
 net/hsr/hsr_slave.h    |  38 ++++
 13 files changed, 1285 insertions(+), 1057 deletions(-)
 create mode 100644 net/hsr/hsr_forward.c
 create mode 100644 net/hsr/hsr_forward.h
 create mode 100644 net/hsr/hsr_slave.c
 create mode 100644 net/hsr/hsr_slave.h

-- 
1.8.3.2

-- 
Arvid Brodin | Consultant (Linux)
ALTEN | Knarrarnäsgatan 7 | SE-164 40 Kista | Sweden
arvid.brodin@alten.se | www.alten.se/en/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next 00/10] net/hsr: Use list_head+rcu, better frame dispatch, etc.
  2014-07-04 21:33 [PATCH net-next 00/10] net/hsr: Use list_head+rcu, better frame dispatch, etc Arvid Brodin
@ 2014-07-08 18:45 ` David Miller
  2014-07-11 15:45   ` Arvid Brodin
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2014-07-08 18:45 UTC (permalink / raw)
  To: arvid.brodin; +Cc: netdev

From: Arvid Brodin <arvid.brodin@alten.se>
Date: Fri, 4 Jul 2014 23:33:44 +0200

> This patch series is meant to improve the HSR code in several ways:
> 
> * Better code readability.
> * In general, make the code structure more like the net/bridge code (HSR 
>   operates similarly to a bridge, but uses the HSR-specific frame headers to 
>   break up rings, instead of the STP protocol).
> * Better handling of HSR ports' net_device features.
> * Use list_head and the _rcu list traversing routines instead of array of slave 
>   devices.
> * Make it easy to support HSR Interlink devices (for future Redbox/Quadbox 
>   support).
> * Somewhat better throughput on non-HAVE_EFFICIENT_UNALIGNED_ACCESS archs, due 
>   to lesser copying of skb data.
> 
> The code has been tested in a ring together with other HSR nodes running 
> unchanged code, on both avr32 and x86_64. There should only be one minor change 
> in behaviour from a user perspective:
> 
> * Anyone using the Netlink HSR_C_GET_NODE_LIST message to dump the internal 
>   node database will notice that the database now also contains the self node.
> 
> All patches pass 'checkpatch.pl --ignore CAMELCASE --max-line-length=83 
> --strict' with only CHECKs, each of which have been deliberately left in place.
> 
> The final code passes sparse checks with no output.

Series applied, thanks.

Just one question:

@@ -575,6 +579,13 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
 		}
 	}
 
+	for (i = 0; i < HSR_MAX_SLAVE; i++) {
+		res = netdev_rx_handler_register(slave[i], hsr_handle_frame,
+						 hsr);
+		if (res)
+			goto fail;
+	}
+
 	/* Make sure we recognize frames from ourselves in hsr_rcv() */
 	res = hsr_create_self_node(&hsr->self_node_db, hsr_dev->dev_addr,
 				   hsr->slave[1]->dev_addr);

If one of the slaves fails to register it's RX handler here, what unregisters
the slaves which already succeeded?

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next 00/10] net/hsr: Use list_head+rcu, better frame dispatch, etc.
  2014-07-08 18:45 ` David Miller
@ 2014-07-11 15:45   ` Arvid Brodin
  0 siblings, 0 replies; 3+ messages in thread
From: Arvid Brodin @ 2014-07-11 15:45 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On 2014-07-08 20:45, David Miller wrote:
> 
> Just one question:
> 
> @@ -575,6 +579,13 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
>  		}
>  	}
>  
> +	for (i = 0; i < HSR_MAX_SLAVE; i++) {
> +		res = netdev_rx_handler_register(slave[i], hsr_handle_frame,
> +						 hsr);
> +		if (res)
> +			goto fail;
> +	}
> +
>  	/* Make sure we recognize frames from ourselves in hsr_rcv() */
>  	res = hsr_create_self_node(&hsr->self_node_db, hsr_dev->dev_addr,
>  				   hsr->slave[1]->dev_addr);
> 
> If one of the slaves fails to register it's RX handler here, what unregisters
> the slaves which already succeeded?

This looks like it's from "[PATCH net-next 02/10] net/hsr: Switch from dev_add_pack() to 
netdev_rx_handler_register()". If so, the code under the fail: label calls restore_slaves(), 
which in turn iterates over the slaves. From the same patch: 

@@ -402,8 +402,12 @@ static void restore_slaves(struct net_device *hsr_dev)
 			netdev_info(hsr_dev,
 				    "Cannot restore slave promiscuity (%s, %d)\n",
 				    hsr->slave[i]->name, res);
+
+		if (hsr->slave[i]->rx_handler == hsr_handle_frame)
+			netdev_rx_handler_unregister(hsr->slave[i]);
 	}
 
+
 	rtnl_unlock();
 }
 

-- 
Arvid Brodin | Consultant (Linux)
ALTEN | Knarrarnäsgatan 7 | SE-164 40 Kista | Sweden
arvid.brodin@alten.se | www.alten.se/en/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-11 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-04 21:33 [PATCH net-next 00/10] net/hsr: Use list_head+rcu, better frame dispatch, etc Arvid Brodin
2014-07-08 18:45 ` David Miller
2014-07-11 15:45   ` Arvid Brodin

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.