View | Details | Raw Unified | Return to bug 194234 | Differences between
and this patch

Collapse All | Expand All

(-)LICENSE (-1 / +1 lines)
Lines 1-6 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
2
3
  Copyright (c) 2001-2013, Intel Corporation 
3
  Copyright (c) 2001-2014, Intel Corporation 
4
  All rights reserved.
4
  All rights reserved.
5
  
5
  
6
  Redistribution and use in source and binary forms, with or without 
6
  Redistribution and use in source and binary forms, with or without 
(-)ixgbe.c (-49 / +79 lines)
Lines 1-6 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
2
3
  Copyright (c) 2001-2013, Intel Corporation 
3
  Copyright (c) 2001-2014, Intel Corporation 
4
  All rights reserved.
4
  All rights reserved.
5
  
5
  
6
  Redistribution and use in source and binary forms, with or without 
6
  Redistribution and use in source and binary forms, with or without 
Lines 33-41 Link Here
33
/*$FreeBSD$*/
33
/*$FreeBSD$*/
34
34
35
35
36
#ifndef IXGBE_LEGACY_BUILD
36
#include "opt_inet.h"
37
#include "opt_inet.h"
37
#include "opt_inet6.h"
38
#include "opt_inet6.h"
38
#include "opt_rss.h"
39
#include "opt_rss.h"
40
#endif
41
39
#include "ixgbe.h"
42
#include "ixgbe.h"
40
43
41
#ifdef	RSS
44
#ifdef	RSS
Lines 50-56 Link Here
50
/*********************************************************************
53
/*********************************************************************
51
 *  Driver version
54
 *  Driver version
52
 *********************************************************************/
55
 *********************************************************************/
53
char ixgbe_driver_version[] = "2.5.15";
56
char ixgbe_driver_version[] = "2.5.28";
54
57
55
/*********************************************************************
58
/*********************************************************************
56
 *  PCI Device ID Table
59
 *  PCI Device ID Table
Lines 87-93 Link Here
87
	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0},
90
	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0},
88
	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599EN_SFP, 0, 0, 0},
91
	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599EN_SFP, 0, 0, 0},
89
	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF_QP, 0, 0, 0},
92
	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF_QP, 0, 0, 0},
93
	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_QSFP_SF_QP, 0, 0, 0},
90
	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T, 0, 0, 0},
94
	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T, 0, 0, 0},
95
	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T1, 0, 0, 0},
91
	/* required last entry */
96
	/* required last entry */
92
	{0, 0, 0, 0, 0}
97
	{0, 0, 0, 0, 0}
93
};
98
};
Lines 114-126 Link Here
114
static int	ixgbe_mq_start(struct ifnet *, struct mbuf *);
119
static int	ixgbe_mq_start(struct ifnet *, struct mbuf *);
115
static int	ixgbe_mq_start_locked(struct ifnet *, struct tx_ring *);
120
static int	ixgbe_mq_start_locked(struct ifnet *, struct tx_ring *);
116
static void	ixgbe_qflush(struct ifnet *);
121
static void	ixgbe_qflush(struct ifnet *);
122
#endif /* IXGBE_LEGACY_TX */
117
static void	ixgbe_deferred_mq_start(void *, int);
123
static void	ixgbe_deferred_mq_start(void *, int);
118
#endif /* IXGBE_LEGACY_TX */
119
static int      ixgbe_ioctl(struct ifnet *, u_long, caddr_t);
124
static int      ixgbe_ioctl(struct ifnet *, u_long, caddr_t);
120
static void	ixgbe_init(void *);
125
static void	ixgbe_init(void *);
121
static void	ixgbe_init_locked(struct adapter *);
126
static void	ixgbe_init_locked(struct adapter *);
122
static void     ixgbe_stop(void *);
127
static void     ixgbe_stop(void *);
128
#if __FreeBSD_version >= 1100036
123
static uint64_t	ixgbe_get_counter(struct ifnet *, ift_counter);
129
static uint64_t	ixgbe_get_counter(struct ifnet *, ift_counter);
130
#endif
124
static void     ixgbe_media_status(struct ifnet *, struct ifmediareq *);
131
static void     ixgbe_media_status(struct ifnet *, struct ifmediareq *);
125
static int      ixgbe_media_change(struct ifnet *);
132
static int      ixgbe_media_change(struct ifnet *);
126
static void     ixgbe_identify_hardware(struct adapter *);
133
static void     ixgbe_identify_hardware(struct adapter *);
Lines 504-510 Link Here
504
	** system mbuf allocation. Tuning nmbclusters
511
	** system mbuf allocation. Tuning nmbclusters
505
	** can alleviate this.
512
	** can alleviate this.
506
	*/
513
	*/
507
	if (nmbclusters > 0 ) {
514
	if (nmbclusters > 0) {
508
		int s;
515
		int s;
509
		s = (ixgbe_rxd * adapter->num_queues) * ixgbe_total_ports;
516
		s = (ixgbe_rxd * adapter->num_queues) * ixgbe_total_ports;
510
		if (s > nmbclusters) {
517
		if (s > nmbclusters) {
Lines 665-670 Link Here
665
		return (EBUSY);
672
		return (EBUSY);
666
	}
673
	}
667
674
675
	/* Prevent new requests from coming in */
676
	ether_ifdetach(adapter->ifp);
677
668
	IXGBE_CORE_LOCK(adapter);
678
	IXGBE_CORE_LOCK(adapter);
669
	ixgbe_stop(adapter);
679
	ixgbe_stop(adapter);
670
	IXGBE_CORE_UNLOCK(adapter);
680
	IXGBE_CORE_UNLOCK(adapter);
Lines 701-707 Link Here
701
	if (adapter->vlan_detach != NULL)
711
	if (adapter->vlan_detach != NULL)
702
		EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach);
712
		EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach);
703
713
704
	ether_ifdetach(adapter->ifp);
705
	callout_drain(&adapter->timer);
714
	callout_drain(&adapter->timer);
706
#ifdef DEV_NETMAP
715
#ifdef DEV_NETMAP
707
	netmap_detach(adapter->ifp);
716
	netmap_detach(adapter->ifp);
Lines 913-934 Link Here
913
}
922
}
914
923
915
/*
924
/*
916
 * Called from a taskqueue to drain queued transmit packets.
917
 */
918
static void
919
ixgbe_deferred_mq_start(void *arg, int pending)
920
{
921
	struct tx_ring *txr = arg;
922
	struct adapter *adapter = txr->adapter;
923
	struct ifnet *ifp = adapter->ifp;
924
925
	IXGBE_TX_LOCK(txr);
926
	if (!drbr_empty(ifp, txr->br))
927
		ixgbe_mq_start_locked(ifp, txr);
928
	IXGBE_TX_UNLOCK(txr);
929
}
930
931
/*
932
** Flush all ring buffers
925
** Flush all ring buffers
933
*/
926
*/
934
static void
927
static void
Lines 948-953 Link Here
948
}
941
}
949
#endif /* IXGBE_LEGACY_TX */
942
#endif /* IXGBE_LEGACY_TX */
950
943
944
/*
945
 * Called from a taskqueue to drain queued transmit packets.
946
 */
