Re: converting fore200e driver to use request_firmware()

2008-02-07 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],David Miller writes:
 however, i ran into a little problem with the sbus interface.  what should
 i pass for 'struct device *' for an sbus device?

sdev-ofdev.dev should work

thanks!  that is what i needed.  so what i have works on pci and is
quite a bit cleaner than the current mess for the firmware.  the only
iffy part is the conversion of the struct fore_200e to a struct device
which is depends your bus.  perhaps it should be a seperate routine.

any comments on the following?

diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
index 1c7ae30..a5303ee 100644
--- a/drivers/atm/Kconfig
+++ b/drivers/atm/Kconfig
@@ -325,81 +325,21 @@ config ATM_IA_DEBUG
  speed of the driver, and the size of your syslog files! When
  inactive, they will have only a modest impact on performance.
 
-config ATM_FORE200E_MAYBE
+config ATM_FORE200E
tristate FORE Systems 200E-series
-   depends on PCI || SBUS
+   depends on (PCI || SBUS)
---help---
  This is a driver for the FORE Systems 200E-series ATM adapter
  cards. It simultaneously supports PCA-200E and SBA-200E models
  on PCI and SBUS hosts. Say Y (or M to compile as a module
  named fore_200e) here if you have one of these ATM adapters.
 
- Note that the driver will actually be compiled only if you
- additionally enable the support for PCA-200E and/or SBA-200E
- cards.
-
  See the file file:Documentation/networking/fore200e.txt for
  further details.
 
-config ATM_FORE200E_PCA
-   bool PCA-200E support
-   depends on ATM_FORE200E_MAYBE  PCI
-   help
- Say Y here if you want your PCA-200E cards to be probed.
-
-config ATM_FORE200E_PCA_DEFAULT_FW
-   bool Use default PCA-200E firmware (normally enabled)
-   depends on ATM_FORE200E_PCA
-   help
- Use the default PCA-200E firmware data shipped with the driver.
-
- Normal users do not have to deal with the firmware stuff, so
- they should say Y here.
-
-config ATM_FORE200E_PCA_FW
-   string Pathname of user-supplied binary firmware
-   depends on ATM_FORE200E_PCA  !ATM_FORE200E_PCA_DEFAULT_FW
-   default 
-   help
- This defines the pathname of an alternative PCA-200E binary
- firmware image supplied by the user. This pathname may be
- absolute or relative to the drivers/atm directory.
-
- The driver comes with an adequate firmware image, so normal users do
- not have to supply an alternative one. They just say Y to Use
- default PCA-200E firmware instead.
-
-config ATM_FORE200E_SBA
-   bool SBA-200E support
-   depends on ATM_FORE200E_MAYBE  SBUS
-   help
- Say Y here if you want your SBA-200E cards to be probed.
-
-config ATM_FORE200E_SBA_DEFAULT_FW
-   bool Use default SBA-200E firmware (normally enabled)
-   depends on ATM_FORE200E_SBA
-   help
- Use the default SBA-200E firmware data shipped with the driver.
-
- Normal users do not have to deal with the firmware stuff, so
- they should say Y here.
-
-config ATM_FORE200E_SBA_FW
-   string Pathname of user-supplied binary firmware
-   depends on ATM_FORE200E_SBA  !ATM_FORE200E_SBA_DEFAULT_FW
-   default 
-   help
- This defines the pathname of an alternative SBA-200E binary
- firmware image supplied by the user. This pathname may be
- absolute or relative to the drivers/atm directory.
-
- The driver comes with an adequate firmware image, so normal users do
- not have to supply an alternative one. They just say Y to Use
- default SBA-200E firmware, above.
-
 config ATM_FORE200E_USE_TASKLET
bool Defer interrupt work to a tasklet
-   depends on (PCI || SBUS)  (ATM_FORE200E_PCA || ATM_FORE200E_SBA)
+   depends on ATM_FORE200E
default n
help
  This defers work to be done by the interrupt handler to a
@@ -408,7 +348,7 @@ config ATM_FORE200E_USE_TASKLET
 
 config ATM_FORE200E_TX_RETRY
int Maximum number of tx retries
-   depends on (PCI || SBUS)  (ATM_FORE200E_PCA || ATM_FORE200E_SBA)
+   depends on ATM_FORE200E
default 16
---help---
  Specifies the number of times the driver attempts to transmit
@@ -425,7 +365,7 @@ config ATM_FORE200E_TX_RETRY
 
 config ATM_FORE200E_DEBUG
int Debugging level (0-3)
-   depends on (PCI || SBUS)  (ATM_FORE200E_PCA || ATM_FORE200E_SBA)
+   depends on ATM_FORE200E
default 0
help
  Specifies the level of debugging messages issued by the driver.
@@ -436,12 +376,6 @@ config ATM_FORE200E_DEBUG
  the performances of the driver, and the size of your syslog files!
  Keep the debugging level to 0 during normal operations.
 
-config ATM_FORE200E
-   tristate
-   depends on (PCI || SBUS)  (ATM_FORE200E_PCA || ATM_FORE200E_SBA)
-   

converting fore200e driver to use request_firmware()

2008-02-06 Thread chas williams - CONTRACTOR
however, i ran into a little problem with the sbus interface.  what should
i pass for 'struct device *' for an sbus device?
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-2.6.25 4/7][ATM]: [br2864] routed support

2008-01-30 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Chung-
Chi Lo writes:
 +   } else { /* vc-mux */
 +   if (brdev-payload == p_routed) {

add line

   skb-protocol = __constant_htons(ETH_P_IP);

here just like LLC did?

 +   skb_reset_network_header(skb);
 +   skb-pkt_type = PACKET_HOST;

yes, that is missing but it needs to be a little more complicated than
that i think.  you need to examine the first byte to see if its an
ipv4 or ipv6 datagram.  something like:

struct iphdr *iph = skb_network_header(skb);

skb_reset_network_header(skb);
iph = skb_network_header(skb);
if (iph-version == 4)
skb-protocol = __constant_htons(ETH_P_IP);
else if (iph-version == 6)
skb-protocol = __constant_htons(ETH_P_IPV6);
else
/* drop the packet */
skb-pkt_type = PACKET_HOST;

how does that look?

+   } else {
+   skb_push(skb, 2);
+   if (brdev-payload == p_bridged)
+   memset(skb-data, 0, 2);
+   }

Here should be

   } else {
   if (brdev-payload == p_bridged) {
   skb_push(skb, 2);
   memset(skb-data, 0, 2);
   }
   }

Because VCMUX and routed mode doesn't need two bytes in header.

yeah, another oversight.  your fix is correct. i bet you have guessed
that we dont use vc multiplexing.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-2.6.25 4/7][ATM]: [br2864] routed support

2008-01-26 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Chung-
Chi Lo writes:
Question to decode the encaps=VCMUX and bridge mode:

This line
skb_pull((skb, BR2684_PAD_LEN + ETH_HLEN);
should be replaced by
skb_pull((skb, BR2684_PAD_LEN);

you are correct.

By the way, this routed mode patch doesn't include encaps=VCMUX and
RFC2684 routed
protocol decapsulation?

yep.  eric believes the following should fix both problems:

commit 43e4b025ffe130cd6a292fa9ff909e39a88f849c
Author: Chas Williams - CONTRACTOR [EMAIL PROTECTED]
Date:   Sat Jan 26 07:18:26 2008 -0500

[ATM]: [br2864] fix vcmux support

From: Eric Kinzie [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 31347cb..97b422c 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -400,15 +400,20 @@ static void br2684_push(struct atm_vcc *atmvcc, struct 
sk_buff *skb)
return;
}
 
-   } else {
-   /* first 2 chars should be 0 */
-   if (*((u16 *) (skb-data)) != 0) {
-   brdev-stats.rx_errors++;
-   dev_kfree_skb(skb);
-   return;
+   } else { /* vc-mux */
+   if (brdev-payload == p_routed) {
+   skb_reset_network_header(skb);
+   skb-pkt_type = PACKET_HOST;
+   } else { /* p_bridged */
+   /* first 2 chars should be 0 */
+   if (*((u16 *) (skb-data)) != 0) {
+   brdev-stats.rx_errors++;
+   dev_kfree_skb(skb);
+   return;
+   }
+   skb_pull(skb, BR2684_PAD_LEN);
+   skb-protocol = eth_type_trans(skb, net_dev);
}
-   skb_pull(skb, BR2684_PAD_LEN + ETH_HLEN);   /* pad, dstmac, 
srcmac, ethtype */
-   skb-protocol = eth_type_trans(skb, net_dev);
}
 
 #ifdef CONFIG_ATM_BR2684_IPFILTER
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-2.6.24][ATM]: [nicstar] delay irq setup until card is configured

2008-01-04 Thread chas williams - CONTRACTOR
if an interrupt occurs too soon, the driver oops while trying to handle
a shortage of buffers condition (caused by no buffers having been
allocated yet).

commit a3322d3d34854edf27f7950efaa93e68f5f71ace
Author: Chas Williams - CONTRACTOR [EMAIL PROTECTED]
Date:   Fri Jan 4 16:27:07 2008 -0500

[ATM]: [nicstar] delay irq setup until card is configured

Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 14ced85..0c205b0 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -625,14 +625,6 @@ static int __devinit ns_init_card(int i, struct pci_dev 
*pcidev)
if (mac[i] == NULL)
   nicstar_init_eprom(card-membase);
 
-   if (request_irq(pcidev-irq, ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, 
nicstar, card) != 0)
-   {
-  printk(nicstar%d: can't allocate IRQ %d.\n, i, pcidev-irq);
-  error = 9;
-  ns_init_card_error(card, error);
-  return error;
-   }
-
/* Set the VPI/VCI MSb mask to zero so we can receive OAM cells */
writel(0x, card-membase + VPM);
   
@@ -858,8 +850,6 @@ static int __devinit ns_init_card(int i, struct pci_dev 
*pcidev)
   card-iovpool.count++;
}
 
-   card-intcnt = 0;
-
/* Configure NICStAR */
if (card-rct_size == 4096)
   ns_cfg_rctsize = NS_CFG_RCTSIZE_4096_ENTRIES;
@@ -868,6 +858,15 @@ static int __devinit ns_init_card(int i, struct pci_dev 
*pcidev)
 
card-efbie = 1;
 
+   card-intcnt = 0;
+   if (request_irq(pcidev-irq, ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, 
nicstar, card) != 0)
+   {
+  printk(nicstar%d: can't allocate IRQ %d.\n, i, pcidev-irq);
+  error = 9;
+  ns_init_card_error(card, error);
+  return error;
+   }
+
/* Register device */
card-atmdev = atm_dev_register(nicstar, atm_ops, -1, NULL);
if (card-atmdev == NULL)
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-2.6.25 5/7][ATM]: [br2864] whitespace cleanup

2007-12-29 Thread chas williams - CONTRACTOR
commit 6b11f93a718dc916198feb1099ae0cef39ce3936
Author: Chas Williams [EMAIL PROTECTED]
Date:   Sat Oct 27 08:33:40 2007 -0400

[ATM]: [br2864] whitespace cleanup

Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h
index ccdab6c..52bf72a 100644
--- a/include/linux/atmbr2684.h
+++ b/include/linux/atmbr2684.h
@@ -15,7 +15,7 @@
 #define BR2684_MEDIA_802_6 (4) /* 802.6 */
 
/* used only at device creation:  */
-#define BR2684_FLAG_ROUTED (116) /* payload is routed, not bridged */
+#define BR2684_FLAG_ROUTED (116) /* payload is routed, not bridged */
 
 /*
  * Is there FCS inbound on this VC?  This currently isn't supported.
@@ -45,17 +45,16 @@
 #define BR2684_PAYLOAD_ROUTED   (0)
 #define BR2684_PAYLOAD_BRIDGED  (1)
 
-
 /*
  * This is for the ATM_NEWBACKENDIF call - these are like socket families:
  * the first element of the structure is the backend number and the rest
  * is per-backend specific
  */
 struct atm_newif_br2684 {
-   atm_backend_t   backend_num;/* ATM_BACKEND_BR2684 */
-   int media;  /* BR2684_MEDIA_*, flags in upper bits 
*/
-   charifname[IFNAMSIZ];
-   int mtu;
+   atm_backend_t backend_num;  /* ATM_BACKEND_BR2684 */
+   int media;  /* BR2684_MEDIA_*, flags in upper bits */
+   char ifname[IFNAMSIZ];
+   int mtu;
 };
 
 /*
@@ -66,10 +65,10 @@ struct atm_newif_br2684 {
 #define BR2684_FIND_BYNUM  (1)
 #define BR2684_FIND_BYIFNAME   (2)
 struct br2684_if_spec {
-   int method; /* BR2684_FIND_* */
+   int method; /* BR2684_FIND_* */
union {
-   charifname[IFNAMSIZ];
-   int devnum;
+   char ifname[IFNAMSIZ];
+   int devnum;
} spec;
 };
 
@@ -79,16 +78,16 @@ struct br2684_if_spec {
  * is per-backend specific
  */
 struct atm_backend_br2684 {
-   atm_backend_t   backend_num;/* ATM_BACKEND_BR2684 */
+   atm_backend_t backend_num;  /* ATM_BACKEND_BR2684 */
struct br2684_if_spec ifspec;
-   int fcs_in; /* BR2684_FCSIN_* */
-   int fcs_out;/* BR2684_FCSOUT_* */
-   int fcs_auto;   /* 1: fcs_{in,out} disabled if no FCS rx'ed */
-   int encaps; /* BR2684_ENCAPS_* */
-   int has_vpiid;  /* 1: use vpn_id - Unsupported */
-   __u8vpn_id[7];
-   int send_padding;   /* unsupported */
-   int min_size;   /* we will pad smaller packets than this */
+   int fcs_in; /* BR2684_FCSIN_* */
+   int fcs_out;/* BR2684_FCSOUT_* */
+   int fcs_auto;   /* 1: fcs_{in,out} disabled if no FCS rx'ed */
+   int encaps; /* BR2684_ENCAPS_* */
+   int has_vpiid;  /* 1: use vpn_id - Unsupported */
+   __u8 vpn_id[7];
+   int send_padding;   /* unsupported */
+   int min_size;   /* we will pad smaller packets than this */
 };
 
 /*
@@ -97,8 +96,8 @@ struct atm_backend_br2684 {
  * efficient per-if in/out filters, this support will be removed
  */
 struct br2684_filter {
-   __be32  prefix; /* network byte order */
-   __be32  netmask;/* 0 = disable filter */
+   __be32 prefix;  /* network byte order */
+   __be32 netmask; /* 0 = disable filter */
 };
 
 struct br2684_filter_set {
@@ -107,8 +106,8 @@ struct br2684_filter_set {
 };
 
 enum br2684_payload {
-p_routed = BR2684_PAYLOAD_ROUTED,
-p_bridged = BR2684_PAYLOAD_BRIDGED,
+   p_routed = BR2684_PAYLOAD_ROUTED,
+   p_bridged = BR2684_PAYLOAD_BRIDGED,
 };
 
 #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index d9bb2a1..f5a3794 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -1,9 +1,10 @@
 /*
-Ethernet netdevice using ATM AAL5 as underlying carrier
-(RFC1483 obsoleted by RFC2684) for Linux
-Authors: Marcell GAL, 2000, XDSL Ltd, Hungary
- Eric Kinzie, 2006-2007, US Naval Research Laboratory
-*/
+ * Ethernet netdevice using ATM AAL5 as underlying carrier
+ * (RFC1483 obsoleted by RFC2684) for Linux
+ *
+ * Authors: Marcell GAL, 2000, XDSL Ltd, Hungary
+ *  Eric Kinzie, 2006-2007, US Naval Research Laboratory
+ */
 
 #include linux/module.h
 #include linux/init.h
@@ -51,28 +52,24 @@ static void skb_debug(const struct sk_buff *skb)
 #define ETHERTYPE_IPV6 0x86, 0xdd
 #define PAD_BRIDGED0x00, 0x00
 
-static unsigned char ethertype_ipv4[] =
-   { ETHERTYPE_IPV4 };
-static unsigned char ethertype_ipv6[] =
-   { ETHERTYPE_IPV6 };
+static unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 };
+static unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 };
 static unsigned char llc_oui_pid_pad[] =
-   { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED };

[PATCH net-2.6.25 7/7][ATM]: [he] fixing compilation when you define USE_RBPS_POOL/USE_RBPL_POOL

2007-12-29 Thread chas williams - CONTRACTOR
commit 62024377f1da8a3f5b49cfd60d892c778f5a5741
Author: Jorge Boncompte [EMAIL PROTECTED]
Date:   Thu Dec 13 16:14:40 2007 -0500

[ATM]: [he] fixing compilation when you define USE_RBPS_POOL/USE_RBPL_POOL

Signed-off-by: Jorge Boncompte [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 3b64a99..20df4bb 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1643,6 +1643,8 @@ he_stop(struct he_dev *he_dev)
 
if (he_dev-rbpl_base) {
 #ifdef USE_RBPL_POOL
+   int i;
+
for (i = 0; i  CONFIG_RBPL_SIZE; ++i) {
void *cpuaddr = he_dev-rbpl_virt[i].virt;
dma_addr_t dma_handle = he_dev-rbpl_base[i].phys;
@@ -1665,6 +1667,8 @@ he_stop(struct he_dev *he_dev)
 #ifdef USE_RBPS
if (he_dev-rbps_base) {
 #ifdef USE_RBPS_POOL
+   int i;
+
for (i = 0; i  CONFIG_RBPS_SIZE; ++i) {
void *cpuaddr = he_dev-rbps_virt[i].virt;
dma_addr_t dma_handle = he_dev-rbps_base[i].phys;
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] atm/ambassador: kmalloc + memset conversion to kzalloc

2007-11-27 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Rober
t P. J. Day writes:
  in any event, i just thought i'd point it out.  if you're absolutely
  sure there will never be another call to setup_dev() from somewhere
  else, then, yes, it's safe.

 I understood your opinions. and partially agree with you.
 But isn't it a unfounded fear?

i don't know, i just thought i'd mention it.  if no one thinks it's an
issue, it's certainly fine with me.

its very unlikely that setup_dev() is likely to be called from another
code path.  this patch looks fine to me.  i will take it and get it
submitted on the next merge.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1][ATM]: [he] initialize lock and tasklet earlier

2007-11-26 Thread chas williams - CONTRACTOR
if you are lucky (unlucky?) enough to have shared interrupts, the
interrupt handler can be called before the tasklet and lock are ready
for use.

commit 44b3e82778b0edf73147529c8b1c115d241a6a4d
Author: chas williams - CONTRACTOR [EMAIL PROTECTED]
Date:   Mon Nov 26 11:30:33 2007 -0500

[ATM]: [he] initialize lock and tasklet earlier

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index d33aba6..3b64a99 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -394,6 +394,11 @@ he_init_one(struct pci_dev *pci_dev, const struct 
pci_device_id *pci_ent)
he_dev-atm_dev-dev_data = he_dev;
atm_dev-dev_data = he_dev;
he_dev-number = atm_dev-number;
+#ifdef USE_TASKLET
+   tasklet_init(he_dev-tasklet, he_tasklet, (unsigned long) he_dev);
+#endif
+   spin_lock_init(he_dev-global_lock);
+
if (he_start(atm_dev)) {
he_stop(he_dev);
err = -ENODEV;
@@ -1173,11 +1178,6 @@ he_start(struct atm_dev *dev)
if ((err = he_init_irq(he_dev)) != 0)
return err;
 
-#ifdef USE_TASKLET
-   tasklet_init(he_dev-tasklet, he_tasklet, (unsigned long) he_dev);
-#endif
-   spin_lock_init(he_dev-global_lock);
-
/* 4.11 enable pci bus controller state machines */
host_cntl |= (OUTFF_ENB | CMDFF_ENB |
QUICK_RD_RETRY | QUICK_WR_RETRY | PERR_INT_ENB);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5][ATM]: [br2864] whitespace cleanup

2007-10-27 Thread chas williams - CONTRACTOR
commit 6b11f93a718dc916198feb1099ae0cef39ce3936
Author: Chas Williams [EMAIL PROTECTED]
Date:   Sat Oct 27 08:33:40 2007 -0400

[ATM]: [br2864] whitespace cleanup

Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h
index ccdab6c..52bf72a 100644
--- a/include/linux/atmbr2684.h
+++ b/include/linux/atmbr2684.h
@@ -15,7 +15,7 @@
 #define BR2684_MEDIA_802_6 (4) /* 802.6 */
 
/* used only at device creation:  */
-#define BR2684_FLAG_ROUTED (116) /* payload is routed, not bridged */
+#define BR2684_FLAG_ROUTED (116) /* payload is routed, not bridged */
 
 /*
  * Is there FCS inbound on this VC?  This currently isn't supported.
@@ -45,17 +45,16 @@
 #define BR2684_PAYLOAD_ROUTED   (0)
 #define BR2684_PAYLOAD_BRIDGED  (1)
 
-
 /*
  * This is for the ATM_NEWBACKENDIF call - these are like socket families:
  * the first element of the structure is the backend number and the rest
  * is per-backend specific
  */
 struct atm_newif_br2684 {
-   atm_backend_t   backend_num;/* ATM_BACKEND_BR2684 */
-   int media;  /* BR2684_MEDIA_*, flags in upper bits 
*/
-   charifname[IFNAMSIZ];
-   int mtu;
+   atm_backend_t backend_num;  /* ATM_BACKEND_BR2684 */
+   int media;  /* BR2684_MEDIA_*, flags in upper bits */
+   char ifname[IFNAMSIZ];
+   int mtu;
 };
 
 /*
@@ -66,10 +65,10 @@ struct atm_newif_br2684 {
 #define BR2684_FIND_BYNUM  (1)
 #define BR2684_FIND_BYIFNAME   (2)
 struct br2684_if_spec {
-   int method; /* BR2684_FIND_* */
+   int method; /* BR2684_FIND_* */
union {
-   charifname[IFNAMSIZ];
-   int devnum;
+   char ifname[IFNAMSIZ];
+   int devnum;
} spec;
 };
 
@@ -79,16 +78,16 @@ struct br2684_if_spec {
  * is per-backend specific
  */
 struct atm_backend_br2684 {
-   atm_backend_t   backend_num;/* ATM_BACKEND_BR2684 */
+   atm_backend_t backend_num;  /* ATM_BACKEND_BR2684 */
struct br2684_if_spec ifspec;
-   int fcs_in; /* BR2684_FCSIN_* */
-   int fcs_out;/* BR2684_FCSOUT_* */
-   int fcs_auto;   /* 1: fcs_{in,out} disabled if no FCS rx'ed */
-   int encaps; /* BR2684_ENCAPS_* */
-   int has_vpiid;  /* 1: use vpn_id - Unsupported */
-   __u8vpn_id[7];
-   int send_padding;   /* unsupported */
-   int min_size;   /* we will pad smaller packets than this */
+   int fcs_in; /* BR2684_FCSIN_* */
+   int fcs_out;/* BR2684_FCSOUT_* */
+   int fcs_auto;   /* 1: fcs_{in,out} disabled if no FCS rx'ed */
+   int encaps; /* BR2684_ENCAPS_* */
+   int has_vpiid;  /* 1: use vpn_id - Unsupported */
+   __u8 vpn_id[7];
+   int send_padding;   /* unsupported */
+   int min_size;   /* we will pad smaller packets than this */
 };
 
 /*
@@ -97,8 +96,8 @@ struct atm_backend_br2684 {
  * efficient per-if in/out filters, this support will be removed
  */
 struct br2684_filter {
-   __be32  prefix; /* network byte order */
-   __be32  netmask;/* 0 = disable filter */
+   __be32 prefix;  /* network byte order */
+   __be32 netmask; /* 0 = disable filter */
 };
 
 struct br2684_filter_set {
@@ -107,8 +106,8 @@ struct br2684_filter_set {
 };
 
 enum br2684_payload {
-p_routed = BR2684_PAYLOAD_ROUTED,
-p_bridged = BR2684_PAYLOAD_BRIDGED,
+   p_routed = BR2684_PAYLOAD_ROUTED,
+   p_bridged = BR2684_PAYLOAD_BRIDGED,
 };
 
 #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index d9bb2a1..f5a3794 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -1,9 +1,10 @@
 /*
-Ethernet netdevice using ATM AAL5 as underlying carrier
-(RFC1483 obsoleted by RFC2684) for Linux
-Authors: Marcell GAL, 2000, XDSL Ltd, Hungary
- Eric Kinzie, 2006-2007, US Naval Research Laboratory
-*/
+ * Ethernet netdevice using ATM AAL5 as underlying carrier
+ * (RFC1483 obsoleted by RFC2684) for Linux
+ *
+ * Authors: Marcell GAL, 2000, XDSL Ltd, Hungary
+ *  Eric Kinzie, 2006-2007, US Naval Research Laboratory
+ */
 
 #include linux/module.h
 #include linux/init.h
@@ -51,28 +52,24 @@ static void skb_debug(const struct sk_buff *skb)
 #define ETHERTYPE_IPV6 0x86, 0xdd
 #define PAD_BRIDGED0x00, 0x00
 
-static unsigned char ethertype_ipv4[] =
-   { ETHERTYPE_IPV4 };
-static unsigned char ethertype_ipv6[] =
-   { ETHERTYPE_IPV6 };
+static unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 };
+static unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 };
 static unsigned char llc_oui_pid_pad[] =
-   { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED };

[PATCH 3/5][ATM]: [he] This patch removes the ancient version string.

2007-10-27 Thread chas williams - CONTRACTOR
commit 41d6b7e20dd6d57bec4f14697f654c8211ff5d57
Author: Adrian Bunk [EMAIL PROTECTED]
Date:   Fri Oct 26 07:29:47 2007 -0400

[ATM]: [he] This patch removes the ancient version string.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index d33aba6..4f1c7e6 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1,5 +1,3 @@
-/* $Id: he.c,v 1.18 2003/05/06 22:57:15 chas Exp $ */
-
 /*
 
   he.c
@@ -99,10 +97,6 @@
 #define HPRINTK(fmt,args...)   do { } while (0)
 #endif /* HE_DEBUG */
 
-/* version definition */
-
-static char *version = $Id: he.c,v 1.18 2003/05/06 22:57:15 chas Exp $;
-
 /* declarations */
 
 static int he_open(struct atm_vcc *vcc);
@@ -366,7 +360,7 @@ he_init_one(struct pci_dev *pci_dev, const struct 
pci_device_id *pci_ent)
struct he_dev *he_dev = NULL;
int err = 0;
 
-   printk(KERN_INFO he: %s\n, version);
+   printk(KERN_INFO ATM he driver\n);
 
if (pci_enable_device(pci_dev))
return -EIO;
@@ -2933,7 +2927,7 @@ he_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 
left = *pos;
if (!left--)
-   return sprintf(page, %s\n, version);
+   return sprintf(page, ATM he driver\n);
 
if (!left--)
return sprintf(page, %s%s\n\n,
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5][ATM]: atm is no longer experimental

2007-10-27 Thread chas williams - CONTRACTOR
commit f57512af6142cf14bd15012c4c627f9ebef0582a
Author: Robert P. J. Day [EMAIL PROTECTED]
Date:   Fri Oct 26 07:27:07 2007 -0400

[ATM]: atm is no longer experimental

From: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/net/atm/Kconfig b/net/atm/Kconfig
index 21ff276..754ea10 100644
--- a/net/atm/Kconfig
+++ b/net/atm/Kconfig
@@ -1,10 +1,9 @@
 #
-# Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)
+# Asynchronous Transfer Mode (ATM)
 #
 
 config ATM
-   tristate Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)
-   depends on EXPERIMENTAL
+   tristate Asynchronous Transfer Mode (ATM)
---help---
  ATM is a high-speed networking technology for Local Area Networks
  and Wide Area Networks.  It uses a fixed packet size and is
@@ -20,7 +19,7 @@ config ATM
  further details.
 
 config ATM_CLIP
-   tristate Classical IP over ATM (EXPERIMENTAL)
+   tristate Classical IP over ATM
depends on ATM  INET
help
  Classical IP over ATM for PVCs and SVCs, supporting InARP and
@@ -29,7 +28,7 @@ config ATM_CLIP
  (LANE) below.
 
 config ATM_CLIP_NO_ICMP
-   bool Do NOT send ICMP if no neighbour (EXPERIMENTAL)
+   bool Do NOT send ICMP if no neighbour
depends on ATM_CLIP
help
  Normally, an ICMP host unreachable message is sent if a neighbour
@@ -39,7 +38,7 @@ config ATM_CLIP_NO_ICMP
  such neighbours are silently discarded instead.
 
 config ATM_LANE
-   tristate LAN Emulation (LANE) support (EXPERIMENTAL)
+   tristate LAN Emulation (LANE) support
depends on ATM
help
  LAN Emulation emulates services of existing LANs across an ATM
@@ -48,7 +47,7 @@ config ATM_LANE
  ELAN and Ethernet segments. You need LANE if you want to try MPOA.
 
 config ATM_MPOA
-   tristate Multi-Protocol Over ATM (MPOA) support (EXPERIMENTAL)
+   tristate Multi-Protocol Over ATM (MPOA) support
depends on ATM  INET  ATM_LANE!=n
help
  Multi-Protocol Over ATM allows ATM edge devices such as routers,
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5][ATM]: Convert struct class_device to struct device

2007-10-27 Thread chas williams - CONTRACTOR
commit 03c544e08cfe22f0c8a952c0aed1265917dca469
Author: Kay Sievers [EMAIL PROTECTED]
Date:   Fri Oct 26 07:28:29 2007 -0400

[ATM]: Convert struct class_device to struct device

Signed-off-by: Kay Sievers [EMAIL PROTECTED]
Cc: Tony Jones [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
index 9ef07ed..1b88311 100644
--- a/net/atm/atm_sysfs.c
+++ b/net/atm/atm_sysfs.c
@@ -9,13 +9,15 @@
 
 #define to_atm_dev(cldev) container_of(cldev, struct atm_dev, class_dev)
 
-static ssize_t show_type(struct class_device *cdev, char *buf)
+static ssize_t show_type(struct device *cdev,
+struct device_attribute *attr, char *buf)
 {
struct atm_dev *adev = to_atm_dev(cdev);
return sprintf(buf, %s\n, adev-type);
 }
 
-static ssize_t show_address(struct class_device *cdev, char *buf)
+static ssize_t show_address(struct device *cdev,
+   struct device_attribute *attr, char *buf)
 {
char *pos = buf;
struct atm_dev *adev = to_atm_dev(cdev);
@@ -28,7 +30,8 @@ static ssize_t show_address(struct class_device *cdev, char 
*buf)
return pos - buf;
 }
 
-static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
+static ssize_t show_atmaddress(struct device *cdev,
+  struct device_attribute *attr, char *buf)
 {
unsigned long flags;
char *pos = buf;
@@ -54,7 +57,8 @@ static ssize_t show_atmaddress(struct class_device *cdev, 
char *buf)
return pos - buf;
 }
 
-static ssize_t show_carrier(struct class_device *cdev, char *buf)
+static ssize_t show_carrier(struct device *cdev,
+   struct device_attribute *attr, char *buf)
 {
char *pos = buf;
struct atm_dev *adev = to_atm_dev(cdev);
@@ -65,7 +69,8 @@ static ssize_t show_carrier(struct class_device *cdev, char 
*buf)
return pos - buf;
 }
 
-static ssize_t show_link_rate(struct class_device *cdev, char *buf)
+static ssize_t show_link_rate(struct device *cdev,
+ struct device_attribute *attr, char *buf)
 {
char *pos = buf;
struct atm_dev *adev = to_atm_dev(cdev);
@@ -90,22 +95,23 @@ static ssize_t show_link_rate(struct class_device *cdev, 
char *buf)
return pos - buf;
 }
 
-static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
-static CLASS_DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
-static CLASS_DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
-static CLASS_DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
-static CLASS_DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
-
-static struct class_device_attribute *atm_attrs[] = {
-   class_device_attr_atmaddress,
-   class_device_attr_address,
-   class_device_attr_carrier,
-   class_device_attr_type,
-   class_device_attr_link_rate,
+static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
+static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
+static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
+static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
+static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
+
+static struct device_attribute *atm_attrs[] = {
+   dev_attr_atmaddress,
+   dev_attr_address,
+   dev_attr_carrier,
+   dev_attr_type,
+   dev_attr_link_rate,
NULL
 };
 
-static int atm_uevent(struct class_device *cdev, struct kobj_uevent_env *env)
+
+static int atm_uevent(struct device *cdev, struct kobj_uevent_env *env)
 {
struct atm_dev *adev;
 
@@ -122,7 +128,7 @@ static int atm_uevent(struct class_device *cdev, struct 
kobj_uevent_env *env)
return 0;
 }
 
-static void atm_release(struct class_device *cdev)
+static void atm_release(struct device *cdev)
 {
struct atm_dev *adev = to_atm_dev(cdev);
 
@@ -131,25 +137,25 @@ static void atm_release(struct class_device *cdev)
 
 static struct class atm_class = {
.name   = atm,
-   .release= atm_release,
-   .uevent = atm_uevent,
+   .dev_release= atm_release,
+   .dev_uevent = atm_uevent,
 };
 
 int atm_register_sysfs(struct atm_dev *adev)
 {
-   struct class_device *cdev = adev-class_dev;
+   struct device *cdev = adev-class_dev;
int i, j, err;
 
cdev-class = atm_class;
-   class_set_devdata(cdev, adev);
+   dev_set_drvdata(cdev, adev);
 
-   snprintf(cdev-class_id, BUS_ID_SIZE, %s%d, adev-type, adev-number);
-   err = class_device_register(cdev);
+   snprintf(cdev-bus_id, BUS_ID_SIZE, %s%d, adev-type, adev-number);
+   err = device_register(cdev);
if (err  0)
return err;
 
for (i = 0; atm_attrs[i]; i++) {
-   err = class_device_create_file(cdev, atm_attrs[i]);
+   err = device_create_file(cdev, atm_attrs[i]);
 

[PATCH 4/5][ATM]: [br2864] routed support

2007-10-27 Thread chas williams - CONTRACTOR
commit fea6b121bcc150fc91186e5012466c91944ce64d
Author: Eric Kinzie [EMAIL PROTECTED]
Date:   Fri Oct 26 08:05:08 2007 -0400

[ATM]: [br2864] routed support

From: Eric Kinzie [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h
index 969fb6c..ccdab6c 100644
--- a/include/linux/atmbr2684.h
+++ b/include/linux/atmbr2684.h
@@ -14,6 +14,9 @@
 #define BR2684_MEDIA_FDDI  (3)
 #define BR2684_MEDIA_802_6 (4) /* 802.6 */
 
+   /* used only at device creation:  */
+#define BR2684_FLAG_ROUTED (116) /* payload is routed, not bridged */
+
 /*
  * Is there FCS inbound on this VC?  This currently isn't supported.
  */
@@ -36,13 +39,21 @@
 #define BR2684_ENCAPS_AUTODETECT (2)   /* Unsuported */
 
 /*
+ * Is this VC bridged or routed?
+ */
+
+#define BR2684_PAYLOAD_ROUTED   (0)
+#define BR2684_PAYLOAD_BRIDGED  (1)
+
+
+/*
  * This is for the ATM_NEWBACKENDIF call - these are like socket families:
  * the first element of the structure is the backend number and the rest
  * is per-backend specific
  */
 struct atm_newif_br2684 {
atm_backend_t   backend_num;/* ATM_BACKEND_BR2684 */
-   int media;  /* BR2684_MEDIA_* */
+   int media;  /* BR2684_MEDIA_*, flags in upper bits 
*/
charifname[IFNAMSIZ];
int mtu;
 };
@@ -95,6 +106,11 @@ struct br2684_filter_set {
struct br2684_filter filter;
 };
 
+enum br2684_payload {
+p_routed = BR2684_PAYLOAD_ROUTED,
+p_bridged = BR2684_PAYLOAD_BRIDGED,
+};
+
 #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
struct br2684_filter_set)
 
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 2096e5c..a3d07c2 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -359,7 +359,7 @@ struct atm_dev {
struct proc_dir_entry *proc_entry; /* proc entry */
char *proc_name;/* proc entry name */
 #endif
-   struct class_device class_dev;  /* sysfs class device */
+   struct device class_dev;/* sysfs device */
struct list_head dev_list;  /* linkage */
 };
 
@@ -461,7 +461,7 @@ static inline void atm_dev_put(struct atm_dev *dev)
BUG_ON(!test_bit(ATM_DF_REMOVED, dev-flags));
if (dev-ops-dev_close)
dev-ops-dev_close(dev);
-   class_device_put(dev-class_dev);
+   put_device(dev-class_dev);
}
 }
 
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index ba6428f..d9bb2a1 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -1,7 +1,8 @@
 /*
-Experimental ethernet netdevice using ATM AAL5 as underlying carrier
-(RFC1483 obsoleted by RFC2684) for Linux 2.4
-Author: Marcell GAL, 2000, XDSL Ltd, Hungary
+Ethernet netdevice using ATM AAL5 as underlying carrier
+(RFC1483 obsoleted by RFC2684) for Linux
+Authors: Marcell GAL, 2000, XDSL Ltd, Hungary
+ Eric Kinzie, 2006-2007, US Naval Research Laboratory
 */
 
 #include linux/module.h
@@ -39,9 +40,27 @@ static void skb_debug(const struct sk_buff *skb)
 #define skb_debug(skb) do {} while (0)
 #endif
 
+#define BR2684_ETHERTYPE_LEN   2
+#define BR2684_PAD_LEN 2
+
+#define LLC0xaa, 0xaa, 0x03
+#define SNAP_BRIDGED   0x00, 0x80, 0xc2
+#define SNAP_ROUTED0x00, 0x00, 0x00
+#define PID_ETHERNET   0x00, 0x07
+#define ETHERTYPE_IPV4 0x08, 0x00
+#define ETHERTYPE_IPV6 0x86, 0xdd
+#define PAD_BRIDGED0x00, 0x00
+
+static unsigned char ethertype_ipv4[] =
+   { ETHERTYPE_IPV4 };
+static unsigned char ethertype_ipv6[] =
+   { ETHERTYPE_IPV6 };
 static unsigned char llc_oui_pid_pad[] =
-{ 0xAA, 0xAA, 0x03, 0x00, 0x80, 0xC2, 0x00, 0x07, 0x00, 0x00 };
-#define PADLEN (2)
+   { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED };
+static unsigned char llc_oui_ipv4[] =
+   { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 };
+static unsigned char llc_oui_ipv6[] =
+   { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 };
 
 enum br2684_encaps {
e_vc  = BR2684_ENCAPS_VC,
@@ -69,6 +88,7 @@ struct br2684_dev {
struct list_head brvccs; /* one device = one vcc (before xmas) */
struct net_device_stats stats;
int mac_was_set;
+   enum br2684_payload payload;
 };
 
 /*
@@ -136,6 +156,7 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct 
br2684_dev *brdev,
 {
struct atm_vcc *atmvcc;
int minheadroom = (brvcc-encaps == e_llc) ? 10 : 2;
+
if (skb_headroom(skb)  minheadroom) {
struct sk_buff *skb2 = skb_realloc_headroom(skb, minheadroom);
brvcc-copies_needed++;
@@ -146,11 +167,32 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct 
br2684_dev *brdev,
}
skb = skb2;
}
-   skb_push(skb, minheadroom);
-   if (brvcc-encaps == e_llc)
-   

[PATCH 5/7][ATM]: [lanai] sram_test_word() must be __devinit

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: [lanai] sram_test_word() must be __devinit

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit 9b3515b17a74eff9aad7409dd64888cf0cd03d4d
tree 6b10b2df62cd24cfc86558c70ecc761e5bcaf724
parent b7560ad591d64544359766df2f2c687e9e65
author Adrian Bunk [EMAIL PROTECTED] Thu, 12 Jul 2007 11:17:16 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Thu, 12 Jul 2007 
11:17:16 -0400

 drivers/atm/lanai.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 4e1fa50..0ac201e 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -553,8 +553,8 @@ static inline void sram_write(const struct lanai_dev *lanai,
writel(val, sram_addr(lanai, offset));
 }
 
-static int __init sram_test_word(
-   const struct lanai_dev *lanai, int offset, u32 pattern)
+static int __devinit sram_test_word(const struct lanai_dev *lanai,
+   int offset, u32 pattern)
 {
u32 readback;
sram_write(lanai, pattern, offset);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/7][ATM]: [nicstar] Replace C code with call to ARRAY_SIZE() macro.

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: [nicstar] Replace C code with call to ARRAY_SIZE() macro.

Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit e9e4b3e9524fd445fcc06f56678a6b7f3d1d5f3a
tree 7edafbabdafaad229fb728c1c74e6bca60a0c58c
parent 6bab08f73e2c24665a523f15a4ebe4002be38a91
author Robert P. J. Day [EMAIL PROTECTED] Wed, 11 Jul 2007 12:23:43 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 11 Jul 2007 
12:23:43 -0400

 drivers/atm/nicstarmac.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/atm/nicstarmac.c b/drivers/atm/nicstarmac.c
index 480947f..842e26c 100644
--- a/drivers/atm/nicstarmac.c
+++ b/drivers/atm/nicstarmac.c
@@ -134,7 +134,7 @@ nicstar_read_eprom_status( virt_addr_t base )
/* Send read instruction */
val = NICSTAR_REG_READ( base, NICSTAR_REG_GENERAL_PURPOSE )  0xFFF0;
 
-   for (i=0; isizeof rdsrtab/sizeof rdsrtab[0]; i++)
+   for (i=0; iARRAY_SIZE(rdsrtab); i++)
{
NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE,
(val | rdsrtab[i]) );
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7][ATM]: Eliminate dead config variable CONFIG_BR2684_FAST_TRANS.

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: Eliminate dead config variable CONFIG_BR2684_FAST_TRANS.

From: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit 6bab08f73e2c24665a523f15a4ebe4002be38a91
tree 2c6d28e064934b097f37b3b766900b7bb77264b4
parent ffc2850a65ef863fe52650e5e1bc7ac3e098bbb8
author chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 11 Jul 2007 12:19:31 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 11 Jul 2007 
12:19:31 -0400

 net/atm/br2684.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index faa6aaf..c0f6861 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -460,11 +460,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct 
sk_buff *skb)
skb_pull(skb, plen);
skb_set_mac_header(skb, -ETH_HLEN);
skb-pkt_type = PACKET_HOST;
-#ifdef CONFIG_BR2684_FAST_TRANS
-   skb-protocol = ((u16 *) skb-data)[-1];
-#else  /* some protocols might require this: */
skb-protocol = br_type_trans(skb, net_dev);
-#endif /* CONFIG_BR2684_FAST_TRANS */
 #else
skb_pull(skb, plen - ETH_HLEN);
skb-protocol = eth_type_trans(skb, net_dev);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/7][ATM]: Replacing kmalloc/memset combination with kzalloc.

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: Replacing kmalloc/memset combination with kzalloc.

Signed-off-by: vignesh babu [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit ffc2850a65ef863fe52650e5e1bc7ac3e098bbb8
tree 1e66e6f29dbda236b826cfdd6ce1b053d15224d9
parent 99d24edeb6abc6ca3a0d0fbdb83c664c04403c8c
author vignesh babu [EMAIL PROTECTED] Wed, 11 Jul 2007 12:15:49 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 11 Jul 2007 
12:15:49 -0400

 net/sched/sch_atm.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 54b92d2..2df38bb 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -292,13 +292,12 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, 
u32 parent,
}
}
DPRINTK(atm_tc_change: new id %x\n,classid);
-   flow = kmalloc(sizeof(struct atm_flow_data)+hdr_len,GFP_KERNEL);
+   flow = kzalloc(sizeof(struct atm_flow_data)+hdr_len, GFP_KERNEL);
DPRINTK(atm_tc_change: flow %p\n,flow);
if (!flow) {
error = -ENOBUFS;
goto err_out;
}
-   memset(flow,0,sizeof(*flow));
flow-filter_list = NULL;
if (!(flow-q = qdisc_create_dflt(sch-dev,pfifo_qdisc_ops,classid)))
flow-q = noop_qdisc;
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/7][ATM]: [idt77252] Rename CONFIG_ATM_IDT77252_SEND_IDLE to not resemble a Kconfig variable

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: [idt77252] Rename CONFIG_ATM_IDT77252_SEND_IDLE to not resemble a 
Kconfig variable

Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit c6023af8babdaefc46d8ac7e3293f4bb87537422
tree f9aaecd241f8263b58caa6929f8b84002227c176
parent 15fa4d7e8fda822d42bc202fe390b52309ee9d86
author Robert P. J. Day [EMAIL PROTECTED] Thu, 12 Jul 2007 14:52:10 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Thu, 12 Jul 2007 
14:52:10 -0400

 drivers/atm/idt77252.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 3800bc0..ebd1b66 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -65,7 +65,7 @@ static char const rcsid[] =
 static unsigned int vpibits = 1;
 
 
