X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fenic%2Fenic_main.c;h=805eb5e46a32970ca6109c2ce7d989860bc8f274;hb=8b428cb5a92efc5da2b48faec47528d06367cf4e;hp=4de65f6c6dc673c0e1f7a705d919e8096b706b19;hpb=39cf83f1771bd6b2050b7f3572a278bc2e58a1eb;p=dpdk.git diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 4de65f6c6d..805eb5e46a 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -50,7 +50,7 @@ static int is_eth_addr_valid(uint8_t *addr) return !is_mcast_addr(addr) && !is_zero_addr(addr); } -static void +void enic_rxmbuf_queue_release(__rte_unused struct enic *enic, struct vnic_rq *rq) { uint16_t i; @@ -68,7 +68,7 @@ enic_rxmbuf_queue_release(__rte_unused struct enic *enic, struct vnic_rq *rq) } } -static void enic_free_wq_buf(struct rte_mbuf **buf) +void enic_free_wq_buf(struct rte_mbuf **buf) { struct rte_mbuf *mbuf = *buf; @@ -191,8 +191,7 @@ int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr) return err; } -static void -enic_free_rq_buf(struct rte_mbuf **mbuf) +void enic_free_rq_buf(struct rte_mbuf **mbuf) { if (*mbuf == NULL) return; @@ -275,7 +274,7 @@ void enic_init_vnic_resources(struct enic *enic) } -static int +int enic_alloc_rx_queue_mbufs(struct enic *enic, struct vnic_rq *rq) { struct rte_mbuf *mb; @@ -535,6 +534,11 @@ void enic_pick_rx_handler(struct rte_eth_dev *eth_dev) { struct enic *enic = pmd_priv(eth_dev); + if (enic->cq64) { + ENICPMD_LOG(DEBUG, " use the normal Rx handler for 64B CQ entry"); + eth_dev->rx_pkt_burst = &enic_recv_pkts_64; + return; + } /* * Preference order: * 1. The vectorized handler if possible and requested. @@ -604,9 +608,6 @@ int enic_enable(struct enic *enic) err = enic_rxq_intr_init(enic); if (err) return err; - if (enic_clsf_init(enic)) - dev_warning(enic, "Init of hash table for clsf failed."\ - "Flow director feature will not work\n"); /* Initialize flowman if not already initialized during probe */ if (enic->fm == NULL && enic_fm_init(enic)) @@ -806,16 +807,36 @@ int enic_alloc_rq(struct enic *enic, uint16_t queue_idx, unsigned int socket_id, struct rte_mempool *mp, uint16_t nb_desc, uint16_t free_thresh) { + struct enic_vf_representor *vf; int rc; - uint16_t sop_queue_idx = enic_rte_rq_idx_to_sop_idx(queue_idx); - uint16_t data_queue_idx = enic_rte_rq_idx_to_data_idx(queue_idx, enic); - struct vnic_rq *rq_sop = &enic->rq[sop_queue_idx]; - struct vnic_rq *rq_data = &enic->rq[data_queue_idx]; + uint16_t sop_queue_idx; + uint16_t data_queue_idx; + uint16_t cq_idx; + struct vnic_rq *rq_sop; + struct vnic_rq *rq_data; unsigned int mbuf_size, mbufs_per_pkt; unsigned int nb_sop_desc, nb_data_desc; uint16_t min_sop, max_sop, min_data, max_data; uint32_t max_rx_pkt_len; + /* + * Representor uses a reserved PF queue. Translate representor + * queue number to PF queue number. + */ + if (enic_is_vf_rep(enic)) { + RTE_ASSERT(queue_idx == 0); + vf = VF_ENIC_TO_VF_REP(enic); + sop_queue_idx = vf->pf_rq_sop_idx; + data_queue_idx = vf->pf_rq_data_idx; + enic = vf->pf; + queue_idx = sop_queue_idx; + } else { + sop_queue_idx = enic_rte_rq_idx_to_sop_idx(queue_idx); + data_queue_idx = enic_rte_rq_idx_to_data_idx(queue_idx, enic); + } + cq_idx = enic_cq_rq(enic, sop_queue_idx); + rq_sop = &enic->rq[sop_queue_idx]; + rq_data = &enic->rq[data_queue_idx]; rq_sop->is_sop = 1; rq_sop->data_queue_idx = data_queue_idx; rq_data->is_sop = 0; @@ -935,8 +956,22 @@ int enic_alloc_rq(struct enic *enic, uint16_t queue_idx, } nb_data_desc = rq_data->ring.desc_count; } - rc = vnic_cq_alloc(enic->vdev, &enic->cq[queue_idx], queue_idx, + /* Enable 64B CQ entry if requested */ + if (enic->cq64 && vnic_dev_set_cq_entry_size(enic->vdev, + sop_queue_idx, VNIC_RQ_CQ_ENTRY_SIZE_64)) { + dev_err(enic, "failed to enable 64B CQ entry on sop rq\n"); + goto err_free_rq_data; + } + if (rq_data->in_use && enic->cq64 && + vnic_dev_set_cq_entry_size(enic->vdev, data_queue_idx, + VNIC_RQ_CQ_ENTRY_SIZE_64)) { + dev_err(enic, "failed to enable 64B CQ entry on data rq\n"); + goto err_free_rq_data; + } + + rc = vnic_cq_alloc(enic->vdev, &enic->cq[cq_idx], cq_idx, socket_id, nb_sop_desc + nb_data_desc, + enic->cq64 ? sizeof(struct cq_enet_rq_desc_64) : sizeof(struct cq_enet_rq_desc)); if (rc) { dev_err(enic, "error in allocation of cq for rq\n"); @@ -979,7 +1014,7 @@ err_free_sop_mbuf: rte_free(rq_sop->mbuf_ring); err_free_cq: /* cleanup on error */ - vnic_cq_free(&enic->cq[queue_idx]); + vnic_cq_free(&enic->cq[cq_idx]); err_free_rq_data: if (rq_data->in_use) vnic_rq_free(rq_data); @@ -1007,12 +1042,27 @@ void enic_free_wq(void *txq) int enic_alloc_wq(struct enic *enic, uint16_t queue_idx, unsigned int socket_id, uint16_t nb_desc) { + struct enic_vf_representor *vf; int err; - struct vnic_wq *wq = &enic->wq[queue_idx]; - unsigned int cq_index = enic_cq_wq(enic, queue_idx); + struct vnic_wq *wq; + unsigned int cq_index; char name[RTE_MEMZONE_NAMESIZE]; static int instance; + /* + * Representor uses a reserved PF queue. Translate representor + * queue number to PF queue number. + */ + if (enic_is_vf_rep(enic)) { + RTE_ASSERT(queue_idx == 0); + vf = VF_ENIC_TO_VF_REP(enic); + queue_idx = vf->pf_wq_idx; + cq_index = vf->pf_wq_cq_idx; + enic = vf->pf; + } else { + cq_index = enic_cq_wq(enic, queue_idx); + } + wq = &enic->wq[queue_idx]; wq->socket_id = socket_id; /* * rte_eth_tx_queue_setup() checks min, max, and alignment. So just @@ -1068,7 +1118,6 @@ int enic_disable(struct enic *enic) vnic_dev_disable(enic->vdev); - enic_clsf_destroy(enic); enic_fm_destroy(enic); if (!enic_is_sriov_vf(enic)) @@ -1448,6 +1497,17 @@ int enic_set_vnic_res(struct enic *enic) if (eth_dev->data->dev_conf.intr_conf.rxq) { required_intr += eth_dev->data->nb_rx_queues; } + ENICPMD_LOG(DEBUG, "Required queues for PF: rq %u wq %u cq %u", + required_rq, required_wq, required_cq); + if (enic->vf_required_rq) { + /* Queues needed for VF representors */ + required_rq += enic->vf_required_rq; + required_wq += enic->vf_required_wq; + required_cq += enic->vf_required_cq; + ENICPMD_LOG(DEBUG, "Required queues for VF representors: rq %u wq %u cq %u", + enic->vf_required_rq, enic->vf_required_wq, + enic->vf_required_cq); + } if (enic->conf_rq_count < required_rq) { dev_err(dev, "Not enough Receive queues. Requested:%u which uses %d RQs on VIC, Configured:%u\n", @@ -1493,7 +1553,7 @@ enic_reinit_rq(struct enic *enic, unsigned int rq_idx) sop_rq = &enic->rq[enic_rte_rq_idx_to_sop_idx(rq_idx)]; data_rq = &enic->rq[enic_rte_rq_idx_to_data_idx(rq_idx, enic)]; - cq_idx = rq_idx; + cq_idx = enic_cq_rq(enic, rq_idx); vnic_cq_clean(&enic->cq[cq_idx]); vnic_cq_init(&enic->cq[cq_idx], @@ -1708,9 +1768,6 @@ static int enic_dev_init(struct enic *enic) return -1; } - /* Get the supported filters */ - enic_fdir_info(enic); - eth_dev->data->mac_addrs = rte_zmalloc("enic_mac_addr", sizeof(struct rte_ether_addr) * ENIC_UNICAST_PERFECT_FILTERS, 0);