Skip to content

Commit 40d8353

Browse files
emuslndavem330
authored andcommitted
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: Shannon Nelson <shannon.nelson@amd.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4d9d722 commit 40d8353

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/net/ethernet/pensando/ionic/ionic_lif.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3831,6 +3831,18 @@ static void ionic_lif_queue_identify(struct ionic_lif *lif)
38313831
qtype, qti->max_sg_elems);
38323832
dev_dbg(ionic->dev, " qtype[%d].sg_desc_stride = %d\n",
38333833
qtype, qti->sg_desc_stride);
3834+
3835+
if (qti->max_sg_elems >= IONIC_MAX_FRAGS) {
3836+
qti->max_sg_elems = IONIC_MAX_FRAGS - 1;
3837+
dev_dbg(ionic->dev, "limiting qtype %d max_sg_elems to IONIC_MAX_FRAGS-1 %d\n",
3838+
qtype, qti->max_sg_elems);
3839+
}
3840+
3841+
if (qti->max_sg_elems > MAX_SKB_FRAGS) {
3842+
qti->max_sg_elems = MAX_SKB_FRAGS;
3843+
dev_dbg(ionic->dev, "limiting qtype %d max_sg_elems to MAX_SKB_FRAGS %d\n",
3844+
qtype, qti->max_sg_elems);
3845+
}
38343846
}
38353847
}
38363848

0 commit comments

Comments
 (0)