Author: davidcs
Date: Tue Sep 26 22:32:08 2017
New Revision: 324036
URL: https://svnweb.freebsd.org/changeset/base/324036

Log:
  MFC r323824
  1. ql_hw.c:
   In ql_hw_send() return EINVAL when TSO framelength exceeds max
   supported length by HW.(davidcs)
  2. ql_os.c:
   In qla_send() call bus_dmamap_unload before freeing mbuf or
   recreating dmmamap.(davidcs)
   In qla_fp_taskqueue() Add additional checks for IFF_DRV_RUNNING
   Fix qla_clear_tx_buf() call bus_dmamap_sync() before freeing
   mbuf.
  
  Submitted by: david.ba...@netapp.com

Modified:
  stable/9/sys/dev/qlxgbe/ql_hw.c
  stable/9/sys/dev/qlxgbe/ql_os.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/qlxgbe/ql_hw.c
==============================================================================
--- stable/9/sys/dev/qlxgbe/ql_hw.c     Tue Sep 26 22:29:43 2017        
(r324035)
+++ stable/9/sys/dev/qlxgbe/ql_hw.c     Tue Sep 26 22:32:08 2017        
(r324036)
@@ -2324,7 +2324,7 @@ ql_hw_send(qla_host_t *ha, bus_dma_segment_t *segs, in
        if (total_length > QLA_MAX_TSO_FRAME_SIZE) {
                device_printf(dev, "%s: total length exceeds maxlen(%d)\n",
                        __func__, total_length);
-               return (-1);
+               return (EINVAL);
        }
        eh = mtod(mp, struct ether_vlan_header *);
 

Modified: stable/9/sys/dev/qlxgbe/ql_os.c
==============================================================================
--- stable/9/sys/dev/qlxgbe/ql_os.c     Tue Sep 26 22:29:43 2017        
(r324035)
+++ stable/9/sys/dev/qlxgbe/ql_os.c     Tue Sep 26 22:32:08 2017        
(r324036)
@@ -1308,6 +1308,7 @@ qla_send(qla_host_t *ha, struct mbuf **m_headp, uint32
                        ha->tx_ring[txr_idx].iscsi_pkt_count++;
                ha->tx_ring[txr_idx].tx_buf[tx_idx].m_head = m_head;
        } else {
+               bus_dmamap_unload(ha->tx_tag, map); 
                if (ret == EINVAL) {
                        if (m_head)
                                m_freem(m_head);
@@ -1393,7 +1394,8 @@ qla_fp_taskqueue(void *context, int pending)
                 goto qla_fp_taskqueue_exit;
         }
 
-       while (rx_pkts_left && !ha->stop_rcv) {
+       while (rx_pkts_left && !ha->stop_rcv &&
+               (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
                rx_pkts_left = ql_rcv_isr(ha, fp->txr_idx, 64);
 
 #ifdef QL_ENABLE_ISCSI_TLV
@@ -1436,6 +1438,11 @@ qla_fp_taskqueue(void *context, int pending)
                                drbr_advance(ifp, fp->tx_br);
                        }
 
+                       /* Send a copy of the frame to the BPF listener */
+                       ETHER_BPF_MTAP(ifp, mp);
+                       if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+                               break;
+
                        mp = drbr_peek(ifp, fp->tx_br);
                }
        }
@@ -1698,16 +1705,24 @@ qla_clear_tx_buf(qla_host_t *ha, qla_tx_buf_t *txb)
 {
        QL_DPRINT2(ha, (ha->pci_dev, "%s: enter\n", __func__));
 
-       if (txb->m_head && txb->map) {
+       if (txb->m_head) {
+               bus_dmamap_sync(ha->tx_tag, txb->map,
+                       BUS_DMASYNC_POSTWRITE);
 
                bus_dmamap_unload(ha->tx_tag, txb->map);
 
                m_freem(txb->m_head);
                txb->m_head = NULL;
+
+               bus_dmamap_destroy(ha->tx_tag, txb->map);
+               txb->map = NULL;
        }
 
-       if (txb->map)
+       if (txb->map) {
+               bus_dmamap_unload(ha->tx_tag, txb->map);
                bus_dmamap_destroy(ha->tx_tag, txb->map);
+               txb->map = NULL;
+       }
 
        QL_DPRINT2(ha, (ha->pci_dev, "%s: exit\n", __func__));
 }
_______________________________________________
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