Thread (28 messages) 28 messages, 2 authors, 2019-07-01

Re: [PATCH v2 net-next 17/19] ionic: Add RSS support

From: Jakub Kicinski <hidden>
Date: 2019-06-29 18:48:44

On Fri, 28 Jun 2019 14:39:32 -0700, Shannon Nelson wrote:
quoted hunk ↗ jump to hunk
@@ -1260,10 +1266,24 @@ static struct lif *ionic_lif_alloc(struct ionic *ionic, unsigned int index)
 	if (err)
 		goto err_out_free_lif_info;
 
+	/* allocate rss indirection table */
+	tbl_sz = le16_to_cpu(lif->ionic->ident.lif.eth.rss_ind_tbl_sz);
+	lif->rss_ind_tbl_sz = sizeof(*lif->rss_ind_tbl) * tbl_sz;
+	lif->rss_ind_tbl = dma_alloc_coherent(dev, lif->rss_ind_tbl_sz,
+					      &lif->rss_ind_tbl_pa,
+					      GFP_KERNEL);
+
+	if (!lif->rss_ind_tbl) {
+		dev_err(dev, "Failed to allocate rss indirection table, aborting\n");
+		goto err_out_free_qcqs;
+	}
+
 	list_add_tail(&lif->list, &ionic->lifs);
 
 	return lif;
 
+err_out_free_qcqs:
+	ionic_qcqs_free(lif);
 err_out_free_lif_info:
 	dma_free_coherent(dev, lif->info_sz, lif->info, lif->info_pa);
 	lif->info = NULL;
@@ -1302,6 +1322,14 @@ static void ionic_lif_free(struct lif *lif)
 {
 	struct device *dev = lif->ionic->dev;
 
+	/* free rss indirection table */
+	if (lif->rss_ind_tbl) {
+		dma_free_coherent(dev, lif->rss_ind_tbl_sz, lif->rss_ind_tbl,
+				  lif->rss_ind_tbl_pa);
dma_free_coherent() should be able to deal with NULLs just fine.
Besides you fail hard if the allocation failed, no?
+		lif->rss_ind_tbl = NULL;
+		lif->rss_ind_tbl_pa = 0;
+	}
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help