CVS commit: src/sys/dev/marvell

2023-05-28 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun May 28 08:01:46 UTC 2023

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
s/sessoin/session/ in warning message.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvxpsec.c
diff -u src/sys/dev/marvell/mvxpsec.c:1.18 src/sys/dev/marvell/mvxpsec.c:1.19
--- src/sys/dev/marvell/mvxpsec.c:1.18	Sat Dec 31 21:15:20 2022
+++ src/sys/dev/marvell/mvxpsec.c	Sun May 28 08:01:46 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.18 2022/12/31 21:15:20 andvar Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.19 2023/05/28 08:01:46 andvar Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -2010,7 +2010,7 @@ fail:
 	if (mv_s)
 		mvxpsec_session_dealloc(mv_s);
 	log(LOG_WARNING,
-	"%s: Failed to add H/W crypto sessoin (id:%u): err=%d\n",
+	"%s: Failed to add H/W crypto session (id:%u): err=%d\n",
 	   __func__, session, err);
 
 	mutex_exit(>sc_session_mtx);



CVS commit: src/sys/dev/marvell

2023-05-28 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun May 28 08:01:46 UTC 2023

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
s/sessoin/session/ in warning message.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2022-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Dec 31 21:15:20 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
fix few typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvxpsec.c
diff -u src/sys/dev/marvell/mvxpsec.c:1.17 src/sys/dev/marvell/mvxpsec.c:1.18
--- src/sys/dev/marvell/mvxpsec.c:1.17	Fri Jul  8 07:02:47 2022
+++ src/sys/dev/marvell/mvxpsec.c	Sat Dec 31 21:15:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.17 2022/07/08 07:02:47 skrll Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.18 2022/12/31 21:15:20 andvar Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -442,7 +442,7 @@ mvxpsec_attach(device_t parent, device_t
 	pool_cache_setlowat(sc->sc_session_pool, MVXPSEC_MAX_SESSIONS / 2);
 	sc->sc_last_session = NULL;
 
-	/* Pakcet */
+	/* Packet */
 	sc->sc_packet_pool =
 	pool_cache_init(sizeof(struct mvxpsec_session), 0, 0, 0,
 	"mvxpsec_pktpl", NULL, IPL_NET,
@@ -1025,7 +1025,7 @@ mvxpsec_dma_sync_packet(struct mvxpsec_s
 /*
  * Initialize MVXPSEC Internal SRAM
  *
- * - must be called after DMA initizlization.
+ * - must be called after DMA initialization.
  * - make VM mapping for SRAM area on MBus.
  */
 STATIC int
@@ -1312,7 +1312,7 @@ mvxpsec_intr_cnt(struct mvxpsec_softc *s
  * Setup MVXPSEC header structure.
  *
  * the header contains descriptor of security accelerator,
- * key material of chiphers, iv of ciphers and macs, ...
+ * key material of ciphers, iv of ciphers and macs, ...
  *
  * the header is transferred to MVXPSEC Internal SRAM by TDMA,
  * and parsed by MVXPSEC H/W.



CVS commit: src/sys/dev/marvell

2022-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Dec 31 21:15:20 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
fix few typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 18:45:45 UTC 2022

Modified Files:
src/sys/dev/marvell: gtpci.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/marvell/gtpci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 18:45:45 UTC 2022

Modified Files:
src/sys/dev/marvell: gtpci.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/marvell/gtpci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/gtpci.c
diff -u src/sys/dev/marvell/gtpci.c:1.37 src/sys/dev/marvell/gtpci.c:1.38
--- src/sys/dev/marvell/gtpci.c:1.37	Thu Jul 21 10:09:21 2022
+++ src/sys/dev/marvell/gtpci.c	Sun Sep 25 18:45:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtpci.c,v 1.37 2022/07/21 10:09:21 andvar Exp $	*/
+/*	$NetBSD: gtpci.c,v 1.38 2022/09/25 18:45:45 thorpej Exp $	*/
 /*
  * Copyright (c) 2008, 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.37 2022/07/21 10:09:21 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.38 2022/09/25 18:45:45 thorpej Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -35,7 +35,6 @@ __KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.
 #include 
 #include 
 #include 
-#include 
 
 #include 
 



CVS commit: src/sys/dev/marvell

2022-08-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug 20 19:04:07 UTC 2022

Modified Files:
src/sys/dev/marvell: if_gfe.c

Log Message:
gfe_ifstart(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" with
"IF_POLL() -> IF_DEQUEUE() on success".


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/marvell/if_gfe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_gfe.c
diff -u src/sys/dev/marvell/if_gfe.c:1.59 src/sys/dev/marvell/if_gfe.c:1.60
--- src/sys/dev/marvell/if_gfe.c:1.59	Sat Aug  7 16:19:13 2021
+++ src/sys/dev/marvell/if_gfe.c	Sat Aug 20 19:04:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gfe.c,v 1.59 2021/08/07 16:19:13 thorpej Exp $	*/
+/*	$NetBSD: if_gfe.c,v 1.60 2022/08/20 19:04:07 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.59 2021/08/07 16:19:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.60 2022/08/20 19:04:07 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -691,7 +691,7 @@ gfe_ifstart(struct ifnet *ifp)
 	}
 
 	for (;;) {
-		IF_DEQUEUE(>if_snd, m);
+		IF_POLL(>if_snd, m);
 		if (m == NULL) {
 			ifp->if_flags &= ~IFF_OACTIVE;
 			GE_FUNC_EXIT(sc, "");
@@ -704,6 +704,8 @@ gfe_ifstart(struct ifnet *ifp)
 		if (IF_QFULL(>sc_txq[GE_TXPRIO_HI].txq_pendq))
 			break;
 
+		IF_DEQUEUE(>if_snd, m);
+
 		/*
 		 * Try to enqueue a mbuf to the device. If that fails, we
 		 * can always try to map the next mbuf.
@@ -718,7 +720,6 @@ gfe_ifstart(struct ifnet *ifp)
 	/*
 	 * Attempt to queue the mbuf for send failed.
 	 */
-	IF_PREPEND(>if_snd, m);
 	ifp->if_flags |= IFF_OACTIVE;
 	GE_FUNC_EXIT(sc, "%%");
 }



CVS commit: src/sys/dev/marvell

2022-08-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug 20 19:04:07 UTC 2022

Modified Files:
src/sys/dev/marvell: if_gfe.c

Log Message:
gfe_ifstart(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" with
"IF_POLL() -> IF_DEQUEUE() on success".


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/marvell/if_gfe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2022-06-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun  1 15:40:15 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Fix missing change to freesession return type.

Not sure how this didn't get committed before -- it was supposed to be
part of this change:

https://mail-index.netbsd.org/source-changes/2022/05/22/msg138764.html


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2022-06-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun  1 15:40:15 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Fix missing change to freesession return type.

Not sure how this didn't get committed before -- it was supposed to be
part of this change:

https://mail-index.netbsd.org/source-changes/2022/05/22/msg138764.html


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvxpsec.c
diff -u src/sys/dev/marvell/mvxpsec.c:1.15 src/sys/dev/marvell/mvxpsec.c:1.16
--- src/sys/dev/marvell/mvxpsec.c:1.15	Sun May 22 11:38:51 2022
+++ src/sys/dev/marvell/mvxpsec.c	Wed Jun  1 15:40:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.15 2022/05/22 11:38:51 riastradh Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.16 2022/06/01 15:40:15 riastradh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -2020,7 +2020,7 @@ fail:
 /*
  * remove opencrypto session
  */
-int
+void
 mvxpsec_freesession(void *arg, uint64_t tid)
 {
 	struct mvxpsec_softc *sc = arg;
@@ -2056,8 +2056,6 @@ mvxpsec_freesession(void *arg, uint64_t 
 	crypto_unblock(sc->sc_cid, CRYPTO_SYMQ|CRYPTO_ASYMQ);
 
 	MVXPSEC_EVCNT_INCR(sc, session_free);
-
-	return 0;
 }
 
 /*



CVS commit: src/sys/dev/marvell

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:38:51 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Prune dead branches.  Assert session id validity.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvxpsec.c
diff -u src/sys/dev/marvell/mvxpsec.c:1.14 src/sys/dev/marvell/mvxpsec.c:1.15
--- src/sys/dev/marvell/mvxpsec.c:1.14	Tue Apr 12 21:05:37 2022
+++ src/sys/dev/marvell/mvxpsec.c	Sun May 22 11:38:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.14 2022/04/12 21:05:37 andvar Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.15 2022/05/22 11:38:51 riastradh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -2029,21 +2029,13 @@ mvxpsec_freesession(void *arg, uint64_t 
 	uint32_t sid = ((uint32_t)tid) & 0x;
 
 	session = MVXPSEC_SESSION(sid);
-	if (session < 0 || session >= MVXPSEC_MAX_SESSIONS) {
-		log(LOG_ERR, "%s: invalid session (id:%u)\n",
-		__func__, session);
-		return EINVAL;
-	}
+	KASSERTMSG(session >= 0, "session=%d", session);
+	KASSERTMSG(session < MVXPSEC_MAX_SESSIONS, "session=%d max=%d",
+	session, MVXPSEC_MAX_SESSIONS);
 
 	mutex_enter(>sc_session_mtx);
-	if ( (mv_s = sc->sc_sessions[session]) == NULL) {
-		mutex_exit(>sc_session_mtx);
-#ifdef DEBUG
-		log(LOG_DEBUG, "%s: session %d already inactivated\n",
-		__func__, session);
-#endif
-		return ENOENT;
-	}
+	mv_s = sc->sc_sessions[session];
+	KASSERT(mv_s != NULL);
 	MVXPSEC_PRINTF(MVXPSEC_DEBUG_OPENCRYPTO,
 	"%s: inactivate session %d\n", __func__, session);
 



CVS commit: src/sys/dev/marvell

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:38:51 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Prune dead branches.  Assert session id validity.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:38:26 UTC 2022

Modified Files:
src/sys/dev/marvell: mvcesa.c

Log Message:
mvcesa(4): Prune dead branches.  Assert session id validity.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/mvcesa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:38:26 UTC 2022

Modified Files:
src/sys/dev/marvell: mvcesa.c

Log Message:
mvcesa(4): Prune dead branches.  Assert session id validity.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/mvcesa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvcesa.c
diff -u src/sys/dev/marvell/mvcesa.c:1.4 src/sys/dev/marvell/mvcesa.c:1.5
--- src/sys/dev/marvell/mvcesa.c:1.4	Sun Dec  5 02:41:44 2021
+++ src/sys/dev/marvell/mvcesa.c	Sun May 22 11:38:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvcesa.c,v 1.4 2021/12/05 02:41:44 msaitoh Exp $	*/
+/*	$NetBSD: mvcesa.c,v 1.5 2022/05/22 11:38:26 riastradh Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.4 2021/12/05 02:41:44 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.5 2022/05/22 11:38:26 riastradh Exp $");
 
 #include 
 #include 
@@ -332,11 +332,10 @@ mvcesa_freesession(void *arg, u_int64_t 
 	int session;
 	uint32_t sid = ((uint32_t)tid) & 0x;
 
-	KASSERT(sc != NULL /*, ("mvcesa_freesession: null softc")*/);
-
 	session = MVCESA_SESSION(sid);
-	if (session >= sc->sc_nsessions)
-		return EINVAL;
+	KASSERTMSG(session >= 0, "session=%d", session);
+	KASSERTMSG(session < sc->sc_nsessions, "session=%d nsessions=%d",
+	session, sc->sc_nsessions);
 
 	memset(>sc_sessions[session], 0, sizeof(sc->sc_sessions[session]));
 	return (0);
@@ -345,7 +344,7 @@ mvcesa_freesession(void *arg, u_int64_t 
 static int
 mvcesa_process(void *arg, struct cryptop *crp, int hint)
 {
-	struct mvcesa_softc *sc = (struct mvcesa_softc *)arg;
+	struct mvcesa_softc *sc = arg;
 	struct mvcesa_session *ses;
 	struct cryptodesc *crd;
 	struct mbuf *m = NULL;
@@ -353,20 +352,9 @@ mvcesa_process(void *arg, struct cryptop
 	int session;
 	char *buf = NULL;
 
-	KASSERT(sc != NULL /*, ("mvcesa_process: null softc")*/);
-
-	if (crp == NULL)
-		return EINVAL;
-	if (crp->crp_callback == NULL || sc == NULL) {
-		crp->crp_etype = EINVAL;
-		goto done;
-	}
-
 	session = MVCESA_SESSION(crp->crp_sid);
-	if (session >= sc->sc_nsessions) {
-		crp->crp_etype = ENOENT;
-		goto done;
-	}
+	KASSERTMSG(session < sc->sc_nsessions, "session=%d nsessions=%d",
+	session, sc->sc_nsessions);
 	ses = >sc_sessions[session];
 
 	if (crp->crp_flags & CRYPTO_F_IMBUF)



Re: CVS commit: src/sys/dev/marvell

2022-05-22 Thread Rin Okuyama

On 2022/05/21 19:27, Rin Okuyama wrote:

Module Name:src
Committed By:   rin
Date:   Sat May 21 10:27:30 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
m_freem() *after* bus_dmamap_sync() and bus_dmamap_load() for
that mbuf. This is mandatory for some archs.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/marvell/if_mvgbe.c


s/load/unload/ here. Thanks riastradh@ for pointing out.

rin


CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:33:05 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Correct byte-order for bufsize field of RX descriptor.

XXX
This bug affected only armeb. Unfortunately, the systems including
armel still lock up eventually with NFS root on mvgbe(4)...


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.65 src/sys/dev/marvell/if_mvgbe.c:1.66
--- src/sys/dev/marvell/if_mvgbe.c:1.65	Sat May 21 10:27:30 2022
+++ src/sys/dev/marvell/if_mvgbe.c	Sat May 21 10:33:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.65 2022/05/21 10:27:30 rin Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.66 2022/05/21 10:33:05 rin Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.65 2022/05/21 10:27:30 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.66 2022/05/21 10:33:05 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1587,6 +1587,7 @@ mvgbe_newbuf(struct mvgbe_softc *sc, int
 	struct mvgbe_rx_desc *r;
 	int align;
 	vaddr_t offset;
+	uint16_t bufsize;
 
 	if (m == NULL) {
 		void *buf = NULL;
@@ -1631,12 +1632,13 @@ mvgbe_newbuf(struct mvgbe_softc *sc, int
 	c->mvgbe_mbuf = m_new;
 	offset = (vaddr_t)m_new->m_data - (vaddr_t)sc->sc_cdata.mvgbe_jumbo_buf;
 	r->bufptr = H2MVGBE32(dmamap->dm_segs[0].ds_addr + offset);
-	r->bufsize = MVGBE_JLEN & ~MVGBE_RXBUF_MASK;
+	bufsize = MVGBE_JLEN & ~MVGBE_RXBUF_MASK;
+	r->bufsize = H2MVGBE16(bufsize);
 	r->cmdsts =
 	H2MVGBE32(MVGBE_BUFFER_OWNED_BY_DMA | MVGBE_RX_ENABLE_INTERRUPT);
 
 	/* Invalidate RX buffer */
-	bus_dmamap_sync(sc->sc_dmat, dmamap, offset, r->bufsize,
+	bus_dmamap_sync(sc->sc_dmat, dmamap, offset, bufsize,
 	BUS_DMASYNC_PREREAD);
 
 	MVGBE_CDRXSYNC(sc, i, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
@@ -1991,7 +1993,7 @@ mvgbe_rxeof(struct mvgbe_softc *sc)
 		m = cdata->mvgbe_rx_chain[idx].mvgbe_mbuf;
 		cdata->mvgbe_rx_chain[idx].mvgbe_mbuf = NULL;
 		total_len = MVGBE2H16(cur_rx->bytecnt) - ETHER_CRC_LEN;
-		bufsize = cur_rx->bufsize;
+		bufsize = MVGBE2H16(cur_rx->bufsize);
 
 		cdata->mvgbe_rx_map[idx] = NULL;
 



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:33:05 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Correct byte-order for bufsize field of RX descriptor.

XXX
This bug affected only armeb. Unfortunately, the systems including
armel still lock up eventually with NFS root on mvgbe(4)...


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:27:30 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
m_freem() *after* bus_dmamap_sync() and bus_dmamap_load() for
that mbuf. This is mandatory for some archs.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.64 src/sys/dev/marvell/if_mvgbe.c:1.65
--- src/sys/dev/marvell/if_mvgbe.c:1.64	Sat May 21 10:24:50 2022
+++ src/sys/dev/marvell/if_mvgbe.c	Sat May 21 10:27:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.64 2022/05/21 10:24:50 rin Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.65 2022/05/21 10:27:30 rin Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.64 2022/05/21 10:24:50 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.65 2022/05/21 10:27:30 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -2127,13 +2127,14 @@ mvgbe_txeof(struct mvgbe_softc *sc)
 		if (cdata->mvgbe_tx_chain[idx].mvgbe_mbuf != NULL) {
 			entry = cdata->mvgbe_tx_map[idx];
 
-			m_freem(cdata->mvgbe_tx_chain[idx].mvgbe_mbuf);
-			cdata->mvgbe_tx_chain[idx].mvgbe_mbuf = NULL;
-
 			bus_dmamap_sync(sc->sc_dmat, entry->dmamap, 0,
 			entry->dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
 
 			bus_dmamap_unload(sc->sc_dmat, entry->dmamap);
+
+			m_freem(cdata->mvgbe_tx_chain[idx].mvgbe_mbuf);
+			cdata->mvgbe_tx_chain[idx].mvgbe_mbuf = NULL;
+
 			SIMPLEQ_INSERT_TAIL(>sc_txmap_head, entry, link);
 			cdata->mvgbe_tx_map[idx] = NULL;
 		}



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:27:30 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
m_freem() *after* bus_dmamap_sync() and bus_dmamap_load() for
that mbuf. This is mandatory for some archs.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:24:50 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Add DPRINTF() to catch failure of m_defrag() in mvgbe_encap().


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.63 src/sys/dev/marvell/if_mvgbe.c:1.64
--- src/sys/dev/marvell/if_mvgbe.c:1.63	Sat May 21 10:22:27 2022
+++ src/sys/dev/marvell/if_mvgbe.c	Sat May 21 10:24:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.63 2022/05/21 10:22:27 rin Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.64 2022/05/21 10:24:50 rin Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.63 2022/05/21 10:22:27 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.64 2022/05/21 10:24:50 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1825,8 +1825,10 @@ do_defrag:
 		/* A small unaligned segment was detected. */
 		struct mbuf *m_new;
 		m_new = m_defrag(m_head, M_DONTWAIT);
-		if (m_new == NULL)
+		if (m_new == NULL) {
+			DPRINTFN(2, ("mvgbe_encap: defrag failed\n"));
 			return EFBIG;
+		}
 		m_head = m_new;
 	}
 



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:24:50 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Add DPRINTF() to catch failure of m_defrag() in mvgbe_encap().


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:22:27 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Raise threshold of debug level to 3 for DPRINTF() in non-error path of
mvgbe_encap(). Without this change, debug level 2 is almost unusable...


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.62 src/sys/dev/marvell/if_mvgbe.c:1.63
--- src/sys/dev/marvell/if_mvgbe.c:1.62	Mon Aug 30 00:08:28 2021
+++ src/sys/dev/marvell/if_mvgbe.c	Sat May 21 10:22:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.62 2021/08/30 00:08:28 rin Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.63 2022/05/21 10:22:27 rin Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.62 2021/08/30 00:08:28 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.63 2022/05/21 10:22:27 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1871,7 +1871,7 @@ do_defrag:
 	}
 
 
-	DPRINTFN(2, ("mvgbe_encap: dm_nsegs=%d\n", txmap->dm_nsegs));
+	DPRINTFN(3, ("mvgbe_encap: dm_nsegs=%d\n", txmap->dm_nsegs));
 
 	for (i = 0; i < txmap->dm_nsegs; i++) {
 		f = >sc_rdata->mvgbe_tx_ring[current];



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:22:27 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Raise threshold of debug level to 3 for DPRINTF() in non-error path of
mvgbe_encap(). Without this change, debug level 2 is almost unusable...


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2022-04-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  6 22:48:09 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvxpsec.c
diff -u src/sys/dev/marvell/mvxpsec.c:1.11 src/sys/dev/marvell/mvxpsec.c:1.12
--- src/sys/dev/marvell/mvxpsec.c:1.11	Sat Mar 12 15:32:32 2022
+++ src/sys/dev/marvell/mvxpsec.c	Wed Apr  6 22:48:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.11 2022/03/12 15:32:32 riastradh Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.12 2022/04/06 22:48:09 riastradh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -401,7 +401,7 @@ mvxpsec_attach(device_t parent, device_t
 	/* INTR */
 	MVXPSEC_WRITE(sc, MVXPSEC_INT_MASK, MVXPSEC_DEFAULT_INT);
 	MVXPSEC_WRITE(sc, MV_TDMA_ERR_MASK, MVXPSEC_DEFAULT_ERR);
-	sc->sc_done_ih = 
+	sc->sc_done_ih =
 	marvell_intr_establish(mva->mva_irq, IPL_NET, mvxpsec_intr, sc);
 	/* XXX: sould pass error IRQ using mva */
 	sc->sc_error_ih = marvell_intr_establish(MVXPSEC_ERR_INT(sc),
@@ -434,7 +434,7 @@ mvxpsec_attach(device_t parent, device_t
 	MVXPSEC_WRITE(sc, MV_ACC_COMMAND, MV_ACC_COMMAND_STOP);
 
 	/* Session */
-	sc->sc_session_pool = 
+	sc->sc_session_pool =
 	pool_cache_init(sizeof(struct mvxpsec_session), 0, 0, 0,
 	"mvxpsecpl", NULL, IPL_NET,
 	mvxpsec_session_ctor, mvxpsec_session_dtor, sc);
@@ -577,7 +577,7 @@ mvxpsec_timer(void *aux)
 #ifdef MVXPSEC_DEBUG
 	mvxpsec_dump_reg(sc);
 #endif
-	
+
 	s = splnet();
 	/* stop security accelerator */
 	MVXPSEC_WRITE(sc, MV_ACC_COMMAND, MV_ACC_COMMAND_STOP);
@@ -771,7 +771,6 @@ mvxpsec_dma_setup(struct mvxpsec_descrip
 #ifdef MVXPSEC_DEBUG
 	mvxpsec_dump_dmaq(dh);
 #endif
-
 }
 
 /*
@@ -889,7 +888,7 @@ mvxpsec_dma_copy_packet(struct mvxpsec_s
 	 *   ||
 	 *   vv
 	 *   ++...
-	 *   |IV  |DATA
+	 *   |IV  |DATA
 	 *   ++...
 	 */
 	pkt_off = 0;
@@ -909,7 +908,7 @@ mvxpsec_dma_copy_packet(struct mvxpsec_s
 	if (__predict_false(err))
 		return err;
 
-	/* 
+	/*
 	 * make DMA descriptors to copy session header: DRAM -> SRAM
 	 * we can reuse session header on SRAM if session is not changed.
 	 */
@@ -1268,7 +1267,7 @@ STATIC uint32_t
 mvxpsec_eintr_ack(struct mvxpsec_softc *sc)
 {
 	uint32_t reg;
- 
+
 	reg  = MVXPSEC_READ(sc, MV_TDMA_ERR_CAUSE);
 	reg &= MVXPSEC_DEFAULT_ERR;
 	MVXPSEC_WRITE(sc, MV_TDMA_ERR_CAUSE, ~reg);
@@ -1445,7 +1444,7 @@ mvxpsec_packet_ctor(void *arg, void *obj
 		log(LOG_ERR, "%s: cannot create DMA map\n", __func__);
 		goto fail;
 	}
-	if (bus_dmamap_load(sc->sc_dmat, mv_p->pkt_header_map, 
+	if (bus_dmamap_load(sc->sc_dmat, mv_p->pkt_header_map,
 	_p->pkt_header, sizeof(mv_p->pkt_header),
 	NULL, BUS_DMA_NOWAIT)) {
 		log(LOG_ERR, "%s: cannot load header\n", __func__);
@@ -1533,7 +1532,7 @@ mvxpsec_session_ref(struct mvxpsec_sessi
 
 	refs = atomic_inc_32_nv(_s->refs);
 	if (refs == 1) {
-		/* 
+		/*
 		 * a session with refs == 0 is
 		 * already invalidated. revert it.
 		 * XXX: use CAS ?
@@ -1543,7 +1542,7 @@ mvxpsec_session_ref(struct mvxpsec_sessi
 		"%s: session is already invalidated.\n", __func__);
 		return -1;
 	}
-	
+
 	return 0;
 }
 
@@ -2128,7 +2127,7 @@ mvxpsec_dispatch(void *arg, struct crypt
 	err = mvxpsec_packet_setcrp(mv_p, crp);
 	if (__predict_false(err))
 		goto fail;
-	
+
 	/*
 	 * Setup DMA descriptor chains
 	 */
@@ -2660,7 +2659,7 @@ STATIC int
 mvxpsec_packet_write_iv(struct mvxpsec_packet *mv_p, void *iv, int ivlen)
 {
 	uint8_t ivbuf[16];
-	
+
 	KASSERT(ivlen == 8 || ivlen == 16);
 
 	if (iv == NULL) {
@@ -2924,7 +2923,7 @@ static uint8_t AES_SBOX[256] = {
	  7,  18, 128, 226, 235,  39, 178, 117,   9, 131,  44,  26,  27, 110,
 	 90, 160,  82,  59, 214, 179,  41, 227,  47, 132,  83, 209,   0, 237,
	 32, 252, 177,  91, 106, 203, 190,  57,  74,  76,  88, 207, 208, 239,
-	170, 251,  67,  77,  51, 133,  69, 249,   2, 127,  80,  60, 159, 168, 
+	170, 251,  67,  77,  51, 133,  69, 249,   2, 127,  80,  60, 159, 168,
 	 81, 163,  64, 143, 146, 157,  56, 245, 188, 182, 218,  33,  16, 255,
 	243, 210, 205,  12,  19, 236,  95, 151,  68,  23, 196, 167, 126,  61,
	100,  93,  25, 115,  96, 129,  79, 220,  34,  42, 144, 136,  70, 238,
@@ -2938,7 +2937,7 @@ static uint8_t AES_SBOX[256] = {
 	176,  84, 187,  22
 };
 
-static uint32_t AES_RCON[30] = { 
+static uint32_t AES_RCON[30] = {
 	0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
	0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4,
	0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91
@@ -2946,11 +2945,11 @@ static uint32_t AES_RCON[30] = { 
 
 STATIC int
 mv_aes_ksched(uint8_t k[4][MAXKC], int keyBits,
-uint8_t 

CVS commit: src/sys/dev/marvell

2022-04-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  6 22:48:09 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 07:57:38 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
s/sumary/summary/


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.36 src/sys/dev/marvell/if_mvxpe.c:1.37
--- src/sys/dev/marvell/if_mvxpe.c:1.36	Fri Sep 17 08:13:06 2021
+++ src/sys/dev/marvell/if_mvxpe.c	Sun Dec  5 07:57:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.36 2021/09/17 08:13:06 andvar Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.37 2021/12/05 07:57:38 msaitoh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.36 2021/09/17 08:13:06 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.37 2021/12/05 07:57:38 msaitoh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1600,15 +1600,15 @@ mvxpe_rxtx_intr(void *arg)
 			MVXPE_EVCNT_INCR(>sc_ev.ev_rxtx_tbrq);
 		}
 		if (prxtxic & MVXPE_PRXTXI_PRXTXTHICSUMMARY) {
-			DPRINTIFNET(ifp, 1, "PRXTXTHIC Sumary\n");
+			DPRINTIFNET(ifp, 1, "PRXTXTHIC Summary\n");
 			MVXPE_EVCNT_INCR(>sc_ev.ev_rxtx_rxtxth);
 		}
 		if (prxtxic & MVXPE_PRXTXI_PTXERRORSUMMARY) {
-			DPRINTIFNET(ifp, 1, "PTXERROR Sumary\n");
+			DPRINTIFNET(ifp, 1, "PTXERROR Summary\n");
 			MVXPE_EVCNT_INCR(>sc_ev.ev_rxtx_txerr);
 		}
 		if (prxtxic & MVXPE_PRXTXI_PMISCICSUMMARY) {
-			DPRINTIFNET(ifp, 1, "PMISCIC Sumary\n");
+			DPRINTIFNET(ifp, 1, "PMISCIC Summary\n");
 			MVXPE_EVCNT_INCR(>sc_ev.ev_rxtx_misc);
 		}
 	}



CVS commit: src/sys/dev/marvell

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 07:57:38 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
s/sumary/summary/


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 02:41:44 UTC 2021

Modified Files:
src/sys/dev/marvell: mvcesa.c mvcesareg.h

Log Message:
s/decript/decrypt/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/mvcesa.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvcesareg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvcesa.c
diff -u src/sys/dev/marvell/mvcesa.c:1.3 src/sys/dev/marvell/mvcesa.c:1.4
--- src/sys/dev/marvell/mvcesa.c:1.3	Sun Jun 14 23:29:23 2020
+++ src/sys/dev/marvell/mvcesa.c	Sun Dec  5 02:41:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvcesa.c,v 1.3 2020/06/14 23:29:23 riastradh Exp $	*/
+/*	$NetBSD: mvcesa.c,v 1.4 2021/12/05 02:41:44 msaitoh Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.3 2020/06/14 23:29:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.4 2021/12/05 02:41:44 msaitoh Exp $");
 
 #include 
 #include 
@@ -716,7 +716,7 @@ mvcesa_des_encdec(struct mvcesa_softc *s
 		}
 
 		/*
-		 * Encryption/Decription calculation time is 9 cycles in DES
+		 * Encryption/Decryption calculation time is 9 cycles in DES
 		 * mode and 25 cycles in 3DES mode.
 		 */
 		bus_space_write_4(sc->sc_iot, sc->sc_ioh, MVCESA_DESE_DBL,

Index: src/sys/dev/marvell/mvcesareg.h
diff -u src/sys/dev/marvell/mvcesareg.h:1.2 src/sys/dev/marvell/mvcesareg.h:1.3
--- src/sys/dev/marvell/mvcesareg.h:1.2	Sat Sep 28 05:46:51 2013
+++ src/sys/dev/marvell/mvcesareg.h	Sun Dec  5 02:41:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvcesareg.h,v 1.2 2013/09/28 05:46:51 kiyohara Exp $	*/
+/*	$NetBSD: mvcesareg.h,v 1.3 2021/12/05 02:41:44 msaitoh Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -80,7 +80,7 @@
 #define MVCESA_SHA1MD5I_AC_IVBYTESWAP		(1 << 4)
 #define MVCESA_SHA1MD5I_AC_TERMINATION		(1 << 31)
 
-/* AES Encryption/Decription Interface Registers */
+/* AES Encryption/Decryption Interface Registers */
 #define MVCESA_AES_ENCRYPTION	0xd80
 #define MVCESA_AES_DECRYPTION	0xdc0
 #define MVCESA_AES_DIOC_OFF	  0x20	/* Data In/Out Column */



CVS commit: src/sys/dev/marvell

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 02:41:44 UTC 2021

Modified Files:
src/sys/dev/marvell: mvcesa.c mvcesareg.h

Log Message:
s/decript/decrypt/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/mvcesa.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvcesareg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2021-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 10 15:55:35 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvxpereg.h

Log Message:
s/Erorr/Error/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/if_mvxpereg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpereg.h
diff -u src/sys/dev/marvell/if_mvxpereg.h:1.6 src/sys/dev/marvell/if_mvxpereg.h:1.7
--- src/sys/dev/marvell/if_mvxpereg.h:1.6	Tue Aug 17 22:00:31 2021
+++ src/sys/dev/marvell/if_mvxpereg.h	Wed Nov 10 15:55:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpereg.h,v 1.6 2021/08/17 22:00:31 andvar Exp $	*/
+/*	$NetBSD: if_mvxpereg.h,v 1.7 2021/11/10 15:55:35 msaitoh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -225,8 +225,8 @@
 /* SGMII PHY Registers */
 #define MVXPE_PPLLC		0x2e04	/* Power and PLL Control */
 #define MVXPE_TESTC0		0x2e54	/* PHY Test Control 0 */
-#define MVXPE_TESTPRBSEC0	0x2e7c	/* PHY Test PRBS Erorr Counter 0 */
-#define MVXPE_TESTPRBSEC1	0x2e80	/* PHY Test PRBS Erorr Counter 1 */
+#define MVXPE_TESTPRBSEC0	0x2e7c	/* PHY Test PRBS Error Counter 0 */
+#define MVXPE_TESTPRBSEC1	0x2e80	/* PHY Test PRBS Error Counter 1 */
 #define MVXPE_TESTOOB0		0x2e84	/* PHY Test OOB 0 */
 #define MVXPE_DLE		0x2e8c	/* Digital Loopback Enable */
 #define MVXPE_RCS		0x2f18	/* Reference Clock Select */



CVS commit: src/sys/dev/marvell

2021-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 10 15:55:35 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvxpereg.h

Log Message:
s/Erorr/Error/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/if_mvxpereg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2021-08-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug 30 00:08:28 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvgbe.c mvgbereg.h

Log Message:
Add ARMEB support to mvgbe(4).

For ARMEB, peripheral is configured to little-endian mode, even if
CPU itself is in big-endian mode. Therefore, we need to configure
the device to little-endian mode, and byte-swap descriptor fields
(unlike the case of powerpc).


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/marvell/mvgbereg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.61 src/sys/dev/marvell/if_mvgbe.c:1.62
--- src/sys/dev/marvell/if_mvgbe.c:1.61	Sat Aug  7 16:19:13 2021
+++ src/sys/dev/marvell/if_mvgbe.c	Mon Aug 30 00:08:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.61 2021/08/07 16:19:13 thorpej Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.62 2021/08/30 00:08:28 rin Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.61 2021/08/07 16:19:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.62 2021/08/30 00:08:28 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1254,7 +1254,7 @@ mvgbe_init(struct ifnet *ifp)
 	/* Set SDC register except IPGINT bits */
 	MVGBE_WRITE(sc, MVGBE_SDC,
 	MVGBE_SDC_RXBSZ_16_64BITWORDS |
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef MVGBE_BIG_ENDIAN
 	MVGBE_SDC_BLMR |	/* Big/Little Endian Receive Mode: No swap */
 	MVGBE_SDC_BLMT |	/* Big/Little Endian Transmit Mode: No swap */
 #endif
@@ -1517,12 +1517,12 @@ mvgbe_init_rx_ring(struct mvgbe_softc *s
 			cd->mvgbe_rx_chain[i].mvgbe_next =
 			>mvgbe_rx_chain[0];
 			rd->mvgbe_rx_ring[i].nextdescptr =
-			MVGBE_RX_RING_ADDR(sc, 0);
+			H2MVGBE32(MVGBE_RX_RING_ADDR(sc, 0));
 		} else {
 			cd->mvgbe_rx_chain[i].mvgbe_next =
 			>mvgbe_rx_chain[i + 1];
 			rd->mvgbe_rx_ring[i].nextdescptr =
-			MVGBE_RX_RING_ADDR(sc, i + 1);
+			H2MVGBE32(MVGBE_RX_RING_ADDR(sc, i + 1));
 		}
 	}
 
@@ -1557,14 +1557,15 @@ mvgbe_init_tx_ring(struct mvgbe_softc *s
 			cd->mvgbe_tx_chain[i].mvgbe_next =
 			>mvgbe_tx_chain[0];
 			rd->mvgbe_tx_ring[i].nextdescptr =
-			MVGBE_TX_RING_ADDR(sc, 0);
+			H2MVGBE32(MVGBE_TX_RING_ADDR(sc, 0));
 		} else {
 			cd->mvgbe_tx_chain[i].mvgbe_next =
 			>mvgbe_tx_chain[i + 1];
 			rd->mvgbe_tx_ring[i].nextdescptr =
-			MVGBE_TX_RING_ADDR(sc, i + 1);
+			H2MVGBE32(MVGBE_TX_RING_ADDR(sc, i + 1));
 		}
-		rd->mvgbe_tx_ring[i].cmdsts = MVGBE_BUFFER_OWNED_BY_HOST;
+		rd->mvgbe_tx_ring[i].cmdsts =
+		H2MVGBE32(MVGBE_BUFFER_OWNED_BY_HOST);
 	}
 
 	sc->sc_cdata.mvgbe_tx_prod = 0;
@@ -1629,9 +1630,10 @@ mvgbe_newbuf(struct mvgbe_softc *sc, int
 	r = c->mvgbe_desc;
 	c->mvgbe_mbuf = m_new;
 	offset = (vaddr_t)m_new->m_data - (vaddr_t)sc->sc_cdata.mvgbe_jumbo_buf;
-	r->bufptr = dmamap->dm_segs[0].ds_addr + offset;
+	r->bufptr = H2MVGBE32(dmamap->dm_segs[0].ds_addr + offset);
 	r->bufsize = MVGBE_JLEN & ~MVGBE_RXBUF_MASK;
-	r->cmdsts = MVGBE_BUFFER_OWNED_BY_DMA | MVGBE_RX_ENABLE_INTERRUPT;
+	r->cmdsts =
+	H2MVGBE32(MVGBE_BUFFER_OWNED_BY_DMA | MVGBE_RX_ENABLE_INTERRUPT);
 
 	/* Invalidate RX buffer */
 	bus_dmamap_sync(sc->sc_dmat, dmamap, offset, r->bufsize,
@@ -1873,10 +1875,10 @@ do_defrag:
 
 	for (i = 0; i < txmap->dm_nsegs; i++) {
 		f = >sc_rdata->mvgbe_tx_ring[current];
-		f->bufptr = txseg[i].ds_addr;
-		f->bytecnt = txseg[i].ds_len;
+		f->bufptr = H2MVGBE32(txseg[i].ds_addr);
+		f->bytecnt = H2MVGBE16(txseg[i].ds_len);
 		if (i != 0)
-			f->cmdsts = MVGBE_BUFFER_OWNED_BY_DMA;
+			f->cmdsts = H2MVGBE32(MVGBE_BUFFER_OWNED_BY_DMA);
 		last = current;
 		current = MVGBE_TX_RING_NEXT(current);
 	}
@@ -1897,21 +1899,21 @@ do_defrag:
 		MVGBE_TX_IP_HEADER_LEN(iphdr_unitlen);	/* unit is 4B */
 	}
 	if (txmap->dm_nsegs == 1)
-		f->cmdsts = cmdsts		|
+		f->cmdsts = H2MVGBE32(cmdsts	|
 		MVGBE_TX_ENABLE_INTERRUPT	|
 		MVGBE_TX_ZERO_PADDING	|
 		MVGBE_TX_FIRST_DESC		|
-		MVGBE_TX_LAST_DESC;
+		MVGBE_TX_LAST_DESC);
 	else {
 		f = >sc_rdata->mvgbe_tx_ring[first];
-		f->cmdsts = cmdsts | MVGBE_TX_FIRST_DESC;
+		f->cmdsts = H2MVGBE32(cmdsts | MVGBE_TX_FIRST_DESC);
 
 		f = >sc_rdata->mvgbe_tx_ring[last];
-		f->cmdsts =
+		f->cmdsts = H2MVGBE32(
 		MVGBE_BUFFER_OWNED_BY_DMA	|
 		MVGBE_TX_ENABLE_INTERRUPT	|
 		MVGBE_TX_ZERO_PADDING	|
-		MVGBE_TX_LAST_DESC;
+		MVGBE_TX_LAST_DESC);
 
 		/* Sync descriptors except first */
 		MVGBE_CDTXSYNC(sc,
@@ -1926,7 +1928,7 @@ do_defrag:
 
 	/* Finally, sync first descriptor */
 	sc->sc_rdata->mvgbe_tx_ring[first].cmdsts |=
-	MVGBE_BUFFER_OWNED_BY_DMA;
+	H2MVGBE32(MVGBE_BUFFER_OWNED_BY_DMA);
 	MVGBE_CDTXSYNC(sc, *txidx, 

CVS commit: src/sys/dev/marvell

2021-08-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug 30 00:08:28 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvgbe.c mvgbereg.h

Log Message:
Add ARMEB support to mvgbe(4).

For ARMEB, peripheral is configured to little-endian mode, even if
CPU itself is in big-endian mode. Therefore, we need to configure
the device to little-endian mode, and byte-swap descriptor fields
(unlike the case of powerpc).


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/marvell/mvgbereg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2021-08-13 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Aug 13 21:04:44 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
s/fame/frame in mvxpe_mib_def with assumption that it was not intentional typo.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.34 src/sys/dev/marvell/if_mvxpe.c:1.35
--- src/sys/dev/marvell/if_mvxpe.c:1.34	Mon Aug  2 12:56:24 2021
+++ src/sys/dev/marvell/if_mvxpe.c	Fri Aug 13 21:04:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.34 2021/08/02 12:56:24 andvar Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.35 2021/08/13 21:04:44 andvar Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.34 2021/08/02 12:56:24 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.35 2021/08/13 21:04:44 andvar Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -218,7 +218,7 @@ STATIC struct mvxpe_mib_def {
 	"Frame Size  256 -  511"},
 	{MVXPE_MIB_RX_FRAME1023_OCT, 0,	"rx_frame_512_1023",
 	"Frame Size  512 - 1023", 0},
-	{MVXPE_MIB_RX_FRAMEMAX_OCT, 0,	"rx_fame_1024_max",
+	{MVXPE_MIB_RX_FRAMEMAX_OCT, 0,	"rx_frame_1024_max",
 	"Frame Size 1024 -  Max", 0},
 	{MVXPE_MIB_TX_GOOD_OCT, 1,	"tx_good_oct",
 	"Good Octets Tx", 0},



CVS commit: src/sys/dev/marvell

2021-08-13 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Aug 13 21:04:44 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
s/fame/frame in mvxpe_mib_def with assumption that it was not intentional typo.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2020-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 25 22:37:48 UTC 2020

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
Make this build with or without options IPSEC.

Not really that useful without options IPSEC, but simply uncommenting
mvxpsec in conf/ARMADAXP didn't build, and this change is trivial, so
why not.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvxpsec.c
diff -u src/sys/dev/marvell/mvxpsec.c:1.6 src/sys/dev/marvell/mvxpsec.c:1.7
--- src/sys/dev/marvell/mvxpsec.c:1.6	Sat Jul 25 22:37:16 2020
+++ src/sys/dev/marvell/mvxpsec.c	Sat Jul 25 22:37:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.6 2020/07/25 22:37:16 riastradh Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.7 2020/07/25 22:37:48 riastradh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -24,6 +24,11 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+
+#ifdef _KERNEL_OPT
+#include "opt_ipsec.h"
+#endif
+
 /*
  * Cryptographic Engine and Security Accelerator(MVXPSEC)
  */
@@ -63,7 +68,9 @@
 #include 
 #include 
 
+#if NIPSEC > 0
 #include 
+#endif
 
 #include 
 #include 
@@ -2513,6 +2520,7 @@ mvxpsec_packet_setmbuf(struct mvxpsec_pa
 		}
 	}
 	if (pktlen > SRAM_PAYLOAD_SIZE) {
+#if NIPSEC > 0
 		extern   percpu_t *espstat_percpu;
 	   	/* XXX:
 		 * layer violation. opencrypto knows our max packet size
@@ -2520,6 +2528,7 @@ mvxpsec_packet_setmbuf(struct mvxpsec_pa
 		 */
 
 		_NET_STATINC(espstat_percpu, ESP_STAT_TOOBIG);
+#endif
 		log(LOG_ERR,
 		"%s: ESP Packet too large: %zu [oct.] > %zu [oct.]\n",
 		device_xname(sc->sc_dev),
@@ -2562,6 +2571,7 @@ mvxpsec_packet_setuio(struct mvxpsec_pac
 	struct mvxpsec_softc *sc = mv_s->sc;
 
 	if (uio->uio_resid > SRAM_PAYLOAD_SIZE) {
+#if NIPSEC > 0
 		extern   percpu_t *espstat_percpu;
 	   	/* XXX:
 		 * layer violation. opencrypto knows our max packet size
@@ -2569,6 +2579,7 @@ mvxpsec_packet_setuio(struct mvxpsec_pac
 		 */
 
 		_NET_STATINC(espstat_percpu, ESP_STAT_TOOBIG);
+#endif
 		log(LOG_ERR,
 		"%s: uio request too large: %zu [oct.] > %zu [oct.]\n",
 		device_xname(sc->sc_dev),



CVS commit: src/sys/dev/marvell

2020-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 25 22:37:16 UTC 2020

Modified Files:
src/sys/dev/marvell: files.armada mvxpsec.c

Log Message:
Omit needless rijndael dependencies.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/files.armada \
src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2020-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 25 22:37:16 UTC 2020

Modified Files:
src/sys/dev/marvell: files.armada mvxpsec.c

Log Message:
Omit needless rijndael dependencies.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/files.armada \
src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/files.armada
diff -u src/sys/dev/marvell/files.armada:1.5 src/sys/dev/marvell/files.armada:1.6
--- src/sys/dev/marvell/files.armada:1.5	Wed Apr 22 09:15:40 2020
+++ src/sys/dev/marvell/files.armada	Sat Jul 25 22:37:16 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.armada,v 1.5 2020/04/22 09:15:40 rin Exp $
+#	$NetBSD: files.armada,v 1.6 2020/07/25 22:37:16 riastradh Exp $
 # Configuration info for Marvell ARMADA integrated peripherals
 
 # ARMADA XP Buffer Manger
@@ -10,5 +10,5 @@ device	mvxpe: mvxpbm, ether, ifnet, arp,
 file	dev/marvell/if_mvxpe.c			mvxpe		needs-flag
 
 # ARMADA XP Cryptographic Engines and Security Accelerator
-device	mvxpsec: opencrypto, rijndael
+device	mvxpsec: opencrypto
 file	dev/marvell/mvxpsec.c			mvxpsec		needs-flag
Index: src/sys/dev/marvell/mvxpsec.c
diff -u src/sys/dev/marvell/mvxpsec.c:1.5 src/sys/dev/marvell/mvxpsec.c:1.6
--- src/sys/dev/marvell/mvxpsec.c:1.5	Fri Dec 27 09:41:51 2019
+++ src/sys/dev/marvell/mvxpsec.c	Sat Jul 25 22:37:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.5 2019/12/27 09:41:51 msaitoh Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.6 2020/07/25 22:37:16 riastradh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -53,8 +53,6 @@
 
 #include 
 
-#include 
-
 #include 
 #include 
 



CVS commit: src/sys/dev/marvell

2020-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 25 22:37:48 UTC 2020

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
Make this build with or without options IPSEC.

Not really that useful without options IPSEC, but simply uncommenting
mvxpsec in conf/ARMADAXP didn't build, and this change is trivial, so
why not.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:29:23 UTC 2020

Modified Files:
src/sys/dev/marvell: mvcesa.c

Log Message:
mvcesa(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvcesa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvcesa.c
diff -u src/sys/dev/marvell/mvcesa.c:1.2 src/sys/dev/marvell/mvcesa.c:1.3
--- src/sys/dev/marvell/mvcesa.c:1.2	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/marvell/mvcesa.c	Sun Jun 14 23:29:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvcesa.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: mvcesa.c,v 1.3 2020/06/14 23:29:23 riastradh Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.3 2020/06/14 23:29:23 riastradh Exp $");
 
 #include 
 #include 
@@ -56,7 +56,6 @@ struct mvcesa_session {
 	int ses_used;
 
 	int ses_klen;
-	uint32_t ses_iv[4];
 	uint32_t ses_key[8];
 
 	uint32_t ses_hminner[5];	/* HMAC inner state */
@@ -236,9 +235,6 @@ mvcesa_newsession(void *arg, u_int32_t *
 return EINVAL;
 			enc = 1;
 
-			cprng_fast(ses->ses_iv,
-			c->cri_alg == CRYPTO_AES_CBC ? 16 : 8);
-
 			/* Go ahead and compute key in CESA's byte order */
 			ses->ses_klen = c->cri_klen;
 			memcpy(ses->ses_key, c->cri_key, c->cri_klen / 8);
@@ -406,8 +402,10 @@ mvcesa_process(void *arg, struct cryptop
 dir = MVCESA_DESE_C_DIRECTION_ENC;
 if (crd->crd_flags & CRD_F_IV_EXPLICIT)
 	iv = (uint32_t *)crd->crd_iv;
-else
-	iv = ses->ses_iv;
+else {
+	cprng_fast(ivbuf, sizeof(ivbuf));
+	iv = ivbuf;
+}
 if (!(crd->crd_flags & CRD_F_IV_PRESENT)) {
 	if (m != NULL)
 		m_copyback(m, crd->crd_inject,
@@ -760,8 +758,5 @@ mvcesa_des_encdec(struct mvcesa_softc *s
 		}
 	}
 
-	if (dir == MVCESA_DESE_C_DIRECTION_ENC)
-		memcpy(ses->ses_iv, iv, sizeof(ses->ses_iv));
-
 	return 0;
 }



CVS commit: src/sys/dev/marvell

2020-06-14 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 14 23:29:23 UTC 2020

Modified Files:
src/sys/dev/marvell: mvcesa.c

Log Message:
mvcesa(4): Don't use prev msg's last block as IV for next msg in CBC.

This violates the security contract of the CBC construction, which
requires that the IV be unpredictable in advance; an adaptive adversary
can exploit this to verify plaintext guesses.

XXX Compile-tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvcesa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2020-02-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  5 08:34:48 UTC 2020

Modified Files:
src/sys/dev/marvell: if_gfe.c if_mvxpe.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/marvell/if_gfe.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_gfe.c
diff -u src/sys/dev/marvell/if_gfe.c:1.55 src/sys/dev/marvell/if_gfe.c:1.56
--- src/sys/dev/marvell/if_gfe.c:1.55	Tue Feb  4 07:36:55 2020
+++ src/sys/dev/marvell/if_gfe.c	Wed Feb  5 08:34:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gfe.c,v 1.55 2020/02/04 07:36:55 skrll Exp $	*/
+/*	$NetBSD: if_gfe.c,v 1.56 2020/02/05 08:34:48 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.55 2020/02/04 07:36:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.56 2020/02/05 08:34:48 skrll Exp $");
 
 #include "opt_inet.h"
 
@@ -906,7 +906,7 @@ gfe_rx_get(struct gfe_softc *sc, enum gf
 		(buflen > sc->sc_max_frame_length)) {
 			GE_DPRINTF(sc, ("!"));
 			--rxq->rxq_active;
-			ifp->if_ipackets++;
+			if_statinc(ifp, if_ipackets);
 			if_statinc(ifp, if_ierrors);
 			goto give_it_back;
 		}

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.32 src/sys/dev/marvell/if_mvxpe.c:1.33
--- src/sys/dev/marvell/if_mvxpe.c:1.32	Tue Feb  4 07:36:55 2020
+++ src/sys/dev/marvell/if_mvxpe.c	Wed Feb  5 08:34:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.32 2020/02/04 07:36:55 skrll Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.33 2020/02/05 08:34:48 skrll Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.32 2020/02/04 07:36:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.33 2020/02/05 08:34:48 skrll Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -3264,10 +3264,10 @@ mvxpe_update_mib(struct mvxpe_softc *sc)
 
 		switch (mvxpe_mib_list[i].ext) {
 		case MVXPE_MIBEXT_IF_OERRORS:
-			ifp->if_oerrors += val;
+			if_statadd(ifp, if_oerrors,  val);
 			break;
 		case MVXPE_MIBEXT_IF_IERRORS:
-			ifp->if_ierrors += val;
+			if_statadd(ifp, if_ierrors,  val);
 			break;
 		case MVXPE_MIBEXT_IF_COLLISIONS:
 			if_statadd(ifp, if_collisions, val);



CVS commit: src/sys/dev/marvell

2020-02-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  5 08:34:48 UTC 2020

Modified Files:
src/sys/dev/marvell: if_gfe.c if_mvxpe.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/marvell/if_gfe.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2020-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  4 07:36:55 UTC 2020

Modified Files:
src/sys/dev/marvell: if_gfe.c if_mvxpe.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/marvell/if_gfe.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_gfe.c
diff -u src/sys/dev/marvell/if_gfe.c:1.54 src/sys/dev/marvell/if_gfe.c:1.55
--- src/sys/dev/marvell/if_gfe.c:1.54	Tue May 28 07:41:49 2019
+++ src/sys/dev/marvell/if_gfe.c	Tue Feb  4 07:36:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gfe.c,v 1.54 2019/05/28 07:41:49 msaitoh Exp $	*/
+/*	$NetBSD: if_gfe.c,v 1.55 2020/02/04 07:36:55 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.54 2019/05/28 07:41:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.55 2020/02/04 07:36:55 skrll Exp $");
 
 #include "opt_inet.h"
 
@@ -747,7 +747,7 @@ gfe_ifwatchdog(struct ifnet *ifp)
 		GE_TXDPRESYNC(sc, txq, curtxdnum);
 	}
 	aprint_error("\n");
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	(void) gfe_whack(sc, GE_WHACK_RESTART);
 	GE_FUNC_EXIT(sc, "");
 }
@@ -907,7 +907,7 @@ gfe_rx_get(struct gfe_softc *sc, enum gf
 			GE_DPRINTF(sc, ("!"));
 			--rxq->rxq_active;
 			ifp->if_ipackets++;
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto give_it_back;
 		}
 
@@ -1008,7 +1008,7 @@ gfe_rx_process(struct gfe_softc *sc, uin
 			sc->sc_tickflags |= GE_TICK_RX_RESTART;
 			callout_reset(>sc_co, 1, gfe_tick, sc);
 		}
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		GE_DPRINTF(sc, ("%s: rx queue %d filled at %u\n",
 		device_xname(sc->sc_dev), rxprio, rxq->rxq_fi));
 		memset(masks, 0, sizeof(masks));
@@ -1249,9 +1249,9 @@ gfe_tx_enqueue(struct gfe_softc *sc, enu
 		txq->txq_nactive--;
 
 		/* statistics */
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 		if (cmdsts & TX_STS_ES)
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		GE_DPRINTF(sc, ("%%"));
 	}
 
@@ -1424,9 +1424,9 @@ gfe_tx_done(struct gfe_softc *sc, enum g
 		txq->txq_inptr += roundup(pktlen, dcache_line_size);
 
 		/* statistics */
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 		if (cmdsts & TX_STS_ES)
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 
 		/* txd->ed_bufptr = 0; */
 

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.31 src/sys/dev/marvell/if_mvxpe.c:1.32
--- src/sys/dev/marvell/if_mvxpe.c:1.31	Sat Dec 28 03:07:18 2019
+++ src/sys/dev/marvell/if_mvxpe.c	Tue Feb  4 07:36:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.31 2019/12/28 03:07:18 gutteridge Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.32 2020/02/04 07:36:55 skrll Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.31 2019/12/28 03:07:18 gutteridge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.32 2020/02/04 07:36:55 skrll Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1709,7 +1709,7 @@ mvxpe_start(struct ifnet *ifp)
 		sc->sc_tx_ring[q].tx_queue_len);
 		DPRINTIFNET(ifp, 1, "a packet is added to tx ring\n");
 		sc->sc_tx_pending++;
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 		ifp->if_timer = 1;
 		sc->sc_wdogsoft = 1;
 		bpf_mtap(ifp, m, BPF_D_OUT);
@@ -1937,7 +1937,7 @@ mvxpe_watchdog(struct ifnet *ifp)
 MVXPE_EVCNT_INCR(>sc_ev.ev_drv_wdogsoft);
 			} else {
 aprint_error_ifnet(ifp, "watchdog timeout\n");
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 mvxpe_linkreset(sc);
 mvxpe_sc_unlock(sc);
 
@@ -3270,7 +3270,7 @@ mvxpe_update_mib(struct mvxpe_softc *sc)
 			ifp->if_ierrors += val;
 			break;
 		case MVXPE_MIBEXT_IF_COLLISIONS:
-			ifp->if_collisions += val;
+			if_statadd(ifp, if_collisions, val);
 			break;
 		default:
 			break;



CVS commit: src/sys/dev/marvell

2020-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  4 07:36:55 UTC 2020

Modified Files:
src/sys/dev/marvell: if_gfe.c if_mvxpe.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/marvell/if_gfe.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2020-02-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb  3 07:47:54 UTC 2020

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2020-02-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb  3 07:47:54 UTC 2020

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.58 src/sys/dev/marvell/if_mvgbe.c:1.59
--- src/sys/dev/marvell/if_mvgbe.c:1.58	Fri Sep 13 07:55:07 2019
+++ src/sys/dev/marvell/if_mvgbe.c	Mon Feb  3 07:47:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.58 2019/09/13 07:55:07 msaitoh Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.59 2020/02/03 07:47:53 skrll Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.58 2019/09/13 07:55:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.59 2020/02/03 07:47:53 skrll Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1455,7 +1455,7 @@ mvgbe_watchdog(struct ifnet *ifp)
 		} else {
 			aprint_error_ifnet(ifp, "watchdog timeout\n");
 
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 
 			mvgbe_init(ifp);
 		}
@@ -1998,15 +1998,15 @@ mvgbe_rxeof(struct mvgbe_softc *sc)
 			int err = rxstat & MVGBE_RX_ERROR_CODE_MASK;
 
 			if (err == MVGBE_RX_CRC_ERROR)
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 			if (err == MVGBE_RX_OVERRUN_ERROR)
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 			if (err == MVGBE_RX_MAX_FRAME_LEN_ERROR)
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 			if (err == MVGBE_RX_RESOURCE_ERROR)
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 #else
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 #endif
 			mvgbe_newbuf(sc, cur, m, dmamap);
 			continue;
@@ -2059,7 +2059,7 @@ mvgbe_rxeof(struct mvgbe_softc *sc)
 aprint_error_ifnet(ifp,
 "no receive buffers available --"
 " packet dropped!\n");
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 continue;
 			}
 			m = m0;
@@ -2107,16 +2107,16 @@ mvgbe_txeof(struct mvgbe_softc *sc)
 			break;
 		}
 		if (cur_tx->cmdsts & MVGBE_TX_LAST_DESC)
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 		if (cur_tx->cmdsts & MVGBE_ERROR_SUMMARY) {
 			int err = cur_tx->cmdsts & MVGBE_TX_ERROR_CODE_MASK;
 
 			if (err == MVGBE_TX_LATE_COLLISION_ERROR)
-ifp->if_collisions++;
+if_statinc(ifp, if_collisions);
 			if (err == MVGBE_TX_UNDERRUN_ERROR)
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 			if (err == MVGBE_TX_EXCESSIVE_COLLISION_ERRO)
-ifp->if_collisions++;
+if_statinc(ifp, if_collisions);
 		}
 		if (cdata->mvgbe_tx_chain[idx].mvgbe_mbuf != NULL) {
 			entry = cdata->mvgbe_tx_map[idx];



CVS commit: src/sys/dev/marvell

2019-12-27 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Dec 28 03:07:18 UTC 2019

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
Fix typos in messages.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.30 src/sys/dev/marvell/if_mvxpe.c:1.31
--- src/sys/dev/marvell/if_mvxpe.c:1.30	Tue Oct 15 00:13:53 2019
+++ src/sys/dev/marvell/if_mvxpe.c	Sat Dec 28 03:07:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.30 2019/10/15 00:13:53 chs Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.31 2019/12/28 03:07:18 gutteridge Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.30 2019/10/15 00:13:53 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.31 2019/12/28 03:07:18 gutteridge Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -558,11 +558,11 @@ mvxpe_evcnt_attach(struct mvxpe_softc *s
 	evcnt_attach_dynamic(>sc_ev.ev_misc_srse, EVCNT_TYPE_INTR,
 	NULL, device_xname(sc->sc_dev), "MISC SERDES sync error");
 	evcnt_attach_dynamic(>sc_ev.ev_misc_txreq, EVCNT_TYPE_INTR,
-	NULL, device_xname(sc->sc_dev), "MISC Tx resource erorr");
+	NULL, device_xname(sc->sc_dev), "MISC Tx resource error");
 
 	/* RxTx Interrupt */
 	evcnt_attach_dynamic(>sc_ev.ev_rxtx_rreq, EVCNT_TYPE_INTR,
-	NULL, device_xname(sc->sc_dev), "RxTx Rx resource erorr");
+	NULL, device_xname(sc->sc_dev), "RxTx Rx resource error");
 	evcnt_attach_dynamic(>sc_ev.ev_rxtx_rpq, EVCNT_TYPE_INTR,
 	NULL, device_xname(sc->sc_dev), "RxTx Rx packet");
 	evcnt_attach_dynamic(>sc_ev.ev_rxtx_tbrq, EVCNT_TYPE_INTR,
@@ -600,7 +600,7 @@ mvxpe_evcnt_attach(struct mvxpe_softc *s
 	evcnt_attach_dynamic(>sc_ev.ev_txd_ur, EVCNT_TYPE_MISC,
 	NULL, device_xname(sc->sc_dev), "Tx FIFO underrun counter");
 	evcnt_attach_dynamic(>sc_ev.ev_txd_oth, EVCNT_TYPE_MISC,
-	NULL, device_xname(sc->sc_dev), "Tx unkonwn erorr counter");
+	NULL, device_xname(sc->sc_dev), "Tx unknown error counter");
 
 	/* Status Registers */
 	evcnt_attach_dynamic(>sc_ev.ev_reg_pdfc, EVCNT_TYPE_MISC,
@@ -610,7 +610,7 @@ mvxpe_evcnt_attach(struct mvxpe_softc *s
 	evcnt_attach_dynamic(>sc_ev.ev_reg_txbadfcs, EVCNT_TYPE_MISC,
 	NULL, device_xname(sc->sc_dev), "Tx bad FCS counter");
 	evcnt_attach_dynamic(>sc_ev.ev_reg_txdropped, EVCNT_TYPE_MISC,
-	NULL, device_xname(sc->sc_dev), "Tx dorpped counter");
+	NULL, device_xname(sc->sc_dev), "Tx dropped counter");
 	evcnt_attach_dynamic(>sc_ev.ev_reg_lpic, EVCNT_TYPE_MISC,
 	NULL, device_xname(sc->sc_dev), "LP_IDLE counter");
 



CVS commit: src/sys/dev/marvell

2019-12-27 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Dec 28 03:07:18 UTC 2019

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
Fix typos in messages.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2019-10-01 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Oct  1 17:35:09 UTC 2019

Modified Files:
src/sys/dev/marvell: files.armada if_mvxpe.c

Log Message:
make this compile again:
 - remove unused config attributes
 - rename a local variable to avoid a name conflict


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/files.armada
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2019-10-01 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Oct  1 17:35:09 UTC 2019

Modified Files:
src/sys/dev/marvell: files.armada if_mvxpe.c

Log Message:
make this compile again:
 - remove unused config attributes
 - rename a local variable to avoid a name conflict


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/files.armada
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/files.armada
diff -u src/sys/dev/marvell/files.armada:1.3 src/sys/dev/marvell/files.armada:1.4
--- src/sys/dev/marvell/files.armada:1.3	Wed Jun  3 04:20:02 2015
+++ src/sys/dev/marvell/files.armada	Tue Oct  1 17:35:09 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.armada,v 1.3 2015/06/03 04:20:02 hsuenaga Exp $
+#	$NetBSD: files.armada,v 1.4 2019/10/01 17:35:09 chs Exp $
 # Configuration info for Marvell ARMADA integrated peripherals
 
 # ARMADA XP Buffer Manger
@@ -6,11 +6,9 @@ device	mvxpbm { [port = -1 ], [irq = -1]
 file	dev/marvell/mvxpbm.c
 
 # ARMADA XP Gigabit Ethernet Controller Interface
-define	mvxpe { [port = -1 ], [irq = -1] }
 device	mvxpe: mvxpbm, ether, ifnet, arp, mii
 file	dev/marvell/if_mvxpe.c			mvxpe		needs-flag
 
 # ARMADA XP Cryptographic Engines and Security Accelerator
-define	mvxpsec { [port = -1 ], [irq = -1] }
 device	mvxpsec: opencrypto
 file	dev/marvell/mvxpsec.c			mvxpsec		needs-flag

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.28 src/sys/dev/marvell/if_mvxpe.c:1.29
--- src/sys/dev/marvell/if_mvxpe.c:1.28	Fri Sep 13 07:55:07 2019
+++ src/sys/dev/marvell/if_mvxpe.c	Tue Oct  1 17:35:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.28 2019/09/13 07:55:07 msaitoh Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.29 2019/10/01 17:35:09 chs Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.28 2019/09/13 07:55:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.29 2019/10/01 17:35:09 chs Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -286,7 +286,7 @@ STATIC void
 mvxpe_attach(device_t parent, device_t self, void *aux)
 {
 	struct mvxpe_softc *sc = device_private(self);
-	struct mii_softc *mii;
+	struct mii_softc *child;
 	struct ifnet *ifp = >sc_ethercom.ec_if;
 	struct mii_data * const mii = >sc_mii;
 	struct marvell_attach_args *mva = aux;
@@ -485,14 +485,14 @@ mvxpe_attach(device_t parent, device_t s
 	 * but some boards may not.
 	 */
 	mii_attach(self, mii, 0x, MII_PHY_ANY, sc->sc_dev->dv_unit, 0);
-	mii = LIST_FIRST(>mii_phys);
-	if (mii == NULL) {
+	child = LIST_FIRST(>mii_phys);
+	if (child == NULL) {
 		aprint_error_dev(self, "no PHY found!\n");
 		ifmedia_add(>mii_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
 		ifmedia_set(>mii_media, IFM_ETHER | IFM_MANUAL);
 	} else {
 		ifmedia_set(>mii_media, IFM_ETHER | IFM_AUTO);
-		phyaddr = MVXPE_PHYADDR_PHYAD(mii->mii_phy);
+		phyaddr = MVXPE_PHYADDR_PHYAD(child->mii_phy);
 		MVXPE_WRITE(sc, MVXPE_PHYADDR, phyaddr);
 		DPRINTSC(sc, 1, "PHYADDR: %#x\n", MVXPE_READ(sc, MVXPE_PHYADDR));
 	}



CVS commit: src/sys/dev/marvell

2019-04-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 24 10:56:25 UTC 2019

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
 This driver uses MII(4) and have hook SIOC[GS]IFMEDIA which just pass to
ifmedia_ioctl(), the hook is not required because ether_ioctl has it
(if_ethersubr.c rev. 1.160). This driver might require some additional fixes
for SIOCSIFMTU and other ioctl()s.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.22 src/sys/dev/marvell/if_mvxpe.c:1.23
--- src/sys/dev/marvell/if_mvxpe.c:1.22	Mon Mar 18 11:38:03 2019
+++ src/sys/dev/marvell/if_mvxpe.c	Wed Apr 24 10:56:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.22 2019/03/18 11:38:03 msaitoh Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.23 2019/04/24 10:56:24 msaitoh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.22 2019/03/18 11:38:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.23 2019/04/24 10:56:24 msaitoh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1727,18 +1727,9 @@ STATIC int
 mvxpe_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
 	struct mvxpe_softc *sc = ifp->if_softc;
-	struct ifreq *ifr = data;
 	int error = 0;
-	int s;
 
 	switch (cmd) {
-	case SIOCGIFMEDIA:
-	case SIOCSIFMEDIA:
-		DPRINTIFNET(ifp, 2, "mvxpe_ioctl MEDIA\n");
-		s = splnet(); /* XXX: is there suitable mutex? */
-		error = ifmedia_ioctl(ifp, ifr, >sc_mii.mii_media, cmd);
-		splx(s);
-		break;
 	default:
 		DPRINTIFNET(ifp, 2, "mvxpe_ioctl ETHER\n");
 		error = ether_ioctl(ifp, cmd, data);



CVS commit: src/sys/dev/marvell

2019-04-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 24 10:56:25 UTC 2019

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
 This driver uses MII(4) and have hook SIOC[GS]IFMEDIA which just pass to
ifmedia_ioctl(), the hook is not required because ether_ioctl has it
(if_ethersubr.c rev. 1.160). This driver might require some additional fixes
for SIOCSIFMTU and other ioctl()s.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2018-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 11 19:40:54 UTC 2018

Modified Files:
src/sys/dev/marvell: com_mv.c

Log Message:
Remove stray ; to fix the build


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/com_mv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/com_mv.c
diff -u src/sys/dev/marvell/com_mv.c:1.10 src/sys/dev/marvell/com_mv.c:1.11
--- src/sys/dev/marvell/com_mv.c:1.10	Tue Dec 11 06:34:00 2018
+++ src/sys/dev/marvell/com_mv.c	Tue Dec 11 19:40:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: com_mv.c,v 1.10 2018/12/11 06:34:00 thorpej Exp $	*/
+/*	$NetBSD: com_mv.c,v 1.11 2018/12/11 19:40:54 martin Exp $	*/
 /*
  * Copyright (c) 2007, 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com_mv.c,v 1.10 2018/12/11 06:34:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_mv.c,v 1.11 2018/12/11 19:40:54 martin Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ CFATTACH_DECL_NEW(mvuart_mbus, sizeof(st
 
 static void
 mvuart_init_regs(struct com_regs *regs, bus_space_tag_t tag,
-		 bus_space_handle_t hdl, bus_addr_t addr);
+		 bus_space_handle_t hdl, bus_addr_t addr)
 {
 
 	com_init_regs_stride(regs, tag, hdl, addr, 2);



CVS commit: src/sys/dev/marvell

2018-12-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 11 19:40:54 UTC 2018

Modified Files:
src/sys/dev/marvell: com_mv.c

Log Message:
Remove stray ; to fix the build


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/com_mv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2018-05-07 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon May  7 09:41:10 UTC 2018

Modified Files:
src/sys/dev/marvell: mvxpbm.c

Log Message:
Fix double-free, m_tag_delete_chain is already called by m_free.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvxpbm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2018-05-07 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon May  7 09:41:10 UTC 2018

Modified Files:
src/sys/dev/marvell: mvxpbm.c

Log Message:
Fix double-free, m_tag_delete_chain is already called by m_free.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvxpbm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvxpbm.c
diff -u src/sys/dev/marvell/mvxpbm.c:1.1 src/sys/dev/marvell/mvxpbm.c:1.2
--- src/sys/dev/marvell/mvxpbm.c:1.1	Wed Jun  3 03:55:47 2015
+++ src/sys/dev/marvell/mvxpbm.c	Mon May  7 09:41:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpbm.c,v 1.1 2015/06/03 03:55:47 hsuenaga Exp $	*/
+/*	$NetBSD: mvxpbm.c,v 1.2 2018/05/07 09:41:10 maxv Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvxpbm.c,v 1.1 2015/06/03 03:55:47 hsuenaga Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvxpbm.c,v 1.2 2018/05/07 09:41:10 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -322,8 +322,7 @@ mvxpbm_free_mbuf(struct mbuf *m, void *b
 	KASSERT(arg != NULL);
 
 	DPRINTFN(3, "free packet %p\n", m);
-	if (m->m_flags & M_PKTHDR)
-		m_tag_delete_chain((m), NULL);
+
 	chunk->m = NULL;
 	s = splvm();
 	pool_cache_put(mb_cache, m);



CVS commit: src/sys/dev/marvell

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 22:22:58 UTC 2017

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
use PR_NOWAIT instead of 0


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvxpsec.c
diff -u src/sys/dev/marvell/mvxpsec.c:1.1 src/sys/dev/marvell/mvxpsec.c:1.2
--- src/sys/dev/marvell/mvxpsec.c:1.1	Wed Jun  3 00:20:02 2015
+++ src/sys/dev/marvell/mvxpsec.c	Thu Nov  9 17:22:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.1 2015/06/03 04:20:02 hsuenaga Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.2 2017/11/09 22:22:58 christos Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -1498,7 +1498,7 @@ mvxpsec_session_alloc(struct mvxpsec_sof
 {
 	struct mvxpsec_session *mv_s;
 
-	mv_s = pool_cache_get(sc->sc_session_pool, 0);
+	mv_s = pool_cache_get(sc->sc_session_pool, PR_NOWAIT);
 	if (mv_s == NULL) {
 		log(LOG_ERR, "%s: cannot allocate memory\n", __func__);
 		return NULL;
@@ -1614,7 +1614,7 @@ mvxpsec_packet_alloc(struct mvxpsec_sess
 		sc->sc_free_qlen--;
 	}
 	else {
-		mv_p = pool_cache_get(sc->sc_packet_pool, 0);
+		mv_p = pool_cache_get(sc->sc_packet_pool, PR_NOWAIT);
 		if (mv_p == NULL) {
 			log(LOG_ERR, "%s: cannot allocate memory\n",
 			__func__);



CVS commit: src/sys/dev/marvell

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 22:22:58 UTC 2017

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
use PR_NOWAIT instead of 0


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvxpsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2017-03-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Mar  3 16:52:08 UTC 2017

Modified Files:
src/sys/dev/marvell: mvsdio.c

Log Message:
Add check during mvsdio_attach that CMD line is in idle state.

If the CMD line is not in idle state, the interrupt handler routine will
misbehave causing an endless interrupt handler loop.  This would prevent
the the kernel from getting to mountroot.

On my Pogoplug POGO-V4-A3-01, this was caused by U-Boot routing com1's TX
and RX signals to the SD card slot's CMD and DAT[0] lines respectively.

We should probably grow Marvell SoC MPP (pinmux) configuration frobs.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/mvsdio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvsdio.c
diff -u src/sys/dev/marvell/mvsdio.c:1.5 src/sys/dev/marvell/mvsdio.c:1.6
--- src/sys/dev/marvell/mvsdio.c:1.5	Sat Mar 15 13:33:48 2014
+++ src/sys/dev/marvell/mvsdio.c	Fri Mar  3 16:52:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsdio.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $	*/
+/*	$NetBSD: mvsdio.c,v 1.6 2017/03/03 16:52:08 jakllsch Exp $	*/
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsdio.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsdio.c,v 1.6 2017/03/03 16:52:08 jakllsch Exp $");
 
 #include "opt_mvsdio.h"
 
@@ -157,6 +157,7 @@ mvsdio_attach(device_t parent, device_t 
 	struct marvell_attach_args *mva = aux;
 	struct sdmmcbus_attach_args saa;
 	uint32_t nis, eis;
+	uint32_t hps;
 
 	aprint_naive("\n");
 	aprint_normal(": Marvell Secure Digital Input/Output Interface\n");
@@ -227,6 +228,13 @@ mvsdio_attach(device_t parent, device_t 
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, MVSDIO_EISE, eis);
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, MVSDIO_EISIE, eis);
 
+	hps = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MVSDIO_HPS16LSB);
+	if ((hps & HPS16LSB_CMDLEVEL) == 0) {
+		aprint_error_dev(sc->sc_dev,
+		"CMD line not idle, HPS 0x%x (bad MPP config?)\n", hps);
+		return;
+	}
+
 /*
 	 * Attach the generic SD/MMC bus driver.  (The bus driver must
 	 * not invoke any chipset functions before it is attached.)



CVS commit: src/sys/dev/marvell

2017-03-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Mar  3 16:52:08 UTC 2017

Modified Files:
src/sys/dev/marvell: mvsdio.c

Log Message:
Add check during mvsdio_attach that CMD line is in idle state.

If the CMD line is not in idle state, the interrupt handler routine will
misbehave causing an endless interrupt handler loop.  This would prevent
the the kernel from getting to mountroot.

On my Pogoplug POGO-V4-A3-01, this was caused by U-Boot routing com1's TX
and RX signals to the SD card slot's CMD and DAT[0] lines respectively.

We should probably grow Marvell SoC MPP (pinmux) configuration frobs.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/mvsdio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2017-01-09 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Jan  9 14:06:35 UTC 2017

Modified Files:
src/sys/dev/marvell: marvellreg.h

Log Message:
Add ATTR_AXI_DDR.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/marvellreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/marvellreg.h
diff -u src/sys/dev/marvell/marvellreg.h:1.10 src/sys/dev/marvell/marvellreg.h:1.11
--- src/sys/dev/marvell/marvellreg.h:1.10	Tue Oct  4 15:02:27 2016
+++ src/sys/dev/marvell/marvellreg.h	Mon Jan  9 14:06:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: marvellreg.h,v 1.10 2016/10/04 15:02:27 kiyohara Exp $	*/
+/*	$NetBSD: marvellreg.h,v 1.11 2017/01/09 14:06:35 kiyohara Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -88,5 +88,6 @@
 #define MARVELL_ATTR_SDRAM_CS2		0x0b
 #define MARVELL_ATTR_SDRAM_CS3		0x07
 #endif
+#define MARVELL_ATTR_AXI_DDR		0x00
 
 #endif	/* _DEV_MARVELL_MARVELLREG_H_ */



CVS commit: src/sys/dev/marvell

2017-01-09 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Jan  9 14:06:35 UTC 2017

Modified Files:
src/sys/dev/marvell: marvellreg.h

Log Message:
Add ATTR_AXI_DDR.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/marvellreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:44:26 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmac.c

Log Message:
Support Marvell Dove.  Use irq array.  Dove's irqs not sequencial.
And remove debug printf().


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/marvell/gtidmac.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/gtidmac.c
diff -u src/sys/dev/marvell/gtidmac.c:1.12 src/sys/dev/marvell/gtidmac.c:1.13
--- src/sys/dev/marvell/gtidmac.c:1.12	Sat Jan  7 14:36:51 2017
+++ src/sys/dev/marvell/gtidmac.c	Sat Jan  7 14:44:26 2017
@@ -1,6 +1,6 @@
-/*	$NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $	*/
+/*	$NetBSD: gtidmac.c,v 1.13 2017/01/07 14:44:26 kiyohara Exp $	*/
 /*
- * Copyright (c) 2008, 2012 KIYOHARA Takashi
+ * Copyright (c) 2008, 2012, 2016 KIYOHARA Takashi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.13 2017/01/07 14:44:26 kiyohara Exp $");
 
 #include 
 #include 
@@ -276,24 +276,30 @@ static const struct dmover_algdesc mvxor
 	},
 };
 
+static int orion_88f5182_xore_irqs[] = { 30, 31 };
+static int kirkwood_xore_irqs[] = { 5, 6, 7, 8 };
+static int dove_xore_irqs[] = { 39, 40, 42, 43 };
+static int armadaxp_xore_irqs0[] = { 51, 52 };
+static int armadaxp_xore_irqs1[] = { 94, 95 };
+
 static struct {
 	int model;
 	int idmac_nchan;
 	int idmac_irq;
 	int xore_nchan;
-	int xore_irq;
+	int *xore_irqs;
 } channels[] = {
 	/*
 	 * Marvell System Controllers:
 	 * need irqs in attach_args.
 	 */
-	{ MARVELL_DISCOVERY,		8, -1, 0, -1 },
-	{ MARVELL_DISCOVERY_II,		8, -1, 0, -1 },
-	{ MARVELL_DISCOVERY_III,	8, -1, 0, -1 },
+	{ MARVELL_DISCOVERY,		8, -1, 0, NULL },
+	{ MARVELL_DISCOVERY_II,		8, -1, 0, NULL },
+	{ MARVELL_DISCOVERY_III,	8, -1, 0, NULL },
 #if 0
-	{ MARVELL_DISCOVERY_LT,		4, -1, 2, -1 },
-	{ MARVELL_DISCOVERY_V,		4, -1, 2, -1 },
-	{ MARVELL_DISCOVERY_VI,		4, -1, 2, -1 },		
+	{ MARVELL_DISCOVERY_LT,		4, -1, 2, NULL },
+	{ MARVELL_DISCOVERY_V,		4, -1, 2, NULL },
+	{ MARVELL_DISCOVERY_VI,		4, -1, 2, NULL },		
 #endif
 
 	/*
@@ -301,28 +307,29 @@ static struct {
 	 * No need irqs in attach_args.  We always connecting to interrupt-pin
 	 * statically.
 	 */
-	{ MARVELL_ORION_1_88F1181,	4, 24, 0, -1 },
-	{ MARVELL_ORION_2_88F1281,	4, 24, 0, -1 },
-	{ MARVELL_ORION_1_88F5082,	4, 24, 0, -1 },
-	{ MARVELL_ORION_1_88F5180N,	4, 24, 0, -1 },
-	{ MARVELL_ORION_1_88F5181,	4, 24, 0, -1 },
-	{ MARVELL_ORION_1_88F5182,	4, 24, 2, 30 },
-	{ MARVELL_ORION_2_88F5281,	4, 24, 0, -1 },
-	{ MARVELL_ORION_1_88W8660,	4, 24, 0, -1 },
-	{ MARVELL_KIRKWOOD_88F6180,	0, -1, 4, 5 },
-	{ MARVELL_KIRKWOOD_88F6192,	0, -1, 4, 5 },
-	{ MARVELL_KIRKWOOD_88F6281,	0, -1, 4, 5 },
-	{ MARVELL_KIRKWOOD_88F6282,	0, -1, 4, 5 },
-	{ MARVELL_ARMADAXP_MV78130,	4, 33, 2, 51 },
-	{ MARVELL_ARMADAXP_MV78130,	0, -1, 2, 94 },
-	{ MARVELL_ARMADAXP_MV78160,	4, 33, 2, 51 },
-	{ MARVELL_ARMADAXP_MV78160,	0, -1, 2, 94 },
-	{ MARVELL_ARMADAXP_MV78230,	4, 33, 2, 51 },
-	{ MARVELL_ARMADAXP_MV78230,	0, -1, 2, 94 },
-	{ MARVELL_ARMADAXP_MV78260,	4, 33, 2, 51 },
-	{ MARVELL_ARMADAXP_MV78260,	0, -1, 2, 94 },
-	{ MARVELL_ARMADAXP_MV78460,	4, 33, 2, 51 },
-	{ MARVELL_ARMADAXP_MV78460,	0, -1, 2, 94 },
+	{ MARVELL_ORION_1_88F1181,	4, 24, 0, NULL },
+	{ MARVELL_ORION_2_88F1281,	4, 24, 0, NULL },
+	{ MARVELL_ORION_1_88F5082,	4, 24, 0, NULL },
+	{ MARVELL_ORION_1_88F5180N,	4, 24, 0, NULL },
+	{ MARVELL_ORION_1_88F5181,	4, 24, 0, NULL },
+	{ MARVELL_ORION_1_88F5182,	4, 24, 2, orion_88f5182_xore_irqs },
+	{ MARVELL_ORION_2_88F5281,	4, 24, 0, NULL },
+	{ MARVELL_ORION_1_88W8660,	4, 24, 0, NULL },
+	{ MARVELL_KIRKWOOD_88F6180,	0, -1, 4, kirkwood_xore_irqs },
+	{ MARVELL_KIRKWOOD_88F6192,	0, -1, 4, kirkwood_xore_irqs },
+	{ MARVELL_KIRKWOOD_88F6281,	0, -1, 4, kirkwood_xore_irqs },
+	{ MARVELL_KIRKWOOD_88F6282,	0, -1, 4, kirkwood_xore_irqs },
+	{ MARVELL_DOVE_88AP510,		0, -1, 4, dove_xore_irqs },
+	{ MARVELL_ARMADAXP_MV78130,	4, 33, 2, armadaxp_xore_irqs0 },
+	{ MARVELL_ARMADAXP_MV78130,	0, -1, 2, armadaxp_xore_irqs1 },
+	{ MARVELL_ARMADAXP_MV78160,	4, 33, 2, armadaxp_xore_irqs0 },
+	{ MARVELL_ARMADAXP_MV78160,	0, -1, 2, armadaxp_xore_irqs1 },
+	{ MARVELL_ARMADAXP_MV78230,	4, 33, 2, armadaxp_xore_irqs0 },
+	{ MARVELL_ARMADAXP_MV78230,	0, -1, 2, armadaxp_xore_irqs1 },
+	{ MARVELL_ARMADAXP_MV78260,	4, 33, 2, armadaxp_xore_irqs0 },
+	{ MARVELL_ARMADAXP_MV78260,	0, -1, 2, armadaxp_xore_irqs1 },
+	{ MARVELL_ARMADAXP_MV78460,	4, 33, 2, armadaxp_xore_irqs0 },
+	{ MARVELL_ARMADAXP_MV78460,	0, -1, 2, armadaxp_xore_irqs1 },
 };
 
 struct gtidmac_winacctbl *gtidmac_winacctbl;
@@ -364,7 +371,7 @@ gtidmac_attach(device_t parent, device_t
 	struct gtidmac_softc *sc = 

CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:44:26 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmac.c

Log Message:
Support Marvell Dove.  Use irq array.  Dove's irqs not sequencial.
And remove debug printf().


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/marvell/gtidmac.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:36:51 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmac.c gtidmacvar.h

Log Message:
Remove unused function.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/gtidmac.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/gtidmacvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:36:51 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmac.c gtidmacvar.h

Log Message:
Remove unused function.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/gtidmac.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/gtidmacvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/gtidmac.c
diff -u src/sys/dev/marvell/gtidmac.c:1.11 src/sys/dev/marvell/gtidmac.c:1.12
--- src/sys/dev/marvell/gtidmac.c:1.11	Sat Mar 15 13:33:48 2014
+++ src/sys/dev/marvell/gtidmac.c	Sat Jan  7 14:36:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtidmac.c,v 1.11 2014/03/15 13:33:48 kiyohara Exp $	*/
+/*	$NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008, 2012 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.11 2014/03/15 13:33:48 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $");
 
 #include 
 #include 
@@ -926,13 +926,6 @@ gtidmac_dmmap_unload(struct gtidmac_soft
 }
 
 
-void *
-gtidmac_tag_get(void)
-{
-
-	return gtidmac_softc;
-}
-
 /*
  * IDMAC functions
  */

Index: src/sys/dev/marvell/gtidmacvar.h
diff -u src/sys/dev/marvell/gtidmacvar.h:1.2 src/sys/dev/marvell/gtidmacvar.h:1.3
--- src/sys/dev/marvell/gtidmacvar.h:1.2	Sat Mar 15 13:33:48 2014
+++ src/sys/dev/marvell/gtidmacvar.h	Sat Jan  7 14:36:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtidmacvar.h,v 1.2 2014/03/15 13:33:48 kiyohara Exp $	*/
+/*	$NetBSD: gtidmacvar.h,v 1.3 2017/01/07 14:36:51 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008, 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -48,8 +48,6 @@ struct gtidmac_winacctbl {
 extern struct gtidmac_winacctbl *gtidmac_winacctbl;
 extern struct gtidmac_winacctbl *mvxore_winacctbl;
 
-void *gtidmac_tag_get(void);
-
 int gtidmac_chan_alloc(void *, bus_dmamap_t **, bus_dmamap_t **, void *);
 void gtidmac_chan_free(void *, int);
 int gtidmac_setup(void *, int, int, bus_dmamap_t *, bus_dmamap_t *, bus_size_t);



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:32:33 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmacreg.h

Log Message:
Fix macro MVXORE_CHAN2BASE().  The XORE has 2 channels per port.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/gtidmacreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/gtidmacreg.h
diff -u src/sys/dev/marvell/gtidmacreg.h:1.3 src/sys/dev/marvell/gtidmacreg.h:1.4
--- src/sys/dev/marvell/gtidmacreg.h:1.3	Mon Jul 23 06:09:47 2012
+++ src/sys/dev/marvell/gtidmacreg.h	Sat Jan  7 14:32:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtidmacreg.h,v 1.3 2012/07/23 06:09:47 kiyohara Exp $	*/
+/*	$NetBSD: gtidmacreg.h,v 1.4 2017/01/07 14:32:32 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008, 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -51,7 +51,7 @@
 #define MVXORE_PORT2BASE(sc, p)	\
 (((sc)->sc_gtidmac_nchan == 0 && (p) == 0) ? -0x100 : 0x000)
 #define MVXORE_CHAN2BASE(sc, c)	\
-(MVXORE_PORT2BASE(sc, (c) & 0x4) + (((c) & 0x3) << 2))
+(MVXORE_PORT2BASE(sc, (c) & 0xe) + (((c) & 0x1) << 2))
 
 
 /* IDMA Descriptor Register Map */



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:32:33 UTC 2017

Modified Files:
src/sys/dev/marvell: gtidmacreg.h

Log Message:
Fix macro MVXORE_CHAN2BASE().  The XORE has 2 channels per port.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/gtidmacreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:26:37 UTC 2017

Modified Files:
src/sys/dev/marvell: marvellvar.h

Log Message:
Add tags for AXI_CS[01].


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/marvellvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/marvellvar.h
diff -u src/sys/dev/marvell/marvellvar.h:1.5 src/sys/dev/marvell/marvellvar.h:1.6
--- src/sys/dev/marvell/marvellvar.h:1.5	Sat Mar 15 11:47:43 2014
+++ src/sys/dev/marvell/marvellvar.h	Sat Jan  7 14:26:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: marvellvar.h,v 1.5 2014/03/15 11:47:43 kiyohara Exp $	*/
+/*	$NetBSD: marvellvar.h,v 1.6 2017/01/07 14:26:37 kiyohara Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -34,6 +34,9 @@ enum marvell_tags {
 	MARVELL_TAG_SDRAM_CS2,
 	MARVELL_TAG_SDRAM_CS3,
 
+	MARVELL_TAG_AXI_CS0,	/* Advanced eXtensible Interface */
+	MARVELL_TAG_AXI_CS1,	/* Advanced eXtensible Interface */
+
 	MARVELL_TAG_DDR3_CS0,
 	MARVELL_TAG_DDR3_CS1,
 	MARVELL_TAG_DDR3_CS2,



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:26:37 UTC 2017

Modified Files:
src/sys/dev/marvell: marvellvar.h

Log Message:
Add tags for AXI_CS[01].


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/marvellvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:24:27 UTC 2017

Modified Files:
src/sys/dev/marvell: if_mvgbe.c mvsata_mv.c

Log Message:
Support Marvell Dove.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/mvsata_mv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:24:27 UTC 2017

Modified Files:
src/sys/dev/marvell: if_mvgbe.c mvsata_mv.c

Log Message:
Support Marvell Dove.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/mvsata_mv.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.47 src/sys/dev/marvell/if_mvgbe.c:1.48
--- src/sys/dev/marvell/if_mvgbe.c:1.47	Thu Dec 15 09:28:05 2016
+++ src/sys/dev/marvell/if_mvgbe.c	Sat Jan  7 14:24:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.47 2016/12/15 09:28:05 ozaki-r Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.48 2017/01/07 14:24:27 kiyohara Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.47 2016/12/15 09:28:05 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.48 2017/01/07 14:24:27 kiyohara Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -367,6 +367,8 @@ struct mvgbe_port {
 	{ MARVELL_MV78XX0_MV78200,	2, 1, { 48 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
 	{ MARVELL_MV78XX0_MV78200,	3, 1, { 52 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
 
+	{ MARVELL_DOVE_88AP510,		0, 1, { 29 }, FLAGS_FIX_TQTB | FLAGS_IPG2 },
+
 	{ MARVELL_ARMADAXP_MV78130,	0, 1, { 66 }, FLAGS_HAS_PV },
 	{ MARVELL_ARMADAXP_MV78130,	1, 1, { 70 }, FLAGS_HAS_PV },
 	{ MARVELL_ARMADAXP_MV78130,	2, 1, { 74 }, FLAGS_HAS_PV },

Index: src/sys/dev/marvell/mvsata_mv.c
diff -u src/sys/dev/marvell/mvsata_mv.c:1.7 src/sys/dev/marvell/mvsata_mv.c:1.8
--- src/sys/dev/marvell/mvsata_mv.c:1.7	Sat Mar 15 13:33:48 2014
+++ src/sys/dev/marvell/mvsata_mv.c	Sat Jan  7 14:24:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata_mv.c,v 1.7 2014/03/15 13:33:48 kiyohara Exp $	*/
+/*	$NetBSD: mvsata_mv.c,v 1.8 2017/01/07 14:24:27 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.7 2014/03/15 13:33:48 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.8 2017/01/07 14:24:27 kiyohara Exp $");
 
 #include 
 #include 
@@ -99,6 +99,9 @@ struct mvsata_product mvsata_products[] 
 	{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78100, 1, 2, gen2e, 0 },
 	{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78200, 1, 2, gen2e, 0 },
 
+	/* Dove */
+	{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88AP510, 1, 1, gen2e, 0 },
+
 	/* Armada XP */
 	{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78130, 1, 2, gen2e, 0 },
 	{ PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78160, 1, 2, gen2e, 0 },



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:19:45 UTC 2017

Modified Files:
src/sys/dev/marvell: mvspireg.h

Log Message:
Change MVSPI_SIZE to 0x80 instead of 0x50.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvspireg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2017-01-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jan  7 14:19:45 UTC 2017

Modified Files:
src/sys/dev/marvell: mvspireg.h

Log Message:
Change MVSPI_SIZE to 0x80 instead of 0x50.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvspireg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvspireg.h
diff -u src/sys/dev/marvell/mvspireg.h:1.2 src/sys/dev/marvell/mvspireg.h:1.3
--- src/sys/dev/marvell/mvspireg.h:1.2	Mon May 13 15:47:18 2013
+++ src/sys/dev/marvell/mvspireg.h	Sat Jan  7 14:19:45 2017
@@ -38,7 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 #ifndef _MVSPIREG_H_
 #define _MVSPIREG_H_
 
-#define		MVSPI_SIZE			0x50		/* Size of MVSPI */
+#define		MVSPI_SIZE			0x80		/* Size of MVSPI */
 
 /* Definition of registers */
 #define		MVSPI_CTRL_REG			0x00		/* MVSPI Control Register */



CVS commit: src/sys/dev/marvell

2016-10-10 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Oct 10 14:23:35 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
The bus_dmamap_sync(PREREAD) is unnecessary for sent mbuf.
Moreover bus_dmamap_sync(POSTWRITE), before unload.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-10-10 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Mon Oct 10 14:23:35 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
The bus_dmamap_sync(PREREAD) is unnecessary for sent mbuf.
Moreover bus_dmamap_sync(POSTWRITE), before unload.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.13 src/sys/dev/marvell/if_mvxpe.c:1.14
--- src/sys/dev/marvell/if_mvxpe.c:1.13	Fri Jun 10 13:27:14 2016
+++ src/sys/dev/marvell/if_mvxpe.c	Mon Oct 10 14:23:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.13 2016/06/10 13:27:14 ozaki-r Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.14 2016/10/10 14:23:35 kiyohara Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.13 2016/06/10 13:27:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.14 2016/10/10 14:23:35 kiyohara Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1141,6 +1141,7 @@ mvxpe_ring_flush_queue(struct mvxpe_soft
 {
 	struct mvxpe_rx_ring *rx = MVXPE_RX_RING(sc, q);
 	struct mvxpe_tx_ring *tx = MVXPE_TX_RING(sc, q);
+	struct mbuf *m;
 	int i;
 
 	KASSERT_RX_MTX(sc, q);
@@ -1157,11 +1158,15 @@ mvxpe_ring_flush_queue(struct mvxpe_soft
 
 	/* Tx handle */
 	for (i = 0; i < MVXPE_TX_RING_CNT; i++) {
-		if (MVXPE_TX_MBUF(sc, q, i) == NULL)
+		m = MVXPE_TX_MBUF(sc, q, i);
+		if (m == NULL)
 			continue;
-		bus_dmamap_unload(sc->sc_dmat, MVXPE_TX_MAP(sc, q, i));
-		m_freem(MVXPE_TX_MBUF(sc, q, i));
 		MVXPE_TX_MBUF(sc, q, i) = NULL;
+		bus_dmamap_sync(sc->sc_dmat,
+		MVXPE_TX_MAP(sc, q, i), 0, m->m_pkthdr.len,
+		BUS_DMASYNC_POSTWRITE);
+		bus_dmamap_unload(sc->sc_dmat, MVXPE_TX_MAP(sc, q, i));
+		m_freem(m);
 	}
 	tx->tx_dma = tx->tx_cpu = 0;
	tx->tx_used = 0;
@@ -2141,7 +2146,7 @@ mvxpe_tx_queue(struct mvxpe_softc *sc, s
 	MVXPE_TX_MBUF(sc, q, tx->tx_cpu) = m;
 	bus_dmamap_sync(sc->sc_dmat,
 	MVXPE_TX_MAP(sc, q, tx->tx_cpu), 0, m->m_pkthdr.len,
-	BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
+	BUS_DMASYNC_PREWRITE);
 
 	/* load to tx descriptors */
 	start = tx->tx_cpu;
@@ -2302,6 +2307,7 @@ mvxpe_tx_queue_complete(struct mvxpe_sof
 {
 	struct mvxpe_tx_ring *tx = MVXPE_TX_RING(sc, q);
 	struct mvxpe_tx_desc *t;
+	struct mbuf *m;
 	uint32_t ptxs, ptxsu, ndesc;
 	int i;
 
@@ -2342,12 +2348,16 @@ mvxpe_tx_queue_complete(struct mvxpe_sof
 			}
 			error = 1;
 		}
-		if (MVXPE_TX_MBUF(sc, q, tx->tx_dma) != NULL) {
+		m = MVXPE_TX_MBUF(sc, q, tx->tx_dma);
+		if (m != NULL) {
 			KASSERT((t->command & MVXPE_TX_CMD_F) != 0);
+			MVXPE_TX_MBUF(sc, q, tx->tx_dma) = NULL;
+			bus_dmamap_sync(sc->sc_dmat,
+			MVXPE_TX_MAP(sc, q, tx->tx_dma), 0, m->m_pkthdr.len,
+			BUS_DMASYNC_POSTWRITE);
 			bus_dmamap_unload(sc->sc_dmat,
 			MVXPE_TX_MAP(sc, q, tx->tx_dma));
-			m_freem(MVXPE_TX_MBUF(sc, q, tx->tx_dma));
-			MVXPE_TX_MBUF(sc, q, tx->tx_dma) = NULL;
+			m_freem(m);
 			sc->sc_tx_pending--;
 		}
 		else



CVS commit: src/sys/dev/marvell

2016-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  9 14:50:54 UTC 2016

Modified Files:
src/sys/dev/marvell: gt.c

Log Message:
PR/51540: Henning Petersen: replace , with ;


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/marvell/gt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/gt.c
diff -u src/sys/dev/marvell/gt.c:1.27 src/sys/dev/marvell/gt.c:1.28
--- src/sys/dev/marvell/gt.c:1.27	Sat Jul 11 06:32:46 2015
+++ src/sys/dev/marvell/gt.c	Sun Oct  9 10:50:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gt.c,v 1.27 2015/07/11 10:32:46 kamil Exp $	*/
+/*	$NetBSD: gt.c,v 1.28 2016/10/09 14:50:54 christos Exp $	*/
 
 /*
  * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.27 2015/07/11 10:32:46 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.28 2016/10/09 14:50:54 christos Exp $");
 
 #include "opt_marvell.h"
 #include "gtmpsc.h"
@@ -807,7 +807,7 @@ gt_watchdog_init(struct gt_softc *gt)
 	gt_write(gt, GT_WDOG_Config, GT_WDOG_Config_Ctl1a|GT_WDOG_Preset_DFLT);
 	gt_write(gt, GT_WDOG_Config, GT_WDOG_Config_Ctl1b|GT_WDOG_Preset_DFLT);
 
-	r = gt_read(gt, GT_WDOG_Config),
+	r = gt_read(gt, GT_WDOG_Config);
 	aprint_normal(" status %#x,%#x: %s\n",
 	r, gt_read(gt, GT_WDOG_Value),
 	((r & GT_WDOG_Config_Enb) != 0) ? "enabled" : "botch");



CVS commit: src/sys/dev/marvell

2016-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  9 14:50:54 UTC 2016

Modified Files:
src/sys/dev/marvell: gt.c

Log Message:
PR/51540: Henning Petersen: replace , with ;


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/marvell/gt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  9 14:49:51 UTC 2016

Modified Files:
src/sys/dev/marvell: mvspi.c

Log Message:
PR/51540: Henning Petersen: replace , with ;


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/mvspi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/mvspi.c
diff -u src/sys/dev/marvell/mvspi.c:1.3 src/sys/dev/marvell/mvspi.c:1.4
--- src/sys/dev/marvell/mvspi.c:1.3	Sun Dec 13 13:35:26 2015
+++ src/sys/dev/marvell/mvspi.c	Sun Oct  9 10:49:51 2016
@@ -130,7 +130,7 @@ mvspi_attach(struct device *parent, stru
 	ctl &= MVSPI_DIRHS_MASK;
 	ctl &= MVSPI_1BYTE_MASK;
 
-	PUTREG(sc, MVSPI_INTCONF_REG, ctl),
+	PUTREG(sc, MVSPI_INTCONF_REG, ctl);
 
 	/*
 	 * Initialize SPI controller.



CVS commit: src/sys/dev/marvell

2016-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  9 14:49:51 UTC 2016

Modified Files:
src/sys/dev/marvell: mvspi.c

Log Message:
PR/51540: Henning Petersen: replace , with ;


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/mvspi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 15:02:27 UTC 2016

Modified Files:
src/sys/dev/marvell: marvellreg.h

Log Message:
Add 88AP510.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/marvell/marvellreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-10-04 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Oct  4 15:02:27 UTC 2016

Modified Files:
src/sys/dev/marvell: marvellreg.h

Log Message:
Add 88AP510.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/marvell/marvellreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/marvellreg.h
diff -u src/sys/dev/marvell/marvellreg.h:1.9 src/sys/dev/marvell/marvellreg.h:1.10
--- src/sys/dev/marvell/marvellreg.h:1.9	Wed Jun  3 04:00:06 2015
+++ src/sys/dev/marvell/marvellreg.h	Tue Oct  4 15:02:27 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: marvellreg.h,v 1.9 2015/06/03 04:00:06 hsuenaga Exp $	*/
+/*	$NetBSD: marvellreg.h,v 1.10 2016/10/04 15:02:27 kiyohara Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -59,6 +59,8 @@
 #define MARVELL_MV78XX0_MV78100		PCI_PRODUCT_MARVELL_MV78100
 #define MARVELL_MV78XX0_MV78200		PCI_PRODUCT_MARVELL_MV78200
 
+#define MARVELL_DOVE_88AP510		PCI_PRODUCT_MARVELL_88AP510
+
 #define MARVELL_ARMADAXP_MV78130	PCI_PRODUCT_MARVELL_MV78130
 #define MARVELL_ARMADAXP_MV78160	PCI_PRODUCT_MARVELL_MV78160
 #define MARVELL_ARMADAXP_MV78230	PCI_PRODUCT_MARVELL_MV78230



CVS commit: src/sys/dev/marvell

2016-02-13 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 08:05:07 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c if_mvxpevar.h

Log Message:
Make all packets are enqueued into queue 0.
queue 7 is not default, it is caused by the filter tables.
The fields are including queue number, not bitfields.
So MVXPE_DF_QUEUE_ALL (b111) means queue 7.

And also, pass all unicast addresses if it is promisc mode.
MVXPE_PXC_UPM is working in almost cases,
but this change is needed for some cases; bridging frames through inter units,
using products have consecutive MAC addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/if_mvxpe.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/if_mvxpevar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.11 src/sys/dev/marvell/if_mvxpe.c:1.12
--- src/sys/dev/marvell/if_mvxpe.c:1.11	Sat Feb 13 06:44:22 2016
+++ src/sys/dev/marvell/if_mvxpe.c	Sat Feb 13 08:05:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.11 2016/02/13 06:44:22 hikaru Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.12 2016/02/13 08:05:06 hikaru Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.11 2016/02/13 06:44:22 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.12 2016/02/13 08:05:06 hikaru Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -924,6 +924,13 @@ mvxpe_initreg(struct ifnet *ifp)
 
 	/* Port MAC Control set 4 is not used */
 
+	/* Port Configuration */
+	/* Use queue 0 only */
+	reg = MVXPE_READ(sc, MVXPE_PXC);
+	reg &= ~(MVXPE_PXC_RXQ_MASK | MVXPE_PXC_RXQARP_MASK |
+	MVXPE_PXC_TCPQ_MASK | MVXPE_PXC_UDPQ_MASK | MVXPE_PXC_BPDUQ_MASK);
+	MVXPE_WRITE(sc, MVXPE_PXC, reg);
+
 	/* Port Configuration Extended: enable Tx CRC generation */
 	reg = MVXPE_READ(sc, MVXPE_PXCX);
 	reg &= ~MVXPE_PXCX_TXCRCDIS;
@@ -2717,11 +2724,11 @@ mvxpe_filter_setup(struct mvxpe_softc *s
 		if (memcmp(enm->enm_addrlo, special, 5) == 0) {
 			i = enm->enm_addrlo[5];
 			dfsmt[i>>2] |=
-			MVXPE_DF(i&3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS);
+			MVXPE_DF(i&3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS);
 		} else {
 			i = mvxpe_crc8(enm->enm_addrlo, ETHER_ADDR_LEN);
 			dfomt[i>>2] |=
-			MVXPE_DF(i&3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS);
+			MVXPE_DF(i&3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS);
 		}
 
 		ETHER_NEXT_MULTI(step, enm);
@@ -2732,10 +2739,10 @@ allmulti:
 	if (ifp->if_flags & (IFF_ALLMULTI|IFF_PROMISC)) {
 		for (i = 0; i < MVXPE_NDFSMT; i++) {
 			dfsmt[i] = dfomt[i] = 
-			MVXPE_DF(0, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS) |
-			MVXPE_DF(1, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS) |
-			MVXPE_DF(2, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS) |
-			MVXPE_DF(3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS);
+			MVXPE_DF(0, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+			MVXPE_DF(1, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+			MVXPE_DF(2, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+			MVXPE_DF(3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS);
 		}
 	}
 
@@ -2752,8 +2759,20 @@ set:
 	MVXPE_WRITE(sc, MVXPE_PXC, pxc);
 
 	/* Set Destination Address Filter Unicast Table */
-	i = sc->sc_enaddr[5] & 0xf;		/* last nibble */
-	dfut[i>>2] = MVXPE_DF(i&3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS);
+	if (ifp->if_flags & IFF_PROMISC) {
+		/* pass all unicast addresses */
+		for (i = 0; i < MVXPE_NDFUT; i++) {
+			dfut[i] =
+			MVXPE_DF(0, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+			MVXPE_DF(1, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+			MVXPE_DF(2, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) |
+			MVXPE_DF(3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS);
+		}
+	}
+	else {
+		i = sc->sc_enaddr[5] & 0xf; /* last nibble */
+		dfut[i>>2] = MVXPE_DF(i&3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS);
+	}
 	MVXPE_WRITE_REGION(sc, MVXPE_DFUT(0), dfut, MVXPE_NDFUT);
 
 	/* Set Destination Address Filter Multicast Tables */

Index: src/sys/dev/marvell/if_mvxpevar.h
diff -u src/sys/dev/marvell/if_mvxpevar.h:1.2 src/sys/dev/marvell/if_mvxpevar.h:1.3
--- src/sys/dev/marvell/if_mvxpevar.h:1.2	Wed Jun  3 03:55:47 2015
+++ src/sys/dev/marvell/if_mvxpevar.h	Sat Feb 13 08:05:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpevar.h,v 1.2 2015/06/03 03:55:47 hsuenaga Exp $	*/
+/*	$NetBSD: if_mvxpevar.h,v 1.3 2016/02/13 08:05:06 hikaru Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -40,18 +40,17 @@
  * Default limit of queue length
  *
  * queue 0 is lowest priority and queue 7 is highest priority.
- * IP packet is received on queue 7 by default.
  *
  * XXX: packet classifier is not implement yet
  */
-#define MVXPE_RX_QUEUE_LIMIT_0	8
+#define MVXPE_RX_QUEUE_LIMIT_0	IFQ_MAXLEN
 #define MVXPE_RX_QUEUE_LIMIT_1	8
 #define MVXPE_RX_QUEUE_LIMIT_2	8
 #define 

CVS commit: src/sys/dev/marvell

2016-02-13 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 08:05:07 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c if_mvxpevar.h

Log Message:
Make all packets are enqueued into queue 0.
queue 7 is not default, it is caused by the filter tables.
The fields are including queue number, not bitfields.
So MVXPE_DF_QUEUE_ALL (b111) means queue 7.

And also, pass all unicast addresses if it is promisc mode.
MVXPE_PXC_UPM is working in almost cases,
but this change is needed for some cases; bridging frames through inter units,
using products have consecutive MAC addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/if_mvxpe.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/if_mvxpevar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-02-13 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 08:44:22 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Pass all unicast addresses if it is promisc mode.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-02-13 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 08:44:22 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Pass all unicast addresses if it is promisc mode.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/marvell/if_mvgbe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.43 src/sys/dev/marvell/if_mvgbe.c:1.44
--- src/sys/dev/marvell/if_mvgbe.c:1.43	Tue Feb  9 12:53:17 2016
+++ src/sys/dev/marvell/if_mvgbe.c	Sat Feb 13 08:44:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.43 2016/02/09 12:53:17 kiyohara Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.44 2016/02/13 08:44:22 hikaru Exp $	*/
 /*
  * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.43 2016/02/09 12:53:17 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.44 2016/02/13 08:44:22 hikaru Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -2238,8 +2238,19 @@ set:
 	MVGBE_WRITE(sc, MVGBE_PXC, pxc);
 
 	/* Set Destination Address Filter Unicast Table */
-	i = sc->sc_enaddr[5] & 0xf;		/* last nibble */
-	dfut[i>>2] = MVGBE_DF(i&3, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS);
+	if (ifp->if_flags & IFF_PROMISC) {
+		/* pass all unicast addresses */
+		for (i = 0; i < MVGBE_NDFUT; i++) {
+			dfut[i] =
+			MVGBE_DF(0, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS) |
+			MVGBE_DF(1, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS) |
+			MVGBE_DF(2, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS) |
+			MVGBE_DF(3, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS);
+		}
+	} else {
+		i = sc->sc_enaddr[5] & 0xf;		/* last nibble */
+		dfut[i>>2] = MVGBE_DF(i&3, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS);
+	}
 	MVGBE_WRITE_FILTER(sc, MVGBE_DFUT, dfut, MVGBE_NDFUT);
 
 	/* Set Destination Address Filter Multicast Tables */



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Fri Feb 12 09:24:15 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpereg.h

Log Message:
Fix the bitmask of MVXPE_PMACC0_FRAMESIZELIMIT. It did no harm.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/if_mvxpereg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpereg.h
diff -u src/sys/dev/marvell/if_mvxpereg.h:1.2 src/sys/dev/marvell/if_mvxpereg.h:1.3
--- src/sys/dev/marvell/if_mvxpereg.h:1.2	Wed Jun  3 03:55:47 2015
+++ src/sys/dev/marvell/if_mvxpereg.h	Fri Feb 12 09:24:15 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpereg.h,v 1.2 2015/06/03 03:55:47 hsuenaga Exp $	*/
+/*	$NetBSD: if_mvxpereg.h,v 1.3 2016/02/12 09:24:15 hikaru Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -608,7 +608,7 @@
 /* Port MAC Control 0 (MVXPE_PMACC0) */
 #define MVXPE_PMACC0_PORTEN		(1 << 0)
 #define MVXPE_PMACC0_PORTTYPE		(1 << 1)
-#define MVXPE_PMACC0_FRAMESIZELIMIT(x)	x) >> 1) & 0x7ffc) << 2)
+#define MVXPE_PMACC0_FRAMESIZELIMIT(x)	x) >> 1) & 0x1fff) << 2)
 #define MVXPE_PMACC0_MUSTSET		(1 << 15)
 
 /* Port MAC Control 1 (MVXPE_PMACC1) */



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Fri Feb 12 09:24:15 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpereg.h

Log Message:
Fix the bitmask of MVXPE_PMACC0_FRAMESIZELIMIT. It did no harm.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/if_mvxpereg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 05:47:39 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
Fix mitake, disable SERDES error interrupts again.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.6 src/sys/dev/marvell/if_mvxpe.c:1.7
--- src/sys/dev/marvell/if_mvxpe.c:1.6	Sat Feb 13 05:44:01 2016
+++ src/sys/dev/marvell/if_mvxpe.c	Sat Feb 13 05:47:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.6 2016/02/13 05:44:01 hikaru Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.7 2016/02/13 05:47:38 hikaru Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.6 2016/02/13 05:44:01 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.7 2016/02/13 05:47:38 hikaru Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1378,8 +1378,6 @@ mvxpe_enable_intr(struct mvxpe_softc *sc
 	reg |= MVXPE_PMI_RXCRCERROR;
 	reg |= MVXPE_PMI_RXLARGEPACKET;
 	reg |= MVXPE_PMI_TXUNDRN;
-	reg |= MVXPE_PMI_PRBSERROR;
-	reg |= MVXPE_PMI_SRSE;
 #if 0
 	/*
 	 * The device may raise false interrupts for SERDES even if the device



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 05:47:39 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
Fix mitake, disable SERDES error interrupts again.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 06:44:22 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
Fix typo in sysctls.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 06:44:22 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
Fix typo in sysctls.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.10 src/sys/dev/marvell/if_mvxpe.c:1.11
--- src/sys/dev/marvell/if_mvxpe.c:1.10	Sat Feb 13 06:33:21 2016
+++ src/sys/dev/marvell/if_mvxpe.c	Sat Feb 13 06:44:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.10 2016/02/13 06:33:21 hikaru Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.11 2016/02/13 06:44:22 hikaru Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.10 2016/02/13 06:33:21 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.11 2016/02/13 06:44:22 hikaru Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -3058,7 +3058,7 @@ sysctl_mvxpe_init(struct mvxpe_softc *sc
 	/* hw.mvxpe.debug */
 	if (sysctl_createv(>sc_mvxpe_clog, 0, NULL, ,
 	CTLFLAG_READWRITE, CTLTYPE_INT, "debug",
-	SYSCTL_DESCR("mvgbe device driver debug control"),
+	SYSCTL_DESCR("mvxpe device driver debug control"),
 	NULL, 0, _debug, 0,
 	CTL_HW, mvxpe_root_num, CTL_CREATE, CTL_EOL) != 0) {
 		aprint_normal_dev(sc->sc_dev, "couldn't create sysctl node\n");
@@ -3101,10 +3101,10 @@ sysctl_mvxpe_init(struct mvxpe_softc *sc
 #ifdef SYSCTL_INCLUDE_DESCR
 #define MVXPE_SYSCTL_DESCR(num) "configuration parameters for queue " # num
 		static const char *sysctl_queue_descrs[] = {
-			MVXPE_SYSCTL_DESC(0), MVXPE_SYSCTL_DESC(1),
-			MVXPE_SYSCTL_DESC(2), MVXPE_SYSCTL_DESC(3),
-			MVXPE_SYSCTL_DESC(4), MVXPE_SYSCTL_DESC(5),
-			MVXPE_SYSCTL_DESC(6), MVXPE_SYSCTL_DESC(7),
+			MVXPE_SYSCTL_DESCR(0), MVXPE_SYSCTL_DESCR(1),
+			MVXPE_SYSCTL_DESCR(2), MVXPE_SYSCTL_DESCR(3),
+			MVXPE_SYSCTL_DESCR(4), MVXPE_SYSCTL_DESCR(5),
+			MVXPE_SYSCTL_DESCR(6), MVXPE_SYSCTL_DESCR(7),
 		};
 #undef MVXPE_SYSCTL_DESCR
 #endif /* SYSCTL_INCLUDE_DESCR */
@@ -3181,7 +3181,7 @@ sysctl_mvxpe_init(struct mvxpe_softc *sc
 	/* hw.mvxpe.mvxpe[unit].clear_mib */
 	if (sysctl_createv(>sc_mvxpe_clog, 0, NULL, ,
 	CTLFLAG_READWRITE, CTLTYPE_INT, "clear_mib",
-	SYSCTL_DESCR("mvgbe device driver debug control"),
+	SYSCTL_DESCR("mvxpe device driver debug control"),
 	sysctl_clear_mib, 0, (void *)sc, 0,
 	CTL_HW, mvxpe_root_num, mvxpe_nodenum, CTL_CREATE,
 	CTL_EOL) != 0) {



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 06:02:31 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
Preserve rx csum bad flags.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 06:02:31 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
Preserve rx csum bad flags.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.7 src/sys/dev/marvell/if_mvxpe.c:1.8
--- src/sys/dev/marvell/if_mvxpe.c:1.7	Sat Feb 13 05:47:38 2016
+++ src/sys/dev/marvell/if_mvxpe.c	Sat Feb 13 06:02:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.7 2016/02/13 05:47:38 hikaru Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.8 2016/02/13 06:02:31 hikaru Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.7 2016/02/13 05:47:38 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.8 2016/02/13 06:02:31 hikaru Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -2620,8 +2620,9 @@ mvxpe_rx_set_csumflag(struct ifnet *ifp,
 
 	/* L3 */
 	if (r->status & MVXPE_RX_L3_IP) {
-		csum_flags |= M_CSUM_IPv4;
-		if ((r->status & MVXPE_RX_IP_HEADER_OK) == 0) {
+		csum_flags |= M_CSUM_IPv4 & ifp->if_csum_flags_rx;
+		if ((r->status & MVXPE_RX_IP_HEADER_OK) == 0 &&
+		(csum_flags & M_CSUM_IPv4)) {
 			csum_flags |= M_CSUM_IPv4_BAD;
 			goto finish;
 		}
@@ -2638,26 +2639,25 @@ mvxpe_rx_set_csumflag(struct ifnet *ifp,
 	switch (r->status & MVXPE_RX_L4_MASK) {
 	case MVXPE_RX_L4_TCP:
 		if (r->status & MVXPE_RX_L3_IP)
-			csum_flags |= M_CSUM_TCPv4;
+			csum_flags |= M_CSUM_TCPv4 & ifp->if_csum_flags_rx;
 		else
-			csum_flags |= M_CSUM_TCPv6;
-		if ((r->status & MVXPE_RX_L4_CHECKSUM_OK) == 0)
-			csum_flags |= M_CSUM_TCP_UDP_BAD;
+			csum_flags |= M_CSUM_TCPv6 & ifp->if_csum_flags_rx;
 		break;
 	case MVXPE_RX_L4_UDP:
 		if (r->status & MVXPE_RX_L3_IP)
-			csum_flags |= M_CSUM_UDPv4;
+			csum_flags |= M_CSUM_UDPv4 & ifp->if_csum_flags_rx;
 		else
-			csum_flags |= M_CSUM_UDPv6;
-		if ((r->status & MVXPE_RX_L4_CHECKSUM_OK) == 0)
-			csum_flags |= M_CSUM_TCP_UDP_BAD;
+			csum_flags |= M_CSUM_UDPv6 & ifp->if_csum_flags_rx;
 		break;
 	case MVXPE_RX_L4_OTH:
 	default:
 		break;
 	}
+	if ((r->status & MVXPE_RX_L4_CHECKSUM_OK) == 0 && (csum_flags &
+	(M_CSUM_TCPv4 | M_CSUM_TCPv6 | M_CSUM_UDPv4 | M_CSUM_UDPv6)))
+		csum_flags |= M_CSUM_TCP_UDP_BAD;
 finish:
-	m0->m_pkthdr.csum_flags |= (csum_flags & ifp->if_csum_flags_rx);
+	m0->m_pkthdr.csum_flags = csum_flags;
 }
 
 /*



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 06:33:21 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c if_mvxpereg.h

Log Message:
Count up if_{opackets,oerrors,ierrors,collisions}.
And also "MAC Transmit Error" is tx error, not rx.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/marvell/if_mvxpe.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/if_mvxpereg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.9 src/sys/dev/marvell/if_mvxpe.c:1.10
--- src/sys/dev/marvell/if_mvxpe.c:1.9	Sat Feb 13 06:12:46 2016
+++ src/sys/dev/marvell/if_mvxpe.c	Sat Feb 13 06:33:21 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.9 2016/02/13 06:12:46 hikaru Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.10 2016/02/13 06:33:21 hikaru Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.9 2016/02/13 06:12:46 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.10 2016/02/13 06:33:21 hikaru Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -189,67 +189,71 @@ STATIC struct mvxpe_mib_def {
 	int reg64;
 	const char *sysctl_name;
 	const char *desc;
+	int ext;
+#define MVXPE_MIBEXT_IF_OERRORS	1
+#define MVXPE_MIBEXT_IF_IERRORS	2
+#define MVXPE_MIBEXT_IF_COLLISIONS	3
 } mvxpe_mib_list[] = {
 	{MVXPE_MIB_RX_GOOD_OCT, 1,	"rx_good_oct",
-	"Good Octets Rx"},
+	"Good Octets Rx", 0},
 	{MVXPE_MIB_RX_BAD_OCT, 0,	"rx_bad_oct",
-	"Bad  Octets Rx"},
-	{MVXPE_MIB_RX_MAC_TRNS_ERR, 0,	"rx_mac_err",
-	"MAC Transmit Error"},
+	"Bad  Octets Rx", 0},
+	{MVXPE_MIB_TX_MAC_TRNS_ERR, 0,	"tx_mac_err",
+	"MAC Transmit Error", MVXPE_MIBEXT_IF_OERRORS},
 	{MVXPE_MIB_RX_GOOD_FRAME, 0,	"rx_good_frame",
-	"Good Frames Rx"},
+	"Good Frames Rx", 0},
 	{MVXPE_MIB_RX_BAD_FRAME, 0,	"rx_bad_frame",
-	"Bad Frames Rx"},
+	"Bad Frames Rx", 0},
 	{MVXPE_MIB_RX_BCAST_FRAME, 0,	"rx_bcast_frame",
-	"Broadcast Frames Rx"},
+	"Broadcast Frames Rx", 0},
 	{MVXPE_MIB_RX_MCAST_FRAME, 0,	"rx_mcast_frame",
-	"Multicast Frames Rx"},
+	"Multicast Frames Rx", 0},
 	{MVXPE_MIB_RX_FRAME64_OCT, 0,	"rx_frame_1_64",
-	"Frame Size1 -   64"},
+	"Frame Size1 -   64", 0},
 	{MVXPE_MIB_RX_FRAME127_OCT, 0,	"rx_frame_65_127",
-	"Frame Size   65 -  127"},
+	"Frame Size   65 -  127", 0},
 	{MVXPE_MIB_RX_FRAME255_OCT, 0,	"rx_frame_128_255",
-	"Frame Size  128 -  255"},
+	"Frame Size  128 -  255", 0},
 	{MVXPE_MIB_RX_FRAME511_OCT, 0,	"rx_frame_256_511",
 	"Frame Size  256 -  511"},
 	{MVXPE_MIB_RX_FRAME1023_OCT, 0,	"rx_frame_512_1023",
-	"Frame Size  512 - 1023"},
+	"Frame Size  512 - 1023", 0},
 	{MVXPE_MIB_RX_FRAMEMAX_OCT, 0,	"rx_fame_1024_max",
-	"Frame Size 1024 -  Max"},
+	"Frame Size 1024 -  Max", 0},
 	{MVXPE_MIB_TX_GOOD_OCT, 1,	"tx_good_oct",
-	"Good Octets Tx"},
+	"Good Octets Tx", 0},
 	{MVXPE_MIB_TX_GOOD_FRAME, 0,	"tx_good_frame",
-	"Good Frames Tx"},
+	"Good Frames Tx", 0},
 	{MVXPE_MIB_TX_EXCES_COL, 0,	"tx_exces_collision",
-	"Excessive Collision"},
+	"Excessive Collision", MVXPE_MIBEXT_IF_OERRORS},
 	{MVXPE_MIB_TX_MCAST_FRAME, 0,	"tx_mcast_frame",
 	"Multicast Frames Tx"},
 	{MVXPE_MIB_TX_BCAST_FRAME, 0,	"tx_bcast_frame",
 	"Broadcast Frames Tx"},
 	{MVXPE_MIB_TX_MAC_CTL_ERR, 0,	"tx_mac_err",
-	"Unknown MAC Control"},
+	"Unknown MAC Control", 0},
 	{MVXPE_MIB_FC_SENT, 0,		"fc_tx",
-	"Flow Control Tx"},
+	"Flow Control Tx", 0},
 	{MVXPE_MIB_FC_GOOD, 0,		"fc_rx_good",
-	"Good Flow Control Rx"},
+	"Good Flow Control Rx", 0},
 	{MVXPE_MIB_FC_BAD, 0,		"fc_rx_bad",
-	"Bad Flow Control Rx"},
+	"Bad Flow Control Rx", 0},
 	{MVXPE_MIB_PKT_UNDERSIZE, 0,	"pkt_undersize",
-	"Undersized Packets Rx"},
+	"Undersized Packets Rx", MVXPE_MIBEXT_IF_IERRORS},
 	{MVXPE_MIB_PKT_FRAGMENT, 0,	"pkt_fragment",
-	"Fragmented Packets Rx"},
+	"Fragmented Packets Rx", MVXPE_MIBEXT_IF_IERRORS},
 	{MVXPE_MIB_PKT_OVERSIZE, 0,	"pkt_oversize",
-	"Oversized Packets Rx"},
+	"Oversized Packets Rx", MVXPE_MIBEXT_IF_IERRORS},
 	{MVXPE_MIB_PKT_JABBER, 0,	"pkt_jabber",
-	"Jabber Packets Rx"},
+	"Jabber Packets Rx", MVXPE_MIBEXT_IF_IERRORS},
 	{MVXPE_MIB_MAC_RX_ERR, 0,	"mac_rx_err",
-	"MAC Rx Errors"},
+	"MAC Rx Errors", MVXPE_MIBEXT_IF_IERRORS},
 	{MVXPE_MIB_MAC_CRC_ERR, 0,	"mac_crc_err",
-	"MAC CRC Errors"},
+	"MAC CRC Errors", MVXPE_MIBEXT_IF_IERRORS},
 	{MVXPE_MIB_MAC_COL, 0,		"mac_collision",
-	"MAC Collision"},
+	"MAC Collision", MVXPE_MIBEXT_IF_COLLISIONS},
 	{MVXPE_MIB_MAC_LATE_COL, 0,	"mac_late_collision",
-	"MAC Late Collision"},
+	"MAC Late Collision", MVXPE_MIBEXT_IF_OERRORS},
 };
 
 /*
@@ -1690,6 +1694,7 @@ 

CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 06:33:21 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c if_mvxpereg.h

Log Message:
Count up if_{opackets,oerrors,ierrors,collisions}.
And also "MAC Transmit Error" is tx error, not rx.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/marvell/if_mvxpe.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/if_mvxpereg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 05:21:11 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
Correct bus_dmamap_sync operaion.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.4 src/sys/dev/marvell/if_mvxpe.c:1.5
--- src/sys/dev/marvell/if_mvxpe.c:1.4	Sat Feb 13 03:33:02 2016
+++ src/sys/dev/marvell/if_mvxpe.c	Sat Feb 13 05:21:11 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.4 2016/02/13 03:33:02 hikaru Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.5 2016/02/13 05:21:11 hikaru Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.4 2016/02/13 03:33:02 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.5 2016/02/13 05:21:11 hikaru Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -2130,7 +2130,7 @@ mvxpe_tx_queue(struct mvxpe_softc *sc, s
 	MVXPE_TX_MBUF(sc, q, tx->tx_cpu) = m;
 	bus_dmamap_sync(sc->sc_dmat,
 	MVXPE_TX_MAP(sc, q, tx->tx_cpu), 0, m->m_pkthdr.len,
-	BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREWRITE);
+	BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
 
 	/* load to tx descriptors */
 	start = tx->tx_cpu;



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 05:21:11 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
Correct bus_dmamap_sync operaion.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Sat Feb 13 06:12:46 UTC 2016

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
Style.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/marvell/if_mvxpe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.8 src/sys/dev/marvell/if_mvxpe.c:1.9
--- src/sys/dev/marvell/if_mvxpe.c:1.8	Sat Feb 13 06:02:31 2016
+++ src/sys/dev/marvell/if_mvxpe.c	Sat Feb 13 06:12:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.8 2016/02/13 06:02:31 hikaru Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.9 2016/02/13 06:12:46 hikaru Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.8 2016/02/13 06:02:31 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.9 2016/02/13 06:12:46 hikaru Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -2622,7 +2622,7 @@ mvxpe_rx_set_csumflag(struct ifnet *ifp,
 	if (r->status & MVXPE_RX_L3_IP) {
 		csum_flags |= M_CSUM_IPv4 & ifp->if_csum_flags_rx;
 		if ((r->status & MVXPE_RX_IP_HEADER_OK) == 0 &&
-		(csum_flags & M_CSUM_IPv4)) {
+		(csum_flags & M_CSUM_IPv4) != 0) {
 			csum_flags |= M_CSUM_IPv4_BAD;
 			goto finish;
 		}
@@ -2654,7 +2654,7 @@ mvxpe_rx_set_csumflag(struct ifnet *ifp,
 		break;
 	}
 	if ((r->status & MVXPE_RX_L4_CHECKSUM_OK) == 0 && (csum_flags &
-	(M_CSUM_TCPv4 | M_CSUM_TCPv6 | M_CSUM_UDPv4 | M_CSUM_UDPv6)))
+	(M_CSUM_TCPv4 | M_CSUM_TCPv6 | M_CSUM_UDPv4 | M_CSUM_UDPv6)) != 0)
 		csum_flags |= M_CSUM_TCP_UDP_BAD;
 finish:
 	m0->m_pkthdr.csum_flags = csum_flags;



  1   2   3   4   >