Commit 40d83539 authored by Shannon Nelson's avatar Shannon Nelson Committed by David S. Miller

ionic: add a check for max SGs and SKB frags

Add a check of the queue's max_sg_elems against the maximum frags we
expect to see per SKB and take the smaller of the two as our max for
the queues' descriptor buffer allocations.
Signed-off-by: default avatarShannon Nelson <shannon.nelson@amd.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4d9d7220
...@@ -3831,6 +3831,18 @@ static void ionic_lif_queue_identify(struct ionic_lif *lif) ...@@ -3831,6 +3831,18 @@ static void ionic_lif_queue_identify(struct ionic_lif *lif)
qtype, qti->max_sg_elems); qtype, qti->max_sg_elems);
dev_dbg(ionic->dev, " qtype[%d].sg_desc_stride = %d\n", dev_dbg(ionic->dev, " qtype[%d].sg_desc_stride = %d\n",
qtype, qti->sg_desc_stride); qtype, qti->sg_desc_stride);
if (qti->max_sg_elems >= IONIC_MAX_FRAGS) {
qti->max_sg_elems = IONIC_MAX_FRAGS - 1;
dev_dbg(ionic->dev, "limiting qtype %d max_sg_elems to IONIC_MAX_FRAGS-1 %d\n",
qtype, qti->max_sg_elems);
}
if (qti->max_sg_elems > MAX_SKB_FRAGS) {
qti->max_sg_elems = MAX_SKB_FRAGS;
dev_dbg(ionic->dev, "limiting qtype %d max_sg_elems to MAX_SKB_FRAGS %d\n",
qtype, qti->max_sg_elems);
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment