[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-atm
Subject: Killing the cli() from net/atm/lec.c
From: Heikki Vatiainen <hessu () cs ! tut ! fi>
Date: 2000-10-31 20:53:33
[Download RAW message or body]
This is my first attempt to kill all the cli()s from the LANE
client's kernel part, linux/net/atm/lec.c. I have converted the
locking of the critical resource, LE_ARP table, to spin locks and
would like to get comments about the correctness of my patch.
The LE_ARP table is modified by zeppelin, vcc->push and the timer
which cleans up the aged entries. Since some of the ATM NIC drivers
use tasklets and some don't, I gather the code is dealing with
locking involving two or three differenct contexts; user, soft or
hard irq and bottom half (treated like soft irq).
I have read Rusty Russel's kernel locking guide [1], including the
further reading referenced by [1], and with that information I came
up with locking that uses _irq versions of reader/writer locks
everywhere except lec_arp_check_empties() which is only called from
vcc->push. My reasoning is that vcc->push is always called from
hard irq or from a tasklet so there's no need do disable the irqs.
Otherwise it's always safe and not incorrect to disable the local
irq.
I do not have a real SMP box available now, but a single CPU box
with SMP enabled has worked so far. The only problem I have had is
the ENI driver doing "0+6 RX left" and similar when running
netperf towards the box at line speed.
[1] http://netfilter.filewatcher.org/unreliable-guides/index.html
diff -u -r /usr/src/linux-2.4.0-test9/net/atm/lec.c ./lec.c
--- /usr/src/linux-2.4.0-test9/net/atm/lec.c Fri Jul 7 07:37:24 2000
+++ ./lec.c Mon Oct 23 16:26:37 2000
@@ -65,7 +65,7 @@
static void lec_init(struct net_device *dev);
static __inline__ struct lec_arp_table* lec_arp_find(struct lec_priv *priv,
unsigned char *mac_addr);
-static __inline__ int lec_arp_remove(struct lec_arp_table **lec_arp_tables,
+static __inline__ int lec_arp_remove(struct lec_priv *priv,
struct lec_arp_table *to_remove);
/* LANE2 functions */
static void lane2_associate_ind (struct net_device *dev, u8 *mac_address,
@@ -422,8 +422,10 @@
lec_flush_complete(priv, mesg->content.normal.flag);
break;
case l_narp_req: /* LANE2: see 7.1.35 in the lane2 spec */
+ write_lock_irq(&priv->arp_lock);
entry = lec_arp_find(priv, mesg->content.normal.mac_addr);
- lec_arp_remove(priv->lec_arp_tables, entry);
+ lec_arp_remove(priv, entry);
+ write_unlock_irq(&priv->arp_lock);
if (mesg->content.normal.no_source_le_narp)
break;
@@ -1037,18 +1039,6 @@
#define HASH(ch) (ch & (LEC_ARP_TABLE_SIZE -1))
-static __inline__ void
-lec_arp_lock(struct lec_priv *priv)
-{
- atomic_inc(&priv->lec_arp_lock_var);
-}
-
-static __inline__ void
-lec_arp_unlock(struct lec_priv *priv)
-{
- atomic_dec(&priv->lec_arp_lock_var);
-}
-
/*
* Initialization of arp-cache
*/
@@ -1060,6 +1050,7 @@
for (i=0;i<LEC_ARP_TABLE_SIZE;i++) {
priv->lec_arp_tables[i] = NULL;
}
+ rwlock_init(&priv->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;
@@ -1097,21 +1088,17 @@
* LANE2: Add to the end of the list to satisfy 8.1.13
*/
static __inline__ void
-lec_arp_put(struct lec_arp_table **lec_arp_tables,
+lec_arp_put(struct lec_priv *priv,
struct lec_arp_table *to_put)
{
unsigned short place;
- unsigned long flags;
struct lec_arp_table *tmp;
- save_flags(flags);
- cli();
-
place = HASH(to_put->mac_addr[ETH_ALEN-1]);
- tmp = lec_arp_tables[place];
+ tmp = priv->lec_arp_tables[place];
to_put->next = NULL;
if (tmp == NULL)
- lec_arp_tables[place] = to_put;
+ priv->lec_arp_tables[place] = to_put;
else { /* add to the end */
while (tmp->next)
@@ -1119,7 +1106,6 @@
tmp->next = to_put;
}
- restore_flags(flags);
DPRINTK("LEC_ARP: Added entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
0xff&to_put->mac_addr[0], 0xff&to_put->mac_addr[1],
0xff&to_put->mac_addr[2], 0xff&to_put->mac_addr[3],
@@ -1130,31 +1116,25 @@
* Remove entry from lec_arp_table
*/
static __inline__ int
-lec_arp_remove(struct lec_arp_table **lec_arp_tables,
+lec_arp_remove(struct lec_priv *priv,
struct lec_arp_table *to_remove)
{
unsigned short place;
struct lec_arp_table *tmp;
- unsigned long flags;
int remove_vcc=1;
- save_flags(flags);
- cli();
-
- if (!to_remove) {
- restore_flags(flags);
+ if (!to_remove)
return -1;
- }
+
place = HASH(to_remove->mac_addr[ETH_ALEN-1]);
- tmp = lec_arp_tables[place];
+ tmp = priv->lec_arp_tables[place];
if (tmp == to_remove) {
- lec_arp_tables[place] = tmp->next;
+ priv->lec_arp_tables[place] = tmp->next;
} else {
while(tmp && tmp->next != to_remove) {
tmp = tmp->next;
}
if (!tmp) {/* Entry was not found */
- restore_flags(flags);
return -1;
}
}
@@ -1168,7 +1148,7 @@
* ESI_FLUSH_PENDING, ESI_FORWARD_DIRECT
*/
for(place=0;place<LEC_ARP_TABLE_SIZE;place++) {
- for(tmp=lec_arp_tables[place];tmp!=NULL;tmp=tmp->next){
+ \
for(tmp=priv->lec_arp_tables[place];tmp!=NULL;tmp=tmp->next){
if (memcmp(tmp->atm_addr, to_remove->atm_addr,
ATM_ESA_LEN)==0) {
remove_vcc=0;
@@ -1180,7 +1160,6 @@
lec_arp_clear_vccs(to_remove);
}
skb_queue_purge(&to_remove->tx_wait); /* FIXME: good place for this? */
- restore_flags(flags);
DPRINTK("LEC_ARP: Removed entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
0xff&to_remove->mac_addr[0], 0xff&to_remove->mac_addr[1],
0xff&to_remove->mac_addr[2], 0xff&to_remove->mac_addr[3],
@@ -1365,12 +1344,10 @@
lec_arp_destroy(struct lec_priv *priv)
{
struct lec_arp_table *entry, *next;
- unsigned long flags;
int i;
- save_flags(flags);
- cli();
+ write_lock_irq(&priv->arp_lock);
del_timer(&priv->lec_arp_timer);
/*
@@ -1379,7 +1356,7 @@
for (i=0;i<LEC_ARP_TABLE_SIZE;i++) {
for(entry =priv->lec_arp_tables[i];entry != NULL; entry=next) {
next = entry->next;
- lec_arp_remove(priv->lec_arp_tables, entry);
+ lec_arp_remove(priv, entry);
kfree(entry);
}
}
@@ -1413,7 +1390,7 @@
priv->mcast_vcc = NULL;
memset(priv->lec_arp_tables, 0,
sizeof(struct lec_arp_table*)*LEC_ARP_TABLE_SIZE);
- restore_flags(flags);
+ write_unlock_irq(&priv->arp_lock);
}
@@ -1430,18 +1407,14 @@
DPRINTK("LEC_ARP: lec_arp_find :%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
mac_addr[0]&0xff, mac_addr[1]&0xff, mac_addr[2]&0xff,
mac_addr[3]&0xff, mac_addr[4]&0xff, mac_addr[5]&0xff);
- lec_arp_lock(priv);
place = HASH(mac_addr[ETH_ALEN-1]);
to_return = priv->lec_arp_tables[place];
while(to_return) {
- if (memcmp(mac_addr, to_return->mac_addr, ETH_ALEN) == 0) {
- lec_arp_unlock(priv);
+ if (memcmp(mac_addr, to_return->mac_addr, ETH_ALEN) == 0)
return to_return;
- }
to_return = to_return->next;
}
- lec_arp_unlock(priv);
return NULL;
}
@@ -1558,8 +1531,6 @@
lec_arp_check_expire(unsigned long data)
{
struct lec_priv *priv = (struct lec_priv *)data;
- struct lec_arp_table **lec_arp_tables =
- (struct lec_arp_table **)priv->lec_arp_tables;
struct lec_arp_table *entry, *next;
unsigned long now;
unsigned long time_to_check;
@@ -1567,59 +1538,58 @@
del_timer(&priv->lec_arp_timer);
- DPRINTK("lec_arp_check_expire %p,%d\n",priv,
- priv->lec_arp_lock_var.counter);
+ DPRINTK("lec_arp_check_expire %p,%u\n",priv,
+ spin_is_locked(&priv->lec_arp_lock));
DPRINTK("expire: eo:%p nf:%p\n",priv->lec_arp_empty_ones,
priv->lec_no_forward);
- if (!priv->lec_arp_lock_var.counter) {
- lec_arp_lock(priv);
- now = jiffies;
- for(i=0;i<LEC_ARP_TABLE_SIZE;i++) {
- for(entry = lec_arp_tables[i];entry != NULL;) {
- if ((entry->flags) & LEC_REMOTE_FLAG &&
- priv->topology_change)
- time_to_check=priv->forward_delay_time;
- else
- time_to_check = priv->aging_time;
-
- DPRINTK("About to expire: %lx - %lx > %lx\n",
- now,entry->last_used, time_to_check);
- if( time_after(now, entry->last_used+
- time_to_check) &&
- !(entry->flags & LEC_PERMANENT_FLAG) &&
- !(entry->mac_addr[0] & 0x01) ) { /* LANE2: \
7.1.20 */
- /* Remove entry */
- DPRINTK("LEC:Entry timed out\n");
- next = entry->next;
- lec_arp_remove(lec_arp_tables, entry);
- kfree(entry);
- entry = next;
- } else {
- /* Something else */
- if ((entry->status == ESI_VC_PENDING ||
- entry->status == ESI_ARP_PENDING)
- && time_after_eq(now,
- entry->timestamp +
- priv->max_unknown_frame_time)) {
- entry->timestamp = jiffies;
- entry->packets_flooded = 0;
- if (entry->status == ESI_VC_PENDING)
- send_to_lecd(priv, \
l_svc_setup, entry->mac_addr, entry->atm_addr, NULL);
- }
- if (entry->status == ESI_FLUSH_PENDING
- &&
- time_after_eq(now, entry->timestamp+
- priv->path_switching_delay)) {
- entry->last_used = jiffies;
- entry->status =
- ESI_FORWARD_DIRECT;
- }
- entry = entry->next;
+ write_lock_irq(&priv->arp_lock);
+ now = jiffies;
+ for(i=0;i<LEC_ARP_TABLE_SIZE;i++) {
+ for(entry = priv->lec_arp_tables[i];entry != NULL;) {
+ if ((entry->flags) & LEC_REMOTE_FLAG &&
+ priv->topology_change)
+ time_to_check=priv->forward_delay_time;
+ else
+ time_to_check = priv->aging_time;
+
+ DPRINTK("About to expire: %lx - %lx > %lx\n",
+ now,entry->last_used, time_to_check);
+ if( time_after(now, entry->last_used+
+ time_to_check) &&
+ !(entry->flags & LEC_PERMANENT_FLAG) &&
+ !(entry->mac_addr[0] & 0x01) ) { /* LANE2: 7.1.20 */
+ /* Remove entry */
+ DPRINTK("LEC:Entry timed out\n");
+ next = entry->next;
+ lec_arp_remove(priv, entry);
+ kfree(entry);
+ entry = next;
+ } else {
+ /* Something else */
+ if ((entry->status == ESI_VC_PENDING ||
+ entry->status == ESI_ARP_PENDING)
+ && time_after_eq(now,
+ entry->timestamp +
+ priv->max_unknown_frame_time)) \
{ + entry->timestamp = jiffies;
+ entry->packets_flooded = 0;
+ if (entry->status == ESI_VC_PENDING)
+ send_to_lecd(priv, l_svc_setup, \
entry->mac_addr, entry->atm_addr, NULL); + }
+ if (entry->status == ESI_FLUSH_PENDING
+ &&
+ time_after_eq(now, entry->timestamp+
+ priv->path_switching_delay)) {
+ entry->last_used = jiffies;
+ entry->status =
+ ESI_FORWARD_DIRECT;
}
+ entry = entry->next;
}
}
- lec_arp_unlock(priv);
}
+
+ write_unlock_irq(&priv->arp_lock);
priv->lec_arp_timer.expires = jiffies + LEC_ARP_REFRESH_INTERVAL;
add_timer(&priv->lec_arp_timer);
}
@@ -1647,6 +1617,7 @@
}
}
+ read_lock_irq(&priv->arp_lock);
entry = lec_arp_find(priv, mac_to_find);
if (entry) {
@@ -1654,6 +1625,7 @@
/* Connection Ok */
entry->last_used = jiffies;
*ret_entry = entry;
+ read_unlock_irq(&priv->arp_lock);
return entry->vcc;
}
/* Data direct VC not yet set up, check to see if the unknown
@@ -1664,6 +1636,7 @@
entry->packets_flooded<priv->maximum_unknown_frame_count) {
entry->packets_flooded++;
DPRINTK("LEC_ARP: Flooding..\n");
+ read_unlock_irq(&priv->arp_lock);
return priv->mcast_vcc;
}
/* We got here because entry->status == ESI_FLUSH_PENDING
@@ -1672,15 +1645,19 @@
*/
*ret_entry = entry;
DPRINTK("lec: entry->status %d entry->vcc %p\n", entry->status, \
entry->vcc); + read_unlock_irq(&priv->arp_lock);
return NULL;
} else {
/* No matching entry was found */
+ read_unlock_irq(&priv->arp_lock);
entry = make_entry(priv, mac_to_find);
DPRINTK("LEC_ARP: Making entry\n");
if (!entry) {
return priv->mcast_vcc;
}
- lec_arp_put(priv->lec_arp_tables, entry);
+ write_lock_irq(&priv->arp_lock);
+ lec_arp_put(priv, entry);
+ write_unlock_irq(&priv->arp_lock);
/* We want arp-request(s) to be sent */
entry->packets_flooded =1;
entry->status = ESI_ARP_PENDING;
@@ -1705,7 +1682,7 @@
struct lec_arp_table *entry, *next;
int i;
- lec_arp_lock(priv);
+ write_lock_irq(&priv->arp_lock);
DPRINTK("lec_addr_delete\n");
for(i=0;i<LEC_ARP_TABLE_SIZE;i++) {
for(entry=priv->lec_arp_tables[i];entry != NULL; entry=next) {
@@ -1713,14 +1690,14 @@
if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)
&& (permanent ||
!(entry->flags & LEC_PERMANENT_FLAG))) {
- lec_arp_remove(priv->lec_arp_tables, entry);
+ lec_arp_remove(priv, entry);
kfree(entry);
}
- lec_arp_unlock(priv);
+ write_unlock_irq(&priv->arp_lock);
return 0;
}
}
- lec_arp_unlock(priv);
+ write_unlock_irq(&priv->arp_lock);
return -1;
}
@@ -1740,12 +1717,15 @@
mac_addr[0],mac_addr[1],mac_addr[2],mac_addr[3],
mac_addr[4],mac_addr[5]);
+ write_lock_irq(&priv->arp_lock);
+
entry = lec_arp_find(priv, mac_addr);
- if (entry == NULL && targetless_le_arp)
+ if (entry == NULL && targetless_le_arp) {
+ write_unlock_irq(&priv->arp_lock);
return; /* LANE2: ignore targetless LE_ARPs for which
* we have no entry in the cache. 7.1.30
*/
- lec_arp_lock(priv);
+ }
if (priv->lec_arp_empty_ones) {
entry = priv->lec_arp_empty_ones;
if (!memcmp(entry->atm_addr, atm_addr, ATM_ESA_LEN)) {
@@ -1779,13 +1759,13 @@
entry->status = ESI_FORWARD_DIRECT;
memcpy(entry->mac_addr, mac_addr, ETH_ALEN);
entry->last_used = jiffies;
- lec_arp_put(priv->lec_arp_tables, entry);
+ lec_arp_put(priv, entry);
}
if (remoteflag)
entry->flags|=LEC_REMOTE_FLAG;
else
entry->flags&=~LEC_REMOTE_FLAG;
- lec_arp_unlock(priv);
+ write_unlock_irq(&priv->arp_lock);
DPRINTK("After update\n");
dump_arp_table(priv);
return;
@@ -1795,7 +1775,7 @@
if (!entry) {
entry = make_entry(priv, mac_addr);
entry->status = ESI_UNKNOWN;
- lec_arp_put(priv->lec_arp_tables, entry);
+ lec_arp_put(priv, entry);
/* Temporary, changes before end of function */
}
memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN);
@@ -1819,6 +1799,7 @@
}
}
}
+ write_unlock_irq(&priv->arp_lock);
if (remoteflag)
entry->flags|=LEC_REMOTE_FLAG;
else
@@ -1830,7 +1811,6 @@
}
DPRINTK("After update2\n");
dump_arp_table(priv);
- lec_arp_unlock(priv);
}
/*
@@ -1844,7 +1824,7 @@
struct lec_arp_table *entry;
int i, found_entry=0;
- lec_arp_lock(priv);
+ write_lock_irq(&priv->arp_lock);
if (ioc_data->receive == 2) {
/* Vcc for Multicast Forward. No timer, LANEv2 7.1.20 and 2.3.5.3 */
@@ -1852,8 +1832,8 @@
#if 0
entry = lec_arp_find(priv, bus_mac);
if (!entry) {
+ write_unlock_irq(&priv->arp_lock);
printk("LEC_ARP: Multicast entry not found!\n");
- lec_arp_unlock(priv);
return;
}
memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN);
@@ -1862,7 +1842,7 @@
#endif
entry = make_entry(priv, bus_mac);
if (entry == NULL) {
- lec_arp_unlock(priv);
+ write_unlock_irq(&priv->arp_lock);
return;
}
del_timer(&entry->timer);
@@ -1871,7 +1851,7 @@
entry->old_recv_push = old_push;
entry->next = priv->mcast_fwds;
priv->mcast_fwds = entry;
- lec_arp_unlock(priv);
+ write_unlock_irq(&priv->arp_lock);
return;
} else if (ioc_data->receive == 1) {
/* Vcc which we don't want to make default vcc, attach it
@@ -1898,7 +1878,7 @@
add_timer(&entry->timer);
entry->next = priv->lec_no_forward;
priv->lec_no_forward = entry;
- lec_arp_unlock(priv);
+ write_unlock_irq(&priv->arp_lock);
dump_arp_table(priv);
return;
}
@@ -1957,7 +1937,7 @@
}
}
if (found_entry) {
- lec_arp_unlock(priv);
+ write_unlock_irq(&priv->arp_lock);
DPRINTK("After vcc was added\n");
dump_arp_table(priv);
return;
@@ -1975,7 +1955,7 @@
entry->timer.expires = jiffies + priv->vcc_timeout_period;
entry->timer.function = lec_arp_expire_vcc;
add_timer(&entry->timer);
- lec_arp_unlock(priv);
+ write_unlock_irq(&priv->arp_lock);
DPRINTK("After vcc was added\n");
dump_arp_table(priv);
}
@@ -1985,8 +1965,9 @@
{
struct lec_arp_table *entry;
int i;
-
+
DPRINTK("LEC:lec_flush_complete %lx\n",tran_id);
+ read_lock_irq(&priv->arp_lock);
for (i=0;i<LEC_ARP_TABLE_SIZE;i++) {
for (entry=priv->lec_arp_tables[i];entry;entry=entry->next) {
if (entry->flush_tran_id == tran_id &&
@@ -1996,6 +1977,7 @@
}
}
}
+ read_unlock_irq(&priv->arp_lock);
dump_arp_table(priv);
}
@@ -2005,13 +1987,15 @@
{
struct lec_arp_table *entry;
int i;
-
+
+ read_lock_irq(&priv->arp_lock);
for (i=0;i<LEC_ARP_TABLE_SIZE;i++)
for(entry=priv->lec_arp_tables[i];entry;entry=entry->next)
if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) {
entry->flush_tran_id = tran_id;
DPRINTK("Set flush transaction id to %lx for \
%p\n",tran_id,entry); }
+ read_unlock_irq(&priv->arp_lock);
}
int
@@ -2021,10 +2005,10 @@
0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
struct lec_arp_table *to_add;
- lec_arp_lock(priv);
+ write_lock_irq(&priv->arp_lock);
to_add = make_entry(priv, mac_addr);
if (!to_add) {
- lec_arp_unlock(priv);
+ write_unlock_irq(&priv->arp_lock);
return -ENOMEM;
}
memcpy(to_add->atm_addr, vcc->remote.sas_addr.prv, ATM_ESA_LEN);
@@ -2034,8 +2018,8 @@
to_add->old_push = vcc->push;
vcc->push = lec_push;
priv->mcast_vcc = vcc;
- lec_arp_put(priv->lec_arp_tables, to_add);
- lec_arp_unlock(priv);
+ lec_arp_put(priv, to_add);
+ write_unlock_irq(&priv->arp_lock);
return 0;
}
@@ -2047,12 +2031,12 @@
DPRINTK("LEC_ARP: lec_vcc_close vpi:%d vci:%d\n",vcc->vpi,vcc->vci);
dump_arp_table(priv);
- lec_arp_lock(priv);
+ write_lock_irq(&priv->arp_lock);
for(i=0;i<LEC_ARP_TABLE_SIZE;i++) {
for(entry = priv->lec_arp_tables[i];entry; entry=next) {
next = entry->next;
if (vcc == entry->vcc) {
- lec_arp_remove(priv->lec_arp_tables,entry);
+ lec_arp_remove(priv, entry);
kfree(entry);
if (priv->mcast_vcc == vcc) {
priv->mcast_vcc = NULL;
@@ -2109,7 +2093,7 @@
entry = next;
}
- lec_arp_unlock(priv);
+ write_unlock_irq(&priv->arp_lock);
dump_arp_table(priv);
}
@@ -2119,7 +2103,6 @@
{
struct lec_arp_table *entry, *prev;
struct lecdatahdr_8023 *hdr = (struct lecdatahdr_8023 *)skb->data;
- unsigned long flags;
unsigned char *src;
#ifdef CONFIG_TR
struct lecdatahdr_8025 *tr_hdr = (struct lecdatahdr_8025 *)skb->data;
@@ -2129,24 +2112,21 @@
#endif
src = hdr->h_source;
- lec_arp_lock(priv);
+ write_lock(&priv->arp_lock);
entry = priv->lec_arp_empty_ones;
if (vcc == entry->vcc) {
- save_flags(flags);
- cli();
del_timer(&entry->timer);
memcpy(entry->mac_addr, src, ETH_ALEN);
entry->status = ESI_FORWARD_DIRECT;
entry->last_used = jiffies;
priv->lec_arp_empty_ones = entry->next;
- restore_flags(flags);
/* We might have got an entry */
if ((prev=lec_arp_find(priv,src))) {
- lec_arp_remove(priv->lec_arp_tables, prev);
+ lec_arp_remove(priv, prev);
kfree(prev);
}
- lec_arp_put(priv->lec_arp_tables, entry);
- lec_arp_unlock(priv);
+ lec_arp_put(priv, entry);
+ write_unlock(&priv->arp_lock);
return;
}
prev = entry;
@@ -2157,22 +2137,19 @@
}
if (!entry) {
DPRINTK("LEC_ARP: Arp_check_empties: entry not found!\n");
- lec_arp_unlock(priv);
+ write_unlock(&priv->arp_lock);
return;
}
- save_flags(flags);
- cli();
del_timer(&entry->timer);
memcpy(entry->mac_addr, src, ETH_ALEN);
entry->status = ESI_FORWARD_DIRECT;
entry->last_used = jiffies;
prev->next = entry->next;
- restore_flags(flags);
if ((prev = lec_arp_find(priv, src))) {
- lec_arp_remove(priv->lec_arp_tables,prev);
+ lec_arp_remove(priv, prev);
kfree(prev);
}
- lec_arp_put(priv->lec_arp_tables,entry);
- lec_arp_unlock(priv);
+ lec_arp_put(priv, entry);
+ write_unlock(&priv->arp_lock);
}
diff -u -r /usr/src/linux-2.4.0-test9/net/atm/lec.h ./lec.h
--- /usr/src/linux-2.4.0-test9/net/atm/lec.h Fri Apr 14 19:37:20 2000
+++ ./lec.h Mon Oct 23 15:27:03 2000
@@ -84,6 +84,7 @@
struct lec_priv {
struct net_device_stats stats;
unsigned short lecid; /* Lecid of this client */
+ rwlock_t arp_lock;
struct lec_arp_table *lec_arp_empty_ones;
/* Used for storing VCC's that don't have a MAC address attached yet */
struct lec_arp_table *lec_arp_tables[LEC_ARP_TABLE_SIZE];
@@ -98,7 +99,6 @@
establishes multiple Multicast Forward VCCs to us. This list
collects all those VCCs. LANEv1 client has only one item in this
list. These entries are not aged out. */
- atomic_t lec_arp_lock_var;
struct atm_vcc *mcast_vcc; /* Default Multicast Send VCC */
struct atm_vcc *lecd;
struct timer_list lec_arp_timer;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic