David T Hollis wrote:

Greg KH wrote:

On Thu, Jun 12, 2003 at 09:12:00AM -0400, David T Hollis wrote:


Few minor code tweaks, formatting, etc. Greg, is this in proper shape for inclusion?


Close, but I think this will break on 2.4.22-pre1, right:


+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
+#include <linux/crc32.h>
+#else /* for now, this is swiped out of various drivers in drivers/net/... */
+static unsigned const ethernet_polynomial = 0x04c11db7U;
+static inline u32 ether_crc(int length, unsigned char *data)
+{
+ int crc = -1;
+ while (--length >= 0) {
+ unsigned char current_octet = *data++;
+ int bit;
+ for (bit = 0; bit < 8; bit++, current_octet >>= 1) {
+ crc = (crc << 1) ^
+ ((crc < 0) ^ (current_octet & 1) ?
+ ethernet_polynomial : 0);
+ }
+ }
+ return crc;
+}
+#endif


Can you also rip this out of the 2.5 version you sent me?

thanks,

greg k-h


Ok, here is the 2.4 version (a patch against the one I already send to save some bandwidth). The CRC stuff is removed which does force this guy to 2.4.19 and higher if I'm not mistaken. I don't see that as a big issue in that most folks are probably running 2.4.18 or higher and the RH9 kernel is listed as 2.4.18 but it's more like 2.4.19 (maybe even 2.4.20) with all the patches. I would suspect most other distro's are the same.

You'll probably get a collision when applying with the $Id tag at the top of the file. I noticed that the patch I sent you replaced it with the diff version, not the driver rev.

2.5 is on it's way.
Index: ax8817x.c
===================================================================
RCS file: /home/dhollis/cvsroot/ax8817x/ax8817x.c,v
retrieving revision 1.13
retrieving revision 1.15
diff -u -r1.13 -r1.15
--- ax8817x.c   12 Jun 2003 12:57:04 -0000      1.13
+++ ax8817x.c   15 Jun 2003 18:45:21 -0000      1.15
@@ -1,7 +1,7 @@
 /*
  * ASIX AX8817x USB 2.0 10/100/HomePNA Ethernet controller driver
  *
- * $Id: ax8817x.c,v 1.13 2003/06/12 12:57:04 dhollis Exp $
+ * $Id: ax8817x.c,v 1.15 2003/06/15 18:45:21 dhollis Exp $
  *
  * Copyright (c) 2002-2003 TiVo Inc.
  *
@@ -10,6 +10,12 @@
  *
  * History 
  *
+ *     2003-06-12 - Dave Hollis <[EMAIL PROTECTED]>  1.0.1
+ *             * use usb_make_path for ethtool info
+ *             * Use crc32.h for crc functions
+ *             * Additional callback cases for other host ctrlrs
+ *             * Force minimum default rcv buffers
+ *
  *     2003-06-12 - Dave Hollis <[EMAIL PROTECTED]>  1.0.0
  *             * Backport removal of multiple tx_urb / lengthy 
  *               start_xmit routines, etc.
@@ -64,26 +70,7 @@
 #include <linux/skbuff.h>
 #include <linux/mii.h>
 #include <asm/uaccess.h>
-
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
 #include <linux/crc32.h>
-#else                          /* for now, this is swiped out of various drivers in 
drivers/net/... */
-static unsigned const ethernet_polynomial = 0x04c11db7U;
-static inline u32 ether_crc(int length, unsigned char *data)
-{
-       int crc = -1;
-       while (--length >= 0) {
-               unsigned char current_octet = *data++;
-               int bit;
-               for (bit = 0; bit < 8; bit++, current_octet >>= 1) {
-                       crc = (crc << 1) ^
-                           ((crc < 0) ^ (current_octet & 1) ?
-                            ethernet_polynomial : 0);
-               }
-       }
-       return crc;
-}
-#endif
 
 /* Version Information */
 #define DRIVER_VERSION "v1.0.0"
@@ -131,8 +118,10 @@
 
 #define AX_MAX_PHY_RETRY            50
 
+#define AX_RX_URBS_DEFAULT         2
+
 static const char driver_name[] = "ax8817x";
-static int n_rx_urbs = 2;
+static int n_rx_urbs = AX_RX_URBS_DEFAULT;
 
 MODULE_PARM(n_rx_urbs, "i");
 MODULE_PARM_DESC(n_rx_urbs,
@@ -630,7 +619,10 @@
        case -ENOENT:           /* */
        case -ECONNRESET:       /* Async unlink */
        case -ESHUTDOWN:        /* Hardware gone */
-       case -EILSEQ:           /* Get this when you yank it out */
+       case -EILSEQ:           /* Get this when you yank it out on UHCI */
+       case -ETIMEDOUT:        /* OHCI */
+       case -EPROTO:           /* EHCI */
+       case -EPIPE:            
                dev_kfree_skb_any(skb);
                urb->context = NULL;
                return;
@@ -927,7 +919,6 @@
 {
        struct ax8817x_info *ax_info;
        int cmd;
-       char tmp[128];
 
        ax_info = net->priv;
        if (get_user(cmd, (int *) uaddr))
@@ -941,9 +932,8 @@
                                ETHTOOL_BUSINFO_LEN);
                        strncpy(info.version, DRIVER_VERSION,
                                ETHTOOL_BUSINFO_LEN);
-                       sprintf(tmp, "usb%d:%d", ax_info->usb->bus->busnum,
-                               ax_info->usb->devnum);
-                       strncpy(info.bus_info, tmp, ETHTOOL_BUSINFO_LEN);
+                       usb_make_path(ax_info->usb, info.bus_info,
+                                     sizeof info.bus_info);
                        if (copy_to_user(uaddr, &info, sizeof(info)))
                                return -EFAULT;
                        return 0;
@@ -1273,10 +1263,8 @@
 {
        int ret;
 
-       if (n_rx_urbs <= 0) {
-               err("%s: Non-positive URB count\n", __FUNCTION__);
-               return -EINVAL;
-       }
+       if (n_rx_urbs < 1) 
+               n_rx_urbs = AX_RX_URBS_DEFAULT;
 
        ret = usb_register(&ax8817x_driver);
        if (ret < 0) {

Reply via email to