| 2493 | } |
| 2494 | |
| 2495 | static int |
| 2496 | cpfl_dev_vport_init(struct rte_eth_dev *dev, void *init_params) |
| 2497 | { |
| 2498 | struct cpfl_vport *cpfl_vport = dev->data->dev_private; |
| 2499 | struct idpf_vport *vport = &cpfl_vport->base; |
| 2500 | struct cpfl_vport_param *param = init_params; |
| 2501 | struct cpfl_adapter_ext *adapter = param->adapter; |
| 2502 | /* for sending create vport virtchnl msg prepare */ |
| 2503 | struct virtchnl2_create_vport create_vport_info; |
| 2504 | struct virtchnl2_add_queue_groups p2p_queue_grps_info; |
| 2505 | uint8_t p2p_q_vc_out_info[IDPF_DFLT_MBX_BUF_SIZE] = {0}; |
| 2506 | int ret = 0; |
| 2507 | |
| 2508 | dev->dev_ops = &cpfl_eth_dev_ops; |
| 2509 | vport->adapter = &adapter->base; |
| 2510 | vport->sw_idx = param->idx; |
| 2511 | vport->devarg_id = param->devarg_id; |
| 2512 | |
| 2513 | memset(&create_vport_info, 0, sizeof(create_vport_info)); |
| 2514 | ret = idpf_vport_info_init(vport, &create_vport_info); |
| 2515 | if (ret != 0) { |
| 2516 | PMD_INIT_LOG(ERR, "Failed to init vport req_info."); |
| 2517 | goto err; |
| 2518 | } |
| 2519 | |
| 2520 | ret = idpf_vport_init(vport, &create_vport_info, dev->data); |
| 2521 | if (ret != 0) { |
| 2522 | PMD_INIT_LOG(ERR, "Failed to init vports."); |
| 2523 | goto err; |
| 2524 | } |
| 2525 | |
| 2526 | cpfl_vport->itf.type = CPFL_ITF_TYPE_VPORT; |
| 2527 | cpfl_vport->itf.adapter = adapter; |
| 2528 | cpfl_vport->itf.data = dev->data; |
| 2529 | TAILQ_INIT(&cpfl_vport->itf.flow_list); |
| 2530 | adapter->vports[param->idx] = cpfl_vport; |
| 2531 | adapter->cur_vports |= RTE_BIT32(param->devarg_id); |
| 2532 | adapter->cur_vport_nb++; |
| 2533 | |
| 2534 | dev->data->mac_addrs = rte_zmalloc(NULL, RTE_ETHER_ADDR_LEN, 0); |
| 2535 | if (dev->data->mac_addrs == NULL) { |
| 2536 | PMD_INIT_LOG(ERR, "Cannot allocate mac_addr memory."); |
| 2537 | ret = -ENOMEM; |
| 2538 | goto err_mac_addrs; |
| 2539 | } |
| 2540 | |
| 2541 | rte_ether_addr_copy((struct rte_ether_addr *)vport->default_mac_addr, |
| 2542 | &dev->data->mac_addrs[0]); |
| 2543 | |
| 2544 | memset(cpfl_vport->itf.dma, 0, sizeof(cpfl_vport->itf.dma)); |
| 2545 | memset(cpfl_vport->itf.msg, 0, sizeof(cpfl_vport->itf.msg)); |
| 2546 | ret = cpfl_alloc_dma_mem_batch(&cpfl_vport->itf.flow_dma, |
| 2547 | cpfl_vport->itf.dma, |
| 2548 | sizeof(union cpfl_rule_cfg_pkt_record), |
| 2549 | CPFL_FLOW_BATCH_SIZE); |
| 2550 | if (ret < 0) |
| 2551 | goto err_mac_addrs; |
| 2552 |
nothing calls this directly
no test coverage detected