netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Enrico Mioso <mrkiko.rs@gmail.com>
To: "Bjørn Mork" <bjorn@mork.no>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH RFC 3/3] huawei_cdc_ncm base skeleton
Date: Wed, 3 Jul 2013 12:16:19 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LNX.2.02.1307031209310.19087@eeeadesso> (raw)
In-Reply-To: <87ip0sw0sf.fsf@nemi.mork.no>

First of all - thank you for all your comments and suggestions!




On Wed, 3 Jul 2013, Bj?rn Mork wrote:

==Date: Wed, 03 Jul 2013 09:38:40 +0200
==From: Bj?rn Mork <bjorn@mork.no>
==To: Enrico Mioso <mrkiko.rs@gmail.com>
==Cc: netdev@vger.kernel.org
==Subject: Re: [PATCH RFC 3/3] huawei_cdc_ncm base skeleton
==
==Enrico Mioso <mrkiko.rs@gmail.com> writes:
==
==> This is more an RFC than a patch.
==
==It looks pretty complete to me :)
==
==> + * This code is based on the original cdc_ncm implementation, that is:
==> + * Copyright (C) ST-Ericsson 2010-2012
==> + * Contact: Alexey Orishko <alexey.orishko@stericsson.com>
==> + * Original author: Hans Petter Selasky <hans.petter.selasky@stericsson.com>
==> + *
==> + * USB Host Driver for Network Control Model (NCM)
==> + * http://www.usb.org/developers/devclass_docs/NCM10.zip
==> + *
==> + * The NCM encoding, decoding and initialization logic
==> + * derives from FreeBSD 8.x. if_cdce.c and if_cdcereg.h
==> + *
==> + * This software is available to you under a choice of one of two
==> + * licenses. You may choose this file to be licensed under the terms
==> + * of the GNU General Public License (GPL) Version 2 or the 2-clause
==> + * BSD license listed below:
==
==This text does not match the MODULE_LICENSE you have used. You should
==probably take a few minutes to think about how you want your work to be
==licensed and use the appropriate combination of license comment and
==MODULE_LICENSE.
==
==You do in any case not need to copy all this from the cdc_ncm driver.
==You reuse code via the exported API, but the code in this driver is
==mostly your own.  A small note of cdc_ncm use is nice, but I don't think
==it's any more necessary than for other kernel code you use via #includes.
==
==

Thank you - right. I want my code to be GPL, no bsd license. Yes, I understand 
it're purely a personal choice, but wanted to be sincere.

==> +/* Bind our driver to needed interfaces. Heavily inspired by cdc_mbim.c one! */
==
==Many of your comments look mostly like notes for yourself.  Which they
==probably are, given that you sent this as a RFC :)
==
==You should go over all these comments and think about whether they are
==useful for others reading this code.  I don't think this one is, for
==example.
==
Yeah !! :) I'll remove them - they where here to help me understand the logic 
structure.

==> +static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev, struct usb_interface *intf) {
==> +
==> +	/* Some general use variables */
==> +	struct cdc_ncm_ctx *ctx;
==> +	struct usb_driver *subdriver = ERR_PTR(-ENODEV);
==> +	int ret = -ENODEV;
==> +	struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data;
==> +	
==> +	/* Actually binds us to the device: use standard ncm function */
==> +	ret = cdc_ncm_bind_common(usbnet_dev, intf, 1); /* altsetting should be 1 */
==> +	
==> +	/* Did the ncm bind function fail? */
==> +	if (ret)
==> +		goto err;
==> +	
==> +	/* Let cdc data ctx pointer point to our state structure */
==> +	ctx = drvstate->ctx;
==> +	
==> +	if (usbnet_dev->status) 
==> +		subdriver = usb_cdc_wdm_register(ctx->control, &usbnet_dev->status->desc, 4096, huawei_cdc_ncm_wdm_manage_power); /* a smarter way to calculate that constant? */
==
==Yes, we were going to revisit that constant as soon as you discovered
==the protocol.  Now you found that it is AT commands, which doesn't
==really provide an absolute answer.  But AT commands is actually the
==normal usecase for cdc-wdm, so I believe using the defaults from that
==specification makes some sense.  As noted on the cdc-wdm driver:
==
==  CDC-WMC r1.1 requires wMaxCommand to be "at least 256 decimal (0x100)"
==
==Maybe 256 is enough here? Or are there Huawei specific AT commands with
==larger responses than that?  I don't know.  Choose some number and
==change the comment to explain the reasoning behind that choice.
==
==
I don't know - a word from Huawei would be very helpful in this context. 
Aniway, I would think there are commands with very large payloads and messages.
What you think if we set this to 512?

==> +	if (IS_ERR(subdriver)) {
==> +	 ret = PTR_ERR(subdriver);
==> +	 cdc_ncm_unbind(usbnet_dev, intf);
==> +   goto err;
==> +	}
==> +	
==> +	/* Prevent usbnet from using the status descriptor */
==> +	usbnet_dev->status = NULL;
==> +	
==> +	drvstate->subdriver = subdriver;
==> +	
==> +	/* FIXME: should we handle the vlan header in some way? */
==
==No, that is in cdc_mbim because it maps multiplexed MBIM IP sessions to
==ethernet VLAN interfaces.  The devices supported by this driver cannot
==support more than one IP session per USB function, so there is
==absolutely nothing you or the firmware can map a VLAN to.  Just drop the
==comment. 
==
Fine!
==> +	/* FIXME2: in my opinion we also could not do ARP, hoping somebody can help... */
==
==The firmware obviously does ARP as it works whether you disable it or
==not.  The usefulness can be discussed, but you cannot drop it without
==testing that it does in fact work.  The firmware most likely use either
==DHCP or ARP requests to figure out your MAC address, so the ARP requests
==might be required even if they look silly.
==
==
I will proceed with the test in some minutes!

==> +static const struct usb_device_id huawei_cdc_ncm_devs[] = {
==> +	/* The correct NCM handling will be implemented. For now, only my dongle
==> +		will be handled.
==> +		*/
==> +	{ USB_DEVICE_INTERFACE_NUMBER(0x12d1, 0x1506, 1), \
==> +		.driver_info = (unsigned long)&huawei_cdc_ncm_info,
==> +	},
==> +
==> +	{
==> +		/* Terminating entry */
==> +	},
==> +};
==
==
==As you note, that table needs to match on class codes.  Just move the
==Huawei vendor specific entries from cdc_ncm.
==
Here I'm a little bit confused - it seems there are device exporting QMI inside 
ncm, devices exporting AT and even devices exporting other unspecified 
protocol... or at least this was what I understood from google and various 
reports.
I will move all the entries - hoping not to cause regressions for cdc_ncm 
users!!

==
==
==Bj?rn
==
Thank you again for your help.

  reply	other threads:[~2013-07-03 10:16 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02 10:43 [PATCH RFC] cdc_ncm.c: make rx and tx functions exportable Enrico Mioso
2013-07-02 12:01 ` Bjørn Mork
2013-07-02 12:05   ` Enrico Mioso
2013-07-02 17:04   ` [RFC] huawei_cdc_ncm driver - status Enrico Mioso
2013-07-02 19:06     ` Enrico Mioso
2013-07-02 20:06     ` [PATCH 0/3] make cdc_ncm_tx_fixup and cdc_ncm_rx_fixup non-static functions Enrico Mioso
2013-07-02 20:10       ` [PATCH 1/3] Export cdc_ncm_{tx,rx}_fixup functions Enrico Mioso
2013-07-02 20:13         ` [PATCH RFC 2/3] Introduce huawei_cdc_ncm driver Enrico Mioso
2013-07-02 20:15           ` [PATCH RFC 3/3] huawei_cdc_ncm base skeleton Enrico Mioso
2013-07-03  6:40             ` Huaei E3131 - connected! Enrico Mioso
2013-07-03  7:11               ` Huaei E3131 - status Enrico Mioso
2013-07-03  8:15                 ` Bjørn Mork
2013-07-03 12:55                   ` [PATCH V2 1/3] usbnet: cdc_ncm: let cdc_ncm_tx_fixup and cdc_ncm_rx_fixup be non-static Enrico Mioso
2013-07-03 13:00                   ` [PATCH V2 2/3] usbnet: cdc_ncm: export cdc_ncm_tx_fixup and cdc_ncm_rx_fixup Enrico Mioso
2013-07-03 13:19                     ` Sergei Shtylyov
2013-07-03 13:22                       ` Enrico Mioso
2013-07-03 13:33                       ` [PATCH V3 1/2] Export cdc_ncm_{tx,rx]_fixup functions Enrico Mioso
2013-07-03 13:38                       ` [PATCH V3 2/2] Introduce huawei_cdc_ncm driver Enrico Mioso
2013-07-03 16:18                         ` Ben Hutchings
2013-07-03 18:11                           ` [PATCH V3 2/2 RESEND] " Enrico Mioso
2013-07-04 13:19                             ` Bjørn Mork
2013-07-04 17:03                               ` Enrico Mioso
2013-07-03 18:11                           ` [PATCH V3 2/2] " Enrico Mioso
2013-07-03 13:05                   ` [PATCH V2 3/3] usbnet: introduce " Enrico Mioso
2013-07-03 13:13                   ` [PATCH] usbnet: cdc_ncm: remove huawei devices handled by cdc_ncm_huawei.c Enrico Mioso
2013-07-03  7:13               ` Huaei E3131 - connected! Bjørn Mork
2013-07-03  7:38             ` [PATCH RFC 3/3] huawei_cdc_ncm base skeleton Bjørn Mork
2013-07-03 10:16               ` Enrico Mioso [this message]
2013-07-03  7:40           ` [PATCH RFC 2/3] Introduce huawei_cdc_ncm driver Bjørn Mork
2013-07-03  7:43         ` [PATCH 1/3] Export cdc_ncm_{tx,rx}_fixup functions Bjørn Mork
2013-07-03 10:19           ` Enrico Mioso
2013-07-03  7:45       ` [PATCH 0/3] make cdc_ncm_tx_fixup and cdc_ncm_rx_fixup non-static functions Bjørn Mork
2013-07-10 12:27   ` [PATCH 1/3] net: cdc_ncm: Export cdc_ncm_{tx,rx}_fixup functions for re-use Enrico Mioso
     [not found]     ` <0cbf7c81-182e-493c-9c28-5b78160a08f1@email.android.com>
     [not found]       ` <alpine.LNX.2.02.1307170457450.1161@eeeadesso>
     [not found]         ` <87bo4xx3ef.fsf@nemi.mork.no>
     [not found]           ` <87bo4xx3ef.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2013-08-16 13:39             ` [PATCH] " Enrico Mioso
2013-08-16 13:49               ` Greg Kroah-Hartman
2013-08-16 13:51                 ` Enrico Mioso
2013-08-16 13:52                 ` Greg Kroah-Hartman
2013-08-16 13:44           ` [PATCH] net: huawei_cdc_ncm: Introduce new huawei_cdc_ncm driver Enrico Mioso
2013-07-10 12:28   ` [PATCH 2/3] net: huawei_cdc_ncm: Introduce the " Enrico Mioso
2013-07-10 12:30   ` [PATCH 3/3] net: cdc_ncm: remove Huawei non-standard NCM device IDs Enrico Mioso

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=alpine.LNX.2.02.1307031209310.19087@eeeadesso \
    --to=mrkiko.rs@gmail.com \
    --cc=bjorn@mork.no \
    --cc=netdev@vger.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).