patch-pre2.0.5 linux/drivers/net/sdla.c

Next file: linux/drivers/scsi/BusLogic.c
Previous file: linux/drivers/net/fmv18x.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file pre2.0.4/linux/drivers/net/sdla.c linux/drivers/net/sdla.c
@@ -5,7 +5,7 @@
  *
  *		Global definitions for the Frame relay interface.
  *
- * Version:	@(#)sdla.c   0.20	13 Apr 1996
+ * Version:	@(#)sdla.c   0.25	14 May 1996
  *
  * Credits:	Sangoma Technologies, for the use of 2 cards for an extended
  *			period of time.
@@ -20,7 +20,9 @@
  *		0.15	Mike McLagan	Improved error handling, packet dropping
  *		0.20	Mike McLagan	New transmit/receive flags for config
  *					If in FR mode, don't accept packets from
- *					non-DLCI devices.
+ *					non DLCI devices.
+ *		0.25	Mike McLagan	Fixed problem with rejecting packets
+ *					from non DLCI devices.
  *
  *
  *		This program is free software; you can redistribute it and/or
@@ -56,7 +58,7 @@
 
 #include <linux/sdla.h>
 
-static const char* version = "SDLA driver v0.20, 13 Apr 1996, mike.mclagan@linux.org";
+static const char* version = "SDLA driver v0.25, 14 May 1996, mike.mclagan@linux.org";
 
 static const char* devname = "sdla";
 
@@ -327,7 +329,7 @@
    struct _dlci_stat *pstatus;
    short             *pdlci;
    int               i;
-   char              *state;
+   char              *state, line[30];
 
    switch (ret)
    {
@@ -364,8 +366,10 @@
                   if (pstatus->flags & SDLA_DLCI_ACTIVE)
                      state = "active";
                   else
-                     state = "unknown status";
- 
+                  {
+                     sprintf(line, "uknown status: %02X", pstatus->flags);
+                     state = line;
+                  }
             printk(KERN_INFO "%s: DLCI %i: %s.\n", dev->name, pstatus->dlci, state);
 /* same here */
          }
@@ -637,13 +641,14 @@
 static int sdla_transmit(struct sk_buff *skb, struct device *dev)
 {
    struct frad_local *flp;
-   int               ret, addr;
+   int               ret, addr, accept;
    short             size;
    unsigned long     flags;
    struct buf_entry  *pbuf;
 
    flp = dev->priv;
    ret = 0;
+   accept = 1;
 
    if (dev->tbusy) 
       return(1);
@@ -655,75 +660,77 @@
       printk(KERN_WARNING "%s: transmitter access conflict.\n", dev->name);
    else
    {
- 
       /*
        * stupid GateD insists on setting up the multicast router thru us
        * and we're ill equipped to handle a non Frame Relay packet at this
        * time!
        */
 
+      accept = 1;
       switch (dev->type)
       {
          case ARPHRD_FRAD:
             if (skb->dev->type != ARPHRD_DLCI)
             {
-               printk(KERN_WARNING "%s: FRAD module accepts packets from DLCI ONLY!\n", dev->name);
-               dev_kfree_skb(skb, FREE_WRITE);
-               return(0);
+               printk(KERN_WARNING "%s: Non DLCI device, type %i, tried to send on FRAD module.\n", dev->name, skb->dev->type);
+               accept = 0;
             }
             break;
 
          default:
             printk(KERN_WARNING "%s: unknown firmware type 0x%4.4X\n", dev->name, dev->type);
-            dev_kfree_skb(skb, FREE_WRITE);
-            return(0);
-      }
-
-      /* this is frame specific, but till there's a PPP module, it's the default */
-      switch (flp->type)
-      {
-         case SDLA_S502A:
-         case SDLA_S502E:
-            ret = sdla_cmd(dev, SDLA_INFORMATION_WRITE, *(short *)(skb->dev->dev_addr), 0, skb->data, skb->len, NULL, NULL);
-            break;
-
-         case SDLA_S508:
-            size = sizeof(addr);
-            ret = sdla_cmd(dev, SDLA_INFORMATION_WRITE, *(short *)(skb->dev->dev_addr), 0, NULL, skb->len, &addr, &size);
-            if (ret == SDLA_RET_OK)
-            {
-               save_flags(flags); 
-               cli();
-               SDLA_WINDOW(dev, addr);
-               pbuf = (void *)(((int) dev->mem_start) + (addr & SDLA_ADDR_MASK));
-
-               sdla_write(dev, pbuf->buf_addr, skb->data, skb->len);
-
-               SDLA_WINDOW(dev, addr);
-               pbuf->opp_flag = 1;
-               restore_flags(flags);
-            }
+            accept = 0;
             break;
       }
- 
-      switch (ret)
+
+      if (accept)
       {
-         case SDLA_RET_OK:
-            flp->stats.tx_packets++;
-            ret = DLCI_RET_OK;
-            break;
- 
-         case SDLA_RET_CIR_OVERFLOW:
-         case SDLA_RET_BUF_OVERSIZE:
-         case SDLA_RET_NO_BUFS:
-            flp->stats.tx_dropped++;
-            ret = DLCI_RET_DROP;
-            break;
+         /* this is frame specific, but till there's a PPP module, it's the default */
+         switch (flp->type)
+         {
+            case SDLA_S502A:
+            case SDLA_S502E:
+               ret = sdla_cmd(dev, SDLA_INFORMATION_WRITE, *(short *)(skb->dev->dev_addr), 0, skb->data, skb->len, NULL, NULL);
+               break;
+
+            case SDLA_S508:
+               size = sizeof(addr);
+               ret = sdla_cmd(dev, SDLA_INFORMATION_WRITE, *(short *)(skb->dev->dev_addr), 0, NULL, skb->len, &addr, &size);
+               if (ret == SDLA_RET_OK)
+               {
+                  save_flags(flags); 
+                  cli();
+                  SDLA_WINDOW(dev, addr);
+                  pbuf = (void *)(((int) dev->mem_start) + (addr & SDLA_ADDR_MASK));
+
+                  sdla_write(dev, pbuf->buf_addr, skb->data, skb->len);
+
+                  SDLA_WINDOW(dev, addr);
+                  pbuf->opp_flag = 1;
+                  restore_flags(flags);
+               }
+               break;
+         }
 
-         default:
-            flp->stats.tx_errors++;
-            ret = DLCI_RET_ERR;
-            break;
+         switch (ret)
+         {
+            case SDLA_RET_OK:
+               flp->stats.tx_packets++;
+               ret = DLCI_RET_OK;
+               break;
+
+            case SDLA_RET_CIR_OVERFLOW:
+            case SDLA_RET_BUF_OVERSIZE:
+            case SDLA_RET_NO_BUFS:
+               flp->stats.tx_dropped++;
+               ret = DLCI_RET_DROP;
+               break;
+
+            default:
+               flp->stats.tx_errors++;
+               ret = DLCI_RET_ERR;
+               break;
+         }
       }
       dev->tbusy = 0;
    }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this