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.

MFC after:5 days
This commit is contained in:
David C Somayajulu 2017-10-11 18:25:05 +00:00
parent 1356a2e6fa
commit c6acf96aac
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324535
2 changed files with 25 additions and 0 deletions

View File

@ -2374,6 +2374,20 @@ ql_hw_send(qla_host_t *ha, bus_dma_segment_t *segs, int nsegs,
}
}
for (i = 0; i < num_tx_cmds; i++) {
int j;
j = (tx_idx+i) & (NUM_TX_DESCRIPTORS - 1);
if (NULL != ha->tx_ring[txr_idx].tx_buf[j].m_head) {
QL_ASSERT(ha, 0, \
("%s [%d]: txr_idx = %d tx_idx = %d mbuf = %p\n",\
__func__, __LINE__, txr_idx, j,\
ha->tx_ring[txr_idx].tx_buf[j].m_head));
return (EINVAL);
}
}
tx_cmd = &hw->tx_cntxt[txr_idx].tx_ring_base[tx_idx];
if (!(mp->m_pkthdr.csum_flags & CSUM_TSO)) {

View File

@ -1232,6 +1232,17 @@ qla_send(qla_host_t *ha, struct mbuf **m_headp, uint32_t txr_idx,
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 [%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;
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,