Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102520
b: refs/heads/master
c: 8e26916
h: refs/heads/master
v: v3
  • Loading branch information
Paulius Zaleckas authored and Jeff Garzik committed May 13, 2008
1 parent 9fa03ca commit 30d0f90
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 66 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ef43ebaa538e0cc9063cbf84593a05091bcace2
refs/heads/master: 8e2691658f4cd2e24beacb6dcba3c33b2ff10593
70 changes: 34 additions & 36 deletions trunk/drivers/net/pcmcia/axnet_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ static void ei_tx_timeout(struct net_device *dev)
int txsr, isr, tickssofar = jiffies - dev->trans_start;
unsigned long flags;

ei_local->stat.tx_errors++;
dev->stats.tx_errors++;

spin_lock_irqsave(&ei_local->page_lock, flags);
txsr = inb(e8390_base+EN0_TSR);
Expand All @@ -1032,7 +1032,7 @@ static void ei_tx_timeout(struct net_device *dev)
dev->name, (txsr & ENTSR_ABT) ? "excess collisions." :
(isr) ? "lost interrupt?" : "cable problem?", txsr, isr, tickssofar);

if (!isr && !ei_local->stat.tx_packets)
if (!isr && !dev->stats.tx_packets)
{
/* The 8390 probably hasn't gotten on the cable yet. */
ei_local->interface_num ^= 1; /* Try a different xcvr. */
Expand Down Expand Up @@ -1122,7 +1122,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue(dev);
outb_p(ENISR_ALL, e8390_base + EN0_IMR);
spin_unlock_irqrestore(&ei_local->page_lock, flags);
ei_local->stat.tx_errors++;
dev->stats.tx_errors++;
return 1;
}

Expand Down Expand Up @@ -1170,7 +1170,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
spin_unlock_irqrestore(&ei_local->page_lock, flags);

dev_kfree_skb (skb);
ei_local->stat.tx_bytes += send_length;
dev->stats.tx_bytes += send_length;

return 0;
}
Expand Down Expand Up @@ -1262,9 +1262,9 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)

if (interrupts & ENISR_COUNTERS)
{
ei_local->stat.rx_frame_errors += inb_p(e8390_base + EN0_COUNTER0);
ei_local->stat.rx_crc_errors += inb_p(e8390_base + EN0_COUNTER1);
ei_local->stat.rx_missed_errors+= inb_p(e8390_base + EN0_COUNTER2);
dev->stats.rx_frame_errors += inb_p(e8390_base + EN0_COUNTER0);
dev->stats.rx_crc_errors += inb_p(e8390_base + EN0_COUNTER1);
dev->stats.rx_missed_errors+= inb_p(e8390_base + EN0_COUNTER2);
}
}

Expand Down Expand Up @@ -1309,7 +1309,6 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
static void ei_tx_err(struct net_device *dev)
{
long e8390_base = dev->base_addr;
struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
unsigned char txsr = inb_p(e8390_base+EN0_TSR);
unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU);

Expand All @@ -1332,10 +1331,10 @@ static void ei_tx_err(struct net_device *dev)
ei_tx_intr(dev);
else
{
ei_local->stat.tx_errors++;
if (txsr & ENTSR_CRS) ei_local->stat.tx_carrier_errors++;
if (txsr & ENTSR_CDH) ei_local->stat.tx_heartbeat_errors++;
if (txsr & ENTSR_OWC) ei_local->stat.tx_window_errors++;
dev->stats.tx_errors++;
if (txsr & ENTSR_CRS) dev->stats.tx_carrier_errors++;
if (txsr & ENTSR_CDH) dev->stats.tx_heartbeat_errors++;
if (txsr & ENTSR_OWC) dev->stats.tx_window_errors++;
}
}

Expand Down Expand Up @@ -1397,25 +1396,25 @@ static void ei_tx_intr(struct net_device *dev)

