net/bnxt: support enable/disable interrupt
Implement Rx Queue interrupt enable/disable functions Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
This commit is contained in:
parent
19e6af01bb
commit
1fe427fd08
@ -5,6 +5,7 @@
|
||||
;
|
||||
[Features]
|
||||
Link status = Y
|
||||
Rx interrupt = Y
|
||||
Queue start/stop = Y
|
||||
MTU update = Y
|
||||
Jumbo frame = Y
|
||||
|
@ -202,8 +202,16 @@ static int bnxt_init_chip(struct bnxt *bp)
|
||||
{
|
||||
unsigned int i, rss_idx, fw_idx;
|
||||
struct rte_eth_link new;
|
||||
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(bp->eth_dev);
|
||||
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
|
||||
uint32_t intr_vector = 0;
|
||||
uint32_t queue_id, base = BNXT_MISC_VEC_ID;
|
||||
uint32_t vec = BNXT_MISC_VEC_ID;
|
||||
int rc;
|
||||
|
||||
/* disable uio/vfio intr/eventfd mapping */
|
||||
rte_intr_disable(intr_handle);
|
||||
|
||||
if (bp->eth_dev->data->mtu > ETHER_MTU) {
|
||||
bp->eth_dev->data->dev_conf.rxmode.jumbo_frame = 1;
|
||||
bp->flags |= BNXT_FLAG_JUMBO;
|
||||
@ -306,6 +314,48 @@ static int bnxt_init_chip(struct bnxt *bp)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* check and configure queue intr-vector mapping */
|
||||
if ((rte_intr_cap_multiple(intr_handle) ||
|
||||
!RTE_ETH_DEV_SRIOV(bp->eth_dev).active) &&
|
||||
bp->eth_dev->data->dev_conf.intr_conf.rxq != 0) {
|
||||
intr_vector = bp->eth_dev->data->nb_rx_queues;
|
||||
RTE_LOG(INFO, PMD, "%s(): intr_vector = %d\n", __func__,
|
||||
intr_vector);
|
||||
if (intr_vector > bp->rx_cp_nr_rings) {
|
||||
RTE_LOG(ERR, PMD, "At most %d intr queues supported",
|
||||
bp->rx_cp_nr_rings);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
if (rte_intr_efd_enable(intr_handle, intr_vector))
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rte_intr_dp_is_en(intr_handle) && !intr_handle->intr_vec) {
|
||||
intr_handle->intr_vec =
|
||||
rte_zmalloc("intr_vec",
|
||||
bp->eth_dev->data->nb_rx_queues *
|
||||
sizeof(int), 0);
|
||||
if (intr_handle->intr_vec == NULL) {
|
||||
RTE_LOG(ERR, PMD, "Failed to allocate %d rx_queues"
|
||||
" intr_vec", bp->eth_dev->data->nb_rx_queues);
|
||||
return -ENOMEM;
|
||||
}
|
||||
RTE_LOG(DEBUG, PMD, "%s(): intr_handle->intr_vec = %p "
|
||||
"intr_handle->nb_efd = %d intr_handle->max_intr = %d\n",
|
||||
__func__, intr_handle->intr_vec, intr_handle->nb_efd,
|
||||
intr_handle->max_intr);
|
||||
}
|
||||
|
||||
for (queue_id = 0; queue_id < bp->eth_dev->data->nb_rx_queues;
|
||||
queue_id++) {
|
||||
intr_handle->intr_vec[queue_id] = vec;
|
||||
if (vec < base + intr_handle->nb_efd - 1)
|
||||
vec++;
|
||||
}
|
||||
|
||||
/* enable uio/vfio intr/eventfd mapping */
|
||||
rte_intr_enable(intr_handle);
|
||||
|
||||
rc = bnxt_get_hwrm_link_config(bp, &new);
|
||||
if (rc) {
|
||||
RTE_LOG(ERR, PMD, "HWRM Get link config failure rc: %x\n", rc);
|
||||
@ -421,6 +471,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
|
||||
};
|
||||
eth_dev->data->dev_conf.intr_conf.lsc = 1;
|
||||
|
||||
eth_dev->data->dev_conf.intr_conf.rxq = 1;
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*
|
||||
@ -2009,6 +2061,8 @@ static const struct eth_dev_ops bnxt_dev_ops = {
|
||||
.rx_queue_release = bnxt_rx_queue_release_op,
|
||||
.tx_queue_setup = bnxt_tx_queue_setup_op,
|
||||
.tx_queue_release = bnxt_tx_queue_release_op,
|
||||
.rx_queue_intr_enable = bnxt_rx_queue_intr_enable_op,
|
||||
.rx_queue_intr_disable = bnxt_rx_queue_intr_disable_op,
|
||||
.reta_update = bnxt_reta_update_op,
|
||||
.reta_query = bnxt_reta_query_op,
|
||||
.rss_hash_update = bnxt_rss_hash_update_op,
|
||||
|
@ -34,6 +34,9 @@
|
||||
#ifndef _BNXT_IRQ_H_
|
||||
#define _BNXT_IRQ_H_
|
||||
|
||||
#define BNXT_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET
|
||||
#define BNXT_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET
|
||||
|
||||
struct bnxt_irq {
|
||||
rte_intr_callback_fn handler;
|
||||
unsigned int vector;
|
||||
|
@ -362,3 +362,41 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
|
||||
out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev, uint16_t queue_id)
|
||||
{
|
||||
struct bnxt_rx_queue *rxq;
|
||||
struct bnxt_cp_ring_info *cpr;
|
||||
int rc = 0;
|
||||
|
||||
if (eth_dev->data->rx_queues) {
|
||||
rxq = eth_dev->data->rx_queues[queue_id];
|
||||
if (!rxq) {
|
||||
rc = -EINVAL;
|
||||
return rc;
|
||||
}
|
||||
cpr = rxq->cp_ring;
|
||||
B_CP_DB_ARM(cpr);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev, uint16_t queue_id)
|
||||
{
|
||||
struct bnxt_rx_queue *rxq;
|
||||
struct bnxt_cp_ring_info *cpr;
|
||||
int rc = 0;
|
||||
|
||||
if (eth_dev->data->rx_queues) {
|
||||
rxq = eth_dev->data->rx_queues[queue_id];
|
||||
if (!rxq) {
|
||||
rc = -EINVAL;
|
||||
return rc;
|
||||
}
|
||||
cpr = rxq->cp_ring;
|
||||
B_CP_DB_DISARM(cpr);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
@ -73,5 +73,9 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
|
||||
const struct rte_eth_rxconf *rx_conf,
|
||||
struct rte_mempool *mp);
|
||||
void bnxt_free_rx_mbufs(struct bnxt *bp);
|
||||
int bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev,
|
||||
uint16_t queue_id);
|
||||
int bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev,
|
||||
uint16_t queue_id);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user