FreeBSD Bugzilla – Attachment 148084 Details for
Bug 194234
[ixgbe] Update ixgbe to 2.5.27
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Core code patch
core.patch (text/plain), 16.30 KB, created by
Eric Joyner
on 2014-10-07 23:41:58 UTC
(
hide
)
Description:
Core code patch
Filename:
MIME Type:
Creator:
Eric Joyner
Created:
2014-10-07 23:41:58 UTC
Size:
16.30 KB
patch
obsolete
>--- a/sys/dev/ixgbe/ixgbe.c >+++ b/sys/dev/ixgbe/ixgbe.c >@@ -1,6 +1,6 @@ > /****************************************************************************** > >- Copyright (c) 2001-2013, Intel Corporation >+ Copyright (c) 2001-2014, Intel Corporation > All rights reserved. > > Redistribution and use in source and binary forms, with or without >@@ -33,9 +33,12 @@ > /*$FreeBSD: head/sys/dev/ixgbe/ixgbe.c 272240 2014-09-28 07:29:45Z glebius $*/ > > >+#ifndef IXGBE_LEGACY_BUILD > #include "opt_inet.h" > #include "opt_inet6.h" > #include "opt_rss.h" >+#endif >+ > #include "ixgbe.h" > > #ifdef RSS >@@ -50,7 +53,7 @@ > /********************************************************************* > * Driver version > *********************************************************************/ >-char ixgbe_driver_version[] = "2.5.15"; >+char ixgbe_driver_version[] = "2.5.27"; > > /********************************************************************* > * PCI Device ID Table >@@ -87,7 +90,9 @@ > {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0}, > {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599EN_SFP, 0, 0, 0}, > {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF_QP, 0, 0, 0}, >+ {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_QSFP_SF_QP, 0, 0, 0}, > {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T, 0, 0, 0}, >+ {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T1, 0, 0, 0}, > /* required last entry */ > {0, 0, 0, 0, 0} > }; >@@ -114,13 +119,15 @@ > static int ixgbe_mq_start(struct ifnet *, struct mbuf *); > static int ixgbe_mq_start_locked(struct ifnet *, struct tx_ring *); > static void ixgbe_qflush(struct ifnet *); >-static void ixgbe_deferred_mq_start(void *, int); > #endif /* IXGBE_LEGACY_TX */ >+static void ixgbe_deferred_mq_start(void *, int); > static int ixgbe_ioctl(struct ifnet *, u_long, caddr_t); > static void ixgbe_init(void *); > static void ixgbe_init_locked(struct adapter *); > static void ixgbe_stop(void *); >+#if __FreeBSD_version >= 1100036 > static uint64_t ixgbe_get_counter(struct ifnet *, ift_counter); >+#endif > static void ixgbe_media_status(struct ifnet *, struct ifmediareq *); > static int ixgbe_media_change(struct ifnet *); > static void ixgbe_identify_hardware(struct adapter *); >@@ -504,7 +511,7 @@ > ** system mbuf allocation. Tuning nmbclusters > ** can alleviate this. > */ >- if (nmbclusters > 0 ) { >+ if (nmbclusters > 0) { > int s; > s = (ixgbe_rxd * adapter->num_queues) * ixgbe_total_ports; > if (s > nmbclusters) { >@@ -701,6 +708,8 @@ > if (adapter->vlan_detach != NULL) > EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach); > >+ /* Force state down */ >+ adapter->ifp->if_flags &= ~IFF_UP; > ether_ifdetach(adapter->ifp); > callout_drain(&adapter->timer); > #ifdef DEV_NETMAP >@@ -913,22 +922,6 @@ > } > > /* >- * Called from a taskqueue to drain queued transmit packets. >- */ >-static void >-ixgbe_deferred_mq_start(void *arg, int pending) >-{ >- struct tx_ring *txr = arg; >- struct adapter *adapter = txr->adapter; >- struct ifnet *ifp = adapter->ifp; >- >- IXGBE_TX_LOCK(txr); >- if (!drbr_empty(ifp, txr->br)) >- ixgbe_mq_start_locked(ifp, txr); >- IXGBE_TX_UNLOCK(txr); >-} >- >-/* > ** Flush all ring buffers > */ > static void >@@ -948,6 +941,27 @@ > } > #endif /* IXGBE_LEGACY_TX */ > >+/* >+ * Called from a taskqueue to drain queued transmit packets. >+ */ >+static void >+ixgbe_deferred_mq_start(void *arg, int pending) >+{ >+ struct tx_ring *txr = arg; >+ struct adapter *adapter = txr->adapter; >+ struct ifnet *ifp = adapter->ifp; >+ >+ IXGBE_TX_LOCK(txr); >+#ifndef IXGBE_LEGACY_TX >+ if (!drbr_empty(ifp, txr->br)) >+ ixgbe_mq_start_locked(ifp, txr); >+#else >+ if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) >+ ixgbe_start_locked(txr, ifp); >+#endif >+ IXGBE_TX_UNLOCK(txr); >+} >+ > /********************************************************************* > * Ioctl entry point > * >@@ -961,7 +975,6 @@ > ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) > { > struct adapter *adapter = ifp->if_softc; >- struct ixgbe_hw *hw = &adapter->hw; > struct ifreq *ifr = (struct ifreq *) data; > #if defined(INET) || defined(INET6) > struct ifaddr *ifa = (struct ifaddr *)data; >@@ -1047,10 +1060,15 @@ > IOCTL_DEBUGOUT("ioctl: SIOCSIFCAP (Set Capabilities)"); > if (mask & IFCAP_HWCSUM) > ifp->if_capenable ^= IFCAP_HWCSUM; >+#if __FreeBSD_version > 900505 > if (mask & IFCAP_TSO4) > ifp->if_capenable ^= IFCAP_TSO4; > if (mask & IFCAP_TSO6) > ifp->if_capenable ^= IFCAP_TSO6; >+#else >+ if (mask & IFCAP_TSO) >+ ifp->if_capenable ^= IFCAP_TSO; >+#endif > if (mask & IFCAP_LRO) > ifp->if_capenable ^= IFCAP_LRO; > if (mask & IFCAP_VLAN_HWTAGGING) >@@ -1067,8 +1085,10 @@ > VLAN_CAPABILITIES(ifp); > break; > } >+#if __FreeBSD_version >= 1100036 > case SIOCGI2C: > { >+ struct ixgbe_hw *hw = &adapter->hw; > struct ifi2creq i2c; > int i; > IOCTL_DEBUGOUT("ioctl: SIOCGI2C (Get I2C Data)"); >@@ -1090,6 +1110,7 @@ > error = copyout(&i2c, ifr->ifr_data, sizeof(i2c)); > break; > } >+#endif > default: > IOCTL_DEBUGOUT1("ioctl: UNKNOWN (0x%X)\n", (int)command); > error = ether_ioctl(ifp, command, data); >@@ -1551,7 +1572,7 @@ > IXGBE_TX_LOCK(txr); > ixgbe_txeof(txr); > #ifdef IXGBE_LEGACY_TX >- if (!IFQ_DRV_IS_EMPTY(ifp->if_snd)) >+ if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) > ixgbe_start_locked(txr, ifp); > #else > if (!drbr_empty(ifp, txr->br)) >@@ -2101,7 +2122,7 @@ > else if (txr->queue_status == IXGBE_QUEUE_WORKING) > taskqueue_enqueue(que->tq, &txr->txq_task); > } >- /* Only truely watchdog if all queues show hung */ >+ /* Only truly watchdog if all queues show hung */ > if (hung == adapter->num_queues) > goto watchdog; > >@@ -2299,9 +2320,7 @@ > { > device_t dev = adapter->dev; > struct ix_queue *que = adapter->queues; >-#ifndef IXGBE_LEGACY_TX >- struct tx_ring *txr = adapter->tx_rings; >-#endif >+ struct tx_ring *txr = adapter->tx_rings; > int error, rid = 0; > > /* MSI RID at 1 */ >@@ -2321,9 +2340,7 @@ > * Try allocating a fast interrupt and the associated deferred > * processing contexts. > */ >-#ifndef IXGBE_LEGACY_TX > TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr); >-#endif > TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); > que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT, > taskqueue_thread_enqueue, &que->tq); >@@ -2354,7 +2371,7 @@ > return (error); > } > /* For simplicity in the handlers */ >- adapter->que_mask = IXGBE_EIMS_ENABLE_MASK; >+ adapter->active_queues = IXGBE_EIMS_ENABLE_MASK; > > return (0); > } >@@ -2420,7 +2437,7 @@ > bus_describe_intr(dev, que->res, que->tag, "que %d", i); > #endif > que->msix = vector; >- adapter->que_mask |= (u64)(1 << que->msix); >+ adapter->active_queues |= (u64)(1 << que->msix); > #ifdef RSS > /* > * The queue ID is used as the RSS layer bucket ID. >@@ -2452,10 +2469,7 @@ > i, cpu_id); > #endif > >- >-#ifndef IXGBE_LEGACY_TX > TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr); >-#endif > TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); > que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT, > taskqueue_thread_enqueue, &que->tq); >@@ -2722,7 +2736,9 @@ > ifp->if_softc = adapter; > ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; > ifp->if_ioctl = ixgbe_ioctl; >- ifp->if_get_counter = ixgbe_get_counter; >+#if __FreeBSD_version >= 1100036 >+ if_setgetcounterfn(ifp, ixgbe_get_counter); >+#endif > #ifndef IXGBE_LEGACY_TX > ifp->if_transmit = ixgbe_mq_start; > ifp->if_qflush = ixgbe_qflush; >@@ -3216,7 +3232,7 @@ > > for (int i = 0; i < adapter->num_queues; i++, txr++) { > u64 tdba = txr->txdma.dma_paddr; >- u32 txctrl; >+ u32 txctrl = 0; > > IXGBE_WRITE_REG(hw, IXGBE_TDBAL(i), > (tdba & 0x00000000ffffffffULL)); >@@ -3336,7 +3352,7 @@ > tx_buffer->map = NULL; > } > } >-#ifdef IXGBE_LEGACY_TX >+#ifndef IXGBE_LEGACY_TX > if (txr->br != NULL) > buf_ring_free(txr->br, M_DEVBUF); > #endif >@@ -5368,6 +5384,7 @@ > { > struct ixgbe_hw *hw = &adapter->hw; > u32 missed_rx = 0, bprc, lxon, lxoff, total; >+ u64 total_missed_rx = 0; > > adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); > adapter->stats.illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC); >@@ -5386,6 +5403,8 @@ > missed_rx += mp; > /* global total per queue */ > adapter->stats.mpc[i] += mp; >+ /* Total for stats display */ >+ total_missed_rx += adapter->stats.mpc[i]; > if (hw->mac.type == ixgbe_mac_82598EB) { > adapter->stats.rnbc[i] += > IXGBE_READ_REG(hw, IXGBE_RNBC(i)); >@@ -5495,42 +5514,52 @@ > adapter->stats.fcoedwrc += IXGBE_READ_REG(hw, IXGBE_FCOEDWRC); > adapter->stats.fcoedwtc += IXGBE_READ_REG(hw, IXGBE_FCOEDWTC); > } >+ >+ /* Fill out the OS statistics structure */ >+ IXGBE_SET_IPACKETS(adapter, adapter->stats.gprc); >+ IXGBE_SET_OPACKETS(adapter, adapter->stats.gptc); >+ IXGBE_SET_IBYTES(adapter, adapter->stats.gorc); >+ IXGBE_SET_OBYTES(adapter, adapter->stats.gotc); >+ IXGBE_SET_IMCASTS(adapter, adapter->stats.mprc); >+ IXGBE_SET_OMCASTS(adapter, adapter->stats.mptc); >+ IXGBE_SET_COLLISIONS(adapter, 0); >+ IXGBE_SET_IQDROPS(adapter, total_missed_rx); >+ IXGBE_SET_IERRORS(adapter, adapter->stats.crcerrs >+ + adapter->stats.rlec); > } > >+#if __FreeBSD_version >= 1100036 > static uint64_t > ixgbe_get_counter(struct ifnet *ifp, ift_counter cnt) > { > struct adapter *adapter; >- uint64_t rv; > > adapter = if_getsoftc(ifp); > > switch (cnt) { > case IFCOUNTER_IPACKETS: >- return (adapter->stats.gprc); >+ return (adapter->ipackets); > case IFCOUNTER_OPACKETS: >- return (adapter->stats.gptc); >+ return (adapter->opackets); > case IFCOUNTER_IBYTES: >- return (adapter->stats.gorc); >+ return (adapter->ibytes); > case IFCOUNTER_OBYTES: >- return (adapter->stats.gotc); >+ return (adapter->obytes); > case IFCOUNTER_IMCASTS: >- return (adapter->stats.mprc); >+ return (adapter->imcasts); > case IFCOUNTER_OMCASTS: >- return (adapter->stats.mptc); >+ return (adapter->omcasts); > case IFCOUNTER_COLLISIONS: > return (0); > case IFCOUNTER_IQDROPS: >- rv = 0; >- for (int i = 0; i < 8; i++) >- rv += adapter->stats.mpc[i]; >- return (rv); >+ return (adapter->iqdrops); > case IFCOUNTER_IERRORS: >- return (adapter->stats.crcerrs + adapter->stats.rlec); >+ return (adapter->ierrors); > default: > return (if_get_counter_default(ifp, cnt)); > } > } >+#endif > > /** ixgbe_sysctl_tdh_handler - Handler function > * Retrieves the TDH value from the hardware >--- a/sys/dev/ixgbe/ixgbe.h >+++ b/sys/dev/ixgbe/ixgbe.h >@@ -1,6 +1,6 @@ > /****************************************************************************** > >- Copyright (c) 2001-2013, Intel Corporation >+ Copyright (c) 2001-2014, Intel Corporation > All rights reserved. > > Redistribution and use in source and binary forms, with or without >@@ -204,6 +204,15 @@ > #define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP) > #endif > >+/* Backward compatibility items for very old versions */ >+#ifndef pci_find_cap >+#define pci_find_cap pci_find_extcap >+#endif >+ >+#ifndef DEVMETHOD_END >+#define DEVMETHOD_END { NULL, NULL } >+#endif >+ > /* > * Interrupt Moderation parameters > */ >@@ -300,9 +309,9 @@ > u32 txd_cmd; > bus_dma_tag_t txtag; > char mtx_name[16]; >+ struct task txq_task; > #ifndef IXGBE_LEGACY_TX > struct buf_ring *br; >- struct task txq_task; > #endif > #ifdef IXGBE_FDIR > u16 atr_sample; >@@ -441,7 +450,7 @@ > * Allocated at run time, an array of rings. > */ > struct rx_ring *rx_rings; >- u64 que_mask; >+ u64 active_queues; > u32 num_rx_desc; > > /* Multicast array memory */ >@@ -457,6 +466,20 @@ > unsigned long link_irq; > > struct ixgbe_hw_stats stats; >+ >+#if __FreeBSD_version >= 1100036 >+ /* FreeBSD counter(9) stats */ >+ u64 ipackets; >+ u64 ierrors; >+ u64 opackets; >+ u64 oerrors; >+ u64 ibytes; >+ u64 obytes; >+ u64 imcasts; >+ u64 omcasts; >+ u64 iqdrops; >+ u64 noproto; >+#endif > }; > > >@@ -487,6 +510,31 @@ > #define PCIER_LINK_STA PCIR_EXPRESS_LINK_STA > #endif > >+/* Stats macros */ >+#if __FreeBSD_version >= 1100036 >+#define IXGBE_SET_IPACKETS(sc, count) (sc)->ipackets = (count) >+#define IXGBE_SET_IERRORS(sc, count) (sc)->ierrors = (count) >+#define IXGBE_SET_OPACKETS(sc, count) (sc)->opackets = (count) >+#define IXGBE_SET_OERRORS(sc, count) (sc)->oerrors = (count) >+#define IXGBE_SET_COLLISIONS(sc, count) >+#define IXGBE_SET_IBYTES(sc, count) (sc)->ibytes = (count) >+#define IXGBE_SET_OBYTES(sc, count) (sc)->obytes = (count) >+#define IXGBE_SET_IMCASTS(sc, count) (sc)->imcasts = (count) >+#define IXGBE_SET_OMCASTS(sc, count) (sc)->omcasts = (count) >+#define IXGBE_SET_IQDROPS(sc, count) (sc)->iqdrops = (count) >+#else >+#define IXGBE_SET_IPACKETS(sc, count) (sc)->ifp->if_ipackets = (count) >+#define IXGBE_SET_IERRORS(sc, count) (sc)->ifp->if_ierrors = (count) >+#define IXGBE_SET_OPACKETS(sc, count) (sc)->ifp->if_opackets = (count) >+#define IXGBE_SET_OERRORS(sc, count) (sc)->ifp->if_oerrors = (count) >+#define IXGBE_SET_COLLISIONS(sc, count) (sc)->ifp->if_collisions = (count) >+#define IXGBE_SET_IBYTES(sc, count) (sc)->ifp->if_ibytes = (count) >+#define IXGBE_SET_OBYTES(sc, count) (sc)->ifp->if_obytes = (count) >+#define IXGBE_SET_IMCASTS(sc, count) (sc)->ifp->if_imcasts = (count) >+#define IXGBE_SET_OMCASTS(sc, count) (sc)->ifp->if_omcasts = (count) >+#define IXGBE_SET_IQDROPS(sc, count) (sc)->ifp->if_iqdrops = (count) >+#endif >+ > static inline bool > ixgbe_is_sfp(struct ixgbe_hw *hw) > { >@@ -497,6 +545,10 @@ > case ixgbe_phy_sfp_unknown: > case ixgbe_phy_sfp_passive_tyco: > case ixgbe_phy_sfp_passive_unknown: >+ case ixgbe_phy_qsfp_passive_unknown: >+ case ixgbe_phy_qsfp_active_unknown: >+ case ixgbe_phy_qsfp_intel: >+ case ixgbe_phy_qsfp_unknown: > return TRUE; > default: > return FALSE; >--- a/sys/dev/ixgbe/ixgbe_osdep.h >+++ b/sys/dev/ixgbe/ixgbe_osdep.h >@@ -1,6 +1,6 @@ > /****************************************************************************** > >- Copyright (c) 2001-2013, Intel Corporation >+ Copyright (c) 2001-2014, Intel Corporation > All rights reserved. > > Redistribution and use in source and binary forms, with or without >@@ -108,13 +108,14 @@ > #define UNREFERENCED_3PARAMETER(_p, _q, _r) > #define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) > >- > #define IXGBE_NTOHL(_i) ntohl(_i) > #define IXGBE_NTOHS(_i) ntohs(_i) > > /* XXX these need to be revisited */ >-#define IXGBE_CPU_TO_LE32 le32toh >-#define IXGBE_LE32_TO_CPUS le32dec >+#define IXGBE_CPU_TO_LE32 htole32 >+#define IXGBE_LE32_TO_CPUS(x) >+#define IXGBE_CPU_TO_BE16 htobe16 >+#define IXGBE_CPU_TO_BE32 htobe32 > > typedef uint8_t u8; > typedef int8_t s8; >--- a/sys/dev/ixgbe/ixv.c >+++ b/sys/dev/ixgbe/ixv.c >@@ -1,6 +1,6 @@ > /****************************************************************************** > >- Copyright (c) 2001-2013, Intel Corporation >+ Copyright (c) 2001-2014, Intel Corporation > All rights reserved. > > Redistribution and use in source and binary forms, with or without >@@ -634,9 +634,11 @@ > } > drbr_advance(ifp, txr->br); > enqueued++; >+#if __FreeBSD_version >= 1100036 > if_inc_counter(ifp, IFCOUNTER_OBYTES, next->m_pkthdr.len); > if (next->m_flags & M_MCAST) > if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); >+#endif > /* Send a copy of the frame to the BPF listener */ > ETHER_BPF_MTAP(ifp, next); > if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) >@@ -2651,7 +2653,9 @@ > tx_desc = > (struct ixgbe_legacy_tx_desc *)&txr->tx_base[first]; > } >+#if __FreeBSD_version >= 1100036 > if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); >+#endif > /* See if there is more work now */ > last = tx_buffer->eop_index; > if (last != -1) { >@@ -3341,7 +3345,9 @@ > /* Make sure all parts of a bad packet are discarded */ > if (((staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) || > (rxr->discard)) { >+#if __FreeBSD_version >= 1100036 > if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); >+#endif > rxr->rx_discarded++; > if (!eop) > rxr->discard = TRUE; >@@ -3455,7 +3461,9 @@ > /* Sending this frame? */ > if (eop) { > sendmp->m_pkthdr.rcvif = ifp; >+#if __FreeBSD_version >= 1100036 > if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); >+#endif > rxr->rx_packets++; > /* capture data for AIM */ > rxr->bytes += sendmp->m_pkthdr.len; >--- a/sys/dev/ixgbe/ixv.h >+++ b/sys/dev/ixgbe/ixv.h >@@ -1,6 +1,6 @@ > /****************************************************************************** > >- Copyright (c) 2001-2012, Intel Corporation >+ Copyright (c) 2001-2014, Intel Corporation > All rights reserved. > > Redistribution and use in source and binary forms, with or without >@@ -185,6 +185,11 @@ > #define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP) > #endif > >+/* Backward compatibility */ >+#ifndef pci_find_cap >+#define pci_find_cap pci_find_extcap >+#endif >+ > /* > ***************************************************************************** > * vendor_info_array
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 194234
:
148084
|
148085
|
148597
|
148598