| 856 | } |
| 857 | |
| 858 | static int |
| 859 | ntb_dev_configure(const struct rte_rawdev *dev, rte_rawdev_obj_t config, |
| 860 | size_t config_size) |
| 861 | { |
| 862 | struct ntb_dev_config *conf = config; |
| 863 | struct ntb_hw *hw = dev->dev_private; |
| 864 | uint32_t xstats_num; |
| 865 | int ret; |
| 866 | |
| 867 | if (conf == NULL || config_size != sizeof(*conf)) |
| 868 | return -EINVAL; |
| 869 | |
| 870 | hw->queue_pairs = conf->num_queues; |
| 871 | hw->queue_size = conf->queue_size; |
| 872 | hw->used_mw_num = conf->mz_num; |
| 873 | hw->mz = conf->mz_list; |
| 874 | hw->rx_queues = rte_zmalloc("ntb_rx_queues", |
| 875 | sizeof(struct ntb_rx_queue *) * hw->queue_pairs, 0); |
| 876 | hw->tx_queues = rte_zmalloc("ntb_tx_queues", |
| 877 | sizeof(struct ntb_tx_queue *) * hw->queue_pairs, 0); |
| 878 | /* First total stats, then per queue stats. */ |
| 879 | xstats_num = (hw->queue_pairs + 1) * NTB_XSTATS_NUM; |
| 880 | hw->ntb_xstats = rte_zmalloc("ntb_xstats", xstats_num * |
| 881 | sizeof(uint64_t), 0); |
| 882 | hw->ntb_xstats_off = rte_zmalloc("ntb_xstats_off", xstats_num * |
| 883 | sizeof(uint64_t), 0); |
| 884 | |
| 885 | /* Start handshake with the peer. */ |
| 886 | ret = ntb_handshake_work(dev); |
| 887 | if (ret < 0) { |
| 888 | rte_free(hw->rx_queues); |
| 889 | rte_free(hw->tx_queues); |
| 890 | hw->rx_queues = NULL; |
| 891 | hw->tx_queues = NULL; |
| 892 | return ret; |
| 893 | } |
| 894 | |
| 895 | return 0; |
| 896 | } |
| 897 | |
| 898 | static int |
| 899 | ntb_dev_start(struct rte_rawdev *dev) |
nothing calls this directly
no test coverage detected