* [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Write lockdep xmit class in late initialization phase
@ 2012-08-27 8:53 Sven Eckelmann
2012-08-27 8:53 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Add KernelDoc for soft-interface lockdep functions Sven Eckelmann
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Sven Eckelmann @ 2012-08-27 8:53 UTC (permalink / raw)
To: b.a.t.m.a.n
e27bb6fa916451e9eaced16e7c21d5b71a3b7f30 ("batman-adv: Set special lockdep
classes to avoid lockdep warning") introduced a lockdep class for the tx queue,
but did not set it in the correct initialization phase. The batman-adv specific
lock class could be replaced by a later netdevice registration phase.
Reported-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
soft-interface.c | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/soft-interface.c b/soft-interface.c
index a584f62..72d8767 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -352,16 +352,6 @@ out:
return;
}
-static const struct net_device_ops batadv_netdev_ops = {
- .ndo_open = batadv_interface_open,
- .ndo_stop = batadv_interface_release,
- .ndo_get_stats = batadv_interface_stats,
- .ndo_set_mac_address = batadv_interface_set_mac_addr,
- .ndo_change_mtu = batadv_interface_change_mtu,
- .ndo_start_xmit = batadv_interface_tx,
- .ndo_validate_addr = eth_validate_addr
-};
-
/* batman-adv network devices have devices nesting below it and are a special
* "super class" of normal network devices; split their locks off into a
* separate class since they always nest.
@@ -382,6 +372,30 @@ static void batadv_set_lockdep_class(struct net_device *dev)
netdev_for_each_tx_queue(dev, batadv_set_lockdep_class_one, NULL);
}
+/**
+ * batadv_softif_init - Late stage initialization of soft interface
+ * @dev: registered network device to modify
+ *
+ * Returns error code on failures
+ */
+static int batadv_softif_init(struct net_device *dev)
+{
+ batadv_set_lockdep_class(dev);
+
+ return 0;
+}
+
+static const struct net_device_ops batadv_netdev_ops = {
+ .ndo_init = batadv_softif_init,
+ .ndo_open = batadv_interface_open,
+ .ndo_stop = batadv_interface_release,
+ .ndo_get_stats = batadv_interface_stats,
+ .ndo_set_mac_address = batadv_interface_set_mac_addr,
+ .ndo_change_mtu = batadv_interface_change_mtu,
+ .ndo_start_xmit = batadv_interface_tx,
+ .ndo_validate_addr = eth_validate_addr
+};
+
static void batadv_interface_setup(struct net_device *dev)
{
struct batadv_priv *priv = netdev_priv(dev);
@@ -391,7 +405,6 @@ static void batadv_interface_setup(struct net_device *dev)
dev->netdev_ops = &batadv_netdev_ops;
dev->destructor = free_netdev;
dev->tx_queue_len = 0;
- batadv_set_lockdep_class(dev);
/* can't call min_mtu, because the needed variables
* have not been initialized yet
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Add KernelDoc for soft-interface lockdep functions
2012-08-27 8:53 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Write lockdep xmit class in late initialization phase Sven Eckelmann
@ 2012-08-27 8:53 ` Sven Eckelmann
2012-09-09 8:15 ` Marek Lindner
2012-08-30 11:46 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Write lockdep xmit class in late initialization phase Antonio Quartulli
2012-09-09 8:13 ` Marek Lindner
2 siblings, 1 reply; 5+ messages in thread
From: Sven Eckelmann @ 2012-08-27 8:53 UTC (permalink / raw)
To: b.a.t.m.a.n
e27bb6fa916451e9eaced16e7c21d5b71a3b7f30 ("batman-adv: Set special lockdep
classes to avoid lockdep warning") added new functions, but no new documentation
for these functions.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
soft-interface.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/soft-interface.c b/soft-interface.c
index 72d8767..5fd3e30 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -359,6 +359,12 @@ out:
static struct lock_class_key batadv_netdev_xmit_lock_key;
static struct lock_class_key batadv_netdev_addr_lock_key;
+/**
+ * batadv_set_lockdep_class_one - Set lockdep class for a single tx queue
+ * @dev: device which owns the tx queue
+ * @txq: tx queue to modify
+ * @_unused: always NULL
+ */
static void batadv_set_lockdep_class_one(struct net_device *dev,
struct netdev_queue *txq,
void *_unused)
@@ -366,6 +372,10 @@ static void batadv_set_lockdep_class_one(struct net_device *dev,
lockdep_set_class(&txq->_xmit_lock, &batadv_netdev_xmit_lock_key);
}
+/**
+ * batadv_set_lockdep_class - Set txq and addr_list lockdep class
+ * @dev: network device to modify
+ */
static void batadv_set_lockdep_class(struct net_device *dev)
{
lockdep_set_class(&dev->addr_list_lock, &batadv_netdev_addr_lock_key);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Write lockdep xmit class in late initialization phase
2012-08-27 8:53 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Write lockdep xmit class in late initialization phase Sven Eckelmann
2012-08-27 8:53 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Add KernelDoc for soft-interface lockdep functions Sven Eckelmann
@ 2012-08-30 11:46 ` Antonio Quartulli
2012-09-09 8:13 ` Marek Lindner
2 siblings, 0 replies; 5+ messages in thread
From: Antonio Quartulli @ 2012-08-30 11:46 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
[-- Attachment #1: Type: text/plain, Size: 3016 bytes --]
On Mon, Aug 27, 2012 at 10:53:50AM +0200, Sven Eckelmann wrote:
> e27bb6fa916451e9eaced16e7c21d5b71a3b7f30 ("batman-adv: Set special lockdep
> classes to avoid lockdep warning") introduced a lockdep class for the tx queue,
> but did not set it in the correct initialization phase. The batman-adv specific
> lock class could be replaced by a later netdevice registration phase.
>
> Reported-by: Antonio Quartulli <ordex@autistici.org>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Tested-by: Antonio Quartulli <ordex@autistici.org>
This solves the problem reported in bug #162! Thank you Sven!
> ---
> soft-interface.c | 35 ++++++++++++++++++++++++-----------
> 1 file changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/soft-interface.c b/soft-interface.c
> index a584f62..72d8767 100644
> --- a/soft-interface.c
> +++ b/soft-interface.c
> @@ -352,16 +352,6 @@ out:
> return;
> }
>
> -static const struct net_device_ops batadv_netdev_ops = {
> - .ndo_open = batadv_interface_open,
> - .ndo_stop = batadv_interface_release,
> - .ndo_get_stats = batadv_interface_stats,
> - .ndo_set_mac_address = batadv_interface_set_mac_addr,
> - .ndo_change_mtu = batadv_interface_change_mtu,
> - .ndo_start_xmit = batadv_interface_tx,
> - .ndo_validate_addr = eth_validate_addr
> -};
> -
> /* batman-adv network devices have devices nesting below it and are a special
> * "super class" of normal network devices; split their locks off into a
> * separate class since they always nest.
> @@ -382,6 +372,30 @@ static void batadv_set_lockdep_class(struct net_device *dev)
> netdev_for_each_tx_queue(dev, batadv_set_lockdep_class_one, NULL);
> }
>
> +/**
> + * batadv_softif_init - Late stage initialization of soft interface
> + * @dev: registered network device to modify
> + *
> + * Returns error code on failures
> + */
> +static int batadv_softif_init(struct net_device *dev)
> +{
> + batadv_set_lockdep_class(dev);
> +
> + return 0;
> +}
> +
> +static const struct net_device_ops batadv_netdev_ops = {
> + .ndo_init = batadv_softif_init,
> + .ndo_open = batadv_interface_open,
> + .ndo_stop = batadv_interface_release,
> + .ndo_get_stats = batadv_interface_stats,
> + .ndo_set_mac_address = batadv_interface_set_mac_addr,
> + .ndo_change_mtu = batadv_interface_change_mtu,
> + .ndo_start_xmit = batadv_interface_tx,
> + .ndo_validate_addr = eth_validate_addr
> +};
> +
> static void batadv_interface_setup(struct net_device *dev)
> {
> struct batadv_priv *priv = netdev_priv(dev);
> @@ -391,7 +405,6 @@ static void batadv_interface_setup(struct net_device *dev)
> dev->netdev_ops = &batadv_netdev_ops;
> dev->destructor = free_netdev;
> dev->tx_queue_len = 0;
> - batadv_set_lockdep_class(dev);
>
> /* can't call min_mtu, because the needed variables
> * have not been initialized yet
> --
> 1.7.10.4
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Write lockdep xmit class in late initialization phase
2012-08-27 8:53 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Write lockdep xmit class in late initialization phase Sven Eckelmann
2012-08-27 8:53 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Add KernelDoc for soft-interface lockdep functions Sven Eckelmann
2012-08-30 11:46 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Write lockdep xmit class in late initialization phase Antonio Quartulli
@ 2012-09-09 8:13 ` Marek Lindner
2 siblings, 0 replies; 5+ messages in thread
From: Marek Lindner @ 2012-09-09 8:13 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Monday, August 27, 2012 16:53:50 Sven Eckelmann wrote:
> e27bb6fa916451e9eaced16e7c21d5b71a3b7f30 ("batman-adv: Set special lockdep
> classes to avoid lockdep warning") introduced a lockdep class for the tx
> queue, but did not set it in the correct initialization phase. The
> batman-adv specific lock class could be replaced by a later netdevice
> registration phase.
>
> Reported-by: Antonio Quartulli <ordex@autistici.org>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> soft-interface.c | 35 ++++++++++++++++++++++++-----------
> 1 file changed, 24 insertions(+), 11 deletions(-)
Applied in revision b8f86c9.
Thanks,
Marek
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-09-09 8:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-27 8:53 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Write lockdep xmit class in late initialization phase Sven Eckelmann
2012-08-27 8:53 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Add KernelDoc for soft-interface lockdep functions Sven Eckelmann
2012-09-09 8:15 ` Marek Lindner
2012-08-30 11:46 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Write lockdep xmit class in late initialization phase Antonio Quartulli
2012-09-09 8:13 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox