On 2/23/23 12:27, Chris Mi wrote:
> Iterate each registered offload API. It's not a problem for today
> since we only have one implementation.
>
> Signed-off-by: Chris Mi <[email protected]>
> Reviewed-by: Roi Dayan <[email protected]>
> ---
> lib/netdev-offload.c | 32 ++++++++++++++++++++++++++++++++
> lib/netdev-offload.h | 4 ++++
> 2 files changed, 36 insertions(+)
>
> diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
> index 4592262bd..b333a3b82 100644
> --- a/lib/netdev-offload.c
> +++ b/lib/netdev-offload.c
> @@ -256,6 +256,38 @@ meter_offload_del(ofproto_meter_id meter_id, struct
> ofputil_meter_stats *stats)
> return 0;
> }
>
> +int
> +netdev_offload_recv(struct dpif_upcall *upcall, struct ofpbuf *buf)
Handler id.
> +{
> + struct netdev_registered_flow_api *rfa;
> + int ret;
> +
> + CMAP_FOR_EACH (rfa, cmap_node, &netdev_flow_apis) {
> + if (rfa->flow_api->sflow_recv) {
> + ret = rfa->flow_api->sflow_recv(upcall, buf);
> + if (ret) {
> + VLOG_DBG_RL(&rl, "Failed to receive psample packet, error
> %d, "
No 'sflow' or 'psample' in names or logs.
> + "type: %s", ret, rfa->flow_api->type);
strerror ?
> + return ret;
> + }
> + }
> + }
> +
> + return 0;
> +}
> +
> +void
> +netdev_offload_recv_wait(void)
Same.
> +{
> + struct netdev_registered_flow_api *rfa;
> +
> + CMAP_FOR_EACH (rfa, cmap_node, &netdev_flow_apis) {
> + if (rfa->flow_api->sflow_recv_wait) {
> + rfa->flow_api->sflow_recv_wait();
> + }
> + }
> +}
> +
> int
> netdev_flow_flush(struct netdev *netdev)
> {
> diff --git a/lib/netdev-offload.h b/lib/netdev-offload.h
> index edc843cd9..e332555ee 100644
> --- a/lib/netdev-offload.h
> +++ b/lib/netdev-offload.h
> @@ -33,6 +33,7 @@ extern "C" {
>
> struct dp_packet_batch;
> struct dp_packet;
> +struct dpif_upcall;
> struct netdev_class;
> struct netdev_rxq;
> struct netdev_saved_flags;
> @@ -162,6 +163,9 @@ void meter_offload_set(ofproto_meter_id, struct
> ofputil_meter_config *);
> int meter_offload_get(ofproto_meter_id, struct ofputil_meter_stats *);
> int meter_offload_del(ofproto_meter_id, struct ofputil_meter_stats *);
>
> +int netdev_offload_recv(struct dpif_upcall *upcall, struct ofpbuf *buf);
> +void netdev_offload_recv_wait(void);
> +
> #ifdef __cplusplus
> }
> #endif
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev