Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121670
b: refs/heads/master
c: 02e7173
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Hemminger authored and Jeff Garzik committed Nov 2, 2008
1 parent e051890 commit 262c0e8
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 76 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: 8ba25dad0ac78850cd46d91186a27d60f7314752
refs/heads/master: 02e7173149c3ffcf963075ec2bdc5f7be8335a78
43 changes: 21 additions & 22 deletions trunk/drivers/net/atlx/atl1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,7 @@ static void atl1_via_workaround(struct atl1_adapter *adapter)

static void atl1_inc_smb(struct atl1_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
struct stats_msg_block *smb = adapter->smb.smb;

/* Fill out the OS statistics structure */
Expand Down Expand Up @@ -1704,30 +1705,30 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
adapter->soft_stats.tx_trunc += smb->tx_trunc;
adapter->soft_stats.tx_pause += smb->tx_pause;

adapter->net_stats.rx_packets = adapter->soft_stats.rx_packets;
adapter->net_stats.tx_packets = adapter->soft_stats.tx_packets;
adapter->net_stats.rx_bytes = adapter->soft_stats.rx_bytes;
adapter->net_stats.tx_bytes = adapter->soft_stats.tx_bytes;
adapter->net_stats.multicast = adapter->soft_stats.multicast;
adapter->net_stats.collisions = adapter->soft_stats.collisions;
adapter->net_stats.rx_errors = adapter->soft_stats.rx_errors;
adapter->net_stats.rx_over_errors =
netdev->stats.rx_packets = adapter->soft_stats.rx_packets;
netdev->stats.tx_packets = adapter->soft_stats.tx_packets;
netdev->stats.rx_bytes = adapter->soft_stats.rx_bytes;
netdev->stats.tx_bytes = adapter->soft_stats.tx_bytes;
netdev->stats.multicast = adapter->soft_stats.multicast;
netdev->stats.collisions = adapter->soft_stats.collisions;
netdev->stats.rx_errors = adapter->soft_stats.rx_errors;
netdev->stats.rx_over_errors =
adapter->soft_stats.rx_missed_errors;
adapter->net_stats.rx_length_errors =
netdev->stats.rx_length_errors =
adapter->soft_stats.rx_length_errors;
adapter->net_stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors;
adapter->net_stats.rx_frame_errors =
netdev->stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors;
netdev->stats.rx_frame_errors =
adapter->soft_stats.rx_frame_errors;
adapter->net_stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors;
adapter->net_stats.rx_missed_errors =
netdev->stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors;
netdev->stats.rx_missed_errors =
adapter->soft_stats.rx_missed_errors;
adapter->net_stats.tx_errors = adapter->soft_stats.tx_errors;
adapter->net_stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors;
adapter->net_stats.tx_aborted_errors =
netdev->stats.tx_errors = adapter->soft_stats.tx_errors;
netdev->stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors;
netdev->stats.tx_aborted_errors =
adapter->soft_stats.tx_aborted_errors;
adapter->net_stats.tx_window_errors =
netdev->stats.tx_window_errors =
adapter->soft_stats.tx_window_errors;
adapter->net_stats.tx_carrier_errors =
netdev->stats.tx_carrier_errors =
adapter->soft_stats.tx_carrier_errors;
}

Expand Down Expand Up @@ -1860,7 +1861,7 @@ static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter)
adapter->rx_buffer_len + NET_IP_ALIGN);
if (unlikely(!skb)) {
/* Better luck next round */
adapter->net_stats.rx_dropped++;
adapter->netdev->stats.rx_dropped++;
break;
}

Expand Down Expand Up @@ -2983,7 +2984,7 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
netdev->open = &atl1_open;
netdev->stop = &atl1_close;
netdev->hard_start_xmit = &atl1_xmit_frame;
netdev->get_stats = &atlx_get_stats;

netdev->set_multicast_list = &atlx_set_multi;
netdev->set_mac_address = &atl1_set_mac;
netdev->change_mtu = &atl1_change_mtu;
Expand Down Expand Up @@ -3173,8 +3174,6 @@ static struct atl1_stats atl1_gstrings_stats[] = {
{"tx_bytes", ATL1_STAT(soft_stats.tx_bytes)},
{"rx_errors", ATL1_STAT(soft_stats.rx_errors)},
{"tx_errors", ATL1_STAT(soft_stats.tx_errors)},
{"rx_dropped", ATL1_STAT(net_stats.rx_dropped)},
{"tx_dropped", ATL1_STAT(net_stats.tx_dropped)},
{"multicast", ATL1_STAT(soft_stats.multicast)},
{"collisions", ATL1_STAT(soft_stats.collisions)},
{"rx_length_errors", ATL1_STAT(soft_stats.rx_length_errors)},
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/atlx/atl1.h
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ struct atl1_hw {
struct atl1_adapter {
struct net_device *netdev;
struct pci_dev *pdev;
struct net_device_stats net_stats;

struct atl1_sft_stats soft_stats;
struct vlan_group *vlgrp;
u32 rx_buffer_len;
Expand Down
55 changes: 22 additions & 33 deletions trunk/drivers/net/atlx/atl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
* Check that some rx space is free. If not,
* free one and mark stats->rx_dropped++.
*/
adapter->net_stats.rx_dropped++;
netdev->stats.rx_dropped++;
break;
}
skb_reserve(skb, NET_IP_ALIGN);
Expand All @@ -435,20 +435,20 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
} else
#endif
netif_rx(skb);
adapter->net_stats.rx_bytes += rx_size;
adapter->net_stats.rx_packets++;
netdev->stats.rx_bytes += rx_size;
netdev->stats.rx_packets++;
netdev->last_rx = jiffies;
} else {
adapter->net_stats.rx_errors++;
netdev->stats.rx_errors++;

if (rxd->status.ok && rxd->status.pkt_size <= 60)
adapter->net_stats.rx_length_errors++;
netdev->stats.rx_length_errors++;
if (rxd->status.mcast)
adapter->net_stats.multicast++;
netdev->stats.multicast++;
if (rxd->status.crc)
adapter->net_stats.rx_crc_errors++;
netdev->stats.rx_crc_errors++;
if (rxd->status.align)
adapter->net_stats.rx_frame_errors++;
netdev->stats.rx_frame_errors++;
}

/* advance write ptr */
Expand All @@ -463,6 +463,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)

static void atl2_intr_tx(struct atl2_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
u32 txd_read_ptr;
u32 txs_write_ptr;
struct tx_pkt_status *txs;
Expand Down Expand Up @@ -522,20 +523,20 @@ static void atl2_intr_tx(struct atl2_adapter *adapter)

/* tx statistics: */
if (txs->ok) {
adapter->net_stats.tx_bytes += txs->pkt_size;
adapter->net_stats.tx_packets++;
netdev->stats.tx_bytes += txs->pkt_size;
netdev->stats.tx_packets++;
}
else
adapter->net_stats.tx_errors++;
netdev->stats.tx_errors++;

if (txs->defer)
adapter->net_stats.collisions++;
netdev->stats.collisions++;
if (txs->abort_col)
adapter->net_stats.tx_aborted_errors++;
netdev->stats.tx_aborted_errors++;
if (txs->late_col)
adapter->net_stats.tx_window_errors++;
netdev->stats.tx_window_errors++;
if (txs->underun)
adapter->net_stats.tx_fifo_errors++;
netdev->stats.tx_fifo_errors++;
} while (1);

if (free_hole) {
Expand Down Expand Up @@ -621,7 +622,7 @@ static irqreturn_t atl2_intr(int irq, void *data)

/* link event */
if (status & (ISR_PHY | ISR_MANUAL)) {
adapter->net_stats.tx_carrier_errors++;
adapter->netdev->stats.tx_carrier_errors++;
atl2_check_for_link(adapter);
}

Expand Down Expand Up @@ -899,19 +900,6 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
return NETDEV_TX_OK;
}

/*
* atl2_get_stats - Get System Network Statistics
* @netdev: network interface device structure
*
* Returns the address of the device statistics structure.
* The statistics are actually updated from the timer callback.
*/
static struct net_device_stats *atl2_get_stats(struct net_device *netdev)
{
struct atl2_adapter *adapter = netdev_priv(netdev);
return &adapter->net_stats;
}

