On 29 May 2026, at 17:45, Aaron Conole wrote:
> Eelco Chaudron via dev <[email protected]> writes:
>
>> This patch extends the dummy offload provider to simulate full
>> hardware offload behavior, where packets matching offloaded
>> flows can be processed entirely in "hardware" without falling
>> back to the software datapath.
>>
>> Previously, the dummy offload provider only simulated partial
>> offload, where flows were marked as offloaded but all packet
>> processing still occurred in software.
>>
>> Signed-off-by: Eelco Chaudron <[email protected]>
>> ---
>
> Hi Eelco,
>
> Thanks for the patch - I think I can also see how to integrate the
> ct-offload series with this.
Thanks for reviewing! See my feedback on your comments below.
[...]
>> +static bool
>> +dummy_offload_hw_process_pkt(const struct dpif_offload *offload_,
>> + struct dummy_offloaded_flow *flow,
>> + struct dp_packet *pkt)
>> +{
>> + uint32_t hash = dp_packet_get_rss_hash(pkt);
>> + uint32_t pkt_size = dp_packet_size(pkt);
>> + const struct nlattr *nla;
>> + size_t left;
>> +
>> + if (!flow->actions) {
>> + return false;
>> + }
>> +
>> + NL_ATTR_FOR_EACH (nla, left, flow->actions, flow->actions_len) {
>> + bool last_action = (left <= NLA_ALIGN(nla->nla_len));
>> +
>> + if (nl_attr_type(nla) == OVS_ACTION_ATTR_OUTPUT) {
>> + odp_port_t odp_port = nl_attr_get_odp_port(nla);
>> + struct dummy_offload_port *port;
>> + struct dp_packet_batch batch;
>> + int n_txq;
>> +
>> + port = dummy_offload_get_port_by_odp_port(offload_, odp_port);
>> + if (!port) {
>> + return false;
>> + }
>> +
>> + n_txq = netdev_n_txq(port->pm_port.netdev);
>> + dp_packet_batch_init_packet(&batch, last_action
>> + ? pkt
>> + : dp_packet_clone(pkt));
>> + /* As the tx-steering option is not exposed to hardware offload,
>> + * for now we assume hash steering based on the number of queues
>> + * configured for the dummy-netdev. */
>> + netdev_send(port->pm_port.netdev, hash % n_txq, &batch, false);
>> + }
>> + }
>> +
>> + flow->stats.n_bytes += pkt_size;
>> + flow->stats.n_packets++;
>> + flow->stats.used = time_msec();
>
> Maybe it doesn't matter too much in this case, but these stats are being
> updated even if netdev_send() fails above.
This mimics the current flow match and actions, where the counters are
incremented when the flow matches, regardless of the actual transmit
outcome. So I think it should be fine as is.
> Also, I guess technically
> there could be some kind of race with the flow_put since that does an
> assignment (but I might have missed a lock).
Both code paths are protected by the same port->port_mutex.
- dummy_flow_put() holds it from line 715 through the stats read
at line 767
- dummy_netdev_hw_offload_run() holds it (via trylock at line 990)
through the dummy_offload_hw_process_pkt() call that writes the stats
>> + return true;
>> +}
[...]
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev