Deleted Added
full compact
if_nve.c (158735) if_nve.c (158773)
1/*-
2 * Copyright (c) 2005 by David E. O'Brien <obrien@FreeBSD.org>.
3 * Copyright (c) 2003,2004 by Quinton Dolan <q@onthenet.com.au>.
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:

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

67 * as recent versions of DragonFly.
68 *
69 * Written by Quinton Dolan <q@onthenet.com.au>
70 * Portions based on existing FreeBSD network drivers.
71 * NVIDIA API usage derived from distributed NVIDIA NVNET driver source files.
72 */
73
74#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2005 by David E. O'Brien <obrien@FreeBSD.org>.
3 * Copyright (c) 2003,2004 by Quinton Dolan <q@onthenet.com.au>.
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:

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

67 * as recent versions of DragonFly.
68 *
69 * Written by Quinton Dolan <q@onthenet.com.au>
70 * Portions based on existing FreeBSD network drivers.
71 * NVIDIA API usage derived from distributed NVIDIA NVNET driver source files.
72 */
73
74#include <sys/cdefs.h>
75__FBSDID("$FreeBSD: head/sys/dev/nve/if_nve.c 158735 2006-05-18 23:19:44Z jhb $");
75__FBSDID("$FreeBSD: head/sys/dev/nve/if_nve.c 158773 2006-05-20 21:08:09Z mlaier $");
76
77#include <sys/param.h>
78#include <sys/systm.h>
79#include <sys/sockio.h>
80#include <sys/mbuf.h>
81#include <sys/malloc.h>
82#include <sys/kernel.h>
83#include <sys/socket.h>

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

521 ifp->if_ioctl = nve_ioctl;
522 ifp->if_output = ether_output;
523 ifp->if_start = nve_ifstart;
524 ifp->if_watchdog = nve_watchdog;
525 ifp->if_timer = 0;
526 ifp->if_init = nve_init;
527 ifp->if_mtu = ETHERMTU;
528 ifp->if_baudrate = IF_Mbps(100);
76
77#include <sys/param.h>
78#include <sys/systm.h>
79#include <sys/sockio.h>
80#include <sys/mbuf.h>
81#include <sys/malloc.h>
82#include <sys/kernel.h>
83#include <sys/socket.h>

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

521 ifp->if_ioctl = nve_ioctl;
522 ifp->if_output = ether_output;
523 ifp->if_start = nve_ifstart;
524 ifp->if_watchdog = nve_watchdog;
525 ifp->if_timer = 0;
526 ifp->if_init = nve_init;
527 ifp->if_mtu = ETHERMTU;
528 ifp->if_baudrate = IF_Mbps(100);
529 ifp->if_snd.ifq_maxlen = TX_RING_SIZE - 1;
529 IFQ_SET_MAXLEN(&ifp->if_snd, TX_RING_SIZE - 1);
530 ifp->if_snd.ifq_drv_maxlen = TX_RING_SIZE - 1;
531 IFQ_SET_READY(&ifp->if_snd);
530 ifp->if_capabilities |= IFCAP_VLAN_MTU;
531
532 /* Attach to OS's managers. */
533 ether_ifattach(ifp, eaddr);
534
535 /* Activate our interrupt handler. - attach last to avoid lock */
536 error = bus_setup_intr(sc->dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
537 nve_intr, sc, &sc->sc_ih);

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

861 return;
862
863 /* Transmit queued packets until sent or TX ring is full */
864 while (sc->pending_txs < TX_RING_SIZE) {
865 desc = sc->tx_desc + sc->cur_tx;
866 buf = &desc->buf;
867
868 /* Get next packet to send. */
532 ifp->if_capabilities |= IFCAP_VLAN_MTU;
533
534 /* Attach to OS's managers. */
535 ether_ifattach(ifp, eaddr);
536
537 /* Activate our interrupt handler. - attach last to avoid lock */
538 error = bus_setup_intr(sc->dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
539 nve_intr, sc, &sc->sc_ih);

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

863 return;
864
865 /* Transmit queued packets until sent or TX ring is full */
866 while (sc->pending_txs < TX_RING_SIZE) {
867 desc = sc->tx_desc + sc->cur_tx;
868 buf = &desc->buf;
869
870 /* Get next packet to send. */
869 IF_DEQUEUE(&ifp->if_snd, m0);
871 IFQ_DRV_DEQUEUE(&ifp->if_snd, m0);
870
871 /* If nothing to send, return. */
872 if (m0 == NULL)
873 return;
874
875 /*
876 * On nForce4, the chip doesn't interrupt on transmit,
877 * so try to flush transmitted packets from the queue

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

940 break;
941
942 case ADAPTERERR_TRANSMIT_QUEUE_FULL:
943 /* The API TX queue is full - requeue the packet */
944 device_printf(sc->dev,
945 "nve_ifstart: transmit queue is full\n");
946 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
947 bus_dmamap_unload(sc->mtag, buf->map);
872
873 /* If nothing to send, return. */
874 if (m0 == NULL)
875 return;
876
877 /*
878 * On nForce4, the chip doesn't interrupt on transmit,
879 * so try to flush transmitted packets from the queue

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

942 break;
943
944 case ADAPTERERR_TRANSMIT_QUEUE_FULL:
945 /* The API TX queue is full - requeue the packet */
946 device_printf(sc->dev,
947 "nve_ifstart: transmit queue is full\n");
948 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
949 bus_dmamap_unload(sc->mtag, buf->map);
948 IF_PREPEND(&ifp->if_snd, buf->mbuf);
950 IFQ_DRV_PREPEND(&ifp->if_snd, buf->mbuf);
949 buf->mbuf = NULL;
950 return;
951
952 default:
953 /* The API failed to queue/send the packet so dump it */
954 device_printf(sc->dev, "nve_ifstart: transmit error\n");
955 bus_dmamap_unload(sc->mtag, buf->map);
956 m_freem(buf->mbuf);

--- 819 unchanged lines hidden ---
951 buf->mbuf = NULL;
952 return;
953
954 default:
955 /* The API failed to queue/send the packet so dump it */
956 device_printf(sc->dev, "nve_ifstart: transmit error\n");
957 bus_dmamap_unload(sc->mtag, buf->map);
958 m_freem(buf->mbuf);

--- 819 unchanged lines hidden ---