mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Add quad port probe support, this gives the admin proper information about the slot
(which should be a PCIE Gen 3 slot for this adapter) by looking back thru the PCI parent devices to the slot device. The fix above also corrects the bandwidth display to GT/s rather than the incorrect Gb/s Next, allow the use of ALTQ if you select the compile option IXGBE_LEGACY_TX. Allow the use of 'unsupported' optic modules by a compile option as well. Add a phy reset capability into the stop code, this is so a static configured driver will still behave properly when taken down (not being able to unload it). This revision synchronizes the shared code with Intel internal current code, and note that it now includes DCB supporting code, this was necessitated by some internal changes with the code, but it also will provide the opportunity to develop this feature in the core driver down the road. I have edited the README to get rid of some of the worse anachronisms in it as well, its by no means as robust as I might wish at this point however. Oh, I also have included some conditional stuff in the code so it will be compatible in both the 9.X and 10 environments. Performance has been a focus in recent changes and I believe this revision driver will perform very well in most workloads. MFC after: 2 weeks
This commit is contained in:
parent
1dc72d3681
commit
fd75b91d13
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251964
@ -1685,6 +1685,12 @@ dev/ixgbe/ixgbe_82599.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_x540.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_dcb.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_dcb_82598.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_dcb_82599.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/jme/if_jme.c optional jme pci
|
||||
dev/joy/joy.c optional joy
|
||||
dev/joy/joy_isa.c optional joy isa
|
||||
|
@ -2,7 +2,7 @@ FreeBSD Driver for Intel(R) Ethernet 10 Gigabit PCI Express Server Adapters
|
||||
============================================================================
|
||||
/*$FreeBSD$*/
|
||||
|
||||
November 12, 2010
|
||||
Jun 18, 2013
|
||||
|
||||
|
||||
Contents
|
||||
@ -18,8 +18,8 @@ Contents
|
||||
Overview
|
||||
========
|
||||
|
||||
This file describes the FreeBSD* driver for the Intel(R) Ethernet 10 Gigabit
|
||||
Family of Adapters. Driver has been developed for use with FreeBSD 7.2 or later.
|
||||
This file describes the FreeBSD* driver for the
|
||||
Intel(R) Ethernet 10 Gigabit Family of Adapters.
|
||||
|
||||
For questions related to hardware requirements, refer to the documentation
|
||||
supplied with your Intel 10GbE adapter. All hardware requirements listed
|
||||
@ -42,7 +42,7 @@ optics, or is an Intel(R) Ethernet Server Adapter X520-2, then it only supports
|
||||
Intel optics and/or the direct attach cables listed below.
|
||||
|
||||
When 82599-based SFP+ devices are connected back to back, they should be set to
|
||||
the same Speed setting via Ethtool. Results may vary if you mix speed settings.
|
||||
the same Speed setting. Results may vary if you mix speed settings.
|
||||
|
||||
Supplier Type Part Numbers
|
||||
|
||||
@ -70,7 +70,12 @@ Finisar DUAL RATE 1G/10G SFP+ LR (No Bail) FTLX1471D3QCV-IT
|
||||
Avago DUAL RATE 1G/10G SFP+ LR (No Bail) AFCT-701SDZ-IN1
|
||||
Finistar 1000BASE-T SFP FCLF8522P2BTL
|
||||
Avago 1000BASE-T SFP ABCU-5710RZ
|
||||
|
||||
|
||||
NOTE: As of driver version 2.5.13 it is possible to allow the operation
|
||||
of unsupported modules by setting the static variable 'allow_unsupported_sfp'
|
||||
to TRUE and rebuilding the driver. If problems occur please assure that they
|
||||
can be reproduced with fully supported optics first.
|
||||
|
||||
82599-based adapters support all passive and active limiting direct attach
|
||||
cables that comply with SFF-8431 v4.1 and SFF-8472 v10.4 specifications.
|
||||
|
||||
@ -224,14 +229,7 @@ all 10 Gigabit adapters.
|
||||
When there is a choice run on a 64bit OS rather than 32, it makes a
|
||||
significant difference in improvement.
|
||||
|
||||
The default scheduler SCHED_4BSD is not smart about SMP locality issues.
|
||||
Significant improvement can be achieved by switching to the ULE scheduler.
|
||||
|
||||
This is done by changing the entry in the config file from SCHED_4BSD to
|
||||
SCHED_ULE. Note that this is only advisable on FreeBSD 7, on 6.X there have
|
||||
been stability problems with ULE.
|
||||
|
||||
The interface can generate high number of interrupts. To avoid running
|
||||
The interface can generate a high number of interrupts. To avoid running
|
||||
into the limit set by the kernel, adjust hw.intr_storm_threshold
|
||||
setting using sysctl:
|
||||
|
||||
@ -242,12 +240,10 @@ all 10 Gigabit adapters.
|
||||
hw.intr_storm_threshold=9000
|
||||
|
||||
If you still see Interrupt Storm detected messages, increase the limit to a
|
||||
higher number.
|
||||
higher number, or the detection can be disabled by setting it to 0.
|
||||
|
||||
Best throughput results are seen with a large MTU; use 9000 if possible.
|
||||
|
||||
The default number of descriptors is 1024, increasing this to 2K or even
|
||||
4K may improve performance in some workloads, but change carefully.
|
||||
The default number of descriptors is 2048, increasing or descreasing
|
||||
may improve performance in some workloads, but change carefully.
|
||||
|
||||
|
||||
Known Limitations
|
||||
@ -284,7 +280,7 @@ issues download your adapter's user guide and read the Release Notes.
|
||||
----------------------------------------------------------
|
||||
Some PCI-E x8 slots are actually configured as x4 slots. These slots have
|
||||
insufficient bandwidth for full 10Gbe line rate with dual port 10GbE devices.
|
||||
The driver can detect this situation and will write the following message in
|
||||
The driver will detect this situation and will write the following message in
|
||||
the system log: "PCI-Express bandwidth available for this card is not
|
||||
sufficient for optimal performance. For optimal performance a x8 PCI-Express
|
||||
slot is required."
|
||||
|
@ -32,6 +32,7 @@
|
||||
******************************************************************************/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
|
||||
#ifdef HAVE_KERNEL_OPTION_HEADERS
|
||||
#include "opt_inet.h"
|
||||
#include "opt_inet6.h"
|
||||
@ -47,7 +48,7 @@ int ixgbe_display_debug_stats = 0;
|
||||
/*********************************************************************
|
||||
* Driver version
|
||||
*********************************************************************/
|
||||
char ixgbe_driver_version[] = "2.5.8 - HEAD";
|
||||
char ixgbe_driver_version[] = "2.5.13";
|
||||
|
||||
/*********************************************************************
|
||||
* PCI Device ID Table
|
||||
@ -109,8 +110,7 @@ static void ixgbe_start(struct ifnet *);
|
||||
static void ixgbe_start_locked(struct tx_ring *, struct ifnet *);
|
||||
#else /* ! IXGBE_LEGACY_TX */
|
||||
static int ixgbe_mq_start(struct ifnet *, struct mbuf *);
|
||||
static int ixgbe_mq_start_locked(struct ifnet *,
|
||||
struct tx_ring *, 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 */
|
||||
@ -122,6 +122,7 @@ static void ixgbe_media_status(struct ifnet *, struct ifmediareq *);
|
||||
static int ixgbe_media_change(struct ifnet *);
|
||||
static void ixgbe_identify_hardware(struct adapter *);
|
||||
static int ixgbe_allocate_pci_resources(struct adapter *);
|
||||
static void ixgbe_get_slot_info(struct ixgbe_hw *);
|
||||
static int ixgbe_allocate_msix(struct adapter *);
|
||||
static int ixgbe_allocate_legacy(struct adapter *);
|
||||
static int ixgbe_allocate_queues(struct adapter *);
|
||||
@ -149,7 +150,7 @@ static void ixgbe_setup_hw_rsc(struct rx_ring *);
|
||||
static void ixgbe_enable_intr(struct adapter *);
|
||||
static void ixgbe_disable_intr(struct adapter *);
|
||||
static void ixgbe_update_stats_counters(struct adapter *);
|
||||
static bool ixgbe_txeof(struct tx_ring *);
|
||||
static void ixgbe_txeof(struct tx_ring *);
|
||||
static bool ixgbe_rxeof(struct ix_queue *);
|
||||
static void ixgbe_rx_checksum(u32, struct mbuf *, u32);
|
||||
static void ixgbe_set_promisc(struct adapter *);
|
||||
@ -206,6 +207,9 @@ static void ixgbe_atr(struct tx_ring *, struct mbuf *);
|
||||
static void ixgbe_reinit_fdir(void *, int);
|
||||
#endif
|
||||
|
||||
/* Missing shared code prototype */
|
||||
extern void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw);
|
||||
|
||||
/*********************************************************************
|
||||
* FreeBSD Device Interface Entry Points
|
||||
*********************************************************************/
|
||||
@ -290,6 +294,13 @@ TUNABLE_INT("hw.ixgbe.txd", &ixgbe_txd);
|
||||
static int ixgbe_rxd = PERFORM_RXD;
|
||||
TUNABLE_INT("hw.ixgbe.rxd", &ixgbe_rxd);
|
||||
|
||||
/*
|
||||
** Defining this on will allow the use
|
||||
** of unsupported SFP+ modules, note that
|
||||
** doing so you are on your own :)
|
||||
*/
|
||||
static int allow_unsupported_sfp = FALSE;
|
||||
|
||||
/*
|
||||
** HW RSC control:
|
||||
** this feature only works with
|
||||
@ -507,6 +518,7 @@ ixgbe_attach(device_t dev)
|
||||
}
|
||||
|
||||
/* Initialize the shared code */
|
||||
hw->allow_unsupported_sfp = allow_unsupported_sfp;
|
||||
error = ixgbe_init_shared_code(hw);
|
||||
if (error == IXGBE_ERR_SFP_NOT_PRESENT) {
|
||||
/*
|
||||
@ -576,24 +588,10 @@ ixgbe_attach(device_t dev)
|
||||
adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig,
|
||||
ixgbe_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST);
|
||||
|
||||
/* Print PCIE bus type/speed/width info */
|
||||
ixgbe_get_bus_info(hw);
|
||||
device_printf(dev,"PCI Express Bus: Speed %s %s\n",
|
||||
((hw->bus.speed == ixgbe_bus_speed_5000) ? "5.0Gb/s":
|
||||
(hw->bus.speed == ixgbe_bus_speed_2500) ? "2.5Gb/s":"Unknown"),
|
||||
(hw->bus.width == ixgbe_bus_width_pcie_x8) ? "Width x8" :
|
||||
(hw->bus.width == ixgbe_bus_width_pcie_x4) ? "Width x4" :
|
||||
(hw->bus.width == ixgbe_bus_width_pcie_x1) ? "Width x1" :
|
||||
("Unknown"));
|
||||
|
||||
if ((hw->bus.width <= ixgbe_bus_width_pcie_x4) &&
|
||||
(hw->bus.speed == ixgbe_bus_speed_2500)) {
|
||||
device_printf(dev, "PCI-Express bandwidth available"
|
||||
" for this card\n is not sufficient for"
|
||||
" optimal performance.\n");
|
||||
device_printf(dev, "For optimal performance a x8 "
|
||||
"PCIE, or x4 PCIE 2 slot is required.\n");
|
||||
}
|
||||
/*
|
||||
** Check PCIE slot type/speed/width
|
||||
*/
|
||||
ixgbe_get_slot_info(hw);
|
||||
|
||||
/* Set an initial default flow control value */
|
||||
adapter->fc = ixgbe_fc_full;
|
||||
@ -797,7 +795,7 @@ ixgbe_mq_start(struct ifnet *ifp, struct mbuf *m)
|
||||
struct adapter *adapter = ifp->if_softc;
|
||||
struct ix_queue *que;
|
||||
struct tx_ring *txr;
|
||||
int i = 0, err = 0;
|
||||
int i, err = 0;
|
||||
|
||||
/* Which queue to use */
|
||||
if ((m->m_flags & M_FLOWID) != 0)
|
||||
@ -808,40 +806,37 @@ ixgbe_mq_start(struct ifnet *ifp, struct mbuf *m)
|
||||
txr = &adapter->tx_rings[i];
|
||||
que = &adapter->queues[i];
|
||||
|
||||
err = drbr_enqueue(ifp, txr->br, m);
|
||||
if (err)
|
||||
return (err);
|
||||
if (IXGBE_TX_TRYLOCK(txr)) {
|
||||
err = ixgbe_mq_start_locked(ifp, txr, m);
|
||||
err = ixgbe_mq_start_locked(ifp, txr);
|
||||
IXGBE_TX_UNLOCK(txr);
|
||||
} else {
|
||||
err = drbr_enqueue(ifp, txr->br, m);
|
||||
} else
|
||||
taskqueue_enqueue(que->tq, &txr->txq_task);
|
||||
}
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
static int
|
||||
ixgbe_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m)
|
||||
ixgbe_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr)
|
||||
{
|
||||
struct adapter *adapter = txr->adapter;
|
||||
struct mbuf *next;
|
||||
int enqueued, err = 0;
|
||||
int enqueued = 0, err = 0;
|
||||
|
||||
if (((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) ||
|
||||
adapter->link_active == 0) {
|
||||
if (m != NULL)
|
||||
err = drbr_enqueue(ifp, txr->br, m);
|
||||
return (err);
|
||||
}
|
||||
|
||||
enqueued = 0;
|
||||
if (m != NULL) {
|
||||
err = drbr_enqueue(ifp, txr->br, m);
|
||||
if (err) {
|
||||
return (err);
|
||||
}
|
||||
}
|
||||
adapter->link_active == 0)
|
||||
return (ENETDOWN);
|
||||
|
||||
/* Process the queue */
|
||||
#if __FreeBSD_version < 901504
|
||||
next = drbr_dequeue(ifp, txr->br);
|
||||
while (next != NULL) {
|
||||
if ((err = ixgbe_xmit(txr, &next)) != 0) {
|
||||
if (next != NULL)
|
||||
err = drbr_enqueue(ifp, txr->br, next);
|
||||
#else
|
||||
while ((next = drbr_peek(ifp, txr->br)) != NULL) {
|
||||
if ((err = ixgbe_xmit(txr, &next)) != 0) {
|
||||
if (next == NULL) {
|
||||
@ -849,16 +844,20 @@ ixgbe_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m)
|
||||
} else {
|
||||
drbr_putback(ifp, txr->br, next);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#if __FreeBSD_version >= 901504
|
||||
drbr_advance(ifp, txr->br);
|
||||
#endif
|
||||
enqueued++;
|
||||
/* Send a copy of the frame to the BPF listener */
|
||||
ETHER_BPF_MTAP(ifp, next);
|
||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
|
||||
break;
|
||||
if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD)
|
||||
ixgbe_txeof(txr);
|
||||
#if __FreeBSD_version < 901504
|
||||
next = drbr_dequeue(ifp, txr->br);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (enqueued > 0) {
|
||||
@ -885,7 +884,7 @@ ixgbe_deferred_mq_start(void *arg, int pending)
|
||||
|
||||
IXGBE_TX_LOCK(txr);
|
||||
if (!drbr_empty(ifp, txr->br))
|
||||
ixgbe_mq_start_locked(ifp, txr, NULL);
|
||||
ixgbe_mq_start_locked(ifp, txr);
|
||||
IXGBE_TX_UNLOCK(txr);
|
||||
}
|
||||
|
||||
@ -1418,20 +1417,19 @@ ixgbe_handle_que(void *context, int pending)
|
||||
ixgbe_txeof(txr);
|
||||
#ifndef IXGBE_LEGACY_TX
|
||||
if (!drbr_empty(ifp, txr->br))
|
||||
ixgbe_mq_start_locked(ifp, txr, NULL);
|
||||
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);
|
||||
if (more) {
|
||||
taskqueue_enqueue(que->tq, &que->que_task);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reenable this interrupt */
|
||||
ixgbe_enable_queue(adapter, que->msix);
|
||||
if (que->res != NULL)
|
||||
ixgbe_enable_queue(adapter, que->msix);
|
||||
else
|
||||
ixgbe_enable_intr(adapter);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1448,9 +1446,10 @@ ixgbe_legacy_irq(void *arg)
|
||||
struct ix_queue *que = arg;
|
||||
struct adapter *adapter = que->adapter;
|
||||
struct ixgbe_hw *hw = &adapter->hw;
|
||||
struct ifnet *ifp = adapter->ifp;
|
||||
struct tx_ring *txr = adapter->tx_rings;
|
||||
bool more_tx, more_rx;
|
||||
u32 reg_eicr, loop = MAX_LOOP;
|
||||
bool more;
|
||||
u32 reg_eicr;
|
||||
|
||||
|
||||
reg_eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
|
||||
@ -1461,17 +1460,19 @@ ixgbe_legacy_irq(void *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
more_rx = ixgbe_rxeof(que);
|
||||
more = ixgbe_rxeof(que);
|
||||
|
||||
IXGBE_TX_LOCK(txr);
|
||||
do {
|
||||
more_tx = ixgbe_txeof(txr);
|
||||
} while (loop-- && more_tx);
|
||||
ixgbe_txeof(txr);
|
||||
#ifdef IXGBE_LEGACY_TX
|
||||
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
|
||||
ixgbe_start_locked(txr, ifp);
|
||||
#else
|
||||
if (!drbr_empty(ifp, txr->br))
|
||||
ixgbe_mq_start_locked(ifp, txr);
|
||||
#endif
|
||||
IXGBE_TX_UNLOCK(txr);
|
||||
|
||||
if (more_rx || more_tx)
|
||||
taskqueue_enqueue(que->tq, &que->que_task);
|
||||
|
||||
/* Check for fan failure */
|
||||
if ((hw->phy.media_type == ixgbe_media_type_copper) &&
|
||||
(reg_eicr & IXGBE_EICR_GPI_SDP1)) {
|
||||
@ -1484,7 +1485,10 @@ ixgbe_legacy_irq(void *arg)
|
||||
if (reg_eicr & IXGBE_EICR_LSC)
|
||||
taskqueue_enqueue(adapter->tq, &adapter->link_task);
|
||||
|
||||
ixgbe_enable_intr(adapter);
|
||||
if (more)
|
||||
taskqueue_enqueue(que->tq, &que->que_task);
|
||||
else
|
||||
ixgbe_enable_intr(adapter);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1499,29 +1503,26 @@ ixgbe_msix_que(void *arg)
|
||||
{
|
||||
struct ix_queue *que = arg;
|
||||
struct adapter *adapter = que->adapter;
|
||||
struct ifnet *ifp = adapter->ifp;
|
||||
struct tx_ring *txr = que->txr;
|
||||
struct rx_ring *rxr = que->rxr;
|
||||
bool more_tx, more_rx;
|
||||
bool more;
|
||||
u32 newitr = 0;
|
||||
|
||||
ixgbe_disable_queue(adapter, que->msix);
|
||||
++que->irqs;
|
||||
|
||||
more_rx = ixgbe_rxeof(que);
|
||||
more = ixgbe_rxeof(que);
|
||||
|
||||
IXGBE_TX_LOCK(txr);
|
||||
more_tx = ixgbe_txeof(txr);
|
||||
/*
|
||||
** Make certain that if the stack
|
||||
** has anything queued the task gets
|
||||
** scheduled to handle it.
|
||||
*/
|
||||
ixgbe_txeof(txr);
|
||||
#ifdef IXGBE_LEGACY_TX
|
||||
if (!IFQ_DRV_IS_EMPTY(&adapter->ifp->if_snd))
|
||||
if (!IFQ_DRV_IS_EMPTY(ifp->if_snd))
|
||||
ixgbe_start_locked(txr, ifp);
|
||||
#else
|
||||
if (!drbr_empty(adapter->ifp, txr->br))
|
||||
if (!drbr_empty(ifp, txr->br))
|
||||
ixgbe_mq_start_locked(ifp, txr);
|
||||
#endif
|
||||
more_tx = 1;
|
||||
IXGBE_TX_UNLOCK(txr);
|
||||
|
||||
/* Do AIM now? */
|
||||
@ -1575,9 +1576,9 @@ ixgbe_msix_que(void *arg)
|
||||
rxr->packets = 0;
|
||||
|
||||
no_calc:
|
||||
if (more_tx || more_rx)
|
||||
if (more)
|
||||
taskqueue_enqueue(que->tq, &que->que_task);
|
||||
else /* Reenable this interrupt */
|
||||
else
|
||||
ixgbe_enable_queue(adapter, que->msix);
|
||||
return;
|
||||
}
|
||||
@ -2062,7 +2063,7 @@ ixgbe_local_timer(void *arg)
|
||||
(paused == 0))
|
||||
++hung;
|
||||
else if (txr->queue_status == IXGBE_QUEUE_WORKING)
|
||||
taskqueue_enqueue(que->tq, &que->que_task);
|
||||
taskqueue_enqueue(que->tq, &txr->txq_task);
|
||||
}
|
||||
/* Only truely watchdog if all queues show hung */
|
||||
if (hung == adapter->num_queues)
|
||||
@ -2149,9 +2150,14 @@ ixgbe_stop(void *arg)
|
||||
ixgbe_reset_hw(hw);
|
||||
hw->adapter_stopped = FALSE;
|
||||
ixgbe_stop_adapter(hw);
|
||||
/* Turn off the laser */
|
||||
if (hw->phy.multispeed_fiber)
|
||||
ixgbe_disable_tx_laser(hw);
|
||||
if (hw->mac.type == ixgbe_mac_82599EB)
|
||||
ixgbe_stop_mac_link_on_d3_82599(hw);
|
||||
/* Turn off the laser - noop with no optics */
|
||||
ixgbe_disable_tx_laser(hw);
|
||||
|
||||
/* Update the stack */
|
||||
adapter->link_up = FALSE;
|
||||
ixgbe_update_link_status(adapter);
|
||||
|
||||
/* reprogram the RAR[0] in case user changed it. */
|
||||
ixgbe_set_rar(&adapter->hw, 0, adapter->hw.mac.addr, 0, IXGBE_RAH_AV);
|
||||
@ -2603,7 +2609,11 @@ ixgbe_setup_interface(device_t dev, struct adapter *adapter)
|
||||
return (-1);
|
||||
}
|
||||
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
|
||||
#if __FreeBSD_version < 1000025
|
||||
ifp->if_baudrate = 1000000000;
|
||||
#else
|
||||
if_initbaudrate(ifp, IF_Gbps(10));
|
||||
#endif
|
||||
ifp->if_init = ixgbe_init;
|
||||
ifp->if_softc = adapter;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
@ -2614,6 +2624,8 @@ ixgbe_setup_interface(device_t dev, struct adapter *adapter)
|
||||
#else
|
||||
ifp->if_start = ixgbe_start;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 2);
|
||||
ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 2;
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
#endif
|
||||
|
||||
ether_ifattach(ifp, adapter->hw.mac.addr);
|
||||
@ -3557,7 +3569,7 @@ ixgbe_atr(struct tx_ring *txr, struct mbuf *mp)
|
||||
* tx_buffer is put back on the free queue.
|
||||
*
|
||||
**********************************************************************/
|
||||
static bool
|
||||
static void
|
||||
ixgbe_txeof(struct tx_ring *txr)
|
||||
{
|
||||
struct adapter *adapter = txr->adapter;
|
||||
@ -3600,13 +3612,13 @@ ixgbe_txeof(struct tx_ring *txr)
|
||||
netmap_tx_irq(ifp, txr->me |
|
||||
(NETMAP_LOCKED_ENTER|NETMAP_LOCKED_EXIT));
|
||||
}
|
||||
return FALSE;
|
||||
return;
|
||||
}
|
||||
#endif /* DEV_NETMAP */
|
||||
|
||||
if (txr->tx_avail == txr->num_desc) {
|
||||
txr->queue_status = IXGBE_QUEUE_IDLE;
|
||||
return FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get work starting point */
|
||||
@ -3700,12 +3712,10 @@ ixgbe_txeof(struct tx_ring *txr)
|
||||
if ((!processed) && ((ticks - txr->watchdog_time) > IXGBE_WATCHDOG))
|
||||
txr->queue_status = IXGBE_QUEUE_HUNG;
|
||||
|
||||
if (txr->tx_avail == txr->num_desc) {
|
||||
if (txr->tx_avail == txr->num_desc)
|
||||
txr->queue_status = IXGBE_QUEUE_IDLE;
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
@ -4387,6 +4397,7 @@ ixgbe_rxeof(struct ix_queue *que)
|
||||
if (netmap_rx_irq(ifp, rxr->me | NETMAP_LOCKED_ENTER, &processed))
|
||||
return (FALSE);
|
||||
#endif /* DEV_NETMAP */
|
||||
|
||||
for (i = rxr->next_to_check; count != 0;) {
|
||||
struct mbuf *sendmp, *mp;
|
||||
u32 rsc, ptype;
|
||||
@ -4576,15 +4587,12 @@ ixgbe_rxeof(struct ix_queue *que)
|
||||
IXGBE_RX_UNLOCK(rxr);
|
||||
|
||||
/*
|
||||
** We still have cleaning to do?
|
||||
** Schedule another interrupt if so.
|
||||
** Still have cleaning to do?
|
||||
*/
|
||||
if ((staterr & IXGBE_RXD_STAT_DD) != 0) {
|
||||
ixgbe_rearm_queues(adapter, (u64)(1 << que->msix));
|
||||
if ((staterr & IXGBE_RXD_STAT_DD) != 0)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
else
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -4832,6 +4840,111 @@ ixgbe_write_pci_cfg(struct ixgbe_hw *hw, u32 reg, u16 value)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Get the width and transaction speed of
|
||||
** the slot this adapter is plugged into.
|
||||
*/
|
||||
static void
|
||||
ixgbe_get_slot_info(struct ixgbe_hw *hw)
|
||||
{
|
||||
device_t dev = ((struct ixgbe_osdep *)hw->back)->dev;
|
||||
struct ixgbe_mac_info *mac = &hw->mac;
|
||||
u16 link;
|
||||
u32 offset;
|
||||
|
||||
/* For most devices simply call the shared code routine */
|
||||
if (hw->device_id != IXGBE_DEV_ID_82599_SFP_SF_QP) {
|
||||
ixgbe_get_bus_info(hw);
|
||||
goto display;
|
||||
}
|
||||
|
||||
/*
|
||||
** For the Quad port adapter we need to parse back
|
||||
** up the PCI tree to find the speed of the expansion
|
||||
** slot into which this adapter is plugged. A bit more work.
|
||||
*/
|
||||
dev = device_get_parent(device_get_parent(dev));
|
||||
#ifdef IXGBE_DEBUG
|
||||
device_printf(dev, "parent pcib = %x,%x,%x\n",
|
||||
pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev));
|
||||
#endif
|
||||
dev = device_get_parent(device_get_parent(dev));
|
||||
#ifdef IXGBE_DEBUG
|
||||
device_printf(dev, "slot pcib = %x,%x,%x\n",
|
||||
pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev));
|
||||
#endif
|
||||
/* Now get the PCI Express Capabilities offset */
|
||||
pci_find_cap(dev, PCIY_EXPRESS, &offset);
|
||||
/* ...and read the Link Status Register */
|
||||
link = pci_read_config(dev, offset + PCIER_LINK_STA, 2);
|
||||
switch (link & IXGBE_PCI_LINK_WIDTH) {
|
||||
case IXGBE_PCI_LINK_WIDTH_1:
|
||||
hw->bus.width = ixgbe_bus_width_pcie_x1;
|
||||
break;
|
||||
case IXGBE_PCI_LINK_WIDTH_2:
|
||||
hw->bus.width = ixgbe_bus_width_pcie_x2;
|
||||
break;
|
||||
case IXGBE_PCI_LINK_WIDTH_4:
|
||||
hw->bus.width = ixgbe_bus_width_pcie_x4;
|
||||
break;
|
||||
case IXGBE_PCI_LINK_WIDTH_8:
|
||||
hw->bus.width = ixgbe_bus_width_pcie_x8;
|
||||
break;
|
||||
default:
|
||||
hw->bus.width = ixgbe_bus_width_unknown;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (link & IXGBE_PCI_LINK_SPEED) {
|
||||
case IXGBE_PCI_LINK_SPEED_2500:
|
||||
hw->bus.speed = ixgbe_bus_speed_2500;
|
||||
break;
|
||||
case IXGBE_PCI_LINK_SPEED_5000:
|
||||
hw->bus.speed = ixgbe_bus_speed_5000;
|
||||
break;
|
||||
case IXGBE_PCI_LINK_SPEED_8000:
|
||||
hw->bus.speed = ixgbe_bus_speed_8000;
|
||||
break;
|
||||
default:
|
||||
hw->bus.speed = ixgbe_bus_speed_unknown;
|
||||
break;
|
||||
}
|
||||
|
||||
mac->ops.set_lan_id(hw);
|
||||
|
||||
display:
|
||||
device_printf(dev,"PCI Express Bus: Speed %s %s\n",
|
||||
((hw->bus.speed == ixgbe_bus_speed_8000) ? "8.0GT/s":
|
||||
(hw->bus.speed == ixgbe_bus_speed_5000) ? "5.0GT/s":
|
||||
(hw->bus.speed == ixgbe_bus_speed_2500) ? "2.5GT/s":"Unknown"),
|
||||
(hw->bus.width == ixgbe_bus_width_pcie_x8) ? "Width x8" :
|
||||
(hw->bus.width == ixgbe_bus_width_pcie_x4) ? "Width x4" :
|
||||
(hw->bus.width == ixgbe_bus_width_pcie_x1) ? "Width x1" :
|
||||
("Unknown"));
|
||||
|
||||
if ((hw->device_id != IXGBE_DEV_ID_82599_SFP_SF_QP) &&
|
||||
((hw->bus.width <= ixgbe_bus_width_pcie_x4) &&
|
||||
(hw->bus.speed == ixgbe_bus_speed_2500))) {
|
||||
device_printf(dev, "PCI-Express bandwidth available"
|
||||
" for this card\n is not sufficient for"
|
||||
" optimal performance.\n");
|
||||
device_printf(dev, "For optimal performance a x8 "
|
||||
"PCIE, or x4 PCIE Gen2 slot is required.\n");
|
||||
}
|
||||
if ((hw->device_id == IXGBE_DEV_ID_82599_SFP_SF_QP) &&
|
||||
((hw->bus.width <= ixgbe_bus_width_pcie_x8) &&
|
||||
(hw->bus.speed < ixgbe_bus_speed_8000))) {
|
||||
device_printf(dev, "PCI-Express bandwidth available"
|
||||
" for this card\n is not sufficient for"
|
||||
" optimal performance.\n");
|
||||
device_printf(dev, "For optimal performance a x8 "
|
||||
"PCIE Gen3 slot is required.\n");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Setup the correct IVAR register for a particular MSIX interrupt
|
||||
** (yes this is all very magic and confusing :)
|
||||
@ -5633,6 +5746,7 @@ ixgbe_set_advertise(SYSCTL_HANDLER_ARGS)
|
||||
/*
|
||||
** Thermal Shutdown Trigger
|
||||
** - cause a Thermal Overtemp IRQ
|
||||
** - this now requires firmware enabling
|
||||
*/
|
||||
static int
|
||||
ixgbe_set_thermal_test(SYSCTL_HANDLER_ARGS)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2012, Intel Corporation
|
||||
Copyright (c) 2001-2013, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -213,6 +213,7 @@
|
||||
#define IXGBE_BULK_LATENCY 1200
|
||||
#define IXGBE_LINK_ITR 2000
|
||||
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
* vendor_info_array
|
||||
@ -230,6 +231,7 @@ typedef struct _ixgbe_vendor_info_t {
|
||||
unsigned int index;
|
||||
} ixgbe_vendor_info_t;
|
||||
|
||||
|
||||
/* This is used to get SFP+ module data */
|
||||
struct ixgbe_i2c_req {
|
||||
u8 dev_addr;
|
||||
@ -456,6 +458,7 @@ struct adapter {
|
||||
/* Multicast array memory */
|
||||
u8 *mta;
|
||||
|
||||
|
||||
/* Misc stats maintained by the driver */
|
||||
unsigned long dropped_pkts;
|
||||
unsigned long mbuf_defrag_failed;
|
||||
@ -467,6 +470,7 @@ struct adapter {
|
||||
struct ixgbe_hw_stats stats;
|
||||
};
|
||||
|
||||
|
||||
/* Precision Time Sync (IEEE 1588) defines */
|
||||
#define ETHERTYPE_IEEE1588 0x88F7
|
||||
#define PICOSECS_PER_TICK 20833
|
||||
@ -489,6 +493,10 @@ struct adapter {
|
||||
#define IXGBE_CORE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->core_mtx, MA_OWNED)
|
||||
#define IXGBE_TX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->tx_mtx, MA_OWNED)
|
||||
|
||||
/* For backward compatibility */
|
||||
#if !defined(PCIER_LINK_STA)
|
||||
#define PCIER_LINK_STA PCIR_EXPRESS_LINK_STA
|
||||
#endif
|
||||
|
||||
static inline bool
|
||||
ixgbe_is_sfp(struct ixgbe_hw *hw)
|
||||
|
@ -166,6 +166,8 @@ s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw)
|
||||
/* Manageability interface */
|
||||
mac->ops.set_fw_drv_ver = NULL;
|
||||
|
||||
mac->ops.get_rtrup2tc = NULL;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
@ -1115,10 +1117,19 @@ static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr,
|
||||
u16 sfp_addr = 0;
|
||||
u16 sfp_data = 0;
|
||||
u16 sfp_stat = 0;
|
||||
u16 gssr;
|
||||
u32 i;
|
||||
|
||||
DEBUGFUNC("ixgbe_read_i2c_phy_82598");
|
||||
|
||||
if (IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)
|
||||
gssr = IXGBE_GSSR_PHY1_SM;
|
||||
else
|
||||
gssr = IXGBE_GSSR_PHY0_SM;
|
||||
|
||||
if (hw->mac.ops.acquire_swfw_sync(hw, gssr) != IXGBE_SUCCESS)
|
||||
return IXGBE_ERR_SWFW_SYNC;
|
||||
|
||||
if (hw->phy.type == ixgbe_phy_nl) {
|
||||
/*
|
||||
* NetLogic phy SDA/SCL registers are at addresses 0xC30A to
|
||||
@ -1127,17 +1138,17 @@ static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr,
|
||||
*/
|
||||
sfp_addr = (dev_addr << 8) + byte_offset;
|
||||
sfp_addr = (sfp_addr | IXGBE_I2C_EEPROM_READ_MASK);
|
||||
hw->phy.ops.write_reg(hw,
|
||||
IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR,
|
||||
IXGBE_MDIO_PMA_PMD_DEV_TYPE,
|
||||
sfp_addr);
|
||||
hw->phy.ops.write_reg_mdi(hw,
|
||||
IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR,
|
||||
IXGBE_MDIO_PMA_PMD_DEV_TYPE,
|
||||
sfp_addr);
|
||||
|
||||
/* Poll status */
|
||||
for (i = 0; i < 100; i++) {
|
||||
hw->phy.ops.read_reg(hw,
|
||||
IXGBE_MDIO_PMA_PMD_SDA_SCL_STAT,
|
||||
IXGBE_MDIO_PMA_PMD_DEV_TYPE,
|
||||
&sfp_stat);
|
||||
hw->phy.ops.read_reg_mdi(hw,
|
||||
IXGBE_MDIO_PMA_PMD_SDA_SCL_STAT,
|
||||
IXGBE_MDIO_PMA_PMD_DEV_TYPE,
|
||||
&sfp_stat);
|
||||
sfp_stat = sfp_stat & IXGBE_I2C_EEPROM_STATUS_MASK;
|
||||
if (sfp_stat != IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS)
|
||||
break;
|
||||
@ -1151,8 +1162,8 @@ static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr,
|
||||
}
|
||||
|
||||
/* Read data */
|
||||
hw->phy.ops.read_reg(hw, IXGBE_MDIO_PMA_PMD_SDA_SCL_DATA,
|
||||
IXGBE_MDIO_PMA_PMD_DEV_TYPE, &sfp_data);
|
||||
hw->phy.ops.read_reg_mdi(hw, IXGBE_MDIO_PMA_PMD_SDA_SCL_DATA,
|
||||
IXGBE_MDIO_PMA_PMD_DEV_TYPE, &sfp_data);
|
||||
|
||||
*eeprom_data = (u8)(sfp_data >> 8);
|
||||
} else {
|
||||
@ -1160,6 +1171,7 @@ static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr,
|
||||
}
|
||||
|
||||
out:
|
||||
hw->mac.ops.release_swfw_sync(hw, gssr);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
|
||||
* and MNG not enabled
|
||||
*/
|
||||
if ((mac->ops.get_media_type(hw) == ixgbe_media_type_fiber) &&
|
||||
!(ixgbe_mng_enabled(hw))) {
|
||||
!hw->mng_fw_enabled) {
|
||||
mac->ops.disable_tx_laser =
|
||||
&ixgbe_disable_tx_laser_multispeed_fiber;
|
||||
mac->ops.enable_tx_laser =
|
||||
@ -180,11 +180,13 @@ s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw)
|
||||
goto setup_sfp_out;
|
||||
}
|
||||
|
||||
hw->eeprom.ops.read(hw, ++data_offset, &data_value);
|
||||
if (hw->eeprom.ops.read(hw, ++data_offset, &data_value))
|
||||
goto setup_sfp_err;
|
||||
while (data_value != 0xffff) {
|
||||
IXGBE_WRITE_REG(hw, IXGBE_CORECTL, data_value);
|
||||
IXGBE_WRITE_FLUSH(hw);
|
||||
hw->eeprom.ops.read(hw, ++data_offset, &data_value);
|
||||
if (hw->eeprom.ops.read(hw, ++data_offset, &data_value))
|
||||
goto setup_sfp_err;
|
||||
}
|
||||
|
||||
/* Release the semaphore */
|
||||
@ -229,6 +231,15 @@ s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw)
|
||||
|
||||
setup_sfp_out:
|
||||
return ret_val;
|
||||
|
||||
setup_sfp_err:
|
||||
/* Release the semaphore */
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM);
|
||||
/* Delay obtaining semaphore again to allow FW access */
|
||||
msec_delay(hw->eeprom.semaphore_delay);
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"eeprom read at offset %d failed", data_offset);
|
||||
return IXGBE_ERR_PHY;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -314,6 +325,11 @@ s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw)
|
||||
mac->ops.set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic;
|
||||
|
||||
|
||||
mac->ops.get_rtrup2tc = &ixgbe_dcb_get_rtrup2tc_generic;
|
||||
|
||||
/* Cache if MNG FW is up */
|
||||
hw->mng_fw_enabled = ixgbe_mng_enabled(hw);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
@ -478,6 +494,29 @@ enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw)
|
||||
return media_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_stop_mac_link_on_d3_82599 - Disables link on D3
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Disables link during D3 power down sequence.
|
||||
*
|
||||
**/
|
||||
void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw)
|
||||
{
|
||||
u32 autoc2_reg;
|
||||
u16 ee_ctrl_2 = 0;
|
||||
|
||||
DEBUGFUNC("ixgbe_stop_mac_link_on_d3_82599");
|
||||
ixgbe_read_eeprom(hw, IXGBE_EEPROM_CTRL_2, &ee_ctrl_2);
|
||||
|
||||
if (!hw->mng_fw_enabled && !hw->wol_enabled &&
|
||||
ee_ctrl_2 & IXGBE_EEPROM_CCD_BIT) {
|
||||
autoc2_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
|
||||
autoc2_reg |= IXGBE_AUTOC2_LINK_DISABLE_ON_D3_MASK;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2_reg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_start_mac_link_82599 - Setup MAC link settings
|
||||
* @hw: pointer to hardware structure
|
||||
@ -1122,7 +1161,8 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
|
||||
{
|
||||
ixgbe_link_speed link_speed;
|
||||
s32 status;
|
||||
u32 ctrl, i, autoc, autoc2;
|
||||
u32 ctrl, i, autoc2;
|
||||
u32 curr_lms;
|
||||
bool link_up = FALSE;
|
||||
|
||||
DEBUGFUNC("ixgbe_reset_hw_82599");
|
||||
@ -1156,6 +1196,13 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
|
||||
if (hw->phy.reset_disable == FALSE && hw->phy.ops.reset != NULL)
|
||||
hw->phy.ops.reset(hw);
|
||||
|
||||
/* remember AUTOC from before we reset */
|
||||
if (hw->mac.cached_autoc)
|
||||
curr_lms = hw->mac.cached_autoc & IXGBE_AUTOC_LMS_MASK;
|
||||
else
|
||||
curr_lms = IXGBE_READ_REG(hw, IXGBE_AUTOC) &
|
||||
IXGBE_AUTOC_LMS_MASK;
|
||||
|
||||
mac_reset_top:
|
||||
/*
|
||||
* Issue global reset to the MAC. Needs to be SW reset if link is up.
|
||||
@ -1204,7 +1251,7 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
|
||||
* stored off yet. Otherwise restore the stored original
|
||||
* values since the reset operation sets back to defaults.
|
||||
*/
|
||||
autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
|
||||
hw->mac.cached_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
|
||||
autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
|
||||
|
||||
/* Enable link if disabled in NVM */
|
||||
@ -1215,12 +1262,24 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
|
||||
}
|
||||
|
||||
if (hw->mac.orig_link_settings_stored == FALSE) {
|
||||
hw->mac.orig_autoc = autoc;
|
||||
hw->mac.orig_autoc = hw->mac.cached_autoc;
|
||||
hw->mac.orig_autoc2 = autoc2;
|
||||
hw->mac.cached_autoc = autoc;
|
||||
hw->mac.orig_link_settings_stored = TRUE;
|
||||
} else {
|
||||
if (autoc != hw->mac.orig_autoc) {
|
||||
|
||||
/* If MNG FW is running on a multi-speed device that
|
||||
* doesn't autoneg with out driver support we need to
|
||||
* leave LMS in the state it was before we MAC reset.
|
||||
* Likewise if we support WoL we don't want change the
|
||||
* LMS state.
|
||||
*/
|
||||
if ((hw->phy.multispeed_fiber && hw->mng_fw_enabled) ||
|
||||
hw->wol_enabled)
|
||||
hw->mac.orig_autoc =
|
||||
(hw->mac.orig_autoc & ~IXGBE_AUTOC_LMS_MASK) |
|
||||
curr_lms;
|
||||
|
||||
if (hw->mac.cached_autoc != hw->mac.orig_autoc) {
|
||||
/* Need SW/FW semaphore around AUTOC writes if LESM is
|
||||
* on, likewise reset_pipeline requires us to hold
|
||||
* this lock as it also writes to AUTOC.
|
||||
@ -2275,11 +2334,11 @@ s32 ixgbe_enable_rx_dma_82599(struct ixgbe_hw *hw, u32 regval)
|
||||
* Returns IXGBE_ERR_EEPROM_VERSION if the FW is not present or
|
||||
* if the FW version is not supported.
|
||||
**/
|
||||
s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw)
|
||||
static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw)
|
||||
{
|
||||
s32 status = IXGBE_ERR_EEPROM_VERSION;
|
||||
u16 fw_offset, fw_ptp_cfg_offset;
|
||||
u16 fw_version = 0;
|
||||
u16 fw_version;
|
||||
|
||||
DEBUGFUNC("ixgbe_verify_fw_version_82599");
|
||||
|
||||
@ -2290,22 +2349,37 @@ s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw)
|
||||
}
|
||||
|
||||
/* get the offset to the Firmware Module block */
|
||||
hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset);
|
||||
if (hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset)) {
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"eeprom read at offset %d failed", IXGBE_FW_PTR);
|
||||
return IXGBE_ERR_EEPROM_VERSION;
|
||||
}
|
||||
|
||||
if ((fw_offset == 0) || (fw_offset == 0xFFFF))
|
||||
goto fw_version_out;
|
||||
|
||||
/* get the offset to the Pass Through Patch Configuration block */
|
||||
hw->eeprom.ops.read(hw, (fw_offset +
|
||||
if (hw->eeprom.ops.read(hw, (fw_offset +
|
||||
IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR),
|
||||
&fw_ptp_cfg_offset);
|
||||
&fw_ptp_cfg_offset)) {
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"eeprom read at offset %d failed",
|
||||
fw_offset +
|
||||
IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR);
|
||||
return IXGBE_ERR_EEPROM_VERSION;
|
||||
}
|
||||
|
||||
if ((fw_ptp_cfg_offset == 0) || (fw_ptp_cfg_offset == 0xFFFF))
|
||||
goto fw_version_out;
|
||||
|
||||
/* get the firmware version */
|
||||
hw->eeprom.ops.read(hw, (fw_ptp_cfg_offset +
|
||||
IXGBE_FW_PATCH_VERSION_4), &fw_version);
|
||||
if (hw->eeprom.ops.read(hw, (fw_ptp_cfg_offset +
|
||||
IXGBE_FW_PATCH_VERSION_4), &fw_version)) {
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"eeprom read at offset %d failed",
|
||||
fw_ptp_cfg_offset + IXGBE_FW_PATCH_VERSION_4);
|
||||
return IXGBE_ERR_EEPROM_VERSION;
|
||||
}
|
||||
|
||||
if (fw_version > 0x5)
|
||||
status = IXGBE_SUCCESS;
|
||||
|
@ -35,6 +35,19 @@
|
||||
#include "ixgbe_api.h"
|
||||
#include "ixgbe_common.h"
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_get_rtrup2tc - read rtrup2tc reg
|
||||
* @hw: pointer to hardware structure
|
||||
* @map: pointer to u8 arr for returning map
|
||||
*
|
||||
* Read the rtrup2tc HW register and resolve its content into map
|
||||
**/
|
||||
void ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw *hw, u8 *map)
|
||||
{
|
||||
if (hw->mac.ops.get_rtrup2tc)
|
||||
hw->mac.ops.get_rtrup2tc(hw, map);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_init_shared_code - Initialize the shared code
|
||||
* @hw: pointer to hardware structure
|
||||
@ -93,6 +106,12 @@ s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
|
||||
|
||||
DEBUGFUNC("ixgbe_set_mac_type\n");
|
||||
|
||||
if (hw->vendor_id != IXGBE_INTEL_VENDOR_ID) {
|
||||
ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
|
||||
"Unsupported vendor id: %x", hw->vendor_id);
|
||||
return IXGBE_ERR_DEVICE_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
switch (hw->device_id) {
|
||||
case IXGBE_DEV_ID_82598:
|
||||
case IXGBE_DEV_ID_82598_BX:
|
||||
@ -139,6 +158,9 @@ s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
|
||||
break;
|
||||
default:
|
||||
ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
|
||||
ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
|
||||
"Unsupported device id: %x",
|
||||
hw->device_id);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -995,6 +1017,8 @@ s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ixgbe_read_analog_reg8 - Reads 8 bit analog register
|
||||
* @hw: pointer to hardware structure
|
||||
|
@ -37,6 +37,8 @@
|
||||
|
||||
#include "ixgbe_type.h"
|
||||
|
||||
void ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw *hw, u8 *map);
|
||||
|
||||
s32 ixgbe_init_shared_code(struct ixgbe_hw *hw);
|
||||
|
||||
extern s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw);
|
||||
@ -134,6 +136,7 @@ u32 ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval);
|
||||
s32 ixgbe_disable_sec_rx_path(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_enable_sec_rx_path(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_mng_fw_enabled(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl);
|
||||
s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl);
|
||||
|
@ -34,6 +34,8 @@
|
||||
|
||||
#include "ixgbe_common.h"
|
||||
#include "ixgbe_phy.h"
|
||||
#include "ixgbe_dcb.h"
|
||||
#include "ixgbe_dcb_82599.h"
|
||||
#include "ixgbe_api.h"
|
||||
|
||||
static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw);
|
||||
@ -134,31 +136,63 @@ s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw)
|
||||
mac->ops.get_link_capabilities = NULL;
|
||||
mac->ops.setup_link = NULL;
|
||||
mac->ops.check_link = NULL;
|
||||
mac->ops.dmac_config = NULL;
|
||||
mac->ops.dmac_update_tcs = NULL;
|
||||
mac->ops.dmac_config_tcs = NULL;
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_device_supports_autoneg_fc - Check if phy supports autoneg flow
|
||||
* control
|
||||
* @hw: pointer to hardware structure
|
||||
* ixgbe_device_supports_autoneg_fc - Check if device supports autonegotiation
|
||||
* of flow control
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* This function returns TRUE if the device supports flow control
|
||||
* autonegotiation, and FALSE if it does not.
|
||||
*
|
||||
* There are several phys that do not support autoneg flow control. This
|
||||
* function check the device id to see if the associated phy supports
|
||||
* autoneg flow control.
|
||||
**/
|
||||
s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
|
||||
bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
|
||||
{
|
||||
bool supported = FALSE;
|
||||
ixgbe_link_speed speed;
|
||||
bool link_up;
|
||||
|
||||
DEBUGFUNC("ixgbe_device_supports_autoneg_fc");
|
||||
|
||||
switch (hw->device_id) {
|
||||
case IXGBE_DEV_ID_82599_T3_LOM:
|
||||
case IXGBE_DEV_ID_X540T:
|
||||
return IXGBE_SUCCESS;
|
||||
switch (hw->phy.media_type) {
|
||||
case ixgbe_media_type_fiber_fixed:
|
||||
case ixgbe_media_type_fiber:
|
||||
hw->mac.ops.check_link(hw, &speed, &link_up, FALSE);
|
||||
/* if link is down, assume supported */
|
||||
if (link_up)
|
||||
supported = speed == IXGBE_LINK_SPEED_1GB_FULL ?
|
||||
TRUE : FALSE;
|
||||
else
|
||||
supported = TRUE;
|
||||
break;
|
||||
case ixgbe_media_type_backplane:
|
||||
supported = TRUE;
|
||||
break;
|
||||
case ixgbe_media_type_copper:
|
||||
/* only some copper devices support flow control autoneg */
|
||||
switch (hw->device_id) {
|
||||
case IXGBE_DEV_ID_82599_T3_LOM:
|
||||
case IXGBE_DEV_ID_X540T:
|
||||
case IXGBE_DEV_ID_X540_BYPASS:
|
||||
supported = TRUE;
|
||||
break;
|
||||
default:
|
||||
supported = FALSE;
|
||||
}
|
||||
default:
|
||||
return IXGBE_ERR_FC_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
|
||||
"Device %x does not support flow control autoneg",
|
||||
hw->device_id);
|
||||
return supported;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -181,7 +215,8 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
|
||||
* ixgbe_fc_rx_pause because it will cause us to fail at UNH.
|
||||
*/
|
||||
if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
|
||||
DEBUGOUT("ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
|
||||
"ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
|
||||
ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS;
|
||||
goto out;
|
||||
}
|
||||
@ -268,7 +303,8 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
|
||||
reg_cu |= IXGBE_TAF_SYM_PAUSE | IXGBE_TAF_ASM_PAUSE;
|
||||
break;
|
||||
default:
|
||||
DEBUGOUT("Flow control param set incorrectly\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
|
||||
"Flow control param set incorrectly\n");
|
||||
ret_val = IXGBE_ERR_CONFIG;
|
||||
goto out;
|
||||
break;
|
||||
@ -320,7 +356,7 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
|
||||
hw->mac.ops.release_swfw_sync(hw,
|
||||
IXGBE_GSSR_MAC_CSR_SM);
|
||||
} else if ((hw->phy.media_type == ixgbe_media_type_copper) &&
|
||||
(ixgbe_device_supports_autoneg_fc(hw) == IXGBE_SUCCESS)) {
|
||||
(ixgbe_device_supports_autoneg_fc(hw))) {
|
||||
hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_ADVT,
|
||||
IXGBE_MDIO_AUTO_NEG_DEV_TYPE, reg_cu);
|
||||
}
|
||||
@ -919,23 +955,18 @@ s32 ixgbe_get_mac_addr_generic(struct ixgbe_hw *hw, u8 *mac_addr)
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_get_bus_info_generic - Generic set PCI bus info
|
||||
* ixgbe_set_pci_config_data_generic - Generic store PCI bus info
|
||||
* @hw: pointer to hardware structure
|
||||
* @link_status: the link status returned by the PCI config space
|
||||
*
|
||||
* Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
|
||||
* Stores the PCI bus info (speed, width, type) within the ixgbe_hw structure
|
||||
**/
|
||||
s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw)
|
||||
void ixgbe_set_pci_config_data_generic(struct ixgbe_hw *hw, u16 link_status)
|
||||
{
|
||||
struct ixgbe_mac_info *mac = &hw->mac;
|
||||
u16 link_status;
|
||||
|
||||
DEBUGFUNC("ixgbe_get_bus_info_generic");
|
||||
|
||||
hw->bus.type = ixgbe_bus_type_pci_express;
|
||||
|
||||
/* Get the negotiated link width and speed from PCI config space */
|
||||
link_status = IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_LINK_STATUS);
|
||||
|
||||
switch (link_status & IXGBE_PCI_LINK_WIDTH) {
|
||||
case IXGBE_PCI_LINK_WIDTH_1:
|
||||
hw->bus.width = ixgbe_bus_width_pcie_x1;
|
||||
@ -970,6 +1001,25 @@ s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw)
|
||||
}
|
||||
|
||||
mac->ops.set_lan_id(hw);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_get_bus_info_generic - Generic set PCI bus info
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Gets the PCI bus info (speed, width, type) then calls helper function to
|
||||
* store this data within the ixgbe_hw structure.
|
||||
**/
|
||||
s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw)
|
||||
{
|
||||
u16 link_status;
|
||||
|
||||
DEBUGFUNC("ixgbe_get_bus_info_generic");
|
||||
|
||||
/* Get the negotiated link width and speed from PCI config space */
|
||||
link_status = IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_LINK_STATUS);
|
||||
|
||||
ixgbe_set_pci_config_data_generic(hw, link_status);
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
@ -1469,11 +1519,13 @@ s32 ixgbe_read_eerd_buffer_generic(struct ixgbe_hw *hw, u16 offset,
|
||||
|
||||
if (words == 0) {
|
||||
status = IXGBE_ERR_INVALID_ARGUMENT;
|
||||
ERROR_REPORT1(IXGBE_ERROR_ARGUMENT, "Invalid EEPROM words");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (offset >= hw->eeprom.word_size) {
|
||||
status = IXGBE_ERR_EEPROM;
|
||||
ERROR_REPORT1(IXGBE_ERROR_ARGUMENT, "Invalid EEPROM offset");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1575,11 +1627,13 @@ s32 ixgbe_write_eewr_buffer_generic(struct ixgbe_hw *hw, u16 offset,
|
||||
|
||||
if (words == 0) {
|
||||
status = IXGBE_ERR_INVALID_ARGUMENT;
|
||||
ERROR_REPORT1(IXGBE_ERROR_ARGUMENT, "Invalid EEPROM words");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (offset >= hw->eeprom.word_size) {
|
||||
status = IXGBE_ERR_EEPROM;
|
||||
ERROR_REPORT1(IXGBE_ERROR_ARGUMENT, "Invalid EEPROM offset");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1648,6 +1702,11 @@ s32 ixgbe_poll_eerd_eewr_done(struct ixgbe_hw *hw, u32 ee_reg)
|
||||
}
|
||||
usec_delay(5);
|
||||
}
|
||||
|
||||
if (i == IXGBE_EERD_EEWR_ATTEMPTS)
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"EEPROM read/write done polling timed out");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -1783,14 +1842,15 @@ static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw)
|
||||
* was not granted because we don't have access to the EEPROM
|
||||
*/
|
||||
if (i >= timeout) {
|
||||
DEBUGOUT("SWESMBI Software EEPROM semaphore "
|
||||
"not granted.\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"SWESMBI Software EEPROM semaphore not granted.\n");
|
||||
ixgbe_release_eeprom_semaphore(hw);
|
||||
status = IXGBE_ERR_EEPROM;
|
||||
}
|
||||
} else {
|
||||
DEBUGOUT("Software semaphore SMBI between device drivers "
|
||||
"not granted.\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"Software semaphore SMBI between device drivers "
|
||||
"not granted.\n");
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -2214,7 +2274,8 @@ s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
|
||||
|
||||
/* Make sure we are using a valid rar index range */
|
||||
if (index >= rar_entries) {
|
||||
DEBUGOUT1("RAR index %d is out of range.\n", index);
|
||||
ERROR_REPORT2(IXGBE_ERROR_ARGUMENT,
|
||||
"RAR index %d is out of range.\n", index);
|
||||
return IXGBE_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@ -2263,7 +2324,8 @@ s32 ixgbe_clear_rar_generic(struct ixgbe_hw *hw, u32 index)
|
||||
|
||||
/* Make sure we are using a valid rar index range */
|
||||
if (index >= rar_entries) {
|
||||
DEBUGOUT1("RAR index %d is out of range.\n", index);
|
||||
ERROR_REPORT2(IXGBE_ERROR_ARGUMENT,
|
||||
"RAR index %d is out of range.\n", index);
|
||||
return IXGBE_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@ -2706,7 +2768,8 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw)
|
||||
fccfg_reg |= IXGBE_FCCFG_TFCE_802_3X;
|
||||
break;
|
||||
default:
|
||||
DEBUGOUT("Flow control param set incorrectly\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
|
||||
"Flow control param set incorrectly\n");
|
||||
ret_val = IXGBE_ERR_CONFIG;
|
||||
goto out;
|
||||
break;
|
||||
@ -2767,8 +2830,13 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw)
|
||||
static s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
|
||||
u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
|
||||
{
|
||||
if ((!(adv_reg)) || (!(lp_reg)))
|
||||
if ((!(adv_reg)) || (!(lp_reg))) {
|
||||
ERROR_REPORT3(IXGBE_ERROR_UNSUPPORTED,
|
||||
"Local or link partner's advertised flow control "
|
||||
"settings are NULL. Local: %x, link partner: %x\n",
|
||||
adv_reg, lp_reg);
|
||||
return IXGBE_ERR_FC_NOT_NEGOTIATED;
|
||||
}
|
||||
|
||||
if ((adv_reg & adv_sym) && (lp_reg & lp_sym)) {
|
||||
/*
|
||||
@ -2819,8 +2887,11 @@ static s32 ixgbe_fc_autoneg_fiber(struct ixgbe_hw *hw)
|
||||
|
||||
linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA);
|
||||
if ((!!(linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) ||
|
||||
(!!(linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1))
|
||||
(!!(linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) {
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"Auto-Negotiation did not complete or timed out");
|
||||
goto out;
|
||||
}
|
||||
|
||||
pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA);
|
||||
pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP);
|
||||
@ -2852,13 +2923,19 @@ static s32 ixgbe_fc_autoneg_backplane(struct ixgbe_hw *hw)
|
||||
* - we are 82599 and link partner is not AN enabled
|
||||
*/
|
||||
links = IXGBE_READ_REG(hw, IXGBE_LINKS);
|
||||
if ((links & IXGBE_LINKS_KX_AN_COMP) == 0)
|
||||
if ((links & IXGBE_LINKS_KX_AN_COMP) == 0) {
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"Auto-Negotiation did not complete");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (hw->mac.type == ixgbe_mac_82599EB) {
|
||||
links2 = IXGBE_READ_REG(hw, IXGBE_LINKS2);
|
||||
if ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0)
|
||||
if ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0) {
|
||||
ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
|
||||
"Link partner is not AN enabled");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Read the 10g AN autoc and LP ability registers and resolve
|
||||
@ -2920,12 +2997,17 @@ void ixgbe_fc_autoneg(struct ixgbe_hw *hw)
|
||||
* - FC autoneg is disabled, or if
|
||||
* - link is not up.
|
||||
*/
|
||||
if (hw->fc.disable_fc_autoneg)
|
||||
if (hw->fc.disable_fc_autoneg) {
|
||||
ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
|
||||
"Flow control autoneg is disabled");
|
||||
goto out;
|
||||
}
|
||||
|
||||
hw->mac.ops.check_link(hw, &speed, &link_up, FALSE);
|
||||
if (!link_up)
|
||||
if (!link_up) {
|
||||
ERROR_REPORT1(IXGBE_ERROR_SOFTWARE, "The link is down");
|
||||
goto out;
|
||||
}
|
||||
|
||||
switch (hw->phy.media_type) {
|
||||
/* Autoneg flow control on fiber adapters */
|
||||
@ -2942,7 +3024,7 @@ void ixgbe_fc_autoneg(struct ixgbe_hw *hw)
|
||||
|
||||
/* Autoneg flow control on copper adapters */
|
||||
case ixgbe_media_type_copper:
|
||||
if (ixgbe_device_supports_autoneg_fc(hw) == IXGBE_SUCCESS)
|
||||
if (ixgbe_device_supports_autoneg_fc(hw))
|
||||
ret_val = ixgbe_fc_autoneg_copper(hw);
|
||||
break;
|
||||
|
||||
@ -2959,6 +3041,53 @@ void ixgbe_fc_autoneg(struct ixgbe_hw *hw)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ixgbe_pcie_timeout_poll - Return number of times to poll for completion
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* System-wide timeout range is encoded in PCIe Device Control2 register.
|
||||
*
|
||||
* Add 10% to specified maximum and return the number of times to poll for
|
||||
* completion timeout, in units of 100 microsec. Never return less than
|
||||
* 800 = 80 millisec.
|
||||
*/
|
||||
static u32 ixgbe_pcie_timeout_poll(struct ixgbe_hw *hw)
|
||||
{
|
||||
s16 devctl2;
|
||||
u32 pollcnt;
|
||||
|
||||
devctl2 = IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_DEVICE_CONTROL2);
|
||||
devctl2 &= IXGBE_PCIDEVCTRL2_TIMEO_MASK;
|
||||
|
||||
switch (devctl2) {
|
||||
case IXGBE_PCIDEVCTRL2_65_130ms:
|
||||
pollcnt = 1300; /* 130 millisec */
|
||||
break;
|
||||
case IXGBE_PCIDEVCTRL2_260_520ms:
|
||||
pollcnt = 5200; /* 520 millisec */
|
||||
break;
|
||||
case IXGBE_PCIDEVCTRL2_1_2s:
|
||||
pollcnt = 20000; /* 2 sec */
|
||||
break;
|
||||
case IXGBE_PCIDEVCTRL2_4_8s:
|
||||
pollcnt = 80000; /* 8 sec */
|
||||
break;
|
||||
case IXGBE_PCIDEVCTRL2_17_34s:
|
||||
pollcnt = 34000; /* 34 sec */
|
||||
break;
|
||||
case IXGBE_PCIDEVCTRL2_50_100us: /* 100 microsecs */
|
||||
case IXGBE_PCIDEVCTRL2_1_2ms: /* 2 millisecs */
|
||||
case IXGBE_PCIDEVCTRL2_16_32ms: /* 32 millisec */
|
||||
case IXGBE_PCIDEVCTRL2_16_32ms_def: /* 32 millisec default */
|
||||
default:
|
||||
pollcnt = 800; /* 80 millisec minimum */
|
||||
break;
|
||||
}
|
||||
|
||||
/* add 10% to spec maximum */
|
||||
return (pollcnt * 11) / 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_disable_pcie_master - Disable PCI-express master access
|
||||
* @hw: pointer to hardware structure
|
||||
@ -2971,14 +3100,14 @@ void ixgbe_fc_autoneg(struct ixgbe_hw *hw)
|
||||
s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
|
||||
{
|
||||
s32 status = IXGBE_SUCCESS;
|
||||
u32 i;
|
||||
u32 i, poll;
|
||||
|
||||
DEBUGFUNC("ixgbe_disable_pcie_master");
|
||||
|
||||
/* Always set this bit to ensure any future transactions are blocked */
|
||||
IXGBE_WRITE_REG(hw, IXGBE_CTRL, IXGBE_CTRL_GIO_DIS);
|
||||
|
||||
/* Exit if master requets are blocked */
|
||||
/* Exit if master requests are blocked */
|
||||
if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO))
|
||||
goto out;
|
||||
|
||||
@ -3004,14 +3133,16 @@ s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
|
||||
* Before proceeding, make sure that the PCIe block does not have
|
||||
* transactions pending.
|
||||
*/
|
||||
for (i = 0; i < IXGBE_PCI_MASTER_DISABLE_TIMEOUT; i++) {
|
||||
poll = ixgbe_pcie_timeout_poll(hw);
|
||||
for (i = 0; i < poll; i++) {
|
||||
usec_delay(100);
|
||||
if (!(IXGBE_READ_PCIE_WORD(hw, IXGBE_PCI_DEVICE_STATUS) &
|
||||
IXGBE_PCI_DEVICE_STATUS_TRANSACTION_PENDING))
|
||||
goto out;
|
||||
}
|
||||
|
||||
DEBUGOUT("PCIe transaction pending bit also did not clear.\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"PCIe transaction pending bit also did not clear.\n");
|
||||
status = IXGBE_ERR_MASTER_REQUESTS_PENDING;
|
||||
|
||||
out:
|
||||
@ -3028,44 +3159,41 @@ s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)
|
||||
**/
|
||||
s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask)
|
||||
{
|
||||
u32 gssr;
|
||||
u32 gssr = 0;
|
||||
u32 swmask = mask;
|
||||
u32 fwmask = mask << 5;
|
||||
s32 timeout = 200;
|
||||
u32 timeout = 200;
|
||||
u32 i;
|
||||
|
||||
DEBUGFUNC("ixgbe_acquire_swfw_sync");
|
||||
|
||||
while (timeout) {
|
||||
for (i = 0; i < timeout; i++) {
|
||||
/*
|
||||
* SW EEPROM semaphore bit is used for access to all
|
||||
* SW_FW_SYNC/GSSR bits (not just EEPROM)
|
||||
* SW NVM semaphore bit is used for access to all
|
||||
* SW_FW_SYNC bits (not just NVM)
|
||||
*/
|
||||
if (ixgbe_get_eeprom_semaphore(hw))
|
||||
return IXGBE_ERR_SWFW_SYNC;
|
||||
|
||||
gssr = IXGBE_READ_REG(hw, IXGBE_GSSR);
|
||||
if (!(gssr & (fwmask | swmask)))
|
||||
break;
|
||||
|
||||
/*
|
||||
* Firmware currently using resource (fwmask) or other software
|
||||
* thread currently using resource (swmask)
|
||||
*/
|
||||
ixgbe_release_eeprom_semaphore(hw);
|
||||
msec_delay(5);
|
||||
timeout--;
|
||||
if (!(gssr & (fwmask | swmask))) {
|
||||
gssr |= swmask;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_GSSR, gssr);
|
||||
ixgbe_release_eeprom_semaphore(hw);
|
||||
return IXGBE_SUCCESS;
|
||||
} else {
|
||||
/* Resource is currently in use by FW or SW */
|
||||
ixgbe_release_eeprom_semaphore(hw);
|
||||
msec_delay(5);
|
||||
}
|
||||
}
|
||||
|
||||
if (!timeout) {
|
||||
DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n");
|
||||
return IXGBE_ERR_SWFW_SYNC;
|
||||
}
|
||||
/* If time expired clear the bits holding the lock and retry */
|
||||
if (gssr & (fwmask | swmask))
|
||||
ixgbe_release_swfw_sync(hw, gssr & (fwmask | swmask));
|
||||
|
||||
gssr |= swmask;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_GSSR, gssr);
|
||||
|
||||
ixgbe_release_eeprom_semaphore(hw);
|
||||
return IXGBE_SUCCESS;
|
||||
msec_delay(5);
|
||||
return IXGBE_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3282,15 +3410,23 @@ s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index)
|
||||
static s32 ixgbe_get_san_mac_addr_offset(struct ixgbe_hw *hw,
|
||||
u16 *san_mac_offset)
|
||||
{
|
||||
s32 ret_val;
|
||||
|
||||
DEBUGFUNC("ixgbe_get_san_mac_addr_offset");
|
||||
|
||||
/*
|
||||
* First read the EEPROM pointer to see if the MAC addresses are
|
||||
* available.
|
||||
*/
|
||||
hw->eeprom.ops.read(hw, IXGBE_SAN_MAC_ADDR_PTR, san_mac_offset);
|
||||
ret_val = hw->eeprom.ops.read(hw, IXGBE_SAN_MAC_ADDR_PTR,
|
||||
san_mac_offset);
|
||||
if (ret_val) {
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"eeprom at offset %d failed",
|
||||
IXGBE_SAN_MAC_ADDR_PTR);
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3307,6 +3443,7 @@ s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr)
|
||||
{
|
||||
u16 san_mac_data, san_mac_offset;
|
||||
u8 i;
|
||||
s32 ret_val;
|
||||
|
||||
DEBUGFUNC("ixgbe_get_san_mac_addr_generic");
|
||||
|
||||
@ -3314,18 +3451,9 @@ s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr)
|
||||
* First read the EEPROM pointer to see if the MAC addresses are
|
||||
* available. If they're not, no point in calling set_lan_id() here.
|
||||
*/
|
||||
ixgbe_get_san_mac_addr_offset(hw, &san_mac_offset);
|
||||
|
||||
if ((san_mac_offset == 0) || (san_mac_offset == 0xFFFF)) {
|
||||
/*
|
||||
* No addresses available in this EEPROM. It's not an
|
||||
* error though, so just wipe the local address and return.
|
||||
*/
|
||||
for (i = 0; i < 6; i++)
|
||||
san_mac_addr[i] = 0xFF;
|
||||
|
||||
ret_val = ixgbe_get_san_mac_addr_offset(hw, &san_mac_offset);
|
||||
if (ret_val || san_mac_offset == 0 || san_mac_offset == 0xFFFF)
|
||||
goto san_mac_addr_out;
|
||||
}
|
||||
|
||||
/* make sure we know which port we need to program */
|
||||
hw->mac.ops.set_lan_id(hw);
|
||||
@ -3333,13 +3461,27 @@ s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr)
|
||||
(hw->bus.func) ? (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT1_OFFSET) :
|
||||
(san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT0_OFFSET);
|
||||
for (i = 0; i < 3; i++) {
|
||||
hw->eeprom.ops.read(hw, san_mac_offset, &san_mac_data);
|
||||
ret_val = hw->eeprom.ops.read(hw, san_mac_offset,
|
||||
&san_mac_data);
|
||||
if (ret_val) {
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"eeprom read at offset %d failed",
|
||||
san_mac_offset);
|
||||
goto san_mac_addr_out;
|
||||
}
|
||||
san_mac_addr[i * 2] = (u8)(san_mac_data);
|
||||
san_mac_addr[i * 2 + 1] = (u8)(san_mac_data >> 8);
|
||||
san_mac_offset++;
|
||||
}
|
||||
return IXGBE_SUCCESS;
|
||||
|
||||
san_mac_addr_out:
|
||||
/*
|
||||
* No addresses available in this EEPROM. It's not an
|
||||
* error though, so just wipe the local address and return.
|
||||
*/
|
||||
for (i = 0; i < 6; i++)
|
||||
san_mac_addr[i] = 0xFF;
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -3352,19 +3494,16 @@ s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr)
|
||||
**/
|
||||
s32 ixgbe_set_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr)
|
||||
{
|
||||
s32 status = IXGBE_SUCCESS;
|
||||
s32 ret_val;
|
||||
u16 san_mac_data, san_mac_offset;
|
||||
u8 i;
|
||||
|
||||
DEBUGFUNC("ixgbe_set_san_mac_addr_generic");
|
||||
|
||||
/* Look for SAN mac address pointer. If not defined, return */
|
||||
ixgbe_get_san_mac_addr_offset(hw, &san_mac_offset);
|
||||
|
||||
if ((san_mac_offset == 0) || (san_mac_offset == 0xFFFF)) {
|
||||
status = IXGBE_ERR_NO_SAN_ADDR_PTR;
|
||||
goto san_mac_addr_out;
|
||||
}
|
||||
ret_val = ixgbe_get_san_mac_addr_offset(hw, &san_mac_offset);
|
||||
if (ret_val || san_mac_offset == 0 || san_mac_offset == 0xFFFF)
|
||||
return IXGBE_ERR_NO_SAN_ADDR_PTR;
|
||||
|
||||
/* Make sure we know which port we need to write */
|
||||
hw->mac.ops.set_lan_id(hw);
|
||||
@ -3379,8 +3518,7 @@ s32 ixgbe_set_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr)
|
||||
san_mac_offset++;
|
||||
}
|
||||
|
||||
san_mac_addr_out:
|
||||
return status;
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3507,7 +3645,8 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
|
||||
|
||||
/* Make sure we are using a valid rar index range */
|
||||
if (rar >= rar_entries) {
|
||||
DEBUGOUT1("RAR index %d is out of range.\n", rar);
|
||||
ERROR_REPORT2(IXGBE_ERROR_ARGUMENT,
|
||||
"RAR index %d is out of range.\n", rar);
|
||||
return IXGBE_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@ -3556,7 +3695,8 @@ s32 ixgbe_set_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
|
||||
|
||||
/* Make sure we are using a valid rar index range */
|
||||
if (rar >= rar_entries) {
|
||||
DEBUGOUT1("RAR index %d is out of range.\n", rar);
|
||||
ERROR_REPORT2(IXGBE_ERROR_ARGUMENT,
|
||||
"RAR index %d is out of range.\n", rar);
|
||||
return IXGBE_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@ -3655,7 +3795,8 @@ s32 ixgbe_find_vlvf_slot(struct ixgbe_hw *hw, u32 vlan)
|
||||
if (first_empty_slot)
|
||||
regindex = first_empty_slot;
|
||||
else {
|
||||
DEBUGOUT("No space in VLVF.\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_SOFTWARE,
|
||||
"No space in VLVF.\n");
|
||||
regindex = IXGBE_ERR_NO_SPACE;
|
||||
}
|
||||
}
|
||||
@ -3945,8 +4086,9 @@ s32 ixgbe_get_wwn_prefix_generic(struct ixgbe_hw *hw, u16 *wwnn_prefix,
|
||||
*wwpn_prefix = 0xFFFF;
|
||||
|
||||
/* check if alternative SAN MAC is supported */
|
||||
hw->eeprom.ops.read(hw, IXGBE_ALT_SAN_MAC_ADDR_BLK_PTR,
|
||||
&alt_san_mac_blk_offset);
|
||||
offset = IXGBE_ALT_SAN_MAC_ADDR_BLK_PTR;
|
||||
if (hw->eeprom.ops.read(hw, offset, &alt_san_mac_blk_offset))
|
||||
goto wwn_prefix_err;
|
||||
|
||||
if ((alt_san_mac_blk_offset == 0) ||
|
||||
(alt_san_mac_blk_offset == 0xFFFF))
|
||||
@ -3954,19 +4096,29 @@ s32 ixgbe_get_wwn_prefix_generic(struct ixgbe_hw *hw, u16 *wwnn_prefix,
|
||||
|
||||
/* check capability in alternative san mac address block */
|
||||
offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_CAPS_OFFSET;
|
||||
hw->eeprom.ops.read(hw, offset, &caps);
|
||||
if (hw->eeprom.ops.read(hw, offset, &caps))
|
||||
goto wwn_prefix_err;
|
||||
if (!(caps & IXGBE_ALT_SAN_MAC_ADDR_CAPS_ALTWWN))
|
||||
goto wwn_prefix_out;
|
||||
|
||||
/* get the corresponding prefix for WWNN/WWPN */
|
||||
offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_WWNN_OFFSET;
|
||||
hw->eeprom.ops.read(hw, offset, wwnn_prefix);
|
||||
if (hw->eeprom.ops.read(hw, offset, wwnn_prefix)) {
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"eeprom read at offset %d failed", offset);
|
||||
}
|
||||
|
||||
offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_WWPN_OFFSET;
|
||||
hw->eeprom.ops.read(hw, offset, wwpn_prefix);
|
||||
if (hw->eeprom.ops.read(hw, offset, wwpn_prefix))
|
||||
goto wwn_prefix_err;
|
||||
|
||||
wwn_prefix_out:
|
||||
return IXGBE_SUCCESS;
|
||||
|
||||
wwn_prefix_err:
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"eeprom read at offset %d failed", offset);
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4412,3 +4564,21 @@ void ixgbe_clear_tx_pending(struct ixgbe_hw *hw)
|
||||
IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_get_rtrup2tc_generic - read rtrup2tc reg
|
||||
* @hw: pointer to hardware structure
|
||||
* @map: pointer to u8 arr for returning map
|
||||
*
|
||||
* Read the rtrup2tc HW register and resolve its content into map
|
||||
**/
|
||||
void ixgbe_dcb_get_rtrup2tc_generic(struct ixgbe_hw *hw, u8 *map)
|
||||
{
|
||||
u32 reg, i;
|
||||
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_RTRUP2TC);
|
||||
for (i = 0; i < IXGBE_DCB_MAX_USER_PRIORITY; i++)
|
||||
map[i] = IXGBE_RTRUP2TC_UP_MASK &
|
||||
(reg >> (i * IXGBE_RTRUP2TC_UP_SHIFT));
|
||||
return;
|
||||
}
|
||||
|
@ -48,6 +48,8 @@ struct ixgbe_pba {
|
||||
};
|
||||
#endif
|
||||
|
||||
void ixgbe_dcb_get_rtrup2tc_generic(struct ixgbe_hw *hw, u8 *map);
|
||||
|
||||
u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw);
|
||||
@ -66,6 +68,7 @@ s32 ixgbe_get_pba_block_size(struct ixgbe_hw *hw, u16 *eeprom_buf,
|
||||
u32 eeprom_buf_size, u16 *pba_block_size);
|
||||
s32 ixgbe_get_mac_addr_generic(struct ixgbe_hw *hw, u8 *mac_addr);
|
||||
s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw);
|
||||
void ixgbe_set_pci_config_data_generic(struct ixgbe_hw *hw, u16 link_status);
|
||||
void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw);
|
||||
|
||||
@ -108,7 +111,7 @@ s32 ixgbe_disable_sec_rx_path_generic(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_enable_sec_rx_path_generic(struct ixgbe_hw *hw);
|
||||
|
||||
s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw);
|
||||
bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw);
|
||||
void ixgbe_fc_autoneg(struct ixgbe_hw *hw);
|
||||
|
||||
s32 ixgbe_validate_mac_addr(u8 *mac_addr);
|
||||
@ -156,5 +159,6 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
|
||||
void ixgbe_clear_tx_pending(struct ixgbe_hw *hw);
|
||||
|
||||
extern s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw);
|
||||
extern void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw);
|
||||
|
||||
#endif /* IXGBE_COMMON */
|
||||
|
718
sys/dev/ixgbe/ixgbe_dcb.c
Normal file
718
sys/dev/ixgbe/ixgbe_dcb.c
Normal file
@ -0,0 +1,718 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2013, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
|
||||
#include "ixgbe_type.h"
|
||||
#include "ixgbe_dcb.h"
|
||||
#include "ixgbe_dcb_82598.h"
|
||||
#include "ixgbe_dcb_82599.h"
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_calculate_tc_credits - This calculates the ieee traffic class
|
||||
* credits from the configured bandwidth percentages. Credits
|
||||
* are the smallest unit programmable into the underlying
|
||||
* hardware. The IEEE 802.1Qaz specification do not use bandwidth
|
||||
* groups so this is much simplified from the CEE case.
|
||||
*/
|
||||
s32 ixgbe_dcb_calculate_tc_credits(u8 *bw, u16 *refill, u16 *max,
|
||||
int max_frame_size)
|
||||
{
|
||||
int min_percent = 100;
|
||||
int min_credit, multiplier;
|
||||
int i;
|
||||
|
||||
min_credit = ((max_frame_size / 2) + IXGBE_DCB_CREDIT_QUANTUM - 1) /
|
||||
IXGBE_DCB_CREDIT_QUANTUM;
|
||||
|
||||
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
if (bw[i] < min_percent && bw[i])
|
||||
min_percent = bw[i];
|
||||
}
|
||||
|
||||
multiplier = (min_credit / min_percent) + 1;
|
||||
|
||||
/* Find out the hw credits for each TC */
|
||||
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
int val = min(bw[i] * multiplier, IXGBE_DCB_MAX_CREDIT_REFILL);
|
||||
|
||||
if (val < min_credit)
|
||||
val = min_credit;
|
||||
refill[i] = (u16)val;
|
||||
|
||||
max[i] = bw[i] ? (bw[i]*IXGBE_DCB_MAX_CREDIT)/100 : min_credit;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_calculate_tc_credits_cee - Calculates traffic class credits
|
||||
* @ixgbe_dcb_config: Struct containing DCB settings.
|
||||
* @direction: Configuring either Tx or Rx.
|
||||
*
|
||||
* This function calculates the credits allocated to each traffic class.
|
||||
* It should be called only after the rules are checked by
|
||||
* ixgbe_dcb_check_config_cee().
|
||||
*/
|
||||
s32 ixgbe_dcb_calculate_tc_credits_cee(struct ixgbe_hw *hw,
|
||||
struct ixgbe_dcb_config *dcb_config,
|
||||
u32 max_frame_size, u8 direction)
|
||||
{
|
||||
struct ixgbe_dcb_tc_path *p;
|
||||
u32 min_multiplier = 0;
|
||||
u16 min_percent = 100;
|
||||
s32 ret_val = IXGBE_SUCCESS;
|
||||
/* Initialization values default for Tx settings */
|
||||
u32 min_credit = 0;
|
||||
u32 credit_refill = 0;
|
||||
u32 credit_max = 0;
|
||||
u16 link_percentage = 0;
|
||||
u8 bw_percent = 0;
|
||||
u8 i;
|
||||
|
||||
if (dcb_config == NULL) {
|
||||
ret_val = IXGBE_ERR_CONFIG;
|
||||
goto out;
|
||||
}
|
||||
|
||||
min_credit = ((max_frame_size / 2) + IXGBE_DCB_CREDIT_QUANTUM - 1) /
|
||||
IXGBE_DCB_CREDIT_QUANTUM;
|
||||
|
||||
/* Find smallest link percentage */
|
||||
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
p = &dcb_config->tc_config[i].path[direction];
|
||||
bw_percent = dcb_config->bw_percentage[direction][p->bwg_id];
|
||||
link_percentage = p->bwg_percent;
|
||||
|
||||
link_percentage = (link_percentage * bw_percent) / 100;
|
||||
|
||||
if (link_percentage && link_percentage < min_percent)
|
||||
min_percent = link_percentage;
|
||||
}
|
||||
|
||||
/*
|
||||
* The ratio between traffic classes will control the bandwidth
|
||||
* percentages seen on the wire. To calculate this ratio we use
|
||||
* a multiplier. It is required that the refill credits must be
|
||||
* larger than the max frame size so here we find the smallest
|
||||
* multiplier that will allow all bandwidth percentages to be
|
||||
* greater than the max frame size.
|
||||
*/
|
||||
min_multiplier = (min_credit / min_percent) + 1;
|
||||
|
||||
/* Find out the link percentage for each TC first */
|
||||
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
p = &dcb_config->tc_config[i].path[direction];
|
||||
bw_percent = dcb_config->bw_percentage[direction][p->bwg_id];
|
||||
|
||||
link_percentage = p->bwg_percent;
|
||||
/* Must be careful of integer division for very small nums */
|
||||
link_percentage = (link_percentage * bw_percent) / 100;
|
||||
if (p->bwg_percent > 0 && link_percentage == 0)
|
||||
link_percentage = 1;
|
||||
|
||||
/* Save link_percentage for reference */
|
||||
p->link_percent = (u8)link_percentage;
|
||||
|
||||
/* Calculate credit refill ratio using multiplier */
|
||||
credit_refill = min(link_percentage * min_multiplier,
|
||||
(u32)IXGBE_DCB_MAX_CREDIT_REFILL);
|
||||
p->data_credits_refill = (u16)credit_refill;
|
||||
|
||||
/* Calculate maximum credit for the TC */
|
||||
credit_max = (link_percentage * IXGBE_DCB_MAX_CREDIT) / 100;
|
||||
|
||||
/*
|
||||
* Adjustment based on rule checking, if the percentage
|
||||
* of a TC is too small, the maximum credit may not be
|
||||
* enough to send out a jumbo frame in data plane arbitration.
|
||||
*/
|
||||
if (credit_max && (credit_max < min_credit))
|
||||
credit_max = min_credit;
|
||||
|
||||
if (direction == IXGBE_DCB_TX_CONFIG) {
|
||||
/*
|
||||
* Adjustment based on rule checking, if the
|
||||
* percentage of a TC is too small, the maximum
|
||||
* credit may not be enough to send out a TSO
|
||||
* packet in descriptor plane arbitration.
|
||||
*/
|
||||
if (credit_max && (credit_max <
|
||||
IXGBE_DCB_MIN_TSO_CREDIT)
|
||||
&& (hw->mac.type == ixgbe_mac_82598EB))
|
||||
credit_max = IXGBE_DCB_MIN_TSO_CREDIT;
|
||||
|
||||
dcb_config->tc_config[i].desc_credits_max =
|
||||
(u16)credit_max;
|
||||
}
|
||||
|
||||
p->data_credits_max = (u16)credit_max;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_unpack_pfc_cee - Unpack dcb_config PFC info
|
||||
* @cfg: dcb configuration to unpack into hardware consumable fields
|
||||
* @map: user priority to traffic class map
|
||||
* @pfc_up: u8 to store user priority PFC bitmask
|
||||
*
|
||||
* This unpacks the dcb configuration PFC info which is stored per
|
||||
* traffic class into a 8bit user priority bitmask that can be
|
||||
* consumed by hardware routines. The priority to tc map must be
|
||||
* updated before calling this routine to use current up-to maps.
|
||||
*/
|
||||
void ixgbe_dcb_unpack_pfc_cee(struct ixgbe_dcb_config *cfg, u8 *map, u8 *pfc_up)
|
||||
{
|
||||
struct ixgbe_dcb_tc_config *tc_config = &cfg->tc_config[0];
|
||||
int up;
|
||||
|
||||
/*
|
||||
* If the TC for this user priority has PFC enabled then set the
|
||||
* matching bit in 'pfc_up' to reflect that PFC is enabled.
|
||||
*/
|
||||
for (*pfc_up = 0, up = 0; up < IXGBE_DCB_MAX_USER_PRIORITY; up++) {
|
||||
if (tc_config[map[up]].pfc != ixgbe_dcb_pfc_disabled)
|
||||
*pfc_up |= 1 << up;
|
||||
}
|
||||
}
|
||||
|
||||
void ixgbe_dcb_unpack_refill_cee(struct ixgbe_dcb_config *cfg, int direction,
|
||||
u16 *refill)
|
||||
{
|
||||
struct ixgbe_dcb_tc_config *tc_config = &cfg->tc_config[0];
|
||||
int tc;
|
||||
|
||||
for (tc = 0; tc < IXGBE_DCB_MAX_TRAFFIC_CLASS; tc++)
|
||||
refill[tc] = tc_config[tc].path[direction].data_credits_refill;
|
||||
}
|
||||
|
||||
void ixgbe_dcb_unpack_max_cee(struct ixgbe_dcb_config *cfg, u16 *max)
|
||||
{
|
||||
struct ixgbe_dcb_tc_config *tc_config = &cfg->tc_config[0];
|
||||
int tc;
|
||||
|
||||
for (tc = 0; tc < IXGBE_DCB_MAX_TRAFFIC_CLASS; tc++)
|
||||
max[tc] = tc_config[tc].desc_credits_max;
|
||||
}
|
||||
|
||||
void ixgbe_dcb_unpack_bwgid_cee(struct ixgbe_dcb_config *cfg, int direction,
|
||||
u8 *bwgid)
|
||||
{
|
||||
struct ixgbe_dcb_tc_config *tc_config = &cfg->tc_config[0];
|
||||
int tc;
|
||||
|
||||
for (tc = 0; tc < IXGBE_DCB_MAX_TRAFFIC_CLASS; tc++)
|
||||
bwgid[tc] = tc_config[tc].path[direction].bwg_id;
|
||||
}
|
||||
|
||||
void ixgbe_dcb_unpack_tsa_cee(struct ixgbe_dcb_config *cfg, int direction,
|
||||
u8 *tsa)
|
||||
{
|
||||
struct ixgbe_dcb_tc_config *tc_config = &cfg->tc_config[0];
|
||||
int tc;
|
||||
|
||||
for (tc = 0; tc < IXGBE_DCB_MAX_TRAFFIC_CLASS; tc++)
|
||||
tsa[tc] = tc_config[tc].path[direction].tsa;
|
||||
}
|
||||
|
||||
u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *cfg, int direction, u8 up)
|
||||
{
|
||||
struct ixgbe_dcb_tc_config *tc_config = &cfg->tc_config[0];
|
||||
u8 prio_mask = 1 << up;
|
||||
u8 tc = cfg->num_tcs.pg_tcs;
|
||||
|
||||
/* If tc is 0 then DCB is likely not enabled or supported */
|
||||
if (!tc)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Test from maximum TC to 1 and report the first match we find. If
|
||||
* we find no match we can assume that the TC is 0 since the TC must
|
||||
* be set for all user priorities
|
||||
*/
|
||||
for (tc--; tc; tc--) {
|
||||
if (prio_mask & tc_config[tc].path[direction].up_to_tc_bitmap)
|
||||
break;
|
||||
}
|
||||
out:
|
||||
return tc;
|
||||
}
|
||||
|
||||
void ixgbe_dcb_unpack_map_cee(struct ixgbe_dcb_config *cfg, int direction,
|
||||
u8 *map)
|
||||
{
|
||||
u8 up;
|
||||
|
||||
for (up = 0; up < IXGBE_DCB_MAX_USER_PRIORITY; up++)
|
||||
map[up] = ixgbe_dcb_get_tc_from_up(cfg, direction, up);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config - Struct containing DCB settings.
|
||||
* @dcb_config: Pointer to DCB config structure
|
||||
*
|
||||
* This function checks DCB rules for DCB settings.
|
||||
* The following rules are checked:
|
||||
* 1. The sum of bandwidth percentages of all Bandwidth Groups must total 100%.
|
||||
* 2. The sum of bandwidth percentages of all Traffic Classes within a Bandwidth
|
||||
* Group must total 100.
|
||||
* 3. A Traffic Class should not be set to both Link Strict Priority
|
||||
* and Group Strict Priority.
|
||||
* 4. Link strict Bandwidth Groups can only have link strict traffic classes
|
||||
* with zero bandwidth.
|
||||
*/
|
||||
s32 ixgbe_dcb_check_config_cee(struct ixgbe_dcb_config *dcb_config)
|
||||
{
|
||||
struct ixgbe_dcb_tc_path *p;
|
||||
s32 ret_val = IXGBE_SUCCESS;
|
||||
u8 i, j, bw = 0, bw_id;
|
||||
u8 bw_sum[2][IXGBE_DCB_MAX_BW_GROUP];
|
||||
bool link_strict[2][IXGBE_DCB_MAX_BW_GROUP];
|
||||
|
||||
memset(bw_sum, 0, sizeof(bw_sum));
|
||||
memset(link_strict, 0, sizeof(link_strict));
|
||||
|
||||
/* First Tx, then Rx */
|
||||
for (i = 0; i < 2; i++) {
|
||||
/* Check each traffic class for rule violation */
|
||||
for (j = 0; j < IXGBE_DCB_MAX_TRAFFIC_CLASS; j++) {
|
||||
p = &dcb_config->tc_config[j].path[i];
|
||||
|
||||
bw = p->bwg_percent;
|
||||
bw_id = p->bwg_id;
|
||||
|
||||
if (bw_id >= IXGBE_DCB_MAX_BW_GROUP) {
|
||||
ret_val = IXGBE_ERR_CONFIG;
|
||||
goto err_config;
|
||||
}
|
||||
if (p->tsa == ixgbe_dcb_tsa_strict) {
|
||||
link_strict[i][bw_id] = TRUE;
|
||||
/* Link strict should have zero bandwidth */
|
||||
if (bw) {
|
||||
ret_val = IXGBE_ERR_CONFIG;
|
||||
goto err_config;
|
||||
}
|
||||
} else if (!bw) {
|
||||
/*
|
||||
* Traffic classes without link strict
|
||||
* should have non-zero bandwidth.
|
||||
*/
|
||||
ret_val = IXGBE_ERR_CONFIG;
|
||||
goto err_config;
|
||||
}
|
||||
bw_sum[i][bw_id] += bw;
|
||||
}
|
||||
|
||||
bw = 0;
|
||||
|
||||
/* Check each bandwidth group for rule violation */
|
||||
for (j = 0; j < IXGBE_DCB_MAX_BW_GROUP; j++) {
|
||||
bw += dcb_config->bw_percentage[i][j];
|
||||
/*
|
||||
* Sum of bandwidth percentages of all traffic classes
|
||||
* within a Bandwidth Group must total 100 except for
|
||||
* link strict group (zero bandwidth).
|
||||
*/
|
||||
if (link_strict[i][j]) {
|
||||
if (bw_sum[i][j]) {
|
||||
/*
|
||||
* Link strict group should have zero
|
||||
* bandwidth.
|
||||
*/
|
||||
ret_val = IXGBE_ERR_CONFIG;
|
||||
goto err_config;
|
||||
}
|
||||
} else if (bw_sum[i][j] != IXGBE_DCB_BW_PERCENT &&
|
||||
bw_sum[i][j] != 0) {
|
||||
ret_val = IXGBE_ERR_CONFIG;
|
||||
goto err_config;
|
||||
}
|
||||
}
|
||||
|
||||
if (bw != IXGBE_DCB_BW_PERCENT) {
|
||||
ret_val = IXGBE_ERR_CONFIG;
|
||||
goto err_config;
|
||||
}
|
||||
}
|
||||
|
||||
err_config:
|
||||
DEBUGOUT2("DCB error code %d while checking %s settings.\n",
|
||||
ret_val, (i == IXGBE_DCB_TX_CONFIG) ? "Tx" : "Rx");
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_get_tc_stats - Returns status of each traffic class
|
||||
* @hw: pointer to hardware structure
|
||||
* @stats: pointer to statistics structure
|
||||
* @tc_count: Number of elements in bwg_array.
|
||||
*
|
||||
* This function returns the status data for each of the Traffic Classes in use.
|
||||
*/
|
||||
s32 ixgbe_dcb_get_tc_stats(struct ixgbe_hw *hw, struct ixgbe_hw_stats *stats,
|
||||
u8 tc_count)
|
||||
{
|
||||
s32 ret = IXGBE_NOT_IMPLEMENTED;
|
||||
switch (hw->mac.type) {
|
||||
case ixgbe_mac_82598EB:
|
||||
ret = ixgbe_dcb_get_tc_stats_82598(hw, stats, tc_count);
|
||||
break;
|
||||
case ixgbe_mac_82599EB:
|
||||
case ixgbe_mac_X540:
|
||||
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
|
||||
ret = ixgbe_dcb_get_tc_stats_82599(hw, stats, tc_count);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_get_pfc_stats - Returns CBFC status of each traffic class
|
||||
* @hw: pointer to hardware structure
|
||||
* @stats: pointer to statistics structure
|
||||
* @tc_count: Number of elements in bwg_array.
|
||||
*
|
||||
* This function returns the CBFC status data for each of the Traffic Classes.
|
||||
*/
|
||||
s32 ixgbe_dcb_get_pfc_stats(struct ixgbe_hw *hw, struct ixgbe_hw_stats *stats,
|
||||
u8 tc_count)
|
||||
{
|
||||
s32 ret = IXGBE_NOT_IMPLEMENTED;
|
||||
switch (hw->mac.type) {
|
||||
case ixgbe_mac_82598EB:
|
||||
ret = ixgbe_dcb_get_pfc_stats_82598(hw, stats, tc_count);
|
||||
break;
|
||||
case ixgbe_mac_82599EB:
|
||||
case ixgbe_mac_X540:
|
||||
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
|
||||
ret = ixgbe_dcb_get_pfc_stats_82599(hw, stats, tc_count);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_rx_arbiter_cee - Config Rx arbiter
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure Rx Data Arbiter and credits for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_rx_arbiter_cee(struct ixgbe_hw *hw,
|
||||
struct ixgbe_dcb_config *dcb_config)
|
||||
{
|
||||
s32 ret = IXGBE_NOT_IMPLEMENTED;
|
||||
u8 tsa[IXGBE_DCB_MAX_TRAFFIC_CLASS] = { 0 };
|
||||
u8 bwgid[IXGBE_DCB_MAX_TRAFFIC_CLASS] = { 0 };
|
||||
u8 map[IXGBE_DCB_MAX_USER_PRIORITY] = { 0 };
|
||||
u16 refill[IXGBE_DCB_MAX_TRAFFIC_CLASS] = { 0 };
|
||||
u16 max[IXGBE_DCB_MAX_TRAFFIC_CLASS] = { 0 };
|
||||
|
||||
ixgbe_dcb_unpack_refill_cee(dcb_config, IXGBE_DCB_TX_CONFIG, refill);
|
||||
ixgbe_dcb_unpack_max_cee(dcb_config, max);
|
||||
ixgbe_dcb_unpack_bwgid_cee(dcb_config, IXGBE_DCB_TX_CONFIG, bwgid);
|
||||
ixgbe_dcb_unpack_tsa_cee(dcb_config, IXGBE_DCB_TX_CONFIG, tsa);
|
||||
ixgbe_dcb_unpack_map_cee(dcb_config, IXGBE_DCB_TX_CONFIG, map);
|
||||
|
||||
switch (hw->mac.type) {
|
||||
case ixgbe_mac_82598EB:
|
||||
ret = ixgbe_dcb_config_rx_arbiter_82598(hw, refill, max, tsa);
|
||||
break;
|
||||
case ixgbe_mac_82599EB:
|
||||
case ixgbe_mac_X540:
|
||||
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
|
||||
ret = ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max, bwgid,
|
||||
tsa, map);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_tx_desc_arbiter_cee - Config Tx Desc arbiter
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure Tx Descriptor Arbiter and credits for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_tx_desc_arbiter_cee(struct ixgbe_hw *hw,
|
||||
struct ixgbe_dcb_config *dcb_config)
|
||||
{
|
||||
s32 ret = IXGBE_NOT_IMPLEMENTED;
|
||||
u8 tsa[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
u8 bwgid[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
u16 refill[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
u16 max[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
|
||||
ixgbe_dcb_unpack_refill_cee(dcb_config, IXGBE_DCB_TX_CONFIG, refill);
|
||||
ixgbe_dcb_unpack_max_cee(dcb_config, max);
|
||||
ixgbe_dcb_unpack_bwgid_cee(dcb_config, IXGBE_DCB_TX_CONFIG, bwgid);
|
||||
ixgbe_dcb_unpack_tsa_cee(dcb_config, IXGBE_DCB_TX_CONFIG, tsa);
|
||||
|
||||
switch (hw->mac.type) {
|
||||
case ixgbe_mac_82598EB:
|
||||
ret = ixgbe_dcb_config_tx_desc_arbiter_82598(hw, refill, max,
|
||||
bwgid, tsa);
|
||||
break;
|
||||
case ixgbe_mac_82599EB:
|
||||
case ixgbe_mac_X540:
|
||||
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
|
||||
ret = ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max,
|
||||
bwgid, tsa);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_tx_data_arbiter_cee - Config Tx data arbiter
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure Tx Data Arbiter and credits for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_tx_data_arbiter_cee(struct ixgbe_hw *hw,
|
||||
struct ixgbe_dcb_config *dcb_config)
|
||||
{
|
||||
s32 ret = IXGBE_NOT_IMPLEMENTED;
|
||||
u8 tsa[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
u8 bwgid[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
u8 map[IXGBE_DCB_MAX_USER_PRIORITY] = { 0 };
|
||||
u16 refill[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
u16 max[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
|
||||
ixgbe_dcb_unpack_refill_cee(dcb_config, IXGBE_DCB_TX_CONFIG, refill);
|
||||
ixgbe_dcb_unpack_max_cee(dcb_config, max);
|
||||
ixgbe_dcb_unpack_bwgid_cee(dcb_config, IXGBE_DCB_TX_CONFIG, bwgid);
|
||||
ixgbe_dcb_unpack_tsa_cee(dcb_config, IXGBE_DCB_TX_CONFIG, tsa);
|
||||
ixgbe_dcb_unpack_map_cee(dcb_config, IXGBE_DCB_TX_CONFIG, map);
|
||||
|
||||
switch (hw->mac.type) {
|
||||
case ixgbe_mac_82598EB:
|
||||
ret = ixgbe_dcb_config_tx_data_arbiter_82598(hw, refill, max,
|
||||
bwgid, tsa);
|
||||
break;
|
||||
case ixgbe_mac_82599EB:
|
||||
case ixgbe_mac_X540:
|
||||
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
|
||||
ret = ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max,
|
||||
bwgid, tsa,
|
||||
map);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_pfc_cee - Config priority flow control
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure Priority Flow Control for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_pfc_cee(struct ixgbe_hw *hw,
|
||||
struct ixgbe_dcb_config *dcb_config)
|
||||
{
|
||||
s32 ret = IXGBE_NOT_IMPLEMENTED;
|
||||
u8 pfc_en;
|
||||
u8 map[IXGBE_DCB_MAX_USER_PRIORITY] = { 0 };
|
||||
|
||||
ixgbe_dcb_unpack_map_cee(dcb_config, IXGBE_DCB_TX_CONFIG, map);
|
||||
ixgbe_dcb_unpack_pfc_cee(dcb_config, map, &pfc_en);
|
||||
|
||||
switch (hw->mac.type) {
|
||||
case ixgbe_mac_82598EB:
|
||||
ret = ixgbe_dcb_config_pfc_82598(hw, pfc_en);
|
||||
break;
|
||||
case ixgbe_mac_82599EB:
|
||||
case ixgbe_mac_X540:
|
||||
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
|
||||
ret = ixgbe_dcb_config_pfc_82599(hw, pfc_en, map);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_tc_stats - Config traffic class statistics
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Configure queue statistics registers, all queues belonging to same traffic
|
||||
* class uses a single set of queue statistics counters.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_tc_stats(struct ixgbe_hw *hw)
|
||||
{
|
||||
s32 ret = IXGBE_NOT_IMPLEMENTED;
|
||||
switch (hw->mac.type) {
|
||||
case ixgbe_mac_82598EB:
|
||||
ret = ixgbe_dcb_config_tc_stats_82598(hw);
|
||||
break;
|
||||
case ixgbe_mac_82599EB:
|
||||
case ixgbe_mac_X540:
|
||||
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
|
||||
ret = ixgbe_dcb_config_tc_stats_82599(hw, NULL);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_hw_config_cee - Config and enable DCB
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure dcb settings and enable dcb mode.
|
||||
*/
|
||||
s32 ixgbe_dcb_hw_config_cee(struct ixgbe_hw *hw,
|
||||
struct ixgbe_dcb_config *dcb_config)
|
||||
{
|
||||
s32 ret = IXGBE_NOT_IMPLEMENTED;
|
||||
u8 pfc_en;
|
||||
u8 tsa[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
u8 bwgid[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
u8 map[IXGBE_DCB_MAX_USER_PRIORITY] = { 0 };
|
||||
u16 refill[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
u16 max[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
|
||||
/* Unpack CEE standard containers */
|
||||
ixgbe_dcb_unpack_refill_cee(dcb_config, IXGBE_DCB_TX_CONFIG, refill);
|
||||
ixgbe_dcb_unpack_max_cee(dcb_config, max);
|
||||
ixgbe_dcb_unpack_bwgid_cee(dcb_config, IXGBE_DCB_TX_CONFIG, bwgid);
|
||||
ixgbe_dcb_unpack_tsa_cee(dcb_config, IXGBE_DCB_TX_CONFIG, tsa);
|
||||
ixgbe_dcb_unpack_map_cee(dcb_config, IXGBE_DCB_TX_CONFIG, map);
|
||||
|
||||
hw->mac.ops.setup_rxpba(hw, dcb_config->num_tcs.pg_tcs,
|
||||
0, dcb_config->rx_pba_cfg);
|
||||
|
||||
switch (hw->mac.type) {
|
||||
case ixgbe_mac_82598EB:
|
||||
ret = ixgbe_dcb_hw_config_82598(hw, dcb_config->link_speed,
|
||||
refill, max, bwgid, tsa);
|
||||
break;
|
||||
case ixgbe_mac_82599EB:
|
||||
case ixgbe_mac_X540:
|
||||
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
|
||||
ixgbe_dcb_config_82599(hw, dcb_config);
|
||||
ret = ixgbe_dcb_hw_config_82599(hw, dcb_config->link_speed,
|
||||
refill, max, bwgid,
|
||||
tsa, map);
|
||||
|
||||
ixgbe_dcb_config_tc_stats_82599(hw, dcb_config);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ret && dcb_config->pfc_mode_enable) {
|
||||
ixgbe_dcb_unpack_pfc_cee(dcb_config, map, &pfc_en);
|
||||
ret = ixgbe_dcb_config_pfc(hw, pfc_en, map);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Helper routines to abstract HW specifics from DCB netlink ops */
|
||||
s32 ixgbe_dcb_config_pfc(struct ixgbe_hw *hw, u8 pfc_en, u8 *map)
|
||||
{
|
||||
int ret = IXGBE_ERR_PARAM;
|
||||
|
||||
switch (hw->mac.type) {
|
||||
case ixgbe_mac_82598EB:
|
||||
ret = ixgbe_dcb_config_pfc_82598(hw, pfc_en);
|
||||
break;
|
||||
case ixgbe_mac_82599EB:
|
||||
case ixgbe_mac_X540:
|
||||
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
|
||||
ret = ixgbe_dcb_config_pfc_82599(hw, pfc_en, map);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 ixgbe_dcb_hw_config(struct ixgbe_hw *hw, u16 *refill, u16 *max,
|
||||
u8 *bwg_id, u8 *tsa, u8 *map)
|
||||
{
|
||||
switch (hw->mac.type) {
|
||||
case ixgbe_mac_82598EB:
|
||||
ixgbe_dcb_config_rx_arbiter_82598(hw, refill, max, tsa);
|
||||
ixgbe_dcb_config_tx_desc_arbiter_82598(hw, refill, max, bwg_id,
|
||||
tsa);
|
||||
ixgbe_dcb_config_tx_data_arbiter_82598(hw, refill, max, bwg_id,
|
||||
tsa);
|
||||
break;
|
||||
case ixgbe_mac_82599EB:
|
||||
case ixgbe_mac_X540:
|
||||
#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
|
||||
ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max, bwg_id,
|
||||
tsa, map);
|
||||
ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max, bwg_id,
|
||||
tsa);
|
||||
ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max, bwg_id,
|
||||
tsa, map);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
176
sys/dev/ixgbe/ixgbe_dcb.h
Normal file
176
sys/dev/ixgbe/ixgbe_dcb.h
Normal file
@ -0,0 +1,176 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2013, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _IXGBE_DCB_H_
|
||||
#define _IXGBE_DCB_H_
|
||||
|
||||
|
||||
#include "ixgbe_type.h"
|
||||
|
||||
/* DCB defines */
|
||||
/* DCB credit calculation defines */
|
||||
#define IXGBE_DCB_CREDIT_QUANTUM 64
|
||||
#define IXGBE_DCB_MAX_CREDIT_REFILL 200 /* 200 * 64B = 12800B */
|
||||
#define IXGBE_DCB_MAX_TSO_SIZE (32 * 1024) /* Max TSO pkt size in DCB*/
|
||||
#define IXGBE_DCB_MAX_CREDIT (2 * IXGBE_DCB_MAX_CREDIT_REFILL)
|
||||
|
||||
/* 513 for 32KB TSO packet */
|
||||
#define IXGBE_DCB_MIN_TSO_CREDIT \
|
||||
((IXGBE_DCB_MAX_TSO_SIZE / IXGBE_DCB_CREDIT_QUANTUM) + 1)
|
||||
|
||||
/* DCB configuration defines */
|
||||
#define IXGBE_DCB_MAX_USER_PRIORITY 8
|
||||
#define IXGBE_DCB_MAX_BW_GROUP 8
|
||||
#define IXGBE_DCB_BW_PERCENT 100
|
||||
|
||||
#define IXGBE_DCB_TX_CONFIG 0
|
||||
#define IXGBE_DCB_RX_CONFIG 1
|
||||
|
||||
/* DCB capability defines */
|
||||
#define IXGBE_DCB_PG_SUPPORT 0x00000001
|
||||
#define IXGBE_DCB_PFC_SUPPORT 0x00000002
|
||||
#define IXGBE_DCB_BCN_SUPPORT 0x00000004
|
||||
#define IXGBE_DCB_UP2TC_SUPPORT 0x00000008
|
||||
#define IXGBE_DCB_GSP_SUPPORT 0x00000010
|
||||
|
||||
struct ixgbe_dcb_support {
|
||||
u32 capabilities; /* DCB capabilities */
|
||||
|
||||
/* Each bit represents a number of TCs configurable in the hw.
|
||||
* If 8 traffic classes can be configured, the value is 0x80. */
|
||||
u8 traffic_classes;
|
||||
u8 pfc_traffic_classes;
|
||||
};
|
||||
|
||||
enum ixgbe_dcb_tsa {
|
||||
ixgbe_dcb_tsa_ets = 0,
|
||||
ixgbe_dcb_tsa_group_strict_cee,
|
||||
ixgbe_dcb_tsa_strict
|
||||
};
|
||||
|
||||
/* Traffic class bandwidth allocation per direction */
|
||||
struct ixgbe_dcb_tc_path {
|
||||
u8 bwg_id; /* Bandwidth Group (BWG) ID */
|
||||
u8 bwg_percent; /* % of BWG's bandwidth */
|
||||
u8 link_percent; /* % of link bandwidth */
|
||||
u8 up_to_tc_bitmap; /* User Priority to Traffic Class mapping */
|
||||
u16 data_credits_refill; /* Credit refill amount in 64B granularity */
|
||||
u16 data_credits_max; /* Max credits for a configured packet buffer
|
||||
* in 64B granularity.*/
|
||||
enum ixgbe_dcb_tsa tsa; /* Link or Group Strict Priority */
|
||||
};
|
||||
|
||||
enum ixgbe_dcb_pfc {
|
||||
ixgbe_dcb_pfc_disabled = 0,
|
||||
ixgbe_dcb_pfc_enabled,
|
||||
ixgbe_dcb_pfc_enabled_txonly,
|
||||
ixgbe_dcb_pfc_enabled_rxonly
|
||||
};
|
||||
|
||||
/* Traffic class configuration */
|
||||
struct ixgbe_dcb_tc_config {
|
||||
struct ixgbe_dcb_tc_path path[2]; /* One each for Tx/Rx */
|
||||
enum ixgbe_dcb_pfc pfc; /* Class based flow control setting */
|
||||
|
||||
u16 desc_credits_max; /* For Tx Descriptor arbitration */
|
||||
u8 tc; /* Traffic class (TC) */
|
||||
};
|
||||
|
||||
enum ixgbe_dcb_pba {
|
||||
/* PBA[0-7] each use 64KB FIFO */
|
||||
ixgbe_dcb_pba_equal = PBA_STRATEGY_EQUAL,
|
||||
/* PBA[0-3] each use 80KB, PBA[4-7] each use 48KB */
|
||||
ixgbe_dcb_pba_80_48 = PBA_STRATEGY_WEIGHTED
|
||||
};
|
||||
|
||||
struct ixgbe_dcb_num_tcs {
|
||||
u8 pg_tcs;
|
||||
u8 pfc_tcs;
|
||||
};
|
||||
|
||||
struct ixgbe_dcb_config {
|
||||
struct ixgbe_dcb_tc_config tc_config[IXGBE_DCB_MAX_TRAFFIC_CLASS];
|
||||
struct ixgbe_dcb_support support;
|
||||
struct ixgbe_dcb_num_tcs num_tcs;
|
||||
u8 bw_percentage[2][IXGBE_DCB_MAX_BW_GROUP]; /* One each for Tx/Rx */
|
||||
bool pfc_mode_enable;
|
||||
bool round_robin_enable;
|
||||
|
||||
enum ixgbe_dcb_pba rx_pba_cfg;
|
||||
|
||||
u32 dcb_cfg_version; /* Not used...OS-specific? */
|
||||
u32 link_speed; /* For bandwidth allocation validation purpose */
|
||||
bool vt_mode;
|
||||
};
|
||||
|
||||
/* DCB driver APIs */
|
||||
|
||||
/* DCB rule checking */
|
||||
s32 ixgbe_dcb_check_config_cee(struct ixgbe_dcb_config *);
|
||||
|
||||
/* DCB credits calculation */
|
||||
s32 ixgbe_dcb_calculate_tc_credits(u8 *, u16 *, u16 *, int);
|
||||
s32 ixgbe_dcb_calculate_tc_credits_cee(struct ixgbe_hw *,
|
||||
struct ixgbe_dcb_config *, u32, u8);
|
||||
|
||||
/* DCB PFC */
|
||||
s32 ixgbe_dcb_config_pfc(struct ixgbe_hw *, u8, u8 *);
|
||||
s32 ixgbe_dcb_config_pfc_cee(struct ixgbe_hw *, struct ixgbe_dcb_config *);
|
||||
|
||||
/* DCB stats */
|
||||
s32 ixgbe_dcb_config_tc_stats(struct ixgbe_hw *);
|
||||
s32 ixgbe_dcb_get_tc_stats(struct ixgbe_hw *, struct ixgbe_hw_stats *, u8);
|
||||
s32 ixgbe_dcb_get_pfc_stats(struct ixgbe_hw *, struct ixgbe_hw_stats *, u8);
|
||||
|
||||
/* DCB config arbiters */
|
||||
s32 ixgbe_dcb_config_tx_desc_arbiter_cee(struct ixgbe_hw *,
|
||||
struct ixgbe_dcb_config *);
|
||||
s32 ixgbe_dcb_config_tx_data_arbiter_cee(struct ixgbe_hw *,
|
||||
struct ixgbe_dcb_config *);
|
||||
s32 ixgbe_dcb_config_rx_arbiter_cee(struct ixgbe_hw *,
|
||||
struct ixgbe_dcb_config *);
|
||||
|
||||
/* DCB unpack routines */
|
||||
void ixgbe_dcb_unpack_pfc_cee(struct ixgbe_dcb_config *, u8 *, u8 *);
|
||||
void ixgbe_dcb_unpack_refill_cee(struct ixgbe_dcb_config *, int, u16 *);
|
||||
void ixgbe_dcb_unpack_max_cee(struct ixgbe_dcb_config *, u16 *);
|
||||
void ixgbe_dcb_unpack_bwgid_cee(struct ixgbe_dcb_config *, int, u8 *);
|
||||
void ixgbe_dcb_unpack_tsa_cee(struct ixgbe_dcb_config *, int, u8 *);
|
||||
void ixgbe_dcb_unpack_map_cee(struct ixgbe_dcb_config *, int, u8 *);
|
||||
u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *, int, u8);
|
||||
|
||||
/* DCB initialization */
|
||||
s32 ixgbe_dcb_hw_config(struct ixgbe_hw *, u16 *, u16 *, u8 *, u8 *, u8 *);
|
||||
s32 ixgbe_dcb_hw_config_cee(struct ixgbe_hw *, struct ixgbe_dcb_config *);
|
||||
#endif /* _IXGBE_DCB_H_ */
|
359
sys/dev/ixgbe/ixgbe_dcb_82598.c
Normal file
359
sys/dev/ixgbe/ixgbe_dcb_82598.c
Normal file
@ -0,0 +1,359 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2013, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
|
||||
#include "ixgbe_type.h"
|
||||
#include "ixgbe_dcb.h"
|
||||
#include "ixgbe_dcb_82598.h"
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_get_tc_stats_82598 - Return status data for each traffic class
|
||||
* @hw: pointer to hardware structure
|
||||
* @stats: pointer to statistics structure
|
||||
* @tc_count: Number of elements in bwg_array.
|
||||
*
|
||||
* This function returns the status data for each of the Traffic Classes in use.
|
||||
*/
|
||||
s32 ixgbe_dcb_get_tc_stats_82598(struct ixgbe_hw *hw,
|
||||
struct ixgbe_hw_stats *stats,
|
||||
u8 tc_count)
|
||||
{
|
||||
int tc;
|
||||
|
||||
DEBUGFUNC("dcb_get_tc_stats");
|
||||
|
||||
if (tc_count > IXGBE_DCB_MAX_TRAFFIC_CLASS)
|
||||
return IXGBE_ERR_PARAM;
|
||||
|
||||
/* Statistics pertaining to each traffic class */
|
||||
for (tc = 0; tc < tc_count; tc++) {
|
||||
/* Transmitted Packets */
|
||||
stats->qptc[tc] += IXGBE_READ_REG(hw, IXGBE_QPTC(tc));
|
||||
/* Transmitted Bytes */
|
||||
stats->qbtc[tc] += IXGBE_READ_REG(hw, IXGBE_QBTC(tc));
|
||||
/* Received Packets */
|
||||
stats->qprc[tc] += IXGBE_READ_REG(hw, IXGBE_QPRC(tc));
|
||||
/* Received Bytes */
|
||||
stats->qbrc[tc] += IXGBE_READ_REG(hw, IXGBE_QBRC(tc));
|
||||
|
||||
#if 0
|
||||
/* Can we get rid of these?? Consequently, getting rid
|
||||
* of the tc_stats structure.
|
||||
*/
|
||||
tc_stats_array[up]->in_overflow_discards = 0;
|
||||
tc_stats_array[up]->out_overflow_discards = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_get_pfc_stats_82598 - Returns CBFC status data
|
||||
* @hw: pointer to hardware structure
|
||||
* @stats: pointer to statistics structure
|
||||
* @tc_count: Number of elements in bwg_array.
|
||||
*
|
||||
* This function returns the CBFC status data for each of the Traffic Classes.
|
||||
*/
|
||||
s32 ixgbe_dcb_get_pfc_stats_82598(struct ixgbe_hw *hw,
|
||||
struct ixgbe_hw_stats *stats,
|
||||
u8 tc_count)
|
||||
{
|
||||
int tc;
|
||||
|
||||
DEBUGFUNC("dcb_get_pfc_stats");
|
||||
|
||||
if (tc_count > IXGBE_DCB_MAX_TRAFFIC_CLASS)
|
||||
return IXGBE_ERR_PARAM;
|
||||
|
||||
for (tc = 0; tc < tc_count; tc++) {
|
||||
/* Priority XOFF Transmitted */
|
||||
stats->pxofftxc[tc] += IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(tc));
|
||||
/* Priority XOFF Received */
|
||||
stats->pxoffrxc[tc] += IXGBE_READ_REG(hw, IXGBE_PXOFFRXC(tc));
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_rx_arbiter_82598 - Config Rx data arbiter
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure Rx Data Arbiter and credits for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_rx_arbiter_82598(struct ixgbe_hw *hw, u16 *refill,
|
||||
u16 *max, u8 *tsa)
|
||||
{
|
||||
u32 reg = 0;
|
||||
u32 credit_refill = 0;
|
||||
u32 credit_max = 0;
|
||||
u8 i = 0;
|
||||
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_RUPPBMR) | IXGBE_RUPPBMR_MQA;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RUPPBMR, reg);
|
||||
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_RMCS);
|
||||
/* Enable Arbiter */
|
||||
reg &= ~IXGBE_RMCS_ARBDIS;
|
||||
/* Enable Receive Recycle within the BWG */
|
||||
reg |= IXGBE_RMCS_RRM;
|
||||
/* Enable Deficit Fixed Priority arbitration*/
|
||||
reg |= IXGBE_RMCS_DFP;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RMCS, reg);
|
||||
|
||||
/* Configure traffic class credits and priority */
|
||||
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
credit_refill = refill[i];
|
||||
credit_max = max[i];
|
||||
|
||||
reg = credit_refill | (credit_max << IXGBE_RT2CR_MCL_SHIFT);
|
||||
|
||||
if (tsa[i] == ixgbe_dcb_tsa_strict)
|
||||
reg |= IXGBE_RT2CR_LSP;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RT2CR(i), reg);
|
||||
}
|
||||
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
|
||||
reg |= IXGBE_RDRXCTL_RDMTS_1_2;
|
||||
reg |= IXGBE_RDRXCTL_MPBEN;
|
||||
reg |= IXGBE_RDRXCTL_MCEN;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, reg);
|
||||
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
|
||||
/* Make sure there is enough descriptors before arbitration */
|
||||
reg &= ~IXGBE_RXCTRL_DMBYPS;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, reg);
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_tx_desc_arbiter_82598 - Config Tx Desc. arbiter
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure Tx Descriptor Arbiter and credits for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_tx_desc_arbiter_82598(struct ixgbe_hw *hw,
|
||||
u16 *refill, u16 *max, u8 *bwg_id,
|
||||
u8 *tsa)
|
||||
{
|
||||
u32 reg, max_credits;
|
||||
u8 i;
|
||||
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_DPMCS);
|
||||
|
||||
/* Enable arbiter */
|
||||
reg &= ~IXGBE_DPMCS_ARBDIS;
|
||||
reg |= IXGBE_DPMCS_TSOEF;
|
||||
|
||||
/* Configure Max TSO packet size 34KB including payload and headers */
|
||||
reg |= (0x4 << IXGBE_DPMCS_MTSOS_SHIFT);
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_DPMCS, reg);
|
||||
|
||||
/* Configure traffic class credits and priority */
|
||||
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
max_credits = max[i];
|
||||
reg = max_credits << IXGBE_TDTQ2TCCR_MCL_SHIFT;
|
||||
reg |= refill[i];
|
||||
reg |= (u32)(bwg_id[i]) << IXGBE_TDTQ2TCCR_BWG_SHIFT;
|
||||
|
||||
if (tsa[i] == ixgbe_dcb_tsa_group_strict_cee)
|
||||
reg |= IXGBE_TDTQ2TCCR_GSP;
|
||||
|
||||
if (tsa[i] == ixgbe_dcb_tsa_strict)
|
||||
reg |= IXGBE_TDTQ2TCCR_LSP;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_TDTQ2TCCR(i), reg);
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_tx_data_arbiter_82598 - Config Tx data arbiter
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure Tx Data Arbiter and credits for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_tx_data_arbiter_82598(struct ixgbe_hw *hw,
|
||||
u16 *refill, u16 *max, u8 *bwg_id,
|
||||
u8 *tsa)
|
||||
{
|
||||
u32 reg;
|
||||
u8 i;
|
||||
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_PDPMCS);
|
||||
/* Enable Data Plane Arbiter */
|
||||
reg &= ~IXGBE_PDPMCS_ARBDIS;
|
||||
/* Enable DFP and Transmit Recycle Mode */
|
||||
reg |= (IXGBE_PDPMCS_TPPAC | IXGBE_PDPMCS_TRM);
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_PDPMCS, reg);
|
||||
|
||||
/* Configure traffic class credits and priority */
|
||||
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
reg = refill[i];
|
||||
reg |= (u32)(max[i]) << IXGBE_TDPT2TCCR_MCL_SHIFT;
|
||||
reg |= (u32)(bwg_id[i]) << IXGBE_TDPT2TCCR_BWG_SHIFT;
|
||||
|
||||
if (tsa[i] == ixgbe_dcb_tsa_group_strict_cee)
|
||||
reg |= IXGBE_TDPT2TCCR_GSP;
|
||||
|
||||
if (tsa[i] == ixgbe_dcb_tsa_strict)
|
||||
reg |= IXGBE_TDPT2TCCR_LSP;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_TDPT2TCCR(i), reg);
|
||||
}
|
||||
|
||||
/* Enable Tx packet buffer division */
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_DTXCTL);
|
||||
reg |= IXGBE_DTXCTL_ENDBUBD;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_DTXCTL, reg);
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_pfc_82598 - Config priority flow control
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure Priority Flow Control for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_pfc_82598(struct ixgbe_hw *hw, u8 pfc_en)
|
||||
{
|
||||
u32 fcrtl, reg;
|
||||
u8 i;
|
||||
|
||||
/* Enable Transmit Priority Flow Control */
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_RMCS);
|
||||
reg &= ~IXGBE_RMCS_TFCE_802_3X;
|
||||
reg |= IXGBE_RMCS_TFCE_PRIORITY;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RMCS, reg);
|
||||
|
||||
/* Enable Receive Priority Flow Control */
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_FCTRL);
|
||||
reg &= ~(IXGBE_FCTRL_RPFCE | IXGBE_FCTRL_RFCE);
|
||||
|
||||
if (pfc_en)
|
||||
reg |= IXGBE_FCTRL_RPFCE;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCTRL, reg);
|
||||
|
||||
/* Configure PFC Tx thresholds per TC */
|
||||
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
if (!(pfc_en & (1 << i))) {
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTL(i), 0);
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTH(i), 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
fcrtl = (hw->fc.low_water[i] << 10) | IXGBE_FCRTL_XONE;
|
||||
reg = (hw->fc.high_water[i] << 10) | IXGBE_FCRTH_FCEN;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTL(i), fcrtl);
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTH(i), reg);
|
||||
}
|
||||
|
||||
/* Configure pause time */
|
||||
reg = hw->fc.pause_time | (hw->fc.pause_time << 16);
|
||||
for (i = 0; i < (IXGBE_DCB_MAX_TRAFFIC_CLASS / 2); i++)
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg);
|
||||
|
||||
/* Configure flow control refresh threshold value */
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTV, hw->fc.pause_time / 2);
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_tc_stats_82598 - Configure traffic class statistics
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Configure queue statistics registers, all queues belonging to same traffic
|
||||
* class uses a single set of queue statistics counters.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_tc_stats_82598(struct ixgbe_hw *hw)
|
||||
{
|
||||
u32 reg = 0;
|
||||
u8 i = 0;
|
||||
u8 j = 0;
|
||||
|
||||
/* Receive Queues stats setting - 8 queues per statistics reg */
|
||||
for (i = 0, j = 0; i < 15 && j < 8; i = i + 2, j++) {
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_RQSMR(i));
|
||||
reg |= ((0x1010101) * j);
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RQSMR(i), reg);
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_RQSMR(i + 1));
|
||||
reg |= ((0x1010101) * j);
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RQSMR(i + 1), reg);
|
||||
}
|
||||
/* Transmit Queues stats setting - 4 queues per statistics reg*/
|
||||
for (i = 0; i < 8; i++) {
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_TQSMR(i));
|
||||
reg |= ((0x1010101) * i);
|
||||
IXGBE_WRITE_REG(hw, IXGBE_TQSMR(i), reg);
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_hw_config_82598 - Config and enable DCB
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure dcb settings and enable dcb mode.
|
||||
*/
|
||||
s32 ixgbe_dcb_hw_config_82598(struct ixgbe_hw *hw, int link_speed,
|
||||
u16 *refill, u16 *max, u8 *bwg_id,
|
||||
u8 *tsa)
|
||||
{
|
||||
ixgbe_dcb_config_rx_arbiter_82598(hw, refill, max, tsa);
|
||||
ixgbe_dcb_config_tx_desc_arbiter_82598(hw, refill, max, bwg_id,
|
||||
tsa);
|
||||
ixgbe_dcb_config_tx_data_arbiter_82598(hw, refill, max, bwg_id,
|
||||
tsa);
|
||||
ixgbe_dcb_config_tc_stats_82598(hw);
|
||||
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
100
sys/dev/ixgbe/ixgbe_dcb_82598.h
Normal file
100
sys/dev/ixgbe/ixgbe_dcb_82598.h
Normal file
@ -0,0 +1,100 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2013, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _IXGBE_DCB_82598_H_
|
||||
#define _IXGBE_DCB_82598_H_
|
||||
|
||||
/* DCB register definitions */
|
||||
|
||||
#define IXGBE_DPMCS_MTSOS_SHIFT 16
|
||||
#define IXGBE_DPMCS_TDPAC 0x00000001 /* 0 Round Robin,
|
||||
* 1 DFP - Deficit Fixed Priority */
|
||||
#define IXGBE_DPMCS_TRM 0x00000010 /* Transmit Recycle Mode */
|
||||
#define IXGBE_DPMCS_ARBDIS 0x00000040 /* DCB arbiter disable */
|
||||
#define IXGBE_DPMCS_TSOEF 0x00080000 /* TSO Expand Factor: 0=x4, 1=x2 */
|
||||
|
||||
#define IXGBE_RUPPBMR_MQA 0x80000000 /* Enable UP to queue mapping */
|
||||
|
||||
#define IXGBE_RT2CR_MCL_SHIFT 12 /* Offset to Max Credit Limit setting */
|
||||
#define IXGBE_RT2CR_LSP 0x80000000 /* LSP enable bit */
|
||||
|
||||
#define IXGBE_RDRXCTL_MPBEN 0x00000010 /* DMA config for multiple packet
|
||||
* buffers enable */
|
||||
#define IXGBE_RDRXCTL_MCEN 0x00000040 /* DMA config for multiple cores
|
||||
* (RSS) enable */
|
||||
|
||||
#define IXGBE_TDTQ2TCCR_MCL_SHIFT 12
|
||||
#define IXGBE_TDTQ2TCCR_BWG_SHIFT 9
|
||||
#define IXGBE_TDTQ2TCCR_GSP 0x40000000
|
||||
#define IXGBE_TDTQ2TCCR_LSP 0x80000000
|
||||
|
||||
#define IXGBE_TDPT2TCCR_MCL_SHIFT 12
|
||||
#define IXGBE_TDPT2TCCR_BWG_SHIFT 9
|
||||
#define IXGBE_TDPT2TCCR_GSP 0x40000000
|
||||
#define IXGBE_TDPT2TCCR_LSP 0x80000000
|
||||
|
||||
#define IXGBE_PDPMCS_TPPAC 0x00000020 /* 0 Round Robin,
|
||||
* 1 DFP - Deficit Fixed Priority */
|
||||
#define IXGBE_PDPMCS_ARBDIS 0x00000040 /* Arbiter disable */
|
||||
#define IXGBE_PDPMCS_TRM 0x00000100 /* Transmit Recycle Mode enable */
|
||||
|
||||
#define IXGBE_DTXCTL_ENDBUBD 0x00000004 /* Enable DBU buffer division */
|
||||
|
||||
#define IXGBE_TXPBSIZE_40KB 0x0000A000 /* 40KB Packet Buffer */
|
||||
#define IXGBE_RXPBSIZE_48KB 0x0000C000 /* 48KB Packet Buffer */
|
||||
#define IXGBE_RXPBSIZE_64KB 0x00010000 /* 64KB Packet Buffer */
|
||||
#define IXGBE_RXPBSIZE_80KB 0x00014000 /* 80KB Packet Buffer */
|
||||
|
||||
/* DCB driver APIs */
|
||||
|
||||
/* DCB PFC */
|
||||
s32 ixgbe_dcb_config_pfc_82598(struct ixgbe_hw *, u8);
|
||||
|
||||
/* DCB stats */
|
||||
s32 ixgbe_dcb_config_tc_stats_82598(struct ixgbe_hw *);
|
||||
s32 ixgbe_dcb_get_tc_stats_82598(struct ixgbe_hw *,
|
||||
struct ixgbe_hw_stats *, u8);
|
||||
s32 ixgbe_dcb_get_pfc_stats_82598(struct ixgbe_hw *,
|
||||
struct ixgbe_hw_stats *, u8);
|
||||
|
||||
/* DCB config arbiters */
|
||||
s32 ixgbe_dcb_config_tx_desc_arbiter_82598(struct ixgbe_hw *, u16 *, u16 *,
|
||||
u8 *, u8 *);
|
||||
s32 ixgbe_dcb_config_tx_data_arbiter_82598(struct ixgbe_hw *, u16 *, u16 *,
|
||||
u8 *, u8 *);
|
||||
s32 ixgbe_dcb_config_rx_arbiter_82598(struct ixgbe_hw *, u16 *, u16 *, u8 *);
|
||||
|
||||
/* DCB initialization */
|
||||
s32 ixgbe_dcb_hw_config_82598(struct ixgbe_hw *, int, u16 *, u16 *, u8 *, u8 *);
|
||||
#endif /* _IXGBE_DCB_82958_H_ */
|
586
sys/dev/ixgbe/ixgbe_dcb_82599.c
Normal file
586
sys/dev/ixgbe/ixgbe_dcb_82599.c
Normal file
@ -0,0 +1,586 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2013, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
|
||||
#include "ixgbe_type.h"
|
||||
#include "ixgbe_dcb.h"
|
||||
#include "ixgbe_dcb_82599.h"
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_get_tc_stats_82599 - Returns status for each traffic class
|
||||
* @hw: pointer to hardware structure
|
||||
* @stats: pointer to statistics structure
|
||||
* @tc_count: Number of elements in bwg_array.
|
||||
*
|
||||
* This function returns the status data for each of the Traffic Classes in use.
|
||||
*/
|
||||
s32 ixgbe_dcb_get_tc_stats_82599(struct ixgbe_hw *hw,
|
||||
struct ixgbe_hw_stats *stats,
|
||||
u8 tc_count)
|
||||
{
|
||||
int tc;
|
||||
|
||||
DEBUGFUNC("dcb_get_tc_stats");
|
||||
|
||||
if (tc_count > IXGBE_DCB_MAX_TRAFFIC_CLASS)
|
||||
return IXGBE_ERR_PARAM;
|
||||
|
||||
/* Statistics pertaining to each traffic class */
|
||||
for (tc = 0; tc < tc_count; tc++) {
|
||||
/* Transmitted Packets */
|
||||
stats->qptc[tc] += IXGBE_READ_REG(hw, IXGBE_QPTC(tc));
|
||||
/* Transmitted Bytes (read low first to prevent missed carry) */
|
||||
stats->qbtc[tc] += IXGBE_READ_REG(hw, IXGBE_QBTC_L(tc));
|
||||
stats->qbtc[tc] +=
|
||||
(((u64)(IXGBE_READ_REG(hw, IXGBE_QBTC_H(tc)))) << 32);
|
||||
/* Received Packets */
|
||||
stats->qprc[tc] += IXGBE_READ_REG(hw, IXGBE_QPRC(tc));
|
||||
/* Received Bytes (read low first to prevent missed carry) */
|
||||
stats->qbrc[tc] += IXGBE_READ_REG(hw, IXGBE_QBRC_L(tc));
|
||||
stats->qbrc[tc] +=
|
||||
(((u64)(IXGBE_READ_REG(hw, IXGBE_QBRC_H(tc)))) << 32);
|
||||
|
||||
/* Received Dropped Packet */
|
||||
stats->qprdc[tc] += IXGBE_READ_REG(hw, IXGBE_QPRDC(tc));
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_get_pfc_stats_82599 - Return CBFC status data
|
||||
* @hw: pointer to hardware structure
|
||||
* @stats: pointer to statistics structure
|
||||
* @tc_count: Number of elements in bwg_array.
|
||||
*
|
||||
* This function returns the CBFC status data for each of the Traffic Classes.
|
||||
*/
|
||||
s32 ixgbe_dcb_get_pfc_stats_82599(struct ixgbe_hw *hw,
|
||||
struct ixgbe_hw_stats *stats,
|
||||
u8 tc_count)
|
||||
{
|
||||
int tc;
|
||||
|
||||
DEBUGFUNC("dcb_get_pfc_stats");
|
||||
|
||||
if (tc_count > IXGBE_DCB_MAX_TRAFFIC_CLASS)
|
||||
return IXGBE_ERR_PARAM;
|
||||
|
||||
for (tc = 0; tc < tc_count; tc++) {
|
||||
/* Priority XOFF Transmitted */
|
||||
stats->pxofftxc[tc] += IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(tc));
|
||||
/* Priority XOFF Received */
|
||||
stats->pxoffrxc[tc] += IXGBE_READ_REG(hw, IXGBE_PXOFFRXCNT(tc));
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_rx_arbiter_82599 - Config Rx Data arbiter
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure Rx Packet Arbiter and credits for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw *hw, u16 *refill,
|
||||
u16 *max, u8 *bwg_id, u8 *tsa,
|
||||
u8 *map)
|
||||
{
|
||||
u32 reg = 0;
|
||||
u32 credit_refill = 0;
|
||||
u32 credit_max = 0;
|
||||
u8 i = 0;
|
||||
|
||||
/*
|
||||
* Disable the arbiter before changing parameters
|
||||
* (always enable recycle mode; WSP)
|
||||
*/
|
||||
reg = IXGBE_RTRPCS_RRM | IXGBE_RTRPCS_RAC | IXGBE_RTRPCS_ARBDIS;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTRPCS, reg);
|
||||
|
||||
/*
|
||||
* map all UPs to TCs. up_to_tc_bitmap for each TC has corresponding
|
||||
* bits sets for the UPs that needs to be mappped to that TC.
|
||||
* e.g if priorities 6 and 7 are to be mapped to a TC then the
|
||||
* up_to_tc_bitmap value for that TC will be 11000000 in binary.
|
||||
*/
|
||||
reg = 0;
|
||||
for (i = 0; i < IXGBE_DCB_MAX_USER_PRIORITY; i++)
|
||||
reg |= (map[i] << (i * IXGBE_RTRUP2TC_UP_SHIFT));
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTRUP2TC, reg);
|
||||
|
||||
/* Configure traffic class credits and priority */
|
||||
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
credit_refill = refill[i];
|
||||
credit_max = max[i];
|
||||
reg = credit_refill | (credit_max << IXGBE_RTRPT4C_MCL_SHIFT);
|
||||
|
||||
reg |= (u32)(bwg_id[i]) << IXGBE_RTRPT4C_BWG_SHIFT;
|
||||
|
||||
if (tsa[i] == ixgbe_dcb_tsa_strict)
|
||||
reg |= IXGBE_RTRPT4C_LSP;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTRPT4C(i), reg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Configure Rx packet plane (recycle mode; WSP) and
|
||||
* enable arbiter
|
||||
*/
|
||||
reg = IXGBE_RTRPCS_RRM | IXGBE_RTRPCS_RAC;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTRPCS, reg);
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_tx_desc_arbiter_82599 - Config Tx Desc. arbiter
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure Tx Descriptor Arbiter and credits for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *hw, u16 *refill,
|
||||
u16 *max, u8 *bwg_id, u8 *tsa)
|
||||
{
|
||||
u32 reg, max_credits;
|
||||
u8 i;
|
||||
|
||||
/* Clear the per-Tx queue credits; we use per-TC instead */
|
||||
for (i = 0; i < 128; i++) {
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, i);
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTTDT1C, 0);
|
||||
}
|
||||
|
||||
/* Configure traffic class credits and priority */
|
||||
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
max_credits = max[i];
|
||||
reg = max_credits << IXGBE_RTTDT2C_MCL_SHIFT;
|
||||
reg |= refill[i];
|
||||
reg |= (u32)(bwg_id[i]) << IXGBE_RTTDT2C_BWG_SHIFT;
|
||||
|
||||
if (tsa[i] == ixgbe_dcb_tsa_group_strict_cee)
|
||||
reg |= IXGBE_RTTDT2C_GSP;
|
||||
|
||||
if (tsa[i] == ixgbe_dcb_tsa_strict)
|
||||
reg |= IXGBE_RTTDT2C_LSP;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTTDT2C(i), reg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Configure Tx descriptor plane (recycle mode; WSP) and
|
||||
* enable arbiter
|
||||
*/
|
||||
reg = IXGBE_RTTDCS_TDPAC | IXGBE_RTTDCS_TDRM;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, reg);
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_tx_data_arbiter_82599 - Config Tx Data arbiter
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure Tx Packet Arbiter and credits for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw, u16 *refill,
|
||||
u16 *max, u8 *bwg_id, u8 *tsa,
|
||||
u8 *map)
|
||||
{
|
||||
u32 reg;
|
||||
u8 i;
|
||||
|
||||
/*
|
||||
* Disable the arbiter before changing parameters
|
||||
* (always enable recycle mode; SP; arb delay)
|
||||
*/
|
||||
reg = IXGBE_RTTPCS_TPPAC | IXGBE_RTTPCS_TPRM |
|
||||
(IXGBE_RTTPCS_ARBD_DCB << IXGBE_RTTPCS_ARBD_SHIFT) |
|
||||
IXGBE_RTTPCS_ARBDIS;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTTPCS, reg);
|
||||
|
||||
/*
|
||||
* map all UPs to TCs. up_to_tc_bitmap for each TC has corresponding
|
||||
* bits sets for the UPs that needs to be mappped to that TC.
|
||||
* e.g if priorities 6 and 7 are to be mapped to a TC then the
|
||||
* up_to_tc_bitmap value for that TC will be 11000000 in binary.
|
||||
*/
|
||||
reg = 0;
|
||||
for (i = 0; i < IXGBE_DCB_MAX_USER_PRIORITY; i++)
|
||||
reg |= (map[i] << (i * IXGBE_RTTUP2TC_UP_SHIFT));
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTTUP2TC, reg);
|
||||
|
||||
/* Configure traffic class credits and priority */
|
||||
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
reg = refill[i];
|
||||
reg |= (u32)(max[i]) << IXGBE_RTTPT2C_MCL_SHIFT;
|
||||
reg |= (u32)(bwg_id[i]) << IXGBE_RTTPT2C_BWG_SHIFT;
|
||||
|
||||
if (tsa[i] == ixgbe_dcb_tsa_group_strict_cee)
|
||||
reg |= IXGBE_RTTPT2C_GSP;
|
||||
|
||||
if (tsa[i] == ixgbe_dcb_tsa_strict)
|
||||
reg |= IXGBE_RTTPT2C_LSP;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTTPT2C(i), reg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Configure Tx packet plane (recycle mode; SP; arb delay) and
|
||||
* enable arbiter
|
||||
*/
|
||||
reg = IXGBE_RTTPCS_TPPAC | IXGBE_RTTPCS_TPRM |
|
||||
(IXGBE_RTTPCS_ARBD_DCB << IXGBE_RTTPCS_ARBD_SHIFT);
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTTPCS, reg);
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_pfc_82599 - Configure priority flow control
|
||||
* @hw: pointer to hardware structure
|
||||
* @pfc_en: enabled pfc bitmask
|
||||
* @map: priority to tc assignments indexed by priority
|
||||
*
|
||||
* Configure Priority Flow Control (PFC) for each traffic class.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, u8 pfc_en, u8 *map)
|
||||
{
|
||||
u32 i, j, fcrtl, reg;
|
||||
u8 max_tc = 0;
|
||||
|
||||
/* Enable Transmit Priority Flow Control */
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCCFG, IXGBE_FCCFG_TFCE_PRIORITY);
|
||||
|
||||
/* Enable Receive Priority Flow Control */
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_MFLCN);
|
||||
reg |= IXGBE_MFLCN_DPF;
|
||||
|
||||
/*
|
||||
* X540 supports per TC Rx priority flow control. So
|
||||
* clear all TCs and only enable those that should be
|
||||
* enabled.
|
||||
*/
|
||||
reg &= ~(IXGBE_MFLCN_RPFCE_MASK | IXGBE_MFLCN_RFCE);
|
||||
|
||||
if (hw->mac.type == ixgbe_mac_X540)
|
||||
reg |= pfc_en << IXGBE_MFLCN_RPFCE_SHIFT;
|
||||
|
||||
if (pfc_en)
|
||||
reg |= IXGBE_MFLCN_RPFCE;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MFLCN, reg);
|
||||
|
||||
for (i = 0; i < IXGBE_DCB_MAX_USER_PRIORITY; i++) {
|
||||
if (map[i] > max_tc)
|
||||
max_tc = map[i];
|
||||
}
|
||||
|
||||
|
||||
/* Configure PFC Tx thresholds per TC */
|
||||
for (i = 0; i <= max_tc; i++) {
|
||||
int enabled = 0;
|
||||
|
||||
for (j = 0; j < IXGBE_DCB_MAX_USER_PRIORITY; j++) {
|
||||
if ((map[j] == i) && (pfc_en & (1 << j))) {
|
||||
enabled = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
reg = (hw->fc.high_water[i] << 10) | IXGBE_FCRTH_FCEN;
|
||||
fcrtl = (hw->fc.low_water[i] << 10) | IXGBE_FCRTL_XONE;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), fcrtl);
|
||||
} else {
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(i)) - 32;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), 0);
|
||||
}
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), reg);
|
||||
}
|
||||
|
||||
for (; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), 0);
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), 0);
|
||||
}
|
||||
|
||||
/* Configure pause time (2 TCs per register) */
|
||||
reg = hw->fc.pause_time | (hw->fc.pause_time << 16);
|
||||
for (i = 0; i < (IXGBE_DCB_MAX_TRAFFIC_CLASS / 2); i++)
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg);
|
||||
|
||||
/* Configure flow control refresh threshold value */
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTV, hw->fc.pause_time / 2);
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_tc_stats_82599 - Config traffic class statistics
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Configure queue statistics registers, all queues belonging to same traffic
|
||||
* class uses a single set of queue statistics counters.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_tc_stats_82599(struct ixgbe_hw *hw,
|
||||
struct ixgbe_dcb_config *dcb_config)
|
||||
{
|
||||
u32 reg = 0;
|
||||
u8 i = 0;
|
||||
u8 tc_count = 8;
|
||||
bool vt_mode = FALSE;
|
||||
|
||||
if (dcb_config != NULL) {
|
||||
tc_count = dcb_config->num_tcs.pg_tcs;
|
||||
vt_mode = dcb_config->vt_mode;
|
||||
}
|
||||
|
||||
if (!((tc_count == 8 && vt_mode == FALSE) || tc_count == 4))
|
||||
return IXGBE_ERR_PARAM;
|
||||
|
||||
if (tc_count == 8 && vt_mode == FALSE) {
|
||||
/*
|
||||
* Receive Queues stats setting
|
||||
* 32 RQSMR registers, each configuring 4 queues.
|
||||
*
|
||||
* Set all 16 queues of each TC to the same stat
|
||||
* with TC 'n' going to stat 'n'.
|
||||
*/
|
||||
for (i = 0; i < 32; i++) {
|
||||
reg = 0x01010101 * (i / 4);
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RQSMR(i), reg);
|
||||
}
|
||||
/*
|
||||
* Transmit Queues stats setting
|
||||
* 32 TQSM registers, each controlling 4 queues.
|
||||
*
|
||||
* Set all queues of each TC to the same stat
|
||||
* with TC 'n' going to stat 'n'.
|
||||
* Tx queues are allocated non-uniformly to TCs:
|
||||
* 32, 32, 16, 16, 8, 8, 8, 8.
|
||||
*/
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (i < 8)
|
||||
reg = 0x00000000;
|
||||
else if (i < 16)
|
||||
reg = 0x01010101;
|
||||
else if (i < 20)
|
||||
reg = 0x02020202;
|
||||
else if (i < 24)
|
||||
reg = 0x03030303;
|
||||
else if (i < 26)
|
||||
reg = 0x04040404;
|
||||
else if (i < 28)
|
||||
reg = 0x05050505;
|
||||
else if (i < 30)
|
||||
reg = 0x06060606;
|
||||
else
|
||||
reg = 0x07070707;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_TQSM(i), reg);
|
||||
}
|
||||
} else if (tc_count == 4 && vt_mode == FALSE) {
|
||||
/*
|
||||
* Receive Queues stats setting
|
||||
* 32 RQSMR registers, each configuring 4 queues.
|
||||
*
|
||||
* Set all 16 queues of each TC to the same stat
|
||||
* with TC 'n' going to stat 'n'.
|
||||
*/
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (i % 8 > 3)
|
||||
/* In 4 TC mode, odd 16-queue ranges are
|
||||
* not used.
|
||||
*/
|
||||
continue;
|
||||
reg = 0x01010101 * (i / 8);
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RQSMR(i), reg);
|
||||
}
|
||||
/*
|
||||
* Transmit Queues stats setting
|
||||
* 32 TQSM registers, each controlling 4 queues.
|
||||
*
|
||||
* Set all queues of each TC to the same stat
|
||||
* with TC 'n' going to stat 'n'.
|
||||
* Tx queues are allocated non-uniformly to TCs:
|
||||
* 64, 32, 16, 16.
|
||||
*/
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (i < 16)
|
||||
reg = 0x00000000;
|
||||
else if (i < 24)
|
||||
reg = 0x01010101;
|
||||
else if (i < 28)
|
||||
reg = 0x02020202;
|
||||
else
|
||||
reg = 0x03030303;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_TQSM(i), reg);
|
||||
}
|
||||
} else if (tc_count == 4 && vt_mode == TRUE) {
|
||||
/*
|
||||
* Receive Queues stats setting
|
||||
* 32 RQSMR registers, each configuring 4 queues.
|
||||
*
|
||||
* Queue Indexing in 32 VF with DCB mode maps 4 TC's to each
|
||||
* pool. Set all 32 queues of each TC across pools to the same
|
||||
* stat with TC 'n' going to stat 'n'.
|
||||
*/
|
||||
for (i = 0; i < 32; i++)
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RQSMR(i), 0x03020100);
|
||||
/*
|
||||
* Transmit Queues stats setting
|
||||
* 32 TQSM registers, each controlling 4 queues.
|
||||
*
|
||||
* Queue Indexing in 32 VF with DCB mode maps 4 TC's to each
|
||||
* pool. Set all 32 queues of each TC across pools to the same
|
||||
* stat with TC 'n' going to stat 'n'.
|
||||
*/
|
||||
for (i = 0; i < 32; i++)
|
||||
IXGBE_WRITE_REG(hw, IXGBE_TQSM(i), 0x03020100);
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_config_82599 - Configure general DCB parameters
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure general DCB parameters.
|
||||
*/
|
||||
s32 ixgbe_dcb_config_82599(struct ixgbe_hw *hw,
|
||||
struct ixgbe_dcb_config *dcb_config)
|
||||
{
|
||||
u32 reg;
|
||||
u32 q;
|
||||
|
||||
/* Disable the Tx desc arbiter so that MTQC can be changed */
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_RTTDCS);
|
||||
reg |= IXGBE_RTTDCS_ARBDIS;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, reg);
|
||||
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_MRQC);
|
||||
if (dcb_config->num_tcs.pg_tcs == 8) {
|
||||
/* Enable DCB for Rx with 8 TCs */
|
||||
switch (reg & IXGBE_MRQC_MRQE_MASK) {
|
||||
case 0:
|
||||
case IXGBE_MRQC_RT4TCEN:
|
||||
/* RSS disabled cases */
|
||||
reg = (reg & ~IXGBE_MRQC_MRQE_MASK) |
|
||||
IXGBE_MRQC_RT8TCEN;
|
||||
break;
|
||||
case IXGBE_MRQC_RSSEN:
|
||||
case IXGBE_MRQC_RTRSS4TCEN:
|
||||
/* RSS enabled cases */
|
||||
reg = (reg & ~IXGBE_MRQC_MRQE_MASK) |
|
||||
IXGBE_MRQC_RTRSS8TCEN;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* Unsupported value, assume stale data,
|
||||
* overwrite no RSS
|
||||
*/
|
||||
ASSERT(0);
|
||||
reg = (reg & ~IXGBE_MRQC_MRQE_MASK) |
|
||||
IXGBE_MRQC_RT8TCEN;
|
||||
}
|
||||
}
|
||||
if (dcb_config->num_tcs.pg_tcs == 4) {
|
||||
/* We support both VT-on and VT-off with 4 TCs. */
|
||||
if (dcb_config->vt_mode)
|
||||
reg = (reg & ~IXGBE_MRQC_MRQE_MASK) |
|
||||
IXGBE_MRQC_VMDQRT4TCEN;
|
||||
else
|
||||
reg = (reg & ~IXGBE_MRQC_MRQE_MASK) |
|
||||
IXGBE_MRQC_RTRSS4TCEN;
|
||||
}
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MRQC, reg);
|
||||
|
||||
/* Enable DCB for Tx with 8 TCs */
|
||||
if (dcb_config->num_tcs.pg_tcs == 8)
|
||||
reg = IXGBE_MTQC_RT_ENA | IXGBE_MTQC_8TC_8TQ;
|
||||
else {
|
||||
/* We support both VT-on and VT-off with 4 TCs. */
|
||||
reg = IXGBE_MTQC_RT_ENA | IXGBE_MTQC_4TC_4TQ;
|
||||
if (dcb_config->vt_mode)
|
||||
reg |= IXGBE_MTQC_VT_ENA;
|
||||
}
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MTQC, reg);
|
||||
|
||||
/* Disable drop for all queues */
|
||||
for (q = 0; q < 128; q++)
|
||||
IXGBE_WRITE_REG(hw, IXGBE_QDE,
|
||||
(IXGBE_QDE_WRITE | (q << IXGBE_QDE_IDX_SHIFT)));
|
||||
|
||||
/* Enable the Tx desc arbiter */
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_RTTDCS);
|
||||
reg &= ~IXGBE_RTTDCS_ARBDIS;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, reg);
|
||||
|
||||
/* Enable Security TX Buffer IFG for DCB */
|
||||
reg = IXGBE_READ_REG(hw, IXGBE_SECTXMINIFG);
|
||||
reg |= IXGBE_SECTX_DCB;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_SECTXMINIFG, reg);
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_dcb_hw_config_82599 - Configure and enable DCB
|
||||
* @hw: pointer to hardware structure
|
||||
* @dcb_config: pointer to ixgbe_dcb_config structure
|
||||
*
|
||||
* Configure dcb settings and enable dcb mode.
|
||||
*/
|
||||
s32 ixgbe_dcb_hw_config_82599(struct ixgbe_hw *hw, int link_speed,
|
||||
u16 *refill, u16 *max, u8 *bwg_id, u8 *tsa,
|
||||
u8 *map)
|
||||
{
|
||||
|
||||
ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max, bwg_id, tsa,
|
||||
map);
|
||||
ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max, bwg_id,
|
||||
tsa);
|
||||
ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max, bwg_id,
|
||||
tsa, map);
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
154
sys/dev/ixgbe/ixgbe_dcb_82599.h
Normal file
154
sys/dev/ixgbe/ixgbe_dcb_82599.h
Normal file
@ -0,0 +1,154 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2013, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _IXGBE_DCB_82599_H_
|
||||
#define _IXGBE_DCB_82599_H_
|
||||
|
||||
/* DCB register definitions */
|
||||
#define IXGBE_RTTDCS_TDPAC 0x00000001 /* 0 Round Robin,
|
||||
* 1 WSP - Weighted Strict Priority
|
||||
*/
|
||||
#define IXGBE_RTTDCS_VMPAC 0x00000002 /* 0 Round Robin,
|
||||
* 1 WRR - Weighted Round Robin
|
||||
*/
|
||||
#define IXGBE_RTTDCS_TDRM 0x00000010 /* Transmit Recycle Mode */
|
||||
#define IXGBE_RTTDCS_BDPM 0x00400000 /* Bypass Data Pipe - must clear! */
|
||||
#define IXGBE_RTTDCS_BPBFSM 0x00800000 /* Bypass PB Free Space - must
|
||||
* clear!
|
||||
*/
|
||||
#define IXGBE_RTTDCS_SPEED_CHG 0x80000000 /* Link speed change */
|
||||
|
||||
/* Receive UP2TC mapping */
|
||||
#define IXGBE_RTRUP2TC_UP_SHIFT 3
|
||||
#define IXGBE_RTRUP2TC_UP_MASK 7
|
||||
/* Transmit UP2TC mapping */
|
||||
#define IXGBE_RTTUP2TC_UP_SHIFT 3
|
||||
|
||||
#define IXGBE_RTRPT4C_MCL_SHIFT 12 /* Offset to Max Credit Limit setting */
|
||||
#define IXGBE_RTRPT4C_BWG_SHIFT 9 /* Offset to BWG index */
|
||||
#define IXGBE_RTRPT4C_GSP 0x40000000 /* GSP enable bit */
|
||||
#define IXGBE_RTRPT4C_LSP 0x80000000 /* LSP enable bit */
|
||||
|
||||
#define IXGBE_RDRXCTL_MPBEN 0x00000010 /* DMA config for multiple packet
|
||||
* buffers enable
|
||||
*/
|
||||
#define IXGBE_RDRXCTL_MCEN 0x00000040 /* DMA config for multiple cores
|
||||
* (RSS) enable
|
||||
*/
|
||||
|
||||
/* RTRPCS Bit Masks */
|
||||
#define IXGBE_RTRPCS_RRM 0x00000002 /* Receive Recycle Mode enable */
|
||||
/* Receive Arbitration Control: 0 Round Robin, 1 DFP */
|
||||
#define IXGBE_RTRPCS_RAC 0x00000004
|
||||
#define IXGBE_RTRPCS_ARBDIS 0x00000040 /* Arbitration disable bit */
|
||||
|
||||
/* RTTDT2C Bit Masks */
|
||||
#define IXGBE_RTTDT2C_MCL_SHIFT 12
|
||||
#define IXGBE_RTTDT2C_BWG_SHIFT 9
|
||||
#define IXGBE_RTTDT2C_GSP 0x40000000
|
||||
#define IXGBE_RTTDT2C_LSP 0x80000000
|
||||
|
||||
#define IXGBE_RTTPT2C_MCL_SHIFT 12
|
||||
#define IXGBE_RTTPT2C_BWG_SHIFT 9
|
||||
#define IXGBE_RTTPT2C_GSP 0x40000000
|
||||
#define IXGBE_RTTPT2C_LSP 0x80000000
|
||||
|
||||
/* RTTPCS Bit Masks */
|
||||
#define IXGBE_RTTPCS_TPPAC 0x00000020 /* 0 Round Robin,
|
||||
* 1 SP - Strict Priority
|
||||
*/
|
||||
#define IXGBE_RTTPCS_ARBDIS 0x00000040 /* Arbiter disable */
|
||||
#define IXGBE_RTTPCS_TPRM 0x00000100 /* Transmit Recycle Mode enable */
|
||||
#define IXGBE_RTTPCS_ARBD_SHIFT 22
|
||||
#define IXGBE_RTTPCS_ARBD_DCB 0x4 /* Arbitration delay in DCB mode */
|
||||
|
||||
#define IXGBE_TXPBTHRESH_DCB 0xA /* THRESH value for DCB mode */
|
||||
|
||||
/* SECTXMINIFG DCB */
|
||||
#define IXGBE_SECTX_DCB 0x00001F00 /* DCB TX Buffer SEC IFG */
|
||||
|
||||
/* BCN register definitions */
|
||||
#define IXGBE_RTTBCNRC_RF_INT_SHIFT 14
|
||||
#define IXGBE_RTTBCNRC_RS_ENA 0x80000000
|
||||
|
||||
#define IXGBE_RTTBCNCR_MNG_CMTGI 0x00000001
|
||||
#define IXGBE_RTTBCNCR_MGN_BCNA_MODE 0x00000002
|
||||
#define IXGBE_RTTBCNCR_RSV7_11_SHIFT 5
|
||||
#define IXGBE_RTTBCNCR_G 0x00000400
|
||||
#define IXGBE_RTTBCNCR_I 0x00000800
|
||||
#define IXGBE_RTTBCNCR_H 0x00001000
|
||||
#define IXGBE_RTTBCNCR_VER_SHIFT 14
|
||||
#define IXGBE_RTTBCNCR_CMT_ETH_SHIFT 16
|
||||
|
||||
#define IXGBE_RTTBCNACL_SMAC_L_SHIFT 16
|
||||
|
||||
#define IXGBE_RTTBCNTG_BCNA_MODE 0x80000000
|
||||
|
||||
#define IXGBE_RTTBCNRTT_TS_SHIFT 3
|
||||
#define IXGBE_RTTBCNRTT_TXQ_IDX_SHIFT 16
|
||||
|
||||
#define IXGBE_RTTBCNRD_BCN_CLEAR_ALL 0x00000002
|
||||
#define IXGBE_RTTBCNRD_DRIFT_FAC_SHIFT 2
|
||||
#define IXGBE_RTTBCNRD_DRIFT_INT_SHIFT 16
|
||||
#define IXGBE_RTTBCNRD_DRIFT_ENA 0x80000000
|
||||
|
||||
|
||||
/* DCB driver APIs */
|
||||
|
||||
/* DCB PFC */
|
||||
s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *, u8, u8 *);
|
||||
|
||||
/* DCB stats */
|
||||
s32 ixgbe_dcb_config_tc_stats_82599(struct ixgbe_hw *,
|
||||
struct ixgbe_dcb_config *);
|
||||
s32 ixgbe_dcb_get_tc_stats_82599(struct ixgbe_hw *,
|
||||
struct ixgbe_hw_stats *, u8);
|
||||
s32 ixgbe_dcb_get_pfc_stats_82599(struct ixgbe_hw *,
|
||||
struct ixgbe_hw_stats *, u8);
|
||||
|
||||
/* DCB config arbiters */
|
||||
s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *, u16 *, u16 *,
|
||||
u8 *, u8 *);
|
||||
s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *, u16 *, u16 *,
|
||||
u8 *, u8 *, u8 *);
|
||||
s32 ixgbe_dcb_config_rx_arbiter_82599(struct ixgbe_hw *, u16 *, u16 *, u8 *,
|
||||
u8 *, u8 *);
|
||||
|
||||
/* DCB initialization */
|
||||
s32 ixgbe_dcb_config_82599(struct ixgbe_hw *,
|
||||
struct ixgbe_dcb_config *);
|
||||
|
||||
s32 ixgbe_dcb_hw_config_82599(struct ixgbe_hw *, int, u16 *, u16 *, u8 *,
|
||||
u8 *, u8 *);
|
||||
#endif /* _IXGBE_DCB_82959_H_ */
|
@ -73,6 +73,9 @@
|
||||
#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)
|
||||
#define ERROR_REPORT1(S,A) printf(S "\n",A)
|
||||
#define ERROR_REPORT2(S,A,B) printf(S "\n",A,B)
|
||||
#define ERROR_REPORT3(S,A,B,C) printf(S "\n",A,B,C)
|
||||
#else
|
||||
#define DEBUGOUT(S)
|
||||
#define DEBUGOUT1(S,A)
|
||||
@ -82,6 +85,10 @@
|
||||
#define DEBUGOUT5(S,A,B,C,D,E)
|
||||
#define DEBUGOUT6(S,A,B,C,D,E,F)
|
||||
#define DEBUGOUT7(S,A,B,C,D,E,F,G)
|
||||
|
||||
#define ERROR_REPORT1(S,A)
|
||||
#define ERROR_REPORT2(S,A,B)
|
||||
#define ERROR_REPORT3(S,A,B,C)
|
||||
#endif
|
||||
|
||||
#define FALSE 0
|
||||
@ -112,6 +119,7 @@
|
||||
typedef uint8_t u8;
|
||||
typedef int8_t s8;
|
||||
typedef uint16_t u16;
|
||||
typedef int16_t s16;
|
||||
typedef uint32_t u32;
|
||||
typedef int32_t s32;
|
||||
typedef uint64_t u64;
|
||||
|
@ -67,6 +67,8 @@ s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw)
|
||||
phy->ops.reset = &ixgbe_reset_phy_generic;
|
||||
phy->ops.read_reg = &ixgbe_read_phy_reg_generic;
|
||||
phy->ops.write_reg = &ixgbe_write_phy_reg_generic;
|
||||
phy->ops.read_reg_mdi = &ixgbe_read_phy_reg_mdi;
|
||||
phy->ops.write_reg_mdi = &ixgbe_write_phy_reg_mdi;
|
||||
phy->ops.setup_link = &ixgbe_setup_phy_link_generic;
|
||||
phy->ops.setup_link_speed = &ixgbe_setup_phy_link_speed_generic;
|
||||
phy->ops.check_link = NULL;
|
||||
@ -125,8 +127,11 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
|
||||
}
|
||||
}
|
||||
/* clear value if nothing found */
|
||||
if (status != IXGBE_SUCCESS)
|
||||
if (status != IXGBE_SUCCESS) {
|
||||
hw->phy.addr = 0;
|
||||
ERROR_REPORT1(IXGBE_ERROR_SOFTWARE,
|
||||
"Could not identify valid PHY address");
|
||||
}
|
||||
} else {
|
||||
status = IXGBE_SUCCESS;
|
||||
}
|
||||
@ -265,15 +270,96 @@ s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw)
|
||||
|
||||
if (ctrl & IXGBE_MDIO_PHY_XS_RESET) {
|
||||
status = IXGBE_ERR_RESET_FAILED;
|
||||
DEBUGOUT("PHY reset polling failed to complete.\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"PHY reset polling failed to complete.\n");
|
||||
}
|
||||
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_read_phy_mdi - Reads a value from a specified PHY register without
|
||||
* the SWFW lock
|
||||
* @hw: pointer to hardware structure
|
||||
* @reg_addr: 32 bit address of PHY register to read
|
||||
* @phy_data: Pointer to read data from PHY register
|
||||
**/
|
||||
s32 ixgbe_read_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
|
||||
u16 *phy_data)
|
||||
{
|
||||
u32 i, data, command;
|
||||
|
||||
/* Setup and write the address cycle command */
|
||||
command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
|
||||
(device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
|
||||
(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
|
||||
(IXGBE_MSCA_ADDR_CYCLE | IXGBE_MSCA_MDI_COMMAND));
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
|
||||
|
||||
/*
|
||||
* Check every 10 usec to see if the address cycle completed.
|
||||
* The MDI Command bit will clear when the operation is
|
||||
* complete
|
||||
*/
|
||||
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
|
||||
usec_delay(10);
|
||||
|
||||
command = IXGBE_READ_REG(hw, IXGBE_MSCA);
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING, "PHY address command did not complete.\n");
|
||||
return IXGBE_ERR_PHY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Address cycle complete, setup and write the read
|
||||
* command
|
||||
*/
|
||||
command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
|
||||
(device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
|
||||
(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
|
||||
(IXGBE_MSCA_READ | IXGBE_MSCA_MDI_COMMAND));
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
|
||||
|
||||
/*
|
||||
* Check every 10 usec to see if the address cycle
|
||||
* completed. The MDI Command bit will clear when the
|
||||
* operation is complete
|
||||
*/
|
||||
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
|
||||
usec_delay(10);
|
||||
|
||||
command = IXGBE_READ_REG(hw, IXGBE_MSCA);
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING, "PHY read command didn't complete\n");
|
||||
return IXGBE_ERR_PHY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read operation is complete. Get the data
|
||||
* from MSRWD
|
||||
*/
|
||||
data = IXGBE_READ_REG(hw, IXGBE_MSRWD);
|
||||
data >>= IXGBE_MSRWD_READ_DATA_SHIFT;
|
||||
*phy_data = (u16)(data);
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_read_phy_reg_generic - Reads a value from a specified PHY register
|
||||
* using the SWFW lock - this function is needed in most cases
|
||||
* @hw: pointer to hardware structure
|
||||
* @reg_addr: 32 bit address of PHY register to read
|
||||
* @phy_data: Pointer to read data from PHY register
|
||||
@ -281,10 +367,7 @@ s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw)
|
||||
s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
|
||||
u32 device_type, u16 *phy_data)
|
||||
{
|
||||
u32 command;
|
||||
u32 i;
|
||||
u32 data;
|
||||
s32 status = IXGBE_SUCCESS;
|
||||
s32 status;
|
||||
u16 gssr;
|
||||
|
||||
DEBUGFUNC("ixgbe_read_phy_reg_generic");
|
||||
@ -294,85 +377,94 @@ s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
|
||||
else
|
||||
gssr = IXGBE_GSSR_PHY0_SM;
|
||||
|
||||
if (hw->mac.ops.acquire_swfw_sync(hw, gssr) != IXGBE_SUCCESS)
|
||||
status = IXGBE_ERR_SWFW_SYNC;
|
||||
|
||||
if (status == IXGBE_SUCCESS) {
|
||||
/* Setup and write the address cycle command */
|
||||
command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
|
||||
(device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
|
||||
(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
|
||||
(IXGBE_MSCA_ADDR_CYCLE | IXGBE_MSCA_MDI_COMMAND));
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
|
||||
|
||||
/*
|
||||
* Check every 10 usec to see if the address cycle completed.
|
||||
* The MDI Command bit will clear when the operation is
|
||||
* complete
|
||||
*/
|
||||
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
|
||||
usec_delay(10);
|
||||
|
||||
command = IXGBE_READ_REG(hw, IXGBE_MSCA);
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
|
||||
DEBUGOUT("PHY address command did not complete.\n");
|
||||
status = IXGBE_ERR_PHY;
|
||||
}
|
||||
|
||||
if (status == IXGBE_SUCCESS) {
|
||||
/*
|
||||
* Address cycle complete, setup and write the read
|
||||
* command
|
||||
*/
|
||||
command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
|
||||
(device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
|
||||
(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
|
||||
(IXGBE_MSCA_READ | IXGBE_MSCA_MDI_COMMAND));
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
|
||||
|
||||
/*
|
||||
* Check every 10 usec to see if the address cycle
|
||||
* completed. The MDI Command bit will clear when the
|
||||
* operation is complete
|
||||
*/
|
||||
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
|
||||
usec_delay(10);
|
||||
|
||||
command = IXGBE_READ_REG(hw, IXGBE_MSCA);
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
|
||||
DEBUGOUT("PHY read command didn't complete\n");
|
||||
status = IXGBE_ERR_PHY;
|
||||
} else {
|
||||
/*
|
||||
* Read operation is complete. Get the data
|
||||
* from MSRWD
|
||||
*/
|
||||
data = IXGBE_READ_REG(hw, IXGBE_MSRWD);
|
||||
data >>= IXGBE_MSRWD_READ_DATA_SHIFT;
|
||||
*phy_data = (u16)(data);
|
||||
}
|
||||
}
|
||||
|
||||
if (hw->mac.ops.acquire_swfw_sync(hw, gssr) == IXGBE_SUCCESS) {
|
||||
status = ixgbe_read_phy_reg_mdi(hw, reg_addr, device_type,
|
||||
phy_data);
|
||||
hw->mac.ops.release_swfw_sync(hw, gssr);
|
||||
} else {
|
||||
status = IXGBE_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_write_phy_reg_mdi - Writes a value to specified PHY register
|
||||
* without SWFW lock
|
||||
* @hw: pointer to hardware structure
|
||||
* @reg_addr: 32 bit PHY register to write
|
||||
* @device_type: 5 bit device type
|
||||
* @phy_data: Data to write to the PHY register
|
||||
**/
|
||||
s32 ixgbe_write_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr,
|
||||
u32 device_type, u16 phy_data)
|
||||
{
|
||||
u32 i, command;
|
||||
|
||||
/* Put the data in the MDI single read and write data register*/
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MSRWD, (u32)phy_data);
|
||||
|
||||
/* Setup and write the address cycle command */
|
||||
command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
|
||||
(device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
|
||||
(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
|
||||
(IXGBE_MSCA_ADDR_CYCLE | IXGBE_MSCA_MDI_COMMAND));
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
|
||||
|
||||
/*
|
||||
* Check every 10 usec to see if the address cycle completed.
|
||||
* The MDI Command bit will clear when the operation is
|
||||
* complete
|
||||
*/
|
||||
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
|
||||
usec_delay(10);
|
||||
|
||||
command = IXGBE_READ_REG(hw, IXGBE_MSCA);
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING, "PHY address cmd didn't complete\n");
|
||||
return IXGBE_ERR_PHY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Address cycle complete, setup and write the write
|
||||
* command
|
||||
*/
|
||||
command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
|
||||
(device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
|
||||
(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
|
||||
(IXGBE_MSCA_WRITE | IXGBE_MSCA_MDI_COMMAND));
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
|
||||
|
||||
/*
|
||||
* Check every 10 usec to see if the address cycle
|
||||
* completed. The MDI Command bit will clear when the
|
||||
* operation is complete
|
||||
*/
|
||||
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
|
||||
usec_delay(10);
|
||||
|
||||
command = IXGBE_READ_REG(hw, IXGBE_MSCA);
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING, "PHY write cmd didn't complete\n");
|
||||
return IXGBE_ERR_PHY;
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_write_phy_reg_generic - Writes a value to specified PHY register
|
||||
* using SWFW lock- this function is needed in most cases
|
||||
* @hw: pointer to hardware structure
|
||||
* @reg_addr: 32 bit PHY register to write
|
||||
* @device_type: 5 bit device type
|
||||
@ -381,9 +473,7 @@ s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
|
||||
s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
|
||||
u32 device_type, u16 phy_data)
|
||||
{
|
||||
u32 command;
|
||||
u32 i;
|
||||
s32 status = IXGBE_SUCCESS;
|
||||
s32 status;
|
||||
u16 gssr;
|
||||
|
||||
DEBUGFUNC("ixgbe_write_phy_reg_generic");
|
||||
@ -393,73 +483,12 @@ s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
|
||||
else
|
||||
gssr = IXGBE_GSSR_PHY0_SM;
|
||||
|
||||
if (hw->mac.ops.acquire_swfw_sync(hw, gssr) != IXGBE_SUCCESS)
|
||||
status = IXGBE_ERR_SWFW_SYNC;
|
||||
|
||||
if (status == IXGBE_SUCCESS) {
|
||||
/* Put the data in the MDI single read and write data register*/
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MSRWD, (u32)phy_data);
|
||||
|
||||
/* Setup and write the address cycle command */
|
||||
command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
|
||||
(device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
|
||||
(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
|
||||
(IXGBE_MSCA_ADDR_CYCLE | IXGBE_MSCA_MDI_COMMAND));
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
|
||||
|
||||
/*
|
||||
* Check every 10 usec to see if the address cycle completed.
|
||||
* The MDI Command bit will clear when the operation is
|
||||
* complete
|
||||
*/
|
||||
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
|
||||
usec_delay(10);
|
||||
|
||||
command = IXGBE_READ_REG(hw, IXGBE_MSCA);
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
|
||||
DEBUGOUT("PHY address cmd didn't complete\n");
|
||||
status = IXGBE_ERR_PHY;
|
||||
}
|
||||
|
||||
if (status == IXGBE_SUCCESS) {
|
||||
/*
|
||||
* Address cycle complete, setup and write the write
|
||||
* command
|
||||
*/
|
||||
command = ((reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT) |
|
||||
(device_type << IXGBE_MSCA_DEV_TYPE_SHIFT) |
|
||||
(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
|
||||
(IXGBE_MSCA_WRITE | IXGBE_MSCA_MDI_COMMAND));
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
|
||||
|
||||
/*
|
||||
* Check every 10 usec to see if the address cycle
|
||||
* completed. The MDI Command bit will clear when the
|
||||
* operation is complete
|
||||
*/
|
||||
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
|
||||
usec_delay(10);
|
||||
|
||||
command = IXGBE_READ_REG(hw, IXGBE_MSCA);
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
|
||||
DEBUGOUT("PHY address cmd didn't complete\n");
|
||||
status = IXGBE_ERR_PHY;
|
||||
}
|
||||
}
|
||||
|
||||
if (hw->mac.ops.acquire_swfw_sync(hw, gssr) == IXGBE_SUCCESS) {
|
||||
status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type,
|
||||
phy_data);
|
||||
hw->mac.ops.release_swfw_sync(hw, gssr);
|
||||
} else {
|
||||
status = IXGBE_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -556,7 +585,8 @@ s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw)
|
||||
|
||||
if (time_out == max_time_out) {
|
||||
status = IXGBE_ERR_LINK_SETUP;
|
||||
DEBUGOUT("ixgbe_setup_phy_link_generic: time out");
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"PHY autonegotiation time out");
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -863,6 +893,8 @@ s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw)
|
||||
* Read control word from PHY init contents offset
|
||||
*/
|
||||
ret_val = hw->eeprom.ops.read(hw, data_offset, &eword);
|
||||
if (ret_val)
|
||||
goto err_eeprom;
|
||||
control = (eword & IXGBE_CONTROL_MASK_NL) >>
|
||||
IXGBE_CONTROL_SHIFT_NL;
|
||||
edata = eword & IXGBE_DATA_MASK_NL;
|
||||
@ -875,10 +907,16 @@ s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw)
|
||||
case IXGBE_DATA_NL:
|
||||
DEBUGOUT("DATA:\n");
|
||||
data_offset++;
|
||||
hw->eeprom.ops.read(hw, data_offset++,
|
||||
&phy_offset);
|
||||
ret_val = hw->eeprom.ops.read(hw, data_offset,
|
||||
&phy_offset);
|
||||
if (ret_val)
|
||||
goto err_eeprom;
|
||||
data_offset++;
|
||||
for (i = 0; i < edata; i++) {
|
||||
hw->eeprom.ops.read(hw, data_offset, &eword);
|
||||
ret_val = hw->eeprom.ops.read(hw, data_offset,
|
||||
&eword);
|
||||
if (ret_val)
|
||||
goto err_eeprom;
|
||||
hw->phy.ops.write_reg(hw, phy_offset,
|
||||
IXGBE_TWINAX_DEV, eword);
|
||||
DEBUGOUT2("Wrote %4.4x to %4.4x\n", eword,
|
||||
@ -910,6 +948,11 @@ s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw)
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
|
||||
err_eeprom:
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"eeprom read at offset %d failed", data_offset);
|
||||
return IXGBE_ERR_PHY;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1159,7 +1202,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
|
||||
if (comp_codes_10g == 0 &&
|
||||
!(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
|
||||
hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
|
||||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
|
||||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
|
||||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) {
|
||||
hw->phy.type = ixgbe_phy_sfp_unsupported;
|
||||
status = IXGBE_ERR_SFP_NOT_SUPPORTED;
|
||||
@ -1174,10 +1217,10 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
|
||||
|
||||
ixgbe_get_device_caps(hw, &enforce_sfp);
|
||||
if (!(enforce_sfp & IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP) &&
|
||||
!((hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0) ||
|
||||
(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1) ||
|
||||
(hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0) ||
|
||||
(hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1))) {
|
||||
!(hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
|
||||
hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 ||
|
||||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
|
||||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) {
|
||||
/* Make sure we're a supported PHY type */
|
||||
if (hw->phy.type == ixgbe_phy_sfp_intel) {
|
||||
status = IXGBE_SUCCESS;
|
||||
@ -1262,7 +1305,12 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
|
||||
sfp_type = ixgbe_sfp_type_srlr_core1;
|
||||
|
||||
/* Read offset to PHY init contents */
|
||||
hw->eeprom.ops.read(hw, IXGBE_PHY_INIT_OFFSET_NL, list_offset);
|
||||
if (hw->eeprom.ops.read(hw, IXGBE_PHY_INIT_OFFSET_NL, list_offset)) {
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"eeprom read at offset %d failed",
|
||||
IXGBE_PHY_INIT_OFFSET_NL);
|
||||
return IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT;
|
||||
}
|
||||
|
||||
if ((!*list_offset) || (*list_offset == 0xFFFF))
|
||||
return IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT;
|
||||
@ -1274,12 +1322,14 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
|
||||
* Find the matching SFP ID in the EEPROM
|
||||
* and program the init sequence
|
||||
*/
|
||||
hw->eeprom.ops.read(hw, *list_offset, &sfp_id);
|
||||
if (hw->eeprom.ops.read(hw, *list_offset, &sfp_id))
|
||||
goto err_phy;
|
||||
|
||||
while (sfp_id != IXGBE_PHY_INIT_END_NL) {
|
||||
if (sfp_id == sfp_type) {
|
||||
(*list_offset)++;
|
||||
hw->eeprom.ops.read(hw, *list_offset, data_offset);
|
||||
if (hw->eeprom.ops.read(hw, *list_offset, data_offset))
|
||||
goto err_phy;
|
||||
if ((!*data_offset) || (*data_offset == 0xFFFF)) {
|
||||
DEBUGOUT("SFP+ module not supported\n");
|
||||
return IXGBE_ERR_SFP_NOT_SUPPORTED;
|
||||
@ -1289,7 +1339,7 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
|
||||
} else {
|
||||
(*list_offset) += 2;
|
||||
if (hw->eeprom.ops.read(hw, *list_offset, &sfp_id))
|
||||
return IXGBE_ERR_PHY;
|
||||
goto err_phy;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1299,6 +1349,11 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
|
||||
err_phy:
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"eeprom read at offset %d failed", *list_offset);
|
||||
return IXGBE_ERR_PHY;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1664,7 +1719,8 @@ static s32 ixgbe_get_i2c_ack(struct ixgbe_hw *hw)
|
||||
}
|
||||
|
||||
if (ack == 1) {
|
||||
DEBUGOUT("I2C ack was not received.\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"I2C ack was not received.\n");
|
||||
status = IXGBE_ERR_I2C;
|
||||
}
|
||||
|
||||
@ -1734,7 +1790,8 @@ static s32 ixgbe_clock_out_i2c_bit(struct ixgbe_hw *hw, bool data)
|
||||
usec_delay(IXGBE_I2C_T_LOW);
|
||||
} else {
|
||||
status = IXGBE_ERR_I2C;
|
||||
DEBUGOUT1("I2C data was not set to %X\n", data);
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"I2C data was not set to %X\n", data);
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -1818,7 +1875,9 @@ static s32 ixgbe_set_i2c_data(struct ixgbe_hw *hw, u32 *i2cctl, bool data)
|
||||
*i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
|
||||
if (data != ixgbe_get_i2c_data(i2cctl)) {
|
||||
status = IXGBE_ERR_I2C;
|
||||
DEBUGOUT1("Error - I2C data was not set to %X.\n", data);
|
||||
ERROR_REPORT2(IXGBE_ERROR_INVALID_STATE,
|
||||
"Error - I2C data was not set to %X.\n",
|
||||
data);
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -1905,6 +1964,7 @@ s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw)
|
||||
goto out;
|
||||
|
||||
status = IXGBE_ERR_OVERTEMP;
|
||||
ERROR_REPORT1(IXGBE_ERROR_CAUTION, "Device over temperature");
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
@ -118,6 +118,10 @@ enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id);
|
||||
s32 ixgbe_get_phy_id(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_read_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
|
||||
u16 *phy_data);
|
||||
s32 ixgbe_write_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
|
||||
u16 phy_data);
|
||||
s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
|
||||
u32 device_type, u16 *phy_data);
|
||||
s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
|
||||
|
@ -35,9 +35,50 @@
|
||||
#ifndef _IXGBE_TYPE_H_
|
||||
#define _IXGBE_TYPE_H_
|
||||
|
||||
/*
|
||||
* The following is a brief description of the error categories used by the
|
||||
* ERROR_REPORT* macros.
|
||||
*
|
||||
* - IXGBE_ERROR_INVALID_STATE
|
||||
* This category is for errors which represent a serious failure state that is
|
||||
* unexpected, and could be potentially harmful to device operation. It should
|
||||
* not be used for errors relating to issues that can be worked around or
|
||||
* ignored.
|
||||
*
|
||||
* - IXGBE_ERROR_POLLING
|
||||
* This category is for errors related to polling/timeout issues and should be
|
||||
* used in any case where the timeout occured, or a failure to obtain a lock, or
|
||||
* failure to receive data within the time limit.
|
||||
*
|
||||
* - IXGBE_ERROR_CAUTION
|
||||
* This category should be used for reporting issues that may be the cause of
|
||||
* other errors, such as temperature warnings. It should indicate an event which
|
||||
* could be serious, but hasn't necessarily caused problems yet.
|
||||
*
|
||||
* - IXGBE_ERROR_SOFTWARE
|
||||
* This category is intended for errors due to software state preventing
|
||||
* something. The category is not intended for errors due to bad arguments, or
|
||||
* due to unsupported features. It should be used when a state occurs which
|
||||
* prevents action but is not a serious issue.
|
||||
*
|
||||
* - IXGBE_ERROR_ARGUMENT
|
||||
* This category is for when a bad or invalid argument is passed. It should be
|
||||
* used whenever a function is called and error checking has detected the
|
||||
* argument is wrong or incorrect.
|
||||
*
|
||||
* - IXGBE_ERROR_UNSUPPORTED
|
||||
* This category is for errors which are due to unsupported circumstances or
|
||||
* configuration issues. It should not be used when the issue is due to an
|
||||
* invalid argument, but for when something has occurred that is unsupported
|
||||
* (Ex: Flow control autonegotiation or an unsupported SFP+ module.)
|
||||
*/
|
||||
|
||||
#include "ixgbe_osdep.h"
|
||||
|
||||
|
||||
/* Vendor ID */
|
||||
#define IXGBE_INTEL_VENDOR_ID 0x8086
|
||||
|
||||
/* Device IDs */
|
||||
#define IXGBE_DEV_ID_82598 0x10B6
|
||||
#define IXGBE_DEV_ID_82598_BX 0x1508
|
||||
@ -62,12 +103,15 @@
|
||||
#define IXGBE_SUBDEV_ID_82599_RNDC 0x1F72
|
||||
#define IXGBE_SUBDEV_ID_82599_560FLR 0x17D0
|
||||
#define IXGBE_SUBDEV_ID_82599_ECNA_DP 0x0470
|
||||
#define IXGBE_SUBDEV_ID_82599_SP_560FLR 0x211B
|
||||
#define IXGBE_SUBDEV_ID_82599_LOM_SFP 0x8976
|
||||
#define IXGBE_DEV_ID_82599_BACKPLANE_FCOE 0x152A
|
||||
#define IXGBE_DEV_ID_82599_SFP_FCOE 0x1529
|
||||
#define IXGBE_DEV_ID_82599_SFP_EM 0x1507
|
||||
#define IXGBE_DEV_ID_82599_SFP_SF2 0x154D
|
||||
#define IXGBE_DEV_ID_82599_SFP_SF_QP 0x154A
|
||||
#define IXGBE_DEV_ID_82599EN_SFP 0x1557
|
||||
#define IXGBE_SUBDEV_ID_82599EN_SFP_OCP1 0x0001
|
||||
#define IXGBE_DEV_ID_82599_XAUI_LOM 0x10FC
|
||||
#define IXGBE_DEV_ID_82599_T3_LOM 0x151C
|
||||
#define IXGBE_DEV_ID_82599_VF 0x10ED
|
||||
@ -212,12 +256,12 @@
|
||||
(((_i) < 64) ? (0x0100C + ((_i) * 0x40)) : \
|
||||
(0x0D00C + (((_i) - 64) * 0x40))))
|
||||
#define IXGBE_RDRXCTL 0x02F00
|
||||
#define IXGBE_RDRXCTL_RSC_PUSH 0x80
|
||||
/* 8 of these 0x03C00 - 0x03C1C */
|
||||
#define IXGBE_RXPBSIZE(_i) (0x03C00 + ((_i) * 4))
|
||||
#define IXGBE_RXCTRL 0x03000
|
||||
#define IXGBE_DROPEN 0x03D04
|
||||
#define IXGBE_RXPBSIZE_SHIFT 10
|
||||
#define IXGBE_RXPBSIZE_MASK 0x000FFC00
|
||||
|
||||
/* Receive Registers */
|
||||
#define IXGBE_RXCSUM 0x05000
|
||||
@ -446,6 +490,7 @@
|
||||
#define IXGBE_TDPT2TCSR(_i) (0x0CD40 + ((_i) * 4)) /* 8 of these (0-7) */
|
||||
|
||||
|
||||
|
||||
/* Security Control Registers */
|
||||
#define IXGBE_SECTXCTRL 0x08800
|
||||
#define IXGBE_SECTXSTAT 0x08804
|
||||
@ -589,8 +634,6 @@
|
||||
#define IXGBE_FCPTRH 0x02414 /* FC USer Desc. PTR High */
|
||||
#define IXGBE_FCBUFF 0x02418 /* FC Buffer Control */
|
||||
#define IXGBE_FCDMARW 0x02420 /* FC Receive DMA RW */
|
||||
#define IXGBE_FCINVST0 0x03FC0 /* FC Invalid DMA Context Status Reg 0*/
|
||||
#define IXGBE_FCINVST(_i) (IXGBE_FCINVST0 + ((_i) * 4))
|
||||
#define IXGBE_FCBUFF_VALID (1 << 0) /* DMA Context Valid */
|
||||
#define IXGBE_FCBUFF_BUFFSIZE (3 << 3) /* User Buffer Size */
|
||||
#define IXGBE_FCBUFF_WRCONTX (1 << 7) /* 0: Initiator, 1: Target */
|
||||
@ -887,8 +930,6 @@
|
||||
#define IXGBE_RDPROBE 0x02F20
|
||||
#define IXGBE_RDMAM 0x02F30
|
||||
#define IXGBE_RDMAD 0x02F34
|
||||
#define IXGBE_TDSTATCTL 0x07C20
|
||||
#define IXGBE_TDSTAT(_i) (0x07C00 + ((_i) * 4)) /* 0x07C00 - 0x07C1C */
|
||||
#define IXGBE_TDHMPN 0x07F08
|
||||
#define IXGBE_TDHMPN2 0x082FC
|
||||
#define IXGBE_TXDESCIC 0x082CC
|
||||
@ -1037,7 +1078,9 @@
|
||||
#define IXGBE_RDRXCTL_RDMTS_1_2 0x00000000 /* Rx Desc Min THLD Size */
|
||||
#define IXGBE_RDRXCTL_CRCSTRIP 0x00000002 /* CRC Strip */
|
||||
#define IXGBE_RDRXCTL_MVMEN 0x00000020
|
||||
#define IXGBE_RDRXCTL_RSC_PUSH_DIS 0x00000020
|
||||
#define IXGBE_RDRXCTL_DMAIDONE 0x00000008 /* DMA init cycle done */
|
||||
#define IXGBE_RDRXCTL_RSC_PUSH 0x00000080
|
||||
#define IXGBE_RDRXCTL_AGGDIS 0x00010000 /* Aggregation disable */
|
||||
#define IXGBE_RDRXCTL_RSCFRSTSIZE 0x003E0000 /* RSC First packet size */
|
||||
#define IXGBE_RDRXCTL_RSCLLIDIS 0x00800000 /* Disable RSC compl on LLI*/
|
||||
@ -1684,7 +1727,8 @@ enum {
|
||||
#define IXGBE_AUTOC2_10G_KR (0x0 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT)
|
||||
#define IXGBE_AUTOC2_10G_XFI (0x1 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT)
|
||||
#define IXGBE_AUTOC2_10G_SFI (0x2 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT)
|
||||
#define IXGBE_AUTOC2_LINK_DISABLE_MASK 0x70000000
|
||||
#define IXGBE_AUTOC2_LINK_DISABLE_ON_D3_MASK 0x50000000
|
||||
#define IXGBE_AUTOC2_LINK_DISABLE_MASK 0x70000000
|
||||
|
||||
#define IXGBE_MACC_FLU 0x00000001
|
||||
#define IXGBE_MACC_FSV_10G 0x00030000
|
||||
@ -1857,6 +1901,8 @@ enum {
|
||||
#define IXGBE_EEPROM_PAGE_SIZE_MAX 128
|
||||
#define IXGBE_EEPROM_RD_BUFFER_MAX_COUNT 256 /* words rd in burst */
|
||||
#define IXGBE_EEPROM_WR_BUFFER_MAX_COUNT 256 /* words wr in burst */
|
||||
#define IXGBE_EEPROM_CTRL_2 1 /* EEPROM CTRL word 2 */
|
||||
#define IXGBE_EEPROM_CCD_BIT 2
|
||||
|
||||
#ifndef IXGBE_EEPROM_GRANT_ATTEMPTS
|
||||
#define IXGBE_EEPROM_GRANT_ATTEMPTS 1000 /* EEPROM attempts to gain grant */
|
||||
@ -1897,6 +1943,18 @@ enum {
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_CAPS_SANMAC 0x0 /* Alt SAN MAC exists */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_CAPS_ALTWWN 0x1 /* Alt WWN base exists */
|
||||
|
||||
/* FW header offset */
|
||||
#define IXGBE_X540_FW_PASSTHROUGH_PATCH_CONFIG_PTR 0x4
|
||||
#define IXGBE_X540_FW_MODULE_MASK 0x7FFF
|
||||
/* 4KB multiplier */
|
||||
#define IXGBE_X540_FW_MODULE_LENGTH 0x1000
|
||||
/* version word 2 (month & day) */
|
||||
#define IXGBE_X540_FW_PATCH_VERSION_2 0x5
|
||||
/* version word 3 (silicon compatibility & year) */
|
||||
#define IXGBE_X540_FW_PATCH_VERSION_3 0x6
|
||||
/* version word 4 (major & minor numbers) */
|
||||
#define IXGBE_X540_FW_PATCH_VERSION_4 0x7
|
||||
|
||||
#define IXGBE_DEVICE_CAPS_WOL_PORT0_1 0x4 /* WoL supported on ports 0 & 1 */
|
||||
#define IXGBE_DEVICE_CAPS_WOL_PORT0 0x8 /* WoL supported on port 0 */
|
||||
#define IXGBE_DEVICE_CAPS_WOL_MASK 0xC /* Mask for WoL capabilities */
|
||||
@ -1919,6 +1977,17 @@ enum {
|
||||
#define IXGBE_PCI_HEADER_TYPE_MULTIFUNC 0x80
|
||||
#define IXGBE_PCI_DEVICE_CONTROL2_16ms 0x0005
|
||||
|
||||
#define IXGBE_PCIDEVCTRL2_TIMEO_MASK 0xf
|
||||
#define IXGBE_PCIDEVCTRL2_16_32ms_def 0x0
|
||||
#define IXGBE_PCIDEVCTRL2_50_100us 0x1
|
||||
#define IXGBE_PCIDEVCTRL2_1_2ms 0x2
|
||||
#define IXGBE_PCIDEVCTRL2_16_32ms 0x5
|
||||
#define IXGBE_PCIDEVCTRL2_65_130ms 0x6
|
||||
#define IXGBE_PCIDEVCTRL2_260_520ms 0x9
|
||||
#define IXGBE_PCIDEVCTRL2_1_2s 0xa
|
||||
#define IXGBE_PCIDEVCTRL2_4_8s 0xd
|
||||
#define IXGBE_PCIDEVCTRL2_17_34s 0xe
|
||||
|
||||
/* Number of 100 microseconds we wait for PCI Express master disable */
|
||||
#define IXGBE_PCI_MASTER_DISABLE_TIMEOUT 800
|
||||
|
||||
@ -2348,6 +2417,14 @@ enum ixgbe_fdir_pballoc_type {
|
||||
#define IXGBE_FDIR_DROP_QUEUE 127
|
||||
|
||||
#define IXGBE_STATUS_OVERHEATING_BIT 20 /* STATUS overtemp bit num */
|
||||
/* iTS sensor related defines*/
|
||||
#define IXGBE_TEMP_STATUS_ADDR_X540 0xC830
|
||||
#define IXGBE_TEMP_VALUE_ADDR_X540 0xC820
|
||||
#define IXGBE_TEMP_PROV_2_ADDR_X540 0xC421
|
||||
#define IXGBE_TEMP_PROV_4_ADDR_X540 0xC423
|
||||
#define IXGBE_TEMP_STATUS_PAGE_X540 0x1E
|
||||
#define IXGBE_TEMP_HIGH_FAILURE_BIT_X540 0xE
|
||||
#define IXGBE_TEMP_HIGH_WARNING_BIT_X540 0xC
|
||||
|
||||
/* Manageablility Host Interface defines */
|
||||
#define IXGBE_HI_MAX_BLOCK_BYTE_LENGTH 1792 /* Num of bytes in range */
|
||||
@ -3033,6 +3110,10 @@ struct ixgbe_mac_operations {
|
||||
|
||||
/* Manageability interface */
|
||||
s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8);
|
||||
s32 (*dmac_config)(struct ixgbe_hw *hw);
|
||||
s32 (*dmac_update_tcs)(struct ixgbe_hw *hw);
|
||||
s32 (*dmac_config_tcs)(struct ixgbe_hw *hw);
|
||||
void (*get_rtrup2tc)(struct ixgbe_hw *hw, u8 *map);
|
||||
};
|
||||
|
||||
struct ixgbe_phy_operations {
|
||||
@ -3042,6 +3123,8 @@ struct ixgbe_phy_operations {
|
||||
s32 (*reset)(struct ixgbe_hw *);
|
||||
s32 (*read_reg)(struct ixgbe_hw *, u32, u32, u16 *);
|
||||
s32 (*write_reg)(struct ixgbe_hw *, u32, u32, u16);
|
||||
s32 (*read_reg_mdi)(struct ixgbe_hw *, u32, u32, u16 *);
|
||||
s32 (*write_reg_mdi)(struct ixgbe_hw *, u32, u32, u16);
|
||||
s32 (*setup_link)(struct ixgbe_hw *);
|
||||
s32 (*setup_link_speed)(struct ixgbe_hw *, ixgbe_link_speed, bool);
|
||||
s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *);
|
||||
@ -3164,6 +3247,8 @@ struct ixgbe_hw {
|
||||
int api_version;
|
||||
bool force_full_reset;
|
||||
bool allow_unsupported_sfp;
|
||||
bool mng_fw_enabled;
|
||||
bool wol_enabled;
|
||||
};
|
||||
|
||||
#define ixgbe_call_func(hw, func, params, error) \
|
||||
@ -3206,8 +3291,8 @@ struct ixgbe_hw {
|
||||
#define IXGBE_ERR_HOST_INTERFACE_COMMAND -33
|
||||
#define IXGBE_ERR_OUT_OF_MEM -34
|
||||
#define IXGBE_ERR_FEATURE_NOT_SUPPORTED -36
|
||||
#define IXGBE_ERR_EEPROM_PROTECTED_REGION -37
|
||||
|
||||
#define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF
|
||||
|
||||
|
||||
#endif /* _IXGBE_TYPE_H_ */
|
||||
|
@ -157,34 +157,33 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
|
||||
usec_delay(5);
|
||||
}
|
||||
|
||||
if (timeout) {
|
||||
/* mailbox timeout can now become active */
|
||||
mbx->timeout = IXGBE_VF_MBX_INIT_TIMEOUT;
|
||||
if (!timeout)
|
||||
return IXGBE_ERR_RESET_FAILED;
|
||||
|
||||
msgbuf[0] = IXGBE_VF_RESET;
|
||||
mbx->ops.write_posted(hw, msgbuf, 1, 0);
|
||||
/* mailbox timeout can now become active */
|
||||
mbx->timeout = IXGBE_VF_MBX_INIT_TIMEOUT;
|
||||
|
||||
msec_delay(10);
|
||||
msgbuf[0] = IXGBE_VF_RESET;
|
||||
mbx->ops.write_posted(hw, msgbuf, 1, 0);
|
||||
|
||||
/*
|
||||
* set our "perm_addr" based on info provided by PF
|
||||
* also set up the mc_filter_type which is piggy backed
|
||||
* on the mac address in word 3
|
||||
*/
|
||||
ret_val = mbx->ops.read_posted(hw, msgbuf,
|
||||
IXGBE_VF_PERMADDR_MSG_LEN, 0);
|
||||
if (!ret_val) {
|
||||
if (msgbuf[0] == (IXGBE_VF_RESET |
|
||||
IXGBE_VT_MSGTYPE_ACK)) {
|
||||
memcpy(hw->mac.perm_addr, addr,
|
||||
IXGBE_ETH_LENGTH_OF_ADDRESS);
|
||||
hw->mac.mc_filter_type =
|
||||
msgbuf[IXGBE_VF_MC_TYPE_WORD];
|
||||
} else {
|
||||
ret_val = IXGBE_ERR_INVALID_MAC_ADDR;
|
||||
}
|
||||
}
|
||||
}
|
||||
msec_delay(10);
|
||||
|
||||
/*
|
||||
* set our "perm_addr" based on info provided by PF
|
||||
* also set up the mc_filter_type which is piggy backed
|
||||
* on the mac address in word 3
|
||||
*/
|
||||
ret_val = mbx->ops.read_posted(hw, msgbuf,
|
||||
IXGBE_VF_PERMADDR_MSG_LEN, 0);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
if (msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK) &&
|
||||
msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_NACK))
|
||||
return IXGBE_ERR_INVALID_MAC_ADDR;
|
||||
|
||||
memcpy(hw->mac.perm_addr, addr, IXGBE_ETH_LENGTH_OF_ADDRESS);
|
||||
hw->mac.mc_filter_type = msgbuf[IXGBE_VF_MC_TYPE_WORD];
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "ixgbe_common.h"
|
||||
#include "ixgbe_phy.h"
|
||||
|
||||
static s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw);
|
||||
static s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw);
|
||||
static s32 ixgbe_get_swfw_sync_semaphore(struct ixgbe_hw *hw);
|
||||
static void ixgbe_release_swfw_sync_semaphore(struct ixgbe_hw *hw);
|
||||
@ -142,6 +141,8 @@ s32 ixgbe_init_ops_X540(struct ixgbe_hw *hw)
|
||||
/* Manageability interface */
|
||||
mac->ops.set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic;
|
||||
|
||||
mac->ops.get_rtrup2tc = &ixgbe_dcb_get_rtrup2tc_generic;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
@ -226,7 +227,8 @@ s32 ixgbe_reset_hw_X540(struct ixgbe_hw *hw)
|
||||
|
||||
if (ctrl & IXGBE_CTRL_RST_MASK) {
|
||||
status = IXGBE_ERR_RESET_FAILED;
|
||||
DEBUGOUT("Reset polling failed to complete.\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"Reset polling failed to complete.\n");
|
||||
}
|
||||
msec_delay(100);
|
||||
|
||||
@ -372,12 +374,13 @@ s32 ixgbe_read_eerd_X540(struct ixgbe_hw *hw, u16 offset, u16 *data)
|
||||
|
||||
DEBUGFUNC("ixgbe_read_eerd_X540");
|
||||
if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) ==
|
||||
IXGBE_SUCCESS)
|
||||
IXGBE_SUCCESS) {
|
||||
status = ixgbe_read_eerd_generic(hw, offset, data);
|
||||
else
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
} else {
|
||||
status = IXGBE_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -397,13 +400,14 @@ s32 ixgbe_read_eerd_buffer_X540(struct ixgbe_hw *hw,
|
||||
|
||||
DEBUGFUNC("ixgbe_read_eerd_buffer_X540");
|
||||
if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) ==
|
||||
IXGBE_SUCCESS)
|
||||
IXGBE_SUCCESS) {
|
||||
status = ixgbe_read_eerd_buffer_generic(hw, offset,
|
||||
words, data);
|
||||
else
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
} else {
|
||||
status = IXGBE_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -421,12 +425,13 @@ s32 ixgbe_write_eewr_X540(struct ixgbe_hw *hw, u16 offset, u16 data)
|
||||
|
||||
DEBUGFUNC("ixgbe_write_eewr_X540");
|
||||
if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) ==
|
||||
IXGBE_SUCCESS)
|
||||
IXGBE_SUCCESS) {
|
||||
status = ixgbe_write_eewr_generic(hw, offset, data);
|
||||
else
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
} else {
|
||||
status = IXGBE_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -446,13 +451,14 @@ s32 ixgbe_write_eewr_buffer_X540(struct ixgbe_hw *hw,
|
||||
|
||||
DEBUGFUNC("ixgbe_write_eewr_buffer_X540");
|
||||
if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) ==
|
||||
IXGBE_SUCCESS)
|
||||
IXGBE_SUCCESS) {
|
||||
status = ixgbe_write_eewr_buffer_generic(hw, offset,
|
||||
words, data);
|
||||
else
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
} else {
|
||||
status = IXGBE_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -578,17 +584,20 @@ s32 ixgbe_validate_eeprom_checksum_X540(struct ixgbe_hw *hw,
|
||||
* Verify read checksum from EEPROM is the same as
|
||||
* calculated checksum
|
||||
*/
|
||||
if (read_checksum != checksum)
|
||||
if (read_checksum != checksum) {
|
||||
status = IXGBE_ERR_EEPROM_CHECKSUM;
|
||||
ERROR_REPORT1(IXGBE_ERROR_INVALID_STATE,
|
||||
"Invalid EEPROM checksum");
|
||||
}
|
||||
|
||||
/* If the user cares, return the calculated checksum */
|
||||
if (checksum_val)
|
||||
*checksum_val = checksum;
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
} else {
|
||||
status = IXGBE_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
@ -629,14 +638,13 @@ s32 ixgbe_update_eeprom_checksum_X540(struct ixgbe_hw *hw)
|
||||
status = ixgbe_write_eewr_generic(hw, IXGBE_EEPROM_CHECKSUM,
|
||||
checksum);
|
||||
|
||||
if (status == IXGBE_SUCCESS)
|
||||
status = ixgbe_update_flash_X540(hw);
|
||||
else
|
||||
if (status == IXGBE_SUCCESS)
|
||||
status = ixgbe_update_flash_X540(hw);
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
} else {
|
||||
status = IXGBE_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -647,7 +655,7 @@ s32 ixgbe_update_eeprom_checksum_X540(struct ixgbe_hw *hw)
|
||||
* Set FLUP (bit 23) of the EEC register to instruct Hardware to copy
|
||||
* EEPROM from shadow RAM to the flash device.
|
||||
**/
|
||||
static s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw)
|
||||
s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw)
|
||||
{
|
||||
u32 flup;
|
||||
s32 status = IXGBE_ERR_EEPROM;
|
||||
@ -669,7 +677,7 @@ static s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw)
|
||||
else
|
||||
DEBUGOUT("Flash update time out\n");
|
||||
|
||||
if (hw->revision_id == 0) {
|
||||
if (hw->mac.type == ixgbe_mac_X540 && hw->revision_id == 0) {
|
||||
flup = IXGBE_READ_REG(hw, IXGBE_EEC);
|
||||
|
||||
if (flup & IXGBE_EEC_SEC1VAL) {
|
||||
@ -710,6 +718,11 @@ static s32 ixgbe_poll_flash_update_done_X540(struct ixgbe_hw *hw)
|
||||
}
|
||||
usec_delay(5);
|
||||
}
|
||||
|
||||
if (i == IXGBE_FLUDONE_ATTEMPTS)
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"Flash update status polling timed out");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -755,7 +768,6 @@ s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, u16 mask)
|
||||
swfw_sync |= swmask;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC, swfw_sync);
|
||||
ixgbe_release_swfw_sync_semaphore(hw);
|
||||
msec_delay(5);
|
||||
goto out;
|
||||
} else {
|
||||
/*
|
||||
@ -771,11 +783,13 @@ s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, u16 mask)
|
||||
/* Failed to get SW only semaphore */
|
||||
if (swmask == IXGBE_GSSR_SW_MNG_SM) {
|
||||
ret_val = IXGBE_ERR_SWFW_SYNC;
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"Failed to get SW only semaphore");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* If the resource is not released by the FW/HW the SW can assume that
|
||||
* the FW/HW malfunctions. In that case the SW should sets the SW bit(s)
|
||||
* the FW/HW malfunctions. In that case the SW should set the SW bit(s)
|
||||
* of the requested resource(s) while ignoring the corresponding FW/HW
|
||||
* bits in the SW_FW_SYNC register.
|
||||
*/
|
||||
@ -791,6 +805,17 @@ s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, u16 mask)
|
||||
ixgbe_release_swfw_sync_semaphore(hw);
|
||||
msec_delay(5);
|
||||
}
|
||||
/* If the resource is not released by other SW the SW can assume that
|
||||
* the other SW malfunctions. In that case the SW should clear all SW
|
||||
* flags that it does not own and then repeat the whole process once
|
||||
* again.
|
||||
*/
|
||||
else if (swfw_sync & swmask) {
|
||||
ixgbe_release_swfw_sync_X540(hw, IXGBE_GSSR_EEP_SM |
|
||||
IXGBE_GSSR_PHY0_SM | IXGBE_GSSR_PHY1_SM |
|
||||
IXGBE_GSSR_MAC_CSR_SM);
|
||||
ret_val = IXGBE_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
@ -818,7 +843,6 @@ void ixgbe_release_swfw_sync_X540(struct ixgbe_hw *hw, u16 mask)
|
||||
IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC, swfw_sync);
|
||||
|
||||
ixgbe_release_swfw_sync_semaphore(hw);
|
||||
msec_delay(5);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -865,14 +889,15 @@ static s32 ixgbe_get_swfw_sync_semaphore(struct ixgbe_hw *hw)
|
||||
* was not granted because we don't have access to the EEPROM
|
||||
*/
|
||||
if (i >= timeout) {
|
||||
DEBUGOUT("REGSMP Software NVM semaphore not "
|
||||
"granted.\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"REGSMP Software NVM semaphore not granted.\n");
|
||||
ixgbe_release_swfw_sync_semaphore(hw);
|
||||
status = IXGBE_ERR_EEPROM;
|
||||
}
|
||||
} else {
|
||||
DEBUGOUT("Software semaphore SMBI between device drivers "
|
||||
"not granted.\n");
|
||||
ERROR_REPORT1(IXGBE_ERROR_POLLING,
|
||||
"Software semaphore SMBI between device drivers "
|
||||
"not granted.\n");
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -56,6 +56,7 @@ s32 ixgbe_write_eewr_buffer_X540(struct ixgbe_hw *hw, u16 offset, u16 words,
|
||||
s32 ixgbe_update_eeprom_checksum_X540(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_validate_eeprom_checksum_X540(struct ixgbe_hw *hw, u16 *checksum_val);
|
||||
u16 ixgbe_calc_eeprom_checksum_X540(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_update_flash_X540(struct ixgbe_hw *hw);
|
||||
|
||||
s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, u16 mask);
|
||||
void ixgbe_release_swfw_sync_X540(struct ixgbe_hw *hw, u16 mask);
|
||||
@ -63,3 +64,4 @@ void ixgbe_release_swfw_sync_X540(struct ixgbe_hw *hw, u16 mask);
|
||||
s32 ixgbe_blink_led_start_X540(struct ixgbe_hw *hw, u32 index);
|
||||
s32 ixgbe_blink_led_stop_X540(struct ixgbe_hw *hw, u32 index);
|
||||
#endif /* _IXGBE_X540_H_ */
|
||||
|
||||
|
@ -10,6 +10,7 @@ SRCS += opt_inet.h opt_inet6.h
|
||||
SRCS += ixgbe.c ixv.c
|
||||
# Shared source
|
||||
SRCS += ixgbe_common.c ixgbe_api.c ixgbe_phy.c ixgbe_mbx.c ixgbe_vf.c
|
||||
SRCS += ixgbe_dcb.c ixgbe_dcb_82598.c ixgbe_dcb_82599.c
|
||||
SRCS += ixgbe_82599.c ixgbe_82598.c ixgbe_x540.c
|
||||
CFLAGS+= -I${.CURDIR}/../../dev/ixgbe -DSMP -DIXGBE_FDIR
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user