Deleted Added
full compact
sfxge_port.c (278838) sfxge_port.c (279184)
1/*-
2 * Copyright (c) 2010-2011 Solarflare Communications, Inc.
3 * All rights reserved.
4 *
5 * This software was developed in part by Philip Paeps under contract for
6 * Solarflare Communications, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010-2011 Solarflare Communications, Inc.
3 * All rights reserved.
4 *
5 * This software was developed in part by Philip Paeps under contract for
6 * Solarflare Communications, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/sfxge/sfxge_port.c 278838 2015-02-16 06:10:17Z arybchik $");
31__FBSDID("$FreeBSD: head/sys/dev/sfxge/sfxge_port.c 279184 2015-02-22 19:25:57Z arybchik $");
32
33#include <sys/types.h>
34#include <sys/limits.h>
35#include <net/ethernet.h>
36#include <net/if_dl.h>
37
38#include "common/efx.h"
39

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

80 DELAY(100);
81 }
82
83 rc = ETIMEDOUT;
84out:
85 return (rc);
86}
87
32
33#include <sys/types.h>
34#include <sys/limits.h>
35#include <net/ethernet.h>
36#include <net/if_dl.h>
37
38#include "common/efx.h"
39

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

80 DELAY(100);
81 }
82
83 rc = ETIMEDOUT;
84out:
85 return (rc);
86}
87
88uint64_t
89sfxge_get_counter(struct ifnet *ifp, ift_counter c)
90{
91 struct sfxge_softc *sc = ifp->if_softc;
92 uint64_t *mac_stats;
93 uint64_t val;
94
95 SFXGE_PORT_LOCK(&sc->port);
96
97 /* Ignore error and use old values */
98 (void)sfxge_mac_stat_update(sc);
99
100 mac_stats = (uint64_t *)sc->port.mac_stats.decode_buf;
101
102 switch (c) {
103 case IFCOUNTER_IPACKETS:
104 val = mac_stats[EFX_MAC_RX_PKTS];
105 break;
106 case IFCOUNTER_IERRORS:
107 val = mac_stats[EFX_MAC_RX_ERRORS];
108 break;
109 case IFCOUNTER_OPACKETS:
110 val = mac_stats[EFX_MAC_TX_PKTS];
111 break;
112 case IFCOUNTER_OERRORS:
113 val = mac_stats[EFX_MAC_TX_ERRORS];
114 break;
115 case IFCOUNTER_COLLISIONS:
116 val = mac_stats[EFX_MAC_TX_SGL_COL_PKTS] +
117 mac_stats[EFX_MAC_TX_MULT_COL_PKTS] +
118 mac_stats[EFX_MAC_TX_EX_COL_PKTS] +
119 mac_stats[EFX_MAC_TX_LATE_COL_PKTS];
120 break;
121 case IFCOUNTER_IBYTES:
122 val = mac_stats[EFX_MAC_RX_OCTETS];
123 break;
124 case IFCOUNTER_OBYTES:
125 val = mac_stats[EFX_MAC_TX_OCTETS];
126 break;
127 case IFCOUNTER_OMCASTS:
128 val = mac_stats[EFX_MAC_TX_MULTICST_PKTS] +
129 mac_stats[EFX_MAC_TX_BRDCST_PKTS];
130 break;
131 case IFCOUNTER_OQDROPS:
132 SFXGE_PORT_UNLOCK(&sc->port);
133 return (sfxge_tx_get_drops(sc));
134 case IFCOUNTER_IMCASTS:
135 /* if_imcasts is maintained in net/if_ethersubr.c */
136 case IFCOUNTER_IQDROPS:
137 /* if_iqdrops is maintained in net/if_ethersubr.c */
138 case IFCOUNTER_NOPROTO:
139 /* if_noproto is maintained in net/if_ethersubr.c */
140 default:
141 SFXGE_PORT_UNLOCK(&sc->port);
142 return (if_get_counter_default(ifp, c));
143 }
144
145 SFXGE_PORT_UNLOCK(&sc->port);
146
147 return (val);
148}
149
88static int
89sfxge_mac_stat_handler(SYSCTL_HANDLER_ARGS)
90{
91 struct sfxge_softc *sc = arg1;
92 unsigned int id = arg2;
93 int rc;
94 uint64_t val;
95

--- 706 unchanged lines hidden ---
150static int
151sfxge_mac_stat_handler(SYSCTL_HANDLER_ARGS)
152{
153 struct sfxge_softc *sc = arg1;
154 unsigned int id = arg2;
155 int rc;
156 uint64_t val;
157

--- 706 unchanged lines hidden ---