Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152990366
D27870.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D27870.diff
View Options
diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c
--- a/sys/dev/neta/if_mvneta.c
+++ b/sys/dev/neta/if_mvneta.c
@@ -186,6 +186,7 @@
/* MIB */
STATIC void mvneta_clear_mib(struct mvneta_softc *);
+STATIC uint64_t mvneta_read_mib(struct mvneta_softc *, int);
STATIC void mvneta_update_mib(struct mvneta_softc *);
/* Switch */
@@ -1102,7 +1103,7 @@
mvneta_initreg(struct ifnet *ifp)
{
struct mvneta_softc *sc;
- int q, i;
+ int q;
uint32_t reg;
sc = ifp->if_softc;
@@ -1189,14 +1190,7 @@
MVNETA_WRITE(sc, MVNETA_PXCX, reg);
/* clear MIB counter registers(clear by read) */
- for (i = 0; i < nitems(mvneta_mib_list); i++) {
- if (mvneta_mib_list[i].reg64)
- MVNETA_READ_MIB_8(sc, mvneta_mib_list[i].regnum);
- else
- MVNETA_READ_MIB_4(sc, mvneta_mib_list[i].regnum);
- }
- MVNETA_READ(sc, MVNETA_PDFC);
- MVNETA_READ(sc, MVNETA_POFC);
+ mvneta_clear_mib(sc);
/* Set SDC register except IPGINT bits */
reg = MVNETA_SDC_RXBSZ_16_64BITWORDS;
@@ -3538,6 +3532,19 @@
/*
* MIB
*/
+STATIC uint64_t
+mvneta_read_mib(struct mvneta_softc *sc, int index)
+{
+ struct mvneta_mib_def *mib;
+ uint64_t val;
+
+ mib = &mvneta_mib_list[index];
+ val = MVNETA_READ_MIB(sc, mib->regnum);
+ if (mib->reg64)
+ val |= (uint64_t)MVNETA_READ_MIB(sc, mib->regnum + 4) << 32;
+ return (val);
+}
+
STATIC void
mvneta_clear_mib(struct mvneta_softc *sc)
{
@@ -3546,10 +3553,7 @@
KASSERT_SC_MTX(sc);
for (i = 0; i < nitems(mvneta_mib_list); i++) {
- if (mvneta_mib_list[i].reg64)
- MVNETA_READ_MIB_8(sc, mvneta_mib_list[i].regnum);
- else
- MVNETA_READ_MIB_4(sc, mvneta_mib_list[i].regnum);
+ (void)mvneta_read_mib(sc, i);
sc->sysctl_mib[i].counter = 0;
}
MVNETA_READ(sc, MVNETA_PDFC);
@@ -3569,11 +3573,7 @@
for (i = 0; i < nitems(mvneta_mib_list); i++) {
- if (mvneta_mib_list[i].reg64)
- val = MVNETA_READ_MIB_8(sc, mvneta_mib_list[i].regnum);
- else
- val = MVNETA_READ_MIB_4(sc, mvneta_mib_list[i].regnum);
-
+ val = mvneta_read_mib(sc, i);
if (val == 0)
continue;
diff --git a/sys/dev/neta/if_mvnetavar.h b/sys/dev/neta/if_mvnetavar.h
--- a/sys/dev/neta/if_mvnetavar.h
+++ b/sys/dev/neta/if_mvnetavar.h
@@ -69,10 +69,8 @@
#define MVNETA_WRITE_REGION(sc, reg, val, c) \
bus_write_region_4((sc)->res[0], (reg), (val), (c))
-#define MVNETA_READ_MIB_4(sc, reg) \
+#define MVNETA_READ_MIB(sc, reg) \
bus_read_4((sc)->res[0], MVNETA_PORTMIB_BASE + (reg))
-#define MVNETA_READ_MIB_8(sc, reg) \
- bus_read_8((sc)->res[0], MVNETA_PORTMIB_BASE + (reg))
#define MVNETA_IS_LINKUP(sc) \
(MVNETA_READ((sc), MVNETA_PSR) & MVNETA_PSR_LINKUP)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 12:27 PM (2 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31769347
Default Alt Text
D27870.diff (2 KB)
Attached To
Mode
D27870: mvneta: Fix 64-bit MIB reads
Attached
Detach File
Event Timeline
Log In to Comment