/* Minimize Tx latency: update the statistics after we restart TXing. */
if (status & ENTSR_COL)
ei_local->stat.collisions++;
dev->stats.collisions++;
if (status & ENTSR_PTX)
ei_local->stat.tx_packets++;
dev->stats.tx_packets++;
else
{
ei_local->stat.tx_errors++;
dev->stats.tx_errors++;
if (status & ENTSR_ABT)
{
ei_local->stat.tx_aborted_errors++;
ei_local->stat.collisions += 16;
dev->stats.tx_aborted_errors++;
dev->stats.collisions += 16;
}
if (status & ENTSR_CRS)
ei_local->stat.tx_carrier_errors++;
dev->stats.tx_carrier_errors++;
if (status & ENTSR_FU)
ei_local->stat.tx_fifo_errors++;
dev->stats.tx_fifo_errors++;
if (status & ENTSR_CDH)
ei_local->stat.tx_heartbeat_errors++;
dev->stats.tx_heartbeat_errors++;
if (status & ENTSR_OWC)
ei_local->stat.tx_window_errors++;
dev->stats.tx_window_errors++;
}
netif_wake_queue(dev);
}
Expand Down Expand Up @@ -1476,8 +1475,8 @@ static void ei_receive(struct net_device *dev)
printk(KERN_DEBUG "%s: bogus packet size: %d, status=%#2x nxpg=%#2x.\n",
dev->name, rx_frame.count, rx_frame.status,
rx_frame.next);
ei_local->stat.rx_errors++;
ei_local->stat.rx_length_errors++;
dev->stats.rx_errors++;
dev->stats.rx_length_errors++;
}
else if ((pkt_stat & 0x0F) == ENRSR_RXOK)
{
Expand All @@ -1489,7 +1488,7 @@ static void ei_receive(struct net_device *dev)
if (ei_debug > 1)
printk(KERN_DEBUG "%s: Couldn't allocate a sk_buff of size %d.\n",
dev->name, pkt_len);
ei_local->stat.rx_dropped++;
dev->stats.rx_dropped++;
break;
}
else
Expand All @@ -1500,10 +1499,10 @@ static void ei_receive(struct net_device *dev)
skb->protocol=eth_type_trans(skb,dev);
netif_rx(skb);
dev->last_rx = jiffies;
ei_local->stat.rx_packets++;
ei_local->stat.rx_bytes += pkt_len;
dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len;
if (pkt_stat & ENRSR_PHY)
ei_local->stat.multicast++;
dev->stats.multicast++;
}
}
else
Expand All @@ -1512,10 +1511,10 @@ static void ei_receive(struct net_device *dev)
printk(KERN_DEBUG "%s: bogus packet: status=%#2x nxpg=%#2x size=%d\n",
dev->name, rx_frame.status, rx_frame.next,
rx_frame.count);
ei_local->stat.rx_errors++;
dev->stats.rx_errors++;
/* NB: The NIC counts CRC, frame and missed errors. */
if (pkt_stat & ENRSR_FO)
ei_local->stat.rx_fifo_errors++;
dev->stats.rx_fifo_errors++;
}
next_frame = rx_frame.next;

Expand Down Expand Up @@ -1550,7 +1549,6 @@ static void ei_rx_overrun(struct net_device *dev)
axnet_dev_t *info = PRIV(dev);
long e8390_base = dev->base_addr;
unsigned char was_txing, must_resend = 0;
struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);

/*
* Record whether a Tx was in progress and then issue the
Expand All @@ -1561,7 +1559,7 @@ static void ei_rx_overrun(struct net_device *dev)

if (ei_debug > 1)
printk(KERN_DEBUG "%s: Receiver overrun.\n", dev->name);
ei_local->stat.rx_over_errors++;
dev->stats.rx_over_errors++;

/*
* Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total.
Expand Down Expand Up @@ -1622,16 +1620,16 @@ static struct net_device_stats *get_stats(struct net_device *dev)

/* If the card is stopped, just return the present stats. */
if (!netif_running(dev))
return &ei_local->stat;
return &dev->stats;

spin_lock_irqsave(&ei_local->page_lock,flags);
/* Read the counter registers, assuming we are in page 0. */
ei_local->stat.rx_frame_errors += inb_p(ioaddr + EN0_COUNTER0);
ei_local->stat.rx_crc_errors += inb_p(ioaddr + EN0_COUNTER1);
ei_local->stat.rx_missed_errors+= inb_p(ioaddr + EN0_COUNTER2);
dev->stats.rx_frame_errors += inb_p(ioaddr + EN0_COUNTER0);
dev->stats.rx_crc_errors += inb_p(ioaddr + EN0_COUNTER1);
dev->stats.rx_missed_errors+= inb_p(ioaddr + EN0_COUNTER2);
spin_unlock_irqrestore(&ei_local->page_lock, flags);

return &ei_local->stat;
return &dev->stats;
}

/*
Expand Down
3 changes: 1 addition & 2 deletions trunk/include/net/tipc/tipc_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ struct tipc_port {
u32 tipc_createport_raw(void *usr_handle,
u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
void (*wakeup)(struct tipc_port *),
const u32 importance,
struct tipc_port **tp_ptr);
const u32 importance);

int tipc_reject_msg(struct sk_buff *buf, u32 err);

Expand Down
7 changes: 5 additions & 2 deletions trunk/net/tipc/name_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,12 +1050,15 @@ void tipc_nametbl_dump(void)

int tipc_nametbl_init(void)
{
table.types = kcalloc(tipc_nametbl_size, sizeof(struct hlist_head),
GFP_ATOMIC);
int array_size = sizeof(struct hlist_head) * tipc_nametbl_size;

table.types = kzalloc(array_size, GFP_ATOMIC);
if (!table.types)
return -ENOMEM;

write_lock_bh(&tipc_nametbl_lock);
table.local_publ_count = 0;
write_unlock_bh(&tipc_nametbl_lock);
return 0;
}

Expand Down
20 changes: 8 additions & 12 deletions trunk/net/tipc/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,15 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp)
}

/**
* tipc_createport_raw - create a generic TIPC port
* tipc_createport_raw - create a native TIPC port
*
* Returns port reference, or 0 if unable to create it
*
* Note: The newly created port is returned in the locked state.
* Returns local port reference
*/

