| 991 | } |
| 992 | |
| 993 | int |
| 994 | eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params) |
| 995 | { |
| 996 | struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); |
| 997 | struct ionic_adapter *adapter = (struct ionic_adapter *)init_params; |
| 998 | int err; |
| 999 | |
| 1000 | IONIC_PRINT_CALL(); |
| 1001 | |
| 1002 | eth_dev->dev_ops = &ionic_eth_dev_ops; |
| 1003 | eth_dev->rx_descriptor_status = ionic_dev_rx_descriptor_status; |
| 1004 | eth_dev->tx_descriptor_status = ionic_dev_tx_descriptor_status; |
| 1005 | |
| 1006 | /* Multi-process not supported, primary does initialization anyway */ |
| 1007 | if (rte_eal_process_type() != RTE_PROC_PRIMARY) |
| 1008 | return 0; |
| 1009 | |
| 1010 | if (adapter->intf->copy_bus_info) |
| 1011 | (*adapter->intf->copy_bus_info)(adapter, eth_dev); |
| 1012 | eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; |
| 1013 | |
| 1014 | lif->eth_dev = eth_dev; |
| 1015 | lif->adapter = adapter; |
| 1016 | adapter->lif = lif; |
| 1017 | |
| 1018 | IONIC_PRINT(DEBUG, "Up to %u MAC addresses supported", |
| 1019 | adapter->max_mac_addrs); |
| 1020 | |
| 1021 | /* Allocate memory for storing MAC addresses */ |
| 1022 | eth_dev->data->mac_addrs = rte_calloc("ionic", |
| 1023 | adapter->max_mac_addrs, |
| 1024 | RTE_ETHER_ADDR_LEN, |
| 1025 | RTE_CACHE_LINE_SIZE); |
| 1026 | if (eth_dev->data->mac_addrs == NULL) { |
| 1027 | IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to " |
| 1028 | "store MAC addresses", |
| 1029 | RTE_ETHER_ADDR_LEN * adapter->max_mac_addrs); |
| 1030 | err = -ENOMEM; |
| 1031 | goto err; |
| 1032 | } |
| 1033 | |
| 1034 | err = ionic_lif_alloc(lif); |
| 1035 | if (err) { |
| 1036 | IONIC_PRINT(ERR, "Cannot allocate LIFs: %d, aborting", |
| 1037 | err); |
| 1038 | goto err; |
| 1039 | } |
| 1040 | |
| 1041 | err = ionic_lif_init(lif); |
| 1042 | if (err) { |
| 1043 | IONIC_PRINT(ERR, "Cannot init LIFs: %d, aborting", err); |
| 1044 | goto err_free_lif; |
| 1045 | } |
| 1046 | |
| 1047 | /* Copy the MAC address */ |
| 1048 | rte_ether_addr_copy((struct rte_ether_addr *)lif->mac_addr, |
| 1049 | ð_dev->data->mac_addrs[0]); |
| 1050 |
nothing calls this directly
no test coverage detected