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

Function ntb_handshake_work

dpdk/drivers/raw/ntb/ntb.c:70–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70static inline int
71ntb_handshake_work(const struct rte_rawdev *dev)
72{
73 struct ntb_hw *hw = dev->dev_private;
74 uint32_t val;
75 int ret, i;
76
77 if (hw->ntb_ops->spad_write == NULL ||
78 hw->ntb_ops->mw_set_trans == NULL) {
79 NTB_LOG(ERR, "Scratchpad/MW setting is not supported.");
80 return -ENOTSUP;
81 }
82
83 /* Tell peer the mw info of local side. */
84 ret = (*hw->ntb_ops->spad_write)(dev, SPAD_NUM_MWS, 1, hw->mw_cnt);
85 if (ret < 0)
86 return ret;
87 for (i = 0; i < hw->mw_cnt; i++) {
88 NTB_LOG(INFO, "Local %u mw size: 0x%"PRIx64"", i,
89 hw->mw_size[i]);
90 val = hw->mw_size[i] >> 32;
91 ret = (*hw->ntb_ops->spad_write)(dev, SPAD_MW0_SZ_H + 2 * i,
92 1, val);
93 if (ret < 0)
94 return ret;
95 val = hw->mw_size[i];
96 ret = (*hw->ntb_ops->spad_write)(dev, SPAD_MW0_SZ_L + 2 * i,
97 1, val);
98 if (ret < 0)
99 return ret;
100 }
101
102 /* Tell peer about the queue info and map memory to the peer. */
103 ret = (*hw->ntb_ops->spad_write)(dev, SPAD_Q_SZ, 1, hw->queue_size);
104 if (ret < 0)
105 return ret;
106 ret = (*hw->ntb_ops->spad_write)(dev, SPAD_NUM_QPS, 1,
107 hw->queue_pairs);
108 if (ret < 0)
109 return ret;
110 ret = (*hw->ntb_ops->spad_write)(dev, SPAD_USED_MWS, 1,
111 hw->used_mw_num);
112 if (ret < 0)
113 return ret;
114 for (i = 0; i < hw->used_mw_num; i++) {
115 val = (uint64_t)(size_t)(hw->mz[i]->addr) >> 32;
116 ret = (*hw->ntb_ops->spad_write)(dev, SPAD_MW0_BA_H + 2 * i,
117 1, val);
118 if (ret < 0)
119 return ret;
120 val = (uint64_t)(size_t)(hw->mz[i]->addr);
121 ret = (*hw->ntb_ops->spad_write)(dev, SPAD_MW0_BA_L + 2 * i,
122 1, val);
123 if (ret < 0)
124 return ret;
125 }
126
127 for (i = 0; i < hw->used_mw_num; i++) {

Callers 2

ntb_dev_intr_handlerFunction · 0.85
ntb_dev_configureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected