[Cerowrt-devel] Raspberry Pi build

Robert Bradley robert.bradley1 at gmail.com
Sat Aug 18 17:59:21 PDT 2012


On 18/08/12 19:53, Dave Taht wrote:
> On Sat, Aug 18, 2012 at 11:07 AM, Robert Bradley
> <robert.bradley1 at gmail.com> wrote:
>> I did a bit of digging, and the Raspberry Pi uses the SMSC LAN9512 chip for
>> wired Ethernet
>> (http://www.smsc.com/media/Downloads_Public/Data_Sheets/9512.pdf). The
>> smsc95xx driver currently lacks BQL support, so that would need to be added
>> first.
> 22k worth of native buffering in the driver (at least at this layer)
> (at 100Mbit, I usually use 3k)
>
> #define DEFAULT_HS_BURST_CAP_SIZE       (16 * 1024 + 5 * HS_USB_PKT_SIZE)
> #define DEFAULT_FS_BURST_CAP_SIZE       (6 * 1024 + 33 * FS_USB_PKT_SIZE)
>
> And: Either this is a "yea! one abstraction to fit them all", or a
> "oh, god, we need something else to track completions", as above it
> uses a generic usbnet.c driver, which, sigh, does try to aggregate
> too.

At least USB should be relatively clean compared to wireless, so less 
need to check for partially-lost frames?

Assuming usbnet is "one abstraction to fit them all" for the moment, I 
think I might possibly have a patch for BQL support, as long as I've not 
done anything stupid.

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c

index b7fbd35..04404b0 100644

--- a/drivers/net/usb/usbnet.c

+++ b/drivers/net/usb/usbnet.c

@@ -777,6 +777,7 @@ int usbnet_open (struct net_device *net)

      }

  

      set_bit(EVENT_DEV_OPEN, &dev->flags);

+    netdev_reset_queue(net);

      netif_start_queue (net);

      netif_info(dev, ifup, dev->net,

             "open: enable queueing (rx %d, tx %d) mtu %d %s framing\n",

@@ -1021,11 +1022,14 @@ static void tx_complete (struct urb *urb)

      struct sk_buff        *skb = (struct sk_buff *) urb->context;

      struct skb_data        *entry = (struct skb_data *) skb->cb;

      struct usbnet        *dev = entry->dev;

+    unsigned int bytes_compl = 0, pkts_compl = 0;

  

      if (urb->status == 0) {

          if (!(dev->driver_info->flags & FLAG_MULTI_PACKET))

              dev->net->stats.tx_packets++;

          dev->net->stats.tx_bytes += entry->length;

+        pkts_compl++;

+        bytes_compl += skb->len;

      } else {

          dev->net->stats.tx_errors++;

  

@@ -1060,6 +1064,7 @@ static void tx_complete (struct urb *urb)

          }

      }

  

+    netdev_completed_queue(dev->net, pkts_compl, bytes_compl);

      usb_autopm_put_interface_async(dev->intf);

      (void) defer_bh(dev, skb, &dev->txq, tx_done);

  }

@@ -1195,6 +1200,7 @@ not_drop:

  #ifdef CONFIG_PM

  deferred:

  #endif

+    netdev_sent_queue(net, skb->len);

      return NETDEV_TX_OK;

  }

  EXPORT_SYMBOL_GPL(usbnet_start_xmit);

-- 
Robert Bradley



More information about the Cerowrt-devel mailing list