Sat Jul 30 19:06:58 2011 UTC ()
Use new style BPF calls.


(rjs)
diff -r1.9 -r1.10 src/sys/dev/marvell/if_mvgbe.c

cvs diff -r1.9 -r1.10 src/sys/dev/marvell/if_mvgbe.c (expand / switch to unified diff)

--- src/sys/dev/marvell/if_mvgbe.c 2011/07/28 15:36:47 1.9
+++ src/sys/dev/marvell/if_mvgbe.c 2011/07/30 19:06:57 1.10
@@ -1,41 +1,41 @@ @@ -1,41 +1,41 @@
1/* $NetBSD: if_mvgbe.c,v 1.9 2011/07/28 15:36:47 matt Exp $ */ 1/* $NetBSD: if_mvgbe.c,v 1.10 2011/07/30 19:06:57 rjs Exp $ */
2/* 2/*
3 * Copyright (c) 2007, 2008 KIYOHARA Takashi 3 * Copyright (c) 2007, 2008 KIYOHARA Takashi
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE. 25 * POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27#include <sys/cdefs.h> 27#include <sys/cdefs.h>
28__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.9 2011/07/28 15:36:47 matt Exp $"); 28__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.10 2011/07/30 19:06:57 rjs Exp $");
29 29
30#include "rnd.h" 30#include "rnd.h"
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/bus.h> 33#include <sys/bus.h>
34#include <sys/device.h> 34#include <sys/device.h>
35#include <sys/endian.h> 35#include <sys/endian.h>
36#include <sys/errno.h> 36#include <sys/errno.h>
37#include <sys/kmem.h> 37#include <sys/kmem.h>
38#include <sys/mutex.h> 38#include <sys/mutex.h>
39#include <sys/sockio.h> 39#include <sys/sockio.h>
40 40
41#include <dev/marvell/marvellreg.h> 41#include <dev/marvell/marvellreg.h>
@@ -888,28 +888,27 @@ mvgbe_start(struct ifnet *ifp) @@ -888,28 +888,27 @@ mvgbe_start(struct ifnet *ifp)
888 if (mvgbe_encap(sc, m_head, &idx)) { 888 if (mvgbe_encap(sc, m_head, &idx)) {
889 ifp->if_flags |= IFF_OACTIVE; 889 ifp->if_flags |= IFF_OACTIVE;
890 break; 890 break;
891 } 891 }
892 892
893 /* now we are committed to transmit the packet */ 893 /* now we are committed to transmit the packet */
894 IFQ_DEQUEUE(&ifp->if_snd, m_head); 894 IFQ_DEQUEUE(&ifp->if_snd, m_head);
895 pkts++; 895 pkts++;
896 896
897 /* 897 /*
898 * If there's a BPF listener, bounce a copy of this frame 898 * If there's a BPF listener, bounce a copy of this frame
899 * to him. 899 * to him.
900 */ 900 */
901 if (ifp->if_bpf) 901 bpf_mtap(ifp, m_head);
902 bpf_ops->bpf_mtap(ifp->if_bpf, m_head); 
903 } 902 }
904 if (pkts == 0) 903 if (pkts == 0)
905 return; 904 return;
906 905
907 /* Transmit at Queue 0 */ 906 /* Transmit at Queue 0 */
908 if (idx != sc->sc_cdata.mvgbe_tx_prod) { 907 if (idx != sc->sc_cdata.mvgbe_tx_prod) {
909 sc->sc_cdata.mvgbe_tx_prod = idx; 908 sc->sc_cdata.mvgbe_tx_prod = idx;
910 MVGBE_WRITE(sc, MVGBE_TQC, MVGBE_TQC_ENQ); 909 MVGBE_WRITE(sc, MVGBE_TQC, MVGBE_TQC_ENQ);
911 910
912 /* 911 /*
913 * Set a timeout in case the chip goes out to lunch. 912 * Set a timeout in case the chip goes out to lunch.
914 */ 913 */
915 ifp->if_timer = 5; 914 ifp->if_timer = 5;
@@ -1734,28 +1733,27 @@ sw_csum: @@ -1734,28 +1733,27 @@ sw_csum:
1734 } 1733 }
1735 m = m0; 1734 m = m0;
1736 } else { 1735 } else {
1737 m->m_pkthdr.rcvif = ifp; 1736 m->m_pkthdr.rcvif = ifp;
1738 m->m_pkthdr.len = m->m_len = total_len; 1737 m->m_pkthdr.len = m->m_len = total_len;
1739 } 1738 }
1740 1739
1741 /* Skip on first 2byte (HW header) */ 1740 /* Skip on first 2byte (HW header) */
1742 m_adj(m, MVGBE_HWHEADER_SIZE); 1741 m_adj(m, MVGBE_HWHEADER_SIZE);
1743 m->m_flags |= M_HASFCS; 1742 m->m_flags |= M_HASFCS;
1744 1743
1745 ifp->if_ipackets++; 1744 ifp->if_ipackets++;
1746 1745
1747 if (ifp->if_bpf) 1746 bpf_mtap(ifp, m);
1748 bpf_ops->bpf_mtap(ifp->if_bpf, m); 
1749 1747
1750 /* pass it on. */ 1748 /* pass it on. */
1751 (*ifp->if_input)(ifp, m); 1749 (*ifp->if_input)(ifp, m);
1752 } 1750 }
1753} 1751}
1754 1752
1755static void 1753static void
1756mvgbe_txeof(struct mvgbe_softc *sc) 1754mvgbe_txeof(struct mvgbe_softc *sc)
1757{ 1755{
1758 struct mvgbe_chain_data *cdata = &sc->sc_cdata; 1756 struct mvgbe_chain_data *cdata = &sc->sc_cdata;
1759 struct mvgbe_tx_desc *cur_tx; 1757 struct mvgbe_tx_desc *cur_tx;
1760 struct ifnet *ifp = &sc->sc_ethercom.ec_if; 1758 struct ifnet *ifp = &sc->sc_ethercom.ec_if;
1761 struct mvgbe_txmap_entry *entry; 1759 struct mvgbe_txmap_entry *entry;