net/ionic: support admin queue
[dpdk.git] / drivers / net / ionic / ionic_lif.h
index 6e3233d..96522c5 100644 (file)
 #include "ionic_osdep.h"
 #include "ionic_dev.h"
 
+#define IONIC_ADMINQ_LENGTH    16      /* must be a power of two */
+
+#define IONIC_QCQ_F_INITED     BIT(0)
+#define IONIC_QCQ_F_SG         BIT(1)
+#define IONIC_QCQ_F_INTR       BIT(2)
+
+/* Queue / Completion Queue */
+struct ionic_qcq {
+       struct ionic_queue q;        /**< Queue */
+       struct ionic_cq cq;          /**< Completion Queue */
+       struct ionic_lif *lif;       /**< LIF */
+       struct rte_mempool *mb_pool; /**< mbuf pool to populate the RX ring */
+       const struct rte_memzone *base_z;
+       void *base;
+       rte_iova_t base_pa;
+       uint32_t total_size;
+       uint32_t flags;
+       struct ionic_intr_info intr;
+};
+
 #define IONIC_LIF_F_INITED             BIT(0)
 
 #define IONIC_LIF_NAME_MAX_SZ          (32)
@@ -25,6 +45,9 @@ struct ionic_lif {
        uint32_t hw_index;
        uint32_t state;
        uint32_t kern_pid;
+       rte_spinlock_t adminq_lock;
+       rte_spinlock_t adminq_service_lock;
+       struct ionic_qcq *adminqcq;
        struct ionic_doorbell __iomem *kern_dbpage;
        char name[IONIC_LIF_NAME_MAX_SZ];
        uint32_t info_sz;
@@ -47,4 +70,17 @@ int ionic_lif_start(struct ionic_lif *lif);
 int ionic_lif_configure(struct ionic_lif *lif);
 void ionic_lif_reset(struct ionic_lif *lif);
 
+int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr);
+void ionic_intr_free(struct ionic_lif *lif, struct ionic_intr_info *intr);
+
+bool ionic_adminq_service(struct ionic_cq *cq, uint32_t cq_desc_index,
+       void *cb_arg);
+int ionic_qcq_service(struct ionic_qcq *qcq, int budget, ionic_cq_cb cb,
+       void *cb_arg);
+
+void ionic_qcq_free(struct ionic_qcq *qcq);
+
+int ionic_qcq_enable(struct ionic_qcq *qcq);
+int ionic_qcq_disable(struct ionic_qcq *qcq);
+
 #endif /* _IONIC_LIF_H_ */