summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
diff options
context:
space:
mode:
authorSunil Goutham <sgoutham@marvell.com>2020-01-27 16:05:19 +0300
committerDavid S. Miller <davem@davemloft.net>2020-01-27 16:33:39 +0300
commit04a21ef303df74737259190d7d7cf77a129bb56a (patch)
treedbfad68032b37307a29dd0e6a24d36a141676512 /drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
parentcaa2da34fd25a37e9fd43343b6966fb9d730a6d5 (diff)
downloadlinux-04a21ef303df74737259190d7d7cf77a129bb56a.tar.xz
octeontx2-pf: Setup interrupts and NAPI handler
Completion queue (CQ) is the one with which HW notifies SW on a packet reception or transmission. Each of the RQ and SQ are mapped to a unique CQ and again both CQs are mapped to same interrupt ie the CINT. So that each core has one interrupt source in whose handler both Rx and Tx notifications are processed. Also - Registered a NAPI handler for the CINT. - Setup coalescing parameters. - IRQ affinity hints etc Signed-off-by: Sunil Goutham <sgoutham@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h')
-rw-r--r--drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h38
1 files changed, 32 insertions, 6 deletions
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
index ce6efcf2e8cf..a81bdc633884 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
@@ -37,6 +37,22 @@
((x) - OTX2_HEAD_ROOM - \
OTX2_DATA_ALIGN(sizeof(struct skb_shared_info)))
+/* IRQ triggered when NIX_LF_CINTX_CNT[ECOUNT]
+ * is equal to this value.
+ */
+#define CQ_CQE_THRESH_DEFAULT 10
+
+/* IRQ triggered when NIX_LF_CINTX_CNT[ECOUNT]
+ * is nonzero and this much time elapses after that.
+ */
+#define CQ_TIMER_THRESH_DEFAULT 1 /* 1 usec */
+#define CQ_TIMER_THRESH_MAX 25 /* 25 usec */
+
+/* Min number of CQs (of the ones mapped to this CINT)
+ * with valid CQEs.
+ */
+#define CQ_QCOUNT_DEFAULT 1
+
struct otx2_snd_queue {
u8 aura_id;
u16 sqe_size;
@@ -52,6 +68,20 @@ struct otx2_snd_queue {
u64 *sqb_ptrs;
} ____cacheline_aligned_in_smp;
+enum cq_type {
+ CQ_RX,
+ CQ_TX,
+ CQS_PER_CINT = 2, /* RQ + SQ */
+};
+
+struct otx2_cq_poll {
+ void *dev;
+#define CINT_INVALID_CQ 255
+ u8 cint_idx;
+ u8 cq_ids[CQS_PER_CINT];
+ struct napi_struct napi;
+};
+
struct otx2_pool {
struct qmem *stack;
struct qmem *fc_addr;
@@ -62,12 +92,6 @@ struct otx2_pool {
struct page *page;
};
-enum cq_type {
- CQ_RX,
- CQ_TX,
- CQS_PER_CINT = 2, /* RQ + SQ */
-};
-
struct otx2_cq_queue {
u8 cq_idx;
u8 cq_type;
@@ -86,6 +110,7 @@ struct otx2_qset {
u16 cq_cnt;
u16 xqe_size;
struct otx2_pool *pool;
+ struct otx2_cq_poll *napi;
struct otx2_cq_queue *cq;
struct otx2_snd_queue *sq;
};
@@ -99,4 +124,5 @@ static inline u64 otx2_iova_to_phys(void *iommu_domain, dma_addr_t dma_addr)
return dma_addr;
}
+int otx2_napi_handler(struct napi_struct *napi, int budget);
#endif /* OTX2_TXRX_H */