* [PATCH net-next 0/2] qmi_wwan changes intended for 3.7
@ 2012-09-07 17:36 Bjørn Mork
[not found] ` <1347039367-12399-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bjørn Mork @ 2012-09-07 17:36 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Bjørn Mork
Just a couple of minor improvements for 3.7. The QMI
message size issue is not considered important enough for
stable. It does not affect the primary device function
at all, and I consider it more of a feature enhancement
than a fix.
Bjørn Mork (2):
net: qmi_wwan: increase max QMI message size to 4096
net: qmi_wwan: use a single bind function for all device types
drivers/net/usb/qmi_wwan.c | 47 ++++++++++++++++----------------------------
1 file changed, 17 insertions(+), 30 deletions(-)
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] net: qmi_wwan: increase max QMI message size to 4096
[not found] ` <1347039367-12399-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
@ 2012-09-07 17:36 ` Bjørn Mork
0 siblings, 0 replies; 4+ messages in thread
From: Bjørn Mork @ 2012-09-07 17:36 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Bjørn Mork
QMI requests exceeding 1500 bytes are possible and
device firmware does not handle fragmented messages
very well. It is therefore necessary to increase
the maximum message size from the current 512 bytes.
The protocol message size limit is not documented
in any publicly known source, but the out of tree
driver from CodeAurora use 4 kB. This is therefore
chosen as the new arbitrary default until the real
limit is known.
This should allow any QMI message to be transmitted
without fragmentation, fixing known issues with GPS
assistance data upload.
Signed-off-by: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
---
drivers/net/usb/qmi_wwan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 328397c..516653f 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -108,7 +108,7 @@ static int qmi_wwan_register_subdriver(struct usbnet *dev)
atomic_set(&info->pmcount, 0);
/* register subdriver */
- subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, 512, &qmi_wwan_cdc_wdm_manage_power);
+ subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, 4096, &qmi_wwan_cdc_wdm_manage_power);
if (IS_ERR(subdriver)) {
dev_err(&info->control->dev, "subdriver registration failed\n");
rv = PTR_ERR(subdriver);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] net: qmi_wwan: use a single bind function for all device types
2012-09-07 17:36 [PATCH net-next 0/2] qmi_wwan changes intended for 3.7 Bjørn Mork
[not found] ` <1347039367-12399-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
@ 2012-09-07 17:36 ` Bjørn Mork
2012-09-07 18:50 ` [PATCH net-next 0/2] qmi_wwan changes intended for 3.7 David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Bjørn Mork @ 2012-09-07 17:36 UTC (permalink / raw)
To: netdev; +Cc: linux-usb, Bjørn Mork
Refactoring the bind code lets us use a common driver_info struct
for all supported devices, simplifying the code a bit. The
real advantage is that devices using the CDC ECM interface
layout now also can be added dynamically using the new_id sysfs
interface. This simplifies testing of new devices.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/net/usb/qmi_wwan.c | 45 ++++++++++++++++----------------------------
1 file changed, 16 insertions(+), 29 deletions(-)
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 516653f..8492333 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -139,10 +139,18 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state)));
- /* require a single interrupt status endpoint for subdriver */
+ /* control and data is shared? */
+ if (intf->cur_altsetting->desc.bNumEndpoints == 3) {
+ info->control = intf;
+ info->data = intf;
+ goto shared;
+ }
+
+ /* else require a single interrupt status endpoint on control intf */
if (intf->cur_altsetting->desc.bNumEndpoints != 1)
goto err;
+ /* and a number of CDC descriptors */
while (len > 3) {
struct usb_descriptor_header *h = (void *)buf;
@@ -231,8 +239,9 @@ next_desc:
if (status < 0)
goto err;
+shared:
status = qmi_wwan_register_subdriver(dev);
- if (status < 0) {
+ if (status < 0 && info->control != info->data) {
usb_set_intfdata(info->data, NULL);
usb_driver_release_interface(driver, info->data);
}
@@ -241,20 +250,6 @@ err:
return status;
}
-/* Some devices combine the "control" and "data" functions into a
- * single interface with all three endpoints: interrupt + bulk in and
- * out
- */
-static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf)
-{
- struct qmi_wwan_state *info = (void *)&dev->data;
-
- /* control and data is shared */
- info->control = intf;
- info->data = intf;
- return qmi_wwan_register_subdriver(dev);
-}
-
static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf)
{
struct qmi_wwan_state *info = (void *)&dev->data;
@@ -330,20 +325,12 @@ static const struct driver_info qmi_wwan_info = {
.manage_power = qmi_wwan_manage_power,
};
-static const struct driver_info qmi_wwan_shared = {
- .description = "WWAN/QMI device",
- .flags = FLAG_WWAN,
- .bind = qmi_wwan_bind_shared,
- .unbind = qmi_wwan_unbind,
- .manage_power = qmi_wwan_manage_power,
-};
-
#define HUAWEI_VENDOR_ID 0x12D1
/* map QMI/wwan function by a fixed interface number */
#define QMI_FIXED_INTF(vend, prod, num) \
USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \
- .driver_info = (unsigned long)&qmi_wwan_shared
+ .driver_info = (unsigned long)&qmi_wwan_info
/* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */
#define QMI_GOBI1K_DEVICE(vend, prod) \
@@ -367,15 +354,15 @@ static const struct usb_device_id products[] = {
/* 2. Combined interface devices matching on class+protocol */
{ /* Huawei E392, E398 and possibly others in "Windows mode" */
USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17),
- .driver_info = (unsigned long)&qmi_wwan_shared,
+ .driver_info = (unsigned long)&qmi_wwan_info,
},
{ /* Pantech UML290 */
USB_DEVICE_AND_INTERFACE_INFO(0x106c, 0x3718, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff),
- .driver_info = (unsigned long)&qmi_wwan_shared,
+ .driver_info = (unsigned long)&qmi_wwan_info,
},
{ /* Pantech UML290 - newer firmware */
USB_DEVICE_AND_INTERFACE_INFO(0x106c, 0x3718, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff),
- .driver_info = (unsigned long)&qmi_wwan_shared,
+ .driver_info = (unsigned long)&qmi_wwan_info,
},
/* 3. Combined interface devices matching on interface number */
@@ -457,7 +444,7 @@ static int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id
*/
if (!id->driver_info) {
dev_dbg(&intf->dev, "setting defaults for dynamic device id\n");
- id->driver_info = (unsigned long)&qmi_wwan_shared;
+ id->driver_info = (unsigned long)&qmi_wwan_info;
}
return usbnet_probe(intf, id);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 0/2] qmi_wwan changes intended for 3.7
2012-09-07 17:36 [PATCH net-next 0/2] qmi_wwan changes intended for 3.7 Bjørn Mork
[not found] ` <1347039367-12399-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2012-09-07 17:36 ` [PATCH net-next 2/2] net: qmi_wwan: use a single bind function for all device types Bjørn Mork
@ 2012-09-07 18:50 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-09-07 18:50 UTC (permalink / raw)
To: bjorn; +Cc: netdev, linux-usb
From: Bjørn Mork <bjorn@mork.no>
Date: Fri, 7 Sep 2012 19:36:05 +0200
> Just a couple of minor improvements for 3.7. The QMI
> message size issue is not considered important enough for
> stable. It does not affect the primary device function
> at all, and I consider it more of a feature enhancement
> than a fix.
>
>
> Bjørn Mork (2):
> net: qmi_wwan: increase max QMI message size to 4096
> net: qmi_wwan: use a single bind function for all device types
Both applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-07 18:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-07 17:36 [PATCH net-next 0/2] qmi_wwan changes intended for 3.7 Bjørn Mork
[not found] ` <1347039367-12399-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2012-09-07 17:36 ` [PATCH net-next 1/2] net: qmi_wwan: increase max QMI message size to 4096 Bjørn Mork
2012-09-07 17:36 ` [PATCH net-next 2/2] net: qmi_wwan: use a single bind function for all device types Bjørn Mork
2012-09-07 18:50 ` [PATCH net-next 0/2] qmi_wwan changes intended for 3.7 David Miller
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).