Here is a patch against the 2.5 patch I sent you.

* Removes the internal CRC32 routine
* fixes the ethtool GETDRVINFO things to be on par with the recent changes (use strlcpy, and usb_make_path)
* A few additional cases on the callbacks to handle disconnects on other controllers
* Sane defaults for rx_buffers instead of bombing out


Ethtool/mii routines still are not working properly on 2.5
Plan to implement URB queueing on tx and rx at some point.
Index: ax8817x.c
===================================================================
RCS file: /home/dhollis/cvsroot/ax8817x/2.5/ax8817x.c,v
retrieving revision 1.8
retrieving revision 1.11
diff -u -r1.8 -r1.11
--- ax8817x.c   12 Jun 2003 13:02:44 -0000      1.8
+++ ax8817x.c   15 Jun 2003 19:00:02 -0000      1.11
@@ -1,7 +1,7 @@
 /*
  * ASIX AX8817x USB 2.0 10/100/HomePNA Ethernet controller driver
  *
- * $Id: ax8817x.c,v 1.8 2003/06/12 13:02:44 dhollis Exp $
+ * $Id: ax8817x.c,v 1.11 2003/06/15 19:00:02 dhollis Exp $
  *
  * Copyright (c) 2002-2003 TiVo Inc.
  *
@@ -10,6 +10,12 @@
  *
  * History 
  *
+ *     2003-06-15 - Dave Hollis <[EMAIL PROTECTED]>  2.0.0
+ *             * Remove crc32 inline function, use core kernel instead
+ *             * Set sane defaults for rx_buffers
+ *             * Fix ethtool GETDRVINFO bits - use strlcpy and
+ *               usb_make_path
+ *
  *     2003-06-05 - Dave Hollis <[EMAIL PROTECTED]>  0.10.0
  *             * Port to 2.5 series kernels
  *             * Remove #if 0 blocks that are confirmed
@@ -58,29 +64,10 @@
 #include <linux/ethtool.h>
 #include <linux/skbuff.h>
 #include <linux/mii.h>
+#include <linux/crc32.h>
 #include <asm/uaccess.h>
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,70)
-#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 "v2.0.0"
 #define DRIVER_AUTHOR "TiVo, Inc."
@@ -127,7 +114,9 @@
 
 #define AX_MAX_PHY_RETRY            50
 
-static int n_rx_urbs = 2;
+#define AX_RX_URBS_DEFAULT         2
+
+static int n_rx_urbs = AX_RX_URBS_DEFAULT;
 
 MODULE_PARM(n_rx_urbs, "i");
 MODULE_PARM_DESC(n_rx_urbs,
@@ -624,7 +613,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;
@@ -960,7 +952,6 @@
 {
        struct ax8817x_info *ax_info;
        int cmd;
-       char tmp[128];
 
        ax_info = net->priv;
        if (get_user(cmd, (int *) uaddr))
@@ -970,13 +961,11 @@
        case ETHTOOL_GDRVINFO:{
                        struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
 
-                       strncpy(info.driver, DRIVER_NAME,
+                       strlcpy(info.driver, DRIVER_NAME,
                                ETHTOOL_BUSINFO_LEN);
-                       strncpy(info.version, DRIVER_VERSION,
+                       strlcpy(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;
@@ -1330,10 +1319,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