Sync ixg(4) up to FreeBSD r243716:

- A lot of bugfixes. Some of them are realted to multi queue and those
   have not affected in NetBSD because we have not used it yet.
 - Show 1000Base-SX correctly.
 - Fix if_baudrate from 1G to 10G.
 - Improve performance.
This commit is contained in:
msaitoh 2015-04-14 07:17:06 +00:00
parent ca58739ce4
commit e1cf58ac37
5 changed files with 320 additions and 388 deletions

File diff suppressed because it is too large Load Diff

View File

@ -58,8 +58,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.h 234620 2012-04-23 22:05:09Z bz $*/
/*$NetBSD: ixgbe.h,v 1.5 2015/04/02 09:26:55 msaitoh Exp $*/
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.h 243716 2012-11-30 22:33:21Z jfv $*/
/*$NetBSD: ixgbe.h,v 1.6 2015/04/14 07:17:06 msaitoh Exp $*/
#ifndef _IXGBE_H_
@ -173,6 +173,19 @@
#define IXGBE_FC_HI 0x20000
#define IXGBE_FC_LO 0x10000
/*
* Used for optimizing small rx mbufs. Effort is made to keep the copy
* small and aligned for the CPU L1 cache.
*
* MHLEN is typically 168 bytes, giving us 8-byte alignment. Getting
* 32 byte alignment needed for the fast bcopy results in 8 bytes being
* wasted. Getting 64 byte alignment, which _should_ be ideal for
* modern Intel CPUs, results in 40 bytes wasted and a significant drop
* in observed efficiency of the optimization, 97.9% -> 81.8%.
*/
#define IXGBE_RX_COPY_LEN 160
#define IXGBE_RX_COPY_ALIGN (MHLEN - IXGBE_RX_COPY_LEN)
/* Keep older OS drivers building... */
#if !defined(SYSCTL_ADD_UQUAD)
#define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD
@ -204,10 +217,6 @@
#define IXGBE_VFTA_SIZE 128
#define IXGBE_BR_SIZE 4096
#define IXGBE_QUEUE_MIN_FREE 32
#define IXGBE_QUEUE_IDLE 1
#define IXGBE_QUEUE_WORKING 2
#define IXGBE_QUEUE_HUNG 4
#define IXGBE_QUEUE_DEPLETED 8
/* Offload bits in mbuf flag */
#define M_CSUM_OFFLOAD \
@ -246,11 +255,12 @@ struct ixgbe_tx_buf {
};
struct ixgbe_rx_buf {
struct mbuf *m_head;
struct mbuf *m_pack;
struct mbuf *buf;
struct mbuf *fmp;
bus_dmamap_t hmap;
bus_dmamap_t pmap;
bus_dmamap_t map;
u_int flags;
#define IXGBE_RX_COPY 0x01
uint64_t addr;
};
/*
@ -291,7 +301,11 @@ struct tx_ring {
struct adapter *adapter;
kmutex_t tx_mtx;
u32 me;
int queue_status;
enum {
IXGBE_QUEUE_IDLE,
IXGBE_QUEUE_WORKING,
IXGBE_QUEUE_HUNG,
} queue_status;
struct timeval watchdog_time;
union ixgbe_adv_tx_desc *tx_base;
struct ixgbe_dma_alloc txdma;
@ -304,6 +318,7 @@ struct tx_ring {
char mtx_name[16];
#if __FreeBSD_version >= 800000
struct buf_ring *br;
struct task txq_task;
#endif
#ifdef IXGBE_FDIR
u16 atr_sample;
@ -330,7 +345,6 @@ struct rx_ring {
struct lro_ctrl lro;
#endif /* LRO */
bool lro_enabled;
bool hdr_split;
bool hw_rsc;
bool discard;
bool vtag_strip;
@ -338,15 +352,14 @@ struct rx_ring {
u32 next_to_check;
char mtx_name[16];
struct ixgbe_rx_buf *rx_buffers;
ixgbe_dma_tag_t *htag;
ixgbe_dma_tag_t *ptag;
ixgbe_dma_tag_t *tag;
u32 bytes; /* Used for AIM calc */
u32 packets;
/* Soft stats */
struct evcnt rx_irq;
struct evcnt rx_split_packets;
struct evcnt rx_copies;
struct evcnt rx_packets;
struct evcnt rx_bytes;
struct evcnt rx_discarded;

View File

@ -30,8 +30,8 @@
POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82599.c 238149 2012-07-05 20:51:44Z jfv $*/
/*$NetBSD: ixgbe_82599.c,v 1.7 2015/04/02 09:26:55 msaitoh Exp $*/
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82599.c 240155 2012-09-06 02:07:58Z kevlo $*/
/*$NetBSD: ixgbe_82599.c,v 1.8 2015/04/14 07:17:06 msaitoh Exp $*/
#include "ixgbe_type.h"
#include "ixgbe_82599.h"
@ -870,12 +870,13 @@ s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) {
/* Set KX4/KX/KR support according to speed requested */
autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP);
if (speed & IXGBE_LINK_SPEED_10GB_FULL)
if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
if (orig_autoc & IXGBE_AUTOC_KX4_SUPP)
autoc |= IXGBE_AUTOC_KX4_SUPP;
if ((orig_autoc & IXGBE_AUTOC_KR_SUPP) &&
(hw->phy.smart_speed_active == FALSE))
autoc |= IXGBE_AUTOC_KR_SUPP;
}
if (speed & IXGBE_LINK_SPEED_1GB_FULL)
autoc |= IXGBE_AUTOC_KX_SUPP;
} else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) &&