947
static void
948
ixgbe_deferred_mq_start(void *arg, int pending)
949
{
950
	struct tx_ring *txr = arg;
951
	struct adapter *adapter = txr->adapter;
952
	struct ifnet *ifp = adapter->ifp;
953
954
	IXGBE_TX_LOCK(txr);
955
#ifndef IXGBE_LEGACY_TX
956
	if (!drbr_empty(ifp, txr->br))
957
		ixgbe_mq_start_locked(ifp, txr);
958
#else
959
	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
960
		ixgbe_start_locked(txr, ifp);
961
#endif
962
	IXGBE_TX_UNLOCK(txr);
963
}
964
951
/*********************************************************************
965
/*********************************************************************
952
 *  Ioctl entry point
966
 *  Ioctl entry point
953
 *
967
 *
Lines 961-967 Link Here
961
ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data)
975
ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data)
962
{
976
{
963
	struct adapter	*adapter = ifp->if_softc;
977
	struct adapter	*adapter = ifp->if_softc;
964
	struct ixgbe_hw *hw = &adapter->hw;
965
	struct ifreq	*ifr = (struct ifreq *) data;
978
	struct ifreq	*ifr = (struct ifreq *) data;
966
#if defined(INET) || defined(INET6)
979
#if defined(INET) || defined(INET6)
967
	struct ifaddr *ifa = (struct ifaddr *)data;
980
	struct ifaddr *ifa = (struct ifaddr *)data;
Lines 1047-1056 Link Here
1047
		IOCTL_DEBUGOUT("ioctl: SIOCSIFCAP (Set Capabilities)");
1060
		IOCTL_DEBUGOUT("ioctl: SIOCSIFCAP (Set Capabilities)");
1048
		if (mask & IFCAP_HWCSUM)
1061
		if (mask & IFCAP_HWCSUM)
1049
			ifp->if_capenable ^= IFCAP_HWCSUM;
1062
			ifp->if_capenable ^= IFCAP_HWCSUM;
1063
#if __FreeBSD_version > 900505
1050
		if (mask & IFCAP_TSO4)
1064
		if (mask & IFCAP_TSO4)
1051
			ifp->if_capenable ^= IFCAP_TSO4;
1065
			ifp->if_capenable ^= IFCAP_TSO4;
1052
		if (mask & IFCAP_TSO6)
1066
		if (mask & IFCAP_TSO6)
1053
			ifp->if_capenable ^= IFCAP_TSO6;
1067
			ifp->if_capenable ^= IFCAP_TSO6;
1068
#else
1069
		if (mask & IFCAP_TSO)
1070
			ifp->if_capenable ^= IFCAP_TSO;
1071
#endif
1054
		if (mask & IFCAP_LRO)
1072
		if (mask & IFCAP_LRO)
1055
			ifp->if_capenable ^= IFCAP_LRO;
1073
			ifp->if_capenable ^= IFCAP_LRO;
1056
		if (mask & IFCAP_VLAN_HWTAGGING)
1074
		if (mask & IFCAP_VLAN_HWTAGGING)
Lines 1067-1074 Link Here
1067
		VLAN_CAPABILITIES(ifp);
1085
		VLAN_CAPABILITIES(ifp);
1068
		break;
1086
		break;
1069
	}
1087
	}
1088
#if __FreeBSD_version >= 1100036
1070
	case SIOCGI2C:
1089
	case SIOCGI2C:
1071
	{
1090
	{
1091
		struct ixgbe_hw *hw = &adapter->hw;
1072
		struct ifi2creq i2c;
1092
		struct ifi2creq i2c;
1073
		int i;
1093
		int i;
1074
		IOCTL_DEBUGOUT("ioctl: SIOCGI2C (Get I2C Data)");
1094
		IOCTL_DEBUGOUT("ioctl: SIOCGI2C (Get I2C Data)");
Lines 1090-1095 Link Here
1090
		error = copyout(&i2c, ifr->ifr_data, sizeof(i2c));
1110
		error = copyout(&i2c, ifr->ifr_data, sizeof(i2c));
1091
		break;
1111
		break;
1092
	}
1112
	}
1113
#endif
1093
	default:
1114
	default:
1094
		IOCTL_DEBUGOUT1("ioctl: UNKNOWN (0x%X)\n", (int)command);
1115
		IOCTL_DEBUGOUT1("ioctl: UNKNOWN (0x%X)\n", (int)command);
1095
		error = ether_ioctl(ifp, command, data);
1116
		error = ether_ioctl(ifp, command, data);
Lines 1551-1557 Link Here
1551
	IXGBE_TX_LOCK(txr);
1572
	IXGBE_TX_LOCK(txr);
1552
	ixgbe_txeof(txr);
1573
	ixgbe_txeof(txr);
1553
#ifdef IXGBE_LEGACY_TX
1574
#ifdef IXGBE_LEGACY_TX
1554
	if (!IFQ_DRV_IS_EMPTY(ifp->if_snd))
1575
	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
1555
		ixgbe_start_locked(txr, ifp);
1576
		ixgbe_start_locked(txr, ifp);
1556
#else
1577
#else
1557
	if (!drbr_empty(ifp, txr->br))
1578
	if (!drbr_empty(ifp, txr->br))
Lines 2101-2107 Link Here
2101
		else if (txr->queue_status == IXGBE_QUEUE_WORKING)
2122
		else if (txr->queue_status == IXGBE_QUEUE_WORKING)
2102
			taskqueue_enqueue(que->tq, &txr->txq_task);
2123
			taskqueue_enqueue(que->tq, &txr->txq_task);
2103
        }
2124
        }
2104
	/* Only truely watchdog if all queues show hung */
2125
	/* Only truly watchdog if all queues show hung */
2105
        if (hung == adapter->num_queues)
2126
        if (hung == adapter->num_queues)
2106
                goto watchdog;
2127
                goto watchdog;
2107
2128
Lines 2299-2307 Link Here
2299
{
2320
{
2300
	device_t	dev = adapter->dev;
2321
	device_t	dev = adapter->dev;
2301
	struct		ix_queue *que = adapter->queues;
2322
	struct		ix_queue *que = adapter->queues;
2302
#ifndef IXGBE_LEGACY_TX
2323
	struct tx_ring	*txr = adapter->tx_rings;
2303
	struct tx_ring		*txr = adapter->tx_rings;
2304
#endif
2305
	int		error, rid = 0;
2324
	int		error, rid = 0;
2306
2325
2307
	/* MSI RID at 1 */
2326
	/* MSI RID at 1 */
Lines 2321-2329 Link Here
2321
	 * Try allocating a fast interrupt and the associated deferred
2340
	 * Try allocating a fast interrupt and the associated deferred
2322
	 * processing contexts.
2341
	 * processing contexts.
2323
	 */
2342
	 */
2324
#ifndef IXGBE_LEGACY_TX
2325
	TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr);
2343
	TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr);
