Author: davidcs
Date: Wed Apr  4 23:53:29 2018
New Revision: 332052
URL: https://svnweb.freebsd.org/changeset/base/332052

Log:
  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()

Modified:
  stable/11/sys/dev/qlxgbe/ql_dbg.h
  stable/11/sys/dev/qlxgbe/ql_hw.c
  stable/11/sys/dev/qlxgbe/ql_ioctl.c
  stable/11/sys/dev/qlxgbe/ql_isr.c
  stable/11/sys/dev/qlxgbe/ql_os.c
  stable/11/sys/dev/qlxgbe/ql_ver.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/qlxgbe/ql_dbg.h
==============================================================================
--- stable/11/sys/dev/qlxgbe/ql_dbg.h   Wed Apr  4 23:30:19 2018        
(r332051)
+++ stable/11/sys/dev/qlxgbe/ql_dbg.h   Wed Apr  4 23:53:29 2018        
(r332052)
@@ -57,6 +57,7 @@ extern void ql_dump_buf32(qla_host_t *ha, const char *
 #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
 

Modified: stable/11/sys/dev/qlxgbe/ql_hw.c
==============================================================================
--- stable/11/sys/dev/qlxgbe/ql_hw.c    Wed Apr  4 23:30:19 2018        
(r332051)
+++ stable/11/sys/dev/qlxgbe/ql_hw.c    Wed Apr  4 23:53:29 2018        
(r332052)
@@ -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;
 }

Modified: stable/11/sys/dev/qlxgbe/ql_ioctl.c
==============================================================================
--- stable/11/sys/dev/qlxgbe/ql_ioctl.c Wed Apr  4 23:30:19 2018        
(r332051)
+++ stable/11/sys/dev/qlxgbe/ql_ioctl.c Wed Apr  4 23:53:29 2018        
(r332052)
@@ -267,7 +267,8 @@ ql_eioctl(struct cdev *dev, u_long cmd, caddr_t data, 
                        }
                } 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, 
                        }
                        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 {

Modified: stable/11/sys/dev/qlxgbe/ql_isr.c
==============================================================================
--- stable/11/sys/dev/qlxgbe/ql_isr.c   Wed Apr  4 23:30:19 2018        
(r332051)
+++ stable/11/sys/dev/qlxgbe/ql_isr.c   Wed Apr  4 23:53:29 2018        
(r332052)
@@ -701,6 +701,7 @@ ql_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t 
                        break;
 
                default:
+                       desc_count = 0;
                        device_printf(dev, "%s: default 0x%llx!\n", __func__,
                                        (long long unsigned int)sdesc->data[0]);
                        break;

Modified: stable/11/sys/dev/qlxgbe/ql_os.c
==============================================================================
--- stable/11/sys/dev/qlxgbe/ql_os.c    Wed Apr  4 23:30:19 2018        
(r332051)
+++ stable/11/sys/dev/qlxgbe/ql_os.c    Wed Apr  4 23:53:29 2018        
(r332052)
@@ -1287,13 +1287,20 @@ qla_send(qla_host_t *ha, struct mbuf **m_headp, uint32
 
        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);
        }
 
@@ -1426,8 +1433,8 @@ qla_fp_taskqueue(void *context, int pending)
         qla_tx_fp_t *fp;
         qla_host_t *ha;
         struct ifnet *ifp;
-        struct mbuf  *mp;
-        int ret;
+        struct mbuf  *mp = NULL;
+        int ret = 0;
        uint32_t txr_idx;
        uint32_t iscsi_pdu = 0;
        uint32_t rx_pkts_left = -1;
@@ -1451,7 +1458,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
@@ -1496,13 +1503,18 @@ 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);
                }
        }
         mtx_unlock(&fp->tx_mtx);
+
+       if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+               goto qla_fp_taskqueue_exit;
 
 qla_fp_taskqueue_exit0:
 

Modified: stable/11/sys/dev/qlxgbe/ql_ver.h
==============================================================================
--- stable/11/sys/dev/qlxgbe/ql_ver.h   Wed Apr  4 23:30:19 2018        
(r332051)
+++ stable/11/sys/dev/qlxgbe/ql_ver.h   Wed Apr  4 23:53:29 2018        
(r332052)
@@ -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_ */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to