View File

@ -30,8 +30,8 @@
POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_osdep.h 238149 2012-07-05 20:51:44Z jfv $*/
/*$NetBSD: ixgbe_osdep.h,v 1.5 2015/04/02 09:26:55 msaitoh Exp $*/
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_osdep.h 240466 2012-09-13 14:40:24Z eadler $*/
/*$NetBSD: ixgbe_osdep.h,v 1.6 2015/04/14 07:17:06 msaitoh Exp $*/
#ifndef _IXGBE_OS_H_
#define _IXGBE_OS_H_
@ -67,12 +67,17 @@
#define DEBUGOUT1(S,A) printf(S "\n",A)
#define DEBUGOUT2(S,A,B) printf(S "\n",A,B)
#define DEBUGOUT3(S,A,B,C) printf(S "\n",A,B,C)
#define DEBUGOUT4(S,A,B,C,D) printf(S "\n",A,B,C,D)
#define DEBUGOUT5(S,A,B,C,D,E) printf(S "\n",A,B,C,D,E)
#define DEBUGOUT6(S,A,B,C,D,E,F) printf(S "\n",A,B,C,D,E,F)
#define DEBUGOUT7(S,A,B,C,D,E,F,G) printf(S "\n",A,B,C,D,E,F,G)
#else
#define DEBUGOUT(S) do { } while (/*CONSTCOND*/false)
#define DEBUGOUT1(S,A) do { } while (/*CONSTCOND*/false)
#define DEBUGOUT2(S,A,B) do { } while (/*CONSTCOND*/false)
#define DEBUGOUT3(S,A,B,C) do { } while (/*CONSTCOND*/false)
#define DEBUGOUT4(S,A,B,C,D) do { } while (/*CONSTCOND*/false)
#define DEBUGOUT5(S,A,B,C,D,E) do { } while (/*CONSTCOND*/false)
#define DEBUGOUT6(S,A,B,C,D,E,F) \
do { } while (/*CONSTCOND*/false)
#define DEBUGOUT7(S,A,B,C,D,E,F,G) \
@ -132,6 +137,25 @@ void prefetch(void *x)
#define prefetch(x)
#endif
/*
* Optimized bcopy thanks to Luigi Rizzo's investigative work. Assumes
* non-overlapping regions and 32-byte padding on both src and dst.
*/
static __inline int
ixgbe_bcopy(void *_src, void *_dst, int l)
{
uint64_t *src = _src;
uint64_t *dst = _dst;
for (; l > 0; l -= 32) {
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
*dst++ = *src++;
}
return (0);
}
struct ixgbe_osdep
{
struct ethercom ec;

View File

@ -30,8 +30,8 @@
POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
/*$FreeBSD: head/sys/dev/ixgbe/ixv.c 238149 2012-07-05 20:51:44Z jfv $*/
/*$NetBSD: ixv.c,v 1.6 2015/04/02 09:26:55 msaitoh Exp $*/
/*$FreeBSD: head/sys/dev/ixgbe/ixv.c 241917 2012-10-22 22:29:48Z eadler $*/
/*$NetBSD: ixv.c,v 1.7 2015/04/14 07:17:06 msaitoh Exp $*/
#include "opt_inet.h"
#include "opt_inet6.h"
@ -706,7 +706,9 @@ ixv_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m)
break;
}
enqueued++;
drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags);
ifp->if_obytes += next->m_pkthdr.len;
if (next->m_flags & M_MCAST)
ifp->if_omcasts++;
/* Send a copy of the frame to the BPF listener */
ETHER_BPF_MTAP(ifp, next);
if ((ifp->if_flags & IFF_RUNNING) == 0)