Subject: Re: [PATCH net-next 00/10] net/hsr: Use list_head+rcu, better frame dispatch, etc.

From: Arvid Brodin <[email-masked]>
Date: Fri, 11 Jul 2014 17:45:28 +0200

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
[email-masked] | www.alten.se/en/