numam-dpdk/drivers/net/mana/mana.h

102 lines
2.2 KiB
C
Raw Normal View History

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright 2022 Microsoft Corporation
*/
#ifndef __MANA_H__
#define __MANA_H__
#define PCI_VENDOR_ID_MICROSOFT 0x1414
#define PCI_DEVICE_ID_MICROSOFT_MANA 0x00ba
/* Shared data between primary/secondary processes */
struct mana_shared_data {
rte_spinlock_t lock;
int init_done;
unsigned int primary_cnt;
unsigned int secondary_cnt;
};
struct mana_process_priv {
void *db_page;
};
struct mana_priv {
struct rte_eth_dev_data *dev_data;
struct mana_process_priv *process_priv;
int num_queues;
/* DPDK port */
uint16_t port_id;
/* IB device port */
uint8_t dev_port;
struct ibv_context *ib_ctx;
struct ibv_pd *ib_pd;
struct ibv_pd *ib_parent_pd;
void *db_page;
int max_rx_queues;
int max_tx_queues;
int max_rx_desc;
int max_tx_desc;
int max_send_sge;
int max_recv_sge;
int max_mr;
uint64_t max_mr_size;
};
extern int mana_logtype_driver;
extern int mana_logtype_init;
#define DRV_LOG(level, fmt, args...) \
rte_log(RTE_LOG_ ## level, mana_logtype_driver, "%s(): " fmt "\n", \
__func__, ## args)
#define PMD_INIT_LOG(level, fmt, args...) \
rte_log(RTE_LOG_ ## level, mana_logtype_init, "%s(): " fmt "\n",\
__func__, ## args)
#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
uint16_t mana_rx_burst_removed(void *dpdk_rxq, struct rte_mbuf **pkts,
uint16_t pkts_n);
uint16_t mana_tx_burst_removed(void *dpdk_rxq, struct rte_mbuf **pkts,
uint16_t pkts_n);
/** Request timeout for IPC. */
#define MANA_MP_REQ_TIMEOUT_SEC 5
/* Request types for IPC. */
enum mana_mp_req_type {
MANA_MP_REQ_VERBS_CMD_FD = 1,
MANA_MP_REQ_CREATE_MR,
MANA_MP_REQ_START_RXTX,
MANA_MP_REQ_STOP_RXTX,
};
/* Pameters for IPC. */
struct mana_mp_param {
enum mana_mp_req_type type;
int port_id;
int result;
/* MANA_MP_REQ_CREATE_MR */
uintptr_t addr;
uint32_t len;
};
#define MANA_MP_NAME "net_mana_mp"
int mana_mp_init_primary(void);
int mana_mp_init_secondary(void);
void mana_mp_uninit_primary(void);
void mana_mp_uninit_secondary(void);
int mana_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev);
void mana_mp_req_on_rxtx(struct rte_eth_dev *dev, enum mana_mp_req_type type);
void *mana_alloc_verbs_buf(size_t size, void *data);
void mana_free_verbs_buf(void *ptr, void *data __rte_unused);
#endif