MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ntb_dev_start

Function ntb_dev_start

dpdk/drivers/raw/ntb/ntb.c:898–976  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

896}
897
898static int
899ntb_dev_start(struct rte_rawdev *dev)
900{
901 struct ntb_hw *hw = dev->dev_private;
902 uint32_t peer_base_l, peer_val;
903 uint64_t peer_base_h;
904 uint32_t i;
905 int ret;
906
907 if (!hw->link_status || !hw->peer_dev_up)
908 return -EINVAL;
909
910 /* Set total stats. */
911 for (i = 0; i < NTB_XSTATS_NUM; i++) {
912 hw->ntb_xstats[i] = 0;
913 hw->ntb_xstats_off[i] = 0;
914 }
915
916 for (i = 0; i < hw->queue_pairs; i++) {
917 ret = ntb_queue_init(dev, i);
918 if (ret) {
919 NTB_LOG(ERR, "Failed to init queue.");
920 goto err_q_init;
921 }
922 }
923
924 hw->peer_mw_base = rte_zmalloc("ntb_peer_mw_base", hw->mw_cnt *
925 sizeof(uint64_t), 0);
926 if (hw->peer_mw_base == NULL) {
927 NTB_LOG(ERR, "Cannot allocate memory for peer mw base.");
928 ret = -ENOMEM;
929 goto err_q_init;
930 }
931
932 if (hw->ntb_ops->spad_read == NULL) {
933 ret = -ENOTSUP;
934 goto err_up;
935 }
936
937 peer_val = (*hw->ntb_ops->spad_read)(dev, SPAD_Q_SZ, 0);
938 if (peer_val != hw->queue_size) {
939 NTB_LOG(ERR, "Inconsistent queue size! (local: %u peer: %u)",
940 hw->queue_size, peer_val);
941 ret = -EINVAL;
942 goto err_up;
943 }
944
945 peer_val = (*hw->ntb_ops->spad_read)(dev, SPAD_NUM_QPS, 0);
946 if (peer_val != hw->queue_pairs) {
947 NTB_LOG(ERR, "Inconsistent number of queues! (local: %u peer:"
948 " %u)", hw->queue_pairs, peer_val);
949 ret = -EINVAL;
950 goto err_up;
951 }
952
953 hw->peer_used_mws = (*hw->ntb_ops->spad_read)(dev, SPAD_USED_MWS, 0);
954
955 for (i = 0; i < hw->peer_used_mws; i++) {

Callers

nothing calls this directly

Calls 5

ntb_queue_initFunction · 0.85
rte_zmallocFunction · 0.85
rte_freeFunction · 0.85
ntb_rxq_release_mbufsFunction · 0.85
ntb_txq_release_mbufsFunction · 0.85

Tested by

no test coverage detected