if (rc)
goto alloc_mem_err;
- rc = bnxt_alloc_vnic_attributes(bp);
+ rc = bnxt_alloc_vnic_attributes(bp, reconfig);
if (rc)
goto alloc_mem_err;
{
struct bnxt *bp = eth_dev->data->dev_private;
uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
+ struct rte_eth_rss_conf *rss_conf = ð_dev->data->dev_conf.rx_adv_conf.rss_conf;
int rc;
bp->rx_queues = (void *)eth_dev->data->rx_queues;
rx_offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
eth_dev->data->dev_conf.rxmode.offloads = rx_offloads;
+ /* application provides the hash key to program */
+ if (rss_conf->rss_key != NULL) {
+ if (rss_conf->rss_key_len != HW_HASH_KEY_SIZE)
+ PMD_DRV_LOG(WARNING, "port %u RSS key len must be %d bytes long",
+ eth_dev->data->port_id, HW_HASH_KEY_SIZE);
+ else
+ memcpy(bp->rss_conf.rss_key, rss_conf->rss_key, HW_HASH_KEY_SIZE);
+ }
+ bp->rss_conf.rss_key_len = HW_HASH_KEY_SIZE;
+ bp->rss_conf.rss_hf = rss_conf->rss_hf;
+
bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu);
return 0;
}
bp->flags |= BNXT_FLAG_UPDATE_HASH;
- memcpy(ð_dev->data->dev_conf.rx_adv_conf.rss_conf,
- rss_conf,
- sizeof(*rss_conf));
/* Update the default RSS VNIC(s) */
vnic = BNXT_GET_DEFAULT_VNIC(bp);
bnxt_rte_to_hwrm_hash_level(bp, rss_conf->rss_hf,
RTE_ETH_RSS_LEVEL(rss_conf->rss_hf));
+ /* Cache the hash function */
+ bp->rss_conf.rss_hf = rss_conf->rss_hf;
+
/*
* If hashkey is not specified, use the previously configured
* hashkey
}
memcpy(vnic->rss_hash_key, rss_conf->rss_key, rss_conf->rss_key_len);
+ /* Cache the hash key */
+ memcpy(bp->rss_conf.rss_key, rss_conf->rss_key, HW_HASH_KEY_SIZE);
+
rss_config:
rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
return rc;
}
}
+ if (!reconfig_dev) {
+ bp->rss_conf.rss_key = rte_zmalloc("bnxt_rss_key",
+ HW_HASH_KEY_SIZE, 0);
+ if (bp->rss_conf.rss_key == NULL) {
+ PMD_DRV_LOG(ERR, "port %u cannot allocate RSS hash key memory",
+ bp->eth_dev->data->port_id);
+ return -ENOMEM;
+ }
+ }
+
rc = bnxt_alloc_mem(bp, reconfig_dev);
if (rc)
return rc;
bnxt_free_error_recovery_info(bp);
rte_free(bp->mcast_addr_list);
bp->mcast_addr_list = NULL;
+ rte_free(bp->rss_conf.rss_key);
+ bp->rss_conf.rss_key = NULL;
}
bnxt_uninit_ctx_mem(bp);
}
}
-int bnxt_alloc_vnic_attributes(struct bnxt *bp)
+int bnxt_alloc_vnic_attributes(struct bnxt *bp, bool reconfig)
{
struct bnxt_vnic_info *vnic;
struct rte_pci_device *pdev = bp->pdev;
vnic->rss_hash_key_dma_addr = vnic->rss_table_dma_addr +
rss_table_size;
- bnxt_prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE);
+ if (!reconfig) {
+ bnxt_prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE);
+ memcpy(bp->rss_conf.rss_key, vnic->rss_hash_key, HW_HASH_KEY_SIZE);
+ } else {
+ memcpy(vnic->rss_hash_key, bp->rss_conf.rss_key, HW_HASH_KEY_SIZE);
+ }
}
return 0;
struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp);
void bnxt_free_all_vnics(struct bnxt *bp);
void bnxt_free_vnic_attributes(struct bnxt *bp);
-int bnxt_alloc_vnic_attributes(struct bnxt *bp);
+int bnxt_alloc_vnic_attributes(struct bnxt *bp, bool reconfig);
void bnxt_free_vnic_mem(struct bnxt *bp);
int bnxt_alloc_vnic_mem(struct bnxt *bp);
int bnxt_vnic_grp_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);