Lines 32-37
Link Here
|
32 |
******************************************************************************/ |
32 |
******************************************************************************/ |
33 |
/*$FreeBSD$*/ |
33 |
/*$FreeBSD$*/ |
34 |
|
34 |
|
|
|
35 |
|
35 |
#ifdef HAVE_KERNEL_OPTION_HEADERS |
36 |
#ifdef HAVE_KERNEL_OPTION_HEADERS |
36 |
#include "opt_inet.h" |
37 |
#include "opt_inet.h" |
37 |
#include "opt_inet6.h" |
38 |
#include "opt_inet6.h" |
Lines 47-53
Link Here
|
47 |
/********************************************************************* |
48 |
/********************************************************************* |
48 |
* Driver version |
49 |
* Driver version |
49 |
*********************************************************************/ |
50 |
*********************************************************************/ |
50 |
char ixgbe_driver_version[] = "2.4.8"; |
51 |
char ixgbe_driver_version[] = "2.4.10"; |
51 |
|
52 |
|
52 |
/********************************************************************* |
53 |
/********************************************************************* |
53 |
* PCI Device ID Table |
54 |
* PCI Device ID Table |
Lines 83-88
Link Here
|
83 |
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF2, 0, 0, 0}, |
84 |
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF2, 0, 0, 0}, |
84 |
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0}, |
85 |
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0}, |
85 |
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599EN_SFP, 0, 0, 0}, |
86 |
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599EN_SFP, 0, 0, 0}, |
|
|
87 |
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF_QP, 0, 0, 0}, |
86 |
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T1, 0, 0, 0}, |
88 |
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T1, 0, 0, 0}, |
87 |
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T, 0, 0, 0}, |
89 |
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T, 0, 0, 0}, |
88 |
/* required last entry */ |
90 |
/* required last entry */ |
Lines 104-116
Link Here
|
104 |
static int ixgbe_attach(device_t); |
106 |
static int ixgbe_attach(device_t); |
105 |
static int ixgbe_detach(device_t); |
107 |
static int ixgbe_detach(device_t); |
106 |
static int ixgbe_shutdown(device_t); |
108 |
static int ixgbe_shutdown(device_t); |
107 |
static void ixgbe_start(struct ifnet *); |
|
|
108 |
static void ixgbe_start_locked(struct tx_ring *, struct ifnet *); |
109 |
#if __FreeBSD_version >= 800000 |
109 |
#if __FreeBSD_version >= 800000 |
110 |
static int ixgbe_mq_start(struct ifnet *, struct mbuf *); |
110 |
static int ixgbe_mq_start(struct ifnet *, struct mbuf *); |
111 |
static int ixgbe_mq_start_locked(struct ifnet *, |
111 |
static int ixgbe_mq_start_locked(struct ifnet *, |
112 |
struct tx_ring *, struct mbuf *); |
112 |
struct tx_ring *, struct mbuf *); |
113 |
static void ixgbe_qflush(struct ifnet *); |
113 |
static void ixgbe_qflush(struct ifnet *); |
|
|
114 |
static void ixgbe_deferred_mq_start(void *, int); |
115 |
#else |
116 |
static void ixgbe_start(struct ifnet *); |
117 |
static void ixgbe_start_locked(struct tx_ring *, struct ifnet *); |
114 |
#endif |
118 |
#endif |
115 |
static int ixgbe_ioctl(struct ifnet *, u_long, caddr_t); |
119 |
static int ixgbe_ioctl(struct ifnet *, u_long, caddr_t); |
116 |
static void ixgbe_init(void *); |
120 |
static void ixgbe_init(void *); |
Lines 164-170
Link Here
|
164 |
static void ixgbe_add_rx_process_limit(struct adapter *, const char *, |
168 |
static void ixgbe_add_rx_process_limit(struct adapter *, const char *, |
165 |
const char *, int *, int); |
169 |
const char *, int *, int); |
166 |
static bool ixgbe_tx_ctx_setup(struct tx_ring *, struct mbuf *); |
170 |
static bool ixgbe_tx_ctx_setup(struct tx_ring *, struct mbuf *); |
167 |
static bool ixgbe_tso_setup(struct tx_ring *, struct mbuf *, u32 *); |
171 |
static bool ixgbe_tso_setup(struct tx_ring *, struct mbuf *, u32 *, u32 *); |
168 |
static void ixgbe_set_ivar(struct adapter *, u8, u8, s8); |
172 |
static void ixgbe_set_ivar(struct adapter *, u8, u8, s8); |
169 |
static void ixgbe_configure_ivars(struct adapter *); |
173 |
static void ixgbe_configure_ivars(struct adapter *); |
170 |
static u8 * ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *); |
174 |
static u8 * ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *); |
Lines 536-542
Link Here
|
536 |
case IXGBE_ERR_SFP_NOT_SUPPORTED: |
540 |
case IXGBE_ERR_SFP_NOT_SUPPORTED: |
537 |
device_printf(dev,"Unsupported SFP+ Module\n"); |
541 |
device_printf(dev,"Unsupported SFP+ Module\n"); |
538 |
error = EIO; |
542 |
error = EIO; |
539 |
device_printf(dev,"Hardware Initialization Failure\n"); |
|
|
540 |
goto err_late; |
543 |
goto err_late; |
541 |
case IXGBE_ERR_SFP_NOT_PRESENT: |
544 |
case IXGBE_ERR_SFP_NOT_PRESENT: |
542 |
device_printf(dev,"No SFP+ Module found\n"); |
545 |
device_printf(dev,"No SFP+ Module found\n"); |
Lines 631-636
Link Here
|
631 |
{ |
634 |
{ |
632 |
struct adapter *adapter = device_get_softc(dev); |
635 |
struct adapter *adapter = device_get_softc(dev); |
633 |
struct ix_queue *que = adapter->queues; |
636 |
struct ix_queue *que = adapter->queues; |
|
|
637 |
struct tx_ring *txr = adapter->tx_rings; |
634 |
u32 ctrl_ext; |
638 |
u32 ctrl_ext; |
635 |
|
639 |
|
636 |
INIT_DEBUGOUT("ixgbe_detach: begin"); |
640 |
INIT_DEBUGOUT("ixgbe_detach: begin"); |
Lines 645-652
Link Here
|
645 |
ixgbe_stop(adapter); |
649 |
ixgbe_stop(adapter); |
646 |
IXGBE_CORE_UNLOCK(adapter); |
650 |
IXGBE_CORE_UNLOCK(adapter); |
647 |
|
651 |
|
648 |
for (int i = 0; i < adapter->num_queues; i++, que++) { |
652 |
for (int i = 0; i < adapter->num_queues; i++, que++, txr++) { |
649 |
if (que->tq) { |
653 |
if (que->tq) { |
|
|
654 |
#if __FreeBSD_version >= 800000 |
655 |
taskqueue_drain(que->tq, &txr->txq_task); |
656 |
#endif |
650 |
taskqueue_drain(que->tq, &que->que_task); |
657 |
taskqueue_drain(que->tq, &que->que_task); |
651 |
taskqueue_free(que->tq); |
658 |
taskqueue_free(que->tq); |
652 |
} |
659 |
} |
Lines 708-713
Link Here
|
708 |
} |
715 |
} |
709 |
|
716 |
|
710 |
|
717 |
|
|
|
718 |
#if __FreeBSD_version < 800000 |
711 |
/********************************************************************* |
719 |
/********************************************************************* |
712 |
* Transmit entry point |
720 |
* Transmit entry point |
713 |
* |
721 |
* |
Lines 726-740
Link Here
|
726 |
|
734 |
|
727 |
IXGBE_TX_LOCK_ASSERT(txr); |
735 |
IXGBE_TX_LOCK_ASSERT(txr); |
728 |
|
736 |
|
729 |
if ((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != |
737 |
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) |
730 |
IFF_DRV_RUNNING) |
|
|
731 |
return; |
738 |
return; |
732 |
if (!adapter->link_active) |
739 |
if (!adapter->link_active) |
733 |
return; |
740 |
return; |
734 |
|
741 |
|
735 |
while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { |
742 |
while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { |
736 |
if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE) { |
743 |
if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE) |
737 |
txr->queue_status |= IXGBE_QUEUE_DEPLETED; |
|
|
738 |
break; |
744 |
break; |
739 |
} |
745 |
} |
740 |
|
746 |
|
Lines 745-752
Link Here
|
745 |
if (ixgbe_xmit(txr, &m_head)) { |
751 |
if (ixgbe_xmit(txr, &m_head)) { |
746 |
if (m_head != NULL) |
752 |
if (m_head != NULL) |
747 |
IFQ_DRV_PREPEND(&ifp->if_snd, m_head); |
753 |
IFQ_DRV_PREPEND(&ifp->if_snd, m_head); |
748 |
if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE) |
|
|
749 |
txr->queue_status |= IXGBE_QUEUE_DEPLETED; |
750 |
break; |
754 |
break; |
751 |
} |
755 |
} |
752 |
/* Send a copy of the frame to the BPF listener */ |
756 |
/* Send a copy of the frame to the BPF listener */ |
Lines 779-785
Link Here
|
779 |
return; |
783 |
return; |
780 |
} |
784 |
} |
781 |
|
785 |
|
782 |
#if __FreeBSD_version >= 800000 |
786 |
#else /* __FreeBSD_version >= 800000 */ |
783 |
/* |
787 |
/* |
784 |
** Multiqueue Transmit driver |
788 |
** Multiqueue Transmit driver |
785 |
** |
789 |
** |
Lines 795-813
Link Here
|
795 |
/* Which queue to use */ |
799 |
/* Which queue to use */ |
796 |
if ((m->m_flags & M_FLOWID) != 0) |
800 |
if ((m->m_flags & M_FLOWID) != 0) |
797 |
i = m->m_pkthdr.flowid % adapter->num_queues; |
801 |
i = m->m_pkthdr.flowid % adapter->num_queues; |
798 |
else |
|
|
799 |
i = curcpu % adapter->num_queues; |
800 |
|
802 |
|
801 |
txr = &adapter->tx_rings[i]; |
803 |
txr = &adapter->tx_rings[i]; |
802 |
que = &adapter->queues[i]; |
804 |
que = &adapter->queues[i]; |
803 |
|
805 |
|
804 |
if (((txr->queue_status & IXGBE_QUEUE_DEPLETED) == 0) && |
806 |
if (IXGBE_TX_TRYLOCK(txr)) { |
805 |
IXGBE_TX_TRYLOCK(txr)) { |
|
|
806 |
err = ixgbe_mq_start_locked(ifp, txr, m); |
807 |
err = ixgbe_mq_start_locked(ifp, txr, m); |
807 |
IXGBE_TX_UNLOCK(txr); |
808 |
IXGBE_TX_UNLOCK(txr); |
808 |
} else { |
809 |
} else { |
809 |
err = drbr_enqueue(ifp, txr->br, m); |
810 |
err = drbr_enqueue(ifp, txr->br, m); |
810 |
taskqueue_enqueue(que->tq, &que->que_task); |
811 |
taskqueue_enqueue(que->tq, &txr->txq_task); |
811 |
} |
812 |
} |
812 |
|
813 |
|
813 |
return (err); |
814 |
return (err); |
Lines 821-827
Link Here
|
821 |
int enqueued, err = 0; |
822 |
int enqueued, err = 0; |
822 |
|
823 |
|
823 |
if (((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) || |
824 |
if (((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) || |
824 |
(txr->queue_status == IXGBE_QUEUE_DEPLETED) || |
|
|
825 |
adapter->link_active == 0) { |
825 |
adapter->link_active == 0) { |
826 |
if (m != NULL) |
826 |
if (m != NULL) |
827 |
err = drbr_enqueue(ifp, txr->br, m); |
827 |
err = drbr_enqueue(ifp, txr->br, m); |
Lines 851-862
Link Here
|
851 |
ETHER_BPF_MTAP(ifp, next); |
851 |
ETHER_BPF_MTAP(ifp, next); |
852 |
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) |
852 |
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) |
853 |
break; |
853 |
break; |
854 |
if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD) |
|
|
855 |
ixgbe_txeof(txr); |
856 |
if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD) { |
857 |
txr->queue_status |= IXGBE_QUEUE_DEPLETED; |
858 |
break; |
859 |
} |
860 |
next = drbr_dequeue(ifp, txr->br); |
854 |
next = drbr_dequeue(ifp, txr->br); |
861 |
} |
855 |
} |
862 |
|
856 |
|
Lines 873-878
Link Here
|
873 |
} |
867 |
} |
874 |
|
868 |
|
875 |
/* |
869 |
/* |
|
|
870 |
* Called from a taskqueue to drain queued tx packets |
871 |
*/ |
872 |
static void |
873 |
ixgbe_deferred_mq_start(void *arg, int pending) |
874 |
{ |
875 |
struct tx_ring *txr = arg; |
876 |
struct adapter *adapter = txr->adapter; |
877 |
struct ifnet *ifp = adapter->ifp; |
878 |
|
879 |
IXGBE_TX_LOCK(txr); |
880 |
if (!drbr_empty(ifp, txr->br)) |
881 |
ixgbe_mq_start_locked(ifp, txr, NULL); |
882 |
IXGBE_TX_UNLOCK(txr); |
883 |
} |
884 |
|
885 |
/* |
876 |
** Flush all ring buffers |
886 |
** Flush all ring buffers |
877 |
*/ |
887 |
*/ |
878 |
static void |
888 |
static void |
Lines 992-997
Link Here
|
992 |
ifp->if_capenable ^= IFCAP_HWCSUM; |
1002 |
ifp->if_capenable ^= IFCAP_HWCSUM; |
993 |
if (mask & IFCAP_TSO4) |
1003 |
if (mask & IFCAP_TSO4) |
994 |
ifp->if_capenable ^= IFCAP_TSO4; |
1004 |
ifp->if_capenable ^= IFCAP_TSO4; |
|
|
1005 |
#if __FreeBSD_version >= 900505 |
1006 |
if (mask & IFCAP_TSO6) |
1007 |
ifp->if_capenable ^= IFCAP_TSO6; |
1008 |
#endif |
995 |
if (mask & IFCAP_LRO) |
1009 |
if (mask & IFCAP_LRO) |
996 |
ifp->if_capenable ^= IFCAP_LRO; |
1010 |
ifp->if_capenable ^= IFCAP_LRO; |
997 |
if (mask & IFCAP_VLAN_HWTAGGING) |
1011 |
if (mask & IFCAP_VLAN_HWTAGGING) |
Lines 1056-1062
Link Here
|
1056 |
|
1070 |
|
1057 |
/* Set the various hardware offload abilities */ |
1071 |
/* Set the various hardware offload abilities */ |
1058 |
ifp->if_hwassist = 0; |
1072 |
ifp->if_hwassist = 0; |
1059 |
if (ifp->if_capenable & IFCAP_TSO4) |
1073 |
if (ifp->if_capenable & IFCAP_TSO) |
1060 |
ifp->if_hwassist |= CSUM_TSO; |
1074 |
ifp->if_hwassist |= CSUM_TSO; |
1061 |
if (ifp->if_capenable & IFCAP_TXCSUM) { |
1075 |
if (ifp->if_capenable & IFCAP_TXCSUM) { |
1062 |
ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); |
1076 |
ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); |
Lines 1145-1151
Link Here
|
1145 |
* from the Intel linux driver 3.8.21. |
1159 |
* from the Intel linux driver 3.8.21. |
1146 |
* Prefetching enables tx line rate even with 1 queue. |
1160 |
* Prefetching enables tx line rate even with 1 queue. |
1147 |
*/ |
1161 |
*/ |
1148 |
txdctl |= (16 << 0) | (1 << 8); |
1162 |
txdctl |= (32 << 0) | (1 << 8); |
1149 |
IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(i), txdctl); |
1163 |
IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(i), txdctl); |
1150 |
} |
1164 |
} |
1151 |
|
1165 |
|
Lines 1390-1396
Link Here
|
1390 |
ixgbe_start_locked(txr, ifp); |
1404 |
ixgbe_start_locked(txr, ifp); |
1391 |
#endif |
1405 |
#endif |
1392 |
IXGBE_TX_UNLOCK(txr); |
1406 |
IXGBE_TX_UNLOCK(txr); |
1393 |
if (more || (ifp->if_drv_flags & IFF_DRV_OACTIVE)) { |
1407 |
if (more) { |
1394 |
taskqueue_enqueue(que->tq, &que->que_task); |
1408 |
taskqueue_enqueue(que->tq, &que->que_task); |
1395 |
return; |
1409 |
return; |
1396 |
} |
1410 |
} |
Lines 1648-1654
Link Here
|
1648 |
ifmr->ifm_active |= IFM_100_TX | IFM_FDX; |
1662 |
ifmr->ifm_active |= IFM_100_TX | IFM_FDX; |
1649 |
break; |
1663 |
break; |
1650 |
case IXGBE_LINK_SPEED_1GB_FULL: |
1664 |
case IXGBE_LINK_SPEED_1GB_FULL: |
1651 |
ifmr->ifm_active |= IFM_1000_T | IFM_FDX; |
1665 |
ifmr->ifm_active |= adapter->optics | IFM_FDX; |
1652 |
break; |
1666 |
break; |
1653 |
case IXGBE_LINK_SPEED_10GB_FULL: |
1667 |
case IXGBE_LINK_SPEED_10GB_FULL: |
1654 |
ifmr->ifm_active |= adapter->optics | IFM_FDX; |
1668 |
ifmr->ifm_active |= adapter->optics | IFM_FDX; |
Lines 1776-1785
Link Here
|
1776 |
} |
1790 |
} |
1777 |
|
1791 |
|
1778 |
/* Make certain there are enough descriptors */ |
1792 |
/* Make certain there are enough descriptors */ |
1779 |
if (nsegs > txr->tx_avail - 2) { |
1793 |
if ((nsegs + 1) > txr->tx_avail - 2) { |
1780 |
txr->no_desc_avail++; |
1794 |
txr->no_desc_avail++; |
1781 |
error = ENOBUFS; |
1795 |
bus_dmamap_unload(txr->txtag, map); |
1782 |
goto xmit_fail; |
1796 |
return (ENOBUFS); |
1783 |
} |
1797 |
} |
1784 |
m_head = *m_headp; |
1798 |
m_head = *m_headp; |
1785 |
|
1799 |
|
Lines 1789-1797
Link Here
|
1789 |
** a packet. |
1803 |
** a packet. |
1790 |
*/ |
1804 |
*/ |
1791 |
if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { |
1805 |
if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { |
1792 |
if (ixgbe_tso_setup(txr, m_head, &paylen)) { |
1806 |
if (ixgbe_tso_setup(txr, m_head, &paylen, &olinfo_status)) { |
1793 |
cmd_type_len |= IXGBE_ADVTXD_DCMD_TSE; |
1807 |
cmd_type_len |= IXGBE_ADVTXD_DCMD_TSE; |
1794 |
olinfo_status |= IXGBE_TXD_POPTS_IXSM << 8; |
|
|
1795 |
olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; |
1808 |
olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; |
1796 |
olinfo_status |= paylen << IXGBE_ADVTXD_PAYLEN_SHIFT; |
1809 |
olinfo_status |= paylen << IXGBE_ADVTXD_PAYLEN_SHIFT; |
1797 |
++adapter->tso_tx; |
1810 |
++adapter->tso_tx; |
Lines 1870-1879
Link Here
|
1870 |
|
1883 |
|
1871 |
return (0); |
1884 |
return (0); |
1872 |
|
1885 |
|
1873 |
xmit_fail: |
|
|
1874 |
bus_dmamap_unload(txr->txtag, txbuf->map); |
1875 |
return (error); |
1876 |
|
1877 |
} |
1886 |
} |
1878 |
|
1887 |
|
1879 |
static void |
1888 |
static void |
Lines 1992-2004
Link Here
|
1992 |
{ |
2001 |
{ |
1993 |
struct adapter *adapter = arg; |
2002 |
struct adapter *adapter = arg; |
1994 |
device_t dev = adapter->dev; |
2003 |
device_t dev = adapter->dev; |
1995 |
struct ifnet *ifp = adapter->ifp; |
|
|
1996 |
struct ix_queue *que = adapter->queues; |
2004 |
struct ix_queue *que = adapter->queues; |
1997 |
struct tx_ring *txr = adapter->tx_rings; |
2005 |
struct tx_ring *txr = adapter->tx_rings; |
1998 |
int hung, busy, paused; |
2006 |
int hung = 0, paused = 0; |
1999 |
|
2007 |
|
2000 |
mtx_assert(&adapter->core_mtx, MA_OWNED); |
2008 |
mtx_assert(&adapter->core_mtx, MA_OWNED); |
2001 |
hung = busy = paused = 0; |
|
|
2002 |
|
2009 |
|
2003 |
/* Check for pluggable optics */ |
2010 |
/* Check for pluggable optics */ |
2004 |
if (adapter->sfp_probe) |
2011 |
if (adapter->sfp_probe) |
Lines 2017-2043
Link Here
|
2017 |
|
2024 |
|
2018 |
/* |
2025 |
/* |
2019 |
** Check the TX queues status |
2026 |
** Check the TX queues status |
2020 |
** - central locked handling of OACTIVE |
|
|
2021 |
** - watchdog only if all queues show hung |
2027 |
** - watchdog only if all queues show hung |
2022 |
*/ |
2028 |
*/ |
2023 |
for (int i = 0; i < adapter->num_queues; i++, que++, txr++) { |
2029 |
for (int i = 0; i < adapter->num_queues; i++, que++, txr++) { |
2024 |
if ((txr->queue_status & IXGBE_QUEUE_HUNG) && |
2030 |
if ((txr->queue_status & IXGBE_QUEUE_HUNG) && |
2025 |
(paused == 0)) |
2031 |
(paused == 0)) |
2026 |
++hung; |
2032 |
++hung; |
2027 |
if (txr->queue_status & IXGBE_QUEUE_DEPLETED) |
|
|
2028 |
++busy; |
2029 |
if ((txr->queue_status & IXGBE_QUEUE_IDLE) == 0) |
2033 |
if ((txr->queue_status & IXGBE_QUEUE_IDLE) == 0) |
2030 |
taskqueue_enqueue(que->tq, &que->que_task); |
2034 |
taskqueue_enqueue(que->tq, &que->que_task); |
2031 |
} |
2035 |
} |
2032 |
/* Only truely watchdog if all queues show hung */ |
2036 |
/* Only truely watchdog if all queues show hung */ |
2033 |
if (hung == adapter->num_queues) |
2037 |
if (hung == adapter->num_queues) |
2034 |
goto watchdog; |
2038 |
goto watchdog; |
2035 |
/* Only turn off the stack flow when ALL are depleted */ |
|
|
2036 |
if (busy == adapter->num_queues) |
2037 |
ifp->if_drv_flags |= IFF_DRV_OACTIVE; |
2038 |
else if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) && |
2039 |
(busy < adapter->num_queues)) |
2040 |
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
2041 |
|
2039 |
|
2042 |
out: |
2040 |
out: |
2043 |
ixgbe_rearm_queues(adapter, adapter->que_mask); |
2041 |
ixgbe_rearm_queues(adapter, adapter->que_mask); |
Lines 2066-2072
Link Here
|
2066 |
ixgbe_update_link_status(struct adapter *adapter) |
2064 |
ixgbe_update_link_status(struct adapter *adapter) |
2067 |
{ |
2065 |
{ |
2068 |
struct ifnet *ifp = adapter->ifp; |
2066 |
struct ifnet *ifp = adapter->ifp; |
2069 |
struct tx_ring *txr = adapter->tx_rings; |
|
|
2070 |
device_t dev = adapter->dev; |
2067 |
device_t dev = adapter->dev; |
2071 |
|
2068 |
|
2072 |
|
2069 |
|
Lines 2087-2095
Link Here
|
2087 |
device_printf(dev,"Link is Down\n"); |
2084 |
device_printf(dev,"Link is Down\n"); |
2088 |
if_link_state_change(ifp, LINK_STATE_DOWN); |
2085 |
if_link_state_change(ifp, LINK_STATE_DOWN); |
2089 |
adapter->link_active = FALSE; |
2086 |
adapter->link_active = FALSE; |
2090 |
for (int i = 0; i < adapter->num_queues; |
|
|
2091 |
i++, txr++) |
2092 |
txr->queue_status = IXGBE_QUEUE_IDLE; |
2093 |
} |
2087 |
} |
2094 |
} |
2088 |
} |
2095 |
|
2089 |
|
Lines 2192-2197
Link Here
|
2192 |
return; |
2186 |
return; |
2193 |
} |
2187 |
} |
2194 |
|
2188 |
|
|
|
2189 |
if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_SX) { |
2190 |
adapter->optics = IFM_1000_SX; |
2191 |
return; |
2192 |
} |
2193 |
|
2195 |
if (layer & (IXGBE_PHYSICAL_LAYER_10GBASE_LR | |
2194 |
if (layer & (IXGBE_PHYSICAL_LAYER_10GBASE_LR | |
2196 |
IXGBE_PHYSICAL_LAYER_10GBASE_LRM)) { |
2195 |
IXGBE_PHYSICAL_LAYER_10GBASE_LRM)) { |
2197 |
adapter->optics = IFM_10G_LR; |
2196 |
adapter->optics = IFM_10G_LR; |
Lines 2229-2234
Link Here
|
2229 |
{ |
2228 |
{ |
2230 |
device_t dev = adapter->dev; |
2229 |
device_t dev = adapter->dev; |
2231 |
struct ix_queue *que = adapter->queues; |
2230 |
struct ix_queue *que = adapter->queues; |
|
|
2231 |
#if __FreeBSD_version >= 800000 |
2232 |
struct tx_ring *txr = adapter->tx_rings; |
2233 |
#endif |
2232 |
int error, rid = 0; |
2234 |
int error, rid = 0; |
2233 |
|
2235 |
|
2234 |
/* MSI RID at 1 */ |
2236 |
/* MSI RID at 1 */ |
Lines 2248-2253
Link Here
|
2248 |
* Try allocating a fast interrupt and the associated deferred |
2250 |
* Try allocating a fast interrupt and the associated deferred |
2249 |
* processing contexts. |
2251 |
* processing contexts. |
2250 |
*/ |
2252 |
*/ |
|
|
2253 |
#if __FreeBSD_version >= 800000 |
2254 |
TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr); |
2255 |
#endif |
2251 |
TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); |
2256 |
TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); |
2252 |
que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT, |
2257 |
que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT, |
2253 |
taskqueue_thread_enqueue, &que->tq); |
2258 |
taskqueue_thread_enqueue, &que->tq); |
Lines 2294-2302
Link Here
|
2294 |
{ |
2299 |
{ |
2295 |
device_t dev = adapter->dev; |
2300 |
device_t dev = adapter->dev; |
2296 |
struct ix_queue *que = adapter->queues; |
2301 |
struct ix_queue *que = adapter->queues; |
|
|
2302 |
struct tx_ring *txr = adapter->tx_rings; |
2297 |
int error, rid, vector = 0; |
2303 |
int error, rid, vector = 0; |
2298 |
|
2304 |
|
2299 |
for (int i = 0; i < adapter->num_queues; i++, vector++, que++) { |
2305 |
for (int i = 0; i < adapter->num_queues; i++, vector++, que++, txr++) { |
2300 |
rid = vector + 1; |
2306 |
rid = vector + 1; |
2301 |
que->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, |
2307 |
que->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, |
2302 |
RF_SHAREABLE | RF_ACTIVE); |
2308 |
RF_SHAREABLE | RF_ACTIVE); |
Lines 2326-2331
Link Here
|
2326 |
if (adapter->num_queues > 1) |
2332 |
if (adapter->num_queues > 1) |
2327 |
bus_bind_intr(dev, que->res, i); |
2333 |
bus_bind_intr(dev, que->res, i); |
2328 |
|
2334 |
|
|
|
2335 |
#if __FreeBSD_version >= 800000 |
2336 |
TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr); |
2337 |
#endif |
2329 |
TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); |
2338 |
TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); |
2330 |
que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT, |
2339 |
que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT, |
2331 |
taskqueue_thread_enqueue, &que->tq); |
2340 |
taskqueue_thread_enqueue, &que->tq); |
Lines 2569-2580
Link Here
|
2569 |
ifp->if_softc = adapter; |
2578 |
ifp->if_softc = adapter; |
2570 |
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; |
2579 |
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; |
2571 |
ifp->if_ioctl = ixgbe_ioctl; |
2580 |
ifp->if_ioctl = ixgbe_ioctl; |
2572 |
ifp->if_start = ixgbe_start; |
|
|
2573 |
#if __FreeBSD_version >= 800000 |
2581 |
#if __FreeBSD_version >= 800000 |
2574 |
ifp->if_transmit = ixgbe_mq_start; |
2582 |
ifp->if_transmit = ixgbe_mq_start; |
2575 |
ifp->if_qflush = ixgbe_qflush; |
2583 |
ifp->if_qflush = ixgbe_qflush; |
|
|
2584 |
#else |
2585 |
ifp->if_start = ixgbe_start; |
2586 |
IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 2); |
2576 |
#endif |
2587 |
#endif |
2577 |
ifp->if_snd.ifq_maxlen = adapter->num_tx_desc - 2; |
|
|
2578 |
|
2588 |
|
2579 |
ether_ifattach(ifp, adapter->hw.mac.addr); |
2589 |
ether_ifattach(ifp, adapter->hw.mac.addr); |
2580 |
|
2590 |
|
Lines 2586-2592
Link Here
|
2586 |
*/ |
2596 |
*/ |
2587 |
ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); |
2597 |
ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); |
2588 |
|
2598 |
|
2589 |
ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | IFCAP_VLAN_HWCSUM; |
2599 |
ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO | IFCAP_VLAN_HWCSUM; |
2590 |
ifp->if_capabilities |= IFCAP_JUMBO_MTU; |
2600 |
ifp->if_capabilities |= IFCAP_JUMBO_MTU; |
2591 |
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING |
2601 |
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING |
2592 |
| IFCAP_VLAN_HWTSO |
2602 |
| IFCAP_VLAN_HWTSO |
Lines 3258-3263
Link Here
|
3258 |
case ETHERTYPE_IPV6: |
3268 |
case ETHERTYPE_IPV6: |
3259 |
ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen); |
3269 |
ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen); |
3260 |
ip_hlen = sizeof(struct ip6_hdr); |
3270 |
ip_hlen = sizeof(struct ip6_hdr); |
|
|
3271 |
/* XXX-BZ this will go badly in case of ext hdrs. */ |
3261 |
ipproto = ip6->ip6_nxt; |
3272 |
ipproto = ip6->ip6_nxt; |
3262 |
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV6; |
3273 |
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV6; |
3263 |
break; |
3274 |
break; |
Lines 3316-3332
Link Here
|
3316 |
* |
3327 |
* |
3317 |
**********************************************************************/ |
3328 |
**********************************************************************/ |
3318 |
static bool |
3329 |
static bool |
3319 |
ixgbe_tso_setup(struct tx_ring *txr, struct mbuf *mp, u32 *paylen) |
3330 |
ixgbe_tso_setup(struct tx_ring *txr, struct mbuf *mp, u32 *paylen, |
|
|
3331 |
u32 *olinfo_status) |
3320 |
{ |
3332 |
{ |
3321 |
struct adapter *adapter = txr->adapter; |
3333 |
struct adapter *adapter = txr->adapter; |
3322 |
struct ixgbe_adv_tx_context_desc *TXD; |
3334 |
struct ixgbe_adv_tx_context_desc *TXD; |
3323 |
struct ixgbe_tx_buf *tx_buffer; |
3335 |
struct ixgbe_tx_buf *tx_buffer; |
3324 |
u32 vlan_macip_lens = 0, type_tucmd_mlhl = 0; |
3336 |
u32 vlan_macip_lens = 0, type_tucmd_mlhl = 0; |
3325 |
u32 mss_l4len_idx = 0; |
3337 |
u32 mss_l4len_idx = 0, len; |
3326 |
u16 vtag = 0; |
3338 |
u16 vtag = 0, eh_type; |
3327 |
int ctxd, ehdrlen, hdrlen, ip_hlen, tcp_hlen; |
3339 |
int ctxd, ehdrlen, ip_hlen, tcp_hlen; |
3328 |
struct ether_vlan_header *eh; |
3340 |
struct ether_vlan_header *eh; |
|
|
3341 |
#if ((__FreeBSD_version >= 900505) && defined(INET6)) |
3342 |
struct ip6_hdr *ip6; |
3343 |
#endif |
3344 |
#ifdef INET |
3329 |
struct ip *ip; |
3345 |
struct ip *ip; |
|
|
3346 |
#endif |
3330 |
struct tcphdr *th; |
3347 |
struct tcphdr *th; |
3331 |
|
3348 |
|
3332 |
|
3349 |
|
Lines 3335-3366
Link Here
|
3335 |
* Jump over vlan headers if already present |
3352 |
* Jump over vlan headers if already present |
3336 |
*/ |
3353 |
*/ |
3337 |
eh = mtod(mp, struct ether_vlan_header *); |
3354 |
eh = mtod(mp, struct ether_vlan_header *); |
3338 |
if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) |
3355 |
if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { |
3339 |
ehdrlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; |
3356 |
ehdrlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; |
3340 |
else |
3357 |
eh_type = eh->evl_proto; |
|
|
3358 |
} else { |
3341 |
ehdrlen = ETHER_HDR_LEN; |
3359 |
ehdrlen = ETHER_HDR_LEN; |
|
|
3360 |
eh_type = eh->evl_encap_proto; |
3361 |
} |
3342 |
|
3362 |
|
3343 |
/* Ensure we have at least the IP+TCP header in the first mbuf. */ |
3363 |
/* Ensure we have at least the IP+TCP header in the first mbuf. */ |
3344 |
if (mp->m_len < ehdrlen + sizeof(struct ip) + sizeof(struct tcphdr)) |
3364 |
len = ehdrlen + sizeof(struct tcphdr); |
3345 |
return FALSE; |
3365 |
switch (ntohs(eh_type)) { |
|
|
3366 |
#if ((__FreeBSD_version >= 900505) && defined(INET6)) |
3367 |
case ETHERTYPE_IPV6: |
3368 |
if (mp->m_len < len + sizeof(struct ip6_hdr)) |
3369 |
return FALSE; |
3370 |
ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen); |
3371 |
/* XXX-BZ For now we do not pretend to support ext. hdrs. */ |
3372 |
if (ip6->ip6_nxt != IPPROTO_TCP) |
3373 |
return FALSE; |
3374 |
ip_hlen = sizeof(struct ip6_hdr); |
3375 |
th = (struct tcphdr *)((caddr_t)ip6 + ip_hlen); |
3376 |
th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0); |
3377 |
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV6; |
3378 |
break; |
3379 |
#endif |
3380 |
#ifdef INET |
3381 |
case ETHERTYPE_IP: |
3382 |
if (mp->m_len < len + sizeof(struct ip)) |
3383 |
return FALSE; |
3384 |
ip = (struct ip *)(mp->m_data + ehdrlen); |
3385 |
if (ip->ip_p != IPPROTO_TCP) |
3386 |
return FALSE; |
3387 |
ip->ip_sum = 0; |
3388 |
ip_hlen = ip->ip_hl << 2; |
3389 |
th = (struct tcphdr *)((caddr_t)ip + ip_hlen); |
3390 |
th->th_sum = in_pseudo(ip->ip_src.s_addr, |
3391 |
ip->ip_dst.s_addr, htons(IPPROTO_TCP)); |
3392 |
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4; |
3393 |
/* Tell transmit desc to also do IPv4 checksum. */ |
3394 |
*olinfo_status |= IXGBE_TXD_POPTS_IXSM << 8; |
3395 |
break; |
3396 |
#endif |
3397 |
default: |
3398 |
panic("%s: CSUM_TSO but no supported IP version (0x%04x)", |
3399 |
__func__, ntohs(eh_type)); |
3400 |
break; |
3401 |
} |
3346 |
|
3402 |
|
3347 |
ctxd = txr->next_avail_desc; |
3403 |
ctxd = txr->next_avail_desc; |
3348 |
tx_buffer = &txr->tx_buffers[ctxd]; |
3404 |
tx_buffer = &txr->tx_buffers[ctxd]; |
3349 |
TXD = (struct ixgbe_adv_tx_context_desc *) &txr->tx_base[ctxd]; |
3405 |
TXD = (struct ixgbe_adv_tx_context_desc *) &txr->tx_base[ctxd]; |
3350 |
|
3406 |
|
3351 |
ip = (struct ip *)(mp->m_data + ehdrlen); |
|
|
3352 |
if (ip->ip_p != IPPROTO_TCP) |
3353 |
return FALSE; /* 0 */ |
3354 |
ip->ip_sum = 0; |
3355 |
ip_hlen = ip->ip_hl << 2; |
3356 |
th = (struct tcphdr *)((caddr_t)ip + ip_hlen); |
3357 |
th->th_sum = in_pseudo(ip->ip_src.s_addr, |
3358 |
ip->ip_dst.s_addr, htons(IPPROTO_TCP)); |
3359 |
tcp_hlen = th->th_off << 2; |
3407 |
tcp_hlen = th->th_off << 2; |
3360 |
hdrlen = ehdrlen + ip_hlen + tcp_hlen; |
|
|
3361 |
|
3408 |
|
3362 |
/* This is used in the transmit desc in encap */ |
3409 |
/* This is used in the transmit desc in encap */ |
3363 |
*paylen = mp->m_pkthdr.len - hdrlen; |
3410 |
*paylen = mp->m_pkthdr.len - ehdrlen - ip_hlen - tcp_hlen; |
3364 |
|
3411 |
|
3365 |
/* VLAN MACLEN IPLEN */ |
3412 |
/* VLAN MACLEN IPLEN */ |
3366 |
if (mp->m_flags & M_VLANTAG) { |
3413 |
if (mp->m_flags & M_VLANTAG) { |
Lines 3375-3384
Link Here
|
3375 |
/* ADV DTYPE TUCMD */ |
3422 |
/* ADV DTYPE TUCMD */ |
3376 |
type_tucmd_mlhl |= IXGBE_ADVTXD_DCMD_DEXT | IXGBE_ADVTXD_DTYP_CTXT; |
3423 |
type_tucmd_mlhl |= IXGBE_ADVTXD_DCMD_DEXT | IXGBE_ADVTXD_DTYP_CTXT; |
3377 |
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP; |
3424 |
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP; |
3378 |
type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4; |
|
|
3379 |
TXD->type_tucmd_mlhl |= htole32(type_tucmd_mlhl); |
3425 |
TXD->type_tucmd_mlhl |= htole32(type_tucmd_mlhl); |
3380 |
|
3426 |
|
3381 |
|
|
|
3382 |
/* MSS L4LEN IDX */ |
3427 |
/* MSS L4LEN IDX */ |
3383 |
mss_l4len_idx |= (mp->m_pkthdr.tso_segsz << IXGBE_ADVTXD_MSS_SHIFT); |
3428 |
mss_l4len_idx |= (mp->m_pkthdr.tso_segsz << IXGBE_ADVTXD_MSS_SHIFT); |
3384 |
mss_l4len_idx |= (tcp_hlen << IXGBE_ADVTXD_L4LEN_SHIFT); |
3429 |
mss_l4len_idx |= (tcp_hlen << IXGBE_ADVTXD_L4LEN_SHIFT); |
Lines 3620-3629
Link Here
|
3620 |
if ((!processed) && ((ticks - txr->watchdog_time) > IXGBE_WATCHDOG)) |
3665 |
if ((!processed) && ((ticks - txr->watchdog_time) > IXGBE_WATCHDOG)) |
3621 |
txr->queue_status = IXGBE_QUEUE_HUNG; |
3666 |
txr->queue_status = IXGBE_QUEUE_HUNG; |
3622 |
|
3667 |
|
3623 |
/* With a minimum free clear the depleted state bit. */ |
|
|
3624 |
if (txr->tx_avail > IXGBE_TX_CLEANUP_THRESHOLD) |
3625 |
txr->queue_status &= ~IXGBE_QUEUE_DEPLETED; |
3626 |
|
3627 |
if (txr->tx_avail == adapter->num_tx_desc) { |
3668 |
if (txr->tx_avail == adapter->num_tx_desc) { |
3628 |
txr->queue_status = IXGBE_QUEUE_IDLE; |
3669 |
txr->queue_status = IXGBE_QUEUE_IDLE; |
3629 |
return (FALSE); |
3670 |
return (FALSE); |
Lines 3698-3718
Link Here
|
3698 |
mp = rxbuf->m_pack; |
3739 |
mp = rxbuf->m_pack; |
3699 |
|
3740 |
|
3700 |
mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; |
3741 |
mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; |
3701 |
/* Get the memory mapping */ |
3742 |
|
3702 |
error = bus_dmamap_load_mbuf_sg(rxr->ptag, |
3743 |
/* If we're dealing with an mbuf that was copied rather |
3703 |
rxbuf->pmap, mp, pseg, &nsegs, BUS_DMA_NOWAIT); |
3744 |
* than replaced, there's no need to go through busdma. |
3704 |
if (error != 0) { |
3745 |
*/ |
3705 |
printf("Refresh mbufs: payload dmamap load" |
3746 |
if ((rxbuf->flags & IXGBE_RX_COPY) == 0) { |
3706 |
" failure - %d\n", error); |
3747 |
/* Get the memory mapping */ |
3707 |
m_free(mp); |
3748 |
error = bus_dmamap_load_mbuf_sg(rxr->ptag, |
3708 |
rxbuf->m_pack = NULL; |
3749 |
rxbuf->pmap, mp, pseg, &nsegs, BUS_DMA_NOWAIT); |
3709 |
goto update; |
3750 |
if (error != 0) { |
|
|
3751 |
printf("Refresh mbufs: payload dmamap load" |
3752 |
" failure - %d\n", error); |
3753 |
m_free(mp); |
3754 |
rxbuf->m_pack = NULL; |
3755 |
goto update; |
3756 |
} |
3757 |
rxbuf->m_pack = mp; |
3758 |
bus_dmamap_sync(rxr->ptag, rxbuf->pmap, |
3759 |
BUS_DMASYNC_PREREAD); |
3760 |
rxbuf->paddr = rxr->rx_base[i].read.pkt_addr = |
3761 |
htole64(pseg[0].ds_addr); |
3762 |
} else { |
3763 |
rxr->rx_base[i].read.pkt_addr = rxbuf->paddr; |
3764 |
rxbuf->flags &= ~IXGBE_RX_COPY; |
3710 |
} |
3765 |
} |
3711 |
rxbuf->m_pack = mp; |
|
|
3712 |
bus_dmamap_sync(rxr->ptag, rxbuf->pmap, |
3713 |
BUS_DMASYNC_PREREAD); |
3714 |
rxr->rx_base[i].read.pkt_addr = |
3715 |
htole64(pseg[0].ds_addr); |
3716 |
|
3766 |
|
3717 |
refreshed = TRUE; |
3767 |
refreshed = TRUE; |
3718 |
/* Next is precalculated */ |
3768 |
/* Next is precalculated */ |
Lines 4025-4030
Link Here
|
4025 |
rxr->next_to_refresh = 0; |
4075 |
rxr->next_to_refresh = 0; |
4026 |
rxr->lro_enabled = FALSE; |
4076 |
rxr->lro_enabled = FALSE; |
4027 |
rxr->rx_split_packets = 0; |
4077 |
rxr->rx_split_packets = 0; |
|
|
4078 |
rxr->rx_copies = 0; |
4028 |
rxr->rx_bytes = 0; |
4079 |
rxr->rx_bytes = 0; |
4029 |
rxr->discard = FALSE; |
4080 |
rxr->discard = FALSE; |
4030 |
rxr->vtag_strip = FALSE; |
4081 |
rxr->vtag_strip = FALSE; |
Lines 4319-4333
Link Here
|
4319 |
{ |
4370 |
{ |
4320 |
|
4371 |
|
4321 |
/* |
4372 |
/* |
4322 |
* ATM LRO is only for IPv4/TCP packets and TCP checksum of the packet |
4373 |
* ATM LRO is only for IP/TCP packets and TCP checksum of the packet |
4323 |
* should be computed by hardware. Also it should not have VLAN tag in |
4374 |
* should be computed by hardware. Also it should not have VLAN tag in |
4324 |
* ethernet header. |
4375 |
* ethernet header. In case of IPv6 we do not yet support ext. hdrs. |
4325 |
*/ |
4376 |
*/ |
4326 |
if (rxr->lro_enabled && |
4377 |
if (rxr->lro_enabled && |
4327 |
(ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && |
4378 |
(ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && |
4328 |
(ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && |
4379 |
(ptype & IXGBE_RXDADV_PKTTYPE_ETQF) == 0 && |
4329 |
(ptype & (IXGBE_RXDADV_PKTTYPE_IPV4 | IXGBE_RXDADV_PKTTYPE_TCP)) == |
4380 |
((ptype & (IXGBE_RXDADV_PKTTYPE_IPV4 | IXGBE_RXDADV_PKTTYPE_TCP)) == |
4330 |
(IXGBE_RXDADV_PKTTYPE_IPV4 | IXGBE_RXDADV_PKTTYPE_TCP) && |
4381 |
(IXGBE_RXDADV_PKTTYPE_IPV4 | IXGBE_RXDADV_PKTTYPE_TCP) || |
|
|
4382 |
(ptype & (IXGBE_RXDADV_PKTTYPE_IPV6 | IXGBE_RXDADV_PKTTYPE_TCP)) == |
4383 |
(IXGBE_RXDADV_PKTTYPE_IPV6 | IXGBE_RXDADV_PKTTYPE_TCP)) && |
4331 |
(m->m_pkthdr.csum_flags & (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) == |
4384 |
(m->m_pkthdr.csum_flags & (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) == |
4332 |
(CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) { |
4385 |
(CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) { |
4333 |
/* |
4386 |
/* |
Lines 4580-4593
Link Here
|
4580 |
** that determines what we are |
4633 |
** that determines what we are |
4581 |
*/ |
4634 |
*/ |
4582 |
sendmp = rbuf->fmp; |
4635 |
sendmp = rbuf->fmp; |
4583 |
rbuf->m_pack = rbuf->fmp = NULL; |
|
|
4584 |
|
4636 |
|
4585 |
if (sendmp != NULL) { /* secondary frag */ |
4637 |
if (sendmp != NULL) { /* secondary frag */ |
|
|
4638 |
rbuf->m_pack = rbuf->fmp = NULL; |
4586 |
mp->m_flags &= ~M_PKTHDR; |
4639 |
mp->m_flags &= ~M_PKTHDR; |
4587 |
sendmp->m_pkthdr.len += mp->m_len; |
4640 |
sendmp->m_pkthdr.len += mp->m_len; |
4588 |
} else { |
4641 |
} else { |
|
|
4642 |
/* |
4643 |
* Optimize. This might be a small packet, |
4644 |
* maybe just a TCP ACK. Do a fast copy that |
4645 |
* is cache aligned into a new mbuf, and |
4646 |
* leave the old mbuf+cluster for re-use. |
4647 |
*/ |
4648 |
if (eop && plen <= IXGBE_RX_COPY_LEN) { |
4649 |
sendmp = m_gethdr(M_DONTWAIT, MT_DATA); |
4650 |
if (sendmp != NULL) { |
4651 |
sendmp->m_data += |
4652 |
IXGBE_RX_COPY_ALIGN; |
4653 |
ixgbe_bcopy(mp->m_data, |
4654 |
sendmp->m_data, plen); |
4655 |
sendmp->m_len = plen; |
4656 |
rxr->rx_copies++; |
4657 |
rbuf->flags |= IXGBE_RX_COPY; |
4658 |
} |
4659 |
} |
4660 |
if (sendmp == NULL) { |
4661 |
rbuf->m_pack = rbuf->fmp = NULL; |
4662 |
sendmp = mp; |
4663 |
} |
4664 |
|
4589 |
/* first desc of a non-ps chain */ |
4665 |
/* first desc of a non-ps chain */ |
4590 |
sendmp = mp; |
|
|
4591 |
sendmp->m_flags |= M_PKTHDR; |
4666 |
sendmp->m_flags |= M_PKTHDR; |
4592 |
sendmp->m_pkthdr.len = mp->m_len; |
4667 |
sendmp->m_pkthdr.len = mp->m_len; |
4593 |
if (staterr & IXGBE_RXD_STAT_VP) { |
4668 |
if (staterr & IXGBE_RXD_STAT_VP) { |
Lines 5438-5443
Link Here
|
5438 |
SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "rx_bytes", |
5513 |
SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "rx_bytes", |
5439 |
CTLFLAG_RD, &rxr->rx_bytes, |
5514 |
CTLFLAG_RD, &rxr->rx_bytes, |
5440 |
"Queue Bytes Received"); |
5515 |
"Queue Bytes Received"); |
|
|
5516 |
SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "rx_copies", |
5517 |
CTLFLAG_RD, &rxr->rx_copies, |
5518 |
"Copied RX Frames"); |
5441 |
SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued", |
5519 |
SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued", |
5442 |
CTLFLAG_RD, &lro->lro_queued, 0, |
5520 |
CTLFLAG_RD, &lro->lro_queued, 0, |
5443 |
"LRO Queued"); |
5521 |
"LRO Queued"); |