* [PATCH] sky2: Add a mutex around ethtools operations
@ 2009-08-05 22:46 Mike McCormack
2009-08-06 0:41 ` Stephen Hemminger
2009-08-06 0:42 ` Stephen Hemminger
0 siblings, 2 replies; 3+ messages in thread
From: Mike McCormack @ 2009-08-05 22:46 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, Rene Mayrhofer, Richard Leitner
As multiple sky2 devices share some of the same hardware, and ethtool
operations are per device, access to transmit timers, eeprom access,
coalesce, etc. should be serialized.
Only tested on a single port card, as my sky2 doesn't have dual ports.
Signed-off-by: Mike McCormack <mikem@ring3k.org>
---
drivers/net/sky2.c | 15 +++++++++++++++
drivers/net/sky2.h | 1 +
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 1415a83..96aad19 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3923,6 +3923,18 @@ static int sky2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom
return sky2_vpd_write(sky2->hw, cap, data, eeprom->offset, eeprom->len);
}
+static int sky2_ethtool_begin(struct net_device *dev)
+{
+ struct sky2_port *sky2 = netdev_priv(dev);
+ mutex_lock(&sky2->hw->ethtool_mutex);
+ return 0;
+}
+
+static void sky2_ethtool_complete(struct net_device *dev)
+{
+ struct sky2_port *sky2 = netdev_priv(dev);
+ mutex_unlock(&sky2->hw->ethtool_mutex);
+}
static const struct ethtool_ops sky2_ethtool_ops = {
.get_settings = sky2_get_settings,
@@ -3954,6 +3966,8 @@ static const struct ethtool_ops sky2_ethtool_ops = {
.phys_id = sky2_phys_id,
.get_sset_count = sky2_get_sset_count,
.get_ethtool_stats = sky2_get_ethtool_stats,
+ .begin = sky2_ethtool_begin,
+ .complete = sky2_ethtool_complete,
};
#ifdef CONFIG_SKY2_DEBUG
@@ -4485,6 +4499,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
}
hw->pdev = pdev;
+ mutex_init(&hw->ethtool_mutex);
hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000);
if (!hw->regs) {
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 4486b06..199fb4a 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -2087,6 +2087,7 @@ struct sky2_hw {
struct timer_list watchdog_timer;
struct work_struct restart_work;
wait_queue_head_t msi_wait;
+ struct mutex ethtool_mutex;
};
static inline int sky2_is_copper(const struct sky2_hw *hw)
--
1.5.6.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sky2: Add a mutex around ethtools operations
2009-08-05 22:46 [PATCH] sky2: Add a mutex around ethtools operations Mike McCormack
@ 2009-08-06 0:41 ` Stephen Hemminger
2009-08-06 0:42 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2009-08-06 0:41 UTC (permalink / raw)
To: Mike McCormack; +Cc: netdev, Rene Mayrhofer, Richard Leitner
On Thu, 06 Aug 2009 07:46:02 +0900
Mike McCormack <mikem@ring3k.org> wrote:
> As multiple sky2 devices share some of the same hardware, and ethtool
> operations are per device, access to transmit timers, eeprom access,
> coalesce, etc. should be serialized.
>
> Only tested on a single port card, as my sky2 doesn't have dual ports.
>
> Signed-off-by: Mike McCormack <mikem@ring3k.org>
NAK.
The ethtool operations are already serialized by rtnl mutex at
higher level. See net/core/dev.c
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sky2: Add a mutex around ethtools operations
2009-08-05 22:46 [PATCH] sky2: Add a mutex around ethtools operations Mike McCormack
2009-08-06 0:41 ` Stephen Hemminger
@ 2009-08-06 0:42 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2009-08-06 0:42 UTC (permalink / raw)
To: Mike McCormack; +Cc: netdev, Rene Mayrhofer, Richard Leitner
On Thu, 06 Aug 2009 07:46:02 +0900
Mike McCormack <mikem@ring3k.org> wrote:
> As multiple sky2 devices share some of the same hardware, and ethtool
> operations are per device, access to transmit timers, eeprom access,
> coalesce, etc. should be serialized.
>
> Only tested on a single port card, as my sky2 doesn't have dual ports.
>
> Signed-off-by: Mike McCormack <mikem@ring3k.org>
NAK.
The ethtool operations are already serialized by rtnl mutex at
higher level. See net/core/dev.c
--
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-06 0:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-05 22:46 [PATCH] sky2: Add a mutex around ethtools operations Mike McCormack
2009-08-06 0:41 ` Stephen Hemminger
2009-08-06 0:42 ` Stephen Hemminger
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).