2326
#endif
2327
	TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que);
2344
	TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que);
2328
	que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT,
2345
	que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT,
2329
            taskqueue_thread_enqueue, &que->tq);
2346
            taskqueue_thread_enqueue, &que->tq);
Lines 2354-2360 Link Here
2354
		return (error);
2371
		return (error);
2355
	}
2372
	}
2356
	/* For simplicity in the handlers */
2373
	/* For simplicity in the handlers */
2357
	adapter->que_mask = IXGBE_EIMS_ENABLE_MASK;
2374
	adapter->active_queues = IXGBE_EIMS_ENABLE_MASK;
2358
2375
2359
	return (0);
2376
	return (0);
2360
}
2377
}
Lines 2420-2426 Link Here
2420
		bus_describe_intr(dev, que->res, que->tag, "que %d", i);
2437
		bus_describe_intr(dev, que->res, que->tag, "que %d", i);
2421
#endif
2438
#endif
2422
		que->msix = vector;
2439
		que->msix = vector;
2423
        	adapter->que_mask |= (u64)(1 << que->msix);
2440
		adapter->active_queues |= (u64)(1 << que->msix);
2424
#ifdef	RSS
2441
#ifdef	RSS
2425
		/*
2442
		/*
2426
		 * The queue ID is used as the RSS layer bucket ID.
2443
		 * The queue ID is used as the RSS layer bucket ID.
Lines 2452-2461 Link Here
2452
		    i, cpu_id);
2469
		    i, cpu_id);
2453
#endif
2470
#endif
2454
2471
2455
2456
#ifndef IXGBE_LEGACY_TX
2457
		TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr);
2472
		TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr);
2458
#endif
2459
		TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que);
2473
		TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que);
2460
		que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT,
2474
		que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT,
2461
		    taskqueue_thread_enqueue, &que->tq);
2475
		    taskqueue_thread_enqueue, &que->tq);
Lines 2722-2728 Link Here
2722
	ifp->if_softc = adapter;
2736
	ifp->if_softc = adapter;
2723
	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
2737
	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
2724
	ifp->if_ioctl = ixgbe_ioctl;
2738
	ifp->if_ioctl = ixgbe_ioctl;
2725
	ifp->if_get_counter = ixgbe_get_counter;
2739
#if __FreeBSD_version >= 1100036
2740
	if_setgetcounterfn(ifp, ixgbe_get_counter);
2741
#endif
2726
#ifndef IXGBE_LEGACY_TX
2742
#ifndef IXGBE_LEGACY_TX
2727
	ifp->if_transmit = ixgbe_mq_start;
2743
	ifp->if_transmit = ixgbe_mq_start;
2728
	ifp->if_qflush = ixgbe_qflush;
2744
	ifp->if_qflush = ixgbe_qflush;
Lines 3216-3222 Link Here
3216
3232
3217
	for (int i = 0; i < adapter->num_queues; i++, txr++) {
3233
	for (int i = 0; i < adapter->num_queues; i++, txr++) {
3218
		u64	tdba = txr->txdma.dma_paddr;
3234
		u64	tdba = txr->txdma.dma_paddr;
3219
		u32	txctrl;
3235
		u32	txctrl = 0;
3220
3236
3221
		IXGBE_WRITE_REG(hw, IXGBE_TDBAL(i),
3237
		IXGBE_WRITE_REG(hw, IXGBE_TDBAL(i),
3222
		       (tdba & 0x00000000ffffffffULL));
3238
		       (tdba & 0x00000000ffffffffULL));
Lines 3336-3342 Link Here
3336
			tx_buffer->map = NULL;
3352
			tx_buffer->map = NULL;
3337
		}
3353
		}
3338
	}
3354
	}
3339
#ifdef IXGBE_LEGACY_TX
3355
#ifndef IXGBE_LEGACY_TX
3340
	if (txr->br != NULL)
3356
	if (txr->br != NULL)
3341
		buf_ring_free(txr->br, M_DEVBUF);
3357
		buf_ring_free(txr->br, M_DEVBUF);
3342
#endif
3358
#endif
Lines 5382-5387 Link Here
5382
{
5398
{
5383
	struct ixgbe_hw *hw = &adapter->hw;
5399
	struct ixgbe_hw *hw = &adapter->hw;
5384
	u32  missed_rx = 0, bprc, lxon, lxoff, total;
5400
	u32  missed_rx = 0, bprc, lxon, lxoff, total;
5401
	u64  total_missed_rx = 0;
5385
5402
5386
	adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS);
5403
	adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS);
5387
	adapter->stats.illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
5404
	adapter->stats.illerrc += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
Lines 5400-5405 Link Here
5400
		missed_rx += mp;
5417
		missed_rx += mp;
5401
		/* global total per queue */