-#define CONFIG_ATM_IDT77252_SEND_IDLE 1
+#define ATM_IDT77252_SEND_IDLE 1
 
 
 /*
@@ -3404,7 +3404,7 @@ init_card(struct atm_dev *dev)
conf =  SAR_CFG_TX_FIFO_SIZE_9 |/* Use maximum fifo size */
SAR_CFG_RXSTQ_SIZE_8k | /* Receive Status Queue is 8k */
SAR_CFG_IDLE_CLP |  /* Set CLP on idle cells */
-#ifndef CONFIG_ATM_IDT77252_SEND_IDLE
+#ifndef ATM_IDT77252_SEND_IDLE
SAR_CFG_NO_IDLE |   /* Do not send idle cells */
 #endif
0;
@@ -3541,7 +3541,7 @@ init_card(struct atm_dev *dev)
printk(%s: Linkrate on ATM line : %u bit/s, %u cell/s.\n,
   card-name, linkrate, card-link_pcr);
 
-#ifdef CONFIG_ATM_IDT77252_SEND_IDLE
+#ifdef ATM_IDT77252_SEND_IDLE
card-utopia_pcr = card-link_pcr;
 #else
card-utopia_pcr = (16000 / 8 / 54);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/7][ATM]: [lanai] change VENDOR to DEVICE

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: [lanai] change VENDOR to DEVICE

There were 2 bad named macros in pci_ids (LANAI 2 and IHB). Rename it to
DEVICE, because it's device id. Also some cleanup in the pci_device_id
table (use PCI_VDEVICE).

Cc: Mitchell Blank Jr [EMAIL PROTECTED]
Signed-off-by: Jiri Slaby [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit b7560ad591d64544359766df2f2c687e9e65
tree fc9f8bdd2bf0f16de90cf9576220cff586ce4d8b
parent e9e4b3e9524fd445fcc06f56678a6b7f3d1d5f3a
author Jiri Slaby [EMAIL PROTECTED] Wed, 11 Jul 2007 12:26:48 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 11 Jul 2007 
12:26:48 -0400

 drivers/atm/lanai.c |   14 --
 include/linux/pci_ids.h |4 ++--
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 09f477d..4e1fa50 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -246,8 +246,8 @@ struct lanai_vcc {
 };
 
 enum lanai_type {
-   lanai2  = PCI_VENDOR_ID_EF_ATM_LANAI2,
-   lanaihb = PCI_VENDOR_ID_EF_ATM_LANAIHB
+   lanai2  = PCI_DEVICE_ID_EF_ATM_LANAI2,
+   lanaihb = PCI_DEVICE_ID_EF_ATM_LANAIHB
 };
 
 struct lanai_dev_stats {
@@ -2631,14 +2631,8 @@ static int __devinit lanai_init_one(struct pci_dev *pci,
 }
 
 static struct pci_device_id lanai_pci_tbl[] = {
-   {
-   PCI_VENDOR_ID_EF, PCI_VENDOR_ID_EF_ATM_LANAI2,
-   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
-   },
-   {
-   PCI_VENDOR_ID_EF, PCI_VENDOR_ID_EF_ATM_LANAIHB,
-   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
-   },
+   { PCI_VDEVICE(EF, PCI_DEVICE_ID_EF_ATM_LANAI2) },
+   { PCI_VDEVICE(EF, PCI_DEVICE_ID_EF_ATM_LANAIHB) },
{ 0, }  /* terminal entry */
 };
 MODULE_DEVICE_TABLE(pci, lanai_pci_tbl);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 75c4d4d..a260a94 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1383,8 +1383,8 @@
 #define PCI_VENDOR_ID_EF   0x111a
 #define PCI_DEVICE_ID_EF_ATM_FPGA  0x
 #define PCI_DEVICE_ID_EF_ATM_ASIC  0x0002
-#define PCI_VENDOR_ID_EF_ATM_LANAI20x0003
-#define PCI_VENDOR_ID_EF_ATM_LANAIHB   0x0005
+#define PCI_DEVICE_ID_EF_ATM_LANAI20x0003
+#define PCI_DEVICE_ID_EF_ATM_LANAIHB   0x0005
 
 #define PCI_VENDOR_ID_IDT  0x111d
 #define PCI_DEVICE_ID_IDT_IDT77201 0x0001
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/7][ATM]: [drivers] ioremap balanced with iounmap

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: [drivers] ioremap balanced with iounmap

Signed-off-by: Amol Lad [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit 15fa4d7e8fda822d42bc202fe390b52309ee9d86
tree bb741ef4aba074d449f6199522f746a64c3ab244
parent 9b3515b17a74eff9aad7409dd64888cf0cd03d4d
author Amol Lad [EMAIL PROTECTED] Thu, 12 Jul 2007 14:47:50 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Thu, 12 Jul 2007 
14:47:50 -0400

 drivers/atm/eni.c|   19 +++
 drivers/atm/firestream.c |   14 +-
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 0d3a38b..0789528 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1745,7 +1745,8 @@ static int __devinit eni_do_init(struct atm_dev *dev)
printk(KERN_ERR KERN_ERR DEV_LABEL (itf %d): bad 
magic - expected 0x%x, got 0x%x\n,dev-number,
ENI155_MAGIC,(unsigned) readl(eprom-magic));
-   return -EINVAL;
+   error = -EINVAL;
+   goto unmap;
}
}
eni_dev-phy = base+PHY_BASE;
@@ -1772,17 +1773,27 @@ static int __devinit eni_do_init(struct atm_dev *dev)
printk()\n);
printk(KERN_ERR DEV_LABEL (itf %d): ERROR - wrong id 0x%x\n,
dev-number,(unsigned) eni_in(MID_RES_ID_MCON));
-   return -EINVAL;
+   error = -EINVAL;
+   goto unmap;
}
error = eni_dev-asic ? get_esi_asic(dev) : get_esi_fpga(dev,base);
-   if (error) return error;
+   if (error)
+   goto unmap;
for (i = 0; i  ESI_LEN; i++)
printk(%s%02X,i ? - : ,dev-esi[i]);
printk()\n);
printk(KERN_NOTICE DEV_LABEL (itf %d): %s,%s\n,dev-number,
eni_in(MID_RES_ID_MCON)  0x200 ? ASIC : FPGA,
media_name[eni_in(MID_RES_ID_MCON)  DAUGTHER_ID]);
-   return suni_init(dev);
+
+   error = suni_init(dev);
+   if (error)
+   goto unmap;
+out:
+   return error;
+unmap:
+   iounmap(base);
+   goto out;
 }
 
 
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 38b688f..737cea4 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1710,7 +1710,7 @@ static int __devinit fs_init (struct fs_dev *dev)
/* This bit is documented as RESERVED */
if (isr  ISR_INIT_ERR) {
printk (KERN_ERR Error initializing the FS... \n);
-   return 1;
+   goto unmap;
}
if (isr  ISR_INIT) {
fs_dprintk (FS_DEBUG_INIT, Ha! Initialized OK!\n);
@@ -1723,7 +1723,7 @@ static int __devinit fs_init (struct fs_dev *dev)
 
if (!to) {
printk (KERN_ERR timeout initializing the FS... \n);
-   return 1;
+   goto unmap;
}
 
/* XXX fix for fs155 */
@@ -1803,7 +1803,7 @@ static int __devinit fs_init (struct fs_dev *dev)
if (!dev-atm_vccs) {
printk (KERN_WARNING Couldn't allocate memory for VCC buffers. 
Woops!\n);
/* XXX Clean up. */
-   return 1;
+   goto unmap;
}
 
dev-tx_inuse = kzalloc (dev-nchannels / 8 /* bits/byte */ , 
GFP_KERNEL);
@@ -1813,7 +1813,7 @@ static int __devinit fs_init (struct fs_dev *dev)
if (!dev-tx_inuse) {
printk (KERN_WARNING Couldn't allocate memory for tx_inuse 
bits!\n);
/* XXX Clean up. */
-   return 1;
+   goto unmap;
}
/* -- RAS1 : FS155 and 50 differ. Default (0) should be OK for both */
/* -- RAS2 : FS50 only: Default is OK. */
@@ -1840,7 +1840,7 @@ static int __devinit fs_init (struct fs_dev *dev)
if (request_irq (dev-irq, fs_irq, IRQF_SHARED, firestream, dev)) {
printk (KERN_WARNING couldn't get irq %d for firestream.\n, 
pci_dev-irq);
/* XXX undo all previous stuff... */
-   return 1;
+   goto unmap;
}
fs_dprintk (FS_DEBUG_INIT, Grabbed irq %d for dev at %p.\n, dev-irq, 
dev);
   
@@ -1890,6 +1890,9 @@ static int __devinit fs_init (struct fs_dev *dev)
   
func_exit ();
return 0;
+unmap:
+   iounmap(dev-base);
+   return 1;
 }
 
 static int __devinit firestream_init_one (struct pci_dev *pci_dev,
@@ -2012,6 +2015,7 @@ static void __devexit firestream_remove_one (struct 
pci_dev *pdev)
for (i=0;i  FS_NR_RX_QUEUES;i++)
free_queue (dev, dev-rx_rq[i]);
 
+   iounmap(dev-base);
fs_dprintk (FS_DEBUG_ALLOC, Free fs-dev: %p\n, dev);
nxtdev = dev-next;
kfree (dev);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body

Re: [PATCH 4/7][ATM]: [lanai] change VENDOR to DEVICE

2007-07-16 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],David Miller writes:
Because of this and the sch_atm.c rejects, I guess you're
not generating these patches against Linus's current tree.

i was working against your net-2.6 tree.  i will checkout the linus tree
and check before submitting patches.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Introduce BROKEN_ON_64BIT facility

2006-10-02 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Jeff Garzik writes:
Several driver have been marked as dependent on CONFIG_32BIT in the
past, when they should really be dependent on this new
CONFIG_BROKEN_ON_64BIT option, because the 32BIT marker was due to bugs
rather than fundamentals.

some of the drivers in atm are already marked with !64BIT and some
need to be marked.  this might be more complete for drivers/atm/Kconfig:

diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
index cfa5af8..f4e0978 100644
--- a/drivers/atm/Kconfig
+++ b/drivers/atm/Kconfig
@@ -139,7 +139,7 @@ config ATM_ENI_BURST_RX_2W
 
 config ATM_FIRESTREAM
tristate Fujitsu FireStream (FS50/FS155) 
-   depends on PCI  ATM
+   depends on PCI  ATM  BROKEN_ON_64BIT
help
  Driver for the Fujitsu FireStream 155 (MB86697) and
  FireStream 50 (MB86695) ATM PCI chips.
@@ -149,7 +149,7 @@ config ATM_FIRESTREAM
 
 config ATM_ZATM
tristate ZeitNet ZN1221/ZN1225
-   depends on PCI  ATM
+   depends on PCI  ATM  BROKEN_ON_64BIT
help
  Driver for the ZeitNet ZN1221 (MMF) and ZN1225 (UTP-5) 155 Mbps ATM
  adapters.
@@ -173,7 +173,7 @@ #  bool '  Enable extended debugging
 #   fi
 config ATM_NICSTAR
tristate IDT 77201 (NICStAR) (ForeRunnerLE)
-   depends on PCI  ATM  !64BIT
+   depends on PCI  ATM  BROKEN_ON_64BIT
help
  The NICStAR chipset family is used in a large number of ATM NICs for
  25 and for 155 Mbps, including IDT cards and the Fore ForeRunnerLE
@@ -241,7 +241,7 @@ config ATM_IDT77252_USE_SUNI
 
 config ATM_AMBASSADOR
tristate Madge Ambassador (Collage PCI 155 Server)
-   depends on PCI  ATM
+   depends on PCI  ATM  BROKEN_ON_64BIT
help
  This is a driver for ATMizer based ATM card produced by Madge
  Networks Ltd. Say Y (or M to compile as a module named ambassador)
@@ -265,7 +265,7 @@ config ATM_AMBASSADOR_DEBUG
 
 config ATM_HORIZON
