1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-16 08:12:53 +08:00

Improve sanity checking and error reporting in event queue processing

This commit is contained in:
Alex Forencich 2019-12-04 13:32:46 -08:00
parent a432a8f472
commit c4d17b6a3c

View File

@ -182,24 +182,41 @@ void mqnic_process_eq(struct net_device *ndev, struct mqnic_eq_ring *eq_ring)
if (event->type == MQNIC_EVENT_TYPE_TX_CPL)
{
// transmit completion event
if (unlikely(event->source > priv->tx_cpl_queue_count))
{
dev_err(&priv->mdev->pdev->dev, "mqnic_process_eq on port %d: unknown event source %d (index %d, type %d)", priv->port, event->source, eq_index, event->type);
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_NONE, 16, 1, event, MQNIC_EVENT_SIZE, true);
}
else
{
struct mqnic_cq_ring *cq_ring = priv->tx_cpl_ring[event->source];
if (likely(cq_ring && cq_ring->handler))
{
cq_ring->handler(cq_ring);
}
}
}
else if (event->type == MQNIC_EVENT_TYPE_RX_CPL)
{
// receive completion event
if (unlikely(event->source > priv->rx_cpl_queue_count))
{
dev_err(&priv->mdev->pdev->dev, "mqnic_process_eq on port %d: unknown event source %d (index %d, type %d)", priv->port, event->source, eq_index, event->type);
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_NONE, 16, 1, event, MQNIC_EVENT_SIZE, true);
}
else
{
struct mqnic_cq_ring *cq_ring = priv->rx_cpl_ring[event->source];
if (likely(cq_ring && cq_ring->handler))
{
cq_ring->handler(cq_ring);
}
}
}
else
{
dev_warn(&priv->mdev->pdev->dev, "mqnic_process_eq on port %d: unknown event type %d (source %d)", priv->port, event->type, event->source);
dev_err(&priv->mdev->pdev->dev, "mqnic_process_eq on port %d: unknown event type %d (index %d, source %d)", priv->port, event->type, eq_index, event->source);
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_NONE, 16, 1, event, MQNIC_EVENT_SIZE, true);
}
done++;