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

Function cmd_link

dpdk/examples/ip_pipeline/cli.c:132–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130" [rss <qid_0> ... <qid_n>]\n";
131
132static void
133cmd_link(char **tokens,
134 uint32_t n_tokens,
135 char *out,
136 size_t out_size)
137{
138 struct link_params p;
139 struct link_params_rss rss;
140 struct link *link;
141 char *name;
142
143 memset(&p, 0, sizeof(p));
144
145 if ((n_tokens < 13) || (n_tokens > 14 + LINK_RXQ_RSS_MAX)) {
146 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
147 return;
148 }
149 name = tokens[1];
150
151 if (strcmp(tokens[2], "dev") == 0)
152 p.dev_name = tokens[3];
153 else if (strcmp(tokens[2], "port") == 0) {
154 p.dev_name = NULL;
155
156 if (parser_read_uint16(&p.port_id, tokens[3]) != 0) {
157 snprintf(out, out_size, MSG_ARG_INVALID, "port_id");
158 return;
159 }
160 } else {
161 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "dev or port");
162 return;
163 }
164
165 if (strcmp(tokens[4], "rxq") != 0) {
166 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "rxq");
167 return;
168 }
169
170 if (parser_read_uint32(&p.rx.n_queues, tokens[5]) != 0) {
171 snprintf(out, out_size, MSG_ARG_INVALID, "n_queues");
172 return;
173 }
174 if (parser_read_uint32(&p.rx.queue_size, tokens[6]) != 0) {
175 snprintf(out, out_size, MSG_ARG_INVALID, "queue_size");
176 return;
177 }
178
179 p.rx.mempool_name = tokens[7];
180
181 if (strcmp(tokens[8], "txq") != 0) {
182 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "txq");
183 return;
184 }
185
186 if (parser_read_uint32(&p.tx.n_queues, tokens[9]) != 0) {
187 snprintf(out, out_size, MSG_ARG_INVALID, "n_queues");
188 return;
189 }

Callers 1

cli_processFunction · 0.85

Calls 6

memsetFunction · 0.85
snprintfFunction · 0.85
strcmpFunction · 0.85
link_createFunction · 0.85
parser_read_uint16Function · 0.70
parser_read_uint32Function · 0.70

Tested by

no test coverage detected