Date: Wed, 4 Oct 2017 23:03:09 +0000 (UTC) From: David C Somayajulu <davidcs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324290 - head/sys/dev/qlxgbe Message-ID: <201710042303.v94N39rY098067@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: davidcs Date: Wed Oct 4 23:03:09 2017 New Revision: 324290 URL: https://svnweb.freebsd.org/changeset/base/324290 Log: Add sanity checks in ql_hw_send() qla_send() to ensure that empty slots in Tx Ring map to empty slot in Tx_buf array before Transmits. If the checks fail further Transmission on that Tx Ring is prevented. Modified: head/sys/dev/qlxgbe/ql_hw.c head/sys/dev/qlxgbe/ql_os.c Modified: head/sys/dev/qlxgbe/ql_hw.c ============================================================================== --- head/sys/dev/qlxgbe/ql_hw.c Wed Oct 4 22:55:30 2017 (r324289) +++ head/sys/dev/qlxgbe/ql_hw.c Wed Oct 4 23:03:09 2017 (r324290) @@ -2374,6 +2374,16 @@ ql_hw_send(qla_host_t *ha, bus_dma_segment_t *segs, in } } + for (i = 0; i < num_tx_cmds; i++) { + if (NULL != ha->tx_ring[txr_idx].tx_buf[(tx_idx+i)].m_head) { + QL_ASSERT(ha, 0, \ + ("%s: txr_idx = %d tx_idx = %d mbuf = %p\n",\ + __func__, txr_idx, (tx_idx+i),\ + ha->tx_ring[txr_idx].tx_buf[(tx_idx+i)].m_head)); + return (EINVAL); + } + } + tx_cmd = &hw->tx_cntxt[txr_idx].tx_ring_base[tx_idx]; if (!(mp->m_pkthdr.csum_flags & CSUM_TSO)) { Modified: head/sys/dev/qlxgbe/ql_os.c ============================================================================== --- head/sys/dev/qlxgbe/ql_os.c Wed Oct 4 22:55:30 2017 (r324289) +++ head/sys/dev/qlxgbe/ql_os.c Wed Oct 4 23:03:09 2017 (r324290) @@ -1232,6 +1232,17 @@ qla_send(qla_host_t *ha, struct mbuf **m_headp, uint32 QL_DPRINT8(ha, (ha->pci_dev, "%s: enter\n", __func__)); tx_idx = ha->hw.tx_cntxt[txr_idx].txr_next; + + if (NULL != ha->tx_ring[txr_idx].tx_buf[tx_idx].m_head) { + QL_ASSERT(ha, 0, ("%s: txr_idx = %d tx_idx = %d mbuf = %p\n",\ + __func__, 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; + return (ret); + } + map = ha->tx_ring[txr_idx].tx_buf[tx_idx].map; ret = bus_dmamap_load_mbuf_sg(ha->tx_tag, map, m_head, segs, &nsegs,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710042303.v94N39rY098067>