]> git.neil.brown.name Git - history.git/commitdiff
[netdrvr sk98lin] small fixes
authorMirko Lindner <mlindner@syskonnect.de>
Thu, 25 Sep 2003 15:52:18 +0000 (11:52 -0400)
committerStephen Hemminger <shemminger@osdl.org>
Thu, 25 Sep 2003 15:52:18 +0000 (11:52 -0400)
Patch 3/5 (Update to version 6.17)
* Add: Removed SkNumber and SkDoDiv
* Add: Counter output as (unsigned long long)

drivers/net/sk98lin/skproc.c

index 7252b5b5434b0ce3c3619d997ffdea0c0ca2565d..6e826976c61448e15194f144a34fe1efcfc46f4a 100644 (file)
@@ -2,8 +2,8 @@
  *
  * Name:    skproc.c
  * Project:    GEnesis, PCI Gigabit Ethernet Adapter
- * Version:    $Revision: 1.8 $
- * Date:    $Date: 2003/06/27 14:41:42 $
+ * Version:    $Revision: 1.2 $
+ * Date:    $Date: 2003/08/12 16:45:29 $
  * Purpose:    Funktions to display statictic data
  *
  ******************************************************************************/
  * History:
  *
  *     $Log: skproc.c,v $
+ *     Revision 1.2  2003/08/12 16:45:29  mlindner
+ *     Add: Removed SkNumber and SkDoDiv
+ *     Add: Counter output as (unsigned long long)
+ *     
+ *     Revision 1.1  2003/07/18 13:39:57  rroesler
+ *     Fix: Re-enter after CVS crash
+ *     
  *     Revision 1.8  2003/06/27 14:41:42  rroesler
  *     Corrected compiler-warning kernel 2.2
  *     
 
 #include "h/skdrv1st.h"
 #include "h/skdrv2nd.h"
-#define ZEROPAD                1               /* pad with zero */
-#define SIGN           2               /* unsigned/signed long */
-#define PLUS           4               /* show plus */
-#define SPACE          8               /* space if plus */
-#define LEFT           16              /* left justified */
-#define SPECIALX       32              /* 0x */
-#define LARGE          64
 
        extern struct net_device        *SkGeRootDev;
 
-extern char * SkNumber(
-                               char * str,
-                               long long num,
-                               int base,
-                               int size,
-                               int precision,
-                               int type);
 
 int sk_proc_read(char *buffer,
                                char **buffer_location,
@@ -137,7 +130,6 @@ void *data)
        int i;
        DEV_NET                                 *pNet;
        SK_AC                                   *pAC;
-       char                                    test_buf[100];
        char                                    sens_msg[50];
        unsigned long                   Flags;  
        unsigned int                    Size;
