MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bnxt_dev_configure_op

Function bnxt_dev_configure_op

dpdk/drivers/net/bnxt/bnxt_ethdev.c:1090–1196  ·  view source on GitHub ↗

Configure the device based on the configuration provided */

Source from the content-addressed store, hash-verified

1088
1089/* Configure the device based on the configuration provided */
1090static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
1091{
1092 struct bnxt *bp = eth_dev->data->dev_private;
1093 uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
1094 struct rte_eth_rss_conf *rss_conf = &eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
1095 int rc;
1096
1097 bp->rx_queues = (void *)eth_dev->data->rx_queues;
1098 bp->tx_queues = (void *)eth_dev->data->tx_queues;
1099 bp->tx_nr_rings = eth_dev->data->nb_tx_queues;
1100 bp->rx_nr_rings = eth_dev->data->nb_rx_queues;
1101
1102 rc = is_bnxt_in_error(bp);
1103 if (rc)
1104 return rc;
1105
1106 if (BNXT_VF(bp) && (bp->flags & BNXT_FLAG_NEW_RM)) {
1107 rc = bnxt_hwrm_check_vf_rings(bp);
1108 if (rc) {
1109 PMD_DRV_LOG(ERR, "HWRM insufficient resources\n");
1110 return -ENOSPC;
1111 }
1112
1113 /* If a resource has already been allocated - in this case
1114 * it is the async completion ring, free it. Reallocate it after
1115 * resource reservation. This will ensure the resource counts
1116 * are calculated correctly.
1117 */
1118
1119 pthread_mutex_lock(&bp->def_cp_lock);
1120
1121 if (!BNXT_HAS_NQ(bp) && bp->async_cp_ring) {
1122 bnxt_disable_int(bp);
1123 bnxt_free_cp_ring(bp, bp->async_cp_ring);
1124 }
1125
1126 rc = bnxt_hwrm_func_reserve_vf_resc(bp, false);
1127 if (rc) {
1128 PMD_DRV_LOG(ERR, "HWRM resource alloc fail:%x\n", rc);
1129 pthread_mutex_unlock(&bp->def_cp_lock);
1130 return -ENOSPC;
1131 }
1132
1133 if (!BNXT_HAS_NQ(bp) && bp->async_cp_ring) {
1134 rc = bnxt_alloc_async_cp_ring(bp);
1135 if (rc) {
1136 pthread_mutex_unlock(&bp->def_cp_lock);
1137 return rc;
1138 }
1139 bnxt_enable_int(bp);
1140 }
1141
1142 pthread_mutex_unlock(&bp->def_cp_lock);
1143 }
1144
1145 /* Inherit new configurations */
1146 if (eth_dev->data->nb_rx_queues > bp->max_rx_rings ||
1147 eth_dev->data->nb_tx_queues > bp->max_tx_rings ||

Callers

nothing calls this directly

Calls 11

is_bnxt_in_errorFunction · 0.85
bnxt_hwrm_check_vf_ringsFunction · 0.85
pthread_mutex_lockFunction · 0.85
bnxt_disable_intFunction · 0.85
bnxt_free_cp_ringFunction · 0.85
pthread_mutex_unlockFunction · 0.85
bnxt_alloc_async_cp_ringFunction · 0.85
bnxt_enable_intFunction · 0.85
bnxt_mtu_set_opFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected