Skip to contentSkip to conversation

Add Ericsson 3G patches

PATCH In review [email protected] 2 participants 4 messages Jun 1, 2011 – Jun 3, 2011

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Add Ericsson 3G patches

From: Tom Zanussi <[email protected]>

This patchset adds the kernel patches needed for Ericsson 3G support, needed by fishriver.

Please pull into linux-yocto-2.6.37.

Pull URL: git://git.yoctoproject.org/linux-yocto-2.6.37-contrib
Branch: tzanussi/fishriver-3g
Browse: http://git.yoctoproject.org/cgit.cgi/linux-yocto-2.6.37-contrib/log/?h=tzanussi/fishriver-3g

Alexey Orishko (2):
usbnet: changes for upcoming cdc_ncm driver
USB CDC NCM host driver

 drivers/net/usb/Kconfig    |   19 +
 drivers/net/usb/Makefile   |    1 +
 drivers/net/usb/cdc_ncm.c  | 1213 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/usb/usbnet.c   |   45 ++-
 include/linux/usb/usbnet.h |    6 +
 5 files changed, 1270 insertions(+), 14 deletions(-)
 create mode 100644 drivers/net/usb/cdc_ncm.c
#1 lore raw

PATCH 1/2 usbnet: changes for upcoming cdc_ncm driver

From: Alexey Orishko

Changes:
include/linux/usb/usbnet.h:
- a new flag to indicate driver's capability to accumulate IP packets in Tx direction and extract several packets from single skb in Rx direction.
drivers/net/usb/usbnet.c:
- the procedure of counting packets in usbnet was updated due to the accumulating of IP packets in the driver
- no short packets are sent if indicated by the flag in driver_info structure

commit 073285fd392f6dc901da7c698d46e1e2a7e26436 upstream

Signed-off-by: Alexey Orishko
Signed-off-by: David S. Miller
Integrated-by: Dongxiao Xu

---
 drivers/net/usb/usbnet.c   |   45 ++++++++++++++++++++++++++++++-------------
 include/linux/usb/usbnet.h |    6 +++++
 2 files changed, 37 insertions(+), 14 deletions(-)
drivers/net/usb/usbnet.c +31 -14
index c04d49e..cff74b8 100644
@@ -391,14 +391,19 @@ static inline void rx_process (struct usbnet *dev, struct sk_buff *skb)
 		goto error;
 	// else network stack removes extra byte if we forced a short packet
 
-	if (skb->len)
-		usbnet_skb_return (dev, skb);
-	else {
-		netif_dbg(dev, rx_err, dev->net, "drop\n");
-error:
-		dev->net->stats.rx_errors++;
-		skb_queue_tail (&dev->done, skb);
+	if (skb->len) {
+		/* all data was already cloned from skb inside the driver */
+		if (dev->driver_info->flags & FLAG_MULTI_PACKET)
+			dev_kfree_skb_any(skb);
+		else
+			usbnet_skb_return(dev, skb);
+		return;
 	}
+
+	netif_dbg(dev, rx_err, dev->net, "drop\n");
+error:
+	dev->net->stats.rx_errors++;
+	skb_queue_tail(&dev->done, skb);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -971,7 +976,8 @@ static void tx_complete (struct urb *urb)
 	struct usbnet		*dev = entry->dev;
 
 	if (urb->status == 0) {
-		dev->net->stats.tx_packets++;
+		if (!(dev->driver_info->flags & FLAG_MULTI_PACKET))
+			dev->net->stats.tx_packets++;
 		dev->net->stats.tx_bytes += entry->length;
 	} else {
 		dev->net->stats.tx_errors++;
@@ -1044,8 +1050,13 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
 	if (info->tx_fixup) {
 		skb = info->tx_fixup (dev, skb, GFP_ATOMIC);
 		if (!skb) {
-			netif_dbg(dev, tx_err, dev->net, "can't tx_fixup skb\n");
-			goto drop;
+			if (netif_msg_tx_err(dev)) {
+				netif_dbg(dev, tx_err, dev->net, "can't tx_fixup skb\n");
+				goto drop;
+			} else {
+				/* cdc_ncm collected packet; waits for more */
+				goto not_drop;
+			}
 		}
 	}
 	length = skb->len;
@@ -1067,13 +1078,18 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
 	/* don't assume the hardware handles USB_ZERO_PACKET
 	 * NOTE:  strictly conforming cdc-ether devices should expect
 	 * the ZLP here, but ignore the one-byte packet.
+	 * NOTE2: CDC NCM specification is different from CDC ECM when
+	 * handling ZLP/short packets, so cdc_ncm driver will make short
+	 * packet itself if needed.
 	 */
 	if (length % dev->maxpacket == 0) {
 		if (!(info->flags & FLAG_SEND_ZLP)) {
-			urb->transfer_buffer_length++;
-			if (skb_tailroom(skb)) {
-				skb->data[skb->len] = 0;
-				__skb_put(skb, 1);
+			if (!(info->flags & FLAG_MULTI_PACKET)) {
+				urb->transfer_buffer_length++;
+				if (skb_tailroom(skb)) {
+					skb->data[skb->len] = 0;
+					__skb_put(skb, 1);
+				}
 			}
 		} else
 			urb->transfer_flags |= URB_ZERO_PACKET;
@@ -1122,6 +1138,7 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
 		netif_dbg(dev, tx_err, dev->net, "drop, code %d\n", retval);
 drop:
 		dev->net->stats.tx_dropped++;
+not_drop:
 		if (skb)
 			dev_kfree_skb_any (skb);
 		usb_free_urb (urb);
include/linux/usb/usbnet.h +6 -0
index 7ae27a4..44842c8 100644
@@ -97,6 +97,12 @@ struct driver_info {
 
 #define FLAG_LINK_INTR	0x0800		/* updates link (carrier) status */
 
+/*
+ * Indicates to usbnet, that USB driver accumulates multiple IP packets.
+ * Affects statistic (counters) and short packet handling.
+ */
+#define FLAG_MULTI_PACKET	0x1000
+
 	/* init device ... can sleep, or cause probe() failure */
 	int	(*bind)(struct usbnet *, struct usb_interface *);
 
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/2 USB CDC NCM host driver

From: Alexey Orishko

The patch provides USB CDC NCM host driver support in the Linux Kernel.

Changes:
drivers/net/usb/cdc_ncm.c:
- initial submission of the CDC NCM host driver;
- verified on Intel 32/64 bit, Intel Atom, ST-Ericsson U8500 (ARM)
- throughput measured over 100 Mbits duplex;
- driver supports 16-bit NTB format only, but it is more than enough for transfers up to 64K;
- driver can handle up to 32 datagrams in received NTB;
- timer is used to collect several packets in Tx direction

drivers/net/usb/Kconfig:
- a new entry to compile CDC NCM host driver
drivers/net/usb/Makefile:
- a new entry to compile CDC NCM host driver

commit 900d495a189dc3ff5952b98a77d18e3018f8286c upstream

Signed-off-by: Alexey Orishko
Signed-off-by: David S. Miller
Integrated-by: Dongxiao Xu

---
 drivers/net/usb/Kconfig   |   19 +
 drivers/net/usb/Makefile  |    1 +
 drivers/net/usb/cdc_ncm.c | 1213 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1233 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/usb/cdc_ncm.c
drivers/net/usb/Kconfig +19 -0
index 52ffabe..6f600cc 100644
@@ -196,6 +196,25 @@ config USB_NET_CDC_EEM
 	  IEEE 802 "local assignment" bit is set in the address, a "usbX"
 	  name is used instead.
 
+config USB_NET_CDC_NCM
+	tristate "CDC NCM support"
+	depends on USB_USBNET
+	default y
+	help
+	  This driver provides support for CDC NCM (Network Control Model
+	  Device USB Class Specification). The CDC NCM specification is
+	  available from <http://www.usb.org/>.
+
+	  Say "y" to link the driver statically, or "m" to build a
+	  dynamically linked module.
+
+	  This driver should work with at least the following devices:
+	    * ST-Ericsson M700 LTE FDD/TDD Mobile Broadband Modem (ref. design)
+	    * ST-Ericsson M5730 HSPA+ Mobile Broadband Modem (reference design)
+	    * ST-Ericsson M570 HSPA+ Mobile Broadband Modem (reference design)
+	    * ST-Ericsson M343 HSPA Mobile Broadband Modem (reference design)
+	    * Ericsson F5521gw Mobile Broadband Module
+
 config USB_NET_DM9601
 	tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices"
 	depends on USB_USBNET
drivers/net/usb/Makefile +1 -0
index a19b025..cac1703 100644
@@ -26,4 +26,5 @@ obj-$(CONFIG_USB_CDC_PHONET)	+= cdc-phonet.o
 obj-$(CONFIG_USB_IPHETH)	+= ipheth.o
 obj-$(CONFIG_USB_SIERRA_NET)	+= sierra_net.o
 obj-$(CONFIG_USB_NET_CX82310_ETH)	+= cx82310_eth.o
+obj-$(CONFIG_USB_NET_CDC_NCM)	+= cdc_ncm.o
 
drivers/net/usb/cdc_ncm.c new file +1213 -0

1,213 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#3 lore raw
In reply to [email protected]
Quoted 6 lines · On 11-06-01 6:03 PM, [email protected] wrote:

From: Tom Zanussi<[email protected]>

This patchset adds the kernel patches needed for Ericsson 3G support, needed by fishriver.

Please pull into linux-yocto-2.6.37.

Merged. I dropped these onto yocto/standard so any new BSPs can leverage them as well.

Changes will be pushed out in the morning, I have a few other pending merges to take care of at the same time.

Cheers,

Bruce

Quoted 17 lines

Pull URL: git://git.yoctoproject.org/linux-yocto-2.6.37-contrib
Branch: tzanussi/fishriver-3g
Browse: http://git.yoctoproject.org/cgit.cgi/linux-yocto-2.6.37-contrib/log/?h=tzanussi/fishriver-3g

Alexey Orishko (2):
usbnet: changes for upcoming cdc_ncm driver
USB CDC NCM host driver

  drivers/net/usb/Kconfig    |   19 +
  drivers/net/usb/Makefile   |    1 +
  drivers/net/usb/cdc_ncm.c  | 1213 ++++++++++++++++++++++++++++++++++++++++++++
  drivers/net/usb/usbnet.c   |   45 ++-
  include/linux/usb/usbnet.h |    6 +
  5 files changed, 1270 insertions(+), 14 deletions(-)

create mode 100644 drivers/net/usb/cdc_ncm.c