Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 214283
b: refs/heads/master
c: 7162f66
h: refs/heads/master
i:
  214281: 6c48f83
  214279: 4d734cb
v: v3
  • Loading branch information
David S. Miller committed Sep 2, 2010
1 parent 51c6c37 commit 6cb1aa6
Show file tree
Hide file tree
Showing 11 changed files with 177 additions and 170 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: 78ab952717b62c0ba6ca7f7a27eaa0486685e45f
refs/heads/master: 7162f6691e9d39d8d866574687cddb3f1ec65d72
52 changes: 24 additions & 28 deletions trunk/drivers/net/bna/bnad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1964,25 +1964,24 @@ bnad_enable_default_bcast(struct bnad *bnad)

/* Statistics utilities */
void
bnad_netdev_qstats_fill(struct bnad *bnad)
bnad_netdev_qstats_fill(struct bnad *bnad, struct rtnl_link_stats64 *stats)
{
struct net_device_stats *net_stats = &bnad->net_stats;
int i, j;

for (i = 0; i < bnad->num_rx; i++) {
for (j = 0; j < bnad->num_rxp_per_rx; j++) {
if (bnad->rx_info[i].rx_ctrl[j].ccb) {
net_stats->rx_packets += bnad->rx_info[i].
stats->rx_packets += bnad->rx_info[i].
rx_ctrl[j].ccb->rcb[0]->rxq->rx_packets;
net_stats->rx_bytes += bnad->rx_info[i].
stats->rx_bytes += bnad->rx_info[i].
rx_ctrl[j].ccb->rcb[0]->rxq->rx_bytes;
if (bnad->rx_info[i].rx_ctrl[j].ccb->rcb[1] &&
bnad->rx_info[i].rx_ctrl[j].ccb->
rcb[1]->rxq) {
net_stats->rx_packets +=
stats->rx_packets +=
bnad->rx_info[i].rx_ctrl[j].
ccb->rcb[1]->rxq->rx_packets;
net_stats->rx_bytes +=
stats->rx_bytes +=
bnad->rx_info[i].rx_ctrl[j].
ccb->rcb[1]->rxq->rx_bytes;
}
Expand All @@ -1992,9 +1991,9 @@ bnad_netdev_qstats_fill(struct bnad *bnad)
for (i = 0; i < bnad->num_tx; i++) {
for (j = 0; j < bnad->num_txq_per_tx; j++) {
if (bnad->tx_info[i].tcb[j]) {
net_stats->tx_packets +=
stats->tx_packets +=
bnad->tx_info[i].tcb[j]->txq->tx_packets;
net_stats->tx_bytes +=
stats->tx_bytes +=
bnad->tx_info[i].tcb[j]->txq->tx_bytes;
}
}
Expand All @@ -2005,37 +2004,36 @@ bnad_netdev_qstats_fill(struct bnad *bnad)
* Must be called with the bna_lock held.
*/
void
bnad_netdev_hwstats_fill(struct bnad *bnad)
bnad_netdev_hwstats_fill(struct bnad *bnad, struct rtnl_link_stats64 *stats)
{
struct bfi_ll_stats_mac *mac_stats;
struct net_device_stats *net_stats = &bnad->net_stats;
u64 bmap;
int i;

mac_stats = &bnad->stats.bna_stats->hw_stats->mac_stats;
net_stats->rx_errors =
stats->rx_errors =
mac_stats->rx_fcs_error + mac_stats->rx_alignment_error +
mac_stats->rx_frame_length_error + mac_stats->rx_code_error +
mac_stats->rx_undersize;
net_stats->tx_errors = mac_stats->tx_fcs_error +
stats->tx_errors = mac_stats->tx_fcs_error +
mac_stats->tx_undersize;
net_stats->rx_dropped = mac_stats->rx_drop;
net_stats->tx_dropped = mac_stats->tx_drop;
net_stats->multicast = mac_stats->rx_multicast;
net_stats->collisions = mac_stats->tx_total_collision;
stats->rx_dropped = mac_stats->rx_drop;
stats->tx_dropped = mac_stats->tx_drop;
stats->multicast = mac_stats->rx_multicast;
stats->collisions = mac_stats->tx_total_collision;

net_stats->rx_length_errors = mac_stats->rx_frame_length_error;
stats->rx_length_errors = mac_stats->rx_frame_length_error;

/* receive ring buffer overflow ?? */

net_stats->rx_crc_errors = mac_stats->rx_fcs_error;
net_stats->rx_frame_errors = mac_stats->rx_alignment_error;
stats->rx_crc_errors = mac_stats->rx_fcs_error;
stats->rx_frame_errors = mac_stats->rx_alignment_error;
/* recv'r fifo overrun */
bmap = (u64)bnad->stats.bna_stats->rxf_bmap[0] |
((u64)bnad->stats.bna_stats->rxf_bmap[1] << 32);
for (i = 0; bmap && (i < BFI_LL_RXF_ID_MAX); i++) {
if (bmap & 1) {
net_stats->rx_fifo_errors =
stats->rx_fifo_errors +=
bnad->stats.bna_stats->
hw_stats->rxf_stats[i].frame_drops;
break;
Expand Down Expand Up @@ -2638,22 +2636,20 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
* Used spin_lock to synchronize reading of stats structures, which
* is written by BNA under the same lock.
*/
static struct net_device_stats *
bnad_get_netdev_stats(struct net_device *netdev)
static struct rtnl_link_stats64 *
bnad_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
{
struct bnad *bnad = netdev_priv(netdev);
unsigned long flags;

spin_lock_irqsave(&bnad->bna_lock, flags);

memset(&bnad->net_stats, 0, sizeof(struct net_device_stats));

bnad_netdev_qstats_fill(bnad);
bnad_netdev_hwstats_fill(bnad);
bnad_netdev_qstats_fill(bnad, stats);
bnad_netdev_hwstats_fill(bnad, stats);

spin_unlock_irqrestore(&bnad->bna_lock, flags);

return &bnad->net_stats;
return stats;
}

static void
Expand Down Expand Up @@ -2858,7 +2854,7 @@ static const struct net_device_ops bnad_netdev_ops = {
.ndo_open = bnad_open,
.ndo_stop = bnad_stop,
.ndo_start_xmit = bnad_start_xmit,
.ndo_get_stats = bnad_get_netdev_stats,
.ndo_get_stats64 = bnad_get_stats64,
.ndo_set_rx_mode = bnad_set_rx_mode,
.ndo_set_multicast_list = bnad_set_rx_mode,
.ndo_validate_addr = eth_validate_addr,
Expand Down
5 changes: 2 additions & 3 deletions trunk/drivers/net/bna/bnad.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ struct bnad {

/* Statistics */
struct bnad_stats stats;
struct net_device_stats net_stats;

struct bnad_diag *diag;

Expand Down Expand Up @@ -308,8 +307,8 @@ extern void bnad_cleanup_rx(struct bnad *bnad, uint rx_id);
extern void bnad_dim_timer_start(struct bnad *bnad);

/* Statistics */
extern void bnad_netdev_qstats_fill(struct bnad *bnad);
extern void bnad_netdev_hwstats_fill(struct bnad *bnad);
extern void bnad_netdev_qstats_fill(struct bnad *bnad, struct rtnl_link_stats64 *stats);
extern void bnad_netdev_hwstats_fill(struct bnad *bnad, struct rtnl_link_stats64 *stats);

/**
* MACROS
Expand Down
17 changes: 7 additions & 10 deletions trunk/drivers/net/bna/bnad_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#define BNAD_NUM_TXQ_COUNTERS 5

#define BNAD_ETHTOOL_STATS_NUM \
(sizeof(struct net_device_stats) / sizeof(unsigned long) + \
(sizeof(struct rtnl_link_stats64) / sizeof(u64) + \
sizeof(struct bnad_drv_stats) / sizeof(u64) + \
offsetof(struct bfi_ll_stats, rxf_stats[0]) / sizeof(u64))

Expand Down Expand Up @@ -1159,7 +1159,8 @@ bnad_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats,
{
struct bnad *bnad = netdev_priv(netdev);
int i, j, bi;
unsigned long *net_stats, flags;
unsigned long flags;
struct rtnl_link_stats64 *net_stats64;
u64 *stats64;
u64 bmap;

Expand All @@ -1176,16 +1177,12 @@ bnad_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats,
spin_lock_irqsave(&bnad->bna_lock, flags);
bi = 0;
memset(buf, 0, stats->n_stats * sizeof(u64));
memset(&bnad->net_stats, 0, sizeof(struct net_device_stats));

bnad_netdev_qstats_fill(bnad);
bnad_netdev_hwstats_fill(bnad);
net_stats64 = (struct rtnl_link_stats64 *)buf;
bnad_netdev_qstats_fill(bnad, net_stats64);
bnad_netdev_hwstats_fill(bnad, net_stats64);

/* Fill net_stats into ethtool buffers */
net_stats = (unsigned long *)&bnad->net_stats;
for (i = 0; i < sizeof(struct net_device_stats) / sizeof(unsigned long);
i++)
buf[bi++] = net_stats[i];
bi = sizeof(*net_stats64) / sizeof(u64);

/* Fill driver stats into ethtool buffers */
stats64 = (u64 *)&bnad->stats.drv_stats;
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/net/cxgb4vf/sge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,6 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp,
__skb_pull(skb, PKTSHIFT);
skb->protocol = eth_type_trans(skb, rspq->netdev);
skb_record_rx_queue(skb, rspq->idx);
skb->dev->last_rx = jiffies; /* XXX removed 2.6.29 */
pi = netdev_priv(skb->dev);
rxq->stats.pkts++;

Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/net/pxa168_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,6 @@ static int rxq_process(struct net_device *dev, int budget)
skb->protocol = eth_type_trans(skb, dev);
netif_receive_skb(skb);
}
dev->last_rx = jiffies;
}
/* Fill RX ring with skb's */
rxq_refill(dev);
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ struct mii_bus {
/* list of all PHYs on bus */
struct phy_device *phy_map[PHY_MAX_ADDR];

/* Phy addresses to be ignored when probing */
/* PHY addresses to be ignored when probing */
u32 phy_mask;

/*
Expand Down Expand Up @@ -283,7 +283,7 @@ struct phy_device {

phy_interface_t interface;

/* Bus address of the PHY (0-32) */
/* Bus address of the PHY (0-31) */
int addr;

/*
Expand Down
32 changes: 15 additions & 17 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,14 @@ static inline void netdev_set_addr_lockdep_class(struct net_device *dev)
* --ANK (980803)
*/

static inline struct list_head *ptype_head(const struct packet_type *pt)
{
if (pt->type == htons(ETH_P_ALL))
return &ptype_all;
else
return &ptype_base[ntohs(pt->type) & PTYPE_HASH_MASK];
}

/**
* dev_add_pack - add packet handler
* @pt: packet type declaration
Expand All @@ -386,16 +394,11 @@ static inline void netdev_set_addr_lockdep_class(struct net_device *dev)

void dev_add_pack(struct packet_type *pt)
{
int hash;
struct list_head *head = ptype_head(pt);

spin_lock_bh(&ptype_lock);
if (pt->type == htons(ETH_P_ALL))
list_add_rcu(&pt->list, &ptype_all);
else {
hash = ntohs(pt->type) & PTYPE_HASH_MASK;
list_add_rcu(&pt->list, &ptype_base[hash]);
}
spin_unlock_bh(&ptype_lock);
spin_lock(&ptype_lock);
list_add_rcu(&pt->list, head);
spin_unlock(&ptype_lock);
}
EXPORT_SYMBOL(dev_add_pack);

Expand All @@ -414,15 +417,10 @@ EXPORT_SYMBOL(dev_add_pack);
*/
void __dev_remove_pack(struct packet_type *pt)
{
struct list_head *head;
struct list_head *head = ptype_head(pt);
struct packet_type *pt1;

spin_lock_bh(&ptype_lock);

if (pt->type == htons(ETH_P_ALL))
head = &ptype_all;
else
head = &ptype_base[ntohs(pt->type) & PTYPE_HASH_MASK];
spin_lock(&ptype_lock);

list_for_each_entry(pt1, head, list) {
if (pt == pt1) {
Expand All @@ -433,7 +431,7 @@ void __dev_remove_pack(struct packet_type *pt)

printk(KERN_WARNING "dev_remove_pack: %p not found.\n", pt);
out:
spin_unlock_bh(&ptype_lock);
spin_unlock(&ptype_lock);
}
EXPORT_SYMBOL(__dev_remove_pack);

Expand Down
Loading

0 comments on commit 6cb1aa6

Please sign in to comment.