aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ksz884x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ksz884x.c')
-rw-r--r--drivers/net/ksz884x.c61
1 files changed, 29 insertions, 32 deletions
diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c
index 7805bbf1d53a..37504a398906 100644
--- a/drivers/net/ksz884x.c
+++ b/drivers/net/ksz884x.c
@@ -1457,7 +1457,6 @@ struct dev_info {
1457 * @adapter: Adapter device information. 1457 * @adapter: Adapter device information.
1458 * @port: Port information. 1458 * @port: Port information.
1459 * @monitor_time_info: Timer to monitor ports. 1459 * @monitor_time_info: Timer to monitor ports.
1460 * @stats: Network statistics.
1461 * @proc_sem: Semaphore for proc accessing. 1460 * @proc_sem: Semaphore for proc accessing.
1462 * @id: Device ID. 1461 * @id: Device ID.
1463 * @mii_if: MII interface information. 1462 * @mii_if: MII interface information.
@@ -1471,7 +1470,6 @@ struct dev_priv {
1471 struct dev_info *adapter; 1470 struct dev_info *adapter;
1472 struct ksz_port port; 1471 struct ksz_port port;
1473 struct ksz_timer_info monitor_timer_info; 1472 struct ksz_timer_info monitor_timer_info;
1474 struct net_device_stats stats;
1475 1473
1476 struct semaphore proc_sem; 1474 struct semaphore proc_sem;
1477 int id; 1475 int id;
@@ -4751,8 +4749,8 @@ static void send_packet(struct sk_buff *skb, struct net_device *dev)
4751 hw_send_pkt(hw); 4749 hw_send_pkt(hw);
4752 4750
4753 /* Update transmit statistics. */ 4751 /* Update transmit statistics. */
4754 priv->stats.tx_packets++; 4752 dev->stats.tx_packets++;
4755 priv->stats.tx_bytes += len; 4753 dev->stats.tx_bytes += len;
4756} 4754}
4757 4755
4758/** 4756/**
@@ -5030,7 +5028,7 @@ static inline int rx_proc(struct net_device *dev, struct ksz_hw* hw,
5030 /* skb->data != skb->head */ 5028 /* skb->data != skb->head */
5031 skb = dev_alloc_skb(packet_len + 2); 5029 skb = dev_alloc_skb(packet_len + 2);
5032 if (!skb) { 5030 if (!skb) {
5033 priv->stats.rx_dropped++; 5031 dev->stats.rx_dropped++;
5034 return -ENOMEM; 5032 return -ENOMEM;
5035 } 5033 }
5036 5034
@@ -5050,8 +5048,8 @@ static inline int rx_proc(struct net_device *dev, struct ksz_hw* hw,
5050 csum_verified(skb); 5048 csum_verified(skb);
5051 5049
5052 /* Update receive statistics. */ 5050 /* Update receive statistics. */
5053 priv->stats.rx_packets++; 5051 dev->stats.rx_packets++;
5054 priv->stats.rx_bytes += packet_len; 5052 dev->stats.rx_bytes += packet_len;
5055 5053
5056 /* Notify upper layer for received packet. */ 5054 /* Notify upper layer for received packet. */
5057 rx_status = netif_rx(skb); 5055 rx_status = netif_rx(skb);
@@ -5291,7 +5289,7 @@ static irqreturn_t netdev_intr(int irq, void *dev_id)
5291 } 5289 }
5292 5290
5293 if (unlikely(int_enable & KS884X_INT_RX_OVERRUN)) { 5291 if (unlikely(int_enable & KS884X_INT_RX_OVERRUN)) {
5294 priv->stats.rx_fifo_errors++; 5292 dev->stats.rx_fifo_errors++;
5295 hw_resume_rx(hw); 5293 hw_resume_rx(hw);
5296 } 5294 }
5297 5295
@@ -5522,7 +5520,7 @@ static int netdev_open(struct net_device *dev)
5522 priv->promiscuous = 0; 5520 priv->promiscuous = 0;
5523 5521
5524 /* Reset device statistics. */ 5522 /* Reset device statistics. */
5525 memset(&priv->stats, 0, sizeof(struct net_device_stats)); 5523 memset(&dev->stats, 0, sizeof(struct net_device_stats));
5526 memset((void *) port->counter, 0, 5524 memset((void *) port->counter, 0,
5527 (sizeof(u64) * OID_COUNTER_LAST)); 5525 (sizeof(u64) * OID_COUNTER_LAST));
5528 5526
@@ -5622,42 +5620,42 @@ static struct net_device_stats *netdev_query_statistics(struct net_device *dev)
5622 int i; 5620 int i;
5623 int p; 5621 int p;
5624 5622
5625 priv->stats.rx_errors = port->counter[OID_COUNTER_RCV_ERROR]; 5623 dev->stats.rx_errors = port->counter[OID_COUNTER_RCV_ERROR];
5626 priv->stats.tx_errors = port->counter[OID_COUNTER_XMIT_ERROR]; 5624 dev->stats.tx_errors = port->counter[OID_COUNTER_XMIT_ERROR];
5627 5625
5628 /* Reset to zero to add count later. */ 5626 /* Reset to zero to add count later. */
5629 priv->stats.multicast = 0; 5627 dev->stats.multicast = 0;
5630 priv->stats.collisions = 0; 5628 dev->stats.collisions = 0;
5631 priv->stats.rx_length_errors = 0; 5629 dev->stats.rx_length_errors = 0;
5632 priv->stats.rx_crc_errors = 0; 5630 dev->stats.rx_crc_errors = 0;
5633 priv->stats.rx_frame_errors = 0; 5631 dev->stats.rx_frame_errors = 0;
5634 priv->stats.tx_window_errors = 0; 5632 dev->stats.tx_window_errors = 0;
5635 5633
5636 for (i = 0, p = port->first_port; i < port->mib_port_cnt; i++, p++) { 5634 for (i = 0, p = port->first_port; i < port->mib_port_cnt; i++, p++) {
5637 mib = &hw->port_mib[p]; 5635 mib = &hw->port_mib[p];
5638 5636
5639 priv->stats.multicast += (unsigned long) 5637 dev->stats.multicast += (unsigned long)
5640 mib->counter[MIB_COUNTER_RX_MULTICAST]; 5638 mib->counter[MIB_COUNTER_RX_MULTICAST];
5641 5639
5642 priv->stats.collisions += (unsigned long) 5640 dev->stats.collisions += (unsigned long)
5643 mib->counter[MIB_COUNTER_TX_TOTAL_COLLISION]; 5641 mib->counter[MIB_COUNTER_TX_TOTAL_COLLISION];
5644 5642
5645 priv->stats.rx_length_errors += (unsigned long)( 5643 dev->stats.rx_length_errors += (unsigned long)(
5646 mib->counter[MIB_COUNTER_RX_UNDERSIZE] + 5644 mib->counter[MIB_COUNTER_RX_UNDERSIZE] +
5647 mib->counter[MIB_COUNTER_RX_FRAGMENT] + 5645 mib->counter[MIB_COUNTER_RX_FRAGMENT] +
5648 mib->counter[MIB_COUNTER_RX_OVERSIZE] + 5646 mib->counter[MIB_COUNTER_RX_OVERSIZE] +
5649 mib->counter[MIB_COUNTER_RX_JABBER]); 5647 mib->counter[MIB_COUNTER_RX_JABBER]);
5650 priv->stats.rx_crc_errors += (unsigned long) 5648 dev->stats.rx_crc_errors += (unsigned long)
5651 mib->counter[MIB_COUNTER_RX_CRC_ERR]; 5649 mib->counter[MIB_COUNTER_RX_CRC_ERR];
5652 priv->stats.rx_frame_errors += (unsigned long)( 5650 dev->stats.rx_frame_errors += (unsigned long)(
5653 mib->counter[MIB_COUNTER_RX_ALIGNMENT_ERR] + 5651 mib->counter[MIB_COUNTER_RX_ALIGNMENT_ERR] +
5654 mib->counter[MIB_COUNTER_RX_SYMBOL_ERR]); 5652 mib->counter[MIB_COUNTER_RX_SYMBOL_ERR]);
5655 5653
5656 priv->stats.tx_window_errors += (unsigned long) 5654 dev->stats.tx_window_errors += (unsigned long)
5657 mib->counter[MIB_COUNTER_TX_LATE_COLLISION]; 5655 mib->counter[MIB_COUNTER_TX_LATE_COLLISION];
5658 } 5656 }
5659 5657
5660 return &priv->stats; 5658 return &dev->stats;
5661} 5659}
5662 5660
5663/** 5661/**
@@ -5718,7 +5716,7 @@ static void dev_set_promiscuous(struct net_device *dev, struct dev_priv *priv,
5718 * from the bridge. 5716 * from the bridge.
5719 */ 5717 */
5720 if ((hw->features & STP_SUPPORT) && !promiscuous && 5718 if ((hw->features & STP_SUPPORT) && !promiscuous &&
5721 dev->br_port) { 5719 (dev->priv_flags & IFF_BRIDGE_PORT)) {
5722 struct ksz_switch *sw = hw->ksz_switch; 5720 struct ksz_switch *sw = hw->ksz_switch;
5723 int port = priv->port.first_port; 5721 int port = priv->port.first_port;
5724 5722
@@ -6812,7 +6810,7 @@ static int stp;
6812static int fast_aging; 6810static int fast_aging;
6813 6811
6814/** 6812/**
6815 * netdev_init - initalize network device. 6813 * netdev_init - initialize network device.
6816 * @dev: Network device. 6814 * @dev: Network device.
6817 * 6815 *
6818 * This function initializes the network device. 6816 * This function initializes the network device.
@@ -6896,13 +6894,12 @@ static void get_mac_addr(struct dev_info *hw_priv, u8 *macaddr, int port)
6896 i = j = num = got_num = 0; 6894 i = j = num = got_num = 0;
6897 while (j < MAC_ADDR_LEN) { 6895 while (j < MAC_ADDR_LEN) {
6898 if (macaddr[i]) { 6896 if (macaddr[i]) {
6897 int digit;
6898
6899 got_num = 1; 6899 got_num = 1;
6900 if ('0' <= macaddr[i] && macaddr[i] <= '9') 6900 digit = hex_to_bin(macaddr[i]);
6901 num = num * 16 + macaddr[i] - '0'; 6901 if (digit >= 0)
6902 else if ('A' <= macaddr[i] && macaddr[i] <= 'F') 6902 num = num * 16 + digit;
6903 num = num * 16 + 10 + macaddr[i] - 'A';
6904 else if ('a' <= macaddr[i] && macaddr[i] <= 'f')
6905 num = num * 16 + 10 + macaddr[i] - 'a';
6906 else if (':' == macaddr[i]) 6903 else if (':' == macaddr[i])
6907 got_num = 2; 6904 got_num = 2;
6908 else 6905 else