Commit 1fa9961d authored by Chas Williams's avatar Chas Williams Committed by David S. Miller

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

Signed-off-by: default avatarChas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d44f7746
...@@ -1418,7 +1418,6 @@ static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr, ...@@ -1418,7 +1418,6 @@ static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr,
* *
* lec_arpc.c was added here when making * lec_arpc.c was added here when making
* lane client modular. October 1997 * lane client modular. October 1997
*
*/ */
#include <linux/types.h> #include <linux/types.h>
...@@ -1429,7 +1428,6 @@ static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr, ...@@ -1429,7 +1428,6 @@ static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr,
#include <linux/inetdevice.h> #include <linux/inetdevice.h>
#include <net/route.h> #include <net/route.h>
#if 0 #if 0
#define DPRINTK(format,args...) #define DPRINTK(format,args...)
/* /*
...@@ -1452,8 +1450,7 @@ static void lec_arp_expire_arp(unsigned long data); ...@@ -1452,8 +1450,7 @@ static void lec_arp_expire_arp(unsigned long data);
/* /*
* Initialization of arp-cache * Initialization of arp-cache
*/ */
static void static void lec_arp_init(struct lec_priv *priv)
lec_arp_init(struct lec_priv *priv)
{ {
unsigned short i; unsigned short i;
...@@ -1468,13 +1465,12 @@ lec_arp_init(struct lec_priv *priv) ...@@ -1468,13 +1465,12 @@ lec_arp_init(struct lec_priv *priv)
add_timer(&priv->lec_arp_timer); add_timer(&priv->lec_arp_timer);
} }
static void static void lec_arp_clear_vccs(struct lec_arp_table *entry)
lec_arp_clear_vccs(struct lec_arp_table *entry)
{ {
if (entry->vcc) { if (entry->vcc) {
struct atm_vcc *vcc = entry->vcc; struct atm_vcc *vcc = entry->vcc;
struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc); struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
struct net_device *dev = (struct net_device*) vcc->proto_data; struct net_device *dev = (struct net_device *)vcc->proto_data;
vcc->pop = vpriv->old_pop; vcc->pop = vpriv->old_pop;
if (vpriv->xoff) if (vpriv->xoff)
...@@ -1502,7 +1498,7 @@ lec_arp_add(struct lec_priv *priv, struct lec_arp_table *to_add) ...@@ -1502,7 +1498,7 @@ lec_arp_add(struct lec_priv *priv, struct lec_arp_table *to_add)
unsigned short place; unsigned short place;
struct lec_arp_table *tmp; struct lec_arp_table *tmp;
place = HASH(to_add->mac_addr[ETH_ALEN-1]); place = HASH(to_add->mac_addr[ETH_ALEN - 1]);
tmp = priv->lec_arp_tables[place]; tmp = priv->lec_arp_tables[place];
to_add->next = NULL; to_add->next = NULL;
if (tmp == NULL) if (tmp == NULL)
...@@ -1515,34 +1511,33 @@ lec_arp_add(struct lec_priv *priv, struct lec_arp_table *to_add) ...@@ -1515,34 +1511,33 @@ lec_arp_add(struct lec_priv *priv, struct lec_arp_table *to_add)
} }
DPRINTK("LEC_ARP: Added entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n", DPRINTK("LEC_ARP: Added entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
0xff&to_add->mac_addr[0], 0xff&to_add->mac_addr[1], 0xff & to_add->mac_addr[0], 0xff & to_add->mac_addr[1],
0xff&to_add->mac_addr[2], 0xff&to_add->mac_addr[3], 0xff & to_add->mac_addr[2], 0xff & to_add->mac_addr[3],
0xff&to_add->mac_addr[4], 0xff&to_add->mac_addr[5]); 0xff & to_add->mac_addr[4], 0xff & to_add->mac_addr[5]);
} }
/* /*
* Remove entry from lec_arp_table * Remove entry from lec_arp_table
*/ */
static int static int
lec_arp_remove(struct lec_priv *priv, lec_arp_remove(struct lec_priv *priv, struct lec_arp_table *to_remove)
struct lec_arp_table *to_remove)
{ {
unsigned short place; unsigned short place;
struct lec_arp_table *tmp; struct lec_arp_table *tmp;
int remove_vcc=1; int remove_vcc = 1;
if (!to_remove) { if (!to_remove) {
return -1; return -1;
} }
place = HASH(to_remove->mac_addr[ETH_ALEN-1]); place = HASH(to_remove->mac_addr[ETH_ALEN - 1]);
tmp = priv->lec_arp_tables[place]; tmp = priv->lec_arp_tables[place];
if (tmp == to_remove) { if (tmp == to_remove) {
priv->lec_arp_tables[place] = tmp->next; priv->lec_arp_tables[place] = tmp->next;
} else { } else {
while(tmp && tmp->next != to_remove) { while (tmp && tmp->next != to_remove) {
tmp = tmp->next; tmp = tmp->next;
} }
if (!tmp) {/* Entry was not found */ if (!tmp) { /* Entry was not found */
return -1; return -1;
} }
} }
...@@ -1555,11 +1550,13 @@ lec_arp_remove(struct lec_priv *priv, ...@@ -1555,11 +1550,13 @@ lec_arp_remove(struct lec_priv *priv,
/* /*
* ESI_FLUSH_PENDING, ESI_FORWARD_DIRECT * ESI_FLUSH_PENDING, ESI_FORWARD_DIRECT
*/ */
for(place = 0; place < LEC_ARP_TABLE_SIZE; place++) { for (place = 0; place < LEC_ARP_TABLE_SIZE; place++) {
for(tmp = priv->lec_arp_tables[place]; tmp != NULL; tmp = tmp->next) { for (tmp = priv->lec_arp_tables[place]; tmp != NULL;
if (memcmp(tmp->atm_addr, to_remove->atm_addr, tmp = tmp->next) {
ATM_ESA_LEN)==0) { if (memcmp
remove_vcc=0; (tmp->atm_addr, to_remove->atm_addr,
ATM_ESA_LEN) == 0) {
remove_vcc = 0;
break; break;
} }
} }
...@@ -1570,17 +1567,16 @@ lec_arp_remove(struct lec_priv *priv, ...@@ -1570,17 +1567,16 @@ lec_arp_remove(struct lec_priv *priv,
skb_queue_purge(&to_remove->tx_wait); /* FIXME: good place for this? */ skb_queue_purge(&to_remove->tx_wait); /* FIXME: good place for this? */
DPRINTK("LEC_ARP: Removed entry:%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n", 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[0], 0xff & to_remove->mac_addr[1],
0xff&to_remove->mac_addr[2], 0xff&to_remove->mac_addr[3], 0xff & to_remove->mac_addr[2], 0xff & to_remove->mac_addr[3],
0xff&to_remove->mac_addr[4], 0xff&to_remove->mac_addr[5]); 0xff & to_remove->mac_addr[4], 0xff & to_remove->mac_addr[5]);
return 0; return 0;
} }
#if DEBUG_ARP_TABLE #if DEBUG_ARP_TABLE
static char* static char *get_status_string(unsigned char st)
get_status_string(unsigned char st)
{ {
switch(st) { switch (st) {
case ESI_UNKNOWN: case ESI_UNKNOWN:
return "ESI_UNKNOWN"; return "ESI_UNKNOWN";
case ESI_ARP_PENDING: case ESI_ARP_PENDING:
...@@ -1597,11 +1593,10 @@ get_status_string(unsigned char st) ...@@ -1597,11 +1593,10 @@ get_status_string(unsigned char st)
} }
#endif #endif
static void static void dump_arp_table(struct lec_priv *priv)
dump_arp_table(struct lec_priv *priv)
{ {
#if DEBUG_ARP_TABLE #if DEBUG_ARP_TABLE
int i,j, offset; int i, j, offset;
struct lec_arp_table *rulla; struct lec_arp_table *rulla;
char buf[1024]; char buf[1024];
struct lec_arp_table **lec_arp_tables = struct lec_arp_table **lec_arp_tables =
...@@ -1612,135 +1607,136 @@ dump_arp_table(struct lec_priv *priv) ...@@ -1612,135 +1607,136 @@ dump_arp_table(struct lec_priv *priv)
(struct lec_arp_table *)priv->lec_no_forward; (struct lec_arp_table *)priv->lec_no_forward;
struct lec_arp_table *mcast_fwds = priv->mcast_fwds; struct lec_arp_table *mcast_fwds = priv->mcast_fwds;
printk("Dump %p:\n", priv);
printk("Dump %p:\n",priv); for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
for (i=0;i<LEC_ARP_TABLE_SIZE;i++) {
rulla = lec_arp_tables[i]; rulla = lec_arp_tables[i];
offset = 0; offset = 0;
offset += sprintf(buf,"%d: %p\n",i, rulla); offset += sprintf(buf, "%d: %p\n", i, rulla);
while (rulla) { while (rulla) {
offset += sprintf(buf+offset,"Mac:"); offset += sprintf(buf + offset, "Mac:");
for(j=0;j<ETH_ALEN;j++) { for (j = 0; j < ETH_ALEN; j++) {
offset+=sprintf(buf+offset, offset += sprintf(buf + offset,
"%2.2x ", "%2.2x ",
rulla->mac_addr[j]&0xff); rulla->mac_addr[j] & 0xff);
} }
offset +=sprintf(buf+offset,"Atm:"); offset += sprintf(buf + offset, "Atm:");
for(j=0;j<ATM_ESA_LEN;j++) { for (j = 0; j < ATM_ESA_LEN; j++) {
offset+=sprintf(buf+offset, offset += sprintf(buf + offset,
"%2.2x ", "%2.2x ",
rulla->atm_addr[j]&0xff); rulla->atm_addr[j] & 0xff);
} }
offset+=sprintf(buf+offset, offset += sprintf(buf + offset,
"Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ", "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
rulla->vcc?rulla->vcc->vpi:0, rulla->vcc ? rulla->vcc->vpi : 0,
rulla->vcc?rulla->vcc->vci:0, rulla->vcc ? rulla->vcc->vci : 0,
rulla->recv_vcc?rulla->recv_vcc->vpi:0, rulla->recv_vcc ? rulla->recv_vcc->
rulla->recv_vcc?rulla->recv_vcc->vci:0, vpi : 0,
rulla->last_used, rulla->recv_vcc ? rulla->recv_vcc->
vci : 0, rulla->last_used,
rulla->timestamp, rulla->no_tries); rulla->timestamp, rulla->no_tries);
offset+=sprintf(buf+offset, offset +=
sprintf(buf + offset,
"Flags:%x, Packets_flooded:%x, Status: %s ", "Flags:%x, Packets_flooded:%x, Status: %s ",
rulla->flags, rulla->packets_flooded, rulla->flags, rulla->packets_flooded,
get_status_string(rulla->status)); get_status_string(rulla->status));
offset+=sprintf(buf+offset,"->%p\n",rulla->next); offset += sprintf(buf + offset, "->%p\n", rulla->next);
rulla = rulla->next; rulla = rulla->next;
} }
printk("%s",buf); printk("%s", buf);
} }
rulla = lec_no_forward; rulla = lec_no_forward;
if (rulla) if (rulla)
printk("No forward\n"); printk("No forward\n");
while(rulla) { while (rulla) {
offset=0; offset = 0;
offset += sprintf(buf+offset,"Mac:"); offset += sprintf(buf + offset, "Mac:");
for(j=0;j<ETH_ALEN;j++) { for (j = 0; j < ETH_ALEN; j++) {
offset+=sprintf(buf+offset,"%2.2x ", offset += sprintf(buf + offset, "%2.2x ",
rulla->mac_addr[j]&0xff); rulla->mac_addr[j] & 0xff);
} }
offset +=sprintf(buf+offset,"Atm:"); offset += sprintf(buf + offset, "Atm:");
for(j=0;j<ATM_ESA_LEN;j++) { for (j = 0; j < ATM_ESA_LEN; j++) {
offset+=sprintf(buf+offset,"%2.2x ", offset += sprintf(buf + offset, "%2.2x ",
rulla->atm_addr[j]&0xff); rulla->atm_addr[j] & 0xff);
} }
offset+=sprintf(buf+offset, offset += sprintf(buf + offset,
"Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ", "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
rulla->vcc?rulla->vcc->vpi:0, rulla->vcc ? rulla->vcc->vpi : 0,
rulla->vcc?rulla->vcc->vci:0, rulla->vcc ? rulla->vcc->vci : 0,
rulla->recv_vcc?rulla->recv_vcc->vpi:0, rulla->recv_vcc ? rulla->recv_vcc->vpi : 0,
rulla->recv_vcc?rulla->recv_vcc->vci:0, rulla->recv_vcc ? rulla->recv_vcc->vci : 0,
rulla->last_used, rulla->last_used,
rulla->timestamp, rulla->no_tries); rulla->timestamp, rulla->no_tries);
offset+=sprintf(buf+offset, offset += sprintf(buf + offset,
"Flags:%x, Packets_flooded:%x, Status: %s ", "Flags:%x, Packets_flooded:%x, Status: %s ",
rulla->flags, rulla->packets_flooded, rulla->flags, rulla->packets_flooded,
get_status_string(rulla->status)); get_status_string(rulla->status));
offset+=sprintf(buf+offset,"->%lx\n",(long)rulla->next); offset += sprintf(buf + offset, "->%lx\n", (long)rulla->next);
rulla = rulla->next; rulla = rulla->next;
printk("%s",buf); printk("%s", buf);
} }
rulla = lec_arp_empty_ones; rulla = lec_arp_empty_ones;
if (rulla) if (rulla)
printk("Empty ones\n"); printk("Empty ones\n");
while(rulla) { while (rulla) {
offset=0; offset = 0;
offset += sprintf(buf+offset,"Mac:"); offset += sprintf(buf + offset, "Mac:");
for(j=0;j<ETH_ALEN;j++) { for (j = 0; j < ETH_ALEN; j++) {
offset+=sprintf(buf+offset,"%2.2x ", offset += sprintf(buf + offset, "%2.2x ",
rulla->mac_addr[j]&0xff); rulla->mac_addr[j] & 0xff);
} }
offset +=sprintf(buf+offset,"Atm:"); offset += sprintf(buf + offset, "Atm:");
for(j=0;j<ATM_ESA_LEN;j++) { for (j = 0; j < ATM_ESA_LEN; j++) {
offset+=sprintf(buf+offset,"%2.2x ", offset += sprintf(buf + offset, "%2.2x ",
rulla->atm_addr[j]&0xff); rulla->atm_addr[j] & 0xff);
} }
offset+=sprintf(buf+offset, offset += sprintf(buf + offset,
"Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ", "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
rulla->vcc?rulla->vcc->vpi:0, rulla->vcc ? rulla->vcc->vpi : 0,
rulla->vcc?rulla->vcc->vci:0, rulla->vcc ? rulla->vcc->vci : 0,
rulla->recv_vcc?rulla->recv_vcc->vpi:0, rulla->recv_vcc ? rulla->recv_vcc->vpi : 0,
rulla->recv_vcc?rulla->recv_vcc->vci:0, rulla->recv_vcc ? rulla->recv_vcc->vci : 0,
rulla->last_used, rulla->last_used,
rulla->timestamp, rulla->no_tries); rulla->timestamp, rulla->no_tries);
offset+=sprintf(buf+offset, offset += sprintf(buf + offset,
"Flags:%x, Packets_flooded:%x, Status: %s ", "Flags:%x, Packets_flooded:%x, Status: %s ",
rulla->flags, rulla->packets_flooded, rulla->flags, rulla->packets_flooded,
get_status_string(rulla->status)); get_status_string(rulla->status));
offset+=sprintf(buf+offset,"->%lx\n",(long)rulla->next); offset += sprintf(buf + offset, "->%lx\n", (long)rulla->next);
rulla = rulla->next; rulla = rulla->next;
printk("%s",buf); printk("%s", buf);
} }
rulla = mcast_fwds; rulla = mcast_fwds;
if (rulla) if (rulla)
printk("Multicast Forward VCCs\n"); printk("Multicast Forward VCCs\n");
while(rulla) { while (rulla) {
offset=0; offset = 0;
offset += sprintf(buf+offset,"Mac:"); offset += sprintf(buf + offset, "Mac:");
for(j=0;j<ETH_ALEN;j++) { for (j = 0; j < ETH_ALEN; j++) {
offset+=sprintf(buf+offset,"%2.2x ", offset += sprintf(buf + offset, "%2.2x ",
rulla->mac_addr[j]&0xff); rulla->mac_addr[j] & 0xff);
} }
offset +=sprintf(buf+offset,"Atm:"); offset += sprintf(buf + offset, "Atm:");
for(j=0;j<ATM_ESA_LEN;j++) { for (j = 0; j < ATM_ESA_LEN; j++) {
offset+=sprintf(buf+offset,"%2.2x ", offset += sprintf(buf + offset, "%2.2x ",
rulla->atm_addr[j]&0xff); rulla->atm_addr[j] & 0xff);
} }
offset+=sprintf(buf+offset, offset += sprintf(buf + offset,
"Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ", "Vcc vpi:%d vci:%d, Recv_vcc vpi:%d vci:%d Last_used:%lx, Timestamp:%lx, No_tries:%d ",
rulla->vcc?rulla->vcc->vpi:0, rulla->vcc ? rulla->vcc->vpi : 0,
rulla->vcc?rulla->vcc->vci:0, rulla->vcc ? rulla->vcc->vci : 0,
rulla->recv_vcc?rulla->recv_vcc->vpi:0, rulla->recv_vcc ? rulla->recv_vcc->vpi : 0,
rulla->recv_vcc?rulla->recv_vcc->vci:0, rulla->recv_vcc ? rulla->recv_vcc->vci : 0,
rulla->last_used, rulla->last_used,
rulla->timestamp, rulla->no_tries); rulla->timestamp, rulla->no_tries);
offset+=sprintf(buf+offset, offset += sprintf(buf + offset,
"Flags:%x, Packets_flooded:%x, Status: %s ", "Flags:%x, Packets_flooded:%x, Status: %s ",
rulla->flags, rulla->packets_flooded, rulla->flags, rulla->packets_flooded,
get_status_string(rulla->status)); get_status_string(rulla->status));
offset+=sprintf(buf+offset,"->%lx\n",(long)rulla->next); offset += sprintf(buf + offset, "->%lx\n", (long)rulla->next);
rulla = rulla->next; rulla = rulla->next;
printk("%s",buf); printk("%s", buf);
} }
#endif #endif
...@@ -1749,8 +1745,7 @@ dump_arp_table(struct lec_priv *priv) ...@@ -1749,8 +1745,7 @@ dump_arp_table(struct lec_priv *priv)
/* /*
* Destruction of arp-cache * Destruction of arp-cache
*/ */
static void static void lec_arp_destroy(struct lec_priv *priv)
lec_arp_destroy(struct lec_priv *priv)
{ {
unsigned long flags; unsigned long flags;
struct lec_arp_table *entry, *next; struct lec_arp_table *entry, *next;
...@@ -1764,14 +1759,15 @@ lec_arp_destroy(struct lec_priv *priv) ...@@ -1764,14 +1759,15 @@ lec_arp_destroy(struct lec_priv *priv)
spin_lock_irqsave(&priv->lec_arp_lock, flags); spin_lock_irqsave(&priv->lec_arp_lock, flags);
for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
for(entry = priv->lec_arp_tables[i]; entry != NULL; entry=next) { for (entry = priv->lec_arp_tables[i]; entry != NULL;
entry = next) {
next = entry->next; next = entry->next;
lec_arp_remove(priv, entry); lec_arp_remove(priv, entry);
kfree(entry); kfree(entry);
} }
} }
entry = priv->lec_arp_empty_ones; entry = priv->lec_arp_empty_ones;
while(entry) { while (entry) {
next = entry->next; next = entry->next;
del_timer_sync(&entry->timer); del_timer_sync(&entry->timer);
lec_arp_clear_vccs(entry); lec_arp_clear_vccs(entry);
...@@ -1780,7 +1776,7 @@ lec_arp_destroy(struct lec_priv *priv) ...@@ -1780,7 +1776,7 @@ lec_arp_destroy(struct lec_priv *priv)
} }
priv->lec_arp_empty_ones = NULL; priv->lec_arp_empty_ones = NULL;
entry = priv->lec_no_forward; entry = priv->lec_no_forward;
while(entry) { while (entry) {
next = entry->next; next = entry->next;
del_timer_sync(&entry->timer); del_timer_sync(&entry->timer);
lec_arp_clear_vccs(entry); lec_arp_clear_vccs(entry);
...@@ -1789,7 +1785,7 @@ lec_arp_destroy(struct lec_priv *priv) ...@@ -1789,7 +1785,7 @@ lec_arp_destroy(struct lec_priv *priv)
} }
priv->lec_no_forward = NULL; priv->lec_no_forward = NULL;
entry = priv->mcast_fwds; entry = priv->mcast_fwds;
while(entry) { while (entry) {
next = entry->next; next = entry->next;
/* No timer, LANEv2 7.1.20 and 2.3.5.3 */ /* No timer, LANEv2 7.1.20 and 2.3.5.3 */
lec_arp_clear_vccs(entry); lec_arp_clear_vccs(entry);
...@@ -1803,24 +1799,22 @@ lec_arp_destroy(struct lec_priv *priv) ...@@ -1803,24 +1799,22 @@ lec_arp_destroy(struct lec_priv *priv)
spin_unlock_irqrestore(&priv->lec_arp_lock, flags); spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
} }
/* /*
* Find entry by mac_address * Find entry by mac_address
*/ */
static struct lec_arp_table* static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
lec_arp_find(struct lec_priv *priv,
unsigned char *mac_addr) unsigned char *mac_addr)
{ {
unsigned short place; unsigned short place;
struct lec_arp_table *to_return; struct lec_arp_table *to_return;
DPRINTK("LEC_ARP: lec_arp_find :%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n", 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[0] & 0xff, mac_addr[1] & 0xff, mac_addr[2] & 0xff,
mac_addr[3]&0xff, mac_addr[4]&0xff, mac_addr[5]&0xff); mac_addr[3] & 0xff, mac_addr[4] & 0xff, mac_addr[5] & 0xff);
place = HASH(mac_addr[ETH_ALEN-1]); place = HASH(mac_addr[ETH_ALEN - 1]);
to_return = priv->lec_arp_tables[place]; to_return = priv->lec_arp_tables[place];
while(to_return) { while (to_return) {
if (!compare_ether_addr(mac_addr, to_return->mac_addr)) { if (!compare_ether_addr(mac_addr, to_return->mac_addr)) {
return to_return; return to_return;
} }
...@@ -1829,8 +1823,8 @@ lec_arp_find(struct lec_priv *priv, ...@@ -1829,8 +1823,8 @@ lec_arp_find(struct lec_priv *priv,
return NULL; return NULL;
} }
static struct lec_arp_table* static struct lec_arp_table *make_entry(struct lec_priv *priv,
make_entry(struct lec_priv *priv, unsigned char *mac_addr) unsigned char *mac_addr)
{ {
struct lec_arp_table *to_return; struct lec_arp_table *to_return;
...@@ -1842,20 +1836,15 @@ make_entry(struct lec_priv *priv, unsigned char *mac_addr) ...@@ -1842,20 +1836,15 @@ make_entry(struct lec_priv *priv, unsigned char *mac_addr)
memcpy(to_return->mac_addr, mac_addr, ETH_ALEN); memcpy(to_return->mac_addr, mac_addr, ETH_ALEN);
init_timer(&to_return->timer); init_timer(&to_return->timer);
to_return->timer.function = lec_arp_expire_arp; to_return->timer.function = lec_arp_expire_arp;
to_return->timer.data = (unsigned long) to_return; to_return->timer.data = (unsigned long)to_return;
to_return->last_used = jiffies; to_return->last_used = jiffies;
to_return->priv = priv; to_return->priv = priv;
skb_queue_head_init(&to_return->tx_wait); skb_queue_head_init(&to_return->tx_wait);
return to_return; return to_return;
} }
/* /* Arp sent timer expired */
* static void lec_arp_expire_arp(unsigned long data)
* Arp sent timer expired
*
*/
static void
lec_arp_expire_arp(unsigned long data)
{ {
struct lec_arp_table *entry; struct lec_arp_table *entry;
...@@ -1865,25 +1854,22 @@ lec_arp_expire_arp(unsigned long data) ...@@ -1865,25 +1854,22 @@ lec_arp_expire_arp(unsigned long data)
if (entry->status == ESI_ARP_PENDING) { if (entry->status == ESI_ARP_PENDING) {
if (entry->no_tries <= entry->priv->max_retry_count) { if (entry->no_tries <= entry->priv->max_retry_count) {
if (entry->is_rdesc) if (entry->is_rdesc)
send_to_lecd(entry->priv, l_rdesc_arp_xmt, entry->mac_addr, NULL, NULL); send_to_lecd(entry->priv, l_rdesc_arp_xmt,
entry->mac_addr, NULL, NULL);
else else
send_to_lecd(entry->priv, l_arp_xmt, entry->mac_addr, NULL, NULL); send_to_lecd(entry->priv, l_arp_xmt,
entry->mac_addr, NULL, NULL);
entry->no_tries++; entry->no_tries++;
} }
mod_timer(&entry->timer, jiffies + (1*HZ)); mod_timer(&entry->timer, jiffies + (1 * HZ));
} }
} }
/* /* Unknown/unused vcc expire, remove associated entry */
* static void lec_arp_expire_vcc(unsigned long data)
* Unknown/unused vcc expire, remove associated entry
*
*/
static void
lec_arp_expire_vcc(unsigned long data)
{ {
unsigned long flags; unsigned long flags;
struct lec_arp_table *to_remove = (struct lec_arp_table*)data; struct lec_arp_table *to_remove = (struct lec_arp_table *)data;
struct lec_priv *priv = (struct lec_priv *)to_remove->priv; struct lec_priv *priv = (struct lec_priv *)to_remove->priv;
struct lec_arp_table *entry = NULL; struct lec_arp_table *entry = NULL;
...@@ -1891,9 +1877,10 @@ lec_arp_expire_vcc(unsigned long data) ...@@ -1891,9 +1877,10 @@ lec_arp_expire_vcc(unsigned long data)
DPRINTK("LEC_ARP %p %p: lec_arp_expire_vcc vpi:%d vci:%d\n", DPRINTK("LEC_ARP %p %p: lec_arp_expire_vcc vpi:%d vci:%d\n",
to_remove, priv, to_remove, priv,
to_remove->vcc?to_remove->recv_vcc->vpi:0, to_remove->vcc ? to_remove->recv_vcc->vpi : 0,
to_remove->vcc?to_remove->recv_vcc->vci:0); to_remove->vcc ? to_remove->recv_vcc->vci : 0);
DPRINTK("eo:%p nf:%p\n",priv->lec_arp_empty_ones,priv->lec_no_forward); DPRINTK("eo:%p nf:%p\n", priv->lec_arp_empty_ones,
priv->lec_no_forward);
spin_lock_irqsave(&priv->lec_arp_lock, flags); spin_lock_irqsave(&priv->lec_arp_lock, flags);
if (to_remove == priv->lec_arp_empty_ones) if (to_remove == priv->lec_arp_empty_ones)
...@@ -1938,8 +1925,7 @@ lec_arp_expire_vcc(unsigned long data) ...@@ -1938,8 +1925,7 @@ lec_arp_expire_vcc(unsigned long data)
* to ESI_FORWARD_DIRECT. This causes the flush period to end * to ESI_FORWARD_DIRECT. This causes the flush period to end
* regardless of the progress of the flush protocol. * regardless of the progress of the flush protocol.
*/ */
static void static void lec_arp_check_expire(unsigned long data)
lec_arp_check_expire(unsigned long data)
{ {
unsigned long flags; unsigned long flags;
struct lec_priv *priv = (struct lec_priv *)data; struct lec_priv *priv = (struct lec_priv *)data;
...@@ -1948,13 +1934,13 @@ lec_arp_check_expire(unsigned long data) ...@@ -1948,13 +1934,13 @@ lec_arp_check_expire(unsigned long data)
unsigned long time_to_check; unsigned long time_to_check;
int i; int i;
DPRINTK("lec_arp_check_expire %p\n",priv); DPRINTK("lec_arp_check_expire %p\n", priv);
DPRINTK("expire: eo:%p nf:%p\n",priv->lec_arp_empty_ones, DPRINTK("expire: eo:%p nf:%p\n", priv->lec_arp_empty_ones,
priv->lec_no_forward); priv->lec_no_forward);
now = jiffies; now = jiffies;
spin_lock_irqsave(&priv->lec_arp_lock, flags); spin_lock_irqsave(&priv->lec_arp_lock, flags);
for(i = 0; i < LEC_ARP_TABLE_SIZE; i++) { for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
for(entry = priv->lec_arp_tables[i]; entry != NULL; ) { for (entry = priv->lec_arp_tables[i]; entry != NULL;) {
if ((entry->flags) & LEC_REMOTE_FLAG && if ((entry->flags) & LEC_REMOTE_FLAG &&
priv->topology_change) priv->topology_change)
time_to_check = priv->forward_delay_time; time_to_check = priv->forward_delay_time;
...@@ -1962,11 +1948,10 @@ lec_arp_check_expire(unsigned long data) ...@@ -1962,11 +1948,10 @@ lec_arp_check_expire(unsigned long data)
time_to_check = priv->aging_time; time_to_check = priv->aging_time;
DPRINTK("About to expire: %lx - %lx > %lx\n", DPRINTK("About to expire: %lx - %lx > %lx\n",
now,entry->last_used, time_to_check); now, entry->last_used, time_to_check);
if( time_after(now, entry->last_used+ if (time_after(now, entry->last_used + time_to_check)
time_to_check) && && !(entry->flags & LEC_PERMANENT_FLAG)
!(entry->flags & LEC_PERMANENT_FLAG) && && !(entry->mac_addr[0] & 0x01)) { /* LANE2: 7.1.20 */
!(entry->mac_addr[0] & 0x01) ) { /* LANE2: 7.1.20 */
/* Remove entry */ /* Remove entry */
DPRINTK("LEC:Entry timed out\n"); DPRINTK("LEC:Entry timed out\n");
next = entry->next; next = entry->next;
...@@ -1979,23 +1964,29 @@ lec_arp_check_expire(unsigned long data) ...@@ -1979,23 +1964,29 @@ lec_arp_check_expire(unsigned long data)
entry->status == ESI_ARP_PENDING) entry->status == ESI_ARP_PENDING)
&& time_after_eq(now, && time_after_eq(now,
entry->timestamp + entry->timestamp +
priv->max_unknown_frame_time)) { priv->
max_unknown_frame_time)) {
entry->timestamp = jiffies; entry->timestamp = jiffies;
entry->packets_flooded = 0; entry->packets_flooded = 0;
if (entry->status == ESI_VC_PENDING) if (entry->status == ESI_VC_PENDING)
send_to_lecd(priv, l_svc_setup, entry->mac_addr, entry->atm_addr, NULL); send_to_lecd(priv, l_svc_setup,
entry->mac_addr,
entry->atm_addr,
NULL);
} }
if (entry->status == ESI_FLUSH_PENDING if (entry->status == ESI_FLUSH_PENDING
&& &&
time_after_eq(now, entry->timestamp+ time_after_eq(now, entry->timestamp +
priv->path_switching_delay)) { priv->path_switching_delay)) {
struct sk_buff *skb; struct sk_buff *skb;
while ((skb = skb_dequeue(&entry->tx_wait)) != NULL) while ((skb =
lec_send(entry->vcc, skb, entry->priv); skb_dequeue(&entry->tx_wait)) !=
NULL)
lec_send(entry->vcc, skb,
entry->priv);
entry->last_used = jiffies; entry->last_used = jiffies;
entry->status = entry->status = ESI_FORWARD_DIRECT;
ESI_FORWARD_DIRECT;
} }
entry = entry->next; entry = entry->next;
} }
...@@ -2005,13 +1996,14 @@ lec_arp_check_expire(unsigned long data) ...@@ -2005,13 +1996,14 @@ lec_arp_check_expire(unsigned long data)
mod_timer(&priv->lec_arp_timer, jiffies + LEC_ARP_REFRESH_INTERVAL); mod_timer(&priv->lec_arp_timer, jiffies + LEC_ARP_REFRESH_INTERVAL);
} }
/* /*
* Try to find vcc where mac_address is attached. * Try to find vcc where mac_address is attached.
* *
*/ */
static struct atm_vcc* static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
lec_arp_resolve(struct lec_priv *priv, unsigned char *mac_to_find, unsigned char *mac_to_find, int is_rdesc,
int is_rdesc, struct lec_arp_table **ret_entry) struct lec_arp_table **ret_entry)
{ {
unsigned long flags; unsigned long flags;
struct lec_arp_table *entry; struct lec_arp_table *entry;
...@@ -2042,29 +2034,35 @@ lec_arp_resolve(struct lec_priv *priv, unsigned char *mac_to_find, ...@@ -2042,29 +2034,35 @@ lec_arp_resolve(struct lec_priv *priv, unsigned char *mac_to_find,
found = entry->vcc; found = entry->vcc;
goto out; goto out;
} }
/* If the LE_ARP cache entry is still pending, reset count to 0 /*
* If the LE_ARP cache entry is still pending, reset count to 0
* so another LE_ARP request can be made for this frame. * so another LE_ARP request can be made for this frame.
*/ */
if (entry->status == ESI_ARP_PENDING) { if (entry->status == ESI_ARP_PENDING) {
entry->no_tries = 0; entry->no_tries = 0;
} }
/* Data direct VC not yet set up, check to see if the unknown /*
frame count is greater than the limit. If the limit has * Data direct VC not yet set up, check to see if the unknown
not been reached, allow the caller to send packet to * frame count is greater than the limit. If the limit has
BUS. */ * not been reached, allow the caller to send packet to
* BUS.
*/
if (entry->status != ESI_FLUSH_PENDING && if (entry->status != ESI_FLUSH_PENDING &&
entry->packets_flooded<priv->maximum_unknown_frame_count) { entry->packets_flooded <
priv->maximum_unknown_frame_count) {
entry->packets_flooded++; entry->packets_flooded++;
DPRINTK("LEC_ARP: Flooding..\n"); DPRINTK("LEC_ARP: Flooding..\n");
found = priv->mcast_vcc; found = priv->mcast_vcc;
goto out; goto out;
} }
/* We got here because entry->status == ESI_FLUSH_PENDING /*
* We got here because entry->status == ESI_FLUSH_PENDING
* or BUS flood limit was reached for an entry which is * or BUS flood limit was reached for an entry which is
* in ESI_ARP_PENDING or ESI_VC_PENDING state. * in ESI_ARP_PENDING or ESI_VC_PENDING state.
*/ */
*ret_entry = entry; *ret_entry = entry;
DPRINTK("lec: entry->status %d entry->vcc %p\n", entry->status, entry->vcc); DPRINTK("lec: entry->status %d entry->vcc %p\n", entry->status,
entry->vcc);
found = NULL; found = NULL;
} else { } else {
/* No matching entry was found */ /* No matching entry was found */
...@@ -2076,16 +2074,17 @@ lec_arp_resolve(struct lec_priv *priv, unsigned char *mac_to_find, ...@@ -2076,16 +2074,17 @@ lec_arp_resolve(struct lec_priv *priv, unsigned char *mac_to_find,
} }
lec_arp_add(priv, entry); lec_arp_add(priv, entry);
/* We want arp-request(s) to be sent */ /* We want arp-request(s) to be sent */
entry->packets_flooded =1; entry->packets_flooded = 1;
entry->status = ESI_ARP_PENDING; entry->status = ESI_ARP_PENDING;
entry->no_tries = 1; entry->no_tries = 1;
entry->last_used = entry->timestamp = jiffies; entry->last_used = entry->timestamp = jiffies;
entry->is_rdesc = is_rdesc; entry->is_rdesc = is_rdesc;
if (entry->is_rdesc) if (entry->is_rdesc)
send_to_lecd(priv, l_rdesc_arp_xmt, mac_to_find, NULL, NULL); send_to_lecd(priv, l_rdesc_arp_xmt, mac_to_find, NULL,
NULL);
else else
send_to_lecd(priv, l_arp_xmt, mac_to_find, NULL, NULL); send_to_lecd(priv, l_arp_xmt, mac_to_find, NULL, NULL);
entry->timer.expires = jiffies + (1*HZ); entry->timer.expires = jiffies + (1 * HZ);
entry->timer.function = lec_arp_expire_arp; entry->timer.function = lec_arp_expire_arp;
add_timer(&entry->timer); add_timer(&entry->timer);
found = priv->mcast_vcc; found = priv->mcast_vcc;
...@@ -2106,8 +2105,9 @@ lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr, ...@@ -2106,8 +2105,9 @@ lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr,
DPRINTK("lec_addr_delete\n"); DPRINTK("lec_addr_delete\n");
spin_lock_irqsave(&priv->lec_arp_lock, flags); spin_lock_irqsave(&priv->lec_arp_lock, flags);
for(i = 0; i < LEC_ARP_TABLE_SIZE; i++) { for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
for(entry = priv->lec_arp_tables[i]; entry != NULL; entry = next) { for (entry = priv->lec_arp_tables[i]; entry != NULL;
entry = next) {
next = entry->next; next = entry->next;
if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN) if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)
&& (permanent || && (permanent ||
...@@ -2135,15 +2135,16 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, ...@@ -2135,15 +2135,16 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
struct lec_arp_table *entry, *tmp; struct lec_arp_table *entry, *tmp;
int i; int i;
DPRINTK("lec:%s", (targetless_le_arp) ? "targetless ": " "); DPRINTK("lec:%s", (targetless_le_arp) ? "targetless " : " ");
DPRINTK("lec_arp_update mac:%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n", DPRINTK("lec_arp_update mac:%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n",
mac_addr[0],mac_addr[1],mac_addr[2],mac_addr[3], mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3],
mac_addr[4],mac_addr[5]); mac_addr[4], mac_addr[5]);
spin_lock_irqsave(&priv->lec_arp_lock, flags); spin_lock_irqsave(&priv->lec_arp_lock, flags);
entry = lec_arp_find(priv, mac_addr); entry = lec_arp_find(priv, mac_addr);
if (entry == NULL && targetless_le_arp) if (entry == NULL && targetless_le_arp)
goto out; /* LANE2: ignore targetless LE_ARPs for which goto out; /*
* LANE2: ignore targetless LE_ARPs for which
* we have no entry in the cache. 7.1.30 * we have no entry in the cache. 7.1.30
*/ */
if (priv->lec_arp_empty_ones) { if (priv->lec_arp_empty_ones) {
...@@ -2151,7 +2152,7 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, ...@@ -2151,7 +2152,7 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
if (!memcmp(entry->atm_addr, atm_addr, ATM_ESA_LEN)) { if (!memcmp(entry->atm_addr, atm_addr, ATM_ESA_LEN)) {
priv->lec_arp_empty_ones = entry->next; priv->lec_arp_empty_ones = entry->next;
} else { } else {
while(entry->next && memcmp(entry->next->atm_addr, while (entry->next && memcmp(entry->next->atm_addr,
atm_addr, ATM_ESA_LEN)) atm_addr, ATM_ESA_LEN))
entry = entry->next; entry = entry->next;
if (entry->next) { if (entry->next) {
...@@ -2174,7 +2175,7 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, ...@@ -2174,7 +2175,7 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
tmp->last_used = jiffies; tmp->last_used = jiffies;
del_timer(&entry->timer); del_timer(&entry->timer);
kfree(entry); kfree(entry);
entry=tmp; entry = tmp;
} else { } else {
entry->status = ESI_FORWARD_DIRECT; entry->status = ESI_FORWARD_DIRECT;
memcpy(entry->mac_addr, mac_addr, ETH_ALEN); memcpy(entry->mac_addr, mac_addr, ETH_ALEN);
...@@ -2182,9 +2183,9 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, ...@@ -2182,9 +2183,9 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
lec_arp_add(priv, entry); lec_arp_add(priv, entry);
} }
if (remoteflag) if (remoteflag)
entry->flags|=LEC_REMOTE_FLAG; entry->flags |= LEC_REMOTE_FLAG;
else else
entry->flags&=~LEC_REMOTE_FLAG; entry->flags &= ~LEC_REMOTE_FLAG;
DPRINTK("After update\n"); DPRINTK("After update\n");
dump_arp_table(priv); dump_arp_table(priv);
goto out; goto out;
...@@ -2201,11 +2202,10 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, ...@@ -2201,11 +2202,10 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
} }
memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN); memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN);
del_timer(&entry->timer); del_timer(&entry->timer);
for(i = 0; i < LEC_ARP_TABLE_SIZE; i++) { for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
for(tmp = priv->lec_arp_tables[i]; tmp; tmp=tmp->next) { for (tmp = priv->lec_arp_tables[i]; tmp; tmp = tmp->next) {
if (entry != tmp && if (entry != tmp &&
!memcmp(tmp->atm_addr, atm_addr, !memcmp(tmp->atm_addr, atm_addr, ATM_ESA_LEN)) {
ATM_ESA_LEN)) {
/* Vcc to this host exists */ /* Vcc to this host exists */
if (tmp->status > ESI_VC_PENDING) { if (tmp->status > ESI_VC_PENDING) {
/* /*
...@@ -2213,21 +2213,21 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, ...@@ -2213,21 +2213,21 @@ lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
* ESI_FORWARD_DIRECT * ESI_FORWARD_DIRECT
*/ */
entry->vcc = tmp->vcc; entry->vcc = tmp->vcc;
entry->old_push=tmp->old_push; entry->old_push = tmp->old_push;
} }
entry->status=tmp->status; entry->status = tmp->status;
break; break;
} }
} }
} }
if (remoteflag) if (remoteflag)
entry->flags|=LEC_REMOTE_FLAG; entry->flags |= LEC_REMOTE_FLAG;
else else
entry->flags&=~LEC_REMOTE_FLAG; entry->flags &= ~LEC_REMOTE_FLAG;
if (entry->status == ESI_ARP_PENDING || if (entry->status == ESI_ARP_PENDING || entry->status == ESI_UNKNOWN) {
entry->status == ESI_UNKNOWN) {
entry->status = ESI_VC_PENDING; entry->status = ESI_VC_PENDING;
send_to_lecd(priv, l_svc_setup, entry->mac_addr, atm_addr, NULL); send_to_lecd(priv, l_svc_setup, entry->mac_addr, atm_addr,
NULL);
} }
DPRINTK("After update2\n"); DPRINTK("After update2\n");
dump_arp_table(priv); dump_arp_table(priv);
...@@ -2241,11 +2241,11 @@ out: ...@@ -2241,11 +2241,11 @@ out:
static void static void
lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data,
struct atm_vcc *vcc, struct atm_vcc *vcc,
void (*old_push)(struct atm_vcc *vcc, struct sk_buff *skb)) void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb))
{ {
unsigned long flags; unsigned long flags;
struct lec_arp_table *entry; struct lec_arp_table *entry;
int i, found_entry=0; int i, found_entry = 0;
spin_lock_irqsave(&priv->lec_arp_lock, flags); spin_lock_irqsave(&priv->lec_arp_lock, flags);
if (ioc_data->receive == 2) { if (ioc_data->receive == 2) {
...@@ -2273,19 +2273,23 @@ lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, ...@@ -2273,19 +2273,23 @@ lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data,
priv->mcast_fwds = entry; priv->mcast_fwds = entry;
goto out; goto out;
} else if (ioc_data->receive == 1) { } else if (ioc_data->receive == 1) {
/* Vcc which we don't want to make default vcc, attach it /*
anyway. */ * Vcc which we don't want to make default vcc,
DPRINTK("LEC_ARP:Attaching data direct, not default :%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n", * attach it anyway.
ioc_data->atm_addr[0],ioc_data->atm_addr[1], */
ioc_data->atm_addr[2],ioc_data->atm_addr[3], DPRINTK
ioc_data->atm_addr[4],ioc_data->atm_addr[5], ("LEC_ARP:Attaching data direct, not default: "
ioc_data->atm_addr[6],ioc_data->atm_addr[7], "%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n",
ioc_data->atm_addr[8],ioc_data->atm_addr[9], ioc_data->atm_addr[0], ioc_data->atm_addr[1],
ioc_data->atm_addr[10],ioc_data->atm_addr[11], ioc_data->atm_addr[2], ioc_data->atm_addr[3],
ioc_data->atm_addr[12],ioc_data->atm_addr[13], ioc_data->atm_addr[4], ioc_data->atm_addr[5],
ioc_data->atm_addr[14],ioc_data->atm_addr[15], ioc_data->atm_addr[6], ioc_data->atm_addr[7],
ioc_data->atm_addr[16],ioc_data->atm_addr[17], ioc_data->atm_addr[8], ioc_data->atm_addr[9],
ioc_data->atm_addr[18],ioc_data->atm_addr[19]); ioc_data->atm_addr[10], ioc_data->atm_addr[11],
ioc_data->atm_addr[12], ioc_data->atm_addr[13],
ioc_data->atm_addr[14], ioc_data->atm_addr[15],
ioc_data->atm_addr[16], ioc_data->atm_addr[17],
ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
entry = make_entry(priv, bus_mac); entry = make_entry(priv, bus_mac);
if (entry == NULL) if (entry == NULL)
goto out; goto out;
...@@ -2302,32 +2306,37 @@ lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, ...@@ -2302,32 +2306,37 @@ lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data,
dump_arp_table(priv); dump_arp_table(priv);
goto out; goto out;
} }
DPRINTK("LEC_ARP:Attaching data direct, default:%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n", DPRINTK
ioc_data->atm_addr[0],ioc_data->atm_addr[1], ("LEC_ARP:Attaching data direct, default: "
ioc_data->atm_addr[2],ioc_data->atm_addr[3], "%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x\n",
ioc_data->atm_addr[4],ioc_data->atm_addr[5], ioc_data->atm_addr[0], ioc_data->atm_addr[1],
ioc_data->atm_addr[6],ioc_data->atm_addr[7], ioc_data->atm_addr[2], ioc_data->atm_addr[3],
ioc_data->atm_addr[8],ioc_data->atm_addr[9], ioc_data->atm_addr[4], ioc_data->atm_addr[5],
ioc_data->atm_addr[10],ioc_data->atm_addr[11], ioc_data->atm_addr[6], ioc_data->atm_addr[7],
ioc_data->atm_addr[12],ioc_data->atm_addr[13], ioc_data->atm_addr[8], ioc_data->atm_addr[9],
ioc_data->atm_addr[14],ioc_data->atm_addr[15], ioc_data->atm_addr[10], ioc_data->atm_addr[11],
ioc_data->atm_addr[16],ioc_data->atm_addr[17], ioc_data->atm_addr[12], ioc_data->atm_addr[13],
ioc_data->atm_addr[18],ioc_data->atm_addr[19]); ioc_data->atm_addr[14], ioc_data->atm_addr[15],
ioc_data->atm_addr[16], ioc_data->atm_addr[17],
ioc_data->atm_addr[18], ioc_data->atm_addr[19]);
for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
for (entry = priv->lec_arp_tables[i]; entry; entry=entry->next) { for (entry = priv->lec_arp_tables[i]; entry;
if (memcmp(ioc_data->atm_addr, entry->atm_addr, entry = entry->next) {
ATM_ESA_LEN)==0) { if (memcmp
(ioc_data->atm_addr, entry->atm_addr,
ATM_ESA_LEN) == 0) {
DPRINTK("LEC_ARP: Attaching data direct\n"); DPRINTK("LEC_ARP: Attaching data direct\n");
DPRINTK("Currently -> Vcc: %d, Rvcc:%d\n", DPRINTK("Currently -> Vcc: %d, Rvcc:%d\n",
entry->vcc?entry->vcc->vci:0, entry->vcc ? entry->vcc->vci : 0,
entry->recv_vcc?entry->recv_vcc->vci:0); entry->recv_vcc ? entry->recv_vcc->
found_entry=1; vci : 0);
found_entry = 1;
del_timer(&entry->timer); del_timer(&entry->timer);
entry->vcc = vcc; entry->vcc = vcc;
entry->old_push = old_push; entry->old_push = old_push;
if (entry->status == ESI_VC_PENDING) { if (entry->status == ESI_VC_PENDING) {
if(priv->maximum_unknown_frame_count if (priv->maximum_unknown_frame_count
==0) == 0)
entry->status = entry->status =
ESI_FORWARD_DIRECT; ESI_FORWARD_DIRECT;
else { else {
...@@ -2335,22 +2344,24 @@ lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, ...@@ -2335,22 +2344,24 @@ lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data,
entry->status = entry->status =
ESI_FLUSH_PENDING; ESI_FLUSH_PENDING;
#if 0 #if 0
send_to_lecd(priv,l_flush_xmt, send_to_lecd(priv, l_flush_xmt,
NULL, NULL,
entry->atm_addr, entry->atm_addr,
NULL); NULL);
#endif #endif
} }
} else { } else {
/* They were forming a connection /*
to us, and we to them. Our * They were forming a connection
ATM address is numerically lower * to us, and we to them. Our
than theirs, so we make connection * ATM address is numerically lower
we formed into default VCC (8.1.11). * than theirs, so we make connection
Connection they made gets torn * we formed into default VCC (8.1.11).
down. This might confuse some * Connection they made gets torn
clients. Can be changed if * down. This might confuse some
someone reports trouble... */ * clients. Can be changed if
* someone reports trouble...
*/
; ;
} }
} }
...@@ -2361,8 +2372,10 @@ lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, ...@@ -2361,8 +2372,10 @@ lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data,
dump_arp_table(priv); dump_arp_table(priv);
goto out; goto out;
} }
/* Not found, snatch address from first data packet that arrives from /*
this vcc */ * Not found, snatch address from first data packet that arrives
* from this vcc
*/
entry = make_entry(priv, bus_mac); entry = make_entry(priv, bus_mac);
if (!entry) if (!entry)
goto out; goto out;
...@@ -2382,22 +2395,23 @@ out: ...@@ -2382,22 +2395,23 @@ out:
spin_unlock_irqrestore(&priv->lec_arp_lock, flags); spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
} }
static void static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id)
lec_flush_complete(struct lec_priv *priv, unsigned long tran_id)
{ {
unsigned long flags; unsigned long flags;
struct lec_arp_table *entry; struct lec_arp_table *entry;
int i; int i;
DPRINTK("LEC:lec_flush_complete %lx\n",tran_id); DPRINTK("LEC:lec_flush_complete %lx\n", tran_id);
spin_lock_irqsave(&priv->lec_arp_lock, flags); spin_lock_irqsave(&priv->lec_arp_lock, flags);
for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
for (entry = priv->lec_arp_tables[i]; entry; entry=entry->next) { for (entry = priv->lec_arp_tables[i]; entry;
if (entry->flush_tran_id == tran_id && entry = entry->next) {
entry->status == ESI_FLUSH_PENDING) { if (entry->flush_tran_id == tran_id
&& entry->status == ESI_FLUSH_PENDING) {
struct sk_buff *skb; struct sk_buff *skb;
while ((skb = skb_dequeue(&entry->tx_wait)) != NULL) while ((skb =
skb_dequeue(&entry->tx_wait)) != NULL)
lec_send(entry->vcc, skb, entry->priv); lec_send(entry->vcc, skb, entry->priv);
entry->status = ESI_FORWARD_DIRECT; entry->status = ESI_FORWARD_DIRECT;
DPRINTK("LEC_ARP: Flushed\n"); DPRINTK("LEC_ARP: Flushed\n");
...@@ -2418,20 +2432,23 @@ lec_set_flush_tran_id(struct lec_priv *priv, ...@@ -2418,20 +2432,23 @@ lec_set_flush_tran_id(struct lec_priv *priv,
spin_lock_irqsave(&priv->lec_arp_lock, flags); spin_lock_irqsave(&priv->lec_arp_lock, flags);
for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) for (i = 0; i < LEC_ARP_TABLE_SIZE; i++)
for(entry = priv->lec_arp_tables[i]; entry; entry=entry->next) for (entry = priv->lec_arp_tables[i]; entry;
entry = entry->next)
if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) { if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) {
entry->flush_tran_id = tran_id; entry->flush_tran_id = tran_id;
DPRINTK("Set flush transaction id to %lx for %p\n",tran_id,entry); DPRINTK
("Set flush transaction id to %lx for %p\n",
tran_id, entry);
} }
spin_unlock_irqrestore(&priv->lec_arp_lock, flags); spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
} }
static int static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc)
lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc)
{ {
unsigned long flags; unsigned long flags;
unsigned char mac_addr[] = { unsigned char mac_addr[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
struct lec_arp_table *to_add; struct lec_arp_table *to_add;
struct lec_vcc_priv *vpriv; struct lec_vcc_priv *vpriv;
int err = 0; int err = 0;
...@@ -2463,18 +2480,17 @@ out: ...@@ -2463,18 +2480,17 @@ out:
return err; return err;
} }
static void static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc)
lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc)
{ {
unsigned long flags; unsigned long flags;
struct lec_arp_table *entry, *next; struct lec_arp_table *entry, *next;
int i; int i;
DPRINTK("LEC_ARP: lec_vcc_close vpi:%d vci:%d\n",vcc->vpi,vcc->vci); DPRINTK("LEC_ARP: lec_vcc_close vpi:%d vci:%d\n", vcc->vpi, vcc->vci);
dump_arp_table(priv); dump_arp_table(priv);
spin_lock_irqsave(&priv->lec_arp_lock, flags); spin_lock_irqsave(&priv->lec_arp_lock, flags);
for(i=0;i<LEC_ARP_TABLE_SIZE;i++) { for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
for(entry = priv->lec_arp_tables[i];entry; entry=next) { for (entry = priv->lec_arp_tables[i]; entry; entry = next) {
next = entry->next; next = entry->next;
if (vcc == entry->vcc) { if (vcc == entry->vcc) {
lec_arp_remove(priv, entry); lec_arp_remove(priv, entry);
...@@ -2494,8 +2510,7 @@ lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc) ...@@ -2494,8 +2510,7 @@ lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc)
lec_arp_clear_vccs(entry); lec_arp_clear_vccs(entry);
del_timer(&entry->timer); del_timer(&entry->timer);
kfree(entry); kfree(entry);
} } else { /* put it back to the list */
else { /* put it back to the list */
entry->next = priv->lec_arp_empty_ones; entry->next = priv->lec_arp_empty_ones;
priv->lec_arp_empty_ones = entry; priv->lec_arp_empty_ones = entry;
} }
...@@ -2510,8 +2525,7 @@ lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc) ...@@ -2510,8 +2525,7 @@ lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc)
lec_arp_clear_vccs(entry); lec_arp_clear_vccs(entry);
del_timer(&entry->timer); del_timer(&entry->timer);
kfree(entry); kfree(entry);
} } else {
else {
entry->next = priv->lec_no_forward; entry->next = priv->lec_no_forward;
priv->lec_no_forward = entry; priv->lec_no_forward = entry;
} }
...@@ -2526,8 +2540,7 @@ lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc) ...@@ -2526,8 +2540,7 @@ lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc)
lec_arp_clear_vccs(entry); lec_arp_clear_vccs(entry);
/* No timer, LANEv2 7.1.20 and 2.3.5.3 */ /* No timer, LANEv2 7.1.20 and 2.3.5.3 */
kfree(entry); kfree(entry);
} } else {
else {
entry->next = priv->mcast_fwds; entry->next = priv->mcast_fwds;
priv->mcast_fwds = entry; priv->mcast_fwds = entry;
} }
...@@ -2549,7 +2562,8 @@ lec_arp_check_empties(struct lec_priv *priv, ...@@ -2549,7 +2562,8 @@ lec_arp_check_empties(struct lec_priv *priv,
#ifdef CONFIG_TR #ifdef CONFIG_TR
struct lecdatahdr_8025 *tr_hdr = (struct lecdatahdr_8025 *)skb->data; struct lecdatahdr_8025 *tr_hdr = (struct lecdatahdr_8025 *)skb->data;
if (priv->is_trdev) src = tr_hdr->h_source; if (priv->is_trdev)
src = tr_hdr->h_source;
else else
#endif #endif
src = hdr->h_source; src = hdr->h_source;
...@@ -2563,7 +2577,7 @@ lec_arp_check_empties(struct lec_priv *priv, ...@@ -2563,7 +2577,7 @@ lec_arp_check_empties(struct lec_priv *priv,
entry->last_used = jiffies; entry->last_used = jiffies;
priv->lec_arp_empty_ones = entry->next; priv->lec_arp_empty_ones = entry->next;
/* We might have got an entry */ /* We might have got an entry */
if ((prev = lec_arp_find(priv,src))) { if ((prev = lec_arp_find(priv, src))) {
lec_arp_remove(priv, prev); lec_arp_remove(priv, prev);
kfree(prev); kfree(prev);
} }
...@@ -2573,7 +2587,7 @@ lec_arp_check_empties(struct lec_priv *priv, ...@@ -2573,7 +2587,7 @@ lec_arp_check_empties(struct lec_priv *priv,
prev = entry; prev = entry;
entry = entry->next; entry = entry->next;
while (entry && entry->vcc != vcc) { while (entry && entry->vcc != vcc) {
prev= entry; prev = entry;
entry = entry->next; entry = entry->next;
} }
if (!entry) { if (!entry) {
...@@ -2593,4 +2607,5 @@ lec_arp_check_empties(struct lec_priv *priv, ...@@ -2593,4 +2607,5 @@ lec_arp_check_empties(struct lec_priv *priv,
out: out:
spin_unlock_irqrestore(&priv->lec_arp_lock, flags); spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
} }
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment