aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/jme.c
diff options
context:
space:
mode:
authorGuo-Fu Tseng <cooldavid@cooldavid.org>2010-03-16 20:09:30 -0400
committerDavid S. Miller <davem@davemloft.net>2010-03-19 00:14:00 -0400
commitbf5e5360fd1df1ae429ebbd81838d7d0879797d1 (patch)
treeb75cfb068c845430ae93931ab7869b8bccc1e0a2 /drivers/net/jme.c
parent17da69b8bfbe441a33a873ad5dd7d3d85800bf2b (diff)
jme: Protect vlgrp structure by pause RX actions.
Temporary stop the RX IRQ, and disable (sync) tasklet or napi. And restore it after finished the vlgrp pointer assignment. Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org> Cc: stable@kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/jme.c')
-rw-r--r--drivers/net/jme.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index cfc7b9824d6f..c0b59a555384 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -2083,12 +2083,45 @@ jme_tx_timeout(struct net_device *netdev)
2083 jme_reset_link(jme); 2083 jme_reset_link(jme);
2084} 2084}
2085 2085
2086static inline void jme_pause_rx(struct jme_adapter *jme)
2087{
2088 atomic_dec(&jme->link_changing);
2089
2090 jme_set_rx_pcc(jme, PCC_OFF);
2091 if (test_bit(JME_FLAG_POLL, &jme->flags)) {
2092 JME_NAPI_DISABLE(jme);
2093 } else {
2094 tasklet_disable(&jme->rxclean_task);
2095 tasklet_disable(&jme->rxempty_task);
2096 }
2097}
2098
2099static inline void jme_resume_rx(struct jme_adapter *jme)
2100{
2101 struct dynpcc_info *dpi = &(jme->dpi);
2102
2103 if (test_bit(JME_FLAG_POLL, &jme->flags)) {
2104 JME_NAPI_ENABLE(jme);
2105 } else {
2106 tasklet_hi_enable(&jme->rxclean_task);
2107 tasklet_hi_enable(&jme->rxempty_task);
2108 }
2109 dpi->cur = PCC_P1;
2110 dpi->attempt = PCC_P1;
2111 dpi->cnt = 0;
2112 jme_set_rx_pcc(jme, PCC_P1);
2113
2114 atomic_inc(&jme->link_changing);
2115}
2116
2086static void 2117static void
2087jme_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) 2118jme_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
2088{ 2119{
2089 struct jme_adapter *jme = netdev_priv(netdev); 2120 struct jme_adapter *jme = netdev_priv(netdev);
2090 2121
2122 jme_pause_rx(jme);
2091 jme->vlgrp = grp; 2123 jme->vlgrp = grp;
2124 jme_resume_rx(jme);
2092} 2125}
2093 2126
2094static void 2127static void