switch (type) {
case INSTR_TX:
case INSTR_TX_I:
+ case INSTR_DROP:
return 1;
default:
switch (instr->type) {
case INSTR_TX:
case INSTR_TX_I:
+ case INSTR_DROP:
case INSTR_HDR_EMIT_TX:
case INSTR_HDR_EMIT2_TX:
case INSTR_HDR_EMIT3_TX:
}
static int
-instr_drop_translate(struct rte_swx_pipeline *p,
+instr_drop_translate(struct rte_swx_pipeline *p __rte_unused,
struct action *action __rte_unused,
char **tokens __rte_unused,
int n_tokens,
{
CHECK(n_tokens == 1, EINVAL);
- /* TX_I. */
- instr->type = INSTR_TX_I;
- instr->io.io.val = p->n_ports_out - 1;
+ /* DROP. */
+ instr->type = INSTR_DROP;
return 0;
}
instr_rx_exec(p);
}
+static inline void
+instr_drop_exec(struct rte_swx_pipeline *p)
+{
+ struct thread *t = &p->threads[p->thread_id];
+ struct instruction *ip = t->ip;
+
+ __instr_drop_exec(p, t, ip);
+
+ /* Thread. */
+ thread_ip_reset(p, t);
+ instr_rx_exec(p);
+}
+
/*
* extract.
*/
if (!i)
return 0;
- if (!instruction_is_tx(instr[i].type))
+ if (instr[i].type != INSTR_TX)
return 0;
if (data[i].n_users)
[INSTR_RX] = instr_rx_exec,
[INSTR_TX] = instr_tx_exec,
[INSTR_TX_I] = instr_tx_i_exec,
+ [INSTR_DROP] = instr_drop_exec,
[INSTR_HDR_EXTRACT] = instr_hdr_extract_exec,
[INSTR_HDR_EXTRACT2] = instr_hdr_extract2_exec,
case INSTR_TX: return "INSTR_TX";
case INSTR_TX_I: return "INSTR_TX_I";
+ case INSTR_DROP: return "INSTR_DROP";
case INSTR_HDR_EXTRACT: return "INSTR_HDR_EXTRACT";
case INSTR_HDR_EXTRACT2: return "INSTR_HDR_EXTRACT2";
instr_type_to_name(instr));
/* instr.io. */
- fprintf(f,
- "\t\t.io = {\n");
+ if (n_io || n_io_imm || n_hdrs)
+ fprintf(f,
+ "\t\t.io = {\n");
/* instr.io.io. */
if (n_io)
}
/* instr.io - closing curly brace. */
- fprintf(f,
- "\t\t},\n");
+ if (n_io || n_io_imm || n_hdrs)
+ fprintf(f,
+ "\t\t},\n");
/* instr - closing curly brace. */
fprintf(f,
[INSTR_TX] = instr_io_export,
[INSTR_TX_I] = instr_io_export,
+ [INSTR_DROP] = instr_io_export,
[INSTR_HDR_EXTRACT] = instr_io_export,
[INSTR_HDR_EXTRACT2] = instr_io_export,
case INSTR_TX: return "__instr_tx_exec";
case INSTR_TX_I: return "__instr_tx_i_exec";
+ case INSTR_DROP: return "__instr_drop_exec";
case INSTR_HDR_EXTRACT: return "__instr_hdr_extract_exec";
case INSTR_HDR_EXTRACT2: return "__instr_hdr_extract2_exec";
*/
INSTR_TX, /* port_out = M */
INSTR_TX_I, /* port_out = I */
+ INSTR_DROP,
/* extract h.header */
INSTR_HDR_EXTRACT,
port->pkt_tx(port->obj, pkt);
}
+static inline void
+__instr_drop_exec(struct rte_swx_pipeline *p,
+ struct thread *t,
+ const struct instruction *ip __rte_unused)
+{
+ uint64_t port_id = p->n_ports_out - 1;
+ struct port_out_runtime *port = &p->out[port_id];
+ struct rte_swx_pkt *pkt = &t->pkt;
+
+ TRACE("[Thread %2u]: drop 1 pkt\n",
+ p->thread_id);
+
+ /* Headers. */
+ emit_handler(t);
+
+ /* Packet. */
+ port->pkt_tx(port->obj, pkt);
+}
+
/*
* extract.
*/