@@ -247,13 +239,11 @@ void *data)
                                "\nReceive statistics\n\n");
 
                                len += sprintf(buffer + len,
-                                       "Received bytes                 %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxOctetsOkCts,
-                                       10,0,-1,0));
+                                       "Received bytes                 %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxOctetsOkCts);
                                len += sprintf(buffer + len,
-                                       "Received packets               %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxOkCts,
-                                       10,0,-1,0));
+                                       "Received packets               %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxOkCts);
 #if 0
                                if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC && 
                                        pAC->HWRevision < 12) {
@@ -267,71 +257,56 @@ void *data)
                                                pPnmiStat->StatRxTooLongCts;
 
                                len += sprintf(buffer + len,
-                                       "Receive errors                 %s\n",
-                                       SkNumber(test_buf, pPnmiStruct->InErrorsCts,
-                                       10,0,-1,0));
+                                       "Receive errors                 %Ld\n",
+                                       (unsigned long long) pPnmiStruct->InErrorsCts);
                                len += sprintf(buffer + len,
-                                       "Receive dropped                %s\n",
-                                       SkNumber(test_buf, pPnmiStruct->RxNoBufCts,
-                                       10,0,-1,0));
+                                       "Receive dropped                %Ld\n",
+                                       (unsigned long long) pPnmiStruct->RxNoBufCts);
                                len += sprintf(buffer + len,
-                                       "Received multicast             %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxMulticastOkCts,
-                                       10,0,-1,0));
+                                       "Received multicast             %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxMulticastOkCts);
                                len += sprintf(buffer + len,
                                        "Receive error types\n");
                                len += sprintf(buffer + len,
-                                       "   length                      %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxRuntCts,
-                                       10, 0, -1, 0));
+                                       "   length                      %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxRuntCts);
                                len += sprintf(buffer + len,
-                                       "   buffer overflow             %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxFifoOverflowCts,
-                                       10, 0, -1, 0));
+                                       "   buffer overflow             %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxFifoOverflowCts);
                                len += sprintf(buffer + len,
-                                       "   bad crc                     %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxFcsCts,
-                                       10, 0, -1, 0));
+                                       "   bad crc                     %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxFcsCts);
                                len += sprintf(buffer + len,
-                                       "   framing                     %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxFramingCts,
-                                       10, 0, -1, 0));
+                                       "   framing                     %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxFramingCts);
                                len += sprintf(buffer + len,
-                                       "   missed frames               %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxMissedCts,
-                                       10, 0, -1, 0));
+                                       "   missed frames               %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxMissedCts);
 
                                if (pNet->Mtu > 1500)
                                        pPnmiStat->StatRxTooLongCts = 0;
 
                                len += sprintf(buffer + len,
-                                       "   too long                    %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxTooLongCts,
-                                       10, 0, -1, 0));                                 
+                                       "   too long                    %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxTooLongCts);                                      
                                len += sprintf(buffer + len,
-                                       "   carrier extension           %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxCextCts,
-                                       10, 0, -1, 0));                         
+                                       "   carrier extension           %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxCextCts);                         
                                len += sprintf(buffer + len,
-                                       "   too short                   %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxShortsCts,
-                                       10, 0, -1, 0));                         
+                                       "   too short                   %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxShortsCts);                               
                                len += sprintf(buffer + len,
-                                       "   symbol                      %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxSymbolCts,
-                                       10, 0, -1, 0));                         
+                                       "   symbol                      %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxSymbolCts);                               
                                len += sprintf(buffer + len,
-                                       "   LLC MAC size                %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxIRLengthCts,
-                                       10, 0, -1, 0));                         
+                                       "   LLC MAC size                %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxIRLengthCts);                             
                                len += sprintf(buffer + len,
-                                       "   carrier event               %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxCarrierCts,
-                                       10, 0, -1, 0));                         
+                                       "   carrier event               %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxCarrierCts);                              
                                len += sprintf(buffer + len,
-                                       "   jabber                      %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatRxJabberCts,
-                                       10, 0, -1, 0));                         
+                                       "   jabber                      %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatRxJabberCts);                               
 
 
                                /*Transmit statistics */
@@ -339,42 +314,34 @@ void *data)
                                "\nTransmit statistics\n\n");
                                
                                len += sprintf(buffer + len,
-                                       "Transmited bytes               %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatTxOctetsOkCts,
-                                       10,0,-1,0));
+                                       "Transmited bytes               %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatTxOctetsOkCts);
                                len += sprintf(buffer + len,
-                                       "Transmited packets             %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatTxOkCts,
-                                       10,0,-1,0));
+                                       "Transmited packets             %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatTxOkCts);
                                len += sprintf(buffer + len,
-                                       "Transmit errors                %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatTxSingleCollisionCts,
-                                       10,0,-1,0));
+                                       "Transmit errors                %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
                                len += sprintf(buffer + len,
-                                       "Transmit dropped               %s\n",
-                                       SkNumber(test_buf, pPnmiStruct->TxNoBufCts,
-                                       10,0,-1,0));
+                                       "Transmit dropped               %Ld\n",
+                                       (unsigned long long) pPnmiStruct->TxNoBufCts);
                                len += sprintf(buffer + len,
-                                       "Transmit collisions            %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatTxSingleCollisionCts,
-                                       10,0,-1,0));
+                                       "Transmit collisions            %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
                                len += sprintf(buffer + len,
                                        "Transmit error types\n");
                                len += sprintf(buffer + len,
                                        "   excessive collision         %ld\n",
                                        pAC->stats.tx_aborted_errors);
                                len += sprintf(buffer + len,
-                                       "   carrier                     %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatTxCarrierCts,
-                                       10, 0, -1, 0));
+                                       "   carrier                     %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatTxCarrierCts);
                                len += sprintf(buffer + len,
-                                       "   fifo underrun               %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatTxFifoUnderrunCts,
-                                       10, 0, -1, 0));
+                                       "   fifo underrun               %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatTxFifoUnderrunCts);
                                len += sprintf(buffer + len,
-                                       "   heartbeat                   %s\n",
-                                       SkNumber(test_buf, pPnmiStat->StatTxCarrierCts,
-                                       10, 0, -1, 0));
+                                       "   heartbeat                   %Ld\n",
+                                       (unsigned long long) pPnmiStat->StatTxCarrierCts);
                                len += sprintf(buffer + len,
                                        "   window                      %ld\n",
                                        pAC->stats.tx_window_errors);
