version 1.9, 2015/05/21 00:45:27 |
version 1.10, 2015/08/05 04:08:44 |
|
|
POSSIBILITY OF SUCH DAMAGE. |
POSSIBILITY OF SUCH DAMAGE. |
|
|
******************************************************************************/ |
******************************************************************************/ |
/*$FreeBSD: head/sys/dev/ixgbe/ixv.c 247822 2013-03-04 23:07:40Z jfv $*/ |
/*$FreeBSD: head/sys/dev/ixgbe/ixv.c 275358 2014-12-01 11:45:24Z hselasky $*/ |
/*$NetBSD$*/ |
/*$NetBSD$*/ |
|
|
#include "opt_inet.h" |
#include "opt_inet.h" |
Line 401 ixv_attach(device_t parent, device_t dev |
|
Line 401 ixv_attach(device_t parent, device_t dev |
|
adapter->num_tx_desc = ixv_txd; |
adapter->num_tx_desc = ixv_txd; |
|
|
if (((ixv_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || |
if (((ixv_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 || |
ixv_rxd < MIN_TXD || ixv_rxd > MAX_TXD) { |
ixv_rxd < MIN_RXD || ixv_rxd > MAX_RXD) { |
aprint_error_dev(dev, "RXD config issue, using default!\n"); |
aprint_error_dev(dev, "RXD config issue, using default!\n"); |
adapter->num_rx_desc = DEFAULT_RXD; |
adapter->num_rx_desc = DEFAULT_RXD; |
} else |
} else |
Line 1630 ixv_identify_hardware(struct adapter *ad |
|
Line 1630 ixv_identify_hardware(struct adapter *ad |
|
** KVM it may not be and will break things. |
** KVM it may not be and will break things. |
*/ |
*/ |
pci_cmd_word = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); |
pci_cmd_word = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); |
if (!((pci_cmd_word & PCI_COMMAND_MASTER_ENABLE) && |
if (!(pci_cmd_word & PCI_COMMAND_MASTER_ENABLE)) { |
(pci_cmd_word & PCI_COMMAND_MEM_ENABLE))) { |
INIT_DEBUGOUT("Bus Master bit was not set!\n"); |
INIT_DEBUGOUT("Memory Access and/or Bus Master " |
pci_cmd_word |= PCI_COMMAND_MASTER_ENABLE; |
"bits were not set!\n"); |
|
pci_cmd_word |= |
|
(PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_MEM_ENABLE); |
|
pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, pci_cmd_word); |
pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, pci_cmd_word); |
} |
} |
|
|
Line 1741 ixv_allocate_msix(struct adapter *adapte |
|
Line 1738 ixv_allocate_msix(struct adapter *adapte |
|
*/ |
*/ |
if (adapter->hw.mac.type == ixgbe_mac_82599_vf) { |
if (adapter->hw.mac.type == ixgbe_mac_82599_vf) { |
int msix_ctrl; |
int msix_ctrl; |
pci_get_capability(pc, tag, PCI_CAP_MSIX, &rid); |
pci_get_capability(pc, tag, PCI_CAP_MSIX, &rid, NULL); |
rid += PCI_MSIX_CTL; |
rid += PCI_MSIX_CTL; |
msix_ctrl = pci_read_config(pc, tag, rid); |
msix_ctrl = pci_read_config(pc, tag, rid); |
msix_ctrl |= PCI_MSIX_CTL_ENABLE; |
msix_ctrl |= PCI_MSIX_CTL_ENABLE; |
Line 1763 ixv_setup_msix(struct adapter *adapter) |
|
Line 1760 ixv_setup_msix(struct adapter *adapter) |
|
return 0; |
return 0; |
#else |
#else |
device_t dev = adapter->dev; |
device_t dev = adapter->dev; |
int rid, vectors, want = 2; |
int rid, want; |
|
|
|
|
/* First try MSI/X */ |
/* First try MSI/X */ |
rid = PCIR_BAR(3); |
rid = PCIR_BAR(3); |
adapter->msix_mem = bus_alloc_resource_any(dev, |
adapter->msix_mem = bus_alloc_resource_any(dev, |
SYS_RES_MEMORY, &rid, RF_ACTIVE); |
SYS_RES_MEMORY, &rid, RF_ACTIVE); |
if (!adapter->msix_mem) { |
if (adapter->msix_mem == NULL) { |
device_printf(adapter->dev, |
device_printf(adapter->dev, |
"Unable to map MSIX table \n"); |
"Unable to map MSIX table \n"); |
goto out; |
goto out; |
} |
} |
|
|
vectors = pci_msix_count(dev); |
|
if (vectors < 2) { |
|
bus_release_resource(dev, SYS_RES_MEMORY, |
|
rid, adapter->msix_mem); |
|
adapter->msix_mem = NULL; |
|
goto out; |
|
} |
|
|
|
/* |
/* |
** Want two vectors: one for a queue, |
** Want two vectors: one for a queue, |
** plus an additional for mailbox. |
** plus an additional for mailbox. |
*/ |
*/ |
if (pci_alloc_msix(dev, &want) == 0) { |
want = 2; |
|
if ((pci_alloc_msix(dev, &want) == 0) && (want == 2)) { |
device_printf(adapter->dev, |
device_printf(adapter->dev, |
"Using MSIX interrupts with %d vectors\n", want); |
"Using MSIX interrupts with %d vectors\n", want); |
return (want); |
return (want); |
} |
} |
|
/* Release in case alloc was insufficient */ |
|
pci_release_msi(dev); |
out: |
out: |
|
if (adapter->msix_mem != NULL) { |
|
bus_release_resource(dev, SYS_RES_MEMORY, |
|
rid, adapter->msix_mem); |
|
adapter->msix_mem = NULL; |
|
} |
device_printf(adapter->dev,"MSIX config error\n"); |
device_printf(adapter->dev,"MSIX config error\n"); |
return (ENXIO); |
return (ENXIO); |
#endif |
#endif |
|
|
fail_1: |
fail_1: |
ixgbe_dma_tag_destroy(dma->dma_tag); |
ixgbe_dma_tag_destroy(dma->dma_tag); |
fail_0: |
fail_0: |
dma->dma_map = NULL; |
|
dma->dma_tag = NULL; |
dma->dma_tag = NULL; |
return (r); |
return (r); |
} |
} |
Line 3697 ixv_rx_checksum(u32 staterr, struct mbuf |
|
Line 3693 ixv_rx_checksum(u32 staterr, struct mbuf |
|
} |
} |
if (status & IXGBE_RXD_STAT_L4CS) { |
if (status & IXGBE_RXD_STAT_L4CS) { |
stats->l4cs.ev_count++; |
stats->l4cs.ev_count++; |
u16 type = M_CSUM_TCPv4|M_CSUM_TCPv6|M_CSUM_UDPv4|M_CSUM_UDPv6; |
int type = M_CSUM_TCPv4|M_CSUM_TCPv6|M_CSUM_UDPv4|M_CSUM_UDPv6; |
if (!(errors & IXGBE_RXD_ERR_TCPE)) { |
if (!(errors & IXGBE_RXD_ERR_TCPE)) { |
mp->m_pkthdr.csum_flags |= type; |
mp->m_pkthdr.csum_flags |= type; |
} else { |
} else { |