5418
		/* global total per queue */
5402
        	adapter->stats.mpc[i] += mp;
5419
        	adapter->stats.mpc[i] += mp;
5420
		/* Total for stats display */
5421
		total_missed_rx += adapter->stats.mpc[i];
5403
		if (hw->mac.type == ixgbe_mac_82598EB) {
5422
		if (hw->mac.type == ixgbe_mac_82598EB) {
5404
			adapter->stats.rnbc[i] +=
5423
			adapter->stats.rnbc[i] +=
5405
			    IXGBE_READ_REG(hw, IXGBE_RNBC(i));
5424
			    IXGBE_READ_REG(hw, IXGBE_RNBC(i));
Lines 5509-5550 Link Here
5509
		adapter->stats.fcoedwrc += IXGBE_READ_REG(hw, IXGBE_FCOEDWRC);
5528
		adapter->stats.fcoedwrc += IXGBE_READ_REG(hw, IXGBE_FCOEDWRC);
5510
		adapter->stats.fcoedwtc += IXGBE_READ_REG(hw, IXGBE_FCOEDWTC);
5529
		adapter->stats.fcoedwtc += IXGBE_READ_REG(hw, IXGBE_FCOEDWTC);
5511
	}
5530
	}
5531
5532
	/* Fill out the OS statistics structure */
5533
	IXGBE_SET_IPACKETS(adapter, adapter->stats.gprc);
5534
	IXGBE_SET_OPACKETS(adapter, adapter->stats.gptc);
5535
	IXGBE_SET_IBYTES(adapter, adapter->stats.gorc);
5536
	IXGBE_SET_OBYTES(adapter, adapter->stats.gotc);
5537
	IXGBE_SET_IMCASTS(adapter, adapter->stats.mprc);
5538
	IXGBE_SET_OMCASTS(adapter, adapter->stats.mptc);
5539
	IXGBE_SET_COLLISIONS(adapter, 0);
5540
	IXGBE_SET_IQDROPS(adapter, total_missed_rx);
5541
	IXGBE_SET_IERRORS(adapter, adapter->stats.crcerrs
5542
	    + adapter->stats.rlec);
