Update ixgbe driver to verion 2.3.6
- This adds a VM SRIOV interface, ixv, it is however transparent to the user, it links with the ixgbe.ko, but when ixgbe is loaded in a virtualized guest with SRIOV configured this will be detected. - Sync shared code to latest - Many bug fixes and improvements, thanks to everyone who has been using the driver and reporting issues.
This commit is contained in:
parent
dfd9c1b976
commit
48bbd73f9a
@ -1252,12 +1252,18 @@ dev/ixgb/ixgb_ee.c optional ixgb
|
||||
dev/ixgb/ixgb_hw.c optional ixgb
|
||||
dev/ixgbe/ixgbe.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixv.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_phy.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_api.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_common.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_mbx.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_vf.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_82598.c optional ixgbe inet \
|
||||
compile-with "${NORMAL_C} -I$S/dev/ixgbe"
|
||||
dev/ixgbe/ixgbe_82599.c optional ixgbe inet \
|
||||
|
@ -46,7 +46,7 @@ int ixgbe_display_debug_stats = 0;
|
||||
/*********************************************************************
|
||||
* Driver version
|
||||
*********************************************************************/
|
||||
char ixgbe_driver_version[] = "2.2.3";
|
||||
char ixgbe_driver_version[] = "2.3.6";
|
||||
|
||||
/*********************************************************************
|
||||
* PCI Device ID Table
|
||||
@ -78,6 +78,8 @@ static ixgbe_vendor_info_t ixgbe_vendor_info_array[] =
|
||||
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_CX4, 0, 0, 0},
|
||||
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_T3_LOM, 0, 0, 0},
|
||||
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_COMBO_BACKPLANE, 0, 0, 0},
|
||||
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_BACKPLANE_FCOE, 0, 0, 0},
|
||||
{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0},
|
||||
/* required last entry */
|
||||
{0, 0, 0, 0, 0}
|
||||
};
|
||||
@ -119,7 +121,7 @@ static int ixgbe_allocate_queues(struct adapter *);
|
||||
static int ixgbe_setup_msix(struct adapter *);
|
||||
static void ixgbe_free_pci_resources(struct adapter *);
|
||||
static void ixgbe_local_timer(void *);
|
||||
static int ixgbe_setup_interface(device_t, struct adapter *);
|
||||
static void ixgbe_setup_interface(device_t, struct adapter *);
|
||||
static void ixgbe_config_link(struct adapter *);
|
||||
|
||||
static int ixgbe_allocate_transmit_buffers(struct tx_ring *);
|
||||
@ -144,7 +146,6 @@ static bool ixgbe_txeof(struct tx_ring *);
|
||||
static bool ixgbe_rxeof(struct ix_queue *, int);
|
||||
static void ixgbe_rx_checksum(u32, struct mbuf *, u32);
|
||||
static void ixgbe_set_promisc(struct adapter *);
|
||||
static void ixgbe_disable_promisc(struct adapter *);
|
||||
static void ixgbe_set_multi(struct adapter *);
|
||||
static void ixgbe_print_hw_stats(struct adapter *);
|
||||
static void ixgbe_print_debug_info(struct adapter *);
|
||||
@ -212,7 +213,7 @@ static driver_t ixgbe_driver = {
|
||||
"ix", ixgbe_methods, sizeof(struct adapter),
|
||||
};
|
||||
|
||||
static devclass_t ixgbe_devclass;
|
||||
devclass_t ixgbe_devclass;
|
||||
DRIVER_MODULE(ixgbe, pci, ixgbe_driver, ixgbe_devclass, 0, 0);
|
||||
|
||||
MODULE_DEPEND(ixgbe, pci, 1, 1, 1);
|
||||
@ -257,7 +258,7 @@ TUNABLE_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix);
|
||||
|
||||
/*
|
||||
* Header split: this causes the hardware to DMA
|
||||
* the header into a separate mbuf from the payload,
|
||||
* the header into a seperate mbuf from the payload,
|
||||
* it can be a performance win in some workloads, but
|
||||
* in others it actually hurts, its off by default.
|
||||
*/
|
||||
@ -288,13 +289,6 @@ TUNABLE_INT("hw.ixgbe.rxd", &ixgbe_rxd);
|
||||
/* Keep running tab on them for sanity check */
|
||||
static int ixgbe_total_ports;
|
||||
|
||||
/*
|
||||
** Shadow VFTA table, this is needed because
|
||||
** the real filter table gets cleared during
|
||||
** a soft reset and we need to repopulate it.
|
||||
*/
|
||||
static u32 ixgbe_shadow_vfta[IXGBE_VFTA_SIZE];
|
||||
|
||||
/*
|
||||
** The number of scatter-gather segments
|
||||
** differs for 82598 and 82599, default to
|
||||
@ -446,6 +440,7 @@ ixgbe_attach(device_t dev)
|
||||
ixgbe_num_segs = IXGBE_82599_SCATTER;
|
||||
adapter->optics = IFM_10G_T;
|
||||
default:
|
||||
ixgbe_num_segs = IXGBE_82599_SCATTER;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -524,15 +519,6 @@ ixgbe_attach(device_t dev)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* Allocate multicast array memory. */
|
||||
adapter->mta = malloc(sizeof(u8) * IXGBE_ETH_LENGTH_OF_ADDRESS *
|
||||
MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT);
|
||||
if (adapter->mta == NULL) {
|
||||
device_printf(dev, "Can not allocate multicast setup array\n");
|
||||
error = ENOMEM;
|
||||
goto err_late;
|
||||
}
|
||||
|
||||
/* Initialize the shared code */
|
||||
error = ixgbe_init_shared_code(hw);
|
||||
if (error == IXGBE_ERR_SFP_NOT_PRESENT) {
|
||||
@ -595,8 +581,7 @@ ixgbe_attach(device_t dev)
|
||||
goto err_late;
|
||||
|
||||
/* Setup OS specific network interface */
|
||||
if (ixgbe_setup_interface(dev, adapter) != 0)
|
||||
goto err_late;
|
||||
ixgbe_setup_interface(dev, adapter);
|
||||
|
||||
/* Sysctl for limiting the amount of work done in the taskqueue */
|
||||
ixgbe_add_rx_process_limit(adapter, "rx_processing_limit",
|
||||
@ -642,10 +627,7 @@ err_late:
|
||||
ixgbe_free_transmit_structures(adapter);
|
||||
ixgbe_free_receive_structures(adapter);
|
||||
err_out:
|
||||
if (adapter->ifp != NULL)
|
||||
if_free(adapter->ifp);
|
||||
ixgbe_free_pci_resources(adapter);
|
||||
free(adapter->mta, M_DEVBUF);
|
||||
return (error);
|
||||
|
||||
}
|
||||
@ -716,7 +698,6 @@ ixgbe_detach(device_t dev)
|
||||
|
||||
ixgbe_free_transmit_structures(adapter);
|
||||
ixgbe_free_receive_structures(adapter);
|
||||
free(adapter->mta, M_DEVBUF);
|
||||
|
||||
IXGBE_CORE_LOCK_DESTROY(adapter);
|
||||
return (0);
|
||||
@ -780,8 +761,8 @@ ixgbe_start_locked(struct tx_ring *txr, struct ifnet * ifp)
|
||||
ETHER_BPF_MTAP(ifp, m_head);
|
||||
|
||||
/* Set watchdog on */
|
||||
txr->watchdog_check = TRUE;
|
||||
txr->watchdog_time = ticks;
|
||||
txr->queue_status = IXGBE_QUEUE_WORKING;
|
||||
|
||||
}
|
||||
return;
|
||||
@ -851,6 +832,10 @@ ixgbe_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m)
|
||||
return (err);
|
||||
}
|
||||
|
||||
/* Call cleanup if number of TX descriptors low */
|
||||
if (txr->tx_avail <= IXGBE_TX_CLEANUP_THRESHOLD)
|
||||
ixgbe_txeof(txr);
|
||||
|
||||
enqueued = 0;
|
||||
if (m == NULL) {
|
||||
next = drbr_dequeue(ifp, txr->br);
|
||||
@ -883,7 +868,7 @@ ixgbe_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m)
|
||||
|
||||
if (enqueued > 0) {
|
||||
/* Set watchdog on */
|
||||
txr->watchdog_check = TRUE;
|
||||
txr->queue_status = IXGBE_QUEUE_WORKING;
|
||||
txr->watchdog_time = ticks;
|
||||
}
|
||||
|
||||
@ -948,7 +933,6 @@ ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data)
|
||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING)) {
|
||||
if ((ifp->if_flags ^ adapter->if_flags) &
|
||||
(IFF_PROMISC | IFF_ALLMULTI)) {
|
||||
ixgbe_disable_promisc(adapter);
|
||||
ixgbe_set_promisc(adapter);
|
||||
}
|
||||
} else
|
||||
@ -987,6 +971,8 @@ ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data)
|
||||
ifp->if_capenable ^= IFCAP_LRO;
|
||||
if (mask & IFCAP_VLAN_HWTAGGING)
|
||||
ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
|
||||
if (mask & IFCAP_VLAN_HWFILTER)
|
||||
ifp->if_capenable ^= IFCAP_VLAN_HWFILTER;
|
||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
|
||||
IXGBE_CORE_LOCK(adapter);
|
||||
ixgbe_init_locked(adapter);
|
||||
@ -1041,6 +1027,18 @@ ixgbe_init_locked(struct adapter *adapter)
|
||||
ixgbe_set_rar(hw, 0, hw->mac.addr, 0, 1);
|
||||
hw->addr_ctrl.rar_used_count = 1;
|
||||
|
||||
/* Set the various hardware offload abilities */
|
||||
ifp->if_hwassist = 0;
|
||||
if (ifp->if_capenable & IFCAP_TSO4)
|
||||
ifp->if_hwassist |= CSUM_TSO;
|
||||
if (ifp->if_capenable & IFCAP_TXCSUM) {
|
||||
ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP);
|
||||
#if __FreeBSD_version >= 800000
|
||||
if (hw->mac.type == ixgbe_mac_82599EB)
|
||||
ifp->if_hwassist |= CSUM_SCTP;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Prepare transmit descriptors and buffers */
|
||||
if (ixgbe_setup_transmit_structures(adapter)) {
|
||||
device_printf(dev,"Could not setup transmit structures\n");
|
||||
@ -1058,10 +1056,12 @@ ixgbe_init_locked(struct adapter *adapter)
|
||||
** Determine the correct mbuf pool
|
||||
** for doing jumbo/headersplit
|
||||
*/
|
||||
if (ifp->if_mtu > ETHERMTU)
|
||||
if (adapter->max_frame_size <= 2048)
|
||||
adapter->rx_mbuf_sz = MCLBYTES;
|
||||
else if (adapter->max_frame_size <= 4096)
|
||||
adapter->rx_mbuf_sz = MJUMPAGESIZE;
|
||||
else
|
||||
adapter->rx_mbuf_sz = MCLBYTES;
|
||||
adapter->rx_mbuf_sz = MJUM9BYTES;
|
||||
|
||||
/* Prepare receive descriptors and buffers */
|
||||
if (ixgbe_setup_receive_structures(adapter)) {
|
||||
@ -1092,18 +1092,6 @@ ixgbe_init_locked(struct adapter *adapter)
|
||||
}
|
||||
IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
|
||||
|
||||
/* Set the various hardware offload abilities */
|
||||
ifp->if_hwassist = 0;
|
||||
if (ifp->if_capenable & IFCAP_TSO4)
|
||||
ifp->if_hwassist |= CSUM_TSO;
|
||||
if (ifp->if_capenable & IFCAP_TXCSUM) {
|
||||
ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP);
|
||||
#if __FreeBSD_version >= 800000
|
||||
if (hw->mac.type == ixgbe_mac_82599EB)
|
||||
ifp->if_hwassist |= CSUM_SCTP;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Set MTU size */
|
||||
if (ifp->if_mtu > ETHERMTU) {
|
||||
mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD);
|
||||
@ -1146,7 +1134,7 @@ ixgbe_init_locked(struct adapter *adapter)
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RDT(i), adapter->num_rx_desc - 1);
|
||||
}
|
||||
|
||||
/* Set up VLAN offloads and filter */
|
||||
/* Set up VLAN support and filter */
|
||||
ixgbe_setup_vlan_hw_support(adapter);
|
||||
|
||||
/* Enable Receive engine */
|
||||
@ -1760,10 +1748,6 @@ ixgbe_xmit(struct tx_ring *txr, struct mbuf **m_headp)
|
||||
++txr->total_packets;
|
||||
IXGBE_WRITE_REG(&adapter->hw, IXGBE_TDT(txr->me), i);
|
||||
|
||||
/* Do a clean if descriptors are low */
|
||||
if (txr->tx_avail <= IXGBE_TX_CLEANUP_THRESHOLD)
|
||||
ixgbe_txeof(txr);
|
||||
|
||||
return (0);
|
||||
|
||||
xmit_fail:
|
||||
@ -1775,11 +1759,13 @@ xmit_fail:
|
||||
static void
|
||||
ixgbe_set_promisc(struct adapter *adapter)
|
||||
{
|
||||
|
||||
u_int32_t reg_rctl;
|
||||
struct ifnet *ifp = adapter->ifp;
|
||||
|
||||
reg_rctl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL);
|
||||
reg_rctl &= (~IXGBE_FCTRL_UPE);
|
||||
reg_rctl &= (~IXGBE_FCTRL_MPE);
|
||||
IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, reg_rctl);
|
||||
|
||||
if (ifp->if_flags & IFF_PROMISC) {
|
||||
reg_rctl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
|
||||
@ -1792,20 +1778,6 @@ ixgbe_set_promisc(struct adapter *adapter)
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
ixgbe_disable_promisc(struct adapter * adapter)
|
||||
{
|
||||
u_int32_t reg_rctl;
|
||||
|
||||
reg_rctl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL);
|
||||
|
||||
reg_rctl &= (~IXGBE_FCTRL_UPE);
|
||||
reg_rctl &= (~IXGBE_FCTRL_MPE);
|
||||
IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, reg_rctl);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* Multicast Update
|
||||
@ -1819,7 +1791,7 @@ static void
|
||||
ixgbe_set_multi(struct adapter *adapter)
|
||||
{
|
||||
u32 fctrl;
|
||||
u8 *mta;
|
||||
u8 mta[MAX_NUM_MULTICAST_ADDRESSES * IXGBE_ETH_LENGTH_OF_ADDRESS];
|
||||
u8 *update_ptr;
|
||||
struct ifmultiaddr *ifma;
|
||||
int mcnt = 0;
|
||||
@ -1827,10 +1799,6 @@ ixgbe_set_multi(struct adapter *adapter)
|
||||
|
||||
IOCTL_DEBUGOUT("ixgbe_set_multi: begin");
|
||||
|
||||
mta = adapter->mta;
|
||||
bzero(mta, sizeof(u8) * IXGBE_ETH_LENGTH_OF_ADDRESS *
|
||||
MAX_NUM_MULTICAST_ADDRESSES);
|
||||
|
||||
fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL);
|
||||
fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
|
||||
if (ifp->if_flags & IFF_PROMISC)
|
||||
@ -1923,19 +1891,14 @@ ixgbe_local_timer(void *arg)
|
||||
*/
|
||||
if (IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & IXGBE_TFCS_TXOFF)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
** Check for time since any descriptor was cleaned
|
||||
** Check status on the TX queues for a hang
|
||||
*/
|
||||
for (int i = 0; i < adapter->num_queues; i++, txr++) {
|
||||
IXGBE_TX_LOCK(txr);
|
||||
if (txr->watchdog_check == FALSE) {
|
||||
IXGBE_TX_UNLOCK(txr);
|
||||
continue;
|
||||
}
|
||||
if ((ticks - txr->watchdog_time) > IXGBE_WATCHDOG)
|
||||
for (int i = 0; i < adapter->num_queues; i++, txr++)
|
||||
if (txr->queue_status == IXGBE_QUEUE_HUNG)
|
||||
goto hung;
|
||||
IXGBE_TX_UNLOCK(txr);
|
||||
}
|
||||
|
||||
out:
|
||||
ixgbe_rearm_queues(adapter, adapter->que_mask);
|
||||
callout_reset(&adapter->timer, hz, ixgbe_local_timer, adapter);
|
||||
@ -1985,7 +1948,7 @@ ixgbe_update_link_status(struct adapter *adapter)
|
||||
adapter->link_active = FALSE;
|
||||
for (int i = 0; i < adapter->num_queues;
|
||||
i++, txr++)
|
||||
txr->watchdog_check = FALSE;
|
||||
txr->queue_status = IXGBE_QUEUE_IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2005,6 +1968,7 @@ ixgbe_stop(void *arg)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
struct adapter *adapter = arg;
|
||||
struct ixgbe_hw *hw = &adapter->hw;
|
||||
ifp = adapter->ifp;
|
||||
|
||||
mtx_assert(&adapter->core_mtx, MA_OWNED);
|
||||
@ -2015,9 +1979,12 @@ ixgbe_stop(void *arg)
|
||||
/* Tell the stack that the interface is no longer active */
|
||||
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
|
||||
|
||||
ixgbe_reset_hw(&adapter->hw);
|
||||
adapter->hw.adapter_stopped = FALSE;
|
||||
ixgbe_stop_adapter(&adapter->hw);
|
||||
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);
|
||||
callout_stop(&adapter->timer);
|
||||
|
||||
/* reprogram the RAR[0] in case user changed it. */
|
||||
@ -2242,6 +2209,9 @@ ixgbe_setup_msix(struct adapter *adapter)
|
||||
|
||||
if (ixgbe_num_queues != 0)
|
||||
queues = ixgbe_num_queues;
|
||||
/* Set max queues to 8 */
|
||||
else if (queues > 8)
|
||||
queues = 8;
|
||||
|
||||
/*
|
||||
** Want one vector (RX/TX pair) per queue
|
||||
@ -2375,7 +2345,7 @@ mem:
|
||||
* Setup networking device structure and register an interface.
|
||||
*
|
||||
**********************************************************************/
|
||||
static int
|
||||
static void
|
||||
ixgbe_setup_interface(device_t dev, struct adapter *adapter)
|
||||
{
|
||||
struct ixgbe_hw *hw = &adapter->hw;
|
||||
@ -2384,10 +2354,8 @@ ixgbe_setup_interface(device_t dev, struct adapter *adapter)
|
||||
INIT_DEBUGOUT("ixgbe_setup_interface: begin");
|
||||
|
||||
ifp = adapter->ifp = if_alloc(IFT_ETHER);
|
||||
if (ifp == NULL) {
|
||||
device_printf(dev, "can not allocate ifnet structure\n");
|
||||
return (-1);
|
||||
}
|
||||
if (ifp == NULL)
|
||||
panic("%s: can not if_alloc()\n", device_get_nameunit(dev));
|
||||
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
|
||||
ifp->if_mtu = ETHERMTU;
|
||||
ifp->if_baudrate = 1000000000;
|
||||
@ -2414,10 +2382,22 @@ ixgbe_setup_interface(device_t dev, struct adapter *adapter)
|
||||
|
||||
ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | IFCAP_VLAN_HWCSUM;
|
||||
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU;
|
||||
ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_LRO;
|
||||
|
||||
ifp->if_capabilities |= IFCAP_JUMBO_MTU;
|
||||
ifp->if_capenable = ifp->if_capabilities;
|
||||
|
||||
/* Don't enable LRO by default */
|
||||
ifp->if_capabilities |= IFCAP_LRO;
|
||||
|
||||
/*
|
||||
** Dont turn this on by default, if vlans are
|
||||
** created on another pseudo device (eg. lagg)
|
||||
** then vlan events are not passed thru, breaking
|
||||
** operation, but with HW FILTER off it works. If
|
||||
** using vlans directly on the em driver you can
|
||||
** enable this and get full hardware tag filtering.
|
||||
*/
|
||||
ifp->if_capabilities |= IFCAP_VLAN_HWFILTER;
|
||||
|
||||
/*
|
||||
* Specify the media types supported by this adapter and register
|
||||
* callbacks to update media and link information
|
||||
@ -2435,7 +2415,7 @@ ixgbe_setup_interface(device_t dev, struct adapter *adapter)
|
||||
ifmedia_add(&adapter->media, IFM_ETHER | IFM_AUTO, 0, NULL);
|
||||
ifmedia_set(&adapter->media, IFM_ETHER | IFM_AUTO);
|
||||
|
||||
return (0);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2450,6 +2430,7 @@ ixgbe_config_link(struct adapter *adapter)
|
||||
if (sfp) {
|
||||
if (hw->phy.multispeed_fiber) {
|
||||
hw->mac.ops.setup_sfp(hw);
|
||||
ixgbe_enable_tx_laser(hw);
|
||||
taskqueue_enqueue(adapter->tq, &adapter->msf_task);
|
||||
} else
|
||||
taskqueue_enqueue(adapter->tq, &adapter->mod_task);
|
||||
@ -2856,7 +2837,7 @@ ixgbe_initialize_transmit_units(struct adapter *adapter)
|
||||
|
||||
/* Setup Transmit Descriptor Cmd Settings */
|
||||
txr->txd_cmd = IXGBE_TXD_CMD_IFCS;
|
||||
txr->watchdog_check = FALSE;
|
||||
txr->queue_status = IXGBE_QUEUE_IDLE;
|
||||
|
||||
/* Disable Head Writeback */
|
||||
switch (hw->mac.type) {
|
||||
@ -3195,7 +3176,7 @@ ixgbe_atr(struct tx_ring *txr, struct mbuf *mp)
|
||||
{
|
||||
struct adapter *adapter = txr->adapter;
|
||||
struct ix_queue *que;
|
||||
struct ixgbe_atr_input atr_input;
|
||||
union ixgbe_atr_input atr_input;
|
||||
struct ip *ip;
|
||||
struct tcphdr *th;
|
||||
struct udphdr *uh;
|
||||
@ -3239,7 +3220,7 @@ ixgbe_atr(struct tx_ring *txr, struct mbuf *mp)
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&atr_input, 0, sizeof(struct ixgbe_atr_input));
|
||||
memset(&atr_input, 0, sizeof(union ixgbe_atr_input));
|
||||
|
||||
vlan_id = htole16(mp->m_pkthdr.ether_vtag);
|
||||
src_ipv4_addr = ip->ip_src.s_addr;
|
||||
@ -3274,15 +3255,18 @@ ixgbe_txeof(struct tx_ring *txr)
|
||||
{
|
||||
struct adapter *adapter = txr->adapter;
|
||||
struct ifnet *ifp = adapter->ifp;
|
||||
u32 first, last, done;
|
||||
u32 first, last, done, processed;
|
||||
struct ixgbe_tx_buf *tx_buffer;
|
||||
struct ixgbe_legacy_tx_desc *tx_desc, *eop_desc;
|
||||
|
||||
mtx_assert(&txr->tx_mtx, MA_OWNED);
|
||||
|
||||
if (txr->tx_avail == adapter->num_tx_desc)
|
||||
if (txr->tx_avail == adapter->num_tx_desc) {
|
||||
txr->queue_status = IXGBE_QUEUE_IDLE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
processed = 0;
|
||||
first = txr->next_to_clean;
|
||||
tx_buffer = &txr->tx_buffers[first];
|
||||
/* For cleanup we just use legacy struct */
|
||||
@ -3314,6 +3298,7 @@ ixgbe_txeof(struct tx_ring *txr)
|
||||
tx_desc->lower.data = 0;
|
||||
tx_desc->buffer_addr = 0;
|
||||
++txr->tx_avail;
|
||||
++processed;
|
||||
|
||||
if (tx_buffer->m_head) {
|
||||
txr->bytes +=
|
||||
@ -3355,6 +3340,15 @@ ixgbe_txeof(struct tx_ring *txr)
|
||||
|
||||
txr->next_to_clean = first;
|
||||
|
||||
/*
|
||||
** Watchdog calculation, we know there's
|
||||
** work outstanding or the first return
|
||||
** would have been taken, so none processed
|
||||
** for too long indicates a hang.
|
||||
*/
|
||||
if ((!processed) && ((ticks - txr->watchdog_time) > IXGBE_WATCHDOG))
|
||||
txr->queue_status = IXGBE_QUEUE_HUNG;
|
||||
|
||||
/*
|
||||
* If we have enough room, clear IFF_DRV_OACTIVE to tell the stack that
|
||||
* it is OK to send packets. If there are no pending descriptors,
|
||||
@ -3364,7 +3358,7 @@ ixgbe_txeof(struct tx_ring *txr)
|
||||
if (txr->tx_avail > IXGBE_TX_CLEANUP_THRESHOLD) {
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
if (txr->tx_avail == adapter->num_tx_desc) {
|
||||
txr->watchdog_check = FALSE;
|
||||
txr->queue_status = IXGBE_QUEUE_IDLE;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -3395,51 +3389,59 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit)
|
||||
cleaned = -1; /* Signify no completions */
|
||||
while (i != limit) {
|
||||
rxbuf = &rxr->rx_buffers[i];
|
||||
if ((rxbuf->m_head == NULL) && (rxr->hdr_split)) {
|
||||
if (rxr->hdr_split == FALSE)
|
||||
goto no_split;
|
||||
|
||||
if (rxbuf->m_head == NULL) {
|
||||
mh = m_gethdr(M_DONTWAIT, MT_DATA);
|
||||
if (mh == NULL)
|
||||
goto update;
|
||||
mh->m_pkthdr.len = mh->m_len = MHLEN;
|
||||
mh->m_len = MHLEN;
|
||||
mh->m_flags |= M_PKTHDR;
|
||||
m_adj(mh, ETHER_ALIGN);
|
||||
/* Get the memory mapping */
|
||||
error = bus_dmamap_load_mbuf_sg(rxr->htag,
|
||||
rxbuf->hmap, mh, hseg, &nsegs, BUS_DMA_NOWAIT);
|
||||
if (error != 0) {
|
||||
printf("GET BUF: dmamap load"
|
||||
" failure - %d\n", error);
|
||||
m_free(mh);
|
||||
goto update;
|
||||
}
|
||||
rxbuf->m_head = mh;
|
||||
bus_dmamap_sync(rxr->htag, rxbuf->hmap,
|
||||
BUS_DMASYNC_PREREAD);
|
||||
rxr->rx_base[i].read.hdr_addr =
|
||||
htole64(hseg[0].ds_addr);
|
||||
}
|
||||
} else
|
||||
mh = rxbuf->m_head;
|
||||
|
||||
mh->m_pkthdr.len = mh->m_len = MHLEN;
|
||||
mh->m_len = MHLEN;
|
||||
mh->m_flags |= M_PKTHDR;
|
||||
/* Get the memory mapping */
|
||||
error = bus_dmamap_load_mbuf_sg(rxr->htag,
|
||||
rxbuf->hmap, mh, hseg, &nsegs, BUS_DMA_NOWAIT);
|
||||
if (error != 0) {
|
||||
printf("Refresh mbufs: hdr dmamap load"
|
||||
" failure - %d\n", error);
|
||||
m_free(mh);
|
||||
rxbuf->m_head = NULL;
|
||||
goto update;
|
||||
}
|
||||
rxbuf->m_head = mh;
|
||||
bus_dmamap_sync(rxr->htag, rxbuf->hmap,
|
||||
BUS_DMASYNC_PREREAD);
|
||||
rxr->rx_base[i].read.hdr_addr = htole64(hseg[0].ds_addr);
|
||||
|
||||
no_split:
|
||||
if (rxbuf->m_pack == NULL) {
|
||||
mp = m_getjcl(M_DONTWAIT, MT_DATA,
|
||||
M_PKTHDR, adapter->rx_mbuf_sz);
|
||||
if (mp == NULL)
|
||||
goto update;
|
||||
mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz;
|
||||
/* Get the memory mapping */
|
||||
error = bus_dmamap_load_mbuf_sg(rxr->ptag,
|
||||
rxbuf->pmap, mp, pseg, &nsegs, BUS_DMA_NOWAIT);
|
||||
if (error != 0) {
|
||||
printf("GET BUF: dmamap load"
|
||||
" failure - %d\n", error);
|
||||
m_free(mp);
|
||||
goto update;
|
||||
}
|
||||
rxbuf->m_pack = mp;
|
||||
bus_dmamap_sync(rxr->ptag, rxbuf->pmap,
|
||||
BUS_DMASYNC_PREREAD);
|
||||
rxr->rx_base[i].read.pkt_addr =
|
||||
htole64(pseg[0].ds_addr);
|
||||
} else
|
||||
mp = rxbuf->m_pack;
|
||||
|
||||
mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz;
|
||||
/* Get the memory mapping */
|
||||
error = bus_dmamap_load_mbuf_sg(rxr->ptag,
|
||||
rxbuf->pmap, mp, pseg, &nsegs, BUS_DMA_NOWAIT);
|
||||
if (error != 0) {
|
||||
printf("Refresh mbufs: payload dmamap load"
|
||||
" failure - %d\n", error);
|
||||
m_free(mp);
|
||||
rxbuf->m_pack = NULL;
|
||||
goto update;
|
||||
}
|
||||
rxbuf->m_pack = mp;
|
||||
bus_dmamap_sync(rxr->ptag, rxbuf->pmap,
|
||||
BUS_DMASYNC_PREREAD);
|
||||
rxr->rx_base[i].read.pkt_addr =
|
||||
htole64(pseg[0].ds_addr);
|
||||
|
||||
cleaned = i;
|
||||
/* Calculate next index */
|
||||
@ -3501,9 +3503,9 @@ ixgbe_allocate_receive_buffers(struct rx_ring *rxr)
|
||||
BUS_SPACE_MAXADDR, /* lowaddr */
|
||||
BUS_SPACE_MAXADDR, /* highaddr */
|
||||
NULL, NULL, /* filter, filterarg */
|
||||
MJUMPAGESIZE, /* maxsize */
|
||||
MJUM9BYTES, /* maxsize */
|
||||
1, /* nsegments */
|
||||
MJUMPAGESIZE, /* maxsegsize */
|
||||
MJUM9BYTES, /* maxsegsize */
|
||||
0, /* flags */
|
||||
NULL, /* lockfunc */
|
||||
NULL, /* lockfuncarg */
|
||||
@ -3661,7 +3663,7 @@ ixgbe_setup_receive_ring(struct rx_ring *rxr)
|
||||
|
||||
rxbuf = &rxr->rx_buffers[j];
|
||||
/*
|
||||
** Don't allocate mbufs if not
|
||||
** Dont allocate mbufs if not
|
||||
** doing header split, its wasteful
|
||||
*/
|
||||
if (rxr->hdr_split == FALSE)
|
||||
@ -4027,25 +4029,33 @@ ixgbe_rx_input(struct rx_ring *rxr, struct ifnet *ifp, struct mbuf *m, u32 ptype
|
||||
static __inline void
|
||||
ixgbe_rx_discard(struct rx_ring *rxr, int i)
|
||||
{
|
||||
struct adapter *adapter = rxr->adapter;
|
||||
struct ixgbe_rx_buf *rbuf;
|
||||
struct mbuf *mh, *mp;
|
||||
|
||||
rbuf = &rxr->rx_buffers[i];
|
||||
if (rbuf->fmp != NULL) /* Partial chain ? */
|
||||
|
||||
if (rbuf->fmp != NULL) {/* Partial chain ? */
|
||||
rbuf->fmp->m_flags |= M_PKTHDR;
|
||||
m_freem(rbuf->fmp);
|
||||
rbuf->fmp = NULL;
|
||||
}
|
||||
|
||||
mh = rbuf->m_head;
|
||||
mp = rbuf->m_pack;
|
||||
/*
|
||||
** With advanced descriptors the writeback
|
||||
** clobbers the buffer addrs, so its easier
|
||||
** to just free the existing mbufs and take
|
||||
** the normal refresh path to get new buffers
|
||||
** and mapping.
|
||||
*/
|
||||
if (rbuf->m_head) {
|
||||
m_free(rbuf->m_head);
|
||||
rbuf->m_head = NULL;
|
||||
}
|
||||
|
||||
if (rbuf->m_pack) {
|
||||
m_free(rbuf->m_pack);
|
||||
rbuf->m_pack = NULL;
|
||||
}
|
||||
|
||||
/* Reuse loaded DMA map and just update mbuf chain */
|
||||
mh->m_len = MHLEN;
|
||||
mh->m_flags |= M_PKTHDR;
|
||||
mh->m_next = NULL;
|
||||
|
||||
mp->m_len = mp->m_pkthdr.len = adapter->rx_mbuf_sz;
|
||||
mp->m_data = mp->m_ext.ext_buf;
|
||||
mp->m_next = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4110,15 +4120,15 @@ ixgbe_rxeof(struct ix_queue *que, int count)
|
||||
vtag = le16toh(cur->wb.upper.vlan);
|
||||
eop = ((staterr & IXGBE_RXD_STAT_EOP) != 0);
|
||||
|
||||
/* Make sure all parts of a bad packet are discarded */
|
||||
/* Make sure bad packets are discarded */
|
||||
if (((staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) ||
|
||||
(rxr->discard)) {
|
||||
ifp->if_ierrors++;
|
||||
rxr->rx_discarded++;
|
||||
if (!eop)
|
||||
rxr->discard = TRUE;
|
||||
else
|
||||
if (eop)
|
||||
rxr->discard = FALSE;
|
||||
else
|
||||
rxr->discard = TRUE;
|
||||
ixgbe_rx_discard(rxr, i);
|
||||
goto next_desc;
|
||||
}
|
||||
@ -4129,7 +4139,7 @@ ixgbe_rxeof(struct ix_queue *que, int count)
|
||||
** not be fragmented across sequential
|
||||
** descriptors, rather the next descriptor
|
||||
** is indicated in bits of the descriptor.
|
||||
** This also means that we might process
|
||||
** This also means that we might proceses
|
||||
** more than one packet at a time, something
|
||||
** that has never been true before, it
|
||||
** required eliminating global chain pointers
|
||||
@ -4210,7 +4220,8 @@ ixgbe_rxeof(struct ix_queue *que, int count)
|
||||
} else {
|
||||
/* Singlet, prepare to send */
|
||||
sendmp = mh;
|
||||
if (staterr & IXGBE_RXD_STAT_VP) {
|
||||
if ((adapter->num_vlans) &&
|
||||
(staterr & IXGBE_RXD_STAT_VP)) {
|
||||
sendmp->m_pkthdr.ether_vtag = vtag;
|
||||
sendmp->m_flags |= M_VLANTAG;
|
||||
}
|
||||
@ -4376,12 +4387,13 @@ ixgbe_register_vlan(void *arg, struct ifnet *ifp, u16 vtag)
|
||||
if ((vtag == 0) || (vtag > 4095)) /* Invalid */
|
||||
return;
|
||||
|
||||
IXGBE_CORE_LOCK(adapter);
|
||||
index = (vtag >> 5) & 0x7F;
|
||||
bit = vtag & 0x1F;
|
||||
ixgbe_shadow_vfta[index] |= (1 << bit);
|
||||
adapter->shadow_vfta[index] |= (1 << bit);
|
||||
++adapter->num_vlans;
|
||||
/* Re-init to load the changes */
|
||||
ixgbe_init(adapter);
|
||||
ixgbe_init_locked(adapter);
|
||||
IXGBE_CORE_UNLOCK(adapter);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4401,17 +4413,20 @@ ixgbe_unregister_vlan(void *arg, struct ifnet *ifp, u16 vtag)
|
||||
if ((vtag == 0) || (vtag > 4095)) /* Invalid */
|
||||
return;
|
||||
|
||||
IXGBE_CORE_LOCK(adapter);
|
||||
index = (vtag >> 5) & 0x7F;
|
||||
bit = vtag & 0x1F;
|
||||
ixgbe_shadow_vfta[index] &= ~(1 << bit);
|
||||
adapter->shadow_vfta[index] &= ~(1 << bit);
|
||||
--adapter->num_vlans;
|
||||
/* Re-init to load the changes */
|
||||
ixgbe_init(adapter);
|
||||
ixgbe_init_locked(adapter);
|
||||
IXGBE_CORE_UNLOCK(adapter);
|
||||
}
|
||||
|
||||
static void
|
||||
ixgbe_setup_vlan_hw_support(struct adapter *adapter)
|
||||
{
|
||||
struct ifnet *ifp = adapter->ifp;
|
||||
struct ixgbe_hw *hw = &adapter->hw;
|
||||
u32 ctrl;
|
||||
|
||||
@ -4430,14 +4445,16 @@ ixgbe_setup_vlan_hw_support(struct adapter *adapter)
|
||||
** we need to repopulate it now.
|
||||
*/
|
||||
for (int i = 0; i < IXGBE_VFTA_SIZE; i++)
|
||||
if (ixgbe_shadow_vfta[i] != 0)
|
||||
if (adapter->shadow_vfta[i] != 0)
|
||||
IXGBE_WRITE_REG(hw, IXGBE_VFTA(i),
|
||||
ixgbe_shadow_vfta[i]);
|
||||
adapter->shadow_vfta[i]);
|
||||
|
||||
/* Enable the Filter Table */
|
||||
ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
|
||||
ctrl &= ~IXGBE_VLNCTRL_CFIEN;
|
||||
ctrl |= IXGBE_VLNCTRL_VFE;
|
||||
/* Enable the Filter Table if enabled */
|
||||
if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) {
|
||||
ctrl &= ~IXGBE_VLNCTRL_CFIEN;
|
||||
ctrl |= IXGBE_VLNCTRL_VFE;
|
||||
}
|
||||
if (hw->mac.type == ixgbe_mac_82598EB)
|
||||
ctrl |= IXGBE_VLNCTRL_VME;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl);
|
||||
@ -4478,14 +4495,14 @@ ixgbe_enable_intr(struct adapter *adapter)
|
||||
/* With RSS we use auto clear */
|
||||
if (adapter->msix_mem) {
|
||||
mask = IXGBE_EIMS_ENABLE_MASK;
|
||||
/* Don't autoclear Link */
|
||||
/* Dont autoclear Link */
|
||||
mask &= ~IXGBE_EIMS_OTHER;
|
||||
mask &= ~IXGBE_EIMS_LSC;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_EIAC, mask);
|
||||
}
|
||||
|
||||
/*
|
||||
** Now enable all queues, this is done separately to
|
||||
** Now enable all queues, this is done seperately to
|
||||
** allow for handling the extended (beyond 32) MSIX
|
||||
** vectors that can be used by 82599
|
||||
*/
|
||||
|
@ -179,6 +179,9 @@
|
||||
#define IXGBE_RX_HDR 128
|
||||
#define IXGBE_VFTA_SIZE 128
|
||||
#define IXGBE_BR_SIZE 4096
|
||||
#define IXGBE_QUEUE_IDLE 0
|
||||
#define IXGBE_QUEUE_WORKING 1
|
||||
#define IXGBE_QUEUE_HUNG 2
|
||||
|
||||
/* Offload bits in mbuf flag */
|
||||
#if __FreeBSD_version >= 800000
|
||||
@ -205,11 +208,6 @@
|
||||
#define IXGBE_BULK_LATENCY 1200
|
||||
#define IXGBE_LINK_ITR 2000
|
||||
|
||||
/* Header split args for get_bug */
|
||||
#define IXGBE_CLEAN_HDR 1
|
||||
#define IXGBE_CLEAN_PKT 2
|
||||
#define IXGBE_CLEAN_ALL 3
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
* vendor_info_array
|
||||
@ -280,7 +278,7 @@ struct tx_ring {
|
||||
struct adapter *adapter;
|
||||
struct mtx tx_mtx;
|
||||
u32 me;
|
||||
bool watchdog_check;
|
||||
int queue_status;
|
||||
int watchdog_time;
|
||||
union ixgbe_adv_tx_desc *tx_base;
|
||||
struct ixgbe_dma_alloc txdma;
|
||||
@ -374,7 +372,15 @@ struct adapter {
|
||||
u16 num_vlans;
|
||||
u16 num_queues;
|
||||
|
||||
/* Info about the board itself */
|
||||
/*
|
||||
** Shadow VFTA table, this is needed because
|
||||
** the real vlan filter table gets cleared during
|
||||
** a soft reset and the driver needs to be able
|
||||
** to repopulate it.
|
||||
*/
|
||||
u32 shadow_vfta[IXGBE_VFTA_SIZE];
|
||||
|
||||
/* Info about the interface */
|
||||
u32 optics;
|
||||
int advertise; /* link speeds */
|
||||
bool link_active;
|
||||
@ -421,8 +427,6 @@ struct adapter {
|
||||
u64 que_mask;
|
||||
u32 rx_process_limit;
|
||||
|
||||
/* Multicast array memory */
|
||||
u8 *mta;
|
||||
/* Misc stats maintained by the driver */
|
||||
unsigned long dropped_pkts;
|
||||
unsigned long mbuf_defrag_failed;
|
||||
|
@ -73,7 +73,6 @@ u32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw);
|
||||
void ixgbe_set_lan_id_multi_port_pcie_82598(struct ixgbe_hw *hw);
|
||||
void ixgbe_set_pcie_completion_timeout(struct ixgbe_hw *hw);
|
||||
static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw);
|
||||
|
||||
/**
|
||||
* ixgbe_set_pcie_completion_timeout - set pci-e completion timeout
|
||||
@ -186,6 +185,7 @@ s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw)
|
||||
mac->mcft_size = 128;
|
||||
mac->vft_size = 128;
|
||||
mac->num_rar_entries = 16;
|
||||
mac->rx_pb_size = 512;
|
||||
mac->max_tx_queues = 32;
|
||||
mac->max_rx_queues = 64;
|
||||
mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82598(hw);
|
||||
@ -196,6 +196,7 @@ s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw)
|
||||
/* Link */
|
||||
mac->ops.check_link = &ixgbe_check_mac_link_82598;
|
||||
mac->ops.setup_link = &ixgbe_setup_mac_link_82598;
|
||||
mac->ops.flap_tx_laser = NULL;
|
||||
mac->ops.get_link_capabilities =
|
||||
&ixgbe_get_link_capabilities_82598;
|
||||
|
||||
@ -385,11 +386,14 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
|
||||
DEBUGFUNC("ixgbe_get_media_type_82598");
|
||||
|
||||
/* Detect if there is a copper PHY attached. */
|
||||
if (hw->phy.type == ixgbe_phy_cu_unknown ||
|
||||
hw->phy.type == ixgbe_phy_tn ||
|
||||
hw->phy.type == ixgbe_phy_aq) {
|
||||
switch (hw->phy.type) {
|
||||
case ixgbe_phy_cu_unknown:
|
||||
case ixgbe_phy_tn:
|
||||
case ixgbe_phy_aq:
|
||||
media_type = ixgbe_media_type_copper;
|
||||
goto out;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Media type for I82598 is based on device ID */
|
||||
@ -436,6 +440,7 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
|
||||
u32 fctrl_reg;
|
||||
u32 rmcs_reg;
|
||||
u32 reg;
|
||||
u32 rx_pba_size;
|
||||
u32 link_speed = 0;
|
||||
bool link_up;
|
||||
|
||||
@ -463,7 +468,7 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
|
||||
|
||||
/* Negotiate the fc mode to use */
|
||||
ret_val = ixgbe_fc_autoneg(hw);
|
||||
if (ret_val)
|
||||
if (ret_val == IXGBE_ERR_FLOW_CONTROL)
|
||||
goto out;
|
||||
|
||||
/* Disable any previous flow control settings */
|
||||
@ -485,7 +490,8 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
|
||||
*/
|
||||
switch (hw->fc.current_mode) {
|
||||
case ixgbe_fc_none:
|
||||
/* Flow control is disabled by software override or autoneg.
|
||||
/*
|
||||
* Flow control is disabled by software override or autoneg.
|
||||
* The code below will actually disable it in the HW.
|
||||
*/
|
||||
break;
|
||||
@ -526,16 +532,19 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
|
||||
|
||||
/* Set up and enable Rx high/low water mark thresholds, enable XON. */
|
||||
if (hw->fc.current_mode & ixgbe_fc_tx_pause) {
|
||||
if (hw->fc.send_xon) {
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num),
|
||||
(hw->fc.low_water | IXGBE_FCRTL_XONE));
|
||||
} else {
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num),
|
||||
hw->fc.low_water);
|
||||
}
|
||||
rx_pba_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(packetbuf_num));
|
||||
rx_pba_size >>= IXGBE_RXPBSIZE_SHIFT;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num),
|
||||
(hw->fc.high_water | IXGBE_FCRTH_FCEN));
|
||||
reg = (rx_pba_size - hw->fc.low_water) << 6;
|
||||
if (hw->fc.send_xon)
|
||||
reg |= IXGBE_FCRTL_XONE;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num), reg);
|
||||
|
||||
reg = (rx_pba_size - hw->fc.high_water) << 6;
|
||||
reg |= IXGBE_FCRTH_FCEN;
|
||||
|
||||
IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num), reg);
|
||||
}
|
||||
|
||||
/* Configure pause time (2 TCs per register) */
|
||||
@ -560,7 +569,7 @@ out:
|
||||
* Restarts the link. Performs autonegotiation if needed.
|
||||
**/
|
||||
static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw,
|
||||
bool autoneg_wait_to_complete)
|
||||
bool autoneg_wait_to_complete)
|
||||
{
|
||||
u32 autoc_reg;
|
||||
u32 links_reg;
|
||||
@ -600,6 +609,41 @@ static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw,
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_validate_link_ready - Function looks for phy link
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Function indicates success when phy link is available. If phy is not ready
|
||||
* within 5 seconds of MAC indicating link, the function returns error.
|
||||
**/
|
||||
static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw)
|
||||
{
|
||||
u32 timeout;
|
||||
u16 an_reg;
|
||||
|
||||
if (hw->device_id != IXGBE_DEV_ID_82598AT2)
|
||||
return IXGBE_SUCCESS;
|
||||
|
||||
for (timeout = 0;
|
||||
timeout < IXGBE_VALIDATE_LINK_READY_TIMEOUT; timeout++) {
|
||||
hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_STATUS,
|
||||
IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &an_reg);
|
||||
|
||||
if ((an_reg & IXGBE_MII_AUTONEG_COMPLETE) &&
|
||||
(an_reg & IXGBE_MII_AUTONEG_LINK_UP))
|
||||
break;
|
||||
|
||||
msec_delay(100);
|
||||
}
|
||||
|
||||
if (timeout == IXGBE_VALIDATE_LINK_READY_TIMEOUT) {
|
||||
DEBUGOUT("Link was indicated but link is down\n");
|
||||
return IXGBE_ERR_LINK_SETUP;
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_mac_link_82598 - Get link/speed status
|
||||
* @hw: pointer to hardware structure
|
||||
@ -648,8 +692,7 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
|
||||
&adapt_comp_reg);
|
||||
}
|
||||
} else {
|
||||
if ((link_reg & 1) &&
|
||||
((adapt_comp_reg & 1) == 0))
|
||||
if ((link_reg & 1) && ((adapt_comp_reg & 1) == 0))
|
||||
*link_up = TRUE;
|
||||
else
|
||||
*link_up = FALSE;
|
||||
@ -684,7 +727,7 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
|
||||
*speed = IXGBE_LINK_SPEED_1GB_FULL;
|
||||
|
||||
if ((hw->device_id == IXGBE_DEV_ID_82598AT2) && (*link_up == TRUE) &&
|
||||
(ixgbe_validate_link_ready(hw) != IXGBE_SUCCESS))
|
||||
(ixgbe_validate_link_ready(hw) != IXGBE_SUCCESS))
|
||||
*link_up = FALSE;
|
||||
|
||||
/* if link is down, zero out the current_mode */
|
||||
@ -692,7 +735,6 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
|
||||
hw->fc.current_mode = ixgbe_fc_none;
|
||||
hw->fc.fc_was_autonegged = FALSE;
|
||||
}
|
||||
|
||||
out:
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
@ -904,8 +946,9 @@ mac_reset_top:
|
||||
if (hw->mac.orig_link_settings_stored == FALSE) {
|
||||
hw->mac.orig_autoc = autoc;
|
||||
hw->mac.orig_link_settings_stored = TRUE;
|
||||
} else if (autoc != hw->mac.orig_autoc)
|
||||
} else if (autoc != hw->mac.orig_autoc) {
|
||||
IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc);
|
||||
}
|
||||
|
||||
/* Store the permanent mac address */
|
||||
hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
|
||||
@ -916,11 +959,10 @@ mac_reset_top:
|
||||
*/
|
||||
hw->mac.ops.init_rx_addrs(hw);
|
||||
|
||||
|
||||
|
||||
reset_hw_out:
|
||||
if (phy_status != IXGBE_SUCCESS)
|
||||
status = phy_status;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -933,9 +975,16 @@ reset_hw_out:
|
||||
s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
|
||||
{
|
||||
u32 rar_high;
|
||||
u32 rar_entries = hw->mac.num_rar_entries;
|
||||
|
||||
DEBUGFUNC("ixgbe_set_vmdq_82598");
|
||||
|
||||
/* Make sure we are using a valid rar index range */
|
||||
if (rar >= rar_entries) {
|
||||
DEBUGOUT1("RAR index %d is out of range.\n", rar);
|
||||
return IXGBE_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar));
|
||||
rar_high &= ~IXGBE_RAH_VIND_MASK;
|
||||
rar_high |= ((vmdq << IXGBE_RAH_VIND_SHIFT) & IXGBE_RAH_VIND_MASK);
|
||||
@ -956,14 +1005,16 @@ static s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
|
||||
|
||||
UNREFERENCED_PARAMETER(vmdq);
|
||||
|
||||
if (rar < rar_entries) {
|
||||
rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar));
|
||||
if (rar_high & IXGBE_RAH_VIND_MASK) {
|
||||
rar_high &= ~IXGBE_RAH_VIND_MASK;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RAH(rar), rar_high);
|
||||
}
|
||||
} else {
|
||||
/* Make sure we are using a valid rar index range */
|
||||
if (rar >= rar_entries) {
|
||||
DEBUGOUT1("RAR index %d is out of range.\n", rar);
|
||||
return IXGBE_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(rar));
|
||||
if (rar_high & IXGBE_RAH_VIND_MASK) {
|
||||
rar_high &= ~IXGBE_RAH_VIND_MASK;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_RAH(rar), rar_high);
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
@ -1173,8 +1224,10 @@ u32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw)
|
||||
|
||||
/* Copper PHY must be checked before AUTOC LMS to determine correct
|
||||
* physical layer because 10GBase-T PHYs use LMS = KX4/KX */
|
||||
if (hw->phy.type == ixgbe_phy_tn ||
|
||||
hw->phy.type == ixgbe_phy_cu_unknown) {
|
||||
switch (hw->phy.type) {
|
||||
case ixgbe_phy_tn:
|
||||
case ixgbe_phy_aq:
|
||||
case ixgbe_phy_cu_unknown:
|
||||
hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_EXT_ABILITY,
|
||||
IXGBE_MDIO_PMA_PMD_DEV_TYPE, &ext_ability);
|
||||
if (ext_ability & IXGBE_MDIO_PHY_10GBASET_ABILITY)
|
||||
@ -1184,6 +1237,8 @@ u32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw)
|
||||
if (ext_ability & IXGBE_MDIO_PHY_100BASETX_ABILITY)
|
||||
physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX;
|
||||
goto out;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (autoc & IXGBE_AUTOC_LMS_MASK) {
|
||||
@ -1263,7 +1318,8 @@ out:
|
||||
void ixgbe_set_lan_id_multi_port_pcie_82598(struct ixgbe_hw *hw)
|
||||
{
|
||||
struct ixgbe_bus_info *bus = &hw->bus;
|
||||
u16 pci_gen, pci_ctrl2;
|
||||
u16 pci_gen = 0;
|
||||
u16 pci_ctrl2 = 0;
|
||||
|
||||
DEBUGFUNC("ixgbe_set_lan_id_multi_port_pcie_82598");
|
||||
|
||||
@ -1285,41 +1341,6 @@ void ixgbe_set_lan_id_multi_port_pcie_82598(struct ixgbe_hw *hw)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_validate_link_ready - Function looks for phy link
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Function indicates success when phy link is available. If phy is not ready
|
||||
* within 5 seconds of MAC indicating link, the function returns error.
|
||||
**/
|
||||
static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw)
|
||||
{
|
||||
u32 timeout;
|
||||
u16 an_reg;
|
||||
|
||||
if (hw->device_id != IXGBE_DEV_ID_82598AT2)
|
||||
return IXGBE_SUCCESS;
|
||||
|
||||
for (timeout = 0;
|
||||
timeout < IXGBE_VALIDATE_LINK_READY_TIMEOUT; timeout++) {
|
||||
hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_STATUS,
|
||||
IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &an_reg);
|
||||
|
||||
if ((an_reg & IXGBE_MII_AUTONEG_COMPLETE) &&
|
||||
(an_reg & IXGBE_MII_AUTONEG_LINK_UP))
|
||||
break;
|
||||
|
||||
msec_delay(100);
|
||||
}
|
||||
|
||||
if (timeout == IXGBE_VALIDATE_LINK_READY_TIMEOUT) {
|
||||
DEBUGOUT("Link was indicated but link is down\n");
|
||||
return IXGBE_ERR_LINK_SETUP;
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_enable_relaxed_ordering_82598 - enable relaxed ordering
|
||||
* @hw: pointer to hardware structure
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -37,6 +37,7 @@
|
||||
|
||||
extern s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw);
|
||||
extern s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw);
|
||||
extern s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);
|
||||
|
||||
/**
|
||||
* ixgbe_init_shared_code - Initialize the shared code
|
||||
@ -68,6 +69,9 @@ s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
|
||||
case ixgbe_mac_82599EB:
|
||||
status = ixgbe_init_ops_82599(hw);
|
||||
break;
|
||||
case ixgbe_mac_82599_vf:
|
||||
status = ixgbe_init_ops_vf(hw);
|
||||
break;
|
||||
default:
|
||||
status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
|
||||
break;
|
||||
@ -110,10 +114,15 @@ s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
|
||||
case IXGBE_DEV_ID_82599_XAUI_LOM:
|
||||
case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
|
||||
case IXGBE_DEV_ID_82599_SFP:
|
||||
case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
|
||||
case IXGBE_DEV_ID_82599_SFP_FCOE:
|
||||
case IXGBE_DEV_ID_82599_CX4:
|
||||
case IXGBE_DEV_ID_82599_T3_LOM:
|
||||
hw->mac.type = ixgbe_mac_82599EB;
|
||||
break;
|
||||
case IXGBE_DEV_ID_82599_VF:
|
||||
hw->mac.type = ixgbe_mac_82599_vf;
|
||||
break;
|
||||
default:
|
||||
ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
|
||||
break;
|
||||
@ -280,6 +289,20 @@ s32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
|
||||
IXGBE_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_get_fcoe_boot_status - Get FCOE boot status from EEPROM
|
||||
* @hw: pointer to hardware structure
|
||||
* @bs: the fcoe boot status
|
||||
*
|
||||
* This function will read the FCOE boot status from the iSCSI FCOE block
|
||||
**/
|
||||
s32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs)
|
||||
{
|
||||
return ixgbe_call_func(hw, hw->mac.ops.get_fcoe_boot_status,
|
||||
(hw, bs),
|
||||
IXGBE_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_get_bus_info - Set PCI bus info
|
||||
* @hw: pointer to hardware structure
|
||||
@ -329,6 +352,32 @@ s32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
|
||||
IXGBE_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_read_pba_string - Reads part number string from EEPROM
|
||||
* @hw: pointer to hardware structure
|
||||
* @pba_num: stores the part number string from the EEPROM
|
||||
* @pba_num_size: part number string buffer length
|
||||
*
|
||||
* Reads the part number string from the EEPROM.
|
||||
**/
|
||||
s32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size)
|
||||
{
|
||||
return ixgbe_read_pba_string_generic(hw, pba_num, pba_num_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_read_pba_length - Reads part number string length from EEPROM
|
||||
* @hw: pointer to hardware structure
|
||||
* @pba_num_size: part number string buffer length
|
||||
*
|
||||
* Reads the part number length from the EEPROM.
|
||||
* Returns expected buffer size in pba_num_size.
|
||||
**/
|
||||
s32 ixgbe_read_pba_length(struct ixgbe_hw *hw, u32 *pba_num_size)
|
||||
{
|
||||
return ixgbe_read_pba_length_generic(hw, pba_num_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_read_pba_num - Reads part number from EEPROM
|
||||
* @hw: pointer to hardware structure
|
||||
@ -352,9 +401,7 @@ s32 ixgbe_identify_phy(struct ixgbe_hw *hw)
|
||||
s32 status = IXGBE_SUCCESS;
|
||||
|
||||
if (hw->phy.type == ixgbe_phy_unknown) {
|
||||
status = ixgbe_call_func(hw,
|
||||
hw->phy.ops.identify,
|
||||
(hw),
|
||||
status = ixgbe_call_func(hw, hw->phy.ops.identify, (hw),
|
||||
IXGBE_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
@ -489,6 +536,44 @@ s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
|
||||
IXGBE_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_disable_tx_laser - Disable Tx laser
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* If the driver needs to disable the laser on SFI optics.
|
||||
**/
|
||||
void ixgbe_disable_tx_laser(struct ixgbe_hw *hw)
|
||||
{
|
||||
if (hw->mac.ops.disable_tx_laser)
|
||||
hw->mac.ops.disable_tx_laser(hw);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_enable_tx_laser - Enable Tx laser
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* If the driver needs to enable the laser on SFI optics.
|
||||
**/
|
||||
void ixgbe_enable_tx_laser(struct ixgbe_hw *hw)
|
||||
{
|
||||
if (hw->mac.ops.enable_tx_laser)
|
||||
hw->mac.ops.enable_tx_laser(hw);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_flap_tx_laser - flap Tx laser to start autotry process
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* When the driver changes the link speeds that it can support then
|
||||
* flap the tx laser to alert the link partner to start autotry
|
||||
* process on its end.
|
||||
**/
|
||||
void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
|
||||
{
|
||||
if (hw->mac.ops.flap_tx_laser)
|
||||
hw->mac.ops.flap_tx_laser(hw);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_setup_link - Set link speed
|
||||
* @hw: pointer to hardware structure
|
||||
|
@ -52,6 +52,8 @@ u32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw);
|
||||
u32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_stop_adapter(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num);
|
||||
s32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size);
|
||||
s32 ixgbe_read_pba_length(struct ixgbe_hw *hw, u32 *pba_num_size);
|
||||
|
||||
s32 ixgbe_identify_phy(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_reset_phy(struct ixgbe_hw *hw);
|
||||
@ -68,6 +70,9 @@ s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw,
|
||||
ixgbe_link_speed speed,
|
||||
bool autoneg,
|
||||
bool autoneg_wait_to_complete);
|
||||
void ixgbe_disable_tx_laser(struct ixgbe_hw *hw);
|
||||
void ixgbe_enable_tx_laser(struct ixgbe_hw *hw);
|
||||
void ixgbe_flap_tx_laser(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
|
||||
bool autoneg, bool autoneg_wait_to_complete);
|
||||
s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
|
||||
@ -119,43 +124,43 @@ s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 pballoc);
|
||||
s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 pballoc);
|
||||
s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
|
||||
struct ixgbe_atr_input *input,
|
||||
union ixgbe_atr_input *input,
|
||||
u8 queue);
|
||||
s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_hw *hw,
|
||||
struct ixgbe_atr_input *input,
|
||||
union ixgbe_atr_input *input,
|
||||
struct ixgbe_atr_input_masks *masks,
|
||||
u16 soft_id,
|
||||
u8 queue);
|
||||
u16 ixgbe_atr_compute_hash_82599(struct ixgbe_atr_input *input, u32 key);
|
||||
s32 ixgbe_atr_set_vlan_id_82599(struct ixgbe_atr_input *input, u16 vlan_id);
|
||||
s32 ixgbe_atr_set_src_ipv4_82599(struct ixgbe_atr_input *input, u32 src_addr);
|
||||
s32 ixgbe_atr_set_dst_ipv4_82599(struct ixgbe_atr_input *input, u32 dst_addr);
|
||||
s32 ixgbe_atr_set_src_ipv6_82599(struct ixgbe_atr_input *input, u32 src_addr_1,
|
||||
u32 src_addr_2, u32 src_addr_3,
|
||||
u32 src_addr_4);
|
||||
s32 ixgbe_atr_set_dst_ipv6_82599(struct ixgbe_atr_input *input, u32 dst_addr_1,
|
||||
u32 dst_addr_2, u32 dst_addr_3,
|
||||
u32 dst_addr_4);
|
||||
s32 ixgbe_atr_set_src_port_82599(struct ixgbe_atr_input *input, u16 src_port);
|
||||
s32 ixgbe_atr_set_dst_port_82599(struct ixgbe_atr_input *input, u16 dst_port);
|
||||
s32 ixgbe_atr_set_flex_byte_82599(struct ixgbe_atr_input *input, u16 flex_byte);
|
||||
s32 ixgbe_atr_set_vm_pool_82599(struct ixgbe_atr_input *input, u8 vm_pool);
|
||||
s32 ixgbe_atr_set_l4type_82599(struct ixgbe_atr_input *input, u8 l4type);
|
||||
s32 ixgbe_atr_get_vlan_id_82599(struct ixgbe_atr_input *input, u16 *vlan_id);
|
||||
s32 ixgbe_atr_get_src_ipv4_82599(struct ixgbe_atr_input *input, u32 *src_addr);
|
||||
s32 ixgbe_atr_get_dst_ipv4_82599(struct ixgbe_atr_input *input, u32 *dst_addr);
|
||||
s32 ixgbe_atr_get_src_ipv6_82599(struct ixgbe_atr_input *input, u32 *src_addr_1,
|
||||
u32 *src_addr_2, u32 *src_addr_3,
|
||||
u32 *src_addr_4);
|
||||
s32 ixgbe_atr_get_dst_ipv6_82599(struct ixgbe_atr_input *input, u32 *dst_addr_1,
|
||||
u32 *dst_addr_2, u32 *dst_addr_3,
|
||||
u32 *dst_addr_4);
|
||||
s32 ixgbe_atr_get_src_port_82599(struct ixgbe_atr_input *input, u16 *src_port);
|
||||
s32 ixgbe_atr_get_dst_port_82599(struct ixgbe_atr_input *input, u16 *dst_port);
|
||||
s32 ixgbe_atr_get_flex_byte_82599(struct ixgbe_atr_input *input,
|
||||
u16 *flex_byte);
|
||||
s32 ixgbe_atr_get_vm_pool_82599(struct ixgbe_atr_input *input, u8 *vm_pool);
|
||||
s32 ixgbe_atr_get_l4type_82599(struct ixgbe_atr_input *input, u8 *l4type);
|
||||
u16 ixgbe_atr_compute_hash_82599(union ixgbe_atr_input *input, u32 key);
|
||||
s32 ixgbe_atr_set_vlan_id_82599(union ixgbe_atr_input *input, __be16 vlan_id);
|
||||
s32 ixgbe_atr_set_src_ipv4_82599(union ixgbe_atr_input *input, __be32 src_addr);
|
||||
s32 ixgbe_atr_set_dst_ipv4_82599(union ixgbe_atr_input *input, __be32 dst_addr);
|
||||
s32 ixgbe_atr_set_src_ipv6_82599(union ixgbe_atr_input *input, __be32 src_addr_0,
|
||||
__be32 src_addr_1, __be32 src_addr_2,
|
||||
__be32 src_addr_3);
|
||||
s32 ixgbe_atr_set_dst_ipv6_82599(union ixgbe_atr_input *input, __be32 dst_addr_0,
|
||||
__be32 dst_addr_1, __be32 dst_addr_2,
|
||||
__be32 dst_addr_3);
|
||||
s32 ixgbe_atr_set_src_port_82599(union ixgbe_atr_input *input, __be16 src_port);
|
||||
s32 ixgbe_atr_set_dst_port_82599(union ixgbe_atr_input *input, __be16 dst_port);
|
||||
s32 ixgbe_atr_set_flex_byte_82599(union ixgbe_atr_input *input, __be16 flex_byte);
|
||||
s32 ixgbe_atr_set_vm_pool_82599(union ixgbe_atr_input *input, u8 vm_pool);
|
||||
s32 ixgbe_atr_set_l4type_82599(union ixgbe_atr_input *input, u8 l4type);
|
||||
s32 ixgbe_atr_get_vlan_id_82599(union ixgbe_atr_input *input, __be16 *vlan_id);
|
||||
s32 ixgbe_atr_get_src_ipv4_82599(union ixgbe_atr_input *input, __be32 *src_addr);
|
||||
s32 ixgbe_atr_get_dst_ipv4_82599(union ixgbe_atr_input *input, __be32 *dst_addr);
|
||||
s32 ixgbe_atr_get_src_ipv6_82599(union ixgbe_atr_input *input, __be32 *src_addr_0,
|
||||
__be32 *src_addr_1, __be32 *src_addr_2,
|
||||
__be32 *src_addr_3);
|
||||
s32 ixgbe_atr_get_dst_ipv6_82599(union ixgbe_atr_input *input, __be32 *dst_addr_0,
|
||||
__be32 *dst_addr_1, __be32 *dst_addr_2,
|
||||
__be32 *dst_addr_3);
|
||||
s32 ixgbe_atr_get_src_port_82599(union ixgbe_atr_input *input, __be16 *src_port);
|
||||
s32 ixgbe_atr_get_dst_port_82599(union ixgbe_atr_input *input, __be16 *dst_port);
|
||||
s32 ixgbe_atr_get_flex_byte_82599(union ixgbe_atr_input *input,
|
||||
__be16 *flex_byte);
|
||||
s32 ixgbe_atr_get_vm_pool_82599(union ixgbe_atr_input *input, u8 *vm_pool);
|
||||
s32 ixgbe_atr_get_l4type_82599(union ixgbe_atr_input *input, u8 *l4type);
|
||||
s32 ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
|
||||
u8 *data);
|
||||
s32 ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
|
||||
@ -168,6 +173,7 @@ s32 ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u16 mask);
|
||||
void ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u16 mask);
|
||||
s32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
|
||||
u16 *wwpn_prefix);
|
||||
s32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs);
|
||||
|
||||
|
||||
#endif /* _IXGBE_API_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2009, Intel Corporation
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -47,8 +47,12 @@ u32 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);
|
||||
s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_start_hw_gen2(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_read_pba_num_generic(struct ixgbe_hw *hw, u32 *pba_num);
|
||||
s32 ixgbe_read_pba_string_generic(struct ixgbe_hw *hw, u8 *pba_num,
|
||||
u32 pba_num_size);
|
||||
s32 ixgbe_read_pba_length_generic(struct ixgbe_hw *hw, u32 *pba_num_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_lan_id_multi_port_pcie(struct ixgbe_hw *hw);
|
||||
@ -60,6 +64,7 @@ s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index);
|
||||
s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data);
|
||||
s32 ixgbe_read_eerd_generic(struct ixgbe_hw *hw, u16 offset, u16 *data);
|
||||
s32 ixgbe_write_eewr_generic(struct ixgbe_hw *hw, u16 offset, u16 data);
|
||||
s32 ixgbe_read_eeprom_bit_bang_generic(struct ixgbe_hw *hw, u16 offset,
|
||||
u16 *data);
|
||||
u16 ixgbe_calc_eeprom_checksum_generic(struct ixgbe_hw *hw);
|
||||
@ -111,4 +116,7 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw,
|
||||
s32 ixgbe_get_wwn_prefix_generic(struct ixgbe_hw *hw, u16 *wwnn_prefix,
|
||||
u16 *wwpn_prefix);
|
||||
|
||||
s32 ixgbe_get_fcoe_boot_status_generic(struct ixgbe_hw *hw, u16 *bs);
|
||||
void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int pf);
|
||||
void ixgbe_set_vlan_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf);
|
||||
#endif /* IXGBE_COMMON */
|
||||
|
743
sys/dev/ixgbe/ixgbe_mbx.c
Normal file
743
sys/dev/ixgbe/ixgbe_mbx.c
Normal file
@ -0,0 +1,743 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, 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_mbx.h"
|
||||
|
||||
/**
|
||||
* ixgbe_read_mbx - Reads a message from the mailbox
|
||||
* @hw: pointer to the HW structure
|
||||
* @msg: The message buffer
|
||||
* @size: Length of buffer
|
||||
* @mbx_id: id of mailbox to read
|
||||
*
|
||||
* returns SUCCESS if it successfuly read message from buffer
|
||||
**/
|
||||
s32 ixgbe_read_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
DEBUGFUNC("ixgbe_read_mbx");
|
||||
|
||||
/* limit read to size of mailbox */
|
||||
if (size > mbx->size)
|
||||
size = mbx->size;
|
||||
|
||||
if (mbx->ops.read)
|
||||
ret_val = mbx->ops.read(hw, msg, size, mbx_id);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_write_mbx - Write a message to the mailbox
|
||||
* @hw: pointer to the HW structure
|
||||
* @msg: The message buffer
|
||||
* @size: Length of buffer
|
||||
* @mbx_id: id of mailbox to write
|
||||
*
|
||||
* returns SUCCESS if it successfully copied message into the buffer
|
||||
**/
|
||||
s32 ixgbe_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
s32 ret_val = IXGBE_SUCCESS;
|
||||
|
||||
DEBUGFUNC("ixgbe_write_mbx");
|
||||
|
||||
if (size > mbx->size)
|
||||
ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
else if (mbx->ops.write)
|
||||
ret_val = mbx->ops.write(hw, msg, size, mbx_id);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_for_msg - checks to see if someone sent us mail
|
||||
* @hw: pointer to the HW structure
|
||||
* @mbx_id: id of mailbox to check
|
||||
*
|
||||
* returns SUCCESS if the Status bit was found or else ERR_MBX
|
||||
**/
|
||||
s32 ixgbe_check_for_msg(struct ixgbe_hw *hw, u16 mbx_id)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
DEBUGFUNC("ixgbe_check_for_msg");
|
||||
|
||||
if (mbx->ops.check_for_msg)
|
||||
ret_val = mbx->ops.check_for_msg(hw, mbx_id);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_for_ack - checks to see if someone sent us ACK
|
||||
* @hw: pointer to the HW structure
|
||||
* @mbx_id: id of mailbox to check
|
||||
*
|
||||
* returns SUCCESS if the Status bit was found or else ERR_MBX
|
||||
**/
|
||||
s32 ixgbe_check_for_ack(struct ixgbe_hw *hw, u16 mbx_id)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
DEBUGFUNC("ixgbe_check_for_ack");
|
||||
|
||||
if (mbx->ops.check_for_ack)
|
||||
ret_val = mbx->ops.check_for_ack(hw, mbx_id);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_for_rst - checks to see if other side has reset
|
||||
* @hw: pointer to the HW structure
|
||||
* @mbx_id: id of mailbox to check
|
||||
*
|
||||
* returns SUCCESS if the Status bit was found or else ERR_MBX
|
||||
**/
|
||||
s32 ixgbe_check_for_rst(struct ixgbe_hw *hw, u16 mbx_id)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
DEBUGFUNC("ixgbe_check_for_rst");
|
||||
|
||||
if (mbx->ops.check_for_rst)
|
||||
ret_val = mbx->ops.check_for_rst(hw, mbx_id);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_poll_for_msg - Wait for message notification
|
||||
* @hw: pointer to the HW structure
|
||||
* @mbx_id: id of mailbox to write
|
||||
*
|
||||
* returns SUCCESS if it successfully received a message notification
|
||||
**/
|
||||
static s32 ixgbe_poll_for_msg(struct ixgbe_hw *hw, u16 mbx_id)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
int countdown = mbx->timeout;
|
||||
|
||||
DEBUGFUNC("ixgbe_poll_for_msg");
|
||||
|
||||
if (!countdown || !mbx->ops.check_for_msg)
|
||||
goto out;
|
||||
|
||||
while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) {
|
||||
countdown--;
|
||||
if (!countdown)
|
||||
break;
|
||||
usec_delay(mbx->usec_delay);
|
||||
}
|
||||
|
||||
out:
|
||||
return countdown ? IXGBE_SUCCESS : IXGBE_ERR_MBX;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_poll_for_ack - Wait for message acknowledgement
|
||||
* @hw: pointer to the HW structure
|
||||
* @mbx_id: id of mailbox to write
|
||||
*
|
||||
* returns SUCCESS if it successfully received a message acknowledgement
|
||||
**/
|
||||
static s32 ixgbe_poll_for_ack(struct ixgbe_hw *hw, u16 mbx_id)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
int countdown = mbx->timeout;
|
||||
|
||||
DEBUGFUNC("ixgbe_poll_for_ack");
|
||||
|
||||
if (!countdown || !mbx->ops.check_for_ack)
|
||||
goto out;
|
||||
|
||||
while (countdown && mbx->ops.check_for_ack(hw, mbx_id)) {
|
||||
countdown--;
|
||||
if (!countdown)
|
||||
break;
|
||||
usec_delay(mbx->usec_delay);
|
||||
}
|
||||
|
||||
out:
|
||||
return countdown ? IXGBE_SUCCESS : IXGBE_ERR_MBX;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_read_posted_mbx - Wait for message notification and receive message
|
||||
* @hw: pointer to the HW structure
|
||||
* @msg: The message buffer
|
||||
* @size: Length of buffer
|
||||
* @mbx_id: id of mailbox to write
|
||||
*
|
||||
* returns SUCCESS if it successfully received a message notification and
|
||||
* copied it into the receive buffer.
|
||||
**/
|
||||
s32 ixgbe_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
DEBUGFUNC("ixgbe_read_posted_mbx");
|
||||
|
||||
if (!mbx->ops.read)
|
||||
goto out;
|
||||
|
||||
ret_val = ixgbe_poll_for_msg(hw, mbx_id);
|
||||
|
||||
/* if ack received read message, otherwise we timed out */
|
||||
if (!ret_val)
|
||||
ret_val = mbx->ops.read(hw, msg, size, mbx_id);
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_write_posted_mbx - Write a message to the mailbox, wait for ack
|
||||
* @hw: pointer to the HW structure
|
||||
* @msg: The message buffer
|
||||
* @size: Length of buffer
|
||||
* @mbx_id: id of mailbox to write
|
||||
*
|
||||
* returns SUCCESS if it successfully copied message into the buffer and
|
||||
* received an ack to that message within delay * timeout period
|
||||
**/
|
||||
s32 ixgbe_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size,
|
||||
u16 mbx_id)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
DEBUGFUNC("ixgbe_write_posted_mbx");
|
||||
|
||||
/* exit if either we can't write or there isn't a defined timeout */
|
||||
if (!mbx->ops.write || !mbx->timeout)
|
||||
goto out;
|
||||
|
||||
/* send msg */
|
||||
ret_val = mbx->ops.write(hw, msg, size, mbx_id);
|
||||
|
||||
/* if msg sent wait until we receive an ack */
|
||||
if (!ret_val)
|
||||
ret_val = ixgbe_poll_for_ack(hw, mbx_id);
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_init_mbx_ops_generic - Initialize MB function pointers
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Setups up the mailbox read and write message function pointers
|
||||
**/
|
||||
void ixgbe_init_mbx_ops_generic(struct ixgbe_hw *hw)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
|
||||
mbx->ops.read_posted = ixgbe_read_posted_mbx;
|
||||
mbx->ops.write_posted = ixgbe_write_posted_mbx;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_read_v2p_mailbox - read v2p mailbox
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* This function is used to read the v2p mailbox without losing the read to
|
||||
* clear status bits.
|
||||
**/
|
||||
static u32 ixgbe_read_v2p_mailbox(struct ixgbe_hw *hw)
|
||||
{
|
||||
u32 v2p_mailbox = IXGBE_READ_REG(hw, IXGBE_VFMAILBOX);
|
||||
|
||||
v2p_mailbox |= hw->mbx.v2p_mailbox;
|
||||
hw->mbx.v2p_mailbox |= v2p_mailbox & IXGBE_VFMAILBOX_R2C_BITS;
|
||||
|
||||
return v2p_mailbox;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_for_bit_vf - Determine if a status bit was set
|
||||
* @hw: pointer to the HW structure
|
||||
* @mask: bitmask for bits to be tested and cleared
|
||||
*
|
||||
* This function is used to check for the read to clear bits within
|
||||
* the V2P mailbox.
|
||||
**/
|
||||
static s32 ixgbe_check_for_bit_vf(struct ixgbe_hw *hw, u32 mask)
|
||||
{
|
||||
u32 v2p_mailbox = ixgbe_read_v2p_mailbox(hw);
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
if (v2p_mailbox & mask)
|
||||
ret_val = IXGBE_SUCCESS;
|
||||
|
||||
hw->mbx.v2p_mailbox &= ~mask;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_for_msg_vf - checks to see if the PF has sent mail
|
||||
* @hw: pointer to the HW structure
|
||||
* @mbx_id: id of mailbox to check
|
||||
*
|
||||
* returns SUCCESS if the PF has set the Status bit or else ERR_MBX
|
||||
**/
|
||||
static s32 ixgbe_check_for_msg_vf(struct ixgbe_hw *hw, u16 mbx_id)
|
||||
{
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
UNREFERENCED_PARAMETER(mbx_id);
|
||||
DEBUGFUNC("ixgbe_check_for_msg_vf");
|
||||
|
||||
if (!ixgbe_check_for_bit_vf(hw, IXGBE_VFMAILBOX_PFSTS)) {
|
||||
ret_val = IXGBE_SUCCESS;
|
||||
hw->mbx.stats.reqs++;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_for_ack_vf - checks to see if the PF has ACK'd
|
||||
* @hw: pointer to the HW structure
|
||||
* @mbx_id: id of mailbox to check
|
||||
*
|
||||
* returns SUCCESS if the PF has set the ACK bit or else ERR_MBX
|
||||
**/
|
||||
static s32 ixgbe_check_for_ack_vf(struct ixgbe_hw *hw, u16 mbx_id)
|
||||
{
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
UNREFERENCED_PARAMETER(mbx_id);
|
||||
DEBUGFUNC("ixgbe_check_for_ack_vf");
|
||||
|
||||
if (!ixgbe_check_for_bit_vf(hw, IXGBE_VFMAILBOX_PFACK)) {
|
||||
ret_val = IXGBE_SUCCESS;
|
||||
hw->mbx.stats.acks++;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_for_rst_vf - checks to see if the PF has reset
|
||||
* @hw: pointer to the HW structure
|
||||
* @mbx_id: id of mailbox to check
|
||||
*
|
||||
* returns TRUE if the PF has set the reset done bit or else FALSE
|
||||
**/
|
||||
static s32 ixgbe_check_for_rst_vf(struct ixgbe_hw *hw, u16 mbx_id)
|
||||
{
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
UNREFERENCED_PARAMETER(mbx_id);
|
||||
DEBUGFUNC("ixgbe_check_for_rst_vf");
|
||||
|
||||
if (!ixgbe_check_for_bit_vf(hw, (IXGBE_VFMAILBOX_RSTD |
|
||||
IXGBE_VFMAILBOX_RSTI))) {
|
||||
ret_val = IXGBE_SUCCESS;
|
||||
hw->mbx.stats.rsts++;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_obtain_mbx_lock_vf - obtain mailbox lock
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* return SUCCESS if we obtained the mailbox lock
|
||||
**/
|
||||
static s32 ixgbe_obtain_mbx_lock_vf(struct ixgbe_hw *hw)
|
||||
{
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
DEBUGFUNC("ixgbe_obtain_mbx_lock_vf");
|
||||
|
||||
/* Take ownership of the buffer */
|
||||
IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_VFU);
|
||||
|
||||
/* reserve mailbox for vf use */
|
||||
if (ixgbe_read_v2p_mailbox(hw) & IXGBE_VFMAILBOX_VFU)
|
||||
ret_val = IXGBE_SUCCESS;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_write_mbx_vf - Write a message to the mailbox
|
||||
* @hw: pointer to the HW structure
|
||||
* @msg: The message buffer
|
||||
* @size: Length of buffer
|
||||
* @mbx_id: id of mailbox to write
|
||||
*
|
||||
* returns SUCCESS if it successfully copied message into the buffer
|
||||
**/
|
||||
static s32 ixgbe_write_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size,
|
||||
u16 mbx_id)
|
||||
{
|
||||
s32 ret_val;
|
||||
u16 i;
|
||||
|
||||
UNREFERENCED_PARAMETER(mbx_id);
|
||||
|
||||
DEBUGFUNC("ixgbe_write_mbx_vf");
|
||||
|
||||
/* lock the mailbox to prevent pf/vf race condition */
|
||||
ret_val = ixgbe_obtain_mbx_lock_vf(hw);
|
||||
if (ret_val)
|
||||
goto out_no_write;
|
||||
|
||||
/* flush msg and acks as we are overwriting the message buffer */
|
||||
ixgbe_check_for_msg_vf(hw, 0);
|
||||
ixgbe_check_for_ack_vf(hw, 0);
|
||||
|
||||
/* copy the caller specified message to the mailbox memory buffer */
|
||||
for (i = 0; i < size; i++)
|
||||
IXGBE_WRITE_REG_ARRAY(hw, IXGBE_VFMBMEM, i, msg[i]);
|
||||
|
||||
/* update stats */
|
||||
hw->mbx.stats.msgs_tx++;
|
||||
|
||||
/* Drop VFU and interrupt the PF to tell it a message has been sent */
|
||||
IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_REQ);
|
||||
|
||||
out_no_write:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_read_mbx_vf - Reads a message from the inbox intended for vf
|
||||
* @hw: pointer to the HW structure
|
||||
* @msg: The message buffer
|
||||
* @size: Length of buffer
|
||||
* @mbx_id: id of mailbox to read
|
||||
*
|
||||
* returns SUCCESS if it successfuly read message from buffer
|
||||
**/
|
||||
static s32 ixgbe_read_mbx_vf(struct ixgbe_hw *hw, u32 *msg, u16 size,
|
||||
u16 mbx_id)
|
||||
{
|
||||
s32 ret_val = IXGBE_SUCCESS;
|
||||
u16 i;
|
||||
|
||||
DEBUGFUNC("ixgbe_read_mbx_vf");
|
||||
UNREFERENCED_PARAMETER(mbx_id);
|
||||
|
||||
/* lock the mailbox to prevent pf/vf race condition */
|
||||
ret_val = ixgbe_obtain_mbx_lock_vf(hw);
|
||||
if (ret_val)
|
||||
goto out_no_read;
|
||||
|
||||
/* copy the message from the mailbox memory buffer */
|
||||
for (i = 0; i < size; i++)
|
||||
msg[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_VFMBMEM, i);
|
||||
|
||||
/* Acknowledge receipt and release mailbox, then we're done */
|
||||
IXGBE_WRITE_REG(hw, IXGBE_VFMAILBOX, IXGBE_VFMAILBOX_ACK);
|
||||
|
||||
/* update stats */
|
||||
hw->mbx.stats.msgs_rx++;
|
||||
|
||||
out_no_read:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_init_mbx_params_vf - set initial values for vf mailbox
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Initializes the hw->mbx struct to correct values for vf mailbox
|
||||
*/
|
||||
void ixgbe_init_mbx_params_vf(struct ixgbe_hw *hw)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
|
||||
/* start mailbox as timed out and let the reset_hw call set the timeout
|
||||
* value to begin communications */
|
||||
mbx->timeout = 0;
|
||||
mbx->usec_delay = IXGBE_VF_MBX_INIT_DELAY;
|
||||
|
||||
mbx->size = IXGBE_VFMAILBOX_SIZE;
|
||||
|
||||
mbx->ops.read = ixgbe_read_mbx_vf;
|
||||
mbx->ops.write = ixgbe_write_mbx_vf;
|
||||
mbx->ops.read_posted = ixgbe_read_posted_mbx;
|
||||
mbx->ops.write_posted = ixgbe_write_posted_mbx;
|
||||
mbx->ops.check_for_msg = ixgbe_check_for_msg_vf;
|
||||
mbx->ops.check_for_ack = ixgbe_check_for_ack_vf;
|
||||
mbx->ops.check_for_rst = ixgbe_check_for_rst_vf;
|
||||
|
||||
mbx->stats.msgs_tx = 0;
|
||||
mbx->stats.msgs_rx = 0;
|
||||
mbx->stats.reqs = 0;
|
||||
mbx->stats.acks = 0;
|
||||
mbx->stats.rsts = 0;
|
||||
}
|
||||
|
||||
static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index)
|
||||
{
|
||||
u32 mbvficr = IXGBE_READ_REG(hw, IXGBE_MBVFICR(index));
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
if (mbvficr & mask) {
|
||||
ret_val = IXGBE_SUCCESS;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_MBVFICR(index), mask);
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_for_msg_pf - checks to see if the VF has sent mail
|
||||
* @hw: pointer to the HW structure
|
||||
* @vf_number: the VF index
|
||||
*
|
||||
* returns SUCCESS if the VF has set the Status bit or else ERR_MBX
|
||||
**/
|
||||
static s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_number)
|
||||
{
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
s32 index = IXGBE_MBVFICR_INDEX(vf_number);
|
||||
u32 vf_bit = vf_number % 16;
|
||||
|
||||
DEBUGFUNC("ixgbe_check_for_msg_pf");
|
||||
|
||||
if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFREQ_VF1 << vf_bit,
|
||||
index)) {
|
||||
ret_val = IXGBE_SUCCESS;
|
||||
hw->mbx.stats.reqs++;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_for_ack_pf - checks to see if the VF has ACKed
|
||||
* @hw: pointer to the HW structure
|
||||
* @vf_number: the VF index
|
||||
*
|
||||
* returns SUCCESS if the VF has set the Status bit or else ERR_MBX
|
||||
**/
|
||||
static s32 ixgbe_check_for_ack_pf(struct ixgbe_hw *hw, u16 vf_number)
|
||||
{
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
s32 index = IXGBE_MBVFICR_INDEX(vf_number);
|
||||
u32 vf_bit = vf_number % 16;
|
||||
|
||||
DEBUGFUNC("ixgbe_check_for_ack_pf");
|
||||
|
||||
if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFACK_VF1 << vf_bit,
|
||||
index)) {
|
||||
ret_val = IXGBE_SUCCESS;
|
||||
hw->mbx.stats.acks++;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_for_rst_pf - checks to see if the VF has reset
|
||||
* @hw: pointer to the HW structure
|
||||
* @vf_number: the VF index
|
||||
*
|
||||
* returns SUCCESS if the VF has set the Status bit or else ERR_MBX
|
||||
**/
|
||||
static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number)
|
||||
{
|
||||
u32 reg_offset = (vf_number < 32) ? 0 : 1;
|
||||
u32 vf_shift = vf_number % 32;
|
||||
u32 vflre = 0;
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
|
||||
DEBUGFUNC("ixgbe_check_for_rst_pf");
|
||||
|
||||
if (hw->mac.type == ixgbe_mac_82599EB)
|
||||
vflre = IXGBE_READ_REG(hw, IXGBE_VFLRE(reg_offset));
|
||||
|
||||
if (vflre & (1 << vf_shift)) {
|
||||
ret_val = IXGBE_SUCCESS;
|
||||
IXGBE_WRITE_REG(hw, IXGBE_VFLREC(reg_offset), (1 << vf_shift));
|
||||
hw->mbx.stats.rsts++;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_obtain_mbx_lock_pf - obtain mailbox lock
|
||||
* @hw: pointer to the HW structure
|
||||
* @vf_number: the VF index
|
||||
*
|
||||
* return SUCCESS if we obtained the mailbox lock
|
||||
**/
|
||||
static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_number)
|
||||
{
|
||||
s32 ret_val = IXGBE_ERR_MBX;
|
||||
u32 p2v_mailbox;
|
||||
|
||||
DEBUGFUNC("ixgbe_obtain_mbx_lock_pf");
|
||||
|
||||
/* Take ownership of the buffer */
|
||||
IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_PFU);
|
||||
|
||||
/* reserve mailbox for vf use */
|
||||
p2v_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_number));
|
||||
if (p2v_mailbox & IXGBE_PFMAILBOX_PFU)
|
||||
ret_val = IXGBE_SUCCESS;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_write_mbx_pf - Places a message in the mailbox
|
||||
* @hw: pointer to the HW structure
|
||||
* @msg: The message buffer
|
||||
* @size: Length of buffer
|
||||
* @vf_number: the VF index
|
||||
*
|
||||
* returns SUCCESS if it successfully copied message into the buffer
|
||||
**/
|
||||
static s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
|
||||
u16 vf_number)
|
||||
{
|
||||
s32 ret_val;
|
||||
u16 i;
|
||||
|
||||
DEBUGFUNC("ixgbe_write_mbx_pf");
|
||||
|
||||
/* lock the mailbox to prevent pf/vf race condition */
|
||||
ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
|
||||
if (ret_val)
|
||||
goto out_no_write;
|
||||
|
||||
/* flush msg and acks as we are overwriting the message buffer */
|
||||
ixgbe_check_for_msg_pf(hw, vf_number);
|
||||
ixgbe_check_for_ack_pf(hw, vf_number);
|
||||
|
||||
/* copy the caller specified message to the mailbox memory buffer */
|
||||
for (i = 0; i < size; i++)
|
||||
IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i, msg[i]);
|
||||
|
||||
/* Interrupt VF to tell it a message has been sent and release buffer*/
|
||||
IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_STS);
|
||||
|
||||
/* update stats */
|
||||
hw->mbx.stats.msgs_tx++;
|
||||
|
||||
out_no_write:
|
||||
return ret_val;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_read_mbx_pf - Read a message from the mailbox
|
||||
* @hw: pointer to the HW structure
|
||||
* @msg: The message buffer
|
||||
* @size: Length of buffer
|
||||
* @vf_number: the VF index
|
||||
*
|
||||
* This function copies a message from the mailbox buffer to the caller's
|
||||
* memory buffer. The presumption is that the caller knows that there was
|
||||
* a message due to a VF request so no polling for message is needed.
|
||||
**/
|
||||
static s32 ixgbe_read_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
|
||||
u16 vf_number)
|
||||
{
|
||||
s32 ret_val;
|
||||
u16 i;
|
||||
|
||||
DEBUGFUNC("ixgbe_read_mbx_pf");
|
||||
|
||||
/* lock the mailbox to prevent pf/vf race condition */
|
||||
ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
|
||||
if (ret_val)
|
||||
goto out_no_read;
|
||||
|
||||
/* copy the message to the mailbox memory buffer */
|
||||
for (i = 0; i < size; i++)
|
||||
msg[i] = IXGBE_READ_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_number), i);
|
||||
|
||||
/* Acknowledge the message and release buffer */
|
||||
IXGBE_WRITE_REG(hw, IXGBE_PFMAILBOX(vf_number), IXGBE_PFMAILBOX_ACK);
|
||||
|
||||
/* update stats */
|
||||
hw->mbx.stats.msgs_rx++;
|
||||
|
||||
out_no_read:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_init_mbx_params_pf - set initial values for pf mailbox
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Initializes the hw->mbx struct to correct values for pf mailbox
|
||||
*/
|
||||
void ixgbe_init_mbx_params_pf(struct ixgbe_hw *hw)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
|
||||
if (hw->mac.type != ixgbe_mac_82599EB)
|
||||
return;
|
||||
|
||||
mbx->timeout = 0;
|
||||
mbx->usec_delay = 0;
|
||||
|
||||
mbx->size = IXGBE_VFMAILBOX_SIZE;
|
||||
|
||||
mbx->ops.read = ixgbe_read_mbx_pf;
|
||||
mbx->ops.write = ixgbe_write_mbx_pf;
|
||||
mbx->ops.read_posted = ixgbe_read_posted_mbx;
|
||||
mbx->ops.write_posted = ixgbe_write_posted_mbx;
|
||||
mbx->ops.check_for_msg = ixgbe_check_for_msg_pf;
|
||||
mbx->ops.check_for_ack = ixgbe_check_for_ack_pf;
|
||||
mbx->ops.check_for_rst = ixgbe_check_for_rst_pf;
|
||||
|
||||
mbx->stats.msgs_tx = 0;
|
||||
mbx->stats.msgs_rx = 0;
|
||||
mbx->stats.reqs = 0;
|
||||
mbx->stats.acks = 0;
|
||||
mbx->stats.rsts = 0;
|
||||
}
|
||||
|
113
sys/dev/ixgbe/ixgbe_mbx.h
Normal file
113
sys/dev/ixgbe/ixgbe_mbx.h
Normal file
@ -0,0 +1,113 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, 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_MBX_H_
|
||||
#define _IXGBE_MBX_H_
|
||||
|
||||
#include "ixgbe_type.h"
|
||||
|
||||
#define IXGBE_VFMAILBOX_SIZE 16 /* 16 32 bit words - 64 bytes */
|
||||
#define IXGBE_ERR_MBX -100
|
||||
|
||||
#define IXGBE_VFMAILBOX 0x002FC
|
||||
#define IXGBE_VFMBMEM 0x00200
|
||||
|
||||
/* Define mailbox register bits */
|
||||
#define IXGBE_VFMAILBOX_REQ 0x00000001 /* Request for PF Ready bit */
|
||||
#define IXGBE_VFMAILBOX_ACK 0x00000002 /* Ack PF message received */
|
||||
#define IXGBE_VFMAILBOX_VFU 0x00000004 /* VF owns the mailbox buffer */
|
||||
#define IXGBE_VFMAILBOX_PFU 0x00000008 /* PF owns the mailbox buffer */
|
||||
#define IXGBE_VFMAILBOX_PFSTS 0x00000010 /* PF wrote a message in the MB */
|
||||
#define IXGBE_VFMAILBOX_PFACK 0x00000020 /* PF ack the previous VF msg */
|
||||
#define IXGBE_VFMAILBOX_RSTI 0x00000040 /* PF has reset indication */
|
||||
#define IXGBE_VFMAILBOX_RSTD 0x00000080 /* PF has indicated reset done */
|
||||
#define IXGBE_VFMAILBOX_R2C_BITS 0x000000B0 /* All read to clear bits */
|
||||
|
||||
#define IXGBE_PFMAILBOX(x) (0x04B00 + (4 * x))
|
||||
#define IXGBE_PFMBMEM(vfn) (0x13000 + (64 * vfn))
|
||||
|
||||
#define IXGBE_PFMAILBOX_STS 0x00000001 /* Initiate message send to VF */
|
||||
#define IXGBE_PFMAILBOX_ACK 0x00000002 /* Ack message recv'd from VF */
|
||||
#define IXGBE_PFMAILBOX_VFU 0x00000004 /* VF owns the mailbox buffer */
|
||||
#define IXGBE_PFMAILBOX_PFU 0x00000008 /* PF owns the mailbox buffer */
|
||||
#define IXGBE_PFMAILBOX_RVFU 0x00000010 /* Reset VFU - used when VF stuck */
|
||||
|
||||
#define IXGBE_MBVFICR_VFREQ_MASK 0x0000FFFF /* bits for VF messages */
|
||||
#define IXGBE_MBVFICR_VFREQ_VF1 0x00000001 /* bit for VF 1 message */
|
||||
#define IXGBE_MBVFICR_VFACK_MASK 0xFFFF0000 /* bits for VF acks */
|
||||
#define IXGBE_MBVFICR_VFACK_VF1 0x00010000 /* bit for VF 1 ack */
|
||||
|
||||
|
||||
/* If it's a IXGBE_VF_* msg then it originates in the VF and is sent to the
|
||||
* PF. The reverse is TRUE if it is IXGBE_PF_*.
|
||||
* Message ACK's are the value or'd with 0xF0000000
|
||||
*/
|
||||
#define IXGBE_VT_MSGTYPE_ACK 0x80000000 /* Messages below or'd with
|
||||
* this are the ACK */
|
||||
#define IXGBE_VT_MSGTYPE_NACK 0x40000000 /* Messages below or'd with
|
||||
* this are the NACK */
|
||||
#define IXGBE_VT_MSGTYPE_CTS 0x20000000 /* Indicates that VF is still
|
||||
clear to send requests */
|
||||
#define IXGBE_VT_MSGINFO_SHIFT 16
|
||||
/* bits 23:16 are used for exra info for certain messages */
|
||||
#define IXGBE_VT_MSGINFO_MASK (0xFF << IXGBE_VT_MSGINFO_SHIFT)
|
||||
|
||||
#define IXGBE_VF_RESET 0x01 /* VF requests reset */
|
||||
#define IXGBE_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */
|
||||
#define IXGBE_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */
|
||||
#define IXGBE_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */
|
||||
#define IXGBE_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */
|
||||
|
||||
/* length of permanent address message returned from PF */
|
||||
#define IXGBE_VF_PERMADDR_MSG_LEN 4
|
||||
/* word in permanent address message with the current multicast type */
|
||||
#define IXGBE_VF_MC_TYPE_WORD 3
|
||||
|
||||
#define IXGBE_PF_CONTROL_MSG 0x0100 /* PF control message */
|
||||
|
||||
#define IXGBE_VF_MBX_INIT_TIMEOUT 2000 /* number of retries on mailbox */
|
||||
#define IXGBE_VF_MBX_INIT_DELAY 500 /* microseconds between retries */
|
||||
|
||||
s32 ixgbe_read_mbx(struct ixgbe_hw *, u32 *, u16, u16);
|
||||
s32 ixgbe_write_mbx(struct ixgbe_hw *, u32 *, u16, u16);
|
||||
s32 ixgbe_read_posted_mbx(struct ixgbe_hw *, u32 *, u16, u16);
|
||||
s32 ixgbe_write_posted_mbx(struct ixgbe_hw *, u32 *, u16, u16);
|
||||
s32 ixgbe_check_for_msg(struct ixgbe_hw *, u16);
|
||||
s32 ixgbe_check_for_ack(struct ixgbe_hw *, u16);
|
||||
s32 ixgbe_check_for_rst(struct ixgbe_hw *, u16);
|
||||
void ixgbe_init_mbx_ops_generic(struct ixgbe_hw *hw);
|
||||
void ixgbe_init_mbx_params_vf(struct ixgbe_hw *);
|
||||
void ixgbe_init_mbx_params_pf(struct ixgbe_hw *);
|
||||
|
||||
#endif /* _IXGBE_MBX_H_ */
|
@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2009, Intel Corporation
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -86,7 +86,8 @@
|
||||
#define UNREFERENCED_PARAMETER(_p)
|
||||
|
||||
|
||||
#define IXGBE_HTONL htonl
|
||||
#define IXGBE_NTOHL(_i) ntohl(_i)
|
||||
#define IXGBE_NTOHS(_i) ntohs(_i)
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef int8_t s8;
|
||||
|
@ -78,7 +78,6 @@ s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw)
|
||||
phy->ops.identify_sfp = &ixgbe_identify_sfp_module_generic;
|
||||
phy->sfp_type = ixgbe_sfp_type_unknown;
|
||||
phy->ops.check_overtemp = &ixgbe_tn_check_overtemp;
|
||||
phy->ops.set_low_power_state = &ixgbe_tn_set_low_power_state;
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -110,9 +109,8 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
|
||||
IXGBE_MDIO_PMA_PMD_DEV_TYPE,
|
||||
&ext_ability);
|
||||
if (ext_ability &
|
||||
IXGBE_MDIO_PHY_10GBASET_ABILITY ||
|
||||
ext_ability &
|
||||
IXGBE_MDIO_PHY_1000BASET_ABILITY)
|
||||
(IXGBE_MDIO_PHY_10GBASET_ABILITY |
|
||||
IXGBE_MDIO_PHY_1000BASET_ABILITY))
|
||||
hw->phy.type =
|
||||
ixgbe_phy_cu_unknown;
|
||||
else
|
||||
@ -124,6 +122,7 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* clear value if nothing found */
|
||||
if (status != IXGBE_SUCCESS)
|
||||
hw->phy.addr = 0;
|
||||
} else {
|
||||
@ -234,6 +233,11 @@ s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw)
|
||||
if (status != IXGBE_SUCCESS || hw->phy.type == ixgbe_phy_none)
|
||||
goto out;
|
||||
|
||||
/* Don't reset PHY if it's shut down due to overtemp. */
|
||||
if (!hw->phy.reset_if_overtemp &&
|
||||
(IXGBE_ERR_OVERTEMP == hw->phy.ops.check_overtemp(hw)))
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Perform soft PHY reset to the PHY_XS.
|
||||
* This will cause a soft reset to the PHY
|
||||
@ -460,10 +464,10 @@ s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_setup_phy_link_generic - Set and restart autoneg
|
||||
* @hw: pointer to hardware structure
|
||||
* ixgbe_setup_phy_link_generic - Set and restart autoneg
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Restart autonegotiation and PHY and waits for completion.
|
||||
* Restart autonegotiation and PHY and waits for completion.
|
||||
**/
|
||||
s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw)
|
||||
{
|
||||
@ -774,7 +778,6 @@ s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw)
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ixgbe_get_phy_firmware_version_tnx - Gets the PHY Firmware Version
|
||||
* @hw: pointer to hardware structure
|
||||
@ -794,7 +797,6 @@ s32 ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw,
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ixgbe_get_phy_firmware_version_generic - Gets the PHY Firmware Version
|
||||
* @hw: pointer to hardware structure
|
||||
@ -938,20 +940,16 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
|
||||
hw->phy.sfp_type = ixgbe_sfp_type_not_present;
|
||||
status = IXGBE_ERR_SFP_NOT_PRESENT;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_IDENTIFIER,
|
||||
status = hw->phy.ops.read_i2c_eeprom(hw,
|
||||
IXGBE_SFF_IDENTIFIER,
|
||||
&identifier);
|
||||
|
||||
if (status == IXGBE_ERR_SFP_NOT_PRESENT || status == IXGBE_ERR_I2C) {
|
||||
status = IXGBE_ERR_SFP_NOT_PRESENT;
|
||||
hw->phy.sfp_type = ixgbe_sfp_type_not_present;
|
||||
if (hw->phy.type != ixgbe_phy_nl) {
|
||||
hw->phy.id = 0;
|
||||
hw->phy.type = ixgbe_phy_unknown;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
if (status == IXGBE_ERR_SWFW_SYNC ||
|
||||
status == IXGBE_ERR_I2C ||
|
||||
status == IXGBE_ERR_SFP_NOT_PRESENT)
|
||||
goto err_read_i2c_eeprom;
|
||||
|
||||
/* LAN ID is needed for sfp_type determination */
|
||||
hw->mac.ops.set_lan_id(hw);
|
||||
@ -960,12 +958,31 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
|
||||
hw->phy.type = ixgbe_phy_sfp_unsupported;
|
||||
status = IXGBE_ERR_SFP_NOT_SUPPORTED;
|
||||
} else {
|
||||
hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_1GBE_COMP_CODES,
|
||||
&comp_codes_1g);
|
||||
hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_10GBE_COMP_CODES,
|
||||
&comp_codes_10g);
|
||||
hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_CABLE_TECHNOLOGY,
|
||||
&cable_tech);
|
||||
status = hw->phy.ops.read_i2c_eeprom(hw,
|
||||
IXGBE_SFF_1GBE_COMP_CODES,
|
||||
&comp_codes_1g);
|
||||
|
||||
if (status == IXGBE_ERR_SWFW_SYNC ||
|
||||
status == IXGBE_ERR_I2C ||
|
||||
status == IXGBE_ERR_SFP_NOT_PRESENT)
|
||||
goto err_read_i2c_eeprom;
|
||||
|
||||
status = hw->phy.ops.read_i2c_eeprom(hw,
|
||||
IXGBE_SFF_10GBE_COMP_CODES,
|
||||
&comp_codes_10g);
|
||||
|
||||
if (status == IXGBE_ERR_SWFW_SYNC ||
|
||||
status == IXGBE_ERR_I2C ||
|
||||
status == IXGBE_ERR_SFP_NOT_PRESENT)
|
||||
goto err_read_i2c_eeprom;
|
||||
status = hw->phy.ops.read_i2c_eeprom(hw,
|
||||
IXGBE_SFF_CABLE_TECHNOLOGY,
|
||||
&cable_tech);
|
||||
|
||||
if (status == IXGBE_ERR_SWFW_SYNC ||
|
||||
status == IXGBE_ERR_I2C ||
|
||||
status == IXGBE_ERR_SFP_NOT_PRESENT)
|
||||
goto err_read_i2c_eeprom;
|
||||
|
||||
/* ID Module
|
||||
* =========
|
||||
@ -978,6 +995,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
|
||||
* 6 SFP_SR/LR_CORE1 - 82599-specific
|
||||
* 7 SFP_act_lmt_DA_CORE0 - 82599-specific
|
||||
* 8 SFP_act_lmt_DA_CORE1 - 82599-specific
|
||||
* 9 SFP_1g_cu_CORE0 - 82599-specific
|
||||
* 10 SFP_1g_cu_CORE1 - 82599-specific
|
||||
*/
|
||||
if (hw->mac.type == ixgbe_mac_82598EB) {
|
||||
if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
|
||||
@ -1001,25 +1020,33 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
|
||||
hw, IXGBE_SFF_CABLE_SPEC_COMP,
|
||||
&cable_spec);
|
||||
if (cable_spec &
|
||||
IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING) {
|
||||
IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING) {
|
||||
if (hw->bus.lan_id == 0)
|
||||
hw->phy.sfp_type =
|
||||
ixgbe_sfp_type_da_act_lmt_core0;
|
||||
else
|
||||
hw->phy.sfp_type =
|
||||
ixgbe_sfp_type_da_act_lmt_core1;
|
||||
} else
|
||||
} else {
|
||||
hw->phy.sfp_type =
|
||||
ixgbe_sfp_type_unknown;
|
||||
ixgbe_sfp_type_unknown;
|
||||
}
|
||||
} else if (comp_codes_10g &
|
||||
(IXGBE_SFF_10GBASESR_CAPABLE |
|
||||
IXGBE_SFF_10GBASELR_CAPABLE)) {
|
||||
IXGBE_SFF_10GBASELR_CAPABLE)) {
|
||||
if (hw->bus.lan_id == 0)
|
||||
hw->phy.sfp_type =
|
||||
ixgbe_sfp_type_srlr_core0;
|
||||
else
|
||||
hw->phy.sfp_type =
|
||||
ixgbe_sfp_type_srlr_core1;
|
||||
} else if (comp_codes_1g & IXGBE_SFF_1GBASET_CAPABLE) {
|
||||
if (hw->bus.lan_id == 0)
|
||||
hw->phy.sfp_type =
|
||||
ixgbe_sfp_type_1g_cu_core0;
|
||||
else
|
||||
hw->phy.sfp_type =
|
||||
ixgbe_sfp_type_1g_cu_core1;
|
||||
} else {
|
||||
hw->phy.sfp_type = ixgbe_sfp_type_unknown;
|
||||
}
|
||||
@ -1039,20 +1066,37 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
|
||||
/* Determine PHY vendor */
|
||||
if (hw->phy.type != ixgbe_phy_nl) {
|
||||
hw->phy.id = identifier;
|
||||
hw->phy.ops.read_i2c_eeprom(hw,
|
||||
status = hw->phy.ops.read_i2c_eeprom(hw,
|
||||
IXGBE_SFF_VENDOR_OUI_BYTE0,
|
||||
&oui_bytes[0]);
|
||||
hw->phy.ops.read_i2c_eeprom(hw,
|
||||
|
||||
if (status == IXGBE_ERR_SWFW_SYNC ||
|
||||
status == IXGBE_ERR_I2C ||
|
||||
status == IXGBE_ERR_SFP_NOT_PRESENT)
|
||||
goto err_read_i2c_eeprom;
|
||||
|
||||
status = hw->phy.ops.read_i2c_eeprom(hw,
|
||||
IXGBE_SFF_VENDOR_OUI_BYTE1,
|
||||
&oui_bytes[1]);
|
||||
hw->phy.ops.read_i2c_eeprom(hw,
|
||||
|
||||
if (status == IXGBE_ERR_SWFW_SYNC ||
|
||||
status == IXGBE_ERR_I2C ||
|
||||
status == IXGBE_ERR_SFP_NOT_PRESENT)
|
||||
goto err_read_i2c_eeprom;
|
||||
|
||||
status = hw->phy.ops.read_i2c_eeprom(hw,
|
||||
IXGBE_SFF_VENDOR_OUI_BYTE2,
|
||||
&oui_bytes[2]);
|
||||
|
||||
if (status == IXGBE_ERR_SWFW_SYNC ||
|
||||
status == IXGBE_ERR_I2C ||
|
||||
status == IXGBE_ERR_SFP_NOT_PRESENT)
|
||||
goto err_read_i2c_eeprom;
|
||||
|
||||
vendor_oui =
|
||||
((oui_bytes[0] << IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT) |
|
||||
(oui_bytes[1] << IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT) |
|
||||
(oui_bytes[2] << IXGBE_SFF_VENDOR_OUI_BYTE2_SHIFT));
|
||||
((oui_bytes[0] << IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT) |
|
||||
(oui_bytes[1] << IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT) |
|
||||
(oui_bytes[2] << IXGBE_SFF_VENDOR_OUI_BYTE2_SHIFT));
|
||||
|
||||
switch (vendor_oui) {
|
||||
case IXGBE_SFF_VENDOR_OUI_TYCO:
|
||||
@ -1092,8 +1136,10 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* 1G SFP modules are not supported */
|
||||
if (comp_codes_10g == 0) {
|
||||
/* Verify supported 1G SFP modules */
|
||||
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.type = ixgbe_phy_sfp_unsupported;
|
||||
status = IXGBE_ERR_SFP_NOT_SUPPORTED;
|
||||
goto out;
|
||||
@ -1106,7 +1152,9 @@ 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)) {
|
||||
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))) {
|
||||
/* Make sure we're a supported PHY type */
|
||||
if (hw->phy.type == ixgbe_phy_sfp_intel) {
|
||||
status = IXGBE_SUCCESS;
|
||||
@ -1122,6 +1170,14 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
|
||||
|
||||
out:
|
||||
return status;
|
||||
|
||||
err_read_i2c_eeprom:
|
||||
hw->phy.sfp_type = ixgbe_sfp_type_not_present;
|
||||
if (hw->phy.type != ixgbe_phy_nl) {
|
||||
hw->phy.id = 0;
|
||||
hw->phy.type = ixgbe_phy_unknown;
|
||||
}
|
||||
return IXGBE_ERR_SFP_NOT_PRESENT;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1152,10 +1208,15 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
|
||||
(hw->phy.sfp_type == ixgbe_sfp_type_da_cu))
|
||||
return IXGBE_ERR_SFP_NOT_SUPPORTED;
|
||||
|
||||
/* Limiting active cables must be initialized as SR modules */
|
||||
if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0)
|
||||
/*
|
||||
* Limiting active cables and 1G Phys must be initialized as
|
||||
* SR modules
|
||||
*/
|
||||
if (sfp_type == ixgbe_sfp_type_da_act_lmt_core0 ||
|
||||
sfp_type == ixgbe_sfp_type_1g_cu_core0)
|
||||
sfp_type = ixgbe_sfp_type_srlr_core0;
|
||||
else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1)
|
||||
else if (sfp_type == ixgbe_sfp_type_da_act_lmt_core1 ||
|
||||
sfp_type == ixgbe_sfp_type_1g_cu_core1)
|
||||
sfp_type = ixgbe_sfp_type_srlr_core1;
|
||||
|
||||
/* Read offset to PHY init contents */
|
||||
@ -1259,7 +1320,6 @@ s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,
|
||||
else
|
||||
swfw_mask = IXGBE_GSSR_PHY0_SM;
|
||||
|
||||
|
||||
do {
|
||||
if (ixgbe_acquire_swfw_sync(hw, swfw_mask) != IXGBE_SUCCESS) {
|
||||
status = IXGBE_ERR_SWFW_SYNC;
|
||||
@ -1472,7 +1532,7 @@ static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data)
|
||||
|
||||
for (i = 7; i >= 0; i--) {
|
||||
status = ixgbe_clock_in_i2c_bit(hw, &bit);
|
||||
*data |= bit<<i;
|
||||
*data |= bit << i;
|
||||
|
||||
if (status != IXGBE_SUCCESS)
|
||||
break;
|
||||
@ -1761,7 +1821,7 @@ void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw)
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_overtemp - Checks if an overtemp occured.
|
||||
* ixgbe_tn_check_overtemp - Checks if an overtemp occured.
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Checks if the LASI temp alarm status was triggered due to overtemp
|
||||
@ -1787,28 +1847,3 @@ s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw)
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ixgbe_set_tn_low_power_state - Sets the teranetics phy into low power state
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Sets the phy into low power mode when LASI temp alarm status is triggered
|
||||
**/
|
||||
s32 ixgbe_tn_set_low_power_state(struct ixgbe_hw *hw)
|
||||
{
|
||||
s32 status = IXGBE_SUCCESS;
|
||||
u16 phy_data = 0;
|
||||
|
||||
DEBUGFUNC("ixgbe_set_tn_low_power_state");
|
||||
|
||||
/* Set the phy into low power mode */
|
||||
hw->phy.ops.read_reg(hw, IXGBE_MDIO_PMA_PMD_CONTROL_ADDR,
|
||||
IXGBE_MDIO_PMA_PMD_DEV_TYPE, &phy_data);
|
||||
phy_data |= IXGBE_MDIO_PHY_LOW_POWER_MODE;
|
||||
hw->phy.ops.write_reg(hw, IXGBE_MDIO_PMA_PMD_CONTROL_ADDR,
|
||||
IXGBE_MDIO_PMA_PMD_DEV_TYPE, phy_data);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -52,9 +52,10 @@
|
||||
/* Bitmasks */
|
||||
#define IXGBE_SFF_DA_PASSIVE_CABLE 0x4
|
||||
#define IXGBE_SFF_DA_ACTIVE_CABLE 0x8
|
||||
#define IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4
|
||||
#define IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4
|
||||
#define IXGBE_SFF_1GBASESX_CAPABLE 0x1
|
||||
#define IXGBE_SFF_1GBASELX_CAPABLE 0x2
|
||||
#define IXGBE_SFF_1GBASET_CAPABLE 0x8
|
||||
#define IXGBE_SFF_10GBASESR_CAPABLE 0x10
|
||||
#define IXGBE_SFF_10GBASELR_CAPABLE 0x20
|
||||
#define IXGBE_I2C_EEPROM_READ_MASK 0x100
|
||||
@ -64,6 +65,10 @@
|
||||
#define IXGBE_I2C_EEPROM_STATUS_FAIL 0x2
|
||||
#define IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3
|
||||
|
||||
/* Flow control defines */
|
||||
#define IXGBE_TAF_SYM_PAUSE 0x400
|
||||
#define IXGBE_TAF_ASM_PAUSE 0x800
|
||||
|
||||
/* Bit-shift macros */
|
||||
#define IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT 24
|
||||
#define IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT 16
|
||||
@ -90,7 +95,6 @@
|
||||
#define IXGBE_TN_LASI_STATUS_REG 0x9005
|
||||
#define IXGBE_TN_LASI_STATUS_TEMP_ALARM 0x0008
|
||||
|
||||
|
||||
s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw);
|
||||
bool ixgbe_validate_phy_addr(struct ixgbe_hw *hw, u32 phy_addr);
|
||||
enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id);
|
||||
@ -126,7 +130,6 @@ s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
|
||||
u16 *list_offset,
|
||||
u16 *data_offset);
|
||||
s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_tn_set_low_power_state(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,
|
||||
u8 dev_addr, u8 *data);
|
||||
s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,
|
||||
|
@ -54,14 +54,18 @@
|
||||
#define IXGBE_DEV_ID_82598_DA_DUAL_PORT 0x10F1
|
||||
#define IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM 0x10E1
|
||||
#define IXGBE_DEV_ID_82598EB_XF_LR 0x10F4
|
||||
#define IXGBE_DEV_ID_82599_KX4 0x10F7
|
||||
#define IXGBE_DEV_ID_82599_KX4_MEZZ 0x1514
|
||||
#define IXGBE_DEV_ID_82599_COMBO_BACKPLANE 0x10F8
|
||||
#define IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ 0x000C
|
||||
#define IXGBE_DEV_ID_82599_CX4 0x10F9
|
||||
#define IXGBE_DEV_ID_82599_SFP 0x10FB
|
||||
#define IXGBE_DEV_ID_82599_XAUI_LOM 0x10FC
|
||||
#define IXGBE_DEV_ID_82599_T3_LOM 0x151C
|
||||
#define IXGBE_DEV_ID_82599_KX4 0x10F7
|
||||
#define IXGBE_DEV_ID_82599_KX4_MEZZ 0x1514
|
||||
#define IXGBE_DEV_ID_82599_COMBO_BACKPLANE 0x10F8
|
||||
#define IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ 0x000C
|
||||
#define IXGBE_DEV_ID_82599_CX4 0x10F9
|
||||
#define IXGBE_DEV_ID_82599_SFP 0x10FB
|
||||
#define IXGBE_SUBDEV_ID_82599_SFP 0x11A9
|
||||
#define IXGBE_DEV_ID_82599_BACKPLANE_FCOE 0x152A
|
||||
#define IXGBE_DEV_ID_82599_SFP_FCOE 0x1529
|
||||
#define IXGBE_DEV_ID_82599_XAUI_LOM 0x10FC
|
||||
#define IXGBE_DEV_ID_82599_T3_LOM 0x151C
|
||||
#define IXGBE_DEV_ID_82599_VF 0x10ED
|
||||
|
||||
/* General Registers */
|
||||
#define IXGBE_CTRL 0x00000
|
||||
@ -90,17 +94,17 @@
|
||||
#define IXGBE_GRC 0x10200
|
||||
|
||||
/* General Receive Control */
|
||||
#define IXGBE_GRC_MNG 0x00000001 /* Manageability Enable */
|
||||
#define IXGBE_GRC_APME 0x00000002 /* APM enabled in EEPROM */
|
||||
#define IXGBE_GRC_MNG 0x00000001 /* Manageability Enable */
|
||||
#define IXGBE_GRC_APME 0x00000002 /* APM enabled in EEPROM */
|
||||
|
||||
#define IXGBE_VPDDIAG0 0x10204
|
||||
#define IXGBE_VPDDIAG1 0x10208
|
||||
|
||||
/* I2CCTL Bit Masks */
|
||||
#define IXGBE_I2C_CLK_IN 0x00000001
|
||||
#define IXGBE_I2C_CLK_OUT 0x00000002
|
||||
#define IXGBE_I2C_DATA_IN 0x00000004
|
||||
#define IXGBE_I2C_DATA_OUT 0x00000008
|
||||
#define IXGBE_I2C_CLK_IN 0x00000001
|
||||
#define IXGBE_I2C_CLK_OUT 0x00000002
|
||||
#define IXGBE_I2C_DATA_IN 0x00000004
|
||||
#define IXGBE_I2C_DATA_OUT 0x00000008
|
||||
|
||||
/* Interrupt Registers */
|
||||
#define IXGBE_EICR 0x00800
|
||||
@ -109,19 +113,19 @@
|
||||
#define IXGBE_EIMC 0x00888
|
||||
#define IXGBE_EIAC 0x00810
|
||||
#define IXGBE_EIAM 0x00890
|
||||
#define IXGBE_EICS_EX(_i) (0x00A90 + (_i) * 4)
|
||||
#define IXGBE_EIMS_EX(_i) (0x00AA0 + (_i) * 4)
|
||||
#define IXGBE_EIMC_EX(_i) (0x00AB0 + (_i) * 4)
|
||||
#define IXGBE_EIAM_EX(_i) (0x00AD0 + (_i) * 4)
|
||||
#define IXGBE_EICS_EX(_i) (0x00A90 + (_i) * 4)
|
||||
#define IXGBE_EIMS_EX(_i) (0x00AA0 + (_i) * 4)
|
||||
#define IXGBE_EIMC_EX(_i) (0x00AB0 + (_i) * 4)
|
||||
#define IXGBE_EIAM_EX(_i) (0x00AD0 + (_i) * 4)
|
||||
/* 82599 EITR is only 12 bits, with the lower 3 always zero */
|
||||
/*
|
||||
* 82598 EITR is 16 bits but set the limits based on the max
|
||||
* supported by all ixgbe hardware
|
||||
*/
|
||||
#define IXGBE_MAX_INT_RATE 488281
|
||||
#define IXGBE_MIN_INT_RATE 956
|
||||
#define IXGBE_MAX_EITR 0x00000FF8
|
||||
#define IXGBE_MIN_EITR 8
|
||||
#define IXGBE_MAX_INT_RATE 488281
|
||||
#define IXGBE_MIN_INT_RATE 956
|
||||
#define IXGBE_MAX_EITR 0x00000FF8
|
||||
#define IXGBE_MIN_EITR 8
|
||||
#define IXGBE_EITR(_i) (((_i) <= 23) ? (0x00820 + ((_i) * 4)) : \
|
||||
(0x012300 + (((_i) - 24) * 4)))
|
||||
#define IXGBE_EITR_ITR_INT_MASK 0x00000FF8
|
||||
@ -231,9 +235,11 @@
|
||||
#define IXGBE_MTQC 0x08120
|
||||
#define IXGBE_VLVF(_i) (0x0F100 + ((_i) * 4)) /* 64 of these (0-63) */
|
||||
#define IXGBE_VLVFB(_i) (0x0F200 + ((_i) * 4)) /* 128 of these (0-127) */
|
||||
#define IXGBE_VMVIR(_i) (0x08000 + ((_i) * 4)) /* 64 of these (0-63) */
|
||||
#define IXGBE_VT_CTL 0x051B0
|
||||
#define IXGBE_VFRE(_i) (0x051E0 + ((_i) * 4))
|
||||
#define IXGBE_VFTE(_i) (0x08110 + ((_i) * 4))
|
||||
#define IXGBE_VMECM(_i) (0x08790 + ((_i) * 4))
|
||||
#define IXGBE_QDE 0x2F04
|
||||
#define IXGBE_VMOLR(_i) (0x0F000 + ((_i) * 4)) /* 64 total */
|
||||
#define IXGBE_UTA(_i) (0x0F400 + ((_i) * 4))
|
||||
@ -288,13 +294,14 @@
|
||||
#define IXGBE_TDWBAH(_i) (0x0603C + ((_i) * 0x40))
|
||||
#define IXGBE_DTXCTL 0x07E00
|
||||
|
||||
#define IXGBE_DMATXCTL 0x04A80
|
||||
#define IXGBE_PFDTXGSWC 0x08220
|
||||
#define IXGBE_DTXMXSZRQ 0x08100
|
||||
#define IXGBE_DTXTCPFLGL 0x04A88
|
||||
#define IXGBE_DTXTCPFLGH 0x04A8C
|
||||
#define IXGBE_LBDRPEN 0x0CA00
|
||||
#define IXGBE_TXPBTHRESH(_i) (0x04950 + ((_i) * 4)) /* 8 of these 0 - 7 */
|
||||
#define IXGBE_DMATXCTL 0x04A80
|
||||
#define IXGBE_PFVFSPOOF(_i) (0x08200 + ((_i) * 4)) /* 8 of these 0 - 7 */
|
||||
#define IXGBE_PFDTXGSWC 0x08220
|
||||
#define IXGBE_DTXMXSZRQ 0x08100
|
||||
#define IXGBE_DTXTCPFLGL 0x04A88
|
||||
#define IXGBE_DTXTCPFLGH 0x04A8C
|
||||
#define IXGBE_LBDRPEN 0x0CA00
|
||||
#define IXGBE_TXPBTHRESH(_i) (0x04950 + ((_i) * 4)) /* 8 of these 0 - 7 */
|
||||
|
||||
#define IXGBE_DMATXCTL_TE 0x1 /* Transmit Enable */
|
||||
#define IXGBE_DMATXCTL_NS 0x2 /* No Snoop LSO hdr buffer */
|
||||
@ -302,6 +309,12 @@
|
||||
#define IXGBE_DMATXCTL_VT_SHIFT 16 /* VLAN EtherType */
|
||||
|
||||
#define IXGBE_PFDTXGSWC_VT_LBEN 0x1 /* Local L2 VT switch enable */
|
||||
|
||||
/* Anti-spoofing defines */
|
||||
#define IXGBE_SPOOF_MACAS_MASK 0xFF
|
||||
#define IXGBE_SPOOF_VLANAS_MASK 0xFF00
|
||||
#define IXGBE_SPOOF_VLANAS_SHIFT 8
|
||||
#define IXGBE_PFVFSPOOF_REG_COUNT 8
|
||||
#define IXGBE_DCA_TXCTRL(_i) (0x07200 + ((_i) * 4)) /* 16 of these (0-15) */
|
||||
/* Tx DCA Control register : 128 of these (0-127) */
|
||||
#define IXGBE_DCA_TXCTRL_82599(_i) (0x0600C + ((_i) * 0x40))
|
||||
@ -652,6 +665,8 @@
|
||||
#define IXGBE_QPTC(_i) (0x06030 + ((_i) * 0x40)) /* 16 of these */
|
||||
#define IXGBE_QBRC(_i) (0x01034 + ((_i) * 0x40)) /* 16 of these */
|
||||
#define IXGBE_QBTC(_i) (0x06034 + ((_i) * 0x40)) /* 16 of these */
|
||||
#define IXGBE_QBRC_L(_i) (0x01034 + ((_i) * 0x40)) /* 16 of these */
|
||||
#define IXGBE_QBRC_H(_i) (0x01038 + ((_i) * 0x40)) /* 16 of these */
|
||||
#define IXGBE_QPRDC(_i) (0x01430 + ((_i) * 0x40)) /* 16 of these */
|
||||
#define IXGBE_QBTC_L(_i) (0x08700 + ((_i) * 0x8)) /* 16 of these */
|
||||
#define IXGBE_QBTC_H(_i) (0x08704 + ((_i) * 0x8)) /* 16 of these */
|
||||
@ -1019,6 +1034,8 @@
|
||||
|
||||
#define IXGBE_MDIO_AUTO_NEG_CONTROL 0x0 /* AUTO_NEG Control Reg */
|
||||
#define IXGBE_MDIO_AUTO_NEG_STATUS 0x1 /* AUTO_NEG Status Reg */
|
||||
#define IXGBE_MDIO_AUTO_NEG_ADVT 0x10 /* AUTO_NEG Advt Reg */
|
||||
#define IXGBE_MDIO_AUTO_NEG_LP 0x13 /* AUTO_NEG LP Status Reg */
|
||||
#define IXGBE_MDIO_PHY_XS_CONTROL 0x0 /* PHY_XS Control Reg */
|
||||
#define IXGBE_MDIO_PHY_XS_RESET 0x8000 /* PHY_XS Reset */
|
||||
#define IXGBE_MDIO_PHY_ID_HIGH 0x2 /* PHY ID High Reg*/
|
||||
@ -1399,6 +1416,9 @@
|
||||
#define IXGBE_VLVF_VIEN 0x80000000 /* filter is valid */
|
||||
#define IXGBE_VLVF_ENTRIES 64
|
||||
#define IXGBE_VLVF_VLANID_MASK 0x00000FFF
|
||||
/* Per VF Port VLAN insertion rules */
|
||||
#define IXGBE_VMVIR_VLANA_DEFAULT 0x40000000 /* Always use default VLAN */
|
||||
#define IXGBE_VMVIR_VLANA_NEVER 0x80000000 /* Never insert VLAN tag */
|
||||
|
||||
#define IXGBE_ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.1q protocol */
|
||||
|
||||
@ -1543,6 +1563,7 @@
|
||||
#define IXGBE_ANLP1_PAUSE 0x0C00
|
||||
#define IXGBE_ANLP1_SYM_PAUSE 0x0400
|
||||
#define IXGBE_ANLP1_ASM_PAUSE 0x0800
|
||||
#define IXGBE_ANLP1_AN_STATE_MASK 0x000f0000
|
||||
|
||||
/* SW Semaphore Register bitmasks */
|
||||
#define IXGBE_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */
|
||||
@ -1571,6 +1592,7 @@
|
||||
#define IXGBE_EEC_PRES 0x00000100 /* EEPROM Present */
|
||||
#define IXGBE_EEC_ARD 0x00000200 /* EEPROM Auto Read Done */
|
||||
#define IXGBE_EEC_FLUP 0x00800000 /* Flash update command */
|
||||
#define IXGBE_EEC_SEC1VAL 0x02000000 /* Sector 1 Valid */
|
||||
#define IXGBE_EEC_FLUDONE 0x04000000 /* Flash update done */
|
||||
/* EEPROM Addressing bits based on type (0-small, 1-large) */
|
||||
#define IXGBE_EEC_ADDR_SIZE 0x00000400
|
||||
@ -1580,7 +1602,11 @@
|
||||
#define IXGBE_EEPROM_WORD_SIZE_BASE_SHIFT 6
|
||||
#define IXGBE_EEPROM_OPCODE_BITS 8
|
||||
|
||||
/* Part Number String Length */
|
||||
#define IXGBE_PBANUM_LENGTH 11
|
||||
|
||||
/* Checksum and EEPROM pointers */
|
||||
#define IXGBE_PBANUM_PTR_GUARD 0xFAFA
|
||||
#define IXGBE_EEPROM_CHECKSUM 0x3F
|
||||
#define IXGBE_EEPROM_SUM 0xBABA
|
||||
#define IXGBE_PCIE_ANALOG_PTR 0x03
|
||||
@ -1660,15 +1686,20 @@
|
||||
#define IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP 0x1
|
||||
#define IXGBE_DEVICE_CAPS_FCOE_OFFLOADS 0x2
|
||||
#define IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR 0x4
|
||||
#define IXGBE_FW_PATCH_VERSION_4 0x7
|
||||
#define IXGBE_FW_PATCH_VERSION_4 0x7
|
||||
#define IXGBE_FCOE_IBA_CAPS_BLK_PTR 0x33 /* iSCSI/FCOE block */
|
||||
#define IXGBE_FCOE_IBA_CAPS_FCOE 0x20 /* FCOE flags */
|
||||
#define IXGBE_ISCSI_FCOE_BLK_PTR 0x17 /* iSCSI/FCOE block */
|
||||
#define IXGBE_ISCSI_FCOE_FLAGS_OFFSET 0x0 /* FCOE flags */
|
||||
#define IXGBE_ISCSI_FCOE_FLAGS_ENABLE 0x1 /* FCOE flags enable bit */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_BLK_PTR 0x27 /* Alt. SAN MAC block */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_CAPS_OFFSET 0x0 /* Alt. SAN MAC capability */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_PORT0_OFFSET 0x1 /* Alt. SAN MAC 0 offset */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_PORT1_OFFSET 0x4 /* Alt. SAN MAC 1 offset */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_WWNN_OFFSET 0x7 /* Alt. WWNN prefix offset */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_WWPN_OFFSET 0x8 /* Alt. WWPN prefix offset */
|
||||
#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 */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_CAPS_OFFSET 0x0 /* Alt. SAN MAC capability */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_PORT0_OFFSET 0x1 /* Alt. SAN MAC 0 offset */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_PORT1_OFFSET 0x4 /* Alt. SAN MAC 1 offset */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_WWNN_OFFSET 0x7 /* Alt. WWNN prefix offset */
|
||||
#define IXGBE_ALT_SAN_MAC_ADDR_WWPN_OFFSET 0x8 /* Alt. WWPN prefix offset */
|
||||
#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 */
|
||||
|
||||
/* PCI Bus Info */
|
||||
#define IXGBE_PCI_DEVICE_STATUS 0xAA
|
||||
@ -2061,6 +2092,7 @@ enum ixgbe_fdir_pballoc_type {
|
||||
#define IXGBE_FDIRCMD_LAST 0x00000800
|
||||
#define IXGBE_FDIRCMD_COLLISION 0x00001000
|
||||
#define IXGBE_FDIRCMD_QUEUE_EN 0x00008000
|
||||
#define IXGBE_FDIRCMD_FLOW_TYPE_SHIFT 5
|
||||
#define IXGBE_FDIRCMD_RX_QUEUE_SHIFT 16
|
||||
#define IXGBE_FDIRCMD_VT_POOL_SHIFT 24
|
||||
#define IXGBE_FDIR_INIT_DONE_POLL 10
|
||||
@ -2238,34 +2270,41 @@ typedef u32 ixgbe_physical_layer;
|
||||
#define IXGBE_PHYSICAL_LAYER_10GBASE_XAUI 0x1000
|
||||
#define IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA 0x2000
|
||||
|
||||
/* Flow Control Macros */
|
||||
#define PAUSE_RTT 8
|
||||
#define PAUSE_MTU(MTU) ((MTU + 1024 - 1) / 1024)
|
||||
|
||||
#define FC_HIGH_WATER(MTU) ((((PAUSE_RTT + PAUSE_MTU(MTU)) * 144) + 99) / 100 +\
|
||||
PAUSE_MTU(MTU))
|
||||
#define FC_LOW_WATER(MTU) (2 * (2 * PAUSE_MTU(MTU) + PAUSE_RTT))
|
||||
|
||||
/* Software ATR hash keys */
|
||||
#define IXGBE_ATR_BUCKET_HASH_KEY 0xE214AD3D
|
||||
#define IXGBE_ATR_SIGNATURE_HASH_KEY 0x14364D17
|
||||
|
||||
/* Software ATR input stream offsets and masks */
|
||||
#define IXGBE_ATR_VLAN_OFFSET 0
|
||||
#define IXGBE_ATR_SRC_IPV6_OFFSET 2
|
||||
#define IXGBE_ATR_SRC_IPV4_OFFSET 14
|
||||
#define IXGBE_ATR_DST_IPV6_OFFSET 18
|
||||
#define IXGBE_ATR_DST_IPV4_OFFSET 30
|
||||
#define IXGBE_ATR_SRC_PORT_OFFSET 34
|
||||
#define IXGBE_ATR_DST_PORT_OFFSET 36
|
||||
#define IXGBE_ATR_FLEX_BYTE_OFFSET 38
|
||||
#define IXGBE_ATR_VM_POOL_OFFSET 40
|
||||
#define IXGBE_ATR_L4TYPE_OFFSET 41
|
||||
#define IXGBE_ATR_BUCKET_HASH_KEY 0x3DAD14E2
|
||||
#define IXGBE_ATR_SIGNATURE_HASH_KEY 0x174D3614
|
||||
|
||||
/* Software ATR input stream values and masks */
|
||||
#define IXGBE_ATR_HASH_MASK 0x7fff
|
||||
#define IXGBE_ATR_L4TYPE_MASK 0x3
|
||||
#define IXGBE_ATR_L4TYPE_IPV6_MASK 0x4
|
||||
#define IXGBE_ATR_L4TYPE_UDP 0x1
|
||||
#define IXGBE_ATR_L4TYPE_TCP 0x2
|
||||
#define IXGBE_ATR_L4TYPE_SCTP 0x3
|
||||
#define IXGBE_ATR_HASH_MASK 0x7fff
|
||||
#define IXGBE_ATR_L4TYPE_IPV6_MASK 0x4
|
||||
enum ixgbe_atr_flow_type {
|
||||
IXGBE_ATR_FLOW_TYPE_IPV4 = 0x0,
|
||||
IXGBE_ATR_FLOW_TYPE_UDPV4 = 0x1,
|
||||
IXGBE_ATR_FLOW_TYPE_TCPV4 = 0x2,
|
||||
IXGBE_ATR_FLOW_TYPE_SCTPV4 = 0x3,
|
||||
IXGBE_ATR_FLOW_TYPE_IPV6 = 0x4,
|
||||
IXGBE_ATR_FLOW_TYPE_UDPV6 = 0x5,
|
||||
IXGBE_ATR_FLOW_TYPE_TCPV6 = 0x6,
|
||||
IXGBE_ATR_FLOW_TYPE_SCTPV6 = 0x7,
|
||||
};
|
||||
|
||||
/* Flow Director ATR input struct. */
|
||||
struct ixgbe_atr_input {
|
||||
union ixgbe_atr_input {
|
||||
/* Byte layout in order, all values with MSB first:
|
||||
*
|
||||
* rsvd0 - 2 bytes - space reserved must be 0.
|
||||
* vlan_id - 2 bytes
|
||||
* src_ip - 16 bytes
|
||||
* dst_ip - 16 bytes
|
||||
@ -2273,18 +2312,41 @@ struct ixgbe_atr_input {
|
||||
* dst_port - 2 bytes
|
||||
* flex_bytes - 2 bytes
|
||||
* vm_pool - 1 byte
|
||||
* l4type - 1 byte
|
||||
* flow_type - 1 byte
|
||||
*/
|
||||
u8 byte_stream[42];
|
||||
struct {
|
||||
__be16 rsvd0;
|
||||
__be16 vlan_id;
|
||||
__be32 dst_ip[4];
|
||||
__be32 src_ip[4];
|
||||
__be16 src_port;
|
||||
__be16 dst_port;
|
||||
__be16 flex_bytes;
|
||||
u8 vm_pool;
|
||||
u8 flow_type;
|
||||
} formatted;
|
||||
__be32 dword_stream[11];
|
||||
};
|
||||
|
||||
struct ixgbe_atr_input_masks {
|
||||
u32 src_ip_mask;
|
||||
u32 dst_ip_mask;
|
||||
u16 src_port_mask;
|
||||
u16 dst_port_mask;
|
||||
u16 vlan_id_mask;
|
||||
u16 data_mask;
|
||||
__be16 rsvd0;
|
||||
__be16 vlan_id_mask;
|
||||
__be32 dst_ip_mask[4];
|
||||
__be32 src_ip_mask[4];
|
||||
__be16 src_port_mask;
|
||||
__be16 dst_port_mask;
|
||||
__be16 flex_mask;
|
||||
};
|
||||
|
||||
/*
|
||||
* Unavailable: The FCoE Boot Option ROM is not present in the flash.
|
||||
* Disabled: Present; boot order is not set for any targets on the port.
|
||||
* Enabled: Present; boot order is set for at least one target on the port.
|
||||
*/
|
||||
enum ixgbe_fcoe_boot_status {
|
||||
ixgbe_fcoe_bootstatus_disabled = 0,
|
||||
ixgbe_fcoe_bootstatus_enabled = 1,
|
||||
ixgbe_fcoe_bootstatus_unavailable = 0xFFFF
|
||||
};
|
||||
|
||||
enum ixgbe_eeprom_type {
|
||||
@ -2298,6 +2360,7 @@ enum ixgbe_mac_type {
|
||||
ixgbe_mac_unknown = 0,
|
||||
ixgbe_mac_82598EB,
|
||||
ixgbe_mac_82599EB,
|
||||
ixgbe_mac_82599_vf,
|
||||
ixgbe_num_macs
|
||||
};
|
||||
|
||||
@ -2345,6 +2408,8 @@ enum ixgbe_sfp_type {
|
||||
ixgbe_sfp_type_srlr_core1 = 6,
|
||||
ixgbe_sfp_type_da_act_lmt_core0 = 7,
|
||||
ixgbe_sfp_type_da_act_lmt_core1 = 8,
|
||||
ixgbe_sfp_type_1g_cu_core0 = 9,
|
||||
ixgbe_sfp_type_1g_cu_core1 = 10,
|
||||
ixgbe_sfp_type_not_present = 0xFFFE,
|
||||
ixgbe_sfp_type_unknown = 0xFFFF
|
||||
};
|
||||
@ -2491,8 +2556,6 @@ struct ixgbe_hw_stats {
|
||||
u64 mptc;
|
||||
u64 bptc;
|
||||
u64 xec;
|
||||
u64 rqsmr[16];
|
||||
u64 tqsmr[8];
|
||||
u64 qprc[16];
|
||||
u64 qptc[16];
|
||||
u64 qbrc[16];
|
||||
@ -2544,6 +2607,7 @@ struct ixgbe_mac_operations {
|
||||
s32 (*set_san_mac_addr)(struct ixgbe_hw *, u8 *);
|
||||
s32 (*get_device_caps)(struct ixgbe_hw *, u16 *);
|
||||
s32 (*get_wwn_prefix)(struct ixgbe_hw *, u16 *, u16 *);
|
||||
s32 (*get_fcoe_boot_status)(struct ixgbe_hw *, u16 *);
|
||||
s32 (*stop_adapter)(struct ixgbe_hw *);
|
||||
s32 (*get_bus_info)(struct ixgbe_hw *);
|
||||
void (*set_lan_id)(struct ixgbe_hw *);
|
||||
@ -2555,6 +2619,9 @@ struct ixgbe_mac_operations {
|
||||
void (*release_swfw_sync)(struct ixgbe_hw *, u16);
|
||||
|
||||
/* Link */
|
||||
void (*disable_tx_laser)(struct ixgbe_hw *);
|
||||
void (*enable_tx_laser)(struct ixgbe_hw *);
|
||||
void (*flap_tx_laser)(struct ixgbe_hw *);
|
||||
s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool);
|
||||
s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool);
|
||||
s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *,
|
||||
@ -2582,6 +2649,8 @@ struct ixgbe_mac_operations {
|
||||
s32 (*clear_vfta)(struct ixgbe_hw *);
|
||||
s32 (*set_vfta)(struct ixgbe_hw *, u32, u32, bool);
|
||||
s32 (*init_uta_tables)(struct ixgbe_hw *);
|
||||
void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int);
|
||||
void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int);
|
||||
|
||||
/* Flow Control */
|
||||
s32 (*fc_enable)(struct ixgbe_hw *, s32);
|
||||
@ -2605,7 +2674,6 @@ struct ixgbe_phy_operations {
|
||||
s32 (*write_i2c_eeprom)(struct ixgbe_hw *, u8, u8);
|
||||
void (*i2c_bus_clear)(struct ixgbe_hw *);
|
||||
s32 (*check_overtemp)(struct ixgbe_hw *);
|
||||
s32 (*set_low_power_state)(struct ixgbe_hw *);
|
||||
};
|
||||
|
||||
struct ixgbe_eeprom_info {
|
||||
@ -2627,11 +2695,14 @@ struct ixgbe_mac_info {
|
||||
u16 wwnn_prefix;
|
||||
/* prefix for World Wide Port Name (WWPN) */
|
||||
u16 wwpn_prefix;
|
||||
#define IXGBE_MAX_MTA 128
|
||||
u32 mta_shadow[IXGBE_MAX_MTA];
|
||||
s32 mc_filter_type;
|
||||
u32 mcft_size;
|
||||
u32 vft_size;
|
||||
u32 num_rar_entries;
|
||||
u32 rar_highwater;
|
||||
u32 rx_pb_size;
|
||||
u32 max_tx_queues;
|
||||
u32 max_rx_queues;
|
||||
u32 max_msix_vectors;
|
||||
@ -2657,6 +2728,38 @@ struct ixgbe_phy_info {
|
||||
enum ixgbe_smart_speed smart_speed;
|
||||
bool smart_speed_active;
|
||||
bool multispeed_fiber;
|
||||
bool reset_if_overtemp;
|
||||
};
|
||||
|
||||
#include "ixgbe_mbx.h"
|
||||
|
||||
struct ixgbe_mbx_operations {
|
||||
void (*init_params)(struct ixgbe_hw *hw);
|
||||
s32 (*read)(struct ixgbe_hw *, u32 *, u16, u16);
|
||||
s32 (*write)(struct ixgbe_hw *, u32 *, u16, u16);
|
||||
s32 (*read_posted)(struct ixgbe_hw *, u32 *, u16, u16);
|
||||
s32 (*write_posted)(struct ixgbe_hw *, u32 *, u16, u16);
|
||||
s32 (*check_for_msg)(struct ixgbe_hw *, u16);
|
||||
s32 (*check_for_ack)(struct ixgbe_hw *, u16);
|
||||
s32 (*check_for_rst)(struct ixgbe_hw *, u16);
|
||||
};
|
||||
|
||||
struct ixgbe_mbx_stats {
|
||||
u32 msgs_tx;
|
||||
u32 msgs_rx;
|
||||
|
||||
u32 acks;
|
||||
u32 reqs;
|
||||
u32 rsts;
|
||||
};
|
||||
|
||||
struct ixgbe_mbx_info {
|
||||
struct ixgbe_mbx_operations ops;
|
||||
struct ixgbe_mbx_stats stats;
|
||||
u32 timeout;
|
||||
u32 usec_delay;
|
||||
u32 v2p_mailbox;
|
||||
u16 size;
|
||||
};
|
||||
|
||||
struct ixgbe_hw {
|
||||
@ -2668,6 +2771,7 @@ struct ixgbe_hw {
|
||||
struct ixgbe_phy_info phy;
|
||||
struct ixgbe_eeprom_info eeprom;
|
||||
struct ixgbe_bus_info bus;
|
||||
struct ixgbe_mbx_info mbx;
|
||||
u16 device_id;
|
||||
u16 vendor_id;
|
||||
u16 subsystem_device_id;
|
||||
@ -2708,6 +2812,12 @@ struct ixgbe_hw {
|
||||
#define IXGBE_ERR_EEPROM_VERSION -24
|
||||
#define IXGBE_ERR_NO_SPACE -25
|
||||
#define IXGBE_ERR_OVERTEMP -26
|
||||
#define IXGBE_ERR_FC_NOT_NEGOTIATED -27
|
||||
#define IXGBE_ERR_FC_NOT_SUPPORTED -28
|
||||
#define IXGBE_ERR_FLOW_CONTROL -29
|
||||
#define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30
|
||||
#define IXGBE_ERR_PBA_SECTION -31
|
||||
#define IXGBE_ERR_INVALID_ARGUMENT -32
|
||||
#define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF
|
||||
|
||||
|
||||
|
495
sys/dev/ixgbe/ixgbe_vf.c
Normal file
495
sys/dev/ixgbe/ixgbe_vf.c
Normal file
@ -0,0 +1,495 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, 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_api.h"
|
||||
#include "ixgbe_type.h"
|
||||
#include "ixgbe_vf.h"
|
||||
|
||||
s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_init_hw_vf(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_start_hw_vf(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_stop_hw_vf(struct ixgbe_hw *hw);
|
||||
u32 ixgbe_get_num_of_tx_queues_vf(struct ixgbe_hw *hw);
|
||||
u32 ixgbe_get_num_of_rx_queues_vf(struct ixgbe_hw *hw);
|
||||
s32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr);
|
||||
s32 ixgbe_setup_mac_link_vf(struct ixgbe_hw *hw,
|
||||
ixgbe_link_speed speed, bool autoneg,
|
||||
bool autoneg_wait_to_complete);
|
||||
s32 ixgbe_check_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
|
||||
bool *link_up, bool autoneg_wait_to_complete);
|
||||
s32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
|
||||
u32 enable_addr);
|
||||
s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
|
||||
u32 mc_addr_count, ixgbe_mc_addr_itr);
|
||||
s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on);
|
||||
|
||||
#ifndef IXGBE_VFWRITE_REG
|
||||
#define IXGBE_VFWRITE_REG IXGBE_WRITE_REG
|
||||
#endif
|
||||
#ifndef IXGBE_VFREAD_REG
|
||||
#define IXGBE_VFREAD_REG IXGBE_READ_REG
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ixgbe_init_ops_vf - Initialize the pointers for vf
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* This will assign function pointers, adapter-specific functions can
|
||||
* override the assignment of generic function pointers by assigning
|
||||
* their own adapter-specific function pointers.
|
||||
* Does not touch the hardware.
|
||||
**/
|
||||
s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw)
|
||||
{
|
||||
/* MAC */
|
||||
hw->mac.ops.init_hw = ixgbe_init_hw_vf;
|
||||
hw->mac.ops.reset_hw = ixgbe_reset_hw_vf;
|
||||
hw->mac.ops.start_hw = ixgbe_start_hw_vf;
|
||||
/* Cannot clear stats on VF */
|
||||
hw->mac.ops.clear_hw_cntrs = NULL;
|
||||
hw->mac.ops.get_media_type = NULL;
|
||||
hw->mac.ops.get_mac_addr = ixgbe_get_mac_addr_vf;
|
||||
hw->mac.ops.stop_adapter = ixgbe_stop_hw_vf;
|
||||
hw->mac.ops.get_bus_info = NULL;
|
||||
|
||||
/* Link */
|
||||
hw->mac.ops.setup_link = ixgbe_setup_mac_link_vf;
|
||||
hw->mac.ops.check_link = ixgbe_check_mac_link_vf;
|
||||
hw->mac.ops.get_link_capabilities = NULL;
|
||||
|
||||
/* RAR, Multicast, VLAN */
|
||||
hw->mac.ops.set_rar = ixgbe_set_rar_vf;
|
||||
hw->mac.ops.init_rx_addrs = NULL;
|
||||
hw->mac.ops.update_mc_addr_list = ixgbe_update_mc_addr_list_vf;
|
||||
hw->mac.ops.enable_mc = NULL;
|
||||
hw->mac.ops.disable_mc = NULL;
|
||||
hw->mac.ops.clear_vfta = NULL;
|
||||
hw->mac.ops.set_vfta = ixgbe_set_vfta_vf;
|
||||
|
||||
hw->mac.max_tx_queues = 1;
|
||||
hw->mac.max_rx_queues = 1;
|
||||
|
||||
hw->mbx.ops.init_params = ixgbe_init_mbx_params_vf;
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_start_hw_vf - Prepare hardware for Tx/Rx
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Starts the hardware by filling the bus info structure and media type, clears
|
||||
* all on chip counters, initializes receive address registers, multicast
|
||||
* table, VLAN filter table, calls routine to set up link and flow control
|
||||
* settings, and leaves transmit and receive units disabled and uninitialized
|
||||
**/
|
||||
s32 ixgbe_start_hw_vf(struct ixgbe_hw *hw)
|
||||
{
|
||||
/* Clear adapter stopped flag */
|
||||
hw->adapter_stopped = FALSE;
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_init_hw_vf - virtual function hardware initialization
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Initialize the hardware by resetting the hardware and then starting
|
||||
* the hardware
|
||||
**/
|
||||
s32 ixgbe_init_hw_vf(struct ixgbe_hw *hw)
|
||||
{
|
||||
s32 status = hw->mac.ops.start_hw(hw);
|
||||
|
||||
hw->mac.ops.get_mac_addr(hw, hw->mac.addr);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_reset_hw_vf - Performs hardware reset
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Resets the hardware by reseting the transmit and receive units, masks and
|
||||
* clears all interrupts.
|
||||
**/
|
||||
s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
u32 timeout = IXGBE_VF_INIT_TIMEOUT;
|
||||
s32 ret_val = IXGBE_ERR_INVALID_MAC_ADDR;
|
||||
u32 ctrl, msgbuf[IXGBE_VF_PERMADDR_MSG_LEN];
|
||||
u8 *addr = (u8 *)(&msgbuf[1]);
|
||||
|
||||
DEBUGFUNC("ixgbevf_reset_hw_vf");
|
||||
|
||||
/* Call adapter stop to disable tx/rx and clear interrupts */
|
||||
hw->mac.ops.stop_adapter(hw);
|
||||
|
||||
DEBUGOUT("Issuing a function level reset to MAC\n");
|
||||
ctrl = IXGBE_VFREAD_REG(hw, IXGBE_VFCTRL);
|
||||
IXGBE_VFWRITE_REG(hw, IXGBE_VFCTRL, (ctrl | IXGBE_CTRL_RST));
|
||||
IXGBE_WRITE_FLUSH(hw);
|
||||
|
||||
usec_delay(1);
|
||||
|
||||
/* we cannot reset while the RSTI / RSTD bits are asserted */
|
||||
while (!mbx->ops.check_for_rst(hw, 0) && timeout) {
|
||||
timeout--;
|
||||
usec_delay(5);
|
||||
}
|
||||
|
||||
if (timeout) {
|
||||
/* mailbox timeout can now become active */
|
||||
mbx->timeout = IXGBE_VF_MBX_INIT_TIMEOUT;
|
||||
|
||||
msgbuf[0] = IXGBE_VF_RESET;
|
||||
mbx->ops.write_posted(hw, msgbuf, 1, 0);
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_stop_hw_vf - Generic stop Tx/Rx units
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
|
||||
* disables transmit and receive units. The adapter_stopped flag is used by
|
||||
* the shared code and drivers to determine if the adapter is in a stopped
|
||||
* state and should not touch the hardware.
|
||||
**/
|
||||
s32 ixgbe_stop_hw_vf(struct ixgbe_hw *hw)
|
||||
{
|
||||
u32 number_of_queues;
|
||||
u32 reg_val;
|
||||
u16 i;
|
||||
|
||||
/*
|
||||
* Set the adapter_stopped flag so other driver functions stop touching
|
||||
* the hardware
|
||||
*/
|
||||
hw->adapter_stopped = TRUE;
|
||||
|
||||
/* Disable the receive unit by stopped each queue */
|
||||
number_of_queues = hw->mac.max_rx_queues;
|
||||
for (i = 0; i < number_of_queues; i++) {
|
||||
reg_val = IXGBE_VFREAD_REG(hw, IXGBE_VFRXDCTL(i));
|
||||
if (reg_val & IXGBE_RXDCTL_ENABLE) {
|
||||
reg_val &= ~IXGBE_RXDCTL_ENABLE;
|
||||
IXGBE_VFWRITE_REG(hw, IXGBE_VFRXDCTL(i), reg_val);
|
||||
}
|
||||
}
|
||||
|
||||
IXGBE_WRITE_FLUSH(hw);
|
||||
|
||||
/* Clear interrupt mask to stop from interrupts being generated */
|
||||
IXGBE_VFWRITE_REG(hw, IXGBE_VTEIMC, IXGBE_VF_IRQ_CLEAR_MASK);
|
||||
|
||||
/* Clear any pending interrupts */
|
||||
IXGBE_VFREAD_REG(hw, IXGBE_VTEICR);
|
||||
|
||||
/* Disable the transmit unit. Each queue must be disabled. */
|
||||
number_of_queues = hw->mac.max_tx_queues;
|
||||
for (i = 0; i < number_of_queues; i++) {
|
||||
reg_val = IXGBE_VFREAD_REG(hw, IXGBE_VFTXDCTL(i));
|
||||
if (reg_val & IXGBE_TXDCTL_ENABLE) {
|
||||
reg_val &= ~IXGBE_TXDCTL_ENABLE;
|
||||
IXGBE_VFWRITE_REG(hw, IXGBE_VFTXDCTL(i), reg_val);
|
||||
}
|
||||
}
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_mta_vector - Determines bit-vector in multicast table to set
|
||||
* @hw: pointer to hardware structure
|
||||
* @mc_addr: the multicast address
|
||||
*
|
||||
* Extracts the 12 bits, from a multicast address, to determine which
|
||||
* bit-vector to set in the multicast table. The hardware uses 12 bits, from
|
||||
* incoming rx multicast addresses, to determine the bit-vector to check in
|
||||
* the MTA. Which of the 4 combination, of 12-bits, the hardware uses is set
|
||||
* by the MO field of the MCSTCTRL. The MO field is set during initialization
|
||||
* to mc_filter_type.
|
||||
**/
|
||||
static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr)
|
||||
{
|
||||
u32 vector = 0;
|
||||
|
||||
switch (hw->mac.mc_filter_type) {
|
||||
case 0: /* use bits [47:36] of the address */
|
||||
vector = ((mc_addr[4] >> 4) | (((u16)mc_addr[5]) << 4));
|
||||
break;
|
||||
case 1: /* use bits [46:35] of the address */
|
||||
vector = ((mc_addr[4] >> 3) | (((u16)mc_addr[5]) << 5));
|
||||
break;
|
||||
case 2: /* use bits [45:34] of the address */
|
||||
vector = ((mc_addr[4] >> 2) | (((u16)mc_addr[5]) << 6));
|
||||
break;
|
||||
case 3: /* use bits [43:32] of the address */
|
||||
vector = ((mc_addr[4]) | (((u16)mc_addr[5]) << 8));
|
||||
break;
|
||||
default: /* Invalid mc_filter_type */
|
||||
DEBUGOUT("MC filter type param set incorrectly\n");
|
||||
ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
/* vector can only be 12-bits or boundary will be exceeded */
|
||||
vector &= 0xFFF;
|
||||
return vector;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_set_rar_vf - set device MAC address
|
||||
* @hw: pointer to hardware structure
|
||||
* @index: Receive address register to write
|
||||
* @addr: Address to put into receive address register
|
||||
* @vmdq: VMDq "set" or "pool" index
|
||||
* @enable_addr: set flag that address is active
|
||||
**/
|
||||
s32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
|
||||
u32 enable_addr)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
u32 msgbuf[3];
|
||||
u8 *msg_addr = (u8 *)(&msgbuf[1]);
|
||||
s32 ret_val;
|
||||
UNREFERENCED_PARAMETER(vmdq);
|
||||
UNREFERENCED_PARAMETER(enable_addr);
|
||||
UNREFERENCED_PARAMETER(index);
|
||||
|
||||
memset(msgbuf, 0, 12);
|
||||
msgbuf[0] = IXGBE_VF_SET_MAC_ADDR;
|
||||
memcpy(msg_addr, addr, 6);
|
||||
ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0);
|
||||
|
||||
if (!ret_val)
|
||||
ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0);
|
||||
|
||||
msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
|
||||
|
||||
/* if nacked the address was rejected, use "perm_addr" */
|
||||
if (!ret_val &&
|
||||
(msgbuf[0] == (IXGBE_VF_SET_MAC_ADDR | IXGBE_VT_MSGTYPE_NACK)))
|
||||
ixgbe_get_mac_addr_vf(hw, hw->mac.addr);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_update_mc_addr_list_vf - Update Multicast addresses
|
||||
* @hw: pointer to the HW structure
|
||||
* @mc_addr_list: array of multicast addresses to program
|
||||
* @mc_addr_count: number of multicast addresses to program
|
||||
* @next: caller supplied function to return next address in list
|
||||
*
|
||||
* Updates the Multicast Table Array.
|
||||
**/
|
||||
s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
|
||||
u32 mc_addr_count, ixgbe_mc_addr_itr next)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
u32 msgbuf[IXGBE_VFMAILBOX_SIZE];
|
||||
u16 *vector_list = (u16 *)&msgbuf[1];
|
||||
u32 vector;
|
||||
u32 cnt, i;
|
||||
u32 vmdq;
|
||||
|
||||
DEBUGFUNC("ixgbe_update_mc_addr_list_vf");
|
||||
|
||||
/* Each entry in the list uses 1 16 bit word. We have 30
|
||||
* 16 bit words available in our HW msg buffer (minus 1 for the
|
||||
* msg type). That's 30 hash values if we pack 'em right. If
|
||||
* there are more than 30 MC addresses to add then punt the
|
||||
* extras for now and then add code to handle more than 30 later.
|
||||
* It would be unusual for a server to request that many multi-cast
|
||||
* addresses except for in large enterprise network environments.
|
||||
*/
|
||||
|
||||
DEBUGOUT1("MC Addr Count = %d\n", mc_addr_count);
|
||||
|
||||
cnt = (mc_addr_count > 30) ? 30 : mc_addr_count;
|
||||
msgbuf[0] = IXGBE_VF_SET_MULTICAST;
|
||||
msgbuf[0] |= cnt << IXGBE_VT_MSGINFO_SHIFT;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
vector = ixgbe_mta_vector(hw, next(hw, &mc_addr_list, &vmdq));
|
||||
DEBUGOUT1("Hash value = 0x%03X\n", vector);
|
||||
vector_list[i] = (u16)vector;
|
||||
}
|
||||
|
||||
return mbx->ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_set_vfta_vf - Set/Unset vlan filter table address
|
||||
* @hw: pointer to the HW structure
|
||||
* @vlan: 12 bit VLAN ID
|
||||
* @vind: unused by VF drivers
|
||||
* @vlan_on: if TRUE then set bit, else clear bit
|
||||
**/
|
||||
s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on)
|
||||
{
|
||||
struct ixgbe_mbx_info *mbx = &hw->mbx;
|
||||
u32 msgbuf[2];
|
||||
UNREFERENCED_PARAMETER(vind);
|
||||
|
||||
msgbuf[0] = IXGBE_VF_SET_VLAN;
|
||||
msgbuf[1] = vlan;
|
||||
/* Setting the 8 bit field MSG INFO to TRUE indicates "add" */
|
||||
msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT;
|
||||
|
||||
return(mbx->ops.write_posted(hw, msgbuf, 2, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_get_num_of_tx_queues_vf - Get number of TX queues
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Returns the number of transmit queues for the given adapter.
|
||||
**/
|
||||
u32 ixgbe_get_num_of_tx_queues_vf(struct ixgbe_hw *hw)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hw);
|
||||
return IXGBE_VF_MAX_TX_QUEUES;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_get_num_of_rx_queues_vf - Get number of RX queues
|
||||
* @hw: pointer to hardware structure
|
||||
*
|
||||
* Returns the number of receive queues for the given adapter.
|
||||
**/
|
||||
u32 ixgbe_get_num_of_rx_queues_vf(struct ixgbe_hw *hw)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hw);
|
||||
return IXGBE_VF_MAX_RX_QUEUES;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_get_mac_addr_vf - Read device MAC address
|
||||
* @hw: pointer to the HW structure
|
||||
**/
|
||||
s32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < IXGBE_ETH_LENGTH_OF_ADDRESS; i++)
|
||||
mac_addr[i] = hw->mac.perm_addr[i];
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_setup_mac_link_vf - Setup MAC link settings
|
||||
* @hw: pointer to hardware structure
|
||||
* @speed: new link speed
|
||||
* @autoneg: TRUE if autonegotiation enabled
|
||||
* @autoneg_wait_to_complete: TRUE when waiting for completion is needed
|
||||
*
|
||||
* Set the link speed in the AUTOC register and restarts link.
|
||||
**/
|
||||
s32 ixgbe_setup_mac_link_vf(struct ixgbe_hw *hw,
|
||||
ixgbe_link_speed speed, bool autoneg,
|
||||
bool autoneg_wait_to_complete)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hw);
|
||||
UNREFERENCED_PARAMETER(speed);
|
||||
UNREFERENCED_PARAMETER(autoneg);
|
||||
UNREFERENCED_PARAMETER(autoneg_wait_to_complete);
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ixgbe_check_mac_link_vf - Get link/speed status
|
||||
* @hw: pointer to hardware structure
|
||||
* @speed: pointer to link speed
|
||||
* @link_up: TRUE is link is up, FALSE otherwise
|
||||
* @autoneg_wait_to_complete: TRUE when waiting for completion is needed
|
||||
*
|
||||
* Reads the links register to determine if link is up and the current speed
|
||||
**/
|
||||
s32 ixgbe_check_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
|
||||
bool *link_up, bool autoneg_wait_to_complete)
|
||||
{
|
||||
u32 links_reg;
|
||||
UNREFERENCED_PARAMETER(autoneg_wait_to_complete);
|
||||
|
||||
if (!(hw->mbx.ops.check_for_rst(hw, 0))) {
|
||||
*link_up = FALSE;
|
||||
*speed = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
links_reg = IXGBE_VFREAD_REG(hw, IXGBE_VFLINKS);
|
||||
|
||||
if (links_reg & IXGBE_LINKS_UP)
|
||||
*link_up = TRUE;
|
||||
else
|
||||
*link_up = FALSE;
|
||||
|
||||
if ((links_reg & IXGBE_LINKS_SPEED_10G_82599) ==
|
||||
IXGBE_LINKS_SPEED_10G_82599)
|
||||
*speed = IXGBE_LINK_SPEED_10GB_FULL;
|
||||
else
|
||||
*speed = IXGBE_LINK_SPEED_1GB_FULL;
|
||||
|
||||
return IXGBE_SUCCESS;
|
||||
}
|
||||
|
113
sys/dev/ixgbe/ixgbe_vf.h
Normal file
113
sys/dev/ixgbe/ixgbe_vf.h
Normal file
@ -0,0 +1,113 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, 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_VF_H__
|
||||
#define __IXGBE_VF_H__
|
||||
|
||||
#define IXGBE_VF_IRQ_CLEAR_MASK 7
|
||||
#define IXGBE_VF_MAX_TX_QUEUES 8
|
||||
#define IXGBE_VF_MAX_RX_QUEUES 8
|
||||
|
||||
#define IXGBE_VFCTRL 0x00000
|
||||
#define IXGBE_VFSTATUS 0x00008
|
||||
#define IXGBE_VFLINKS 0x00010
|
||||
#define IXGBE_VFFRTIMER 0x00048
|
||||
#define IXGBE_VFRXMEMWRAP 0x03190
|
||||
#define IXGBE_VTEICR 0x00100
|
||||
#define IXGBE_VTEICS 0x00104
|
||||
#define IXGBE_VTEIMS 0x00108
|
||||
#define IXGBE_VTEIMC 0x0010C
|
||||
#define IXGBE_VTEIAC 0x00110
|
||||
#define IXGBE_VTEIAM 0x00114
|
||||
#define IXGBE_VTEITR(x) (0x00820 + (4 * x))
|
||||
#define IXGBE_VTIVAR(x) (0x00120 + (4 * x))
|
||||
#define IXGBE_VTIVAR_MISC 0x00140
|
||||
#define IXGBE_VTRSCINT(x) (0x00180 + (4 * x))
|
||||
/* define IXGBE_VFPBACL still says TBD in EAS */
|
||||
#define IXGBE_VFRDBAL(x) (0x01000 + (0x40 * x))
|
||||
#define IXGBE_VFRDBAH(x) (0x01004 + (0x40 * x))
|
||||
#define IXGBE_VFRDLEN(x) (0x01008 + (0x40 * x))
|
||||
#define IXGBE_VFRDH(x) (0x01010 + (0x40 * x))
|
||||
#define IXGBE_VFRDT(x) (0x01018 + (0x40 * x))
|
||||
#define IXGBE_VFRXDCTL(x) (0x01028 + (0x40 * x))
|
||||
#define IXGBE_VFSRRCTL(x) (0x01014 + (0x40 * x))
|
||||
#define IXGBE_VFRSCCTL(x) (0x0102C + (0x40 * x))
|
||||
#define IXGBE_VFPSRTYPE 0x00300
|
||||
#define IXGBE_VFTDBAL(x) (0x02000 + (0x40 * x))
|
||||
#define IXGBE_VFTDBAH(x) (0x02004 + (0x40 * x))
|
||||
#define IXGBE_VFTDLEN(x) (0x02008 + (0x40 * x))
|
||||
#define IXGBE_VFTDH(x) (0x02010 + (0x40 * x))
|
||||
#define IXGBE_VFTDT(x) (0x02018 + (0x40 * x))
|
||||
#define IXGBE_VFTXDCTL(x) (0x02028 + (0x40 * x))
|
||||
#define IXGBE_VFTDWBAL(x) (0x02038 + (0x40 * x))
|
||||
#define IXGBE_VFTDWBAH(x) (0x0203C + (0x40 * x))
|
||||
#define IXGBE_VFDCA_RXCTRL(x) (0x0100C + (0x40 * x))
|
||||
#define IXGBE_VFDCA_TXCTRL(x) (0x0200c + (0x40 * x))
|
||||
#define IXGBE_VFGPRC 0x0101C
|
||||
#define IXGBE_VFGPTC 0x0201C
|
||||
#define IXGBE_VFGORC_LSB 0x01020
|
||||
#define IXGBE_VFGORC_MSB 0x01024
|
||||
#define IXGBE_VFGOTC_LSB 0x02020
|
||||
#define IXGBE_VFGOTC_MSB 0x02024
|
||||
#define IXGBE_VFMPRC 0x01034
|
||||
|
||||
|
||||
struct ixgbevf_hw_stats {
|
||||
u64 base_vfgprc;
|
||||
u64 base_vfgptc;
|
||||
u64 base_vfgorc;
|
||||
u64 base_vfgotc;
|
||||
u64 base_vfmprc;
|
||||
|
||||
u64 last_vfgprc;
|
||||
u64 last_vfgptc;
|
||||
u64 last_vfgorc;
|
||||
u64 last_vfgotc;
|
||||
u64 last_vfmprc;
|
||||
|
||||
u64 vfgprc;
|
||||
u64 vfgptc;
|
||||
u64 vfgorc;
|
||||
u64 vfgotc;
|
||||
u64 vfmprc;
|
||||
|
||||
u64 saved_reset_vfgprc;
|
||||
u64 saved_reset_vfgptc;
|
||||
u64 saved_reset_vfgorc;
|
||||
u64 saved_reset_vfgotc;
|
||||
u64 saved_reset_vfmprc;
|
||||
};
|
||||
|
||||
#endif /* __IXGBE_VF_H__ */
|
||||
|
3950
sys/dev/ixgbe/ixv.c
Normal file
3950
sys/dev/ixgbe/ixv.c
Normal file
File diff suppressed because it is too large
Load Diff
414
sys/dev/ixgbe/ixv.h
Normal file
414
sys/dev/ixgbe/ixv.h
Normal file
@ -0,0 +1,414 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, 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 _IXV_H_
|
||||
#define _IXV_H_
|
||||
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sockio.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <net/bpf.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/if_vlan_var.h>
|
||||
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip6.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcp_lro.h>
|
||||
#include <netinet/udp.h>
|
||||
|
||||
#include <machine/in_cksum.h>
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <machine/resource.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <machine/clock.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/taskqueue.h>
|
||||
#include <sys/pcpu.h>
|
||||
#include <sys/smp.h>
|
||||
#include <machine/smp.h>
|
||||
|
||||
#include "ixgbe_api.h"
|
||||
#include "ixgbe_vf.h"
|
||||
|
||||
/* Tunables */
|
||||
|
||||
/*
|
||||
* TxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the
|
||||
* number of transmit descriptors allocated by the driver. Increasing this
|
||||
* value allows the driver to queue more transmits. Each descriptor is 16
|
||||
* bytes. Performance tests have show the 2K value to be optimal for top
|
||||
* performance.
|
||||
*/
|
||||
#define DEFAULT_TXD 1024
|
||||
#define PERFORM_TXD 2048
|
||||
#define MAX_TXD 4096
|
||||
#define MIN_TXD 64
|
||||
|
||||
/*
|
||||
* RxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the
|
||||
* number of receive descriptors allocated for each RX queue. Increasing this
|
||||
* value allows the driver to buffer more incoming packets. Each descriptor
|
||||
* is 16 bytes. A receive buffer is also allocated for each descriptor.
|
||||
*
|
||||
* Note: with 8 rings and a dual port card, it is possible to bump up
|
||||
* against the system mbuf pool limit, you can tune nmbclusters
|
||||
* to adjust for this.
|
||||
*/
|
||||
#define DEFAULT_RXD 1024
|
||||
#define PERFORM_RXD 2048
|
||||
#define MAX_RXD 4096
|
||||
#define MIN_RXD 64
|
||||
|
||||
/* Alignment for rings */
|
||||
#define DBA_ALIGN 128
|
||||
|
||||
/*
|
||||
* This parameter controls the maximum no of times the driver will loop in
|
||||
* the isr. Minimum Value = 1
|
||||
*/
|
||||
#define MAX_LOOP 10
|
||||
|
||||
/*
|
||||
* This is the max watchdog interval, ie. the time that can
|
||||
* pass between any two TX clean operations, such only happening
|
||||
* when the TX hardware is functioning.
|
||||
*/
|
||||
#define IXV_WATCHDOG (10 * hz)
|
||||
|
||||
/*
|
||||
* This parameters control when the driver calls the routine to reclaim
|
||||
* transmit descriptors.
|
||||
*/
|
||||
#define IXV_TX_CLEANUP_THRESHOLD (adapter->num_tx_desc / 8)
|
||||
#define IXV_TX_OP_THRESHOLD (adapter->num_tx_desc / 32)
|
||||
|
||||
#define IXV_MAX_FRAME_SIZE 0x3F00
|
||||
|
||||
/* Flow control constants */
|
||||
#define IXV_FC_PAUSE 0xFFFF
|
||||
#define IXV_FC_HI 0x20000
|
||||
#define IXV_FC_LO 0x10000
|
||||
|
||||
/* Defines for printing debug information */
|
||||
#define DEBUG_INIT 0
|
||||
#define DEBUG_IOCTL 0
|
||||
#define DEBUG_HW 0
|
||||
|
||||
#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n")
|
||||
#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A)
|
||||
#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B)
|
||||
#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n")
|
||||
#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A)
|
||||
#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B)
|
||||
#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n")
|
||||
#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A)
|
||||
#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B)
|
||||
|
||||
#define MAX_NUM_MULTICAST_ADDRESSES 128
|
||||
#define IXV_EITR_DEFAULT 128
|
||||
#define IXV_SCATTER 32
|
||||
#define IXV_RX_HDR 128
|
||||
#define MSIX_BAR 3
|
||||
#define IXV_TSO_SIZE 65535
|
||||
#define IXV_BR_SIZE 4096
|
||||
#define IXV_LINK_ITR 2000
|
||||
#define TX_BUFFER_SIZE ((u32) 1514)
|
||||
#define VFTA_SIZE 128
|
||||
|
||||
/* Offload bits in mbuf flag */
|
||||
#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP)
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
* vendor_info_array
|
||||
*
|
||||
* This array contains the list of Subvendor/Subdevice IDs on which the driver
|
||||
* should load.
|
||||
*
|
||||
*****************************************************************************
|
||||
*/
|
||||
typedef struct _ixv_vendor_info_t {
|
||||
unsigned int vendor_id;
|
||||
unsigned int device_id;
|
||||
unsigned int subvendor_id;
|
||||
unsigned int subdevice_id;
|
||||
unsigned int index;
|
||||
} ixv_vendor_info_t;
|
||||
|
||||
|
||||
struct ixv_tx_buf {
|
||||
u32 eop_index;
|
||||
struct mbuf *m_head;
|
||||
bus_dmamap_t map;
|
||||
};
|
||||
|
||||
struct ixv_rx_buf {
|
||||
struct mbuf *m_head;
|
||||
struct mbuf *m_pack;
|
||||
struct mbuf *fmp;
|
||||
bus_dmamap_t hmap;
|
||||
bus_dmamap_t pmap;
|
||||
};
|
||||
|
||||
/*
|
||||
* Bus dma allocation structure used by ixv_dma_malloc and ixv_dma_free.
|
||||
*/
|
||||
struct ixv_dma_alloc {
|
||||
bus_addr_t dma_paddr;
|
||||
caddr_t dma_vaddr;
|
||||
bus_dma_tag_t dma_tag;
|
||||
bus_dmamap_t dma_map;
|
||||
bus_dma_segment_t dma_seg;
|
||||
bus_size_t dma_size;
|
||||
int dma_nseg;
|
||||
};
|
||||
|
||||
/*
|
||||
** Driver queue struct: this is the interrupt container
|
||||
** for the associated tx and rx ring.
|
||||
*/
|
||||
struct ix_queue {
|
||||
struct adapter *adapter;
|
||||
u32 msix; /* This queue's MSIX vector */
|
||||
u32 eims; /* This queue's EIMS bit */
|
||||
u32 eitr_setting;
|
||||
u32 eitr; /* cached reg */
|
||||
struct resource *res;
|
||||
void *tag;
|
||||
struct tx_ring *txr;
|
||||
struct rx_ring *rxr;
|
||||
struct task que_task;
|
||||
struct taskqueue *tq;
|
||||
u64 irqs;
|
||||
};
|
||||
|
||||
/*
|
||||
* The transmit ring, one per queue
|
||||
*/
|
||||
struct tx_ring {
|
||||
struct adapter *adapter;
|
||||
struct mtx tx_mtx;
|
||||
u32 me;
|
||||
bool watchdog_check;
|
||||
int watchdog_time;
|
||||
union ixgbe_adv_tx_desc *tx_base;
|
||||
struct ixv_dma_alloc txdma;
|
||||
u32 next_avail_desc;
|
||||
u32 next_to_clean;
|
||||
struct ixv_tx_buf *tx_buffers;
|
||||
volatile u16 tx_avail;
|
||||
u32 txd_cmd;
|
||||
bus_dma_tag_t txtag;
|
||||
char mtx_name[16];
|
||||
struct buf_ring *br;
|
||||
/* Soft Stats */
|
||||
u32 bytes;
|
||||
u32 packets;
|
||||
u64 no_desc_avail;
|
||||
u64 total_packets;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* The Receive ring, one per rx queue
|
||||
*/
|
||||
struct rx_ring {
|
||||
struct adapter *adapter;
|
||||
struct mtx rx_mtx;
|
||||
u32 me;
|
||||
union ixgbe_adv_rx_desc *rx_base;
|
||||
struct ixv_dma_alloc rxdma;
|
||||
struct lro_ctrl lro;
|
||||
bool lro_enabled;
|
||||
bool hdr_split;
|
||||
bool discard;
|
||||
u32 next_to_refresh;
|
||||
u32 next_to_check;
|
||||
char mtx_name[16];
|
||||
struct ixv_rx_buf *rx_buffers;
|
||||
bus_dma_tag_t htag;
|
||||
bus_dma_tag_t ptag;
|
||||
|
||||
u32 bytes; /* Used for AIM calc */
|
||||
u32 packets;
|
||||
|
||||
/* Soft stats */
|
||||
u64 rx_irq;
|
||||
u64 rx_split_packets;
|
||||
u64 rx_packets;
|
||||
u64 rx_bytes;
|
||||
u64 rx_discarded;
|
||||
};
|
||||
|
||||
/* Our adapter structure */
|
||||
struct adapter {
|
||||
struct ifnet *ifp;
|
||||
struct ixgbe_hw hw;
|
||||
|
||||
struct ixgbe_osdep osdep;
|
||||
struct device *dev;
|
||||
|
||||
struct resource *pci_mem;
|
||||
struct resource *msix_mem;
|
||||
|
||||
/*
|
||||
* Interrupt resources: this set is
|
||||
* either used for legacy, or for Link
|
||||
* when doing MSIX
|
||||
*/
|
||||
void *tag;
|
||||
struct resource *res;
|
||||
|
||||
struct ifmedia media;
|
||||
struct callout timer;
|
||||
int msix;
|
||||
int if_flags;
|
||||
|
||||
struct mtx core_mtx;
|
||||
|
||||
eventhandler_tag vlan_attach;
|
||||
eventhandler_tag vlan_detach;
|
||||
|
||||
u16 num_vlans;
|
||||
u16 num_queues;
|
||||
|
||||
/* Info about the board itself */
|
||||
bool link_active;
|
||||
u16 max_frame_size;
|
||||
u32 link_speed;
|
||||
bool link_up;
|
||||
u32 mbxvec;
|
||||
|
||||
/* Mbuf cluster size */
|
||||
u32 rx_mbuf_sz;
|
||||
|
||||
/* Support for pluggable optics */
|
||||
struct task mbx_task; /* Mailbox tasklet */
|
||||
struct taskqueue *tq;
|
||||
|
||||
/*
|
||||
** Queues:
|
||||
** This is the irq holder, it has
|
||||
** and RX/TX pair or rings associated
|
||||
** with it.
|
||||
*/
|
||||
struct ix_queue *queues;
|
||||
|
||||
/*
|
||||
* Transmit rings:
|
||||
* Allocated at run time, an array of rings.
|
||||
*/
|
||||
struct tx_ring *tx_rings;
|
||||
int num_tx_desc;
|
||||
|
||||
/*
|
||||
* Receive rings:
|
||||
* Allocated at run time, an array of rings.
|
||||
*/
|
||||
struct rx_ring *rx_rings;
|
||||
int num_rx_desc;
|
||||
u64 que_mask;
|
||||
u32 rx_process_limit;
|
||||
|
||||
/* Misc stats maintained by the driver */
|
||||
unsigned long dropped_pkts;
|
||||
unsigned long mbuf_defrag_failed;
|
||||
unsigned long mbuf_header_failed;
|
||||
unsigned long mbuf_packet_failed;
|
||||
unsigned long no_tx_map_avail;
|
||||
unsigned long no_tx_dma_setup;
|
||||
unsigned long watchdog_events;
|
||||
unsigned long tso_tx;
|
||||
unsigned long mbx_irq;
|
||||
|
||||
struct ixgbevf_hw_stats stats;
|
||||
};
|
||||
|
||||
|
||||
#define IXV_CORE_LOCK_INIT(_sc, _name) \
|
||||
mtx_init(&(_sc)->core_mtx, _name, "IXV Core Lock", MTX_DEF)
|
||||
#define IXV_CORE_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->core_mtx)
|
||||
#define IXV_TX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->tx_mtx)
|
||||
#define IXV_RX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->rx_mtx)
|
||||
#define IXV_CORE_LOCK(_sc) mtx_lock(&(_sc)->core_mtx)
|
||||
#define IXV_TX_LOCK(_sc) mtx_lock(&(_sc)->tx_mtx)
|
||||
#define IXV_TX_TRYLOCK(_sc) mtx_trylock(&(_sc)->tx_mtx)
|
||||
#define IXV_RX_LOCK(_sc) mtx_lock(&(_sc)->rx_mtx)
|
||||
#define IXV_CORE_UNLOCK(_sc) mtx_unlock(&(_sc)->core_mtx)
|
||||
#define IXV_TX_UNLOCK(_sc) mtx_unlock(&(_sc)->tx_mtx)
|
||||
#define IXV_RX_UNLOCK(_sc) mtx_unlock(&(_sc)->rx_mtx)
|
||||
#define IXV_CORE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->core_mtx, MA_OWNED)
|
||||
#define IXV_TX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->tx_mtx, MA_OWNED)
|
||||
|
||||
/* Workaround to make 8.0 buildable */
|
||||
#if __FreeBSD_version < 800504
|
||||
static __inline int
|
||||
drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br)
|
||||
{
|
||||
#ifdef ALTQ
|
||||
if (ALTQ_IS_ENABLED(&ifp->if_snd))
|
||||
return (1);
|
||||
#endif
|
||||
return (!buf_ring_empty(br));
|
||||
}
|
||||
#endif
|
||||
#endif /* _IXV_H_ */
|
@ -2,9 +2,9 @@
|
||||
.PATH: ${.CURDIR}/../../dev/ixgbe
|
||||
KMOD = ixgbe
|
||||
SRCS = device_if.h bus_if.h pci_if.h
|
||||
SRCS += ixgbe.c
|
||||
SRCS += ixgbe.c ixv.c
|
||||
# Shared source
|
||||
SRCS += ixgbe_common.c ixgbe_api.c ixgbe_phy.c
|
||||
SRCS += ixgbe_common.c ixgbe_api.c ixgbe_phy.c ixgbe_mbx.c ixgbe_vf.c
|
||||
SRCS += ixgbe_82599.c ixgbe_82598.c
|
||||
CFLAGS+= -I${.CURDIR}/../../dev/ixgbe -DSMP -DIXGBE_FDIR
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user