From: cooldavid@cooldavid.org
To: "David Miller" <davem@davemloft.net>
Cc: Guo-Fu Tseng <cooldavid@cooldavid.org>,
"linux-netdev" <netdev@vger.kernel.org>,
"Ethan Hsiao" <ethanhsiao@jmicron.com>,
"Devinchiu" <devinchiu@jmicron.com>,
"Hsiu-Che Chao" <hcchao@jmicron.com>,
stable@kernel.org
Subject: [PATCH net-2.6 2/3] jme: Protect vlgrp structure by pause RX actions.
Date: Wed, 17 Mar 2010 18:09:30 +0800 [thread overview]
Message-ID: <1268820571-2092-2-git-send-email-cooldavid@cooldavid.org> (raw)
In-Reply-To: <1268820571-2092-1-git-send-email-cooldavid@cooldavid.org>
From: Guo-Fu Tseng <cooldavid@cooldavid.org>
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
---
drivers/net/jme.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index cfc7b98..c0b59a5 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -2083,12 +2083,45 @@ jme_tx_timeout(struct net_device *netdev)
jme_reset_link(jme);
}
+static inline void jme_pause_rx(struct jme_adapter *jme)
+{
+ atomic_dec(&jme->link_changing);
+
+ jme_set_rx_pcc(jme, PCC_OFF);
+ if (test_bit(JME_FLAG_POLL, &jme->flags)) {
+ JME_NAPI_DISABLE(jme);
+ } else {
+ tasklet_disable(&jme->rxclean_task);
+ tasklet_disable(&jme->rxempty_task);
+ }
+}
+
+static inline void jme_resume_rx(struct jme_adapter *jme)
+{
+ struct dynpcc_info *dpi = &(jme->dpi);
+
+ if (test_bit(JME_FLAG_POLL, &jme->flags)) {
+ JME_NAPI_ENABLE(jme);
+ } else {
+ tasklet_hi_enable(&jme->rxclean_task);
+ tasklet_hi_enable(&jme->rxempty_task);
+ }
+ dpi->cur = PCC_P1;
+ dpi->attempt = PCC_P1;
+ dpi->cnt = 0;
+ jme_set_rx_pcc(jme, PCC_P1);
+
+ atomic_inc(&jme->link_changing);
+}
+
static void
jme_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
{
struct jme_adapter *jme = netdev_priv(netdev);
+ jme_pause_rx(jme);
jme->vlgrp = grp;
+ jme_resume_rx(jme);
}
static void
--
1.6.4.4
next prev parent reply other threads:[~2010-03-17 10:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-17 10:09 [PATCH net-2.6 1/3] jme: Fix VLAN memory leak cooldavid
2010-03-17 10:09 ` cooldavid [this message]
2010-03-17 10:09 ` [PATCH net-2.6 3/3] jme: Advance driver version number cooldavid
2010-03-19 4:14 ` David Miller
2010-03-19 4:14 ` [PATCH net-2.6 2/3] jme: Protect vlgrp structure by pause RX actions David Miller
2010-03-19 4:14 ` [PATCH net-2.6 1/3] jme: Fix VLAN memory leak David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1268820571-2092-2-git-send-email-cooldavid@cooldavid.org \
--to=cooldavid@cooldavid.org \
--cc=davem@davemloft.net \
--cc=devinchiu@jmicron.com \
--cc=ethanhsiao@jmicron.com \
--cc=hcchao@jmicron.com \
--cc=netdev@vger.kernel.org \
--cc=stable@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).