Deleted Added
full compact
if_em.c (169483) if_em.c (169589)
1/**************************************************************************
2
3Copyright (c) 2001-2007, Intel Corporation
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8

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

26SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30POSSIBILITY OF SUCH DAMAGE.
31
32***************************************************************************/
33
1/**************************************************************************
2
3Copyright (c) 2001-2007, Intel Corporation
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8

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

26SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30POSSIBILITY OF SUCH DAMAGE.
31
32***************************************************************************/
33
34/*$FreeBSD: head/sys/dev/em/if_em.c 169483 2007-05-11 21:36:08Z jfv $*/
34/*$FreeBSD: head/sys/dev/em/if_em.c 169589 2007-05-16 00:14:23Z jfv $*/
35
36#ifdef HAVE_KERNEL_OPTION_HEADERS
37#include "opt_device_polling.h"
38#endif
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/bus.h>

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

84/*********************************************************************
85 * Set this to one to display debug statistics
86 *********************************************************************/
87int em_display_debug_stats = 0;
88
89/*********************************************************************
90 * Driver version:
91 *********************************************************************/
35
36#ifdef HAVE_KERNEL_OPTION_HEADERS
37#include "opt_device_polling.h"
38#endif
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/bus.h>

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

84/*********************************************************************
85 * Set this to one to display debug statistics
86 *********************************************************************/
87int em_display_debug_stats = 0;
88
89/*********************************************************************
90 * Driver version:
91 *********************************************************************/
92char em_driver_version[] = "Version - 6.5.0";
92char em_driver_version[] = "Version - 6.5.2";
93
94
95/*********************************************************************
96 * PCI Device ID Table
97 *
98 * Used by probe to select devices to load on
99 * Last field stores an index into e1000_strings
100 * Last entry must be all 0s

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

1286
1287 if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING)
1288 em_enable_vlans(adapter);
1289
1290 /* Set hardware offload abilities */
1291 ifp->if_hwassist = 0;
1292 if (adapter->hw.mac.type >= e1000_82543) {
1293 if (ifp->if_capenable & IFCAP_TXCSUM)
93
94
95/*********************************************************************
96 * PCI Device ID Table
97 *
98 * Used by probe to select devices to load on
99 * Last field stores an index into e1000_strings
100 * Last entry must be all 0s

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

1286
1287 if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING)
1288 em_enable_vlans(adapter);
1289
1290 /* Set hardware offload abilities */
1291 ifp->if_hwassist = 0;
1292 if (adapter->hw.mac.type >= e1000_82543) {
1293 if (ifp->if_capenable & IFCAP_TXCSUM)
1294 ifp->if_hwassist |= EM_CHECKSUM_FEATURES;
1295 if (ifp->if_capenable & IFCAP_TSO)
1296 ifp->if_hwassist |= EM_TCPSEG_FEATURES;
1294 ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP);
1295 if (ifp->if_capenable & IFCAP_TSO4)
1296 ifp->if_hwassist |= CSUM_TSO;
1297 }
1298
1299 /* Configure for OS presence */
1300 em_init_manageability(adapter);
1301
1302 /* Prepare transmit descriptors and buffers */
1303 if (em_setup_transmit_structures(adapter)) {
1304 device_printf(dev, "Could not setup transmit structures\n");

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

1678 * This routine maps the mbufs to tx descriptors.
1679 *
1680 * return 0 on success, positive on failure
1681 **********************************************************************/
1682
1683static int
1684em_encap(struct adapter *adapter, struct mbuf **m_headp)
1685{
1297 }
1298
1299 /* Configure for OS presence */
1300 em_init_manageability(adapter);
1301
1302 /* Prepare transmit descriptors and buffers */
1303 if (em_setup_transmit_structures(adapter)) {
1304 device_printf(dev, "Could not setup transmit structures\n");

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

1678 * This routine maps the mbufs to tx descriptors.
1679 *
1680 * return 0 on success, positive on failure
1681 **********************************************************************/
1682
1683static int
1684em_encap(struct adapter *adapter, struct mbuf **m_headp)
1685{
1686 struct ifnet *ifp = adapter->ifp;
1687 bus_dma_segment_t segs[EM_MAX_SCATTER];
1688 bus_dmamap_t map;
1689 struct em_buffer *tx_buffer, *tx_buffer_mapped;
1690 struct e1000_tx_desc *ctxd = NULL;
1691 struct mbuf *m_head;
1692 uint32_t txd_upper, txd_lower, txd_used, txd_saved;
1693 int nsegs, i, j, first, last = 0;
1694 int error, do_tso, tso_desc = 0;

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

1799 if (nsegs > (adapter->num_tx_desc_avail - 2)) {
1800 adapter->no_tx_desc_avail2++;
1801 bus_dmamap_unload(adapter->txtag, map);
1802 return (ENOBUFS);
1803 }
1804 m_head = *m_headp;
1805
1806 /* Do hardware assists */
1686 bus_dma_segment_t segs[EM_MAX_SCATTER];
1687 bus_dmamap_t map;
1688 struct em_buffer *tx_buffer, *tx_buffer_mapped;
1689 struct e1000_tx_desc *ctxd = NULL;
1690 struct mbuf *m_head;
1691 uint32_t txd_upper, txd_lower, txd_used, txd_saved;
1692 int nsegs, i, j, first, last = 0;
1693 int error, do_tso, tso_desc = 0;

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

1798 if (nsegs > (adapter->num_tx_desc_avail - 2)) {
1799 adapter->no_tx_desc_avail2++;
1800 bus_dmamap_unload(adapter->txtag, map);
1801 return (ENOBUFS);
1802 }
1803 m_head = *m_headp;
1804
1805 /* Do hardware assists */
1807 if (ifp->if_hwassist > 0) {
1808 if (do_tso && em_tso_setup(adapter, m_head,
1809 &txd_upper, &txd_lower)) {
1810 /* we need to make a final sentinel transmit desc */
1811 tso_desc = TRUE;
1812 } else
1813 em_transmit_checksum_setup(adapter, m_head,
1814 &txd_upper, &txd_lower);
1815 }
1806 if (em_tso_setup(adapter, m_head, &txd_upper, &txd_lower))
1807 /* we need to make a final sentinel transmit desc */
1808 tso_desc = TRUE;
1809 else if (m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD)
1810 em_transmit_checksum_setup(adapter, m_head,
1811 &txd_upper, &txd_lower);
1816
1817 i = adapter->next_avail_tx_desc;
1818 if (adapter->pcix_82544)
1819 txd_saved = i;
1820
1821 /* Set up our transmit descriptors */
1822 for (j = 0; j < nsegs; j++) {
1823 bus_size_t seg_len;

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

1958}
1959
1960/*********************************************************************
1961 *
1962 * This routine maps the mbufs to Advanced TX descriptors.
1963 * used by the 82575 adapter. It also needs no workarounds.
1964 *
1965 **********************************************************************/
1812
1813 i = adapter->next_avail_tx_desc;
1814 if (adapter->pcix_82544)
1815 txd_saved = i;
1816
1817 /* Set up our transmit descriptors */
1818 for (j = 0; j < nsegs; j++) {
1819 bus_size_t seg_len;

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

1954}
1955
1956/*********************************************************************
1957 *
1958 * This routine maps the mbufs to Advanced TX descriptors.
1959 * used by the 82575 adapter. It also needs no workarounds.
1960 *
1961 **********************************************************************/
1966#define CSUM_OFFLOAD 7 /* Checksum bits */
1967
1968static int
1969em_adv_encap(struct adapter *adapter, struct mbuf **m_headp)
1970{
1971 bus_dma_segment_t segs[EM_MAX_SCATTER];
1972 bus_dmamap_t map;
1973 struct em_buffer *tx_buffer, *tx_buffer_mapped;
1974 union e1000_adv_tx_desc *txd = NULL;

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

2769
2770 ifp->if_capabilities = ifp->if_capenable = 0;
2771
2772 if (adapter->hw.mac.type >= e1000_82543) {
2773 ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
2774 ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
2775 }
2776
1962
1963static int
1964em_adv_encap(struct adapter *adapter, struct mbuf **m_headp)
1965{
1966 bus_dma_segment_t segs[EM_MAX_SCATTER];
1967 bus_dmamap_t map;
1968 struct em_buffer *tx_buffer, *tx_buffer_mapped;
1969 union e1000_adv_tx_desc *txd = NULL;

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

2764
2765 ifp->if_capabilities = ifp->if_capenable = 0;
2766
2767 if (adapter->hw.mac.type >= e1000_82543) {
2768 ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
2769 ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
2770 }
2771
2777 /* Enable TSO if available */
2778 if ((adapter->hw.mac.type > e1000_82544) &&
2779 (adapter->hw.mac.type != e1000_82547)) {
2772 /* Enable TSO for PCI Express adapters */
2773 if (adapter->hw.bus.type == e1000_bus_type_pci_express) {
2780 ifp->if_capabilities |= IFCAP_TSO4;
2781 ifp->if_capenable |= IFCAP_TSO4;
2782 }
2783
2784 /*
2785 * Tell the upper layer(s) we support long frames.
2786 */
2787 ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);

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

3365
3366 /*
3367 * XXX: This is not really correct as the stack would not have
3368 * set up all checksums.
3369 * XXX: Return FALSE is not sufficient as we may have to return
3370 * in true failure cases as well. Should do -1 (failure), 0 (no)
3371 * and 1 (success).
3372 */
2774 ifp->if_capabilities |= IFCAP_TSO4;
2775 ifp->if_capenable |= IFCAP_TSO4;
2776 }
2777
2778 /*
2779 * Tell the upper layer(s) we support long frames.
2780 */
2781 ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);

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

3359
3360 /*
3361 * XXX: This is not really correct as the stack would not have
3362 * set up all checksums.
3363 * XXX: Return FALSE is not sufficient as we may have to return
3364 * in true failure cases as well. Should do -1 (failure), 0 (no)
3365 * and 1 (success).
3366 */
3373 if (mp->m_pkthdr.len <= EM_TX_BUFFER_SIZE)
3374 return FALSE; /* 0 */
3367 if (((mp->m_pkthdr.csum_flags & CSUM_TSO) == 0) ||
3368 (mp->m_pkthdr.len <= EM_TX_BUFFER_SIZE))
3369 return FALSE;
3375
3376 /*
3377 * This function could/should be extended to support IP/IPv6
3378 * fragmentation as well. But as they say, one step at a time.
3379 */
3380
3381 /*
3382 * Determine where frame payload starts.

--- 1642 unchanged lines hidden ---
3370
3371 /*
3372 * This function could/should be extended to support IP/IPv6
3373 * fragmentation as well. But as they say, one step at a time.
3374 */
3375
3376 /*
3377 * Determine where frame payload starts.

--- 1642 unchanged lines hidden ---