Deleted Added
full compact
octe.c (213346) octe.c (213762)
1/*-
2 * Copyright (c) 2010 Juli Mallett <jmallett@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2010 Juli Mallett <jmallett@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/mips/cavium/octe/octe.c 213346 2010-10-02 05:43:17Z jmallett $
26 * $FreeBSD: head/sys/mips/cavium/octe/octe.c 213762 2010-10-13 09:17:44Z jmallett $
27 */
28
29/*
30 * Cavium Octeon Ethernet devices.
31 *
32 * XXX This file should be moved to if_octe.c
33 * XXX The driver may have sufficient locking but we need locking to protect
34 * the interfaces presented here, right?

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

141 return (0);
142}
143
144static int
145octe_attach(device_t dev)
146{
147 struct ifnet *ifp;
148 cvm_oct_private_t *priv;
27 */
28
29/*
30 * Cavium Octeon Ethernet devices.
31 *
32 * XXX This file should be moved to if_octe.c
33 * XXX The driver may have sufficient locking but we need locking to protect
34 * the interfaces presented here, right?

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

141 return (0);
142}
143
144static int
145octe_attach(device_t dev)
146{
147 struct ifnet *ifp;
148 cvm_oct_private_t *priv;
149 device_t child;
149 unsigned qos;
150 int error;
151
152 priv = device_get_softc(dev);
153 ifp = priv->ifp;
154
155 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
156
157 if (priv->phy_id != -1) {
150 unsigned qos;
151 int error;
152
153 priv = device_get_softc(dev);
154 ifp = priv->ifp;
155
156 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
157
158 if (priv->phy_id != -1) {
158 error = mii_phy_probe(dev, &priv->miibus, octe_mii_medchange,
159 octe_mii_medstat);
160 if (error != 0) {
161 device_printf(dev, "missing phy %u\n", priv->phy_id);
159 if (priv->phy_device == NULL) {
160 error = mii_phy_probe(dev, &priv->miibus, octe_mii_medchange,
161 octe_mii_medstat);
162 if (error != 0)
163 device_printf(dev, "missing phy %u\n", priv->phy_id);
164 } else {
165 child = device_add_child(dev, priv->phy_device, -1);
166 if (child == NULL)
167 device_printf(dev, "missing phy %u device %s\n", priv->phy_id, priv->phy_device);
162 }
163 }
164
165 if (priv->miibus == NULL) {
166 ifmedia_init(&priv->media, 0, octe_medchange, octe_medstat);
167
168 ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL);
169 ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO);

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

197 ifp->if_hwassist = CSUM_TCP | CSUM_UDP;
198
199 OCTE_TX_LOCK(priv);
200 IFQ_SET_MAXLEN(&ifp->if_snd, MAX_OUT_QUEUE_DEPTH);
201 ifp->if_snd.ifq_drv_maxlen = MAX_OUT_QUEUE_DEPTH;
202 IFQ_SET_READY(&ifp->if_snd);
203 OCTE_TX_UNLOCK(priv);
204
168 }
169 }
170
171 if (priv->miibus == NULL) {
172 ifmedia_init(&priv->media, 0, octe_medchange, octe_medstat);
173
174 ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL);
175 ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO);

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

203 ifp->if_hwassist = CSUM_TCP | CSUM_UDP;
204
205 OCTE_TX_LOCK(priv);
206 IFQ_SET_MAXLEN(&ifp->if_snd, MAX_OUT_QUEUE_DEPTH);
207 ifp->if_snd.ifq_drv_maxlen = MAX_OUT_QUEUE_DEPTH;
208 IFQ_SET_READY(&ifp->if_snd);
209 OCTE_TX_UNLOCK(priv);
210
205 return (0);
211 return (bus_generic_attach(dev));
206}
207
208static int
209octe_detach(device_t dev)
210{
211 return (0);
212}
213

--- 303 unchanged lines hidden ---
212}
213
214static int
215octe_detach(device_t dev)
216{
217 return (0);
218}
219

--- 303 unchanged lines hidden ---