tristate Madge Horizon [Ultra] (Collage PCI 25 and Collage PCI 155 
Client)
-   depends on PCI  ATM
+   depends on PCI  ATM  BROKEN_ON_64BIT
help
  This is a driver for the Horizon chipset ATM adapter cards once
  produced by Madge Networks Ltd. Say Y (or M to compile as a module
@@ -289,7 +289,7 @@ config ATM_HORIZON_DEBUG
 
 config ATM_IA
tristate Interphase ATM PCI x575/x525/x531
-   depends on PCI  ATM  !64BIT
+   depends on PCI  ATM  BROKEN_ON_64BIT
---help---
  This is a driver for the Interphase (i)ChipSAR adapter cards
  which include a variety of variants in term of the size of the
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ATM bug found

2006-10-01 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Jeff Garzik writes:
If alloc_shaper() argument 'unlimited' is true, then pcr is never 
assigned a value.  However, the caller of alloc_shaper() always tests 
the pcr value, regardless of whether or not 'unlimited' is true.

when unlimited is true, this means ubr.  alloc_shaper() creates a queue
to use for all ubr (best effort) traffic.  ubr doesnt count against tx_bw
so its handled a bit differently.  alloc_shaper() should return a 0 for
the pcr since this gets assigned to the vcc's qos parameters.  min_pcr =
0 and max_pcr = 0 means best effort.

still generates a warning from gcc though.

[ATM]: [zatm] always *pcr in alloc_shaper()

Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index c491ec4..083c5d3 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -800,6 +800,7 @@ static int alloc_shaper(struct atm_dev *
i = m = 1;
zatm_dev-ubr_ref_cnt++;
zatm_dev-ubr = shaper;
+   *pcr = 0;
}
else {
if (min) {
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3][ATM]: kmalloc to kzalloc patches for drivers/atm

2006-10-01 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: kmalloc to kzalloc patches for drivers/atm

Signed-off-by: Om Narasimhan [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 339d365266211690a446773e3eb9d864637a71bb
tree d48530e7ba716797687d2831f0f5148cda4a999a
parent f69365e8b58c325546d2e090c9019737436e0712
author Om Narasimhan [EMAIL PROTECTED] Sat, 30 Sep 2006 22:00:22 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 30 Sep 2006 
22:00:22 -0400

 drivers/atm/adummy.c |6 ++
 drivers/atm/firestream.c |   12 +++-
 drivers/atm/he.c |4 +---
 drivers/atm/horizon.c|4 +---
 drivers/atm/idt77252.c   |   23 ++-
 drivers/atm/lanai.c  |8 +---
 drivers/atm/zatm.c   |6 ++
 7 files changed, 16 insertions(+), 47 deletions(-)

diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index 6cc93de..ac2c108 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -113,15 +113,13 @@ static int __init adummy_init(void)
 
printk(KERN_ERR adummy: version %s\n, DRV_VERSION);
 
-   adummy_dev = (struct adummy_dev *) kmalloc(sizeof(struct adummy_dev),
+   adummy_dev = kzalloc(sizeof(struct adummy_dev),
   GFP_KERNEL);
if (!adummy_dev) {
-   printk(KERN_ERR DEV_LABEL : kmalloc() failed\n);
+   printk(KERN_ERR DEV_LABEL : kzalloc() failed\n);
err = -ENOMEM;
goto out;
}
-   memset(adummy_dev, 0, sizeof(struct adummy_dev));
-
atm_dev = atm_dev_register(DEV_LABEL, adummy_ops, -1, NULL);
if (!atm_dev) {
printk(KERN_ERR DEV_LABEL : atm_dev_register() failed\n);
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 38fc054..7c75adf 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1784,7 +1784,7 @@ static int __devinit fs_init (struct fs_
write_fs (dev, RAM, (1  (28 - FS155_VPI_BITS - 
FS155_VCI_BITS)) - 1);
dev-nchannels = FS155_NR_CHANNELS;
}
-   dev-atm_vccs = kmalloc (dev-nchannels * sizeof (struct atm_vcc *), 
+   dev-atm_vccs = kcalloc (dev-nchannels, sizeof (struct atm_vcc *), 
 GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc atmvccs: %p(%Zd)\n,
dev-atm_vccs, dev-nchannels * sizeof (struct atm_vcc *));
@@ -1794,9 +1794,8 @@ static int __devinit fs_init (struct fs_
/* XXX Clean up. */
return 1;
}
-   memset (dev-atm_vccs, 0, dev-nchannels * sizeof (struct atm_vcc *));
 
-   dev-tx_inuse = kmalloc (dev-nchannels / 8 /* bits/byte */ , 
GFP_KERNEL);
+   dev-tx_inuse = kzalloc (dev-nchannels / 8 /* bits/byte */ , 
GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc tx_inuse: %p(%d)\n, 
dev-atm_vccs, dev-nchannels / 8);
 
@@ -1805,8 +1804,6 @@ static int __devinit fs_init (struct fs_
/* XXX Clean up. */
return 1;
}
-   memset (dev-tx_inuse, 0, dev-nchannels / 8);
-
/* -- RAS1 : FS155 and 50 differ. Default (0) should be OK for both */
/* -- RAS2 : FS50 only: Default is OK. */
 
@@ -1893,14 +1890,11 @@ static int __devinit firestream_init_one
if (pci_enable_device(pci_dev)) 
goto err_out;
 
-   fs_dev = kmalloc (sizeof (struct fs_dev), GFP_KERNEL);
+   fs_dev = kzalloc (sizeof (struct fs_dev), GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc fs-dev: %p(%Zd)\n,
fs_dev, sizeof (struct fs_dev));
if (!fs_dev)
goto err_out;
-
-   memset (fs_dev, 0, sizeof (struct fs_dev));
-  
atm_dev = atm_dev_register(fs, ops, -1, NULL);
if (!atm_dev)
goto err_out_free_fs_dev;
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index f2511b4..b22a914 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -383,14 +383,12 @@ he_init_one(struct pci_dev *pci_dev, con
}
pci_set_drvdata(pci_dev, atm_dev);
 
-   he_dev = (struct he_dev *) kmalloc(sizeof(struct he_dev),
+   he_dev = kzalloc(sizeof(struct he_dev),
GFP_KERNEL);
if (!he_dev) {
err = -ENOMEM;
goto init_one_failure;
}
-   memset(he_dev, 0, sizeof(struct he_dev));
-
he_dev-pci_dev = pci_dev;
he_dev-atm_dev = atm_dev;
he_dev-atm_dev-dev_data = he_dev;
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index d1113e8..209dba1 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -2719,7 +2719,7 @@ static int __devinit hrz_probe(struct pc
goto out_disable;
}
 
-   dev = kmalloc(sizeof(hrz_dev), GFP_KERNEL);
+   dev = kzalloc(sizeof(hrz_dev), GFP_KERNEL);
if (!dev) {
// perhaps we

[PATCH 2/3][ATM]: [ambassador] Change the return type to reflect reality

2006-10-01 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [ambassador] Change the return type to reflect reality

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit d7b1207f84d681df2e46c6f22ca153eb7f0944cb
tree 9204a7e7f6812bd683a0079a9a9177ec400fadbd
parent 339d365266211690a446773e3eb9d864637a71bb
author Jeff Garzik [EMAIL PROTECTED] Sun, 01 Oct 2006 10:23:44 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sun, 01 Oct 2006 
10:23:44 -0400

 drivers/atm/ambassador.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index 4521a24..da599e6 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -915,8 +915,8 @@ #endif
 
 /** make rate (not quite as much fun as Horizon) **/
 
-static unsigned int make_rate (unsigned int rate, rounding r,
-  u16 * bits, unsigned int * actual) {
+static int make_rate (unsigned int rate, rounding r,
+ u16 * bits, unsigned int * actual) {
   unsigned char exp = -1; // hush gcc
   unsigned int man = -1;  // hush gcc
   
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3][ATM]: [zatm] always *pcr in alloc_shaper()

2006-10-01 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [zatm] always *pcr in alloc_shaper()

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit ae0e261f74750f57c963349f5c09c8057d5eee32
tree 5e9358ef3fd7d00e3be7a1862afa62a6852c8cb6
parent d7b1207f84d681df2e46c6f22ca153eb7f0944cb
author chas williams - CONTRACTOR [EMAIL PROTECTED] Sun, 01 Oct 2006 11:14:19 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sun, 01 Oct 2006 
11:14:19 -0400

 drivers/atm/zatm.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index c491ec4..083c5d3 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -800,6 +800,7 @@ static int alloc_shaper(struct atm_dev *
i = m = 1;
zatm_dev-ubr_ref_cnt++;
zatm_dev-ubr = shaper;
+   *pcr = 0;
}
else {
if (min) {
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ATM bug found

2006-10-01 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Mitchell Blank Jr writes:
The fix is for alloc_shaper() should really do *pcr = ATM_MAX_PCR in
the if (ubr) stanza.  Chas, want to submit that in the next batch
of patches?

i dont think you can do that.  pcr gets assigned to .min_pcr and .min_pcr
= ATM_MAX_PCR has a different meaning.  it should probably be set to 0.
there is no minimum or maximum pcr for ubr.  you get what you get.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ATM firestream bug

2006-10-01 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Jeff Garzik writes:
1) not safe on 64-bit

firestream is not the only driver that's likely 32-bit safe only.
zatm, nicstar, horizon and ambassdor all use virt_to_bus().

2) variable 'tmc0' is indeed potentially used uninit'd, in particular if 
make_rate() returns an error (use occurs before error check).

i will fix this later.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/8][ATM]: [lec] header indent, comment and whitespace cleanup

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] header indent, comment and whitespace cleanup

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit ad9e9d30230b99dd41921b61a506c41e168e1a84
tree cc1e31605aaf3d473c4f3c8e26d9a1f9b98e72b7
parent 55300d040155e883eb8d3dd39d381c95080719e6
author chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 18:18:44 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 
18:18:44 -0400

 include/linux/atmlec.h |  119 ++---
 net/atm/lec.h  |  172 ++--
 net/atm/lec_arpc.h |  148 +
 3 files changed, 235 insertions(+), 204 deletions(-)

diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h
index f267f24..e7f1a75 100644
--- a/include/linux/atmlec.h
+++ b/include/linux/atmlec.h
@@ -1,9 +1,7 @@
 /*
- * 
- * ATM Lan Emulation Daemon vs. driver interface
- *
- * [EMAIL PROTECTED]
+ * ATM Lan Emulation Daemon driver interface
  *
+ * Marko Kiiskila [EMAIL PROTECTED]
  */
 
 #ifndef _ATMLEC_H_
@@ -13,76 +11,87 @@ #include linux/atmapi.h
 #include linux/atmioc.h
 #include linux/atm.h
 #include linux/if_ether.h
+
 /* ATM lec daemon control socket */
-#define ATMLEC_CTRL _IO('a',ATMIOC_LANE)
-#define ATMLEC_DATA _IO('a',ATMIOC_LANE+1)
-#define ATMLEC_MCAST _IO('a',ATMIOC_LANE+2)
+#define ATMLEC_CTRL_IO('a', ATMIOC_LANE)
+#define ATMLEC_DATA_IO('a', ATMIOC_LANE+1)
+#define ATMLEC_MCAST   _IO('a', ATMIOC_LANE+2)
 
 /* Maximum number of LEC interfaces (tweakable) */
 #define MAX_LEC_ITF 48
 
-/* From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
+/*
+ * From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
  * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for
  * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS.
  */
 #define NUM_TR_DEVS 8
 
-typedef enum { 
-l_set_mac_addr,   l_del_mac_addr, 
-l_svc_setup, 
-l_addr_delete,l_topology_change, 
-l_flush_complete, l_arp_update,
-l_narp_req, /* LANE2 mandates the use of this */
-l_config, l_flush_tran_id, 
-l_set_lecid,  l_arp_xmt,
-l_rdesc_arp_xmt,
-l_associate_req,
-l_should_bridge   /* should we bridge this MAC? */
+typedef enum {
+   l_set_mac_addr,
+   l_del_mac_addr,
+   l_svc_setup,
+   l_addr_delete,
+   l_topology_change,
+   l_flush_complete,
+   l_arp_update,
+   l_narp_req, /* LANE2 mandates the use of this */
+   l_config,
+   l_flush_tran_id,
+   l_set_lecid,
+   l_arp_xmt,
+   l_rdesc_arp_xmt,
+   l_associate_req,
+   l_should_bridge /* should we bridge this MAC? */
 } atmlec_msg_type;
 
 #define ATMLEC_MSG_TYPE_MAX l_should_bridge
 
 struct atmlec_config_msg {
-unsigned int maximum_unknown_frame_count;
-unsigned int max_unknown_frame_time;
-unsigned short max_retry_count;
-unsigned int aging_time;
-unsigned int forward_delay_time;
-unsigned int arp_response_time;
-unsigned int flush_timeout;
-unsigned int path_switching_delay;
-unsigned int  lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */
-int mtu;
-int is_proxy;
+   unsigned int maximum_unknown_frame_count;
+   unsigned int max_unknown_frame_time;
+   unsigned short max_retry_count;
+   unsigned int aging_time;
+   unsigned int forward_delay_time;
+   unsigned int arp_response_time;
+   unsigned int flush_timeout;
+   unsigned int path_switching_delay;
+   unsigned int lane_version;  /* LANE2: 1 for LANEv1, 2 for LANEv2 */
+   int mtu;
+   int is_proxy;
 };
- 
+
 struct atmlec_msg {
-atmlec_msg_type type;
-int sizeoftlvs;/* LANE2: if != 0, tlvs follow */ 
-union {
-struct {
-unsigned char mac_addr[ETH_ALEN];
-unsigned char atm_addr[ATM_ESA_LEN];
-unsigned int flag;/* Topology_change flag, 
-  remoteflag, permanent flag,
-  lecid, transaction id */
-unsigned int targetless_le_arp; /* LANE2 */
-unsigned int no_source_le_narp; /* LANE2 */
-} normal;
-struct atmlec_config_msg config;
-struct {
-uint16_t lec_id; /* requestor 
lec_id  */
-uint32_t tran_id;/* transaction id 
   */
-unsigned char mac_addr[ETH_ALEN];/* dst mac addr   
   */
-unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM 
addr */
-} proxy;
-/* For mapping LE_ARP

[PATCH 4/8][ATM]: [lec] convert lec_arp_table to hlist

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] convert lec_arp_table to hlist

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit cf14c654bcb812dae6ed85075777a19e1e02bee1
tree d01bc707baf050862e676e5609081ba1cc22aca1
parent ad9e9d30230b99dd41921b61a506c41e168e1a84
author chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 18:52:59 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 
18:52:59 -0400

 net/atm/lec.c  |  442 +++-
 net/atm/lec.h  |8 -
 net/atm/lec_arpc.h |2 
 3 files changed, 170 insertions(+), 282 deletions(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 13aeacf..87fb0c2 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -806,7 +806,7 @@ #endif
dev_kfree_skb(skb);
return;
}
-   if (priv-lec_arp_empty_ones) {
+   if (!hlist_empty(priv-lec_arp_empty_ones)) {
lec_arp_check_empties(priv, vcc, skb);
}
skb-dev = dev;
@@ -998,29 +998,32 @@ static void lec_info(struct seq_file *se
 struct lec_state {
unsigned long flags;
struct lec_priv *locked;
-   struct lec_arp_table *entry;
+   struct hlist_node *node;
struct net_device *dev;
int itf;
int arp_table;
int misc_table;
 };
 
-static void *lec_tbl_walk(struct lec_state *state, struct lec_arp_table *tbl,
+static void *lec_tbl_walk(struct lec_state *state, struct hlist_head *tbl,
  loff_t *l)
 {
-   struct lec_arp_table *e = state-entry;
+   struct hlist_node *e = state-node;
+   struct lec_arp_table *tmp;
 
if (!e)
-   e = tbl;
+   e = tbl-first;
if (e == (void *)1) {
-   e = tbl;
+   e = tbl-first;
--*l;
}
-   for (; e; e = e-next) {
+
+   hlist_for_each_entry_from(tmp, e, next) {
if (--*l  0)
break;
}
-   state-entry = e;
+   state-node = e;
+
return (*l  0) ? state : NULL;
 }
 
@@ -1031,7 +1034,7 @@ static void *lec_arp_walk(struct lec_sta
int p;
 
for (p = state-arp_table; p  LEC_ARP_TABLE_SIZE; p++) {
-   v = lec_tbl_walk(state, priv-lec_arp_tables[p], l);
+   v = lec_tbl_walk(state, priv-lec_arp_tables[p], l);
if (v)
break;
}
@@ -1042,10 +1045,10 @@ static void *lec_arp_walk(struct lec_sta
 static void *lec_misc_walk(struct lec_state *state, loff_t *l,
   struct lec_priv *priv)
 {
-   struct lec_arp_table *lec_misc_tables[] = {
-   priv-lec_arp_empty_ones,
-   priv-lec_no_forward,
-   priv-mcast_fwds
+   struct hlist_head *lec_misc_tables[] = {
+   priv-lec_arp_empty_ones,
+   priv-lec_no_forward,
+   priv-mcast_fwds
};
void *v = NULL;
int q;
@@ -1112,7 +1115,7 @@ static void *lec_seq_start(struct seq_fi
state-locked = NULL;
state-arp_table = 0;
state-misc_table = 0;
-   state-entry = (void *)1;
+   state-node = (void *)1;
 
return *pos ? lec_get_idx(state, *pos) : (void *)1;
 }
@@ -1148,9 +1151,10 @@ static int lec_seq_show(struct seq_file 
else {
struct lec_state *state = seq-private;
struct net_device *dev = state-dev;
+   struct lec_arp_table *entry = hlist_entry(state-node, struct 
lec_arp_table, next);
 
seq_printf(seq, %s , dev-name);
-   lec_info(seq, state-entry);
+   lec_info(seq, entry);
}
return 0;
 }
@@ -1455,8 +1459,11 @@ static void lec_arp_init(struct lec_priv
unsigned short i;
 
for (i = 0; i  LEC_ARP_TABLE_SIZE; i++) {
-   priv-lec_arp_tables[i] = NULL;
+   INIT_HLIST_HEAD(priv-lec_arp_tables[i]);
}
+INIT_HLIST_HEAD(priv-lec_arp_empty_ones);
+INIT_HLIST_HEAD(priv-lec_no_forward);
+INIT_HLIST_HEAD(priv-mcast_fwds);
spin_lock_init(priv-lec_arp_lock);
init_timer(priv-lec_arp_timer);
priv-lec_arp_timer.expires = jiffies + LEC_ARP_REFRESH_INTERVAL;
@@ -1479,7 +1486,7 @@ static void lec_arp_clear_vccs(struct le
vcc-user_back = NULL;
vcc-push = entry-old_push;
vcc_release_async(vcc, -EPIPE);
-   vcc = NULL;
+   entry-vcc = NULL;
}
if (entry-recv_vcc) {
entry-recv_vcc-push = entry-old_recv_push;
@@ -1493,27 +1500,17 @@ static void lec_arp_clear_vccs(struct le
  * LANE2: Add to the end of the list to satisfy 8.1.13
  */
 static inline void
-lec_arp_add(struct lec_priv *priv, struct lec_arp_table *to_add)
+lec_arp_add(struct lec_priv *priv, struct lec_arp_table *entry

[PATCH 5/8][ATM]: [lec] old_close is no longer used

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] old_close is no longer used

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 693b186c2a764f62e017db4b7ed39298831d99e8
tree d054ccd10917693803070634a21481b09361b126
parent cf14c654bcb812dae6ed85075777a19e1e02bee1
author chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 18:54:09 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 
18:54:09 -0400

 net/atm/lec_arpc.h |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/net/atm/lec_arpc.h b/net/atm/lec_arpc.h
index 3cc2eba..69aeb07 100644
--- a/net/atm/lec_arpc.h
+++ b/net/atm/lec_arpc.h
@@ -24,9 +24,6 @@ struct lec_arp_table {
void (*old_recv_push) (struct atm_vcc *vcc, struct sk_buff *skb);
/* Push that leads to daemon */
 
-   void (*old_close) (struct atm_vcc *vcc);
-   /* We want to see when this vcc gets 
closed */
-
unsigned long last_used;/* For expiry */
unsigned long timestamp;/* Used for various timestamping things:
 * 1. FLUSH started 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/8][ATM]: [lec] use work queue instead of timer for lec arp expiry

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] use work queue instead of timer for lec arp expiry

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 0152dcfb9d42e203ff26d1619158c9664cfbf2d9
tree 24d0a36e52e7d4e86dd7bf1422ae9948011a194d
parent 693b186c2a764f62e017db4b7ed39298831d99e8
author chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 07:22:57 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 
07:22:57 -0400

 net/atm/lec.c |   17 +++--
 net/atm/lec.h |2 +-
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 87fb0c2..8a9f9ab 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1442,7 +1442,7 @@ #define DEBUG_ARP_TABLE 0
 
 #define LEC_ARP_REFRESH_INTERVAL (3*HZ)
 
-static void lec_arp_check_expire(unsigned long data);
+static void lec_arp_check_expire(void *data);
 static void lec_arp_expire_arp(unsigned long data);
 
 /* 
@@ -1465,11 +1465,8 @@ static void lec_arp_init(struct lec_priv
 INIT_HLIST_HEAD(priv-lec_no_forward);
 INIT_HLIST_HEAD(priv-mcast_fwds);
spin_lock_init(priv-lec_arp_lock);
-   init_timer(priv-lec_arp_timer);
-   priv-lec_arp_timer.expires = jiffies + LEC_ARP_REFRESH_INTERVAL;
-   priv-lec_arp_timer.data = (unsigned long)priv;
-   priv-lec_arp_timer.function = lec_arp_check_expire;
-   add_timer(priv-lec_arp_timer);
+   INIT_WORK(priv-lec_arp_work, lec_arp_check_expire, priv);
+   schedule_delayed_work(priv-lec_arp_work, LEC_ARP_REFRESH_INTERVAL);
 }
 
 static void lec_arp_clear_vccs(struct lec_arp_table *entry)
@@ -1719,7 +1716,7 @@ static void lec_arp_destroy(struct lec_p
struct lec_arp_table *entry;
int i;
 
-   del_timer_sync(priv-lec_arp_timer);
+   cancel_rearming_delayed_work(priv-lec_arp_work);
 
/*
 * Remove all entries
@@ -1865,10 +1862,10 @@ static void lec_arp_expire_vcc(unsigned 
  *   to ESI_FORWARD_DIRECT. This causes the flush period to end
  *   regardless of the progress of the flush protocol.
  */
-static void lec_arp_check_expire(unsigned long data)
+static void lec_arp_check_expire(void *data)
 {
unsigned long flags;
-   struct lec_priv *priv = (struct lec_priv *)data;
+   struct lec_priv *priv = data;
struct hlist_node *node, *next;
struct lec_arp_table *entry;
unsigned long now;
@@ -1930,7 +1927,7 @@ static void lec_arp_check_expire(unsigne
}
spin_unlock_irqrestore(priv-lec_arp_lock, flags);
 
-   mod_timer(priv-lec_arp_timer, jiffies + LEC_ARP_REFRESH_INTERVAL);
+   schedule_delayed_work(priv-lec_arp_work, LEC_ARP_REFRESH_INTERVAL);
 }
 
 /*
diff --git a/net/atm/lec.h b/net/atm/lec.h
index 8a6cb64..5bf3544 100644
--- a/net/atm/lec.h
+++ b/net/atm/lec.h
@@ -93,7 +93,7 @@ struct lec_priv {
spinlock_t lec_arp_lock;
struct atm_vcc *mcast_vcc;  /* Default Multicast Send VCC */
struct atm_vcc *lecd;
-   struct timer_list lec_arp_timer;/* C10 */
+   struct work_struct lec_arp_work;/* C10 */
unsigned int maximum_unknown_frame_count;
/*
 * Within the period of time 
defined by this variable, the client will send 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/8][ATM]: [lec] add reference counting to lec_arp entries

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] add reference counting to lec_arp entries

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 397725689277192a899da4009cd078bab8f6ee2d
tree 3bba44e1549229947ed332bb6263c704cabd55c7
parent 0152dcfb9d42e203ff26d1619158c9664cfbf2d9
author chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 07:28:18 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 
07:28:18 -0400

 net/atm/lec.c  |   42 --
 net/atm/lec_arpc.h |1 +
 2 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 8a9f9ab..c865f68 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -107,6 +107,19 @@ static void lec_vcc_added(struct lec_pri
struct sk_buff *skb));
 static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc);
 
+/* must be done under lec_arp_lock */
+static inline void lec_arp_hold(struct lec_arp_table *entry)
+{
+   atomic_inc(entry-usage);
+}
+
+static inline void lec_arp_put(struct lec_arp_table *entry)
+{
+   if (atomic_dec_and_test(entry-usage))
+   kfree(entry);
+}
+
+
 static struct lane2_ops lane2_ops = {
lane2_resolve,  /* resolve, spec 3.1.3 */
lane2_associate_req,/* associate_req,   spec 3.1.4 */
@@ -795,7 +808,7 @@ #endif
entry = lec_arp_find(priv, src);
if (entry  entry-vcc != vcc) {
lec_arp_remove(priv, entry);
-   kfree(entry);
+   lec_arp_put(entry);
}
}
spin_unlock_irqrestore(priv-lec_arp_lock, flags);
@@ -1726,7 +1739,7 @@ static void lec_arp_destroy(struct lec_p
for (i = 0; i  LEC_ARP_TABLE_SIZE; i++) {
hlist_for_each_entry_safe(entry, node, next, 
priv-lec_arp_tables[i], next) {
lec_arp_remove(priv, entry);
-   kfree(entry);
+   lec_arp_put(entry);
}
INIT_HLIST_HEAD(priv-lec_arp_tables[i]);
}
@@ -1735,7 +1748,7 @@ static void lec_arp_destroy(struct lec_p
del_timer_sync(entry-timer);
lec_arp_clear_vccs(entry);
hlist_del(entry-next);
-   kfree(entry);
+   lec_arp_put(entry);
}
INIT_HLIST_HEAD(priv-lec_arp_empty_ones);

@@ -1743,7 +1756,7 @@ static void lec_arp_destroy(struct lec_p
del_timer_sync(entry-timer);
lec_arp_clear_vccs(entry);
hlist_del(entry-next);
-   kfree(entry);
+   lec_arp_put(entry);
}
INIT_HLIST_HEAD(priv-lec_no_forward);
 
@@ -1751,7 +1764,7 @@ static void lec_arp_destroy(struct lec_p
/* No timer, LANEv2 7.1.20 and 2.3.5.3 */
lec_arp_clear_vccs(entry);
hlist_del(entry-next);
-   kfree(entry);
+   lec_arp_put(entry);
}
INIT_HLIST_HEAD(priv-mcast_fwds);
priv-mcast_vcc = NULL;
@@ -1799,6 +1812,7 @@ static struct lec_arp_table *make_entry(
to_return-last_used = jiffies;
to_return-priv = priv;
skb_queue_head_init(to_return-tx_wait);
+   atomic_set(to_return-usage, 1);
return to_return;
 }
 
@@ -1843,7 +1857,7 @@ static void lec_arp_expire_vcc(unsigned 
spin_unlock_irqrestore(priv-lec_arp_lock, flags);
 
lec_arp_clear_vccs(to_remove);
-   kfree(to_remove);
+   lec_arp_put(to_remove);
 }
 
 /*
@@ -1891,7 +1905,7 @@ static void lec_arp_check_expire(void *d
/* Remove entry */
DPRINTK(LEC:Entry timed out\n);
lec_arp_remove(priv, entry);
-   kfree(entry);
+   lec_arp_put(entry);
} else {
/* Something else */
if ((entry-status == ESI_VC_PENDING ||
@@ -2045,7 +2059,7 @@ lec_addr_delete(struct lec_priv *priv, u
 (permanent ||
!(entry-flags  LEC_PERMANENT_FLAG))) {
lec_arp_remove(priv, entry);
-   kfree(entry);
+   lec_arp_put(entry);
}
spin_unlock_irqrestore(priv-lec_arp_lock, flags);
return 0;
@@ -2094,7 +2108,7 @@ lec_arp_update(struct lec_priv *priv, un
tmp-old_push = entry-old_push;
tmp-last_used = jiffies;
del_timer(entry-timer);
-   kfree(entry

[PATCH 8/8][ATM]: [lec] use refcnt to protect lec_arp_entries outside lock

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] use refcnt to protect lec_arp_entries outside lock

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 74391472d01cdd483714b807c9417a0279ed75d5
tree a191d09973b569f0562d9d433c324bbe80a08560
parent 397725689277192a899da4009cd078bab8f6ee2d
author chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 22:07:01 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 
22:07:01 -0400

 net/atm/lec.c |   34 --
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index c865f68..9e635a0 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -396,7 +396,7 @@ #endif
priv-stats.tx_dropped++;
dev_kfree_skb(skb);
}
-   return 0;
+   goto out;
}
 #if DUMP_PACKETS  0
printk(%s:sending to vpi:%d vci:%d\n, dev-name, vcc-vpi, vcc-vci);
@@ -428,6 +428,9 @@ #endif /* DUMP_PACKETS  0 */
netif_wake_queue(dev);
}
 
+out:
+   if (entry)
+   lec_arp_put(entry);
dev-trans_start = jiffies;
return 0;
 }
@@ -1888,6 +1891,7 @@ static void lec_arp_check_expire(void *d
 
DPRINTK(lec_arp_check_expire %p\n, priv);
now = jiffies;
+restart:
spin_lock_irqsave(priv-lec_arp_lock, flags);
for (i = 0; i  LEC_ARP_TABLE_SIZE; i++) {
hlist_for_each_entry_safe(entry, node, next, 
priv-lec_arp_tables[i], next) {
@@ -1927,14 +1931,16 @@ static void lec_arp_check_expire(void *d
time_after_eq(now, entry-timestamp +
  priv-path_switching_delay)) {
struct sk_buff *skb;
+   struct atm_vcc *vcc = entry-vcc;
 
-   while ((skb =
-   skb_dequeue(entry-tx_wait)) !=
-  NULL)
-   lec_send(entry-vcc, skb,
-entry-priv);
+   lec_arp_hold(entry);
+   
spin_unlock_irqrestore(priv-lec_arp_lock, flags);
+   while ((skb = 
skb_dequeue(entry-tx_wait)) != NULL)
+   lec_send(vcc, skb, entry-priv);
entry-last_used = jiffies;
entry-status = ESI_FORWARD_DIRECT;
+   lec_arp_put(entry);
+   goto restart;
}
}
}
@@ -1977,6 +1983,7 @@ static struct atm_vcc *lec_arp_resolve(s
if (entry-status == ESI_FORWARD_DIRECT) {
/* Connection Ok */
entry-last_used = jiffies;
+   lec_arp_hold(entry);
*ret_entry = entry;
found = entry-vcc;
goto out;
@@ -2007,6 +2014,7 @@ static struct atm_vcc *lec_arp_resolve(s
 * or BUS flood limit was reached for an entry which is
 * in ESI_ARP_PENDING or ESI_VC_PENDING state.
 */
+   lec_arp_hold(entry);
*ret_entry = entry;
DPRINTK(lec: entry-status %d entry-vcc %p\n, entry-status,
entry-vcc);
@@ -2335,18 +2343,24 @@ static void lec_flush_complete(struct le
int i;
 
DPRINTK(LEC:lec_flush_complete %lx\n, tran_id);
+restart:
spin_lock_irqsave(priv-lec_arp_lock, flags);
for (i = 0; i  LEC_ARP_TABLE_SIZE; i++) {
hlist_for_each_entry(entry, node, priv-lec_arp_tables[i], 
next) {
if (entry-flush_tran_id == tran_id
 entry-status == ESI_FLUSH_PENDING) {
struct sk_buff *skb;
+   struct atm_vcc *vcc = entry-vcc;
 
-   while ((skb =
-   skb_dequeue(entry-tx_wait)) != NULL)
-   lec_send(entry-vcc, skb, entry-priv);
+   lec_arp_hold(entry);
+   spin_unlock_irqrestore(priv-lec_arp_lock, 
flags);
+   while ((skb = skb_dequeue(entry-tx_wait)) != 
NULL)
+   lec_send(vcc, skb, entry-priv);
+   entry-last_used = jiffies;
entry-status = ESI_FORWARD_DIRECT;
+   lec_arp_put(entry);
DPRINTK(LEC_ARP: Flushed\n

Re: [PATCH] [ATM] he: Fix __init/__devinit conflict

2006-09-25 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],David Miller writes:
Chas, as a subsystem maintainer, if you change a submitter's patch in
a significant and non-trivial way, you should at least mention a brief
reason why you did that.  In this case, why did you delete all of
Roland's __init/__devinit transformations except one when they all
were necessary to fix this bug?

i submitted roland patch without modification and therefore
without comment.  i did change the author field of the patch
unintentionally (which wont happen in the future).
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] indenting/whitespace/comment clean for lane client

2006-09-19 Thread chas williams - CONTRACTOR
its rather big (4000+ lines) so i am posting a url here instead.
this reduces net/atm/lec.c by about 17k.

ftp://ftp.cmf.nrl.navy.mil/pub/chas/netdev/lec-cleanup-diff
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3][ATM]: [he] he_init_one() is declared __devinit, but calls __init functions

2006-09-16 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [he] he_init_one() is declared __devinit, but calls __init functions

he_init_one() is declared __devinit, but calls lots of init functions
that are marked __init.  However, if CONFIG_HOTPLUG is enabled,
__devinit functions go into normal .text, which leads to

WARNING: drivers/atm/he.o - Section mismatch: reference to .init.text:
from .text between 'he_start' (at offset 0x2130) and 'he_service_tbrq'

Fix this by changing the __init functions to __devinit.

Signed-off-by: Roland Dreier [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit c0361a8558796e5af9c5d4e8d4900e4dc44c2e4e
tree 9ad8e4378eb731b220f1e91f1d92b3122f4d6565
parent 96086141b3a9dcde8f0946ae01f9faa55ac0bf4d
author chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 15:44:55 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 
15:44:55 -0400

 drivers/atm/he.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index dd96123..4598b1f 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -454,7 +454,7 @@ #define NONZERO (1  14)
return (NONZERO | (exp  9) | (rate  0x1ff));
 }
 
-static void __init
+static void __devinit
 he_init_rx_lbfp0(struct he_dev *he_dev)
 {
unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -485,7 +485,7 @@ he_init_rx_lbfp0(struct he_dev *he_dev)
he_writel(he_dev, he_dev-r0_numbuffs, RLBF0_C);
 }
 
-static void __init
+static void __devinit
 he_init_rx_lbfp1(struct he_dev *he_dev)
 {
unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -516,7 +516,7 @@ he_init_rx_lbfp1(struct he_dev *he_dev)
he_writel(he_dev, he_dev-r1_numbuffs, RLBF1_C);
 }
 
-static void __init
+static void __devinit
 he_init_tx_lbfp(struct he_dev *he_dev)
 {
unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -546,7 +546,7 @@ he_init_tx_lbfp(struct he_dev *he_dev)
he_writel(he_dev, lbufd_index - 1, TLBF_T);
 }
 
-static int __init
+static int __devinit
 he_init_tpdrq(struct he_dev *he_dev)
 {
he_dev-tpdrq_base = pci_alloc_consistent(he_dev-pci_dev,
@@ -568,7 +568,7 @@ he_init_tpdrq(struct he_dev *he_dev)
return 0;
 }
 
-static void __init
+static void __devinit
 he_init_cs_block(struct he_dev *he_dev)
 {
unsigned clock, rate, delta;
@@ -664,7 +664,7 @@ he_init_cs_block(struct he_dev *he_dev)
 
 }
 
-static int __init
+static int __devinit
 he_init_cs_block_rcm(struct he_dev *he_dev)
 {
unsigned (*rategrid)[16][16];
@@ -785,7 +785,7 @@ #define RTGTBL_OFFSET 0x400
return 0;
 }
 
-static int __init
+static int __devinit
 he_init_group(struct he_dev *he_dev, int group)
 {
int i;
@@ -955,7 +955,7 @@ #endif
return 0;
 }
 
-static int __init
+static int __devinit
 he_init_irq(struct he_dev *he_dev)
 {
int i;
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3][ATM]: [he] don't hold the device lock when upcalling

2006-09-16 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [he] don't hold the device lock when upcalling

This can create a deadlock/lock ordering problem with other layers that
want to use the transmit (or other) path of the card at that time.

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit fc6b6284e9383bd8d9fd95210fbc5e3c54ccc65d
tree cfb6beef3334433e331d27f453d0c3901bd7c5c2
parent c0361a8558796e5af9c5d4e8d4900e4dc44c2e4e
author chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 15:49:53 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 
15:49:53 -0400

 drivers/atm/he.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 4598b1f..55ca7d8 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1928,7 +1928,9 @@ #endif
 #ifdef notdef
ATM_SKB(skb)-vcc = vcc;
 #endif
+   spin_unlock(he_dev-global_lock);
vcc-push(vcc, skb);
+   spin_lock(he_dev-global_lock);
 
atomic_inc(vcc-stats-rx);
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3][ATM]: potential NULL pointer dereference in clip_mkip()

2006-09-16 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: potential NULL pointer dereference in clip_mkip()

http://article.gmane.org/gmane.linux.kernel/445717

When re-processing received data, a struct sk_buff pointer skb may be
dereferenced after a free operation.

From: Frederik Deweerdt [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 87409562aeed5fb2b85dc2f9bddca0a1bbde8c37
tree 0885b8bd2b8881201de422877abd8979861c44de
parent fc6b6284e9383bd8d9fd95210fbc5e3c54ccc65d
author chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 15:55:01 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 
15:55:01 -0400

 net/atm/clip.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/atm/clip.c b/net/atm/clip.c
index 7ce7bfe..0dfa3a4 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -500,9 +500,9 @@ static int clip_mkip(struct atm_vcc *vcc
} else {
unsigned int len = skb-len;
 
-   clip_push(vcc, skb);
PRIV(skb-dev)-stats.rx_packets--;
PRIV(skb-dev)-stats.rx_bytes -= len;
+   clip_push(vcc, skb);
}
return 0;
 }
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1][ATM]: [he] when transmit fails, unmap the dma regions

2006-09-07 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [he] when transmit fails, unmap the dma regions

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit e2c84ae30cb2dca23afb5e811c108e235f941c3d
tree a4acb86e2e10baa5ac651e566a550e0af0c55507
parent 0d60b74cf4354672e4586ca2bedde6695db43165
author chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 17:04:14 -0400
committer chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 17:04:14 -0400

 drivers/atm/he.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index d369130..dd96123 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -2282,6 +2282,8 @@ __enqueue_tpd(struct he_dev *he_dev, str
TPDRQ_MASK(he_readl(he_dev, TPDRQ_B_H)));
 
if (new_tail == he_dev-tpdrq_head) {
+   int slot;
+
hprintk(tpdrq full (cid 0x%x)\n, cid);
/*
 * FIXME
@@ -2289,6 +2291,13 @@ __enqueue_tpd(struct he_dev *he_dev, str
 * after service_tbrq, service the backlog
 * for now, we just drop the pdu
 */
+   for (slot = 0; slot  TPD_MAXIOV; ++slot) {
+   if (tpd-iovec[slot].addr)
+   pci_unmap_single(he_dev-pci_dev,
+   tpd-iovec[slot].addr,
+   tpd-iovec[slot].len  
TPD_LEN_MASK,
+   
PCI_DMA_TODEVICE);
+   }
if (tpd-skb) {
if (tpd-vcc-pop)
tpd-vcc-pop(tpd-vcc, tpd-skb);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2][ATM]: Move linux/device.h include in linux/atmdev.h to #ifdef __KERNEL__ section

2006-09-07 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: Move linux/device.h include in linux/atmdev.h to #ifdef __KERNEL__ 
section

linux/device.h header is not included in the David Woodhouse's
kernel-headers git tree which is used for userspace kernel headers. Which
results in compile errors when building iproute2.

Signed-off-by: Ismail Donmez [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 0293994f3f7a3a4bc4db6e286473e9b422b8f582
tree b8b24f8e3025e23dbeb61dc101ca1f35f8efaf8e
parent 837a0955d484497fc6b0b1991d9cf77fb74f15e8
author chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 15:14:26 -0400
committer chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 15:14:26 -0400

 include/linux/atmdev.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 41788a3..2096e5c 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -7,7 +7,6 @@ #ifndef LINUX_ATMDEV_H
 #define LINUX_ATMDEV_H
 
 
-#include linux/device.h
 #include linux/atmapi.h
 #include linux/atm.h
 #include linux/atmioc.h
@@ -210,6 +209,7 @@ #define ATM_VF2TXT_MAP \
 
 #ifdef __KERNEL__
 
+#include linux/device.h
 #include linux/wait.h /* wait_queue_head_t */
 #include linux/time.h /* struct timeval */
 #include linux/net.h
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2][ATM]: proper prototypes in net/atm/mpc.h (and reduce ifdef clutter)

2006-09-07 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: proper prototypes in net/atm/mpc.h (and reduce ifdef clutter)

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 0d60b74cf4354672e4586ca2bedde6695db43165
tree 6d87bc63ee248fee449133cb62614f963fc97f54
parent 0293994f3f7a3a4bc4db6e286473e9b422b8f582
author chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 15:56:26 -0400
committer chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 15:56:26 -0400

 net/atm/mpc.c |   11 ---
 net/atm/mpc.h |8 
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 0070466..b87c2a8 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -98,11 +98,6 @@ static struct notifier_block mpoa_notifi
0
 };
 
-#ifdef CONFIG_PROC_FS
-extern int mpc_proc_init(void);
-extern void mpc_proc_clean(void);
-#endif
-
 struct mpoa_client *mpcs = NULL; /* FIXME */
 static struct atm_mpoa_qos *qos_head = NULL;
 static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
@@ -1439,12 +1434,8 @@ static __init int atm_mpoa_init(void)
 {
register_atm_ioctl(atm_ioctl_ops);
 
-#ifdef CONFIG_PROC_FS
if (mpc_proc_init() != 0)
printk(KERN_INFO mpoa: failed to initialize /proc/mpoa\n);
-   else
-   printk(KERN_INFO mpoa: /proc/mpoa initialized\n);
-#endif
 
printk(mpc.c:  __DATE__   __TIME__  initialized\n);
 
@@ -1457,9 +1448,7 @@ static void __exit atm_mpoa_cleanup(void
struct atm_mpoa_qos *qos, *nextqos;
struct lec_priv *priv;
 
-#ifdef CONFIG_PROC_FS
mpc_proc_clean();
-#endif
 
del_timer(mpc_timer);
unregister_netdevice_notifier(mpoa_notifier);
diff --git a/net/atm/mpc.h b/net/atm/mpc.h
index 863ddf6..3c7981a 100644
--- a/net/atm/mpc.h
+++ b/net/atm/mpc.h
@@ -50,4 +50,12 @@ int atm_mpoa_delete_qos(struct atm_mpoa_
 struct seq_file;
 void atm_mpoa_disp_qos(struct seq_file *m);
 
+#ifdef CONFIG_PROC_FS
+int mpc_proc_init(void);
+void mpc_proc_clean(void);
+#else
+#define mpc_proc_init() (0)
+#define mpc_proc_clean() do { } while(0)
+#endif
+
 #endif /* _MPC_H_ */
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] clear skb cb on IP input

2006-07-16 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],David Miller writes:
From: Herbert Xu [EMAIL PROTECTED]
 At least this lets us get rid of a few other memsets :)
 
Applied, good spotting :-)  I remember when we added those
things.

But I'm beginning to think that the onus of this may in fact fall upon
the devices, in fact.  Loopback is one of the few devices where the
control block might not be cleared out, due to uses in the output
path.  Devices predominantly provide a zero'd out control block in the
skb on packet receive.

the atm layer has the same problem.  some atm device drivers use the
skb cb field, so it needs to be zero'ed by the next upper layer (clip,
lane) before being passed to the ip layer.  its also possible that the
atm layer should clone the skb before passing to the next layer which
would also zeroize the cb.

Other opinions welcome...

why does the input side of the ip layer believe the cb contains valid
data?  it should zero the contents of the cb, or just fill in the cb
correctly when the packet arrives at its doorstop.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] correct dev_alloc_skb kerneldoc

2006-07-14 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],David Miller writes:
From: Christoph Hellwig [EMAIL PROTECTED]
Date: Thu, 13 Jul 2006 22:36:16 +0200
  - drivers/atm/{idt77252.c, nicstar.c}, drivers/usb/atm/usbatm.c:
  These use private skb queues and do odd things.  I can't see
  any point for using dev_alloc_skb with it's additional headroom
  reservation here.

as i recall, for simple rfc1483 encapsulation, the LLC/SNAP header of 8
bytes needs to be replaced by an ether header of 14 bytes.  its likely
this is the reason dev_alloc_skb() is used.  most of the other drivers
use atm_alloc_charge() which does a skb_reserve(), but these drivers
dont dma directly into a skb.

Any of these cases that DMA into the skb allocated will need
the headroom, as explained by the PowerPC folks.

this only works for ordinary ip traffic (which i admit is the most
common case).  but since the nicstar/idt77252 devices have a peak
speed of 155Mb/s i doubt they would suffer much.  considering they still
use virt_to_bus/bus_to_virt i would be a bit surprised if they worked
(atleast on ppc64).  they can be simply converted to alloc_skb() and
manually skb_reserve() a little overhead.

usbatm should probably be converted to use atm_alloc_charge() since
the vcc is known at this point unlike the nicstar/idt77252 case.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2][ATM]: Typo in drivers/atm/Kconfig...

2006-07-07 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: Typo in drivers/atm/Kconfig...

From: Matt LaPlante [EMAIL PROTECTED]
Signed-off-by: Charles Williams [EMAIL PROTECTED]

---
commit 8bbf3465e23c41b92931e2d2172c184ccd1d2510
tree d1620632c703f8d67790a4f9971f154949399740
parent d0cddc7d78816bf6ceae9730eb51d78a73a62c15
author chas williams [EMAIL PROTECTED] Thu, 06 Jul 2006 12:38:03 -0400
committer chas williams [EMAIL PROTECTED] Thu, 06 Jul 2006 12:38:03 -0400

 drivers/atm/Kconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
index 01a9f1c..cfa5af8 100644
--- a/drivers/atm/Kconfig
+++ b/drivers/atm/Kconfig
@@ -398,7 +398,7 @@ config ATM_FORE200E_USE_TASKLET
default n
help
  This defers work to be done by the interrupt handler to a
- tasklet instead of hanlding everything at interrupt time.  This
+ tasklet instead of handling everything at interrupt time.  This
  may improve the responsive of the host.
 
 config ATM_FORE200E_TX_RETRY
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2][ATM]: fix possible recursive locking in skb_migrate()

2006-07-07 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: fix possible recursive locking in skb_migrate()

ok this is a real potential deadlock in a way, it takes two locks of 2
skbuffs without doing any kind of lock ordering; I think the following
patch should fix it. Just sort the lock taking order by address of the
skb.. it's not pretty but it's the best this can do in a minimally
invasive way.

Signed-off-by: Arjan van de Ven [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit c895a2f42057801ca096f5155e85bc2b2f381250
tree ee64100fdd0302fe5c12ce6c153eea8b94010f2b
parent 8bbf3465e23c41b92931e2d2172c184ccd1d2510
author chas williams [EMAIL PROTECTED] Fri, 07 Jul 2006 18:11:30 -0400
committer chas williams [EMAIL PROTECTED] Fri, 07 Jul 2006 18:11:30 -0400

 net/atm/ipcommon.c |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/net/atm/ipcommon.c b/net/atm/ipcommon.c
index 4b1faca..1d3de42 100644
--- a/net/atm/ipcommon.c
+++ b/net/atm/ipcommon.c
@@ -25,22 +25,27 @@ #endif
 /*
  * skb_migrate appends the list at from to to, emptying from in the
  * process. skb_migrate is atomic with respect to all other skb operations on
- * from and to. Note that it locks both lists at the same time, so beware
- * of potential deadlocks.
+ * from and to. Note that it locks both lists at the same time, so to deal
+ * with the lock ordering, the locks are taken in address order.
  *
  * This function should live in skbuff.c or skbuff.h.
  */
 
 
-void skb_migrate(struct sk_buff_head *from,struct sk_buff_head *to)
+void skb_migrate(struct sk_buff_head *from, struct sk_buff_head *to)
 {
unsigned long flags;
struct sk_buff *skb_from = (struct sk_buff *) from;
struct sk_buff *skb_to = (struct sk_buff *) to;
struct sk_buff *prev;
 
-   spin_lock_irqsave(from-lock,flags);
-   spin_lock(to-lock);
+   if ((unsigned long) from  (unsigned long) to) {
+   spin_lock_irqsave(from-lock, flags);
+   spin_lock_nested(to-lock, SINGLE_DEPTH_NESTING);
+   } else {
+   spin_lock_irqsave(to-lock, flags);
+   spin_lock_nested(from-lock, SINGLE_DEPTH_NESTING);
+   }
prev = from-prev;
from-next-prev = to-prev;
prev-next = skb_to;
@@ -51,7 +56,7 @@ void skb_migrate(struct sk_buff_head *fr
from-prev = skb_from;
from-next = skb_from;
from-qlen = 0;
-   spin_unlock_irqrestore(from-lock,flags);
+   spin_unlock_irqrestore(from-lock, flags);
 }
 
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4][ATM]: [suni] change suni_init to __devinit

2006-06-28 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [suni] change suni_init to __devinit

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 4768199f3a5582378164820cc74251e485a01292
tree fd27293baebffd029ae53a6efe18913cfb68cada
parent 3d63ef0340a7f49a72f5eaa33f08b38fa78d48e1
author chas williams [EMAIL PROTECTED] Mon, 26 Jun 2006 19:56:00 -0400
committer chas williams [EMAIL PROTECTED] Mon, 26 Jun 2006 19:56:00 -0400

 drivers/atm/he.c   |2 +-
 drivers/atm/suni.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index fde9334..a486eb1 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1018,7 +1018,7 @@ he_init_irq(struct he_dev *he_dev)
return 0;
 }
 
-static int __init
+static int __devinit
 he_start(struct atm_dev *dev)
 {
struct he_dev *he_dev;
diff --git a/drivers/atm/suni.c b/drivers/atm/suni.c
index b1d063c..f04f39c 100644
--- a/drivers/atm/suni.c
+++ b/drivers/atm/suni.c
@@ -289,7 +289,7 @@ static const struct atmphy_ops suni_ops 
 };
 
 
-int suni_init(struct atm_dev *dev)
+int __devinit suni_init(struct atm_dev *dev)
 {
unsigned char mri;
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4][ATM]: [idt77105] should be __devinit not __init

2006-06-28 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [idt77105] should be __devinit not __init

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 51403ade3cedfc85f1f41d81cb3a227f9ce2366f
tree f9cf0143466de92eda0080e27240d4b53c130c18
parent 982703b5b38b314081d79ebc657fc06b1b6fe6b6
author chas williams [EMAIL PROTECTED] Sun, 28 May 2006 22:14:23 -0400
committer chas williams [EMAIL PROTECTED] Sun, 28 May 2006 22:14:23 -0400

 drivers/atm/idt77105.c |2 +-
 drivers/atm/idt77105.h |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 0aabfc2..325325a 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -358,7 +358,7 @@ static const struct atmphy_ops idt77105_
 };
 
 
-int idt77105_init(struct atm_dev *dev)
+int __devinit idt77105_init(struct atm_dev *dev)
 {
dev-phy = idt77105_ops;
return 0;
diff --git a/drivers/atm/idt77105.h b/drivers/atm/idt77105.h
index 8ba8218..3fd2bc8 100644
--- a/drivers/atm/idt77105.h
+++ b/drivers/atm/idt77105.h
@@ -76,7 +76,7 @@ #define IDT77105_CTRSEL_RCC   0x02/* W, R
 #define IDT77105_CTRSEL_RHEC   0x01/* W, Rx HEC Error Counter */
 
 #ifdef __KERNEL__
-int idt77105_init(struct atm_dev *dev) __init;
+int idt77105_init(struct atm_dev *dev);
 #endif
 
 /*
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4][ATM]: basic sysfs support for ATM devices

2006-06-28 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: basic sysfs support for ATM devices

From: Roman Kagan [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 034e4008acda89bc2422541e077f2dbfd530b717
tree e528e0e6f2d69c729f2daf6618df22133b3e4818
parent 4768199f3a5582378164820cc74251e485a01292
author chas williams [EMAIL PROTECTED] Mon, 26 Jun 2006 20:24:44 -0400
committer chas williams [EMAIL PROTECTED] Mon, 26 Jun 2006 20:24:44 -0400

 include/linux/atmdev.h |4 +
 net/atm/Makefile   |2 -
 net/atm/atm_sysfs.c|  176 
 net/atm/common.c   |7 ++
 net/atm/common.h   |2 +
 net/atm/resources.c|   22 +-
 net/atm/resources.h|2 +
 7 files changed, 209 insertions(+), 6 deletions(-)

diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 1eb238a..41788a3 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -7,6 +7,7 @@ #ifndef LINUX_ATMDEV_H
 #define LINUX_ATMDEV_H
 
 
+#include linux/device.h
 #include linux/atmapi.h
 #include linux/atm.h
 #include linux/atmioc.h
@@ -358,6 +359,7 @@ #ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc_entry; /* proc entry */
char *proc_name;/* proc entry name */
 #endif
+   struct class_device class_dev;  /* sysfs class device */
struct list_head dev_list;  /* linkage */
 };
 
@@ -459,7 +461,7 @@ static inline void atm_dev_put(struct at
BUG_ON(!test_bit(ATM_DF_REMOVED, dev-flags));
if (dev-ops-dev_close)
dev-ops-dev_close(dev);
-   kfree(dev);
+   class_device_put(dev-class_dev);
}
 }
 
diff --git a/net/atm/Makefile b/net/atm/Makefile
index d581875..89656d6 100644
--- a/net/atm/Makefile
+++ b/net/atm/Makefile
@@ -2,7 +2,7 @@ #
 # Makefile for the ATM Protocol Families.
 #
 
-atm-y  := addr.o pvc.o signaling.o svc.o ioctl.o common.o atm_misc.o 
raw.o resources.o
+atm-y  := addr.o pvc.o signaling.o svc.o ioctl.o common.o atm_misc.o 
raw.o resources.o atm_sysfs.o
 mpoa-objs  := mpc.o mpoa_caches.o mpoa_proc.o
 
 obj-$(CONFIG_ATM) += atm.o
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
new file mode 100644
index 000..5df4b9a
--- /dev/null
+++ b/net/atm/atm_sysfs.c
@@ -0,0 +1,176 @@
+/* ATM driver model support. */
+
+#include linux/config.h
+#include linux/kernel.h
+#include linux/init.h
+#include linux/kobject.h
+#include linux/atmdev.h
+#include common.h
+#include resources.h
+
+#define to_atm_dev(cldev) container_of(cldev, struct atm_dev, class_dev)
+
+static ssize_t show_type(struct class_device *cdev, char *buf)
+{
+   struct atm_dev *adev = to_atm_dev(cdev);
+   return sprintf(buf, %s\n, adev-type);
+}
+
+static ssize_t show_address(struct class_device *cdev, char *buf)
+{
+   char *pos = buf;
+   struct atm_dev *adev = to_atm_dev(cdev);
+   int i;
+
+   for (i = 0; i  (ESI_LEN - 1); i++)
+   pos += sprintf(pos, %02x:, adev-esi[i]);
+   pos += sprintf(pos, %02x\n, adev-esi[i]);
+
+   return pos - buf;
+}
+
+static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
+{
+unsigned long flags;
+   char *pos = buf;
+   struct atm_dev *adev = to_atm_dev(cdev);
+struct atm_dev_addr *aaddr;
+   int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin;
+   int i, j;
+
+spin_lock_irqsave(adev-lock, flags);
+list_for_each_entry(aaddr, adev-local, entry) {
+   for(i = 0, j = 0; i  ATM_ESA_LEN; ++i, ++j) {
+   if (j == *fmt) {
+   pos += sprintf(pos, .);
+   ++fmt;
+   j = 0;
+   }
+   pos += sprintf(pos, %02x, 
aaddr-addr.sas_addr.prv[i]);
+   }
+   pos += sprintf(pos, \n);
+   }
+spin_unlock_irqrestore(adev-lock, flags);
+
+   return pos - buf;
+}
+
+static ssize_t show_carrier(struct class_device *cdev, char *buf)
+{
+   char *pos = buf;
+   struct atm_dev *adev = to_atm_dev(cdev);
+
+   pos += sprintf(pos, %d\n,
+  adev-signal == ATM_PHY_SIG_LOST ? 0 : 1);
+   
+   return pos - buf;
+}
+
+static ssize_t show_link_rate(struct class_device *cdev, char *buf)
+{
+   char *pos = buf;
+   struct atm_dev *adev = to_atm_dev(cdev);
+   int link_rate;
+
+   /* show the link rate, not the data rate */
+   switch (adev-link_rate) {
+   case ATM_OC3_PCR:
+   link_rate = 15552;
+   break;
+   case ATM_OC12_PCR:
+   link_rate = 62208;
+   break;
+   case ATM_25_PCR:
+   link_rate = 2560;
+   break;
+   default:
+   link_rate = adev-link_rate * 8 * 53;
+   }

[PATCH 1/2][ATM]: convert atm_dev_mutex from semaphore to mutex

2006-03-02 Thread chas williams - CONTRACTOR
please consider for 2.6.17 -- thanks!

[ATM]: convert atm_dev_mutex from semaphore to mutex

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 072ab3c1dc3a841129d7b9affee95ced61d5f3d8
tree 3c10b2cece06d39cbd83ae318b3d64a142053295
parent 02ffc5995920ec858bd6cde41dff81237ca1a28f
author chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 12:21:49 -0500
committer chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 12:21:49 
-0500

 net/atm/common.c|4 ++--
 net/atm/resources.c |   32 +---
 net/atm/resources.h |3 ++-
 3 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -451,12 +451,12 @@ int vcc_connect(struct socket *sock, int
dev = try_then_request_module(atm_dev_lookup(itf), 
atm-device-%d, itf);
} else {
dev = NULL;
-   down(atm_dev_mutex);
+   mutex_lock(atm_dev_mutex);
if (!list_empty(atm_devs)) {
dev = list_entry(atm_devs.next, struct atm_dev, 
dev_list);
atm_dev_hold(dev);
}
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
}
if (!dev)
return -ENODEV;
diff --git a/net/atm/resources.c b/net/atm/resources.c
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -18,6 +18,8 @@
 #include linux/bitops.h
 #include linux/capability.h
 #include linux/delay.h
+#include linux/mutex.h
+
 #include net/sock.h   /* for struct sock */
 
 #include common.h
@@ -26,7 +28,7 @@
 
 
 LIST_HEAD(atm_devs);
-DECLARE_MUTEX(atm_dev_mutex);
+DEFINE_MUTEX(atm_dev_mutex);
 
 static struct atm_dev *__alloc_atm_dev(const char *type)
 {
@@ -65,9 +67,9 @@ struct atm_dev *atm_dev_lookup(int numbe
 {
struct atm_dev *dev;
 
-   down(atm_dev_mutex);
+   mutex_lock(atm_dev_mutex);
dev = __atm_dev_lookup(number);
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
return dev;
 }
 
@@ -83,11 +85,11 @@ struct atm_dev *atm_dev_register(const c
type);
return NULL;
}
-   down(atm_dev_mutex);
+   mutex_lock(atm_dev_mutex);
if (number != -1) {
if ((inuse = __atm_dev_lookup(number))) {
atm_dev_put(inuse);
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
kfree(dev);
return NULL;
}
@@ -112,12 +114,12 @@ struct atm_dev *atm_dev_register(const c
printk(KERN_ERR atm_dev_register: 
   atm_proc_dev_register failed for dev %s\n,
   type);
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
kfree(dev);
return NULL;
}
list_add_tail(dev-dev_list, atm_devs);
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
 
return dev;
 }
@@ -133,9 +135,9 @@ void atm_dev_deregister(struct atm_dev *
 * with same number can appear, such we need deregister proc, 
 * release async all vccs and remove them from vccs list too
 */
-   down(atm_dev_mutex);
+   mutex_lock(atm_dev_mutex);
list_del(dev-dev_list);
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
 
atm_dev_release_vccs(dev);
atm_proc_dev_deregister(dev);
@@ -196,16 +198,16 @@ int atm_dev_ioctl(unsigned int cmd, void
return -EFAULT;
if (get_user(len, iobuf-length))
return -EFAULT;
-   down(atm_dev_mutex);
+   mutex_lock(atm_dev_mutex);
list_for_each(p, atm_devs)
size += sizeof(int);
if (size  len) {
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
return -E2BIG;
}
tmp_buf = kmalloc(size, GFP_ATOMIC);
if (!tmp_buf) {
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
return -ENOMEM;
}
tmp_p = tmp_buf;
@@ -213,7 +215,7 @@ int atm_dev_ioctl(unsigned int cmd, void
dev = list_entry(p, struct atm_dev, dev_list);
*tmp_p++ = dev-number;
}
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
error = ((copy_to_user(buf, tmp_buf, size)) ||
put_user(size, iobuf-length))
 

[PATCH 2/2][ATM]: [fore200e] fix section mismatch warnings

2006-03-02 Thread chas williams - CONTRACTOR
please apply to 2.6.16 tree -- thanks!

[ATM]: [fore200e] fix section mismatch warnings

Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit bb03a1d97c7f1fff1cb7330c13e9cf5ded8aaa3e
tree 46f8397d1da9edee9cd6c95ba726afa677493d74
parent de5fd01e049c1ffe9ef5e4a1ecd23c837305b52f
author chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 10:46:13 -0500
committer chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 10:46:13 
-0500

 drivers/atm/fore200e.c |   36 ++--
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -555,7 +555,7 @@ fore200e_pca_reset(struct fore200e* fore
 }
 
 
-static int __init
+static int __devinit
 fore200e_pca_map(struct fore200e* fore200e)
 {
 DPRINTK(2, device %s being mapped in memory\n, fore200e-name);
@@ -589,7 +589,7 @@ fore200e_pca_unmap(struct fore200e* fore
 }
 
 
-static int __init
+static int __devinit
 fore200e_pca_configure(struct fore200e* fore200e)
 {
 struct pci_dev* pci_dev = (struct pci_dev*)fore200e-bus_dev;
@@ -2125,7 +2125,7 @@ fore200e_change_qos(struct atm_vcc* vcc,
 }
 
 
-static int __init
+static int __devinit
 fore200e_irq_request(struct fore200e* fore200e)
 {
 if (request_irq(fore200e-irq, fore200e_interrupt, SA_SHIRQ, 
fore200e-name, fore200e-atm_dev)  0) {
@@ -2148,7 +2148,7 @@ fore200e_irq_request(struct fore200e* fo
 }
 
 
-static int __init
+static int __devinit
 fore200e_get_esi(struct fore200e* fore200e)
 {
 struct prom_data* prom = fore200e_kmalloc(sizeof(struct prom_data), 
GFP_KERNEL | GFP_DMA);
@@ -2180,7 +2180,7 @@ fore200e_get_esi(struct fore200e* fore20
 }
 
 
-static int __init
+static int __devinit
 fore200e_alloc_rx_buf(struct fore200e* fore200e)
 {
 int scheme, magn, nbr, size, i;
@@ -2245,7 +2245,7 @@ fore200e_alloc_rx_buf(struct fore200e* f
 }
 
 
-static int __init
+static int __devinit
 fore200e_init_bs_queue(struct fore200e* fore200e)
 {
 int scheme, magn, i;
@@ -2308,7 +2308,7 @@ fore200e_init_bs_queue(struct fore200e* 
 }
 
 
-static int __init
+static int __devinit
 fore200e_init_rx_queue(struct fore200e* fore200e)
 {
 struct host_rxq* rxq =  fore200e-host_rxq;
@@ -2368,7 +2368,7 @@ fore200e_init_rx_queue(struct fore200e* 
 }
 
 
-static int __init
+static int __devinit
 fore200e_init_tx_queue(struct fore200e* fore200e)
 {
 struct host_txq* txq =  fore200e-host_txq;
@@ -2431,7 +2431,7 @@ fore200e_init_tx_queue(struct fore200e* 
 }
 
 
-static int __init
+static int __devinit
 fore200e_init_cmd_queue(struct fore200e* fore200e)
 {
 struct host_cmdq* cmdq =  fore200e-host_cmdq;
@@ -2487,7 +2487,7 @@ fore200e_param_bs_queue(struct fore200e*
 }
 
 
-static int __init
+static int __devinit
 fore200e_initialize(struct fore200e* fore200e)
 {
 struct cp_queues __iomem * cpq;
@@ -2539,7 +2539,7 @@ fore200e_initialize(struct fore200e* for
 }
 
 
-static void __init
+static void __devinit
 fore200e_monitor_putc(struct fore200e* fore200e, char c)
 {
 struct cp_monitor __iomem * monitor = fore200e-cp_monitor;
@@ -2551,7 +2551,7 @@ fore200e_monitor_putc(struct fore200e* f
 }
 
 
-static int __init
+static int __devinit
 fore200e_monitor_getc(struct fore200e* fore200e)
 {
 struct cp_monitor __iomem * monitor = fore200e-cp_monitor;
@@ -2576,7 +2576,7 @@ fore200e_monitor_getc(struct fore200e* f
 }
 
 
-static void __init
+static void __devinit
 fore200e_monitor_puts(struct fore200e* fore200e, char* str)
 {
 while (*str) {
@@ -2591,7 +2591,7 @@ fore200e_monitor_puts(struct fore200e* f
 }
 
 
-static int __init
+static int __devinit
 fore200e_start_fw(struct fore200e* fore200e)
 {
 int   ok;
@@ -2622,7 +2622,7 @@ fore200e_start_fw(struct fore200e* fore2
 }
 
 
-static int __init
+static int __devinit
 fore200e_load_fw(struct fore200e* fore200e)
 {
 u32* fw_data = (u32*) fore200e-bus-fw_data;
@@ -2648,7 +2648,7 @@ fore200e_load_fw(struct fore200e* fore20
 }
 
 
-static int __init
+static int __devinit
 fore200e_register(struct fore200e* fore200e)
 {
 struct atm_dev* atm_dev;
@@ -2675,7 +2675,7 @@ fore200e_register(struct fore200e* fore2
 }
 
 
-static int __init
+static int __devinit
 fore200e_init(struct fore200e* fore200e)
 {
 if (fore200e_register(fore200e)  0)
@@ -2721,7 +2721,7 @@ fore200e_init(struct fore200e* fore200e)
return -EBUSY;
 
 fore200e_supply(fore200e);
-
+
 /* all done, board initialization is now complete */
 fore200e-state = FORE200E_STATE_COMPLETE;
 return 0;
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2][ATM]: [drivers] kzalloc() conversion in drivers/atm

2006-03-02 Thread chas williams - CONTRACTOR
please consider for 2.6.17 tree -- thanks!

[ATM]: [drivers] kzalloc() conversion in drivers/atm

Signed-off-by: Eric Sesterhenn [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit b8fc35b0d286fd1c7d0ef4f31508d05ead85a35e
tree 9f8dafc67c191c97df4e1f787709053cb4083495
parent 072ab3c1dc3a841129d7b9affee95ced61d5f3d8
author chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 12:45:27 -0500
committer chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 12:45:27 
-0500

 drivers/atm/adummy.c |5 ++---
 drivers/atm/firestream.c |   10 +++---
 drivers/atm/he.c |3 +--
 drivers/atm/idt77252.c   |   18 ++
 drivers/atm/iphase.c |6 ++
 drivers/atm/zatm.c   |   12 ++--
 6 files changed, 20 insertions(+), 34 deletions(-)

diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -114,14 +114,13 @@ static int __init adummy_init(void)
 
printk(KERN_ERR adummy: version %s\n, DRV_VERSION);
 
-   adummy_dev = (struct adummy_dev *) kmalloc(sizeof(struct adummy_dev),
+   adummy_dev = (struct adummy_dev *) kzalloc(sizeof(struct adummy_dev),
   GFP_KERNEL);
if (!adummy_dev) {
-   printk(KERN_ERR DEV_LABEL : kmalloc() failed\n);
+   printk(KERN_ERR DEV_LABEL : kzalloc() failed\n);
err = -ENOMEM;
goto out;
}
-   memset(adummy_dev, 0, sizeof(struct adummy_dev));
 
atm_dev = atm_dev_register(DEV_LABEL, adummy_ops, -1, NULL);
if (!atm_dev) {
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1782,7 +1782,7 @@ static int __devinit fs_init (struct fs_
write_fs (dev, RAM, (1  (28 - FS155_VPI_BITS - 
FS155_VCI_BITS)) - 1);
dev-nchannels = FS155_NR_CHANNELS;
}
-   dev-atm_vccs = kmalloc (dev-nchannels * sizeof (struct atm_vcc *), 
+   dev-atm_vccs = kcalloc(dev-nchannels, sizeof (struct atm_vcc *), 
 GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc atmvccs: %p(%Zd)\n,
dev-atm_vccs, dev-nchannels * sizeof (struct atm_vcc *));
@@ -1792,9 +1792,8 @@ static int __devinit fs_init (struct fs_
/* XXX Clean up. */
return 1;
}
-   memset (dev-atm_vccs, 0, dev-nchannels * sizeof (struct atm_vcc *));
 
-   dev-tx_inuse = kmalloc (dev-nchannels / 8 /* bits/byte */ , 
GFP_KERNEL);
+   dev-tx_inuse = kzalloc (dev-nchannels / 8 /* bits/byte */ , 
GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc tx_inuse: %p(%d)\n, 
dev-atm_vccs, dev-nchannels / 8);
 
@@ -1803,7 +1802,6 @@ static int __devinit fs_init (struct fs_
/* XXX Clean up. */
return 1;
}
-   memset (dev-tx_inuse, 0, dev-nchannels / 8);
 
/* -- RAS1 : FS155 and 50 differ. Default (0) should be OK for both */
/* -- RAS2 : FS50 only: Default is OK. */
@@ -1891,14 +1889,12 @@ static int __devinit firestream_init_one
if (pci_enable_device(pci_dev)) 
goto err_out;
 
-   fs_dev = kmalloc (sizeof (struct fs_dev), GFP_KERNEL);
+   fs_dev = kzalloc (sizeof (struct fs_dev), GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc fs-dev: %p(%Zd)\n,
fs_dev, sizeof (struct fs_dev));
if (!fs_dev)
goto err_out;
 
-   memset (fs_dev, 0, sizeof (struct fs_dev));
-  
atm_dev = atm_dev_register(fs, ops, -1, NULL);
if (!atm_dev)
goto err_out_free_fs_dev;
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -384,13 +384,12 @@ he_init_one(struct pci_dev *pci_dev, con
}
pci_set_drvdata(pci_dev, atm_dev);
 
-   he_dev = (struct he_dev *) kmalloc(sizeof(struct he_dev),
+   he_dev = (struct he_dev *) kzalloc(sizeof(struct he_dev),
GFP_KERNEL);
if (!he_dev) {
err = -ENOMEM;
goto init_one_failure;
}
-   memset(he_dev, 0, sizeof(struct he_dev));
 
he_dev-pci_dev = pci_dev;
he_dev-atm_dev = atm_dev;
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -642,10 +642,9 @@ alloc_scq(struct idt77252_dev *card, int
 {
struct scq_info *scq;
 
-   scq = (struct scq_info *) kmalloc(sizeof(struct scq_info), GFP_KERNEL);
+   scq = (struct scq_info *) kzalloc(sizeof(struct scq_info), GFP_KERNEL);
if (!scq)
return NULL;
-   memset(scq, 0, sizeof(struct scq_info));
 
scq-base = pci_alloc_consistent(card-pcidev, SCQ_SIZE,
 scq-paddr);
@@ -2142,10 +2141,9 @@ 

[PATCH 1/2][ATM]: keep atmsvc failure messages quiet

2006-03-02 Thread chas williams - CONTRACTOR
please apply to 2.6.16 tree -- thanks!

[ATM]: keep atmsvc failure messages quiet

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 02ffc5995920ec858bd6cde41dff81237ca1a28f
tree 97f2f65c624bfa45e9e28f50fe024317c9cd1797
parent bb03a1d97c7f1fff1cb7330c13e9cf5ded8aaa3e
author chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 11:03:53 -0500
committer chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 11:03:53 
-0500

 net/atm/signaling.c |   10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/net/atm/signaling.c b/net/atm/signaling.c
--- a/net/atm/signaling.c
+++ b/net/atm/signaling.c
@@ -39,25 +39,19 @@ static DECLARE_WAIT_QUEUE_HEAD(sigd_slee
 static void sigd_put_skb(struct sk_buff *skb)
 {
 #ifdef WAIT_FOR_DEMON
-   static unsigned long silence;
DECLARE_WAITQUEUE(wait,current);
 
add_wait_queue(sigd_sleep,wait);
while (!sigd) {
set_current_state(TASK_UNINTERRUPTIBLE);
-   if (time_after(jiffies, silence) || silence == 0) {
-   printk(KERN_INFO atmsvc: waiting for signaling demon 
-   ...\n);
-   silence = (jiffies+30*HZ)|1;
-   }
+   DPRINTK(atmsvc: waiting for signaling demon...\n);
schedule();
}
current-state = TASK_RUNNING;
remove_wait_queue(sigd_sleep,wait);
 #else
if (!sigd) {
-   if (net_ratelimit())
-   printk(KERN_WARNING atmsvc: no signaling demon\n);
+   DPRINTK(atmsvc: no signaling demon\n);
kfree_skb(skb);
return;
}
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/11][ATM]: always return the first interface for ATM_ITF_ANY

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: always return the first interface for ATM_ITF_ANY

From: Mitchell Blank Jr [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit d86bc37841a99650cb17debfaa1ed59f7a9a4431
tree f8b60fc436ac81bfaca70363f441aaf44aa123ba
parent 03153af17b6af2d0cd77d20431b847724c594c3e
author chas williams [EMAIL PROTECTED](none) Sat, 26 Nov 2005 15:44:02 -0500
committer chas williams [EMAIL PROTECTED](none) Sat, 26 Nov 2005 15:44:02 
-0500

 net/atm/common.c |   30 ++
 1 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -423,33 +423,23 @@ int vcc_connect(struct socket *sock, int
if (vcc-qos.txtp.traffic_class == ATM_ANYCLASS ||
vcc-qos.rxtp.traffic_class == ATM_ANYCLASS)
return -EINVAL;
-   if (itf != ATM_ITF_ANY) {
+   if (likely(itf != ATM_ITF_ANY)) {
dev = atm_dev_lookup(itf);
-   if (!dev)
-   return -ENODEV;
-   error = __vcc_connect(vcc, dev, vpi, vci);
-   if (error) {
-   atm_dev_put(dev);
-   return error;
-   }
} else {
-   struct list_head *p, *next;
-
dev = NULL;
spin_lock(atm_dev_lock);
-   list_for_each_safe(p, next, atm_devs) {
-   dev = list_entry(p, struct atm_dev, dev_list);
+   if (!list_empty(atm_devs)) {
+   dev = list_entry(atm_devs.next, struct atm_dev, 
dev_list);
atm_dev_hold(dev);
-   spin_unlock(atm_dev_lock);
-   if (!__vcc_connect(vcc, dev, vpi, vci))
-   break;
-   atm_dev_put(dev);
-   dev = NULL;
-   spin_lock(atm_dev_lock);
}
spin_unlock(atm_dev_lock);
-   if (!dev)
-   return -ENODEV;
+   }
+   if (!dev)
+   return -ENODEV;
+   error = __vcc_connect(vcc, dev, vpi, vci);
+   if (error) {
+   atm_dev_put(dev);
+   return error;
}
if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC)
set_bit(ATM_VF_PARTIAL,vcc-flags);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/11][ATM]: [lanai] better constification

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: [lanai] better constification

Signed-off-by: Mitchell Blank Jr [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit f3dd8fc6b754e8f52a14e538e9d149ffd11020e6
tree ccbd02ec6064ff8caff9291fbb512f0ab0b72e11
parent b98f2b10207afc5fe6be9c382d0a187e65f46756
author chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:26:40 -0500
committer chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:26:40 
-0500

 drivers/atm/lanai.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -305,7 +305,7 @@ struct lanai_dev {
  * vci with their bit set
  */
 static void vci_bitfield_iterate(struct lanai_dev *lanai,
-   /*const*/ unsigned long *lp,
+   const unsigned long *lp,
void (*func)(struct lanai_dev *,vci_t vci))
 {
vci_t vci = find_first_bit(lp, NUM_VCI);
@@ -951,7 +951,7 @@ static int __devinit eeprom_read(struct 
 /* read a big-endian 4-byte value out of eeprom */
 static inline u32 eeprom_be4(const struct lanai_dev *lanai, int address)
 {
-   return be32_to_cpup((u32 *) (lanai-eeprom[address]));
+   return be32_to_cpup((const u32 *) lanai-eeprom[address]);
 }
 
 /* Checksum/validate EEPROM contents */
@@ -1160,7 +1160,7 @@ static inline int vcc_tx_space(const str
 }
 
 /* test if VCC is currently backlogged */
-static inline int vcc_is_backlogged(/*const*/ struct lanai_vcc *lvcc)
+static inline int vcc_is_backlogged(const struct lanai_vcc *lvcc)
 {
return !skb_queue_empty(lvcc-tx.backlog);
 }
@@ -1395,7 +1395,8 @@ static void vcc_rx_aal5(struct lanai_vcc
 {
int size;
struct sk_buff *skb;
-   /*const*/ u32 *x, *end = lvcc-rx.buf.start[endptr * 4];
+   const u32 *x;
+   u32 *end = lvcc-rx.buf.start[endptr * 4];
int n = ((unsigned long) end) - ((unsigned long) lvcc-rx.buf.ptr);
if (n  0)
n += lanai_buf_size(lvcc-rx.buf);
@@ -2111,7 +2112,7 @@ static int lanai_normalize_ci(struct lan
  * shifted by that much as we compute
  *
  */
-static int pcr_to_cbricg(/*const*/ struct atm_qos *qos)
+static int pcr_to_cbricg(const struct atm_qos *qos)
 {
int rounddown = 0;  /* 1 = Round PCR down, i.e. round ICG _up_ */
int x, icg, pcr = atm_pcr_goal(qos-txtp);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/11][ATM]: atm_pcr_goal() doesn't modify its argument's contents -- mark it as const

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: atm_pcr_goal() doesn't modify its argument's contents -- mark it as const

Signed-off-by: Mitchell Blank Jr [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit b98f2b10207afc5fe6be9c382d0a187e65f46756
tree db44e643a4b65fa0e6b0c75553281768c1c7e381
parent 91e7c544b889ffeb066a8880b6b7b5e451ca23a9
author chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:22:06 -0500
committer chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:22:06 
-0500

 include/linux/atmdev.h |2 +-
 net/atm/atm_misc.c |   11 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -468,7 +468,7 @@ static inline void atm_dev_put(struct at
 int atm_charge(struct atm_vcc *vcc,int truesize);
 struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
 gfp_t gfp_flags);
-int atm_pcr_goal(struct atm_trafprm *tp);
+int atm_pcr_goal(const struct atm_trafprm *tp);
 
 void vcc_release_async(struct atm_vcc *vcc, int reply);
 
diff --git a/net/atm/atm_misc.c b/net/atm/atm_misc.c
--- a/net/atm/atm_misc.c
+++ b/net/atm/atm_misc.c
@@ -74,11 +74,14 @@ struct sk_buff *atm_alloc_charge(struct 
  */
 
 
-int atm_pcr_goal(struct atm_trafprm *tp)
+int atm_pcr_goal(const struct atm_trafprm *tp)
 {
-   if (tp-pcr  tp-pcr != ATM_MAX_PCR) return -tp-pcr;
-   if (tp-min_pcr  !tp-pcr) return tp-min_pcr;
-   if (tp-max_pcr != ATM_MAX_PCR) return -tp-max_pcr;
+   if (tp-pcr  tp-pcr != ATM_MAX_PCR)
+   return -tp-pcr;
+   if (tp-min_pcr  !tp-pcr)
+   return tp-min_pcr;
+   if (tp-max_pcr != ATM_MAX_PCR)
+   return -tp-max_pcr;
return 0;
 }
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/11][ATM]: [lanai] lanai missing unregister

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: [lanai] lanai missing unregister

Signed-off-by: Dave Jones [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 3d4d9c94921f1239ec36edc47aa830d567c9a17d
tree 98649d1ac17a5dcf8943f0c47c1ed509de047b5d
parent f3dd8fc6b754e8f52a14e538e9d149ffd11020e6
author chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:50:31 -0500
committer chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:50:31 
-0500

 drivers/atm/lanai.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -2761,6 +2761,7 @@ static void __exit lanai_module_exit(voi
 * gone, so there isn't much to do
 */
DPRINTK(cleanup_module()\n);
+   pci_unregister_driver(lanai_driver);
 }
 
 module_init(lanai_module_init);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/11][ATM]: drivers/atm/atmdev_init.c no longer necessary

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: drivers/atm/atmdev_init.c no longer necessary

From: Jan Pieter [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit b783e46fa913af5ab173008174d8908b5c94
tree d64b05cdcbc8c3ec3bafb3bfeea5f4c054a5e787
parent 3d4d9c94921f1239ec36edc47aa830d567c9a17d
author chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:55:54 -0500
committer chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:55:54 
-0500

 drivers/atm/atmdev_init.c |   54 -
 1 files changed, 0 insertions(+), 54 deletions(-)

diff --git a/drivers/atm/atmdev_init.c b/drivers/atm/atmdev_init.c
deleted file mode 100644
--- a/drivers/atm/atmdev_init.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* drivers/atm/atmdev_init.c - ATM device driver initialization */
- 
-/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
- 
-
-#include linux/config.h
-#include linux/init.h
-
-
-#ifdef CONFIG_ATM_ZATM
-extern int zatm_detect(void);
-#endif
-#ifdef CONFIG_ATM_AMBASSADOR
-extern int amb_detect(void);
-#endif
-#ifdef CONFIG_ATM_HORIZON
-extern int hrz_detect(void);
-#endif
-#ifdef CONFIG_ATM_FORE200E
-extern int fore200e_detect(void);
-#endif
-#ifdef CONFIG_ATM_LANAI
-extern int lanai_detect(void);
-#endif
-
-
-/*
- * For historical reasons, atmdev_init returns the number of devices found.
- * Note that some detections may not go via atmdev_init (e.g. eni.c), so this
- * number is meaningless.
- */
-
-int __init atmdev_init(void)
-{
-   int devs;
-
-   devs = 0;
-#ifdef CONFIG_ATM_ZATM
-   devs += zatm_detect();
-#endif
-#ifdef CONFIG_ATM_AMBASSADOR
-   devs += amb_detect();
-#endif
-#ifdef CONFIG_ATM_HORIZON
-   devs += hrz_detect();
-#endif
-#ifdef CONFIG_ATM_FORE200E
-   devs += fore200e_detect();
-#endif
-#ifdef CONFIG_ATM_LANAI
-   devs += lanai_detect();
-#endif
-   return devs;
-}
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/11][ATM]: attempt to autoload atm drivers

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: attempt to autoload atm drivers

From: Mitchell Blank Jr [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 4727673d1a795cd8d5dee1904571b76d2ba532ed
tree bfce97de4ef2bef8ac8ebc9853a449f9ce5426d6
parent d86bc37841a99650cb17debfaa1ed59f7a9a4431
author chas williams [EMAIL PROTECTED](none) Sat, 26 Nov 2005 15:47:14 -0500
committer chas williams [EMAIL PROTECTED](none) Sat, 26 Nov 2005 15:47:14 
-0500

 net/atm/common.c|2 +-
 net/atm/resources.c |3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -424,7 +424,7 @@ int vcc_connect(struct socket *sock, int
vcc-qos.rxtp.traffic_class == ATM_ANYCLASS)
return -EINVAL;
if (likely(itf != ATM_ITF_ANY)) {
-   dev = atm_dev_lookup(itf);
+   dev = try_then_request_module(atm_dev_lookup(itf), 
atm-device-%d, itf);
} else {
dev = NULL;
spin_lock(atm_dev_lock);
diff --git a/net/atm/resources.c b/net/atm/resources.c
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -245,7 +245,8 @@ int atm_dev_ioctl(unsigned int cmd, void
if (get_user(number, sioc-number))
return -EFAULT;
 
-   if (!(dev = atm_dev_lookup(number)))
+   if (!(dev = try_then_request_module(atm_dev_lookup(number),
+   atm-device-%d, number)))
return -ENODEV;

switch (cmd) {
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/11][ATM]: linux/config.h only needed for #ifdef __KERNEL__ section

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: linux/config.h only needed for #ifdef __KERNEL__ section

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 76033f818bc407a871d82a69d60b3a6995c70ae8
tree bdbed6e0ad50e7bdf237f7b3c6fa3182d0dd171e
parent 3bce08ae95300db3031280bed31ec8c92e915eaa
author chas williams [EMAIL PROTECTED](none) Fri, 25 Nov 2005 20:29:37 -0500
committer chas williams [EMAIL PROTECTED](none) Fri, 25 Nov 2005 20:29:37 
-0500

 include/linux/atmdev.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -7,7 +7,6 @@
 #define LINUX_ATMDEV_H
 
 
-#include linux/config.h
 #include linux/atmapi.h
 #include linux/atm.h
 #include linux/atmioc.h
@@ -210,6 +209,7 @@ struct atm_cirange {
 
 #ifdef __KERNEL__
 
+#include linux/config.h
 #include linux/wait.h /* wait_queue_head_t */
 #include linux/time.h /* struct timeval */
 #include linux/net.h
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/11][ATM]: [lanai] kill lanai_ioctl() which just contains some old debugging code

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: [lanai] kill lanai_ioctl() which just contains some old debugging code

Signed-off-by: Mitchell Blank Jr [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit aebb4adaea614b537e361bdff15f23cf2b0137a3
tree 669168c28511fe168b42843b9b6c5ead89a7ee48
parent 4727673d1a795cd8d5dee1904571b76d2ba532ed
author chas williams [EMAIL PROTECTED](none) Mon, 28 Nov 2005 13:34:42 -0500
committer chas williams [EMAIL PROTECTED](none) Mon, 28 Nov 2005 13:34:42 
-0500

 drivers/atm/lanai.c |   90 +--
 1 files changed, 1 insertions(+), 89 deletions(-)

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -39,7 +39,7 @@
  * o  lanai_change_qos() isn't written yet
  *
  * o  There aren't any ioctl's yet -- I'd like to eventually support
- *setting loopback and LED modes that way.  (see lanai_ioctl)
+ *setting loopback and LED modes that way.
  *
  * o  If the segmentation engine or DMA gets shut down we should restart
  *card as per section 17.0i.  (see lanai_reset)
@@ -2435,93 +2435,6 @@ static int lanai_open(struct atm_vcc *at
return result;
 }
 
-#if 0
-/* ioctl operations for card */
-/* NOTE: these are all DEBUGGING ONLY currently */
-static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void __user 
*arg)
-{
-   int result = 0;
-   struct lanai_dev *lanai = (struct lanai_dev *) atmdev-dev_data;
-   switch(cmd) {
-   case 2106275:
-   shutdown_atm_dev(atmdev);
-   return 0;
-   case 220: {
-   unsigned long flags;
-   spin_lock_irqsave(lanai-servicelock, flags);
-   run_service(lanai);
-   spin_unlock_irqrestore(lanai-servicelock, flags);
-   return 0; }
-   case 222:
-   get_statistics(lanai);
-   return 0;
-   case 223: {
-   unsigned int i;
-   for (i = 0; i = 0x5C ; i += 4) {
-   if (i==0x48) /* Write-only butt reg */
-   continue;
-   printk(KERN_CRIT DEV_LABEL   0x%02X: 
-   0x%08X\n, i,
-   (unsigned int) readl(lanai-base + i));
-   barrier(); mb();
-   pcistatus_check(lanai, 0);
-   barrier(); mb();
-   }
-   return 0; }
-   case 224: {
-   u8 b;
-   u16 w;
-   u32 dw;
-   struct pci_dev *pci = lanai-pci;
-   (void) pci_read_config_word(pci, PCI_VENDOR_ID, w);
-   DPRINTK(vendor = 0x%X\n, (unsigned int) w);
-   (void) pci_read_config_word(pci, PCI_DEVICE_ID, w);
-   DPRINTK(device = 0x%X\n, (unsigned int) w);
-   (void) pci_read_config_word(pci, PCI_COMMAND, w);
-   DPRINTK(command = 0x%X\n, (unsigned int) w);
-   (void) pci_read_config_word(pci, PCI_STATUS, w);
-   DPRINTK(status = 0x%X\n, (unsigned int) w);
-   (void) pci_read_config_dword(pci,
-   PCI_CLASS_REVISION, dw);
-   DPRINTK(class/revision = 0x%X\n, (unsigned int) dw);
-   (void) pci_read_config_byte(pci,
-   PCI_CACHE_LINE_SIZE, b);
-   DPRINTK(cache line size = 0x%X\n, (unsigned int) b);
-   (void) pci_read_config_byte(pci, PCI_LATENCY_TIMER, b);
-   DPRINTK(latency = %d (0x%X)\n,
-   (int) b, (unsigned int) b);
-   (void) pci_read_config_byte(pci, PCI_HEADER_TYPE, b);
-   DPRINTK(header type = 0x%X\n, (unsigned int) b);
-   (void) pci_read_config_byte(pci, PCI_BIST, b);
-   DPRINTK(bist = 0x%X\n, (unsigned int) b);
-   /* skipping a few here */
-   (void) pci_read_config_byte(pci,
-   PCI_INTERRUPT_LINE, b);
-   DPRINTK(pci_int_line = 0x%X\n, (unsigned int) b);
-   (void) pci_read_config_byte(pci,
-   PCI_INTERRUPT_PIN, b);
-   DPRINTK(pci_int_pin = 0x%X\n, (unsigned int) b);
-   (void) pci_read_config_byte(pci, PCI_MIN_GNT, b);
-   DPRINTK(min_gnt = 0x%X\n, (unsigned int) b);
-   (void) pci_read_config_byte(pci, PCI_MAX_LAT, b);
-   DPRINTK(max_lat = 

[PATCH 9/11][ATM]: avoid race conditions related to atm_devs list

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: avoid race conditions related to atm_devs list

Use semaphore to protect atm_devs list, as no one need access to it from
interrupt context.  Avoid race conditions between atm_dev_register(),
atm_dev_lookup() and atm_dev_deregister().  Fix double spin_unlock() bug.

Signed-off-by: Stanislaw Gruszka [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit e1a493214355e544068560be5a2aaa144193bd3f
tree f15a9857a54801018951bd52f6b2081b10debcb2
parent aebb4adaea614b537e361bdff15f23cf2b0137a3
author chas williams [EMAIL PROTECTED](none) Mon, 28 Nov 2005 15:50:29 -0500
committer chas williams [EMAIL PROTECTED](none) Mon, 28 Nov 2005 15:50:29 
-0500

 net/atm/common.c|4 ++--
 net/atm/resources.c |   36 +---
 net/atm/resources.h |3 +--
 3 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -427,12 +427,12 @@ int vcc_connect(struct socket *sock, int
dev = try_then_request_module(atm_dev_lookup(itf), 
atm-device-%d, itf);
} else {
dev = NULL;
-   spin_lock(atm_dev_lock);
+   down(atm_dev_mutex);
if (!list_empty(atm_devs)) {
dev = list_entry(atm_devs.next, struct atm_dev, 
dev_list);
atm_dev_hold(dev);
}
-   spin_unlock(atm_dev_lock);
+   up(atm_dev_mutex);
}
if (!dev)
return -ENODEV;
diff --git a/net/atm/resources.c b/net/atm/resources.c
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -25,7 +25,7 @@
 
 
 LIST_HEAD(atm_devs);
-DEFINE_SPINLOCK(atm_dev_lock);
+DECLARE_MUTEX(atm_dev_mutex);
 
 static struct atm_dev *__alloc_atm_dev(const char *type)
 {
@@ -52,7 +52,7 @@ static struct atm_dev *__atm_dev_lookup(
 
list_for_each(p, atm_devs) {
dev = list_entry(p, struct atm_dev, dev_list);
-   if ((dev-ops)  (dev-number == number)) {
+   if (dev-number == number) {
atm_dev_hold(dev);
return dev;
}
@@ -64,9 +64,9 @@ struct atm_dev *atm_dev_lookup(int numbe
 {
struct atm_dev *dev;
 
-   spin_lock(atm_dev_lock);
+   down(atm_dev_mutex);
dev = __atm_dev_lookup(number);
-   spin_unlock(atm_dev_lock);
+   up(atm_dev_mutex);
return dev;
 }
 
@@ -81,11 +81,11 @@ struct atm_dev *atm_dev_register(const c
type);
return NULL;
}
-   spin_lock(atm_dev_lock);
+   down(atm_dev_mutex);
if (number != -1) {
if ((inuse = __atm_dev_lookup(number))) {
atm_dev_put(inuse);
-   spin_unlock(atm_dev_lock);
+   up(atm_dev_mutex);
kfree(dev);
return NULL;
}
@@ -105,19 +105,17 @@ struct atm_dev *atm_dev_register(const c
memset(dev-flags, 0, sizeof(dev-flags));
memset(dev-stats, 0, sizeof(dev-stats));
atomic_set(dev-refcnt, 1);
-   list_add_tail(dev-dev_list, atm_devs);
-   spin_unlock(atm_dev_lock);
 
if (atm_proc_dev_register(dev)  0) {
printk(KERN_ERR atm_dev_register: 
   atm_proc_dev_register failed for dev %s\n,
   type);
-   spin_lock(atm_dev_lock);
-   list_del(dev-dev_list);
-   spin_unlock(atm_dev_lock);
+   up(atm_dev_mutex);
kfree(dev);
return NULL;
}
+   list_add_tail(dev-dev_list, atm_devs);
+   up(atm_dev_mutex);
 
return dev;
 }
@@ -129,9 +127,9 @@ void atm_dev_deregister(struct atm_dev *
 
atm_proc_dev_deregister(dev);
 
-   spin_lock(atm_dev_lock);
+   down(atm_dev_mutex);
list_del(dev-dev_list);
-   spin_unlock(atm_dev_lock);
+   up(atm_dev_mutex);
 
 warning_time = jiffies;
 while (atomic_read(dev-refcnt) != 1) {
@@ -211,16 +209,16 @@ int atm_dev_ioctl(unsigned int cmd, void
return -EFAULT;
if (get_user(len, iobuf-length))
return -EFAULT;
-   spin_lock(atm_dev_lock);
+   down(atm_dev_mutex);
list_for_each(p, atm_devs)
size += sizeof(int);
if (size  len) {
-   spin_unlock(atm_dev_lock);
+   up(atm_dev_mutex);
return -E2BIG;
}
tmp_buf = kmalloc(size, GFP_ATOMIC);
if (!tmp_buf) {
-   spin_unlock(atm_dev_lock);
+   

[PATCH 11/11][ATM]: [adummy] dummy ATM driver (similar to net/dummy)

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: [adummy] dummy ATM driver (similar to net/dummy)

Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit 0b30678d4e789caae00d99fe5d5a330225c7b269
tree 81cb18c29443c002db658b7f0fd919b02060cbf2
parent d47a837e50bd53156dcfdef1fa58f4e5d7285d8c
author chas williams [EMAIL PROTECTED](none) Tue, 29 Nov 2005 12:52:59 -0500
committer chas williams [EMAIL PROTECTED](none) Tue, 29 Nov 2005 12:52:59 
-0500

 drivers/atm/Kconfig  |7 ++
 drivers/atm/Makefile |1 
 drivers/atm/adummy.c |  168 ++
 3 files changed, 176 insertions(+), 0 deletions(-)

diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
--- a/drivers/atm/Kconfig
+++ b/drivers/atm/Kconfig
@@ -5,6 +5,13 @@
 menu ATM drivers
depends on NETDEVICES  ATM
 
+config ATM_DUMMY
+   tristate Dummy ATM driver
+   depends on ATM
+   help
+ Dummy ATM driver. Useful for proxy signalling, testing,
+ and development.  If unsure, say N.
+
 config ATM_TCP
tristate ATM over TCP
depends on INET  ATM
diff --git a/drivers/atm/Makefile b/drivers/atm/Makefile
--- a/drivers/atm/Makefile
+++ b/drivers/atm/Makefile
@@ -31,6 +31,7 @@ ifeq ($(CONFIG_ATM_IDT77252_USE_SUNI),y)
   obj-$(CONFIG_ATM_IDT77252)   += suni.o
 endif
 
+obj-$(CONFIG_ATM_DUMMY)+= adummy.o
 obj-$(CONFIG_ATM_TCP)  += atmtcp.o
 obj-$(CONFIG_ATM_FIRESTREAM)   += firestream.o
 obj-$(CONFIG_ATM_LANAI)+= lanai.o
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
new file mode 100644
--- /dev/null
+++ b/drivers/atm/adummy.c
@@ -0,0 +1,168 @@
+/*
+ * adummy.c: a dummy ATM driver
+ */
+
+#include linux/config.h
+#include linux/module.h
+#include linux/version.h
+#include linux/kernel.h
+#include linux/skbuff.h
+#include linux/pci.h
+#include linux/errno.h
+#include linux/types.h
+#include linux/string.h
+#include linux/delay.h
+#include linux/init.h
+#include linux/mm.h
+#include linux/sched.h
+#include linux/timer.h
+#include linux/interrupt.h
+#include asm/io.h
+#include asm/byteorder.h
+#include asm/uaccess.h
+
+#include linux/atmdev.h
+#include linux/atm.h
+#include linux/sonet.h
+
+/* version definition */
+
+#define DRV_VERSION 1.0
+
+#define DEV_LABEL adummy
+
+#define ADUMMY_DEV(dev) ((struct adummy_dev *) (dev)-dev_data)
+
+struct adummy_dev {
+   struct atm_dev *atm_dev;
+
+   struct list_head entry;
+};
+
+/* globals */
+
+static LIST_HEAD(adummy_devs);
+
+static int __init
+adummy_start(struct atm_dev *dev)
+{
+   dev-ci_range.vpi_bits = 4;
+   dev-ci_range.vci_bits = 12;
+
+   return 0;
+}
+
+static int
+adummy_open(struct atm_vcc *vcc)
+{
+   short vpi = vcc-vpi;
+   int vci = vcc-vci;
+
+   if (vci == ATM_VCI_UNSPEC || vpi == ATM_VPI_UNSPEC)
+   return 0;
+
+   set_bit(ATM_VF_ADDR, vcc-flags);
+   set_bit(ATM_VF_READY, vcc-flags);
+
+   return 0;
+}
+
+static void
+adummy_close(struct atm_vcc *vcc)
+{
+   clear_bit(ATM_VF_READY, vcc-flags);
+   clear_bit(ATM_VF_ADDR, vcc-flags);
+}
+
+static int
+adummy_send(struct atm_vcc *vcc, struct sk_buff *skb)
+{
+   if (vcc-pop)
+   vcc-pop(vcc, skb);
+   else
+   dev_kfree_skb_any(skb);
+   atomic_inc(vcc-stats-tx);
+
+   return 0;
+}
+
+static int
+adummy_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
+{
+   int left = *pos;
+
+   if (!left--)
+   return sprintf(page, version %s\n, DRV_VERSION);
+
+   return 0;
+}
+
+static struct atmdev_ops adummy_ops =
+{
+   .open = adummy_open,
+   .close =adummy_close,   
+   .send = adummy_send,
+   .proc_read =adummy_proc_read,
+   .owner =THIS_MODULE
+};
+
+static int __init adummy_init(void)
+{
+   struct atm_dev *atm_dev;
+   struct adummy_dev *adummy_dev;
+   int err = 0;
+
+   printk(KERN_ERR adummy: version %s\n, DRV_VERSION);
+
+   adummy_dev = (struct adummy_dev *) kmalloc(sizeof(struct adummy_dev),
+  GFP_KERNEL);
+   if (!adummy_dev) {
+   printk(KERN_ERR DEV_LABEL : kmalloc() failed\n);
+   err = -ENOMEM;
+   goto out;
+   }
+   memset(adummy_dev, 0, sizeof(struct adummy_dev));
+
+   atm_dev = atm_dev_register(DEV_LABEL, adummy_ops, -1, 0);
+   if (!atm_dev) {
+   printk(KERN_ERR DEV_LABEL : atm_dev_register() failed\n);
+   err = -ENODEV;
+   goto out_kfree;
+   }
+
+   adummy_dev-atm_dev = atm_dev;
+   atm_dev-dev_data = adummy_dev;
+
+   if (adummy_start(atm_dev)) {
+   printk(KERN_ERR DEV_LABEL : adummy_start() failed\n);
+   err = -ENODEV;
+   goto out_unregister;
+   }
+
+   list_add(adummy_dev-entry, adummy_devs);
+out:
+   return err;
+
+out_unregister:
+   atm_dev_deregister(atm_dev);
+out_kfree:
+

[PATCH 10/11][ATM]: deregistration removes device from atm_devs list immediately

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: deregistration removes device from atm_devs list immediately

atm_dev_deregister() removes device from atm_dev list immediately to
prevent operations on a phantom device.  Decision to free device based
only on -refcnt  now. Remove shutdown_atm_dev() use atm_dev_deregister()
instead.  atm_dev_deregister() also asynchronously releases all vccs
related to device.

Signed-off-by: Stanislaw Gruszka [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 66f9fb08f7ee005751eaec22e82e6d314f340036
tree c7e15743a39a77892e9df753be58fb5dbc64b1f1
parent e1a493214355e544068560be5a2aaa144193bd3f
author chas williams [EMAIL PROTECTED](none) Tue, 29 Nov 2005 12:37:25 -0500
committer chas williams [EMAIL PROTECTED](none) Tue, 29 Nov 2005 12:37:25 
-0500

 drivers/atm/atmtcp.c |   20 ++--
 drivers/usb/atm/usbatm.c |4 ++--
 include/linux/atmdev.h   |   14 +++---
 net/atm/common.c |   30 +++---
 net/atm/common.h |2 ++
 net/atm/resources.c  |   37 +++--
 6 files changed, 51 insertions(+), 56 deletions(-)

diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -246,10 +246,6 @@ static void atmtcp_c_close(struct atm_vc
 {
struct atm_dev *atmtcp_dev;
struct atmtcp_dev_data *dev_data;
-   struct sock *s;
-   struct hlist_node *node;
-   struct atm_vcc *walk;
-   int i;
 
atmtcp_dev = (struct atm_dev *) vcc-dev_data;
dev_data = PRIV(atmtcp_dev);
@@ -257,20 +253,8 @@ static void atmtcp_c_close(struct atm_vc
if (dev_data-persist) return;
atmtcp_dev-dev_data = NULL;
kfree(dev_data);
-   shutdown_atm_dev(atmtcp_dev);
+   atm_dev_deregister(atmtcp_dev);
vcc-dev_data = NULL;
-   read_lock(vcc_sklist_lock);
-   for(i = 0; i  VCC_HTABLE_SIZE; ++i) {
-   struct hlist_head *head = vcc_hash[i];
-
-   sk_for_each(s, node, head) {
-   walk = atm_sk(s);
-   if (walk-dev != atmtcp_dev)
-   continue;
-   wake_up(s-sk_sleep);
-   }
-   }
-   read_unlock(vcc_sklist_lock);
module_put(THIS_MODULE);
 }
 
@@ -450,7 +434,7 @@ static int atmtcp_remove_persistent(int 
if (PRIV(dev)-vcc) return 0;
kfree(dev_data);
atm_dev_put(dev);
-   shutdown_atm_dev(dev);
+   atm_dev_deregister(dev);
return 0;
 }
 
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -879,7 +879,7 @@ static int usbatm_atm_init(struct usbatm
 
  fail:
instance-atm_dev = NULL;
-   shutdown_atm_dev(atm_dev); /* usbatm_atm_dev_close will eventually be 
called */
+   atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be 
called */
return ret;
 }
 
@@ -1164,7 +1164,7 @@ void usbatm_usb_disconnect(struct usb_in
 
/* ATM finalize */
if (instance-atm_dev)
-   shutdown_atm_dev(instance-atm_dev);
+   atm_dev_deregister(instance-atm_dev);
 
usbatm_put_instance(instance);  /* taken in usbatm_usb_probe */
 }
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -274,7 +274,7 @@ enum {
 
 
 enum {
-   ATM_DF_CLOSE,   /* close device when last VCC is closed */
+   ATM_DF_REMOVED, /* device was removed from atm_devs list */
 };
 
 
@@ -415,7 +415,6 @@ struct atm_dev *atm_dev_register(const c
 int number,unsigned long *flags); /* number == -1: pick first available */
 struct atm_dev *atm_dev_lookup(int number);
 void atm_dev_deregister(struct atm_dev *dev);
-void shutdown_atm_dev(struct atm_dev *dev);
 void vcc_insert_socket(struct sock *sk);
 
 
@@ -457,11 +456,12 @@ static inline void atm_dev_hold(struct a
 
 static inline void atm_dev_put(struct atm_dev *dev)
 {
-   atomic_dec(dev-refcnt);
-
-   if ((atomic_read(dev-refcnt) == 1) 
-   test_bit(ATM_DF_CLOSE,dev-flags))
-   shutdown_atm_dev(dev);
+   if (atomic_dec_and_test(dev-refcnt)) {
+   BUG_ON(!test_bit(ATM_DF_REMOVED, dev-flags));
+   if (dev-ops-dev_close)
+   dev-ops-dev_close(dev);
+   kfree(dev);
+   }
 }
 
 
diff --git a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -221,6 +221,29 @@ void vcc_release_async(struct atm_vcc *v
 EXPORT_SYMBOL(vcc_release_async);
 
 
+void atm_dev_release_vccs(struct atm_dev *dev)
+{
+   int i;
+
+   write_lock_irq(vcc_sklist_lock);
+   for (i = 0; i  VCC_HTABLE_SIZE; i++) {
+   struct hlist_head *head = vcc_hash[i];
+   struct hlist_node *node, *tmp;
+   struct sock *s;
+