u32 tipc_createport_raw(void *usr_handle,
u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
void (*wakeup)(struct tipc_port *),
const u32 importance,
struct tipc_port **tp_ptr)
const u32 importance)
{
struct port *p_ptr;
struct tipc_msg *msg;
Expand All @@ -240,6 +237,7 @@ u32 tipc_createport_raw(void *usr_handle,
return 0;
}

tipc_port_lock(ref);
p_ptr->publ.usr_handle = usr_handle;
p_ptr->publ.max_pkt = MAX_PKT_DEFAULT;
p_ptr->publ.ref = ref;
Expand All @@ -264,7 +262,7 @@ u32 tipc_createport_raw(void *usr_handle,
INIT_LIST_HEAD(&p_ptr->port_list);
list_add_tail(&p_ptr->port_list, &ports);
spin_unlock_bh(&tipc_port_list_lock);
*tp_ptr = &p_ptr->publ;
tipc_port_unlock(p_ptr);
return ref;
}

Expand Down Expand Up @@ -1055,21 +1053,19 @@ int tipc_createport(u32 user_ref,
{
struct user_port *up_ptr;
struct port *p_ptr;
struct tipc_port *tp_ptr;
u32 ref;

up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
if (!up_ptr) {
warn("Port creation failed, no memory\n");
return -ENOMEM;
}
ref = tipc_createport_raw(NULL, port_dispatcher, port_wakeup,
importance, &tp_ptr);
if (ref == 0) {
ref = tipc_createport_raw(NULL, port_dispatcher, port_wakeup, importance);
p_ptr = tipc_port_lock(ref);
if (!p_ptr) {
kfree(up_ptr);
return -ENOMEM;
}
p_ptr = (struct port *)tp_ptr;

p_ptr->user_port = up_ptr;
up_ptr->user_ref = user_ref;
Expand Down
12 changes: 4 additions & 8 deletions trunk/net/tipc/ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,9 @@ void tipc_ref_table_stop(void)
/**
* tipc_ref_acquire - create reference to an object
*
* Register an object pointer in reference table and lock the object.
* Returns a unique reference value that is used from then on to retrieve the
* object pointer, or to determine that the object has been deregistered.
*
* Note: The object is returned in the locked state so that the caller can
* register a partially initialized object, without running the risk that
* the object will be accessed before initialization is complete.
* Return a unique reference value which can be translated back to the pointer
* 'object' at a later time. Also, pass back a pointer to the lock protecting
* the object, but without locking it.
*/

u32 tipc_ref_acquire(void *object, spinlock_t **lock)
Expand Down Expand Up @@ -182,13 +178,13 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
ref = (next_plus_upper & ~index_mask) + index;
entry->ref = ref;
entry->object = object;
spin_unlock_bh(&entry->lock);
*lock = &entry->lock;
}
else if (tipc_ref_table.init_point < tipc_ref_table.capacity) {
index = tipc_ref_table.init_point++;
entry = &(tipc_ref_table.entries[index]);
spin_lock_init(&entry->lock);
spin_lock_bh(&entry->lock);
ref = tipc_ref_table.start_mask + index;
entry->ref = ref;
entry->object = object;
Expand Down
5 changes: 1 addition & 4 deletions trunk/net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol)
const struct proto_ops *ops;
socket_state state;
struct sock *sk;
struct tipc_port *tp_ptr;
u32 portref;

/* Validate arguments */
Expand Down Expand Up @@ -226,7 +225,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol)
/* Allocate TIPC port for socket to use */

portref = tipc_createport_raw(sk, &dispatch, &wakeupdispatch,
TIPC_LOW_IMPORTANCE, &tp_ptr);
TIPC_LOW_IMPORTANCE);
if (unlikely(portref == 0)) {
sk_free(sk);
return -ENOMEM;
Expand All @@ -242,8 +241,6 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol)
sk->sk_backlog_rcv = backlog_rcv;
tipc_sk(sk)->p = tipc_get_port(portref);

spin_unlock_bh(tp_ptr->lock);

if (sock->state == SS_READY) {
tipc_set_portunreturnable(portref, 1);
if (sock->type == SOCK_DGRAM)
Expand Down
1 change: 0 additions & 1 deletion trunk/net/tipc/subscr.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ static void subscr_named_msg_event(void *usr_handle,
kfree(subscriber);
return;
}
spin_unlock_bh(subscriber->lock);

/* Establish a connection to subscriber */

Expand Down

0 comments on commit 30d0f90

Please sign in to comment.