Deleted Added
full compact
if_bge.c (154292) if_bge.c (154492)
1/*-
2 * Copyright (c) 2001 Wind River Systems
3 * Copyright (c) 1997, 1998, 1999, 2001
4 * Bill Paul <wpaul@windriver.com>. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 18 unchanged lines hidden (view full) ---

27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001 Wind River Systems
3 * Copyright (c) 1997, 1998, 1999, 2001
4 * Bill Paul <wpaul@windriver.com>. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 18 unchanged lines hidden (view full) ---

27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/dev/bge/if_bge.c 154292 2006-01-13 08:59:40Z oleg $");
35__FBSDID("$FreeBSD: head/sys/dev/bge/if_bge.c 154492 2006-01-17 23:01:58Z oleg $");
36
37/*
38 * Broadcom BCM570x family gigabit ethernet driver for FreeBSD.
39 *
40 * The Broadcom BCM5700 is based on technology originally developed by
41 * Alteon Networks as part of the Tigon I and Tigon II gigabit ethernet
42 * MAC chips. The BCM5700, sometimes refered to as the Tigon III, has
43 * two on-board MIPS R4000 CPUs and can have as much as 16MB of external

--- 2813 unchanged lines hidden (view full) ---

2857
2858static void
2859bge_stats_update_regs(sc)
2860 struct bge_softc *sc;
2861{
2862 struct ifnet *ifp;
2863 struct bge_mac_stats_regs stats;
2864 u_int32_t *s;
36
37/*
38 * Broadcom BCM570x family gigabit ethernet driver for FreeBSD.
39 *
40 * The Broadcom BCM5700 is based on technology originally developed by
41 * Alteon Networks as part of the Tigon I and Tigon II gigabit ethernet
42 * MAC chips. The BCM5700, sometimes refered to as the Tigon III, has
43 * two on-board MIPS R4000 CPUs and can have as much as 16MB of external

--- 2813 unchanged lines hidden (view full) ---

2857
2858static void
2859bge_stats_update_regs(sc)
2860 struct bge_softc *sc;
2861{
2862 struct ifnet *ifp;
2863 struct bge_mac_stats_regs stats;
2864 u_int32_t *s;
2865 u_long cnt; /* current register value */
2865 int i;
2866
2867 ifp = sc->bge_ifp;
2868
2869 s = (u_int32_t *)&stats;
2870 for (i = 0; i < sizeof(struct bge_mac_stats_regs); i += 4) {
2871 *s = CSR_READ_4(sc, BGE_RX_STATS + i);
2872 s++;
2873 }
2874
2866 int i;
2867
2868 ifp = sc->bge_ifp;
2869
2870 s = (u_int32_t *)&stats;
2871 for (i = 0; i < sizeof(struct bge_mac_stats_regs); i += 4) {
2872 *s = CSR_READ_4(sc, BGE_RX_STATS + i);
2873 s++;
2874 }
2875
2875 ifp->if_collisions +=
2876 (stats.dot3StatsSingleCollisionFrames +
2877 stats.dot3StatsMultipleCollisionFrames +
2878 stats.dot3StatsExcessiveCollisions +
2879 stats.dot3StatsLateCollisions) -
2880 ifp->if_collisions;
2881
2882 return;
2876 cnt = stats.dot3StatsSingleCollisionFrames +
2877 stats.dot3StatsMultipleCollisionFrames +
2878 stats.dot3StatsExcessiveCollisions +
2879 stats.dot3StatsLateCollisions;
2880 ifp->if_collisions += cnt >= sc->bge_tx_collisions ?
2881 cnt - sc->bge_tx_collisions : cnt;
2882 sc->bge_tx_collisions = cnt;
2883}
2884
2885static void
2886bge_stats_update(sc)
2887 struct bge_softc *sc;
2888{
2889 struct ifnet *ifp;
2890 bus_size_t stats;
2883}
2884
2885static void
2886bge_stats_update(sc)
2887 struct bge_softc *sc;
2888{
2889 struct ifnet *ifp;
2890 bus_size_t stats;
2891 u_long cnt; /* current register value */
2891
2892 ifp = sc->bge_ifp;
2893
2894 stats = BGE_MEMWIN_START + BGE_STATS_BLOCK;
2895
2896#define READ_STAT(sc, stats, stat) \
2897 CSR_READ_4(sc, stats + offsetof(struct bge_stats, stat))
2898
2892
2893 ifp = sc->bge_ifp;
2894
2895 stats = BGE_MEMWIN_START + BGE_STATS_BLOCK;
2896
2897#define READ_STAT(sc, stats, stat) \
2898 CSR_READ_4(sc, stats + offsetof(struct bge_stats, stat))
2899
2899 ifp->if_collisions +=
2900 (READ_STAT(sc, stats,
2901 txstats.dot3StatsSingleCollisionFrames.bge_addr_lo) +
2902 READ_STAT(sc, stats,
2903 txstats.dot3StatsMultipleCollisionFrames.bge_addr_lo) +
2904 READ_STAT(sc, stats,
2905 txstats.dot3StatsExcessiveCollisions.bge_addr_lo) +
2906 READ_STAT(sc, stats,
2907 txstats.dot3StatsLateCollisions.bge_addr_lo)) -
2908 ifp->if_collisions;
2900 cnt = READ_STAT(sc, stats,
2901 txstats.dot3StatsSingleCollisionFrames.bge_addr_lo);
2902 cnt += READ_STAT(sc, stats,
2903 txstats.dot3StatsMultipleCollisionFrames.bge_addr_lo);
2904 cnt += READ_STAT(sc, stats,
2905 txstats.dot3StatsExcessiveCollisions.bge_addr_lo);
2906 cnt += READ_STAT(sc, stats,
2907 txstats.dot3StatsLateCollisions.bge_addr_lo);
2908 ifp->if_collisions += cnt >= sc->bge_tx_collisions ?
2909 cnt - sc->bge_tx_collisions : cnt;
2910 sc->bge_tx_collisions = cnt;
2909
2911
2910#undef READ_STAT
2912 cnt = READ_STAT(sc, stats, ifInDiscards.bge_addr_lo);
2913 ifp->if_ierrors += cnt >= sc->bge_rx_discards ?
2914 cnt - sc->bge_rx_discards : cnt;
2915 sc->bge_rx_discards = cnt;
2911
2916
2912#ifdef notdef
2913 ifp->if_collisions +=
2914 (sc->bge_rdata->bge_info.bge_stats.dot3StatsSingleCollisionFrames +
2915 sc->bge_rdata->bge_info.bge_stats.dot3StatsMultipleCollisionFrames +
2916 sc->bge_rdata->bge_info.bge_stats.dot3StatsExcessiveCollisions +
2917 sc->bge_rdata->bge_info.bge_stats.dot3StatsLateCollisions) -
2918 ifp->if_collisions;
2919#endif
2917 cnt = READ_STAT(sc, stats, txstats.ifOutDiscards.bge_addr_lo);
2918 ifp->if_oerrors += cnt >= sc->bge_tx_discards ?
2919 cnt - sc->bge_tx_discards : cnt;
2920 sc->bge_tx_discards = cnt;
2920
2921
2921 return;
2922#undef READ_STAT
2922}
2923
2924/*
2925 * Pad outbound frame to ETHER_MIN_NOPAD for an unusual reason.
2926 * The bge hardware will pad out Tx runts to ETHER_MIN_NOPAD,
2927 * but when such padded frames employ the bge IP/TCP checksum offload,
2928 * the hardware checksum assist gives incorrect results (possibly
2929 * from incorporating its own padding into the UDP/TCP checksum; who knows).

--- 902 unchanged lines hidden ---
2923}
2924
2925/*
2926 * Pad outbound frame to ETHER_MIN_NOPAD for an unusual reason.
2927 * The bge hardware will pad out Tx runts to ETHER_MIN_NOPAD,
2928 * but when such padded frames employ the bge IP/TCP checksum offload,
2929 * the hardware checksum assist gives incorrect results (possibly
2930 * from incorporating its own padding into the UDP/TCP checksum; who knows).

--- 902 unchanged lines hidden ---