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

Function bnxt_vnic_queue_action_alloc

dpdk/drivers/net/bnxt/bnxt_vnic.c:911–962  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

909}
910
911int32_t bnxt_vnic_queue_action_alloc(struct bnxt *bp,
912 uint16_t q_index,
913 uint16_t *vnic_idx,
914 uint16_t *vnicid)
915{
916 uint64_t queue_list[BNXT_VNIC_MAX_QUEUE_SZ_IN_64BITS] = {0};
917 struct bnxt_vnic_info *vnic_info;
918 int32_t idx;
919 int32_t rc = -EINVAL;
920
921 /* validate the given queue id */
922 if (q_index >= bp->rx_nr_rings || q_index >= BNXT_VNIC_MAX_QUEUE_SIZE) {
923 PMD_DRV_LOG(ERR, "invalid queue id should be less than %d\n",
924 bp->rx_nr_rings);
925 return rc;
926 }
927
928 /* Populate the queue list */
929 BNXT_VNIC_BITMAP_SET(queue_list, q_index);
930
931 /* check to see if the q_index is already in use */
932 idx = bnxt_vnic_queue_db_lookup(bp, queue_list);
933 if (idx < 0) {
934 /* Assign the vnic slot */
935 idx = bnxt_vnic_queue_db_add(bp, queue_list);
936 if (idx < 0) {
937 PMD_DRV_LOG(DEBUG, "Unable to alloc vnic for queue\n");
938 return rc;
939 }
940
941 /* Allocate a new one */
942 vnic_info = bnxt_vnic_queue_create(bp, idx, q_index);
943 if (!vnic_info) {
944 PMD_DRV_LOG(ERR, "failed to create vnic - %d\n",
945 q_index);
946 bnxt_vnic_queue_db_del(bp, queue_list);
947 return rc; /* failed */
948 }
949 } else {
950 vnic_info = bnxt_vnic_queue_db_get_vnic(bp, idx);
951 if (vnic_info == NULL) {
952 PMD_DRV_LOG(ERR, "Unable to lookup vnic for queue %d\n",
953 q_index);
954 return rc;
955 }
956 /* increment the reference count and return the vnic id */
957 vnic_info->ref_cnt++;
958 }
959 *vnic_idx = (uint16_t)idx;
960 *vnicid = vnic_info->fw_vnic_id;
961 return 0;
962}
963
964int32_t
965bnxt_vnic_queue_action_free(struct bnxt *bp, uint16_t vnic_id)

Callers 1

Calls 5

bnxt_vnic_queue_db_addFunction · 0.85
bnxt_vnic_queue_createFunction · 0.85
bnxt_vnic_queue_db_delFunction · 0.85

Tested by

no test coverage detected