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

Function cmd_send_parsed

dpdk/examples/ntb/ntb_fwd.c:168–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168void
169cmd_send_parsed(void *parsed_result,
170 __rte_unused struct cmdline *cl,
171 __rte_unused void *data)
172{
173 struct cmd_send_result *res = parsed_result;
174 struct rte_rawdev_buf *pkts_send[NTB_MAX_PKT_BURST];
175 struct rte_mbuf *mbuf_send[NTB_MAX_PKT_BURST];
176 uint64_t size, count, i, j, nb_burst;
177 uint16_t nb_tx, buf_size;
178 unsigned int nb_pkt;
179 size_t queue_id = 0;
180 uint16_t retry = 0;
181 uint32_t val;
182 FILE *file;
183 int ret;
184
185 if (num_queues != 1) {
186 printf("File transmission only supports 1 queue.\n");
187 num_queues = 1;
188 }
189
190 file = fopen(res->filepath, "r");
191 if (file == NULL) {
192 printf("Fail to open the file.\n");
193 return;
194 }
195
196 if (fseek(file, 0, SEEK_END) < 0) {
197 printf("Fail to get file size.\n");
198 fclose(file);
199 return;
200 }
201 size = ftell(file);
202 if (fseek(file, 0, SEEK_SET) < 0) {
203 printf("Fail to get file size.\n");
204 fclose(file);
205 return;
206 }
207
208 /* Tell remote about the file size. */
209 val = size >> 32;
210 rte_rawdev_set_attr(dev_id, "spad_user_0", val);
211 val = size;
212 rte_rawdev_set_attr(dev_id, "spad_user_1", val);
213 printf("Sending file, size is %"PRIu64"\n", size);
214
215 for (i = 0; i < NTB_MAX_PKT_BURST; i++)
216 pkts_send[i] = (struct rte_rawdev_buf *)
217 malloc(sizeof(struct rte_rawdev_buf));
218
219 buf_size = ntb_buf_size - RTE_PKTMBUF_HEADROOM;
220 count = (size + buf_size - 1) / buf_size;
221 nb_burst = (count + pkt_burst - 1) / pkt_burst;
222
223 for (i = 0; i < nb_burst; i++) {
224 val = RTE_MIN(count, pkt_burst);
225 if (rte_mempool_get_bulk(mbuf_pool, (void **)mbuf_send,

Callers

nothing calls this directly

Calls 8

rte_rawdev_set_attrFunction · 0.85
mallocFunction · 0.85
rte_mempool_get_bulkFunction · 0.85
rte_mbuf_raw_allocFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
printfFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected