1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
214fa93cdSSrikanth Jampala #include <linux/pci.h>
314fa93cdSSrikanth Jampala #include <linux/printk.h>
414fa93cdSSrikanth Jampala #include <linux/slab.h>
514fa93cdSSrikanth Jampala 
614fa93cdSSrikanth Jampala #include "nitrox_dev.h"
714fa93cdSSrikanth Jampala #include "nitrox_csr.h"
814fa93cdSSrikanth Jampala #include "nitrox_common.h"
941a9aca6SSrikanth Jampala #include "nitrox_hal.h"
1014fa93cdSSrikanth Jampala 
115155e118SSrikanth Jampala /**
125155e118SSrikanth Jampala  * One vector for each type of ring
135155e118SSrikanth Jampala  *  - NPS packet ring, AQMQ ring and ZQMQ ring
145155e118SSrikanth Jampala  */
1514fa93cdSSrikanth Jampala #define NR_RING_VECTORS 3
165155e118SSrikanth Jampala /* base entry for packet ring/port */
175155e118SSrikanth Jampala #define PKT_RING_MSIX_BASE 0
185155e118SSrikanth Jampala #define NON_RING_MSIX_BASE 192
1914fa93cdSSrikanth Jampala 
2014fa93cdSSrikanth Jampala /**
2114fa93cdSSrikanth Jampala  * nps_pkt_slc_isr - IRQ handler for NPS solicit port
2214fa93cdSSrikanth Jampala  * @irq: irq number
2314fa93cdSSrikanth Jampala  * @data: argument
2414fa93cdSSrikanth Jampala  */
2514fa93cdSSrikanth Jampala static irqreturn_t nps_pkt_slc_isr(int irq, void *data)
2614fa93cdSSrikanth Jampala {
275155e118SSrikanth Jampala 	struct nitrox_q_vector *qvec = data;
285155e118SSrikanth Jampala 	union nps_pkt_slc_cnts slc_cnts;
295155e118SSrikanth Jampala 	struct nitrox_cmdq *cmdq = qvec->cmdq;
3014fa93cdSSrikanth Jampala 
315155e118SSrikanth Jampala 	slc_cnts.value = readq(cmdq->compl_cnt_csr_addr);
3214fa93cdSSrikanth Jampala 	/* New packet on SLC output port */
335155e118SSrikanth Jampala 	if (slc_cnts.s.slc_int)
345155e118SSrikanth Jampala 		tasklet_hi_schedule(&qvec->resp_tasklet);
3514fa93cdSSrikanth Jampala 
3614fa93cdSSrikanth Jampala 	return IRQ_HANDLED;
3714fa93cdSSrikanth Jampala }
3814fa93cdSSrikanth Jampala 
3914fa93cdSSrikanth Jampala static void clear_nps_core_err_intr(struct nitrox_device *ndev)
4014fa93cdSSrikanth Jampala {
4114fa93cdSSrikanth Jampala 	u64 value;
4214fa93cdSSrikanth Jampala 
4314fa93cdSSrikanth Jampala 	/* Write 1 to clear */
4414fa93cdSSrikanth Jampala 	value = nitrox_read_csr(ndev, NPS_CORE_INT);
4514fa93cdSSrikanth Jampala 	nitrox_write_csr(ndev, NPS_CORE_INT, value);
4614fa93cdSSrikanth Jampala 
4714fa93cdSSrikanth Jampala 	dev_err_ratelimited(DEV(ndev), "NSP_CORE_INT  0x%016llx\n", value);
4814fa93cdSSrikanth Jampala }
4914fa93cdSSrikanth Jampala 
5014fa93cdSSrikanth Jampala static void clear_nps_pkt_err_intr(struct nitrox_device *ndev)
5114fa93cdSSrikanth Jampala {
5214fa93cdSSrikanth Jampala 	union nps_pkt_int pkt_int;
5314fa93cdSSrikanth Jampala 	unsigned long value, offset;
5414fa93cdSSrikanth Jampala 	int i;
5514fa93cdSSrikanth Jampala 
5614fa93cdSSrikanth Jampala 	pkt_int.value = nitrox_read_csr(ndev, NPS_PKT_INT);
5714fa93cdSSrikanth Jampala 	dev_err_ratelimited(DEV(ndev), "NPS_PKT_INT  0x%016llx\n",
5814fa93cdSSrikanth Jampala 			    pkt_int.value);
5914fa93cdSSrikanth Jampala 
6014fa93cdSSrikanth Jampala 	if (pkt_int.s.slc_err) {
6114fa93cdSSrikanth Jampala 		offset = NPS_PKT_SLC_ERR_TYPE;
6214fa93cdSSrikanth Jampala 		value = nitrox_read_csr(ndev, offset);
6314fa93cdSSrikanth Jampala 		nitrox_write_csr(ndev, offset, value);
6414fa93cdSSrikanth Jampala 		dev_err_ratelimited(DEV(ndev),
6514fa93cdSSrikanth Jampala 				    "NPS_PKT_SLC_ERR_TYPE  0x%016lx\n", value);
6614fa93cdSSrikanth Jampala 
6714fa93cdSSrikanth Jampala 		offset = NPS_PKT_SLC_RERR_LO;
6814fa93cdSSrikanth Jampala 		value = nitrox_read_csr(ndev, offset);
6914fa93cdSSrikanth Jampala 		nitrox_write_csr(ndev, offset, value);
7014fa93cdSSrikanth Jampala 		/* enable the solicit ports */
7114fa93cdSSrikanth Jampala 		for_each_set_bit(i, &value, BITS_PER_LONG)
7214fa93cdSSrikanth Jampala 			enable_pkt_solicit_port(ndev, i);
7314fa93cdSSrikanth Jampala 
7414fa93cdSSrikanth Jampala 		dev_err_ratelimited(DEV(ndev),
7514fa93cdSSrikanth Jampala 				    "NPS_PKT_SLC_RERR_LO  0x%016lx\n", value);
7614fa93cdSSrikanth Jampala 
7714fa93cdSSrikanth Jampala 		offset = NPS_PKT_SLC_RERR_HI;
7814fa93cdSSrikanth Jampala 		value = nitrox_read_csr(ndev, offset);
7914fa93cdSSrikanth Jampala 		nitrox_write_csr(ndev, offset, value);
8014fa93cdSSrikanth Jampala 		dev_err_ratelimited(DEV(ndev),
8114fa93cdSSrikanth Jampala 				    "NPS_PKT_SLC_RERR_HI  0x%016lx\n", value);
8214fa93cdSSrikanth Jampala 	}
8314fa93cdSSrikanth Jampala 
8414fa93cdSSrikanth Jampala 	if (pkt_int.s.in_err) {
8514fa93cdSSrikanth Jampala 		offset = NPS_PKT_IN_ERR_TYPE;
8614fa93cdSSrikanth Jampala 		value = nitrox_read_csr(ndev, offset);
8714fa93cdSSrikanth Jampala 		nitrox_write_csr(ndev, offset, value);
8814fa93cdSSrikanth Jampala 		dev_err_ratelimited(DEV(ndev),
8914fa93cdSSrikanth Jampala 				    "NPS_PKT_IN_ERR_TYPE  0x%016lx\n", value);
9014fa93cdSSrikanth Jampala 		offset = NPS_PKT_IN_RERR_LO;
9114fa93cdSSrikanth Jampala 		value = nitrox_read_csr(ndev, offset);
9214fa93cdSSrikanth Jampala 		nitrox_write_csr(ndev, offset, value);
9314fa93cdSSrikanth Jampala 		/* enable the input ring */
9414fa93cdSSrikanth Jampala 		for_each_set_bit(i, &value, BITS_PER_LONG)
9514fa93cdSSrikanth Jampala 			enable_pkt_input_ring(ndev, i);
9614fa93cdSSrikanth Jampala 
9714fa93cdSSrikanth Jampala 		dev_err_ratelimited(DEV(ndev),
9814fa93cdSSrikanth Jampala 				    "NPS_PKT_IN_RERR_LO  0x%016lx\n", value);
9914fa93cdSSrikanth Jampala 
10014fa93cdSSrikanth Jampala 		offset = NPS_PKT_IN_RERR_HI;
10114fa93cdSSrikanth Jampala 		value = nitrox_read_csr(ndev, offset);
10214fa93cdSSrikanth Jampala 		nitrox_write_csr(ndev, offset, value);
10314fa93cdSSrikanth Jampala 		dev_err_ratelimited(DEV(ndev),
10414fa93cdSSrikanth Jampala 				    "NPS_PKT_IN_RERR_HI  0x%016lx\n", value);
10514fa93cdSSrikanth Jampala 	}
10614fa93cdSSrikanth Jampala }
10714fa93cdSSrikanth Jampala 
10814fa93cdSSrikanth Jampala static void clear_pom_err_intr(struct nitrox_device *ndev)
10914fa93cdSSrikanth Jampala {
11014fa93cdSSrikanth Jampala 	u64 value;
11114fa93cdSSrikanth Jampala 
11214fa93cdSSrikanth Jampala 	value = nitrox_read_csr(ndev, POM_INT);
11314fa93cdSSrikanth Jampala 	nitrox_write_csr(ndev, POM_INT, value);
11414fa93cdSSrikanth Jampala 	dev_err_ratelimited(DEV(ndev), "POM_INT  0x%016llx\n", value);
11514fa93cdSSrikanth Jampala }
11614fa93cdSSrikanth Jampala 
11714fa93cdSSrikanth Jampala static void clear_pem_err_intr(struct nitrox_device *ndev)
11814fa93cdSSrikanth Jampala {
11914fa93cdSSrikanth Jampala 	u64 value;
12014fa93cdSSrikanth Jampala 
12114fa93cdSSrikanth Jampala 	value = nitrox_read_csr(ndev, PEM0_INT);
12214fa93cdSSrikanth Jampala 	nitrox_write_csr(ndev, PEM0_INT, value);
12314fa93cdSSrikanth Jampala 	dev_err_ratelimited(DEV(ndev), "PEM(0)_INT  0x%016llx\n", value);
12414fa93cdSSrikanth Jampala }
12514fa93cdSSrikanth Jampala 
12614fa93cdSSrikanth Jampala static void clear_lbc_err_intr(struct nitrox_device *ndev)
12714fa93cdSSrikanth Jampala {
12814fa93cdSSrikanth Jampala 	union lbc_int lbc_int;
12914fa93cdSSrikanth Jampala 	u64 value, offset;
13014fa93cdSSrikanth Jampala 	int i;
13114fa93cdSSrikanth Jampala 
13214fa93cdSSrikanth Jampala 	lbc_int.value = nitrox_read_csr(ndev, LBC_INT);
13314fa93cdSSrikanth Jampala 	dev_err_ratelimited(DEV(ndev), "LBC_INT  0x%016llx\n", lbc_int.value);
13414fa93cdSSrikanth Jampala 
13514fa93cdSSrikanth Jampala 	if (lbc_int.s.dma_rd_err) {
13614fa93cdSSrikanth Jampala 		for (i = 0; i < NR_CLUSTERS; i++) {
13714fa93cdSSrikanth Jampala 			offset = EFL_CORE_VF_ERR_INT0X(i);
13814fa93cdSSrikanth Jampala 			value = nitrox_read_csr(ndev, offset);
13914fa93cdSSrikanth Jampala 			nitrox_write_csr(ndev, offset, value);
14014fa93cdSSrikanth Jampala 			offset = EFL_CORE_VF_ERR_INT1X(i);
14114fa93cdSSrikanth Jampala 			value = nitrox_read_csr(ndev, offset);
14214fa93cdSSrikanth Jampala 			nitrox_write_csr(ndev, offset, value);
14314fa93cdSSrikanth Jampala 		}
14414fa93cdSSrikanth Jampala 	}
14514fa93cdSSrikanth Jampala 
14614fa93cdSSrikanth Jampala 	if (lbc_int.s.cam_soft_err) {
14714fa93cdSSrikanth Jampala 		dev_err_ratelimited(DEV(ndev), "CAM_SOFT_ERR, invalidating LBC\n");
14814fa93cdSSrikanth Jampala 		invalidate_lbc(ndev);
14914fa93cdSSrikanth Jampala 	}
15014fa93cdSSrikanth Jampala 
15114fa93cdSSrikanth Jampala 	if (lbc_int.s.pref_dat_len_mismatch_err) {
15214fa93cdSSrikanth Jampala 		offset = LBC_PLM_VF1_64_INT;
15314fa93cdSSrikanth Jampala 		value = nitrox_read_csr(ndev, offset);
15414fa93cdSSrikanth Jampala 		nitrox_write_csr(ndev, offset, value);
15514fa93cdSSrikanth Jampala 		offset = LBC_PLM_VF65_128_INT;
15614fa93cdSSrikanth Jampala 		value = nitrox_read_csr(ndev, offset);
15714fa93cdSSrikanth Jampala 		nitrox_write_csr(ndev, offset, value);
15814fa93cdSSrikanth Jampala 	}
15914fa93cdSSrikanth Jampala 
16014fa93cdSSrikanth Jampala 	if (lbc_int.s.rd_dat_len_mismatch_err) {
16114fa93cdSSrikanth Jampala 		offset = LBC_ELM_VF1_64_INT;
16214fa93cdSSrikanth Jampala 		value = nitrox_read_csr(ndev, offset);
16314fa93cdSSrikanth Jampala 		nitrox_write_csr(ndev, offset, value);
16414fa93cdSSrikanth Jampala 		offset = LBC_ELM_VF65_128_INT;
16514fa93cdSSrikanth Jampala 		value = nitrox_read_csr(ndev, offset);
16614fa93cdSSrikanth Jampala 		nitrox_write_csr(ndev, offset, value);
16714fa93cdSSrikanth Jampala 	}
16814fa93cdSSrikanth Jampala 	nitrox_write_csr(ndev, LBC_INT, lbc_int.value);
16914fa93cdSSrikanth Jampala }
17014fa93cdSSrikanth Jampala 
17114fa93cdSSrikanth Jampala static void clear_efl_err_intr(struct nitrox_device *ndev)
17214fa93cdSSrikanth Jampala {
17314fa93cdSSrikanth Jampala 	int i;
17414fa93cdSSrikanth Jampala 
17514fa93cdSSrikanth Jampala 	for (i = 0; i < NR_CLUSTERS; i++) {
17614fa93cdSSrikanth Jampala 		union efl_core_int core_int;
17714fa93cdSSrikanth Jampala 		u64 value, offset;
17814fa93cdSSrikanth Jampala 
17914fa93cdSSrikanth Jampala 		offset = EFL_CORE_INTX(i);
18014fa93cdSSrikanth Jampala 		core_int.value = nitrox_read_csr(ndev, offset);
18114fa93cdSSrikanth Jampala 		nitrox_write_csr(ndev, offset, core_int.value);
18214fa93cdSSrikanth Jampala 		dev_err_ratelimited(DEV(ndev), "ELF_CORE(%d)_INT  0x%016llx\n",
18314fa93cdSSrikanth Jampala 				    i, core_int.value);
18414fa93cdSSrikanth Jampala 		if (core_int.s.se_err) {
18514fa93cdSSrikanth Jampala 			offset = EFL_CORE_SE_ERR_INTX(i);
18614fa93cdSSrikanth Jampala 			value = nitrox_read_csr(ndev, offset);
18714fa93cdSSrikanth Jampala 			nitrox_write_csr(ndev, offset, value);
18814fa93cdSSrikanth Jampala 		}
18914fa93cdSSrikanth Jampala 	}
19014fa93cdSSrikanth Jampala }
19114fa93cdSSrikanth Jampala 
19214fa93cdSSrikanth Jampala static void clear_bmi_err_intr(struct nitrox_device *ndev)
19314fa93cdSSrikanth Jampala {
19414fa93cdSSrikanth Jampala 	u64 value;
19514fa93cdSSrikanth Jampala 
19614fa93cdSSrikanth Jampala 	value = nitrox_read_csr(ndev, BMI_INT);
19714fa93cdSSrikanth Jampala 	nitrox_write_csr(ndev, BMI_INT, value);
19814fa93cdSSrikanth Jampala 	dev_err_ratelimited(DEV(ndev), "BMI_INT  0x%016llx\n", value);
19914fa93cdSSrikanth Jampala }
20014fa93cdSSrikanth Jampala 
2015155e118SSrikanth Jampala static void nps_core_int_tasklet(unsigned long data)
20214fa93cdSSrikanth Jampala {
2035155e118SSrikanth Jampala 	struct nitrox_q_vector *qvec = (void *)(uintptr_t)(data);
2045155e118SSrikanth Jampala 	struct nitrox_device *ndev = qvec->ndev;
20514fa93cdSSrikanth Jampala 
2065155e118SSrikanth Jampala 	/* if pf mode do queue recovery */
2075155e118SSrikanth Jampala 	if (ndev->mode == __NDEV_MODE_PF) {
2085155e118SSrikanth Jampala 	} else {
2095155e118SSrikanth Jampala 		/**
2105155e118SSrikanth Jampala 		 * if VF(s) enabled communicate the error information
2115155e118SSrikanth Jampala 		 * to VF(s)
2125155e118SSrikanth Jampala 		 */
2135155e118SSrikanth Jampala 	}
21414fa93cdSSrikanth Jampala }
21514fa93cdSSrikanth Jampala 
2165155e118SSrikanth Jampala /**
2175155e118SSrikanth Jampala  * nps_core_int_isr - interrupt handler for NITROX errors and
2185155e118SSrikanth Jampala  *   mailbox communication
2195155e118SSrikanth Jampala  */
22014fa93cdSSrikanth Jampala static irqreturn_t nps_core_int_isr(int irq, void *data)
22114fa93cdSSrikanth Jampala {
22214fa93cdSSrikanth Jampala 	struct nitrox_device *ndev = data;
2235155e118SSrikanth Jampala 	union nps_core_int_active core_int;
22414fa93cdSSrikanth Jampala 
2255155e118SSrikanth Jampala 	core_int.value = nitrox_read_csr(ndev, NPS_CORE_INT_ACTIVE);
2265155e118SSrikanth Jampala 
2275155e118SSrikanth Jampala 	if (core_int.s.nps_core)
2285155e118SSrikanth Jampala 		clear_nps_core_err_intr(ndev);
2295155e118SSrikanth Jampala 
2305155e118SSrikanth Jampala 	if (core_int.s.nps_pkt)
2315155e118SSrikanth Jampala 		clear_nps_pkt_err_intr(ndev);
2325155e118SSrikanth Jampala 
2335155e118SSrikanth Jampala 	if (core_int.s.pom)
2345155e118SSrikanth Jampala 		clear_pom_err_intr(ndev);
2355155e118SSrikanth Jampala 
2365155e118SSrikanth Jampala 	if (core_int.s.pem)
2375155e118SSrikanth Jampala 		clear_pem_err_intr(ndev);
2385155e118SSrikanth Jampala 
2395155e118SSrikanth Jampala 	if (core_int.s.lbc)
2405155e118SSrikanth Jampala 		clear_lbc_err_intr(ndev);
2415155e118SSrikanth Jampala 
2425155e118SSrikanth Jampala 	if (core_int.s.efl)
2435155e118SSrikanth Jampala 		clear_efl_err_intr(ndev);
2445155e118SSrikanth Jampala 
2455155e118SSrikanth Jampala 	if (core_int.s.bmi)
2465155e118SSrikanth Jampala 		clear_bmi_err_intr(ndev);
2475155e118SSrikanth Jampala 
2485155e118SSrikanth Jampala 	/* If more work callback the ISR, set resend */
2495155e118SSrikanth Jampala 	core_int.s.resend = 1;
2505155e118SSrikanth Jampala 	nitrox_write_csr(ndev, NPS_CORE_INT_ACTIVE, core_int.value);
25114fa93cdSSrikanth Jampala 
25214fa93cdSSrikanth Jampala 	return IRQ_HANDLED;
25314fa93cdSSrikanth Jampala }
25414fa93cdSSrikanth Jampala 
2555155e118SSrikanth Jampala void nitrox_unregister_interrupts(struct nitrox_device *ndev)
25614fa93cdSSrikanth Jampala {
2575155e118SSrikanth Jampala 	struct pci_dev *pdev = ndev->pdev;
2585155e118SSrikanth Jampala 	int i;
2595155e118SSrikanth Jampala 
2605155e118SSrikanth Jampala 	for (i = 0; i < ndev->num_vecs; i++) {
2615155e118SSrikanth Jampala 		struct nitrox_q_vector *qvec;
2625155e118SSrikanth Jampala 		int vec;
2635155e118SSrikanth Jampala 
2645155e118SSrikanth Jampala 		qvec = ndev->qvec + i;
2655155e118SSrikanth Jampala 		if (!qvec->valid)
2665155e118SSrikanth Jampala 			continue;
2675155e118SSrikanth Jampala 
2685155e118SSrikanth Jampala 		/* get the vector number */
2695155e118SSrikanth Jampala 		vec = pci_irq_vector(pdev, i);
2705155e118SSrikanth Jampala 		irq_set_affinity_hint(vec, NULL);
2715155e118SSrikanth Jampala 		free_irq(vec, qvec);
2725155e118SSrikanth Jampala 
2735155e118SSrikanth Jampala 		tasklet_disable(&qvec->resp_tasklet);
2745155e118SSrikanth Jampala 		tasklet_kill(&qvec->resp_tasklet);
2755155e118SSrikanth Jampala 		qvec->valid = false;
2765155e118SSrikanth Jampala 	}
2775155e118SSrikanth Jampala 	kfree(ndev->qvec);
2785155e118SSrikanth Jampala 	pci_free_irq_vectors(pdev);
2795155e118SSrikanth Jampala }
2805155e118SSrikanth Jampala 
2815155e118SSrikanth Jampala int nitrox_register_interrupts(struct nitrox_device *ndev)
2825155e118SSrikanth Jampala {
2835155e118SSrikanth Jampala 	struct pci_dev *pdev = ndev->pdev;
2845155e118SSrikanth Jampala 	struct nitrox_q_vector *qvec;
2855155e118SSrikanth Jampala 	int nr_vecs, vec, cpu;
2865155e118SSrikanth Jampala 	int ret, i;
28714fa93cdSSrikanth Jampala 
28814fa93cdSSrikanth Jampala 	/*
28914fa93cdSSrikanth Jampala 	 * PF MSI-X vectors
29014fa93cdSSrikanth Jampala 	 *
29114fa93cdSSrikanth Jampala 	 * Entry 0: NPS PKT ring 0
29214fa93cdSSrikanth Jampala 	 * Entry 1: AQMQ ring 0
29314fa93cdSSrikanth Jampala 	 * Entry 2: ZQM ring 0
29414fa93cdSSrikanth Jampala 	 * Entry 3: NPS PKT ring 1
29514fa93cdSSrikanth Jampala 	 * Entry 4: AQMQ ring 1
29614fa93cdSSrikanth Jampala 	 * Entry 5: ZQM ring 1
29714fa93cdSSrikanth Jampala 	 * ....
29814fa93cdSSrikanth Jampala 	 * Entry 192: NPS_CORE_INT_ACTIVE
29914fa93cdSSrikanth Jampala 	 */
3005155e118SSrikanth Jampala 	nr_vecs = pci_msix_vec_count(pdev);
30114fa93cdSSrikanth Jampala 
3025155e118SSrikanth Jampala 	/* Enable MSI-X */
3035155e118SSrikanth Jampala 	ret = pci_alloc_irq_vectors(pdev, nr_vecs, nr_vecs, PCI_IRQ_MSIX);
3045155e118SSrikanth Jampala 	if (ret < 0) {
3055155e118SSrikanth Jampala 		dev_err(DEV(ndev), "msix vectors %d alloc failed\n", nr_vecs);
3065155e118SSrikanth Jampala 		return ret;
3075155e118SSrikanth Jampala 	}
3085155e118SSrikanth Jampala 	ndev->num_vecs = nr_vecs;
3095155e118SSrikanth Jampala 
3105155e118SSrikanth Jampala 	ndev->qvec = kcalloc(nr_vecs, sizeof(*qvec), GFP_KERNEL);
3115155e118SSrikanth Jampala 	if (!ndev->qvec) {
3125155e118SSrikanth Jampala 		pci_free_irq_vectors(pdev);
31314fa93cdSSrikanth Jampala 		return -ENOMEM;
31414fa93cdSSrikanth Jampala 	}
31514fa93cdSSrikanth Jampala 
3165155e118SSrikanth Jampala 	/* request irqs for packet rings/ports */
3175155e118SSrikanth Jampala 	for (i = PKT_RING_MSIX_BASE; i < (nr_vecs - 1); i += NR_RING_VECTORS) {
3185155e118SSrikanth Jampala 		qvec = &ndev->qvec[i];
31914fa93cdSSrikanth Jampala 
3205155e118SSrikanth Jampala 		qvec->ring = i / NR_RING_VECTORS;
3215155e118SSrikanth Jampala 		if (qvec->ring >= ndev->nr_queues)
3225155e118SSrikanth Jampala 			break;
32314fa93cdSSrikanth Jampala 
3245155e118SSrikanth Jampala 		snprintf(qvec->name, IRQ_NAMESZ, "nitrox-pkt%d", qvec->ring);
3255155e118SSrikanth Jampala 		/* get the vector number */
3265155e118SSrikanth Jampala 		vec = pci_irq_vector(pdev, i);
3275155e118SSrikanth Jampala 		ret = request_irq(vec, nps_pkt_slc_isr, 0, qvec->name, qvec);
32814fa93cdSSrikanth Jampala 		if (ret) {
3295155e118SSrikanth Jampala 			dev_err(DEV(ndev), "irq failed for pkt ring/port%d\n",
3305155e118SSrikanth Jampala 				qvec->ring);
33114fa93cdSSrikanth Jampala 			goto irq_fail;
3325155e118SSrikanth Jampala 		}
3335155e118SSrikanth Jampala 		cpu = qvec->ring % num_online_cpus();
3345155e118SSrikanth Jampala 		irq_set_affinity_hint(vec, get_cpu_mask(cpu));
3355155e118SSrikanth Jampala 
3365155e118SSrikanth Jampala 		tasklet_init(&qvec->resp_tasklet, pkt_slc_resp_tasklet,
3375155e118SSrikanth Jampala 			     (unsigned long)qvec);
3385155e118SSrikanth Jampala 		qvec->cmdq = &ndev->pkt_inq[qvec->ring];
3395155e118SSrikanth Jampala 		qvec->valid = true;
3405155e118SSrikanth Jampala 	}
3415155e118SSrikanth Jampala 
3425155e118SSrikanth Jampala 	/* request irqs for non ring vectors */
3435155e118SSrikanth Jampala 	i = NON_RING_MSIX_BASE;
3445155e118SSrikanth Jampala 	qvec = &ndev->qvec[i];
3455155e118SSrikanth Jampala 
3465155e118SSrikanth Jampala 	snprintf(qvec->name, IRQ_NAMESZ, "nitrox-core-int%d", i);
3475155e118SSrikanth Jampala 	/* get the vector number */
3485155e118SSrikanth Jampala 	vec = pci_irq_vector(pdev, i);
3495155e118SSrikanth Jampala 	ret = request_irq(vec, nps_core_int_isr, 0, qvec->name, qvec);
3505155e118SSrikanth Jampala 	if (ret) {
3515155e118SSrikanth Jampala 		dev_err(DEV(ndev), "irq failed for nitrox-core-int%d\n", i);
3525155e118SSrikanth Jampala 		goto irq_fail;
3535155e118SSrikanth Jampala 	}
3545155e118SSrikanth Jampala 	cpu = num_online_cpus();
3555155e118SSrikanth Jampala 	irq_set_affinity_hint(vec, get_cpu_mask(cpu));
3565155e118SSrikanth Jampala 
3575155e118SSrikanth Jampala 	tasklet_init(&qvec->resp_tasklet, nps_core_int_tasklet,
3585155e118SSrikanth Jampala 		     (unsigned long)qvec);
3595155e118SSrikanth Jampala 	qvec->ndev = ndev;
3605155e118SSrikanth Jampala 	qvec->valid = true;
36114fa93cdSSrikanth Jampala 
36214fa93cdSSrikanth Jampala 	return 0;
36314fa93cdSSrikanth Jampala 
36414fa93cdSSrikanth Jampala irq_fail:
3655155e118SSrikanth Jampala 	nitrox_unregister_interrupts(ndev);
3665155e118SSrikanth Jampala 	return ret;
36714fa93cdSSrikanth Jampala }
368