On 18 Nov 2026, at 12:41, Kevin Traynor wrote:
> On 11/9/26 15:43, Eelco Chaudron via dev wrote:
>> Exercise the alt_actions parameter added to the netdev_hw_post_process()
>> callback. When a flow contains only OUTPUT actions with a mix of
>> dummy-pmd and non-dummy-pmd egress ports, the dummy driver executes the
>> dummy-pmd outputs in the simulated hardware pipeline and returns the
>> non-dummy-pmd outputs as alternative actions for the PMD thread.
>> A new test case validates the new API.
>>
>> Acked-by: Eli Britstein <[email protected]>
>> Signed-off-by: Eelco Chaudron <[email protected]>
>> ---
>> lib/dpif-offload-dummy.c | 141 ++++++++++++++++++++++++++++++++++-----
>> tests/dpif-netdev.at | 103 +++++++++++++++++++++++++++-
>> tests/ofproto-dpif.at | 65 +++++++++++-------
>> 3 files changed, 266 insertions(+), 43 deletions(-)
>>
>> diff --git a/lib/dpif-offload-dummy.c b/lib/dpif-offload-dummy.c
>> index 1c70c0bae..15db9a845 100644
>> --- a/lib/dpif-offload-dummy.c
>> +++ b/lib/dpif-offload-dummy.c
>> @@ -45,6 +45,7 @@ struct dummy_offloaded_flow {
>> struct match match;
>> const struct nlattr *actions;
>> size_t actions_len;
>> + struct offload_actions *alt_actions;
>> ovs_u128 ufid;
>> uint32_t mark;
>> struct dpif_flow_stats stats;
>> @@ -74,6 +75,7 @@ struct dummy_offload_port {
>> uint64_t rx_offload_full OVS_GUARDED; /* Fully offloaded, CPU
>> bypassed. */
>> uint64_t rx_offload_miss OVS_GUARDED; /* No HW offload rule matched. */
>> uint64_t rx_offload_pipe_abort OVS_GUARDED; /* Pipeline abort. */
>> + uint64_t rx_offload_alt_actions OVS_GUARDED; /* Partial action offload.
>> */
>> };
>> struct hw_pkt_node {
>> @@ -246,6 +248,7 @@ dummy_free_flow(struct dummy_offload_port *port,
>> hmap_destroy(&off_flow->pmd_id_map);
>> free(CONST_CAST(struct nlattr *, off_flow->actions));
>> + ovsrcu_postpone(free, off_flow->alt_actions);
>> free(off_flow);
>> }
>> @@ -489,6 +492,8 @@ dummy_offload_get_debug(const struct dpif_offload
>> *offload, struct ds *ds,
>> json_integer_create(port->rx_offload_miss));
>> json_object_put(json_port, "rx_offload_pipe_abort",
>>
>> json_integer_create(port->rx_offload_pipe_abort));
>> + json_object_put(json_port, "rx_offload_alt_actions",
>> +
>> json_integer_create(port->rx_offload_alt_actions));
>> ovs_mutex_unlock(&port->port_mutex);
>> json_object_put(json_ports, netdev_get_name(port_->netdev),
>> @@ -509,13 +514,15 @@ dummy_offload_get_debug(const struct dpif_offload
>> *offload, struct ds *ds,
>> ovs_mutex_lock(&port->port_mutex);
>> ds_put_format(ds,
>> " - %s: port_no: %u\n"
>> - " rx_offload_partial : %" PRIu64 "\n"
>> - " rx_offload_full : %" PRIu64 "\n"
>> - " rx_offload_miss : %" PRIu64 "\n"
>> - " rx_offload_pipe_abort: %" PRIu64 "\n",
>> + " rx_offload_partial : %" PRIu64 "\n"
>> + " rx_offload_full : %" PRIu64 "\n"
>> + " rx_offload_miss : %" PRIu64 "\n"
>> + " rx_offload_pipe_abort : %" PRIu64 "\n"
>> + " rx_offload_alt_actions: %" PRIu64 "\n",
>
> this is probably closer in meaning to _partial, so could move it up.
ACK, will do in v5.
>> netdev_get_name(port_->netdev), port_->port_no,
>> port->rx_offload_partial, port->rx_offload_full,
>> - port->rx_offload_miss,
>> port->rx_offload_pipe_abort);
>> + port->rx_offload_miss,
>> port->rx_offload_pipe_abort,
>> + port->rx_offload_alt_actions);
>> ovs_mutex_unlock(&port->port_mutex);
>> }
>> }
>> @@ -605,6 +612,10 @@ dummy_offload_hw_post_process(const struct dpif_offload
>> *offload_,
>> if (pmd_data) {
>> flow_reference = pmd_data->flow_reference;
>> }
>> +
>> + if (off_flow->alt_actions) {
>> + *alt_actions = off_flow->alt_actions;
>> + }
>> break;
>> }
>> }
>> @@ -723,7 +734,7 @@ dummy_offload_are_all_actions_supported(const struct
>> dpif_offload *offload_,
>> return true;
>> }
>> -static bool
>> +static int
>> dummy_offload_hw_process_pkt(const struct dpif_offload *offload_,
>> struct dummy_offloaded_flow *flow,
>> struct dp_packet *pkt)
>> @@ -734,7 +745,7 @@ dummy_offload_hw_process_pkt(const struct dpif_offload
>> *offload_,
>> size_t left;
>> if (!flow->actions) {
>> - return false;
>> + return ENOENT;
>> }
>> NL_ATTR_FOR_EACH (nla, left, flow->actions, flow->actions_len) {
>> @@ -750,7 +761,14 @@ dummy_offload_hw_process_pkt(const struct dpif_offload
>> *offload_,
>> port = dummy_offload_get_port_by_odp_port(offload_, odp_port);
>> if (!port) {
>> - return false;
>> + return ENODEV;
>> + }
>> +
>> + /* Stop at the first non-dummy-pmd port; remaining actions are
>> + * handled via alt_actions returned by hw_post_process. */
>> + if (strcmp("dummy-pmd",
>> + netdev_get_type(port->pm_port.netdev))) {
>> + goto done;
>> }
>> n_txq = netdev_n_txq(port->pm_port.netdev);
>> @@ -813,10 +831,65 @@ dummy_offload_hw_process_pkt(const struct dpif_offload
>> *offload_,
>> }
>> }
>> +done:
>> flow->stats.n_bytes += pkt_size;
>> flow->stats.n_packets++;
>
> For the alt_actions case, the stats are updated, but that packet is also sent
> to the CPU. If I follow correctly, for example n_packets will be incremented
> here but dp_netdev_flow_used() will also count it and that will mean a double
> count for this packet in get_dpif_flow_status()
Good catch! It was masked by a faulty unit test.
>> flow->stats.used = time_msec();
>> - return true;
>> +
>> + /* For mixed offload, return EAGAIN so the caller re-injects the packet
>> + * to the CPU for alt_actions processing. */
>> + return flow->alt_actions ? EAGAIN : 0;
>
> minor, it's probably the best of the error codes to pick, but it's not really
> an error and not really a retry situation. Maybe an enum for returns would be
> clearer with a XXX_PROCESS_PARTIAL in there
I looked at this again, but if we add an enum we end up having
to add all the other errno return codes to it as well. I would
like to keep it as EAGAIN for now; we can revisit in the future
if needed.
[...]
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev