Commit 5155e118 authored by Srikanth Jampala's avatar Srikanth Jampala Committed by Herbert Xu

crypto: cavium/nitrox - use pci_alloc_irq_vectors() while enabling MSI-X.

replace pci_enable_msix_exact() with pci_alloc_irq_vectors(). get the
required vector count from pci_msix_vec_count().
use struct nitrox_q_vector as the argument to tasklets.
Signed-off-by: default avatarSrikanth Jampala <Jampala.Srikanth@cavium.com>
Reviewed-by: default avatarGadam Sreerama <sgadam@cavium.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e7892dd6
...@@ -12,13 +12,10 @@ void crypto_free_context(void *ctx); ...@@ -12,13 +12,10 @@ void crypto_free_context(void *ctx);
struct nitrox_device *nitrox_get_first_device(void); struct nitrox_device *nitrox_get_first_device(void);
void nitrox_put_device(struct nitrox_device *ndev); void nitrox_put_device(struct nitrox_device *ndev);
void nitrox_pf_cleanup_isr(struct nitrox_device *ndev);
int nitrox_pf_init_isr(struct nitrox_device *ndev);
int nitrox_common_sw_init(struct nitrox_device *ndev); int nitrox_common_sw_init(struct nitrox_device *ndev);
void nitrox_common_sw_cleanup(struct nitrox_device *ndev); void nitrox_common_sw_cleanup(struct nitrox_device *ndev);
void pkt_slc_resp_handler(unsigned long data); void pkt_slc_resp_tasklet(unsigned long data);
int nitrox_process_se_request(struct nitrox_device *ndev, int nitrox_process_se_request(struct nitrox_device *ndev,
struct se_crypto_request *req, struct se_crypto_request *req,
completion_t cb, completion_t cb,
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
* @response_head: submitted request list * @response_head: submitted request list
* @backlog_head: backlog queue * @backlog_head: backlog queue
* @dbell_csr_addr: doorbell register address for this queue * @dbell_csr_addr: doorbell register address for this queue
* @compl_cnt_csr_addr: completion count register address of the slc port
* @base: command queue base address * @base: command queue base address
* @dma: dma address of the base * @dma: dma address of the base
* @pending_count: request pending at device * @pending_count: request pending at device
...@@ -39,6 +40,7 @@ struct nitrox_cmdq { ...@@ -39,6 +40,7 @@ struct nitrox_cmdq {
struct list_head backlog_head; struct list_head backlog_head;
u8 __iomem *dbell_csr_addr; u8 __iomem *dbell_csr_addr;
u8 __iomem *compl_cnt_csr_addr;
u8 *base; u8 *base;
dma_addr_t dma; dma_addr_t dma;
...@@ -88,30 +90,17 @@ struct nitrox_stats { ...@@ -88,30 +90,17 @@ struct nitrox_stats {
atomic64_t dropped; atomic64_t dropped;
}; };
#define MAX_MSIX_VECTOR_NAME 20 #define IRQ_NAMESZ 32
/**
* vectors for queues (64 AE, 64 SE and 64 ZIP) and struct nitrox_q_vector {
* error condition/mailbox. char name[IRQ_NAMESZ];
*/ bool valid;
#define MAX_MSIX_VECTORS 192 int ring;
struct tasklet_struct resp_tasklet;
struct nitrox_msix { union {
struct msix_entry *entries; struct nitrox_cmdq *cmdq;
char **names; struct nitrox_device *ndev;
DECLARE_BITMAP(irqs, MAX_MSIX_VECTORS); };
u32 nr_entries;
};
struct bh_data {
/* slc port completion count address */
u8 __iomem *completion_cnt_csr_addr;
struct nitrox_cmdq *cmdq;
struct tasklet_struct resp_handler;
};
struct nitrox_bh {
struct bh_data *slc;
}; };
/* /*
...@@ -160,8 +149,7 @@ enum vf_mode { ...@@ -160,8 +149,7 @@ enum vf_mode {
* @mode: Device mode PF/VF * @mode: Device mode PF/VF
* @ctx_pool: DMA pool for crypto context * @ctx_pool: DMA pool for crypto context
* @pkt_inq: Packet input rings * @pkt_inq: Packet input rings
* @msix: MSI-X information * @qvec: MSI-X queue vectors information
* @bh: post processing work
* @hw: hardware information * @hw: hardware information
* @debugfs_dir: debugfs directory * @debugfs_dir: debugfs directory
*/ */
...@@ -186,8 +174,8 @@ struct nitrox_device { ...@@ -186,8 +174,8 @@ struct nitrox_device {
struct dma_pool *ctx_pool; struct dma_pool *ctx_pool;
struct nitrox_cmdq *pkt_inq; struct nitrox_cmdq *pkt_inq;
struct nitrox_msix msix; struct nitrox_q_vector *qvec;
struct nitrox_bh bh; int num_vecs;
struct nitrox_stats stats; struct nitrox_stats stats;
struct nitrox_hw hw; struct nitrox_hw hw;
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __NITROX_ISR_H
#define __NITROX_ISR_H
#include "nitrox_dev.h"
int nitrox_register_interrupts(struct nitrox_device *ndev);
void nitrox_unregister_interrupts(struct nitrox_device *ndev);
#endif /* __NITROX_ISR_H */
...@@ -69,6 +69,7 @@ static void nitrox_cmdq_cleanup(struct nitrox_cmdq *cmdq) ...@@ -69,6 +69,7 @@ static void nitrox_cmdq_cleanup(struct nitrox_cmdq *cmdq)
nitrox_cmdq_reset(cmdq); nitrox_cmdq_reset(cmdq);
cmdq->dbell_csr_addr = NULL; cmdq->dbell_csr_addr = NULL;
cmdq->compl_cnt_csr_addr = NULL;
cmdq->unalign_base = NULL; cmdq->unalign_base = NULL;
cmdq->base = NULL; cmdq->base = NULL;
cmdq->unalign_dma = 0; cmdq->unalign_dma = 0;
...@@ -112,6 +113,9 @@ static int nitrox_alloc_pktin_queues(struct nitrox_device *ndev) ...@@ -112,6 +113,9 @@ static int nitrox_alloc_pktin_queues(struct nitrox_device *ndev)
/* packet input ring doorbell address */ /* packet input ring doorbell address */
offset = NPS_PKT_IN_INSTR_BAOFF_DBELLX(i); offset = NPS_PKT_IN_INSTR_BAOFF_DBELLX(i);
cmdq->dbell_csr_addr = NITROX_CSR_ADDR(ndev, offset); cmdq->dbell_csr_addr = NITROX_CSR_ADDR(ndev, offset);
/* packet solicit port completion count address */
offset = NPS_PKT_SLC_CNTSX(i);
cmdq->compl_cnt_csr_addr = NITROX_CSR_ADDR(ndev, offset);
err = nitrox_cmdq_init(cmdq, PKTIN_Q_ALIGN_BYTES); err = nitrox_cmdq_init(cmdq, PKTIN_Q_ALIGN_BYTES);
if (err) if (err)
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "nitrox_common.h" #include "nitrox_common.h"
#include "nitrox_csr.h" #include "nitrox_csr.h"
#include "nitrox_hal.h" #include "nitrox_hal.h"
#include "nitrox_isr.h"
#define CNN55XX_DEV_ID 0x12 #define CNN55XX_DEV_ID 0x12
#define MAX_PF_QUEUES 64 #define MAX_PF_QUEUES 64
...@@ -244,7 +245,7 @@ static int nitrox_pf_sw_init(struct nitrox_device *ndev) ...@@ -244,7 +245,7 @@ static int nitrox_pf_sw_init(struct nitrox_device *ndev)
if (err) if (err)
return err; return err;
err = nitrox_pf_init_isr(ndev); err = nitrox_register_interrupts(ndev);
if (err) if (err)
nitrox_common_sw_cleanup(ndev); nitrox_common_sw_cleanup(ndev);
...@@ -253,7 +254,7 @@ static int nitrox_pf_sw_init(struct nitrox_device *ndev) ...@@ -253,7 +254,7 @@ static int nitrox_pf_sw_init(struct nitrox_device *ndev)
static void nitrox_pf_sw_cleanup(struct nitrox_device *ndev) static void nitrox_pf_sw_cleanup(struct nitrox_device *ndev)
{ {
nitrox_pf_cleanup_isr(ndev); nitrox_unregister_interrupts(ndev);
nitrox_common_sw_cleanup(ndev); nitrox_common_sw_cleanup(ndev);
} }
......
...@@ -721,18 +721,18 @@ static void process_response_list(struct nitrox_cmdq *cmdq) ...@@ -721,18 +721,18 @@ static void process_response_list(struct nitrox_cmdq *cmdq)
} }
/** /**
* pkt_slc_resp_handler - post processing of SE responses * pkt_slc_resp_tasklet - post processing of SE responses
*/ */
void pkt_slc_resp_handler(unsigned long data) void pkt_slc_resp_tasklet(unsigned long data)
{ {
struct bh_data *bh = (void *)(uintptr_t)(data); struct nitrox_q_vector *qvec = (void *)(uintptr_t)(data);
struct nitrox_cmdq *cmdq = bh->cmdq; struct nitrox_cmdq *cmdq = qvec->cmdq;
union nps_pkt_slc_cnts pkt_slc_cnts; union nps_pkt_slc_cnts slc_cnts;
/* read completion count */ /* read completion count */
pkt_slc_cnts.value = readq(bh->completion_cnt_csr_addr); slc_cnts.value = readq(cmdq->compl_cnt_csr_addr);
/* resend the interrupt if more work to do */ /* resend the interrupt if more work to do */
pkt_slc_cnts.s.resend = 1; slc_cnts.s.resend = 1;
process_response_list(cmdq); process_response_list(cmdq);
...@@ -740,7 +740,7 @@ void pkt_slc_resp_handler(unsigned long data) ...@@ -740,7 +740,7 @@ void pkt_slc_resp_handler(unsigned long data)
* clear the interrupt with resend bit enabled, * clear the interrupt with resend bit enabled,
* MSI-X interrupt generates if Completion count > Threshold * MSI-X interrupt generates if Completion count > Threshold
*/ */
writeq(pkt_slc_cnts.value, bh->completion_cnt_csr_addr); writeq(slc_cnts.value, cmdq->compl_cnt_csr_addr);
/* order the writes */ /* order the writes */
mmiowb(); mmiowb();
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "nitrox_dev.h" #include "nitrox_dev.h"
#include "nitrox_hal.h" #include "nitrox_hal.h"
#include "nitrox_common.h" #include "nitrox_common.h"
#include "nitrox_isr.h"
static inline bool num_vfs_valid(int num_vfs) static inline bool num_vfs_valid(int num_vfs)
{ {
...@@ -55,7 +56,7 @@ static void pf_sriov_cleanup(struct nitrox_device *ndev) ...@@ -55,7 +56,7 @@ static void pf_sriov_cleanup(struct nitrox_device *ndev)
nitrox_crypto_unregister(); nitrox_crypto_unregister();
/* cleanup PF resources */ /* cleanup PF resources */
nitrox_pf_cleanup_isr(ndev); nitrox_unregister_interrupts(ndev);
nitrox_common_sw_cleanup(ndev); nitrox_common_sw_cleanup(ndev);
} }
...@@ -68,7 +69,7 @@ static int pf_sriov_init(struct nitrox_device *ndev) ...@@ -68,7 +69,7 @@ static int pf_sriov_init(struct nitrox_device *ndev)
if (err) if (err)
return err; return err;
err = nitrox_pf_init_isr(ndev); err = nitrox_register_interrupts(ndev);
if (err) { if (err) {
nitrox_common_sw_cleanup(ndev); nitrox_common_sw_cleanup(ndev);
return err; return err;
......
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