@@ -396,139 +363,3 @@ void *data)
 }
 
 
-
-
-
-/*****************************************************************************
- *
- * SkDoDiv - convert 64bit number
- *
- * Description:
- *     This function "converts" a long long number.
- *
- * Returns:
- *     remainder of division
- */
-static long SkDoDiv (long long Dividend, int Divisor, long long *pErg)
-{
- long          Rest;
- long long     Ergebnis;
- long          Akku;
-
-
- Akku  = Dividend >> 32;
-
- Ergebnis = ((long long) (Akku / Divisor)) << 32;
- Rest = Akku % Divisor ;
-
- Akku = Rest << 16;
- Akku |= ((Dividend & 0xFFFF0000) >> 16);
-
-
- Ergebnis += ((long long) (Akku / Divisor)) << 16;
- Rest = Akku % Divisor ;
-
- Akku = Rest << 16;
- Akku |= (Dividend & 0xFFFF);
-
- Ergebnis += (Akku / Divisor);
- Rest = Akku % Divisor ;
-
- *pErg = Ergebnis;
- return (Rest);
-}
-
-
-#if 0
-#define do_div(n,base) ({ \
-long long __res; \
-__res = ((unsigned long long) n) % (unsigned) base; \
-n = ((unsigned long long) n) / (unsigned) base; \
-__res; })
-
-#endif
-
-
-/*****************************************************************************
- *
- * SkNumber - Print results
- *
- * Description:
- *     This function converts a long long number into a string.
- *
- * Returns:
- *     number as string
- */
-char * SkNumber(char * str, long long num, int base, int size, int precision
-       ,int type)
-{
-       char c,sign,tmp[66], *strorg = str;
-       const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
-       int i;
-
-       if (type & LARGE)
-               digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-       if (type & LEFT)
-               type &= ~ZEROPAD;
-       if (base < 2 || base > 36)
-               return 0;
-       c = (type & ZEROPAD) ? '0' : ' ';
-       sign = 0;
-       if (type & SIGN) {
-               if (num < 0) {
-                       sign = '-';
-                       num = -num;
-                       size--;
-               } else if (type & PLUS) {
-                       sign = '+';
-                       size--;
-               } else if (type & SPACE) {
-                       sign = ' ';
-                       size--;
-               }
-       }
-       if (type & SPECIALX) {
-               if (base == 16)
-                       size -= 2;
-               else if (base == 8)
-                       size--;
-       }
-       i = 0;
-       if (num == 0)
-               tmp[i++]='0';
-       else while (num != 0)
-               tmp[i++] = digits[SkDoDiv(num,base, &num)];
-
-       if (i > precision)
-               precision = i;
-       size -= precision;
-       if (!(type&(ZEROPAD+LEFT)))
-               while(size-->0)
-                       *str++ = ' ';
-       if (sign)
-               *str++ = sign;
-       if (type & SPECIALX) {
-               if (base==8)
-                       *str++ = '0';
-               else if (base==16) {
-                       *str++ = '0';
-                       *str++ = digits[33];
-               }
-       }
-       if (!(type & LEFT))
-               while (size-- > 0)
-                       *str++ = c;
-       while (i < precision--)
-               *str++ = '0';
-       while (i-- > 0)
-               *str++ = tmp[i];
-       while (size-- > 0)
-               *str++ = ' ';
-       
-       str[0] = '\0';
-       
-       return strorg;
-}
-
-
-