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

Function ssovf_probe

dpdk/drivers/event/octeontx/ssovf_probe.c:217–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215/* SSOVF pcie device aka event queue probe */
216
217static int
218ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
219{
220 uint64_t val;
221 uint16_t vfid;
222 uint8_t *idreg;
223 struct ssovf_res *res;
224 uint8_t *reg;
225
226 RTE_SET_USED(pci_drv);
227
228 /* For secondary processes, the primary has done all the work */
229 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
230 return 0;
231
232 if (pci_dev->mem_resource[0].addr == NULL ||
233 pci_dev->mem_resource[2].addr == NULL) {
234 mbox_log_err("Empty bars %p %p",
235 pci_dev->mem_resource[0].addr,
236 pci_dev->mem_resource[2].addr);
237 return -ENODEV;
238 }
239 idreg = pci_dev->mem_resource[0].addr;
240 idreg += SSO_VHGRP_AQ_THR;
241 val = rte_read64(idreg);
242
243 /* Write back the default value of aq_thr */
244 rte_write64((1ULL << 33) - 1, idreg);
245 vfid = (val >> 16) & 0xffff;
246 if (vfid >= SSO_MAX_VHGRP) {
247 mbox_log_err("Invalid vfid (%d/%d)", vfid, SSO_MAX_VHGRP);
248 return -EINVAL;
249 }
250
251 res = &sdev.grp[vfid];
252 res->vfid = vfid;
253 res->bar0 = pci_dev->mem_resource[0].addr;
254 res->bar2 = pci_dev->mem_resource[2].addr;
255 res->domain = val & 0xffff;
256
257 sdev.total_ssovfs++;
258 if (vfid == 0) {
259 reg = ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0);
260 reg += SSO_VHGRP_PF_MBOX(1);
261 if (octeontx_mbox_set_reg(reg, res->domain)) {
262 mbox_log_err("Invalid Failed to set mbox_reg");
263 return -EINVAL;
264 }
265 }
266
267 rte_wmb();
268 mbox_log_dbg("Domain=%d group=%d total_ssovfs=%d", res->domain,
269 res->vfid, sdev.total_ssovfs);
270 return 0;
271}
272
273static const struct rte_pci_id pci_ssovf_map[] = {
274 {

Callers

nothing calls this directly

Calls 5

rte_eal_process_typeFunction · 0.85
ssovf_barFunction · 0.85
octeontx_mbox_set_regFunction · 0.85
rte_read64Function · 0.50
rte_write64Function · 0.50

Tested by

no test coverage detected