X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Fbnxt_vnic.c;h=2f0ed10265c290214a07c7eb087d8900c599d5ba;hb=cea37e513329fde070abb8b1f655836f550e54d3;hp=c652b8f03e48177bce6741a73fd8d462321fd7df;hpb=1f3cea0044ceccbd3a0f38307cf0808c5b16d6b1;p=dpdk.git diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index c652b8f03e..2f0ed10265 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -16,7 +16,7 @@ * VNIC Functions */ -static void prandom_bytes(void *dest_ptr, size_t len) +void prandom_bytes(void *dest_ptr, size_t len) { char *dest = (char *)dest_ptr; uint64_t rb; @@ -117,6 +117,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) const struct rte_memzone *mz; char mz_name[RTE_MEMZONE_NAMESIZE]; uint32_t entry_length; + size_t rss_table_size; uint16_t max_vnics; int i; rte_iova_t mz_phys_addr; @@ -125,11 +126,12 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) BNXT_MAX_MC_ADDRS * RTE_ETHER_ADDR_LEN; if (BNXT_CHIP_THOR(bp)) - entry_length += BNXT_RSS_TBL_SIZE_THOR * - 2 * sizeof(*vnic->rss_table); + rss_table_size = BNXT_RSS_TBL_SIZE_THOR * + 2 * sizeof(*vnic->rss_table); else - entry_length += HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table); - entry_length = RTE_CACHE_LINE_ROUNDUP(entry_length); + rss_table_size = HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table); + + entry_length = RTE_CACHE_LINE_ROUNDUP(entry_length + rss_table_size); max_vnics = bp->max_vnics; snprintf(mz_name, RTE_MEMZONE_NAMESIZE, @@ -148,10 +150,9 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) } mz_phys_addr = mz->iova; if ((unsigned long)mz->addr == mz_phys_addr) { - PMD_DRV_LOG(WARNING, - "Memzone physical address same as virtual.\n"); - PMD_DRV_LOG(WARNING, - "Using rte_mem_virt2iova()\n"); + PMD_DRV_LOG(DEBUG, + "Memzone physical address same as virtual.\n"); + PMD_DRV_LOG(DEBUG, "Using rte_mem_virt2iova()\n"); mz_phys_addr = rte_mem_virt2iova(mz->addr); if (mz_phys_addr == RTE_BAD_IOVA) { PMD_DRV_LOG(ERR, @@ -170,10 +171,10 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) vnic->rss_table_dma_addr = mz_phys_addr + (entry_length * i); vnic->rss_hash_key = (void *)((char *)vnic->rss_table + - HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table)); + rss_table_size); vnic->rss_hash_key_dma_addr = vnic->rss_table_dma_addr + - HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table); + rss_table_size; vnic->mc_list = (void *)((char *)vnic->rss_hash_key + HW_HASH_KEY_SIZE); vnic->mc_list_dma_addr = vnic->rss_hash_key_dma_addr + @@ -221,3 +222,39 @@ int bnxt_alloc_vnic_mem(struct bnxt *bp) bp->vnic_info = vnic_mem; return 0; } + +int bnxt_vnic_grp_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic) +{ + uint32_t size = sizeof(*vnic->fw_grp_ids) * bp->max_ring_grps; + + vnic->fw_grp_ids = rte_zmalloc("vnic_fw_grp_ids", size, 0); + if (!vnic->fw_grp_ids) { + PMD_DRV_LOG(ERR, + "Failed to alloc %d bytes for group ids\n", + size); + return -ENOMEM; + } + memset(vnic->fw_grp_ids, -1, size); + + return 0; +} + +uint16_t bnxt_rte_to_hwrm_hash_types(uint64_t rte_type) +{ + uint16_t hwrm_type = 0; + + if (rte_type & ETH_RSS_IPV4) + hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4; + if (rte_type & ETH_RSS_NONFRAG_IPV4_TCP) + hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV4; + if (rte_type & ETH_RSS_NONFRAG_IPV4_UDP) + hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV4; + if (rte_type & ETH_RSS_IPV6) + hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV6; + if (rte_type & ETH_RSS_NONFRAG_IPV6_TCP) + hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV6; + if (rte_type & ETH_RSS_NONFRAG_IPV6_UDP) + hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV6; + + return hwrm_type; +}