Deleted Added
full compact
if_my.c (158651) if_my.c (159291)
1/*-
2 * Written by: yen_cw@myson.com.tw
3 * Copyright (c) 2002 Myson Technology Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * Myson fast ethernet PCI NIC driver, available at: http://www.myson.com.tw/
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Written by: yen_cw@myson.com.tw
3 * Copyright (c) 2002 Myson Technology Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * Myson fast ethernet PCI NIC driver, available at: http://www.myson.com.tw/
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/my/if_my.c 158651 2006-05-16 14:37:58Z phk $");
31__FBSDID("$FreeBSD: head/sys/dev/my/if_my.c 159291 2006-06-05 17:59:46Z brueffer $");
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/sockio.h>
36#include <sys/mbuf.h>
37#include <sys/malloc.h>
38#include <sys/kernel.h>
39#include <sys/socket.h>

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

880 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
881 ifp->if_mtu = ETHERMTU;
882 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
883 ifp->if_ioctl = my_ioctl;
884 ifp->if_start = my_start;
885 ifp->if_watchdog = my_watchdog;
886 ifp->if_init = my_init;
887 ifp->if_baudrate = 10000000;
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/sockio.h>
36#include <sys/mbuf.h>
37#include <sys/malloc.h>
38#include <sys/kernel.h>
39#include <sys/socket.h>

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

880 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
881 ifp->if_mtu = ETHERMTU;
882 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
883 ifp->if_ioctl = my_ioctl;
884 ifp->if_start = my_start;
885 ifp->if_watchdog = my_watchdog;
886 ifp->if_init = my_init;
887 ifp->if_baudrate = 10000000;
888 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
888 IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
889 ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
890 IFQ_SET_READY(&ifp->if_snd);
889
890 if (sc->my_info->my_did == MTD803ID)
891 sc->my_pinfo = my_phys;
892 else {
893 if (bootverbose)
894 device_printf(dev, "probing for a PHY\n");
895 MY_LOCK(sc);
896 for (i = MY_PHYADDR_MIN; i < MY_PHYADDR_MAX + 1; i++) {

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

1300 my_init_locked(sc);
1301 }
1302#endif
1303
1304 }
1305
1306 /* Re-enable interrupts. */
1307 CSR_WRITE_4(sc, MY_IMR, MY_INTRS);
891
892 if (sc->my_info->my_did == MTD803ID)
893 sc->my_pinfo = my_phys;
894 else {
895 if (bootverbose)
896 device_printf(dev, "probing for a PHY\n");
897 MY_LOCK(sc);
898 for (i = MY_PHYADDR_MIN; i < MY_PHYADDR_MAX + 1; i++) {

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

1302 my_init_locked(sc);
1303 }
1304#endif
1305
1306 }
1307
1308 /* Re-enable interrupts. */
1309 CSR_WRITE_4(sc, MY_IMR, MY_INTRS);
1308 if (ifp->if_snd.ifq_head != NULL)
1310 if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
1309 my_start_locked(ifp);
1310 MY_UNLOCK(sc);
1311 return;
1312}
1313
1314/*
1315 * Encapsulate an mbuf chain in a descriptor by coupling the mbuf data
1316 * pointers to the fragment pointers.

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

1400 * Check for an available queue slot. If there are none, punt.
1401 */
1402 if (sc->my_cdata.my_tx_free->my_mbuf != NULL) {
1403 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
1404 return;
1405 }
1406 start_tx = sc->my_cdata.my_tx_free;
1407 while (sc->my_cdata.my_tx_free->my_mbuf == NULL) {
1311 my_start_locked(ifp);
1312 MY_UNLOCK(sc);
1313 return;
1314}
1315
1316/*
1317 * Encapsulate an mbuf chain in a descriptor by coupling the mbuf data
1318 * pointers to the fragment pointers.

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

1402 * Check for an available queue slot. If there are none, punt.
1403 */
1404 if (sc->my_cdata.my_tx_free->my_mbuf != NULL) {
1405 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
1406 return;
1407 }
1408 start_tx = sc->my_cdata.my_tx_free;
1409 while (sc->my_cdata.my_tx_free->my_mbuf == NULL) {
1408 IF_DEQUEUE(&ifp->if_snd, m_head);
1410 IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
1409 if (m_head == NULL)
1410 break;
1411
1412 /* Pick a descriptor off the free list. */
1413 cur_tx = sc->my_cdata.my_tx_free;
1414 sc->my_cdata.my_tx_free = cur_tx->my_nextdesc;
1415
1416 /* Pack the data into the descriptor. */

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

1687 }
1688 ifp->if_oerrors++;
1689 if_printf(ifp, "watchdog timeout\n");
1690 if (!(my_phy_readreg(sc, PHY_BMSR) & PHY_BMSR_LINKSTAT))
1691 if_printf(ifp, "no carrier - transceiver cable problem?\n");
1692 my_stop(sc);
1693 my_reset(sc);
1694 my_init_locked(sc);
1411 if (m_head == NULL)
1412 break;
1413
1414 /* Pick a descriptor off the free list. */
1415 cur_tx = sc->my_cdata.my_tx_free;
1416 sc->my_cdata.my_tx_free = cur_tx->my_nextdesc;
1417
1418 /* Pack the data into the descriptor. */

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

1689 }
1690 ifp->if_oerrors++;
1691 if_printf(ifp, "watchdog timeout\n");
1692 if (!(my_phy_readreg(sc, PHY_BMSR) & PHY_BMSR_LINKSTAT))
1693 if_printf(ifp, "no carrier - transceiver cable problem?\n");
1694 my_stop(sc);
1695 my_reset(sc);
1696 my_init_locked(sc);
1695 if (ifp->if_snd.ifq_head != NULL)
1697 if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
1696 my_start_locked(ifp);
1697 MY_LOCK(sc);
1698 return;
1699}
1700
1701
1702/*
1703 * Stop the adapter and free any mbufs allocated to the RX and TX lists.

--- 57 unchanged lines hidden ---
1698 my_start_locked(ifp);
1699 MY_LOCK(sc);
1700 return;
1701}
1702
1703
1704/*
1705 * Stop the adapter and free any mbufs allocated to the RX and TX lists.

--- 57 unchanged lines hidden ---