Search the requested ufid for a offloaded flow, and if found, dump and parse it back to required format.
Signed-off-by: Paul Blakey <[email protected]> Reviewed-by: Roi Dayan <[email protected]> --- lib/netdev-tc-offloads.c | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c index 25df598..fd4ec75 100644 --- a/lib/netdev-tc-offloads.c +++ b/lib/netdev-tc-offloads.c @@ -557,13 +557,42 @@ netdev_tc_flow_put(struct netdev *netdev, int netdev_tc_flow_get(struct netdev *netdev OVS_UNUSED, - struct match *match OVS_UNUSED, - struct nlattr **actions OVS_UNUSED, - struct dpif_flow_stats *stats OVS_UNUSED, - ovs_u128 *ufid OVS_UNUSED, - struct ofpbuf *buf OVS_UNUSED) + struct match *match, + struct nlattr **actions, + struct dpif_flow_stats *stats, + ovs_u128 *ufid, + struct ofpbuf *buf) { - return EOPNOTSUPP; + struct netdev *dev; + struct tc_flow tc_flow; + struct flow *mask; + int prio = 0; + int ifindex; + int err; + int handle = get_ufid_tc_mapping(ufid, &prio, &dev); + + if (!handle) { + return ENOENT; + } + + ifindex = netdev_get_ifindex(dev); + VLOG_DBG("get: ifindex: %d handle: %d prio: %d", ifindex, handle, prio); + err = tc_get_flower(ifindex, handle, prio, &tc_flow); + netdev_close(dev); + if (err) { + VLOG_ERR("could not get (if: %d prio: %d handle: %d), error: %s", + ifindex, prio, handle, ovs_strerror(err)); + return err; + } + odp_port_t in_port = netdev_hmap_port_get_byifidx(ifindex); + + parse_tc_flow_to_match(&tc_flow, match, actions, stats, buf); + + mask = &match->wc.masks; + match_set_in_port(match, in_port); + memset(&mask->in_port, 0xFF, sizeof(mask->in_port)); + + return 0; } int -- 1.8.3.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