5512
}
5543
}
5513
5544
5545
#if __FreeBSD_version >= 1100036
5514
static uint64_t
5546
static uint64_t
5515
ixgbe_get_counter(struct ifnet *ifp, ift_counter cnt)
5547
ixgbe_get_counter(struct ifnet *ifp, ift_counter cnt)
5516
{
5548
{
5517
	struct adapter *adapter;
5549
	struct adapter *adapter;
5518
	uint64_t rv;
5519
5550
5520
	adapter = if_getsoftc(ifp);
5551
	adapter = if_getsoftc(ifp);
5521
5552
5522
	switch (cnt) {
5553
	switch (cnt) {
5523
	case IFCOUNTER_IPACKETS:
5554
	case IFCOUNTER_IPACKETS:
5524
		return (adapter->stats.gprc);
5555
		return (adapter->ipackets);
5525
	case IFCOUNTER_OPACKETS:
5556
	case IFCOUNTER_OPACKETS:
5526
		return (adapter->stats.gptc);
5557
		return (adapter->opackets);
5527
	case IFCOUNTER_IBYTES:
5558
	case IFCOUNTER_IBYTES:
5528
		return (adapter->stats.gorc);
5559
		return (adapter->ibytes);
5529
	case IFCOUNTER_OBYTES:
5560
	case IFCOUNTER_OBYTES:
5530
		return (adapter->stats.gotc);
5561
		return (adapter->obytes);
5531
	case IFCOUNTER_IMCASTS:
5562
	case IFCOUNTER_IMCASTS:
5532
		return (adapter->stats.mprc);
5563
		return (adapter->imcasts);
5533
	case IFCOUNTER_OMCASTS:
5564
	case IFCOUNTER_OMCASTS:
5534
		return (adapter->stats.mptc);
5565
		return (adapter->omcasts);
5535
	case IFCOUNTER_COLLISIONS:
5566
	case IFCOUNTER_COLLISIONS:
5536
		return (0);
5567
		return (0);
5537
	case IFCOUNTER_IQDROPS:
5568
	case IFCOUNTER_IQDROPS:
5538
		rv = 0;
5569
		return (adapter->iqdrops);
5539
		for (int i = 0; i < 8; i++)
5540
			rv += adapter->stats.mpc[i];
5541
		return (rv);
5542
	case IFCOUNTER_IERRORS:
5570
	case IFCOUNTER_IERRORS:
5543
		return (adapter->stats.crcerrs + adapter->stats.rlec);
5571
		return (adapter->ierrors);
5544
	default:
5572
	default:
5545
		return (if_get_counter_default(ifp, cnt));
5573
		return (if_get_counter_default(ifp, cnt));
5546
	}
5574
	}
5547
}
5575
}
5576
#endif
5548
5577
5549
/** ixgbe_sysctl_tdh_handler - Handler function
5578
/** ixgbe_sysctl_tdh_handler - Handler function
5550
 *  Retrieves the TDH value from the hardware
5579
 *  Retrieves the TDH value from the hardware
Lines 6056-6058 Link Here
6056
        	IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(i), srrctl);
6085
        	IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(i), srrctl);
6057
	}
6086
	}
6058
}
6087
}
6088
(-)ixgbe.h (-3 / +55 lines)
Lines 1-6 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
2
3
  Copyright (c) 2001-2013, Intel Corporation 
3
  Copyright (c) 2001-2014, Intel Corporation 
4
  All rights reserved.
4
  All rights reserved.
5
  
5
  
6
  Redistribution and use in source and binary forms, with or without 
6
  Redistribution and use in source and binary forms, with or without 
Lines 204-209 Link Here
204
#define CSUM_OFFLOAD		(CSUM_IP|CSUM_TCP|CSUM_UDP)
204
#define CSUM_OFFLOAD		(CSUM_IP|CSUM_TCP|CSUM_UDP)
205
#endif
205
#endif
206
206
207
/* Backward compatibility items for very old versions */
208
#ifndef pci_find_cap
209
#define pci_find_cap pci_find_extcap
210
#endif
211
212
#ifndef DEVMETHOD_END
213
#define DEVMETHOD_END { NULL, NULL }
214
#endif
215
207
/*
216
/*
208
 * Interrupt Moderation parameters 
217
 * Interrupt Moderation parameters 
209
 */
218
 */
Lines 300-308 Link Here
300
	u32			txd_cmd;
309
	u32			txd_cmd;
301
	bus_dma_tag_t		txtag;
310
	bus_dma_tag_t		txtag;
302
	char			mtx_name[16];
311
	char			mtx_name[16];
312
	struct task		txq_task;
303
#ifndef IXGBE_LEGACY_TX
313
#ifndef IXGBE_LEGACY_TX
304
	struct buf_ring		*br;
314
	struct buf_ring		*br;
305
	struct task		txq_task;
306
#endif
315
#endif
307
#ifdef IXGBE_FDIR
316
#ifdef IXGBE_FDIR
308
	u16			atr_sample;
317
	u16			atr_sample;
Lines 441-447 Link Here
441
	 *	Allocated at run time, an array of rings.
450
	 *	Allocated at run time, an array of rings.
442
	 */
451
	 */
443
	struct rx_ring		*rx_rings;
452
	struct rx_ring		*rx_rings;
444
	u64			que_mask;
453
	u64			active_queues;
445
	u32			num_rx_desc;
454
	u32			num_rx_desc;
446
455
447
	/* Multicast array memory */
456
	/* Multicast array memory */
Lines 457-462 Link Here
457
	unsigned long		link_irq;
466
	unsigned long		link_irq;
458
467
459
	struct ixgbe_hw_stats 	stats;
468
	struct ixgbe_hw_stats 	stats;
469
470
#if __FreeBSD_version >= 1100036
471
	/* FreeBSD counter(9) stats */
472
	u64			ipackets;
473
	u64			ierrors;
474
	u64			opackets;
475
	u64			oerrors;
476
	u64			ibytes;
477
	u64			obytes;
478
	u64			imcasts;
479
	u64			omcasts;
480
	u64			iqdrops;
481
	u64			noproto;
