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

Function ree_qp_create

dpdk/drivers/regex/cn9k/cn9k_regexdev.c:56–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56static struct roc_ree_qp *
57ree_qp_create(const struct rte_regexdev *dev, uint16_t qp_id)
58{
59 struct cn9k_ree_data *data = dev->data->dev_private;
60 uint64_t pg_sz = sysconf(_SC_PAGESIZE);
61 struct roc_ree_vf *vf = &data->vf;
62 const struct rte_memzone *lf_mem;
63 uint32_t len, iq_len, size_div2;
64 char name[RTE_MEMZONE_NAMESIZE];
65 uint64_t used_len, iova;
66 struct roc_ree_qp *qp;
67 uint8_t *va;
68 int ret;
69
70 /* Allocate queue pair */
71 qp = rte_zmalloc("CN9K Regex PMD Queue Pair", sizeof(*qp),
72 ROC_ALIGN);
73 if (qp == NULL) {
74 cn9k_err("Could not allocate queue pair");
75 return NULL;
76 }
77
78 iq_len = REE_IQ_LEN;
79
80 /*
81 * Queue size must be in units of 128B 2 * REE_INST_S (which is 64B),
82 * and a power of 2.
83 * effective queue size to software is (size - 1) * 128
84 */
85 size_div2 = iq_len >> 1;
86
87 /* For pending queue */
88 len = iq_len * RTE_ALIGN(sizeof(struct roc_ree_rid), 8);
89
90 /* So that instruction queues start as pg size aligned */
91 len = RTE_ALIGN(len, pg_sz);
92
93 /* For instruction queues */
94 len += REE_IQ_LEN * sizeof(union roc_ree_inst);
95
96 /* Waste after instruction queues */
97 len = RTE_ALIGN(len, pg_sz);
98
99 qp_memzone_name_get(name, RTE_MEMZONE_NAMESIZE, dev->data->dev_id,
100 qp_id);
101
102 lf_mem = rte_memzone_reserve_aligned(name, len, rte_socket_id(),
103 RTE_MEMZONE_SIZE_HINT_ONLY | RTE_MEMZONE_256MB,
104 RTE_CACHE_LINE_SIZE);
105 if (lf_mem == NULL) {
106 cn9k_err("Could not allocate reserved memzone");
107 goto qp_free;
108 }
109
110 va = lf_mem->addr;
111 iova = lf_mem->iova;
112
113 memset(va, 0, len);

Callers 1

Calls 8

rte_zmallocFunction · 0.85
rte_socket_idFunction · 0.85
memsetFunction · 0.85
roc_ree_qp_get_baseFunction · 0.85
roc_ree_iq_enableFunction · 0.85
rte_freeFunction · 0.85
qp_memzone_name_getFunction · 0.70

Tested by

no test coverage detected