[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200216231158.5678-2-snelson@pensando.io>
Date: Sun, 16 Feb 2020 15:11:50 -0800
From: Shannon Nelson <snelson@...sando.io>
To: davem@...emloft.net, netdev@...r.kernel.org
Cc: Shannon Nelson <snelson@...sando.io>
Subject: [PATCH net-next 1/9] ionic: change param from lif to ionic
Use an ionic pointer rather than the lif in ionic_intr_alloc()
and ionic_intr_free() so that in the future we can allocate
interrupts before we have a lif.
Signed-off-by: Shannon Nelson <snelson@...sando.io>
---
.../net/ethernet/pensando/ionic/ionic_lif.c | 21 +++++++++----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 191271f6260d..15d5b24d89a1 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -149,15 +149,14 @@ static int ionic_request_irq(struct ionic_lif *lif, struct ionic_qcq *qcq)
0, intr->name, &qcq->napi);
}
-static int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr)
+static int ionic_intr_alloc(struct ionic *ionic, struct ionic_intr_info *intr)
{
- struct ionic *ionic = lif->ionic;
int index;
index = find_first_zero_bit(ionic->intrs, ionic->nintrs);
if (index == ionic->nintrs) {
- netdev_warn(lif->netdev, "%s: no intr, index=%d nintrs=%d\n",
- __func__, index, ionic->nintrs);
+ dev_warn(ionic->dev, "%s: no intr, index=%d nintrs=%d\n",
+ __func__, index, ionic->nintrs);
return -ENOSPC;
}
@@ -167,10 +166,10 @@ static int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr)
return 0;
}
-static void ionic_intr_free(struct ionic_lif *lif, int index)
+static void ionic_intr_free(struct ionic *ionic, int index)
{
- if (index != INTR_INDEX_NOT_ASSIGNED && index < lif->ionic->nintrs)
- clear_bit(index, lif->ionic->intrs);
+ if (index != INTR_INDEX_NOT_ASSIGNED && index < ionic->nintrs)
+ clear_bit(index, ionic->intrs);
}
static int ionic_qcq_enable(struct ionic_qcq *qcq)
@@ -294,7 +293,7 @@ static void ionic_qcq_free(struct ionic_lif *lif, struct ionic_qcq *qcq)
qcq->base_pa = 0;
if (qcq->flags & IONIC_QCQ_F_INTR)
- ionic_intr_free(lif, qcq->intr.index);
+ ionic_intr_free(lif->ionic, qcq->intr.index);
devm_kfree(dev, qcq->cq.info);
qcq->cq.info = NULL;
@@ -337,7 +336,7 @@ static void ionic_link_qcq_interrupts(struct ionic_qcq *src_qcq,
struct ionic_qcq *n_qcq)
{
if (WARN_ON(n_qcq->flags & IONIC_QCQ_F_INTR)) {
- ionic_intr_free(n_qcq->cq.lif, n_qcq->intr.index);
+ ionic_intr_free(n_qcq->cq.lif->ionic, n_qcq->intr.index);
n_qcq->flags &= ~IONIC_QCQ_F_INTR;
}
@@ -407,7 +406,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type,
}
if (flags & IONIC_QCQ_F_INTR) {
- err = ionic_intr_alloc(lif, &new->intr);
+ err = ionic_intr_alloc(lif->ionic, &new->intr);
if (err) {
netdev_warn(lif->netdev, "no intr for %s: %d\n",
name, err);
@@ -478,7 +477,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type,
return 0;
err_out_free_intr:
- ionic_intr_free(lif, new->intr.index);
+ ionic_intr_free(lif->ionic, new->intr.index);
err_out:
dev_err(dev, "qcq alloc of %s%d failed %d\n", name, index, err);
return err;
--
2.17.1
Powered by blists - more mailing lists