| 464 | } |
| 465 | |
| 466 | static int ipn3ke_vswitch_probe(struct rte_afu_device *afu_dev) |
| 467 | { |
| 468 | char name[RTE_ETH_NAME_MAX_LEN]; |
| 469 | struct ipn3ke_hw *hw; |
| 470 | struct rte_eth_dev *i40e_eth; |
| 471 | struct ifpga_rawdev *ifpga_dev; |
| 472 | int i, j, retval; |
| 473 | char *fvl_bdf; |
| 474 | |
| 475 | /* check if the AFU device has been probed already */ |
| 476 | /* allocate shared mcp_vswitch structure */ |
| 477 | if (!afu_dev->shared.data) { |
| 478 | snprintf(name, sizeof(name), "net_%s_hw", |
| 479 | afu_dev->device.name); |
| 480 | hw = rte_zmalloc_socket(name, |
| 481 | sizeof(struct ipn3ke_hw), |
| 482 | RTE_CACHE_LINE_SIZE, |
| 483 | afu_dev->device.numa_node); |
| 484 | if (!hw) { |
| 485 | IPN3KE_AFU_PMD_ERR("failed to allocate hardware data"); |
| 486 | retval = -ENOMEM; |
| 487 | return -ENOMEM; |
| 488 | } |
| 489 | afu_dev->shared.data = hw; |
| 490 | |
| 491 | rte_spinlock_init(&afu_dev->shared.lock); |
| 492 | } else { |
| 493 | hw = afu_dev->shared.data; |
| 494 | } |
| 495 | |
| 496 | retval = ipn3ke_hw_init(afu_dev, hw); |
| 497 | if (retval) |
| 498 | return retval; |
| 499 | |
| 500 | if (ipn3ke_bridge_func.get_ifpga_rawdev == NULL) |
| 501 | return -ENOMEM; |
| 502 | ifpga_dev = ipn3ke_bridge_func.get_ifpga_rawdev(hw->rawdev); |
| 503 | if (!ifpga_dev) |
| 504 | IPN3KE_AFU_PMD_ERR("failed to find ifpga_device."); |
| 505 | |
| 506 | /* probe representor ports */ |
| 507 | j = 0; |
| 508 | for (i = 0; i < hw->port_num; i++) { |
| 509 | struct ipn3ke_rpst rpst = { |
| 510 | .port_id = i, |
| 511 | .switch_domain_id = hw->switch_domain_id, |
| 512 | .hw = hw |
| 513 | }; |
| 514 | |
| 515 | /* representor port net_bdf_port */ |
| 516 | snprintf(name, sizeof(name), "net_%s_representor_%d", |
| 517 | afu_dev->device.name, i); |
| 518 | |
| 519 | for (; j < 8; j++) { |
| 520 | fvl_bdf = ifpga_dev->fvl_bdf[j]; |
| 521 | i40e_eth = rte_eth_dev_get_by_name(fvl_bdf); |
| 522 | if (!i40e_eth) { |
| 523 | continue; |
nothing calls this directly
no test coverage detected