/*
* atl2_change_mtu - Change the Maximum Transfer Unit
* @netdev: network interface device structure
Expand Down Expand Up @@ -1050,16 +1038,18 @@ static void atl2_tx_timeout(struct net_device *netdev)
static void atl2_watchdog(unsigned long data)
{
struct atl2_adapter *adapter = (struct atl2_adapter *) data;
u32 drop_rxd, drop_rxs;
unsigned long flags;

if (!test_bit(__ATL2_DOWN, &adapter->flags)) {
u32 drop_rxd, drop_rxs;
unsigned long flags;

spin_lock_irqsave(&adapter->stats_lock, flags);
drop_rxd = ATL2_READ_REG(&adapter->hw, REG_STS_RXD_OV);
drop_rxs = ATL2_READ_REG(&adapter->hw, REG_STS_RXS_OV);
adapter->net_stats.rx_over_errors += (drop_rxd+drop_rxs);
spin_unlock_irqrestore(&adapter->stats_lock, flags);

adapter->netdev->stats.rx_over_errors += drop_rxd + drop_rxs;

/* Reset the timer */
mod_timer(&adapter->watchdog_timer, jiffies + 4 * HZ);
}
Expand Down Expand Up @@ -1396,7 +1386,6 @@ static int __devinit atl2_probe(struct pci_dev *pdev,
netdev->open = &atl2_open;
netdev->stop = &atl2_close;
netdev->hard_start_xmit = &atl2_xmit_frame;
netdev->get_stats = &atl2_get_stats;
netdev->set_multicast_list = &atl2_set_multi;
netdev->set_mac_address = &atl2_set_mac;
netdev->change_mtu = &atl2_change_mtu;
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/net/atlx/atl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ struct atl2_adapter {
/* OS defined structs */
struct net_device *netdev;
struct pci_dev *pdev;
struct net_device_stats net_stats;
#ifdef NETIF_F_HW_VLAN_TX
struct vlan_group *vlgrp;
#endif
Expand Down
13 changes: 0 additions & 13 deletions trunk/drivers/net/atlx/atlx.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,6 @@ static void atlx_clear_phy_int(struct atlx_adapter *adapter)
spin_unlock_irqrestore(&adapter->lock, flags);
}

/*
* atlx_get_stats - Get System Network Statistics
* @netdev: network interface device structure
*
* Returns the address of the device statistics structure.
* The statistics are actually updated from the timer callback.
*/
static struct net_device_stats *atlx_get_stats(struct net_device *netdev)
{
struct atlx_adapter *adapter = netdev_priv(netdev);
return &adapter->net_stats;
}

/*
* atlx_tx_timeout - Respond to a Tx Hang
* @netdev: network interface device structure
Expand Down
93 changes: 88 additions & 5 deletions trunk/net/sched/sch_netem.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
*/
cb->time_to_send = psched_get_time();
q->counter = 0;

__skb_queue_head(&q->qdisc->q, skb);
q->qdisc->qstats.backlog += qdisc_pkt_len(skb);
q->qdisc->qstats.requeues++;
ret = NET_XMIT_SUCCESS;
ret = q->qdisc->ops->requeue(skb, q->qdisc);
}

if (likely(ret == NET_XMIT_SUCCESS)) {
Expand Down Expand Up @@ -626,8 +622,95 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
return -1;
}

static int netem_dump_class(struct Qdisc *sch, unsigned long cl,
struct sk_buff *skb, struct tcmsg *tcm)
{
struct netem_sched_data *q = qdisc_priv(sch);

if (cl != 1) /* only one class */
return -ENOENT;

tcm->tcm_handle |= TC_H_MIN(1);
tcm->tcm_info = q->qdisc->handle;

return 0;
}

static int netem_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
struct Qdisc **old)
{
struct netem_sched_data *q = qdisc_priv(sch);

if (new == NULL)
new = &noop_qdisc;

sch_tree_lock(sch);
*old = xchg(&q->qdisc, new);
qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
qdisc_reset(*old);
sch_tree_unlock(sch);

return 0;
}

static struct Qdisc *netem_leaf(struct Qdisc *sch, unsigned long arg)
{
struct netem_sched_data *q = qdisc_priv(sch);
return q->qdisc;
}

static unsigned long netem_get(struct Qdisc *sch, u32 classid)
{
return 1;
}

static void netem_put(struct Qdisc *sch, unsigned long arg)
{
}

static int netem_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
struct nlattr **tca, unsigned long *arg)
{
return -ENOSYS;
}

static int netem_delete(struct Qdisc *sch, unsigned long arg)
{
return -ENOSYS;
}

static void netem_walk(struct Qdisc *sch, struct qdisc_walker *walker)
{
if (!walker->stop) {
if (walker->count >= walker->skip)
if (walker->fn(sch, 1, walker) < 0) {
walker->stop = 1;
return;
}
walker->count++;
}
}

static struct tcf_proto **netem_find_tcf(struct Qdisc *sch, unsigned long cl)
{
return NULL;
}

static const struct Qdisc_class_ops netem_class_ops = {
.graft = netem_graft,
.leaf = netem_leaf,
.get = netem_get,
.put = netem_put,
.change = netem_change_class,
.delete = netem_delete,
.walk = netem_walk,
.tcf_chain = netem_find_tcf,
.dump = netem_dump_class,
};

static struct Qdisc_ops netem_qdisc_ops __read_mostly = {
.id = "netem",
.cl_ops = &netem_class_ops,
.priv_size = sizeof(struct netem_sched_data),
.enqueue = netem_enqueue,
.dequeue = netem_dequeue,
Expand Down

0 comments on commit 262c0e8

Please sign in to comment.