482
#endif
460
};
483
};
461
484
462
485
Lines 487-492 Link Here
487
#define PCIER_LINK_STA PCIR_EXPRESS_LINK_STA
510
#define PCIER_LINK_STA PCIR_EXPRESS_LINK_STA
488
#endif
511
#endif
489
512
513
/* Stats macros */
514
#if __FreeBSD_version >= 1100036
515
#define IXGBE_SET_IPACKETS(sc, count)    (sc)->ipackets = (count)
516
#define IXGBE_SET_IERRORS(sc, count)     (sc)->ierrors = (count)
517
#define IXGBE_SET_OPACKETS(sc, count)    (sc)->opackets = (count)
518
#define IXGBE_SET_OERRORS(sc, count)     (sc)->oerrors = (count)
519
#define IXGBE_SET_COLLISIONS(sc, count)
520
#define IXGBE_SET_IBYTES(sc, count)      (sc)->ibytes = (count)
521
#define IXGBE_SET_OBYTES(sc, count)      (sc)->obytes = (count)
522
#define IXGBE_SET_IMCASTS(sc, count)     (sc)->imcasts = (count)
523
#define IXGBE_SET_OMCASTS(sc, count)     (sc)->omcasts = (count)
524
#define IXGBE_SET_IQDROPS(sc, count)     (sc)->iqdrops = (count)
525
#else
526
#define IXGBE_SET_IPACKETS(sc, count)    (sc)->ifp->if_ipackets = (count)
527
#define IXGBE_SET_IERRORS(sc, count)     (sc)->ifp->if_ierrors = (count)
528
#define IXGBE_SET_OPACKETS(sc, count)    (sc)->ifp->if_opackets = (count)
529
#define IXGBE_SET_OERRORS(sc, count)     (sc)->ifp->if_oerrors = (count)
530
#define IXGBE_SET_COLLISIONS(sc, count)  (sc)->ifp->if_collisions = (count)
531
#define IXGBE_SET_IBYTES(sc, count)      (sc)->ifp->if_ibytes = (count)
532
#define IXGBE_SET_OBYTES(sc, count)      (sc)->ifp->if_obytes = (count)
533
#define IXGBE_SET_IMCASTS(sc, count)     (sc)->ifp->if_imcasts = (count)
534
#define IXGBE_SET_OMCASTS(sc, count)     (sc)->ifp->if_omcasts = (count)
535
#define IXGBE_SET_IQDROPS(sc, count)     (sc)->ifp->if_iqdrops = (count)
536
#endif
537
490
static inline bool
538
static inline bool
491
ixgbe_is_sfp(struct ixgbe_hw *hw)
539
ixgbe_is_sfp(struct ixgbe_hw *hw)
492
{
540
{
Lines 497-502 Link Here
497
	case ixgbe_phy_sfp_unknown:
545
	case ixgbe_phy_sfp_unknown:
498
	case ixgbe_phy_sfp_passive_tyco:
546
	case ixgbe_phy_sfp_passive_tyco:
499
	case ixgbe_phy_sfp_passive_unknown:
547
	case ixgbe_phy_sfp_passive_unknown:
548
	case ixgbe_phy_qsfp_passive_unknown:
549
	case ixgbe_phy_qsfp_active_unknown:
550
	case ixgbe_phy_qsfp_intel:
551
	case ixgbe_phy_qsfp_unknown:
500
		return TRUE;
552
		return TRUE;
501
	default:
553
	default:
502
		return FALSE;
554
		return FALSE;
(-)ixgbe_osdep.h (-4 / +5 lines)
Lines 1-6 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
2
3
  Copyright (c) 2001-2013, Intel Corporation 
3
  Copyright (c) 2001-2014, Intel Corporation 
4
  All rights reserved.
4
  All rights reserved.
5
  
5
  
6
  Redistribution and use in source and binary forms, with or without 
6
  Redistribution and use in source and binary forms, with or without 
Lines 108-120 Link Here
108
#define UNREFERENCED_3PARAMETER(_p, _q, _r)
108
#define UNREFERENCED_3PARAMETER(_p, _q, _r)
109
#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s)
109
#define UNREFERENCED_4PARAMETER(_p, _q, _r, _s)
110
110
111
112
#define IXGBE_NTOHL(_i)	ntohl(_i)
111
#define IXGBE_NTOHL(_i)	ntohl(_i)
113
#define IXGBE_NTOHS(_i)	ntohs(_i)
112
#define IXGBE_NTOHS(_i)	ntohs(_i)
114
113
115
/* XXX these need to be revisited */
114
/* XXX these need to be revisited */
116
#define IXGBE_CPU_TO_LE32 le32toh
115
#define IXGBE_CPU_TO_LE32 htole32
117
#define IXGBE_LE32_TO_CPUS le32dec
116
#define IXGBE_LE32_TO_CPUS(x)
117
#define IXGBE_CPU_TO_BE16 htobe16
118
#define IXGBE_CPU_TO_BE32 htobe32
118
119
119
typedef uint8_t		u8;
120
typedef uint8_t		u8;
120
typedef int8_t		s8;
121
typedef int8_t		s8;
(-)ixv.c (-1 / +9 lines)
Lines 1-6 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
2
3
  Copyright (c) 2001-2013, Intel Corporation 
3
  Copyright (c) 2001-2014, Intel Corporation 
4
  All rights reserved.
4
  All rights reserved.
5
  
5
  
6
  Redistribution and use in source and binary forms, with or without 
6
  Redistribution and use in source and binary forms, with or without 
Lines 634-642 Link Here
634
		}
634
		}
635
		drbr_advance(ifp, txr->br);
635
		drbr_advance(ifp, txr->br);
636
		enqueued++;
636
		enqueued++;
637
#if __FreeBSD_version >= 1100036
637
		if_inc_counter(ifp, IFCOUNTER_OBYTES, next->m_pkthdr.len);
638
		if_inc_counter(ifp, IFCOUNTER_OBYTES, next->m_pkthdr.len);
638
		if (next->m_flags & M_MCAST)
639
		if (next->m_flags & M_MCAST)
639
			if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
640
			if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
641
#endif
640
		/* Send a copy of the frame to the BPF listener */
642
		/* Send a copy of the frame to the BPF listener */
641
		ETHER_BPF_MTAP(ifp, next);
643
		ETHER_BPF_MTAP(ifp, next);
642
		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
644
		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
Lines 2651-2657 Link Here
2651
			tx_desc =
2653
			tx_desc =
2652
			    (struct ixgbe_legacy_tx_desc *)&txr->tx_base[first];
2654
			    (struct ixgbe_legacy_tx_desc *)&txr->tx_base[first];
2653
		}
2655
		}
2656
#if __FreeBSD_version >= 1100036
2654
		if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
2657
		if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
2658
#endif
2655
		/* See if there is more work now */
2659
		/* See if there is more work now */
2656
		last = tx_buffer->eop_index;
2660
		last = tx_buffer->eop_index;
2657
		if (last != -1) {
2661
		if (last != -1) {
Lines 3341-3347 Link Here
3341
		/* Make sure all parts of a bad packet are discarded */
3345
		/* Make sure all parts of a bad packet are discarded */
3342
		if (((staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) ||
3346
		if (((staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) ||
3343
		    (rxr->discard)) {
3347
		    (rxr->discard)) {
3348
#if __FreeBSD_version >= 1100036
3344
			if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
3349
			if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
3350
#endif
3345
			rxr->rx_discarded++;
3351
			rxr->rx_discarded++;
3346
			if (!eop)
3352
			if (!eop)
3347
				rxr->discard = TRUE;
3353
				rxr->discard = TRUE;
Lines 3455-3461 Link Here
3455
		/* Sending this frame? */
3461
		/* Sending this frame? */
3456
		if (eop) {
3462
		if (eop) {
3457
			sendmp->m_pkthdr.rcvif = ifp;
3463
			sendmp->m_pkthdr.rcvif = ifp;
3464
#if __FreeBSD_version >= 1100036
3458
			if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
3465
			if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
3466
#endif
3459
			rxr->rx_packets++;
3467
			rxr->rx_packets++;
3460
			/* capture data for AIM */
3468
			/* capture data for AIM */
3461
			rxr->bytes += sendmp->m_pkthdr.len;
3469
			rxr->bytes += sendmp->m_pkthdr.len;
(-)ixv.h (-1 / +6 lines)
Lines 1-6 Link Here
1
/******************************************************************************
1
/******************************************************************************
2
2
3
  Copyright (c) 2001-2012, Intel Corporation 
3
  Copyright (c) 2001-2014, Intel Corporation 
4
  All rights reserved.
4
  All rights reserved.
5
  
5
  
6
  Redistribution and use in source and binary forms, with or without 
6
  Redistribution and use in source and binary forms, with or without 
Lines 185-190 Link Here
185
#define CSUM_OFFLOAD		(CSUM_IP|CSUM_TCP|CSUM_UDP)
185
#define CSUM_OFFLOAD		(CSUM_IP|CSUM_TCP|CSUM_UDP)
186
#endif
186
#endif
187
187
188
/* Backward compatibility */
189
#ifndef pci_find_cap
190
#define pci_find_cap pci_find_extcap
191
#endif
192
188
/*
193
/*
189
 *****************************************************************************
194
 *****************************************************************************
190
 * vendor_info_array
195
 * vendor_info_array

Return to bug 194234