net/ionic: add doorbells
Doorbell registers are used by the driver to signal to the NIC that requests are waiting on the message queues. Signed-off-by: Alfredo Cardigliano <cardigliano@ntop.org> Reviewed-by: Shannon Nelson <snelson@pensando.io>
This commit is contained in:
parent
669c8de67c
commit
c67719e133
@ -5,6 +5,7 @@
|
||||
#include <rte_malloc.h>
|
||||
|
||||
#include "ionic_dev.h"
|
||||
#include "ionic_lif.h"
|
||||
#include "ionic.h"
|
||||
|
||||
int
|
||||
@ -297,3 +298,17 @@ ionic_dev_cmd_lif_reset(struct ionic_dev *idev, uint16_t lif_index)
|
||||
|
||||
ionic_dev_cmd_go(idev, &cmd);
|
||||
}
|
||||
|
||||
int
|
||||
ionic_db_page_num(struct ionic_lif *lif, int pid)
|
||||
{
|
||||
return (lif->index * 0) + pid;
|
||||
}
|
||||
|
||||
void
|
||||
ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr,
|
||||
unsigned long index)
|
||||
{
|
||||
ionic_intr_clean(idev->intr_ctrl, index);
|
||||
intr->index = index;
|
||||
}
|
||||
|
@ -121,6 +121,22 @@ struct ionic_dev {
|
||||
uint32_t port_info_sz;
|
||||
};
|
||||
|
||||
#define IONIC_INTR_INDEX_NOT_ASSIGNED (-1)
|
||||
#define IONIC_INTR_NAME_MAX_SZ (32)
|
||||
|
||||
struct ionic_intr_info {
|
||||
char name[IONIC_INTR_NAME_MAX_SZ];
|
||||
int index;
|
||||
uint32_t vector;
|
||||
struct ionic_intr __iomem *ctrl;
|
||||
};
|
||||
|
||||
struct ionic_lif;
|
||||
struct ionic_adapter;
|
||||
|
||||
void ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr,
|
||||
unsigned long index);
|
||||
|
||||
int ionic_dev_setup(struct ionic_adapter *adapter);
|
||||
|
||||
void ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd);
|
||||
@ -150,4 +166,6 @@ void ionic_dev_cmd_lif_init(struct ionic_dev *idev, uint16_t lif_index,
|
||||
rte_iova_t addr);
|
||||
void ionic_dev_cmd_lif_reset(struct ionic_dev *idev, uint16_t lif_index);
|
||||
|
||||
int ionic_db_page_num(struct ionic_lif *lif, int pid);
|
||||
|
||||
#endif /* _IONIC_DEV_H_ */
|
||||
|
@ -10,15 +10,38 @@
|
||||
#include "ionic_lif.h"
|
||||
#include "ionic_ethdev.h"
|
||||
|
||||
static void *
|
||||
ionic_bus_map_dbpage(struct ionic_adapter *adapter, int page_num)
|
||||
{
|
||||
char *vaddr = adapter->bars[IONIC_PCI_BAR_DBELL].vaddr;
|
||||
|
||||
if (adapter->num_bars <= IONIC_PCI_BAR_DBELL)
|
||||
return NULL;
|
||||
|
||||
return (void *)&vaddr[page_num << PAGE_SHIFT];
|
||||
}
|
||||
|
||||
int
|
||||
ionic_lif_alloc(struct ionic_lif *lif)
|
||||
{
|
||||
struct ionic_adapter *adapter = lif->adapter;
|
||||
uint32_t socket_id = rte_socket_id();
|
||||
int dbpage_num;
|
||||
|
||||
snprintf(lif->name, sizeof(lif->name), "lif%u", lif->index);
|
||||
|
||||
IONIC_PRINT(DEBUG, "Allocating Lif Info");
|
||||
|
||||
lif->kern_pid = 0;
|
||||
|
||||
dbpage_num = ionic_db_page_num(lif, 0);
|
||||
|
||||
lif->kern_dbpage = ionic_bus_map_dbpage(adapter, dbpage_num);
|
||||
if (!lif->kern_dbpage) {
|
||||
IONIC_PRINT(ERR, "Cannot map dbpage, aborting");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
lif->info_sz = RTE_ALIGN(sizeof(*lif->info), PAGE_SIZE);
|
||||
|
||||
lif->info_z = rte_eth_dma_zone_reserve(lif->eth_dev,
|
||||
|
@ -24,6 +24,8 @@ struct ionic_lif {
|
||||
uint32_t index;
|
||||
uint32_t hw_index;
|
||||
uint32_t state;
|
||||
uint32_t kern_pid;
|
||||
struct ionic_doorbell __iomem *kern_dbpage;
|
||||
char name[IONIC_LIF_NAME_MAX_SZ];
|
||||
uint32_t info_sz;
|
||||
struct ionic_lif_info *info;
|
||||
|
Loading…
x
Reference in New Issue
Block a user