| 2973 | }; |
| 2974 | |
| 2975 | static int |
| 2976 | sfc_eth_dev_secondary_init(struct rte_eth_dev *dev, uint32_t logtype_main) |
| 2977 | { |
| 2978 | struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev); |
| 2979 | struct sfc_adapter_priv *sap; |
| 2980 | const struct sfc_dp_rx *dp_rx; |
| 2981 | const struct sfc_dp_tx *dp_tx; |
| 2982 | int rc; |
| 2983 | |
| 2984 | /* |
| 2985 | * Allocate process private data from heap, since it should not |
| 2986 | * be located in shared memory allocated using rte_malloc() API. |
| 2987 | */ |
| 2988 | sap = calloc(1, sizeof(*sap)); |
| 2989 | if (sap == NULL) { |
| 2990 | rc = ENOMEM; |
| 2991 | goto fail_alloc_priv; |
| 2992 | } |
| 2993 | |
| 2994 | sap->logtype_main = logtype_main; |
| 2995 | |
| 2996 | dp_rx = sfc_dp_find_rx_by_name(&sfc_dp_head, sas->dp_rx_name); |
| 2997 | if (dp_rx == NULL) { |
| 2998 | SFC_LOG(sas, RTE_LOG_ERR, logtype_main, |
| 2999 | "cannot find %s Rx datapath", sas->dp_rx_name); |
| 3000 | rc = ENOENT; |
| 3001 | goto fail_dp_rx; |
| 3002 | } |
| 3003 | if (~dp_rx->features & SFC_DP_RX_FEAT_MULTI_PROCESS) { |
| 3004 | SFC_LOG(sas, RTE_LOG_ERR, logtype_main, |
| 3005 | "%s Rx datapath does not support multi-process", |
| 3006 | sas->dp_rx_name); |
| 3007 | rc = EINVAL; |
| 3008 | goto fail_dp_rx_multi_process; |
| 3009 | } |
| 3010 | |
| 3011 | dp_tx = sfc_dp_find_tx_by_name(&sfc_dp_head, sas->dp_tx_name); |
| 3012 | if (dp_tx == NULL) { |
| 3013 | SFC_LOG(sas, RTE_LOG_ERR, logtype_main, |
| 3014 | "cannot find %s Tx datapath", sas->dp_tx_name); |
| 3015 | rc = ENOENT; |
| 3016 | goto fail_dp_tx; |
| 3017 | } |
| 3018 | if (~dp_tx->features & SFC_DP_TX_FEAT_MULTI_PROCESS) { |
| 3019 | SFC_LOG(sas, RTE_LOG_ERR, logtype_main, |
| 3020 | "%s Tx datapath does not support multi-process", |
| 3021 | sas->dp_tx_name); |
| 3022 | rc = EINVAL; |
| 3023 | goto fail_dp_tx_multi_process; |
| 3024 | } |
| 3025 | |
| 3026 | sap->dp_rx = dp_rx; |
| 3027 | sap->dp_tx = dp_tx; |
| 3028 | |
| 3029 | dev->process_private = sap; |
| 3030 | dev->rx_pkt_burst = dp_rx->pkt_burst; |
| 3031 | dev->tx_pkt_prepare = dp_tx->pkt_prepare; |
| 3032 | dev->tx_pkt_burst = dp_tx->pkt_burst; |
no test coverage detected