From: Dan Williams <dcbw@redhat.com>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Oliver Neukum <oliver@neukum.org>,
Elina Pasheva <epasheva@sierrawireless.com>,
Network Development <netdev@vger.kernel.org>,
linux-usb <linux-usb@vger.kernel.org>,
Rory Filer <rfiler@sierrawireless.com>, Phil Sutter <phil@nwl.cc>
Subject: [PATCH 2/2 v4] sierra_net: keep status interrupt URB active
Date: Tue, 09 Apr 2013 18:05:51 -0500 [thread overview]
Message-ID: <1365548751.23372.6.camel@dcbw.foobar.com> (raw)
In-Reply-To: <1365548547.23372.2.camel@dcbw.foobar.com>
The driver and firmware sync up through SYNC messages, and the
firmware's affirmative reply to these SYNC messages appears to be the
"Reset" indication received via the status interrupt endpoint. Thus the
driver needs the status interrupt endpoint always active so that the
Reset indication can be received even if the netdev is closed, which is
the case right after device insertion.
Signed-off-by: Dan Williams <dcbw@redhat.com>
---
drivers/net/usb/sierra_net.c | 40 ++++++++++++++++++++++++++++++++--------
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
index 79ab243..c707225 100644
--- a/drivers/net/usb/sierra_net.c
+++ b/drivers/net/usb/sierra_net.c
@@ -44,7 +44,7 @@ static const char driver_name[] = "sierra_net";
#include <net/ip.h>
#include <net/udp.h>
#include <asm/unaligned.h>
-#include <linux/usb/usbnet.h>
+#include "usbnet.h"
#define SWI_USB_REQUEST_GET_FW_ATTR 0x06
#define SWI_GET_FW_ATTR_MASK 0x08
@@ -427,6 +427,13 @@ static void sierra_net_dosync(struct usbnet *dev)
dev_dbg(&dev->udev->dev, "%s", __func__);
+ /* The SIERRA_NET_HIP_MSYNC_ID command appears to request that the
+ * firmware restart itself. After restarting, the modem will respond
+ * with the SIERRA_NET_HIP_RESTART_ID indication. The driver continues
+ * sending MSYNC commands every few seconds until it receives the
+ * RESTART event from the firmware
+ */
+
/* tell modem we are ready */
status = sierra_net_send_sync(dev);
if (status < 0)
@@ -705,6 +712,9 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf)
/* set context index initially to 0 - prepares tx hdr template */
sierra_net_set_ctx_index(priv, 0);
+ /* prepare sync message template */
+ memcpy(priv->sync_msg, sync_tmplate, sizeof(priv->sync_msg));
+
/* decrease the rx_urb_size and max_tx_size to 4k on USB 1.1 */
dev->rx_urb_size = SIERRA_NET_RX_URB_SIZE;
if (dev->udev->speed != USB_SPEED_HIGH)
@@ -740,11 +750,6 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf)
kfree(priv);
return -ENODEV;
}
- /* prepare sync message from template */
- memcpy(priv->sync_msg, sync_tmplate, sizeof(priv->sync_msg));
-
- /* initiate the sync sequence */
- sierra_net_dosync(dev);
return 0;
}
@@ -767,8 +772,9 @@ static void sierra_net_unbind(struct usbnet *dev, struct usb_interface *intf)
netdev_err(dev->net,
"usb_control_msg failed, status %d\n", status);
- sierra_net_set_private(dev, NULL);
+ usbnet_status_stop(dev);
+ sierra_net_set_private(dev, NULL);
kfree(priv);
}
@@ -909,6 +915,24 @@ static const struct driver_info sierra_net_info_direct_ip = {
.tx_fixup = sierra_net_tx_fixup,
};
+static int
+sierra_net_probe(struct usb_interface *udev, const struct usb_device_id *prod)
+{
+ int ret;
+
+ ret = usbnet_probe(udev, prod);
+ if (ret == 0) {
+ struct usbnet *dev = usb_get_intfdata(udev);
+
+ ret = usbnet_status_start(dev, GFP_KERNEL);
+ if (ret == 0) {
+ /* Interrupt URB now set up; initiate sync sequence */
+ sierra_net_dosync(dev);
+ }
+ }
+ return ret;
+}
+
#define DIRECT_IP_DEVICE(vend, prod) \
{USB_DEVICE_INTERFACE_NUMBER(vend, prod, 7), \
.driver_info = (unsigned long)&sierra_net_info_direct_ip}, \
@@ -931,7 +955,7 @@ MODULE_DEVICE_TABLE(usb, products);
static struct usb_driver sierra_net_driver = {
.name = "sierra_net",
.id_table = products,
- .probe = usbnet_probe,
+ .probe = sierra_net_probe,
.disconnect = usbnet_disconnect,
.suspend = usbnet_suspend,
.resume = usbnet_resume,
--
1.8.1.4
next prev parent reply other threads:[~2013-04-09 23:04 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-27 14:12 strange behaviour of MC7700 with sierra_net Phil Sutter
[not found] ` <20110727141246.GC29616-2COwY06ShZsYt6otZODPyA@public.gmane.org>
2011-07-27 19:40 ` Dan Williams
[not found] ` <1311795643.17655.13.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2011-07-28 16:32 ` Phil Sutter
[not found] ` <8F90F944E50427428C60E12A34A309D23424BB0F25@carmd-exchmb01.sierrawireless.local>
[not found] ` <8F90F944E50427428C60E12A34A309D23424BB0F25-3qf8vkpM5jTbmvMHnzRVpW3Pdy6AhKVLXbPIYa3/oNjDOqzlkpFKJg@public.gmane.org>
2011-08-04 16:38 ` Phil Sutter
2013-01-04 16:48 ` [PATCH 1/2] usbnet: allow status interrupt URB to always be active Dan Williams
2013-01-04 16:51 ` [PATCH 2/2] sierra_net: keep status interrupt URB active over netdev open/close Dan Williams
[not found] ` <1357318289.5370.19.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2013-02-06 18:42 ` [PATCH 2/2 v2] sierra_net: fix issues with SYNC/RESTART messages and interrupt pipe setup Dan Williams
[not found] ` <1360176176.11742.16.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2013-02-06 20:17 ` Oliver Neukum
2013-02-07 21:09 ` Dan Williams
2013-02-06 21:11 ` Bjørn Mork
2013-02-07 17:06 ` Dan Williams
2013-02-13 11:44 ` Bjørn Mork
2013-02-13 16:34 ` Dan Williams
2013-01-04 22:16 ` [PATCH 1/2] usbnet: allow status interrupt URB to always be active Oliver Neukum
2013-01-05 1:26 ` Dan Williams
2013-01-05 11:01 ` Oliver Neukum
2013-01-05 11:44 ` Bjørn Mork
2013-01-07 15:25 ` Dan Williams
2013-01-14 17:52 ` Dan Williams
[not found] ` <1357349193.19684.3.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2013-01-05 10:59 ` Bjørn Mork
[not found] ` <87y5g7nbej.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2013-01-07 7:40 ` Oliver Neukum
2013-01-07 15:21 ` Dan Williams
2013-01-11 3:06 ` Ming Lei
2013-01-14 17:23 ` Dan Williams
2013-01-15 1:13 ` Ming Lei
2013-02-06 18:36 ` [PATCH 1/2 v2] " Dan Williams
2013-02-06 20:19 ` Oliver Neukum
2013-03-28 16:30 ` [PATCH 1/2 v3] " Dan Williams
[not found] ` <1364488207.1877.20.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2013-03-28 16:32 ` [PATCH 2/2 v3] sierra_net: keep status interrupt URB active Dan Williams
[not found] ` <1364488327.1877.22.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2013-03-29 19:21 ` David Miller
2013-03-29 19:20 ` [PATCH 1/2 v3] usbnet: allow status interrupt URB to always be active David Miller
[not found] ` <CACVXFVMBAzTYZKiE_uSTqr_yB4f7c5_PSnK=LBP6=oWdWwYHfg@mail.gmail.com>
[not found] ` <CACVXFVMBAzTYZKiE_uSTqr_yB4f7c5_PSnK=LBP6=oWdWwYHfg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-01 16:04 ` Dan Williams
2013-04-09 23:02 ` [PATCH 1/2 v4] " Dan Williams
2013-04-09 23:05 ` Dan Williams [this message]
2013-04-10 7:15 ` [PATCH 2/2 v4] sierra_net: keep status interrupt URB active Oliver Neukum
2013-04-10 14:57 ` Dan Williams
2013-04-10 15:01 ` Oliver Neukum
2013-04-10 7:23 ` [PATCH 1/2 v4] usbnet: allow status interrupt URB to always be active Oliver Neukum
[not found] ` <2328167.HJRXSHNhKT-7ztolUikljGernLeA6q8OA@public.gmane.org>
2013-04-10 12:49 ` Dan Williams
2013-04-10 13:06 ` Oliver Neukum
2013-04-10 13:18 ` Dan Williams
2013-04-10 13:29 ` Oliver Neukum
[not found] ` <1542762.9EJvNHlBNo-7ztolUikljGernLeA6q8OA@public.gmane.org>
2013-04-10 13:54 ` Dan Williams
[not found] ` <1365602083.28888.40.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2013-04-10 13:58 ` Oliver Neukum
2013-04-10 15:01 ` Dan Williams
2013-04-10 18:10 ` Oliver Neukum
2013-04-10 20:30 ` [PATCH 1/2 v5] " Dan Williams
[not found] ` <1365625850.22411.1.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2013-04-10 20:33 ` [PATCH 2/2 v5] sierra_net: keep status interrupt URB active Dan Williams
2013-04-11 2:31 ` [PATCH 1/2 v5] usbnet: allow status interrupt URB to always be active Ming Lei
2013-04-11 6:50 ` Oliver Neukum
2013-04-11 8:06 ` Bjørn Mork
2013-04-11 8:37 ` Ming Lei
2013-04-11 9:59 ` Oliver Neukum
2013-04-11 10:04 ` Bjørn Mork
2013-04-11 10:09 ` Ming Lei
2013-04-11 10:19 ` Ming Lei
[not found] ` <CACVXFVNn9MQr6JLdin=u642Jb-2ZPfVk8YaBmNdhU0_2e7WJqQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-11 10:26 ` Bjørn Mork
2013-04-11 10:30 ` Ming Lei
2013-04-11 11:08 ` Bjørn Mork
[not found] ` <87d2u1wci6.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2013-04-11 11:42 ` Ming Lei
[not found] ` <CACVXFVO13tG606nDHth5rEA9jexj1iFHnry5ktrMpm_aGGTSvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-11 11:54 ` Oliver Neukum
2013-04-11 12:16 ` Ming Lei
2013-04-11 8:09 ` Ming Lei
2013-04-11 9:53 ` Oliver Neukum
2013-04-11 10:03 ` Ming Lei
2013-04-11 11:14 ` Oliver Neukum
2013-04-11 12:11 ` Ming Lei
2013-04-11 12:28 ` Oliver Neukum
2013-04-11 12:59 ` Ming Lei
[not found] ` <CACVXFVPPzva+EwjNdxWsg4FufCc0zzzzvhGH_nLv479vT8VcxQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-12 6:37 ` Oliver Neukum
2013-04-12 9:42 ` Ming Lei
2013-04-12 10:02 ` Oliver Neukum
2013-04-12 10:08 ` Ming Lei
2013-04-12 10:13 ` Bjørn Mork
2013-04-11 15:28 ` Dan Williams
2013-04-12 7:28 ` Oliver Neukum
2013-04-10 21:35 ` Oliver Neukum
2013-04-15 15:59 ` Dan Williams
2013-04-16 1:15 ` Ming Lei
2013-04-16 7:57 ` Oliver Neukum
[not found] ` <1637650.tuYfvStuVJ-7ztolUikljGernLeA6q8OA@public.gmane.org>
2013-04-17 1:56 ` Ming Lei
2013-04-17 6:55 ` Oliver Neukum
[not found] ` <5581442.KzM2iaDSQ0-7ztolUikljGernLeA6q8OA@public.gmane.org>
2013-04-18 3:51 ` Ming Lei
2013-04-19 8:25 ` Oliver Neukum
2013-04-24 12:31 ` Dan Williams
2013-04-25 13:00 ` Oliver Neukum
[not found] ` <1365548547.23372.2.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2013-04-10 13:25 ` [PATCH 1/2 v4] " Bjørn Mork
2013-04-10 13:31 ` Oliver Neukum
[not found] ` <1365604263.28888.56.camel@dcbw.foobar.com>
2013-04-10 15:21 ` Bjørn Mork
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=1365548751.23372.6.camel@dcbw.foobar.com \
--to=dcbw@redhat.com \
--cc=epasheva@sierrawireless.com \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oliver@neukum.org \
--cc=phil@nwl.cc \
--cc=rfiler@sierrawireless.com \
--cc=tom.leiming@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.