aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2014-09-03 09:34:10 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-09-12 03:51:10 -0400
commit4f0aeb1e967d1039d7988aaf84d087916bac30ea (patch)
tree52d8c77ce86e79c182b62d8c5cead478d8ca0e87
parentadc810900a703ee78fe88fd65e086d359fec04b2 (diff)
e1000: move e1000_tbi_adjust_stats to where its used
... and make it static. Signed-off-by: Florian Westphal <fw@strlen.de> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_hw.c78
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_hw.h2
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c77
3 files changed, 77 insertions, 80 deletions
diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.c b/drivers/net/ethernet/intel/e1000/e1000_hw.c
index 1acf5034db10..45c8c864104e 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_hw.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_hw.c
@@ -4837,84 +4837,6 @@ void e1000_update_adaptive(struct e1000_hw *hw)
4837} 4837}
4838 4838
4839/** 4839/**
4840 * e1000_tbi_adjust_stats
4841 * @hw: Struct containing variables accessed by shared code
4842 * @frame_len: The length of the frame in question
4843 * @mac_addr: The Ethernet destination address of the frame in question
4844 *
4845 * Adjusts the statistic counters when a frame is accepted by TBI_ACCEPT
4846 */
4847void e1000_tbi_adjust_stats(struct e1000_hw *hw, struct e1000_hw_stats *stats,
4848 u32 frame_len, u8 *mac_addr)
4849{
4850 u64 carry_bit;
4851
4852 /* First adjust the frame length. */
4853 frame_len--;
4854 /* We need to adjust the statistics counters, since the hardware
4855 * counters overcount this packet as a CRC error and undercount
4856 * the packet as a good packet
4857 */
4858 /* This packet should not be counted as a CRC error. */
4859 stats->crcerrs--;
4860 /* This packet does count as a Good Packet Received. */
4861 stats->gprc++;
4862
4863 /* Adjust the Good Octets received counters */
4864 carry_bit = 0x80000000 & stats->gorcl;
4865 stats->gorcl += frame_len;
4866 /* If the high bit of Gorcl (the low 32 bits of the Good Octets
4867 * Received Count) was one before the addition,
4868 * AND it is zero after, then we lost the carry out,
4869 * need to add one to Gorch (Good Octets Received Count High).
4870 * This could be simplified if all environments supported
4871 * 64-bit integers.
4872 */
4873 if (carry_bit && ((stats->gorcl & 0x80000000) == 0))
4874 stats->gorch++;
4875 /* Is this a broadcast or multicast? Check broadcast first,
4876 * since the test for a multicast frame will test positive on
4877 * a broadcast frame.
4878 */
4879 if (is_broadcast_ether_addr(mac_addr))
4880 /* Broadcast packet */
4881 stats->bprc++;
4882 else if (is_multicast_ether_addr(mac_addr))
4883 /* Multicast packet */
4884 stats->mprc++;
4885
4886 if (frame_len == hw->max_frame_size) {
4887 /* In this case, the hardware has overcounted the number of
4888 * oversize frames.
4889 */
4890 if (stats->roc > 0)
4891 stats->roc--;
4892 }
4893
4894 /* Adjust the bin counters when the extra byte put the frame in the
4895 * wrong bin. Remember that the frame_len was adjusted above.
4896 */
4897 if (frame_len == 64) {
4898 stats->prc64++;
4899 stats->prc127--;
4900 } else if (frame_len == 127) {
4901 stats->prc127++;
4902 stats->prc255--;
4903 } else if (frame_len == 255) {
4904 stats->prc255++;
4905 stats->prc511--;
4906 } else if (frame_len == 511) {
4907 stats->prc511++;
4908 stats->prc1023--;
4909 } else if (frame_len == 1023) {
4910 stats->prc1023++;
4911 stats->prc1522--;
4912 } else if (frame_len == 1522) {
4913 stats->prc1522++;
4914 }
4915}
4916
4917/**
4918 * e1000_get_bus_info 4840 * e1000_get_bus_info
4919 * @hw: Struct containing variables accessed by shared code 4841 * @hw: Struct containing variables accessed by shared code
4920 * 4842 *
diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.h b/drivers/net/ethernet/intel/e1000/e1000_hw.h
index 11578c8978db..5cf7268cc4e1 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_hw.h
+++ b/drivers/net/ethernet/intel/e1000/e1000_hw.h
@@ -393,8 +393,6 @@ s32 e1000_blink_led_start(struct e1000_hw *hw);
393/* Everything else */ 393/* Everything else */
394void e1000_reset_adaptive(struct e1000_hw *hw); 394void e1000_reset_adaptive(struct e1000_hw *hw);
395void e1000_update_adaptive(struct e1000_hw *hw); 395void e1000_update_adaptive(struct e1000_hw *hw);
396void e1000_tbi_adjust_stats(struct e1000_hw *hw, struct e1000_hw_stats *stats,
397 u32 frame_len, u8 * mac_addr);
398void e1000_get_bus_info(struct e1000_hw *hw); 396void e1000_get_bus_info(struct e1000_hw *hw);
399void e1000_pci_set_mwi(struct e1000_hw *hw); 397void e1000_pci_set_mwi(struct e1000_hw *hw);
400void e1000_pci_clear_mwi(struct e1000_hw *hw); 398void e1000_pci_clear_mwi(struct e1000_hw *hw);
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index ad3d5d12173f..fe2b9ad83cb5 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -3981,6 +3981,83 @@ static void e1000_receive_skb(struct e1000_adapter *adapter, u8 status,
3981} 3981}
3982 3982
3983/** 3983/**
3984 * e1000_tbi_adjust_stats
3985 * @hw: Struct containing variables accessed by shared code
3986 * @frame_len: The length of the frame in question
3987 * @mac_addr: The Ethernet destination address of the frame in question
3988 *
3989 * Adjusts the statistic counters when a frame is accepted by TBI_ACCEPT
3990 */
3991static void e1000_tbi_adjust_stats(struct e1000_hw *hw,
3992 struct e1000_hw_stats *stats,
3993 u32 frame_len, const u8 *mac_addr)
3994{
3995 u64 carry_bit;
3996
3997 /* First adjust the frame length. */
3998 frame_len--;
3999 /* We need to adjust the statistics counters, since the hardware
4000 * counters overcount this packet as a CRC error and undercount
4001 * the packet as a good packet
4002 */
4003 /* This packet should not be counted as a CRC error. */
4004 stats->crcerrs--;
4005 /* This packet does count as a Good Packet Received. */
4006 stats->gprc++;
4007
4008 /* Adjust the Good Octets received counters */
4009 carry_bit = 0x80000000 & stats->gorcl;
4010 stats->gorcl += frame_len;
4011 /* If the high bit of Gorcl (the low 32 bits of the Good Octets
4012 * Received Count) was one before the addition,
4013 * AND it is zero after, then we lost the carry out,
4014 * need to add one to Gorch (Good Octets Received Count High).
4015 * This could be simplified if all environments supported
4016 * 64-bit integers.
4017 */
4018 if (carry_bit && ((stats->gorcl & 0x80000000) == 0))
4019 stats->gorch++;
4020 /* Is this a broadcast or multicast? Check broadcast first,
4021 * since the test for a multicast frame will test positive on
4022 * a broadcast frame.
4023 */
4024 if (is_broadcast_ether_addr(mac_addr))
4025 stats->bprc++;
4026 else if (is_multicast_ether_addr(mac_addr))
4027 stats->mprc++;
4028
4029 if (frame_len == hw->max_frame_size) {
4030 /* In this case, the hardware has overcounted the number of
4031 * oversize frames.
4032 */
4033 if (stats->roc > 0)
4034 stats->roc--;
4035 }
4036
4037 /* Adjust the bin counters when the extra byte put the frame in the
4038 * wrong bin. Remember that the frame_len was adjusted above.
4039 */
4040 if (frame_len == 64) {
4041 stats->prc64++;
4042 stats->prc127--;
4043 } else if (frame_len == 127) {
4044 stats->prc127++;
4045 stats->prc255--;
4046 } else if (frame_len == 255) {
4047 stats->prc255++;
4048 stats->prc511--;
4049 } else if (frame_len == 511) {
4050 stats->prc511++;
4051 stats->prc1023--;
4052 } else if (frame_len == 1023) {
4053 stats->prc1023++;
4054 stats->prc1522--;
4055 } else if (frame_len == 1522) {
4056 stats->prc1522++;
4057 }
4058}
4059
4060/**
3984 * e1000_clean_jumbo_rx_irq - Send received data up the network stack; legacy 4061 * e1000_clean_jumbo_rx_irq - Send received data up the network stack; legacy
3985 * @adapter: board private structure 4062 * @adapter: board private structure
3986 * @rx_ring: ring to clean 4063 * @rx_ring: ring to clean