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

Function ionic_lif_alloc

dpdk/drivers/net/ionic/ionic_lif.c:1006–1102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1004}
1005
1006int
1007ionic_lif_alloc(struct ionic_lif *lif)
1008{
1009 struct ionic_adapter *adapter = lif->adapter;
1010 uint32_t socket_id = rte_socket_id();
1011 int err;
1012
1013 /*
1014 * lif->name was zeroed on allocation.
1015 * Copy (sizeof() - 1) bytes to ensure that it is NULL terminated.
1016 */
1017 memcpy(lif->name, lif->eth_dev->data->name, sizeof(lif->name) - 1);
1018
1019 IONIC_PRINT(DEBUG, "LIF: %s", lif->name);
1020
1021 ionic_lif_queue_identify(lif);
1022
1023 if (lif->qtype_info[IONIC_QTYPE_TXQ].version < 1) {
1024 IONIC_PRINT(ERR, "FW too old, please upgrade");
1025 return -ENXIO;
1026 }
1027
1028 if (adapter->q_in_cmb) {
1029 if (adapter->bars.num_bars >= 3 &&
1030 lif->qtype_info[IONIC_QTYPE_RXQ].version >= 2 &&
1031 lif->qtype_info[IONIC_QTYPE_TXQ].version >= 3) {
1032 IONIC_PRINT(INFO, "%s enabled on %s",
1033 PMD_IONIC_CMB_KVARG, lif->name);
1034 lif->state |= IONIC_LIF_F_Q_IN_CMB;
1035 } else {
1036 IONIC_PRINT(ERR, "%s not supported on %s, disabled",
1037 PMD_IONIC_CMB_KVARG, lif->name);
1038 }
1039 }
1040
1041 IONIC_PRINT(DEBUG, "Allocating Lif Info");
1042
1043 rte_spinlock_init(&lif->adminq_lock);
1044 rte_spinlock_init(&lif->adminq_service_lock);
1045
1046 lif->kern_dbpage = adapter->idev.db_pages;
1047 if (!lif->kern_dbpage) {
1048 IONIC_PRINT(ERR, "Cannot map dbpage, aborting");
1049 return -ENOMEM;
1050 }
1051
1052 lif->txqcqs = rte_calloc_socket("ionic",
1053 adapter->max_ntxqs_per_lif,
1054 sizeof(*lif->txqcqs),
1055 RTE_CACHE_LINE_SIZE, socket_id);
1056 if (!lif->txqcqs) {
1057 IONIC_PRINT(ERR, "Cannot allocate tx queues array");
1058 return -ENOMEM;
1059 }
1060
1061 lif->rxqcqs = rte_calloc_socket("ionic",
1062 adapter->max_nrxqs_per_lif,
1063 sizeof(*lif->rxqcqs),

Callers 1

eth_ionic_dev_initFunction · 0.85

Calls 9

rte_socket_idFunction · 0.85
ionic_lif_queue_identifyFunction · 0.85
rte_spinlock_initFunction · 0.85
rte_calloc_socketFunction · 0.85
ionic_notify_qcq_allocFunction · 0.85
ionic_admin_qcq_allocFunction · 0.85
rte_eth_dma_zone_reserveFunction · 0.85
memcpyFunction · 0.50
rte_mem_page_sizeFunction · 0.50

Tested by

no test coverage detected