From b0329d64c51134df37a390e5f8939a32446fde8a Mon Sep 17 00:00:00 2001 From: davidcs Date: Thu, 5 Apr 2018 00:03:38 +0000 Subject: [PATCH] MFC r331739 1. Add additional debug prints. 2. Break transmit when IFF_DRV_RUNNING is OFF. 3. set desc_count=0 for default case in switch in ql_rcv_isr() git-svn-id: svn://svn.freebsd.org/base/stable/9@332054 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/qlxgbe/ql_dbg.h | 1 + sys/dev/qlxgbe/ql_hw.c | 35 +++++++++++++++++++++++++++++++---- sys/dev/qlxgbe/ql_ioctl.c | 5 +++-- sys/dev/qlxgbe/ql_isr.c | 1 + sys/dev/qlxgbe/ql_os.c | 18 +++++++++++++++--- sys/dev/qlxgbe/ql_ver.h | 2 +- 6 files changed, 52 insertions(+), 10 deletions(-) diff --git a/sys/dev/qlxgbe/ql_dbg.h b/sys/dev/qlxgbe/ql_dbg.h index 863a7c8f2..f01bc5b0f 100644 --- a/sys/dev/qlxgbe/ql_dbg.h +++ b/sys/dev/qlxgbe/ql_dbg.h @@ -57,6 +57,7 @@ extern void ql_dump_buf32(qla_host_t *ha, const char *str, void *dbuf, #define INJCT_SGL_RCV_INV_DESC_COUNT 0x0000D #define INJCT_SGL_LRO_INV_DESC_COUNT 0x0000E #define INJCT_PEER_PORT_FAILURE_ERR_RECOVERY 0x0000F +#define INJCT_TXBUF_MBUF_NON_NULL 0x00010 #ifdef QL_DBG diff --git a/sys/dev/qlxgbe/ql_hw.c b/sys/dev/qlxgbe/ql_hw.c index 45aab1222..4c3381f1e 100644 --- a/sys/dev/qlxgbe/ql_hw.c +++ b/sys/dev/qlxgbe/ql_hw.c @@ -1088,7 +1088,11 @@ ql_hw_add_sysctls(qla_host_t *ha) "\t\t\t 8: mbx: mailbox command failure\n" "\t\t\t 9: heartbeat failure\n" "\t\t\t A: temperature failure\n" - "\t\t\t 11: m_getcl or m_getjcl failure\n" ); + "\t\t\t 11: m_getcl or m_getjcl failure\n" + "\t\t\t 13: Invalid Descriptor Count in SGL Receive\n" + "\t\t\t 14: Invalid Descriptor Count in LRO Receive\n" + "\t\t\t 15: peer port error recovery failure\n" + "\t\t\t 16: tx_buf[next_prod_index].mbuf != NULL\n" ); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), @@ -2904,7 +2908,7 @@ ql_del_hw_if_exit: void qla_confirm_9kb_enable(qla_host_t *ha) { - uint32_t supports_9kb = 0; +// uint32_t supports_9kb = 0; ha->hw.mbx_intr_mask_offset = READ_REG32(ha, Q8_MBOX_INT_MASK_MSIX); @@ -2912,10 +2916,12 @@ qla_confirm_9kb_enable(qla_host_t *ha) WRITE_REG32(ha, Q8_MBOX_INT_ENABLE, BIT_2); WRITE_REG32(ha, ha->hw.mbx_intr_mask_offset, 0x0); +#if 0 qla_get_nic_partition(ha, &supports_9kb, NULL); if (!supports_9kb) - ha->hw.enable_9kb = 0; +#endif + ha->hw.enable_9kb = 0; return; } @@ -3587,6 +3593,13 @@ qla_hw_all_mcast(qla_host_t *ha, uint32_t add_mcast) bcopy(ha->hw.mcast[i].addr, mcast, ETHER_ADDR_LEN); mcast = mcast + ETHER_ADDR_LEN; count++; + + device_printf(ha->pci_dev, + "%s: %x:%x:%x:%x:%x:%x \n", + __func__, ha->hw.mcast[i].addr[0], + ha->hw.mcast[i].addr[1], ha->hw.mcast[i].addr[2], + ha->hw.mcast[i].addr[3], ha->hw.mcast[i].addr[4], + ha->hw.mcast[i].addr[5]); if (count == Q8_MAX_MAC_ADDRS) { if (qla_config_mac_addr(ha, ha->hw.mac_addr_arr, @@ -3823,6 +3836,18 @@ ql_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx) } hw_tx_cntxt->txr_free += comp_count; + + if (hw_tx_cntxt->txr_free > NUM_TX_DESCRIPTORS) + device_printf(ha->pci_dev, "%s [%d]: txr_idx = %d txr_free = %d" + "txr_next = %d txr_comp = %d\n", __func__, __LINE__, + txr_idx, hw_tx_cntxt->txr_free, + hw_tx_cntxt->txr_next, hw_tx_cntxt->txr_comp); + + QL_ASSERT(ha, (hw_tx_cntxt->txr_free <= NUM_TX_DESCRIPTORS), \ + ("%s [%d]: txr_idx = %d txr_free = %d txr_next = %d txr_comp = %d\n",\ + __func__, __LINE__, txr_idx, hw_tx_cntxt->txr_free, \ + hw_tx_cntxt->txr_next, hw_tx_cntxt->txr_comp)); + return; } @@ -3959,7 +3984,9 @@ qla_init_nic_func(qla_host_t *ha) if (err) { device_printf(dev, "%s: failed [0x%08x]\n", __func__, err); - } + } else { + device_printf(dev, "%s: successful\n", __func__); + } return 0; } diff --git a/sys/dev/qlxgbe/ql_ioctl.c b/sys/dev/qlxgbe/ql_ioctl.c index 377c28ecb..176154425 100644 --- a/sys/dev/qlxgbe/ql_ioctl.c +++ b/sys/dev/qlxgbe/ql_ioctl.c @@ -267,7 +267,8 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, } } else { - if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { +#define QLA_LOCK_MDUMP_MS_TIMEOUT (QLA_LOCK_DEFAULT_MS_TIMEOUT * 5) + if (QLA_LOCK(ha, __func__, QLA_LOCK_MDUMP_MS_TIMEOUT, 0) == 0) { if (!ha->hw.mdump_done) { fw_dump->saved = 0; QL_INITIATE_RECOVERY(ha); @@ -301,7 +302,7 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, } fw_dump->usec_ts = ha->hw.mdump_usec_ts; - if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, 0) == 0) { + if (QLA_LOCK(ha, __func__, QLA_LOCK_MDUMP_MS_TIMEOUT, 0) == 0) { ha->hw.mdump_done = 0; QLA_UNLOCK(ha, __func__); } else { diff --git a/sys/dev/qlxgbe/ql_isr.c b/sys/dev/qlxgbe/ql_isr.c index d147df3e6..921169297 100644 --- a/sys/dev/qlxgbe/ql_isr.c +++ b/sys/dev/qlxgbe/ql_isr.c @@ -703,6 +703,7 @@ ql_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t count) break; default: + desc_count = 0; device_printf(dev, "%s: default 0x%llx!\n", __func__, (long long unsigned int)sdesc->data[0]); break; diff --git a/sys/dev/qlxgbe/ql_os.c b/sys/dev/qlxgbe/ql_os.c index d4f3c2948..7444d8b4c 100644 --- a/sys/dev/qlxgbe/ql_os.c +++ b/sys/dev/qlxgbe/ql_os.c @@ -1308,13 +1308,20 @@ qla_send(qla_host_t *ha, struct mbuf **m_headp, uint32_t txr_idx, tx_idx = ha->hw.tx_cntxt[txr_idx].txr_next; - if (NULL != ha->tx_ring[txr_idx].tx_buf[tx_idx].m_head) { + if ((NULL != ha->tx_ring[txr_idx].tx_buf[tx_idx].m_head) || + (QL_ERR_INJECT(ha, INJCT_TXBUF_MBUF_NON_NULL))){ QL_ASSERT(ha, 0, ("%s [%d]: txr_idx = %d tx_idx = %d "\ "mbuf = %p\n", __func__, __LINE__, txr_idx, tx_idx,\ ha->tx_ring[txr_idx].tx_buf[tx_idx].m_head)); + + device_printf(ha->pci_dev, "%s [%d]: txr_idx = %d tx_idx = %d " + "mbuf = %p\n", __func__, __LINE__, txr_idx, tx_idx, + ha->tx_ring[txr_idx].tx_buf[tx_idx].m_head); + if (m_head) m_freem(m_head); *m_headp = NULL; + QL_INITIATE_RECOVERY(ha); return (ret); } @@ -1472,7 +1479,7 @@ qla_fp_taskqueue(void *context, int pending) } while (rx_pkts_left && !ha->stop_rcv && - (ifp->if_drv_flags & IFF_DRV_RUNNING)) { + (ifp->if_drv_flags & IFF_DRV_RUNNING) && ha->hw.link_up) { rx_pkts_left = ql_rcv_isr(ha, fp->txr_idx, 64); #ifdef QL_ENABLE_ISCSI_TLV @@ -1517,7 +1524,9 @@ qla_fp_taskqueue(void *context, int pending) /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, mp); - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + + if (((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) || + (!ha->hw.link_up)) break; mp = drbr_peek(ifp, fp->tx_br); @@ -1525,6 +1534,9 @@ qla_fp_taskqueue(void *context, int pending) } mtx_unlock(&fp->tx_mtx); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + goto qla_fp_taskqueue_exit; + qla_fp_taskqueue_exit0: if (rx_pkts_left || ((mp != NULL) && ret)) { diff --git a/sys/dev/qlxgbe/ql_ver.h b/sys/dev/qlxgbe/ql_ver.h index 9887ac6c4..6d7a31882 100644 --- a/sys/dev/qlxgbe/ql_ver.h +++ b/sys/dev/qlxgbe/ql_ver.h @@ -36,6 +36,6 @@ #define QLA_VERSION_MAJOR 3 #define QLA_VERSION_MINOR 10 -#define QLA_VERSION_BUILD 36 +#define QLA_VERSION_BUILD 37 #endif /* #ifndef _QL_VER_H_ */ -- 2.42.0