From: Tonghao Zhang <[email protected]> When offloading the meter action, we may access the "datapath" resource, such as the meter[] of struct dp_netdev. We will store meter offload info to it.
Signed-off-by: Tonghao Zhang <[email protected]> --- lib/dpif-netdev.c | 2 +- lib/dpif-netlink.c | 2 +- lib/netdev-dummy.c | 8 ++++---- lib/netdev-offload-dpdk.c | 7 ++++--- lib/netdev-offload-provider.h | 7 ++++--- lib/netdev-offload-tc.c | 7 ++++--- lib/netdev-offload.c | 11 ++++++----- lib/netdev-offload.h | 4 +++- 8 files changed, 27 insertions(+), 21 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 7fcd8cb..c92d9aa 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -2416,7 +2416,7 @@ dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload) /* Taking a global 'port_mutex' to fulfill thread safety restrictions for * the netdev-offload-dpdk module. */ ovs_mutex_lock(&pmd->dp->port_mutex); - ret = netdev_flow_put(port, &offload->match, + ret = netdev_flow_put(NULL, port, &offload->match, CONST_CAST(struct nlattr *, offload->actions), offload->actions_len, &flow->mega_ufid, &info, NULL); diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index e9a6887..a31da55 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -2044,7 +2044,7 @@ parse_flow_put(struct dpif_netlink *dpif, struct dpif_flow_put *put) info.dpif_class = dpif_class; info.tp_dst_port = dst_port; info.tunnel_csum_on = csum_on; - err = netdev_flow_put(dev, &match, + err = netdev_flow_put(NULL, dev, &match, CONST_CAST(struct nlattr *, put->actions), put->actions_len, CONST_CAST(ovs_u128 *, put->ufid), diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index 71df291..1d203c7 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -1430,10 +1430,10 @@ find_offloaded_flow(const struct hmap *offloaded_flows, const ovs_u128 *ufid) } static int -netdev_dummy_flow_put(struct netdev *netdev, struct match *match, - struct nlattr *actions OVS_UNUSED, - size_t actions_len OVS_UNUSED, - const ovs_u128 *ufid, struct offload_info *info, +netdev_dummy_flow_put(struct dpif *dpif OVS_UNUSED, struct netdev *netdev, + struct match *match, struct nlattr *actions OVS_UNUSED, + size_t actions_len OVS_UNUSED, const ovs_u128 *ufid, + struct offload_info *info, struct dpif_flow_stats *stats) { struct netdev_dummy *dev = netdev_dummy_cast(netdev); diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index 96794dc..1aa40a1 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -707,9 +707,10 @@ netdev_offload_dpdk_destroy_flow(struct netdev *netdev, } static int -netdev_offload_dpdk_flow_put(struct netdev *netdev, struct match *match, - struct nlattr *actions, size_t actions_len, - const ovs_u128 *ufid, struct offload_info *info, +netdev_offload_dpdk_flow_put(struct dpif *dpif OVS_UNUSED, struct netdev *netdev, + struct match *match, struct nlattr *actions, + size_t actions_len, const ovs_u128 *ufid, + struct offload_info *info, struct dpif_flow_stats *stats) { struct rte_flow *rte_flow; diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h index 4e1c425..d0d3fb2 100644 --- a/lib/netdev-offload-provider.h +++ b/lib/netdev-offload-provider.h @@ -63,9 +63,10 @@ struct netdev_flow_api { * 'stats' is populated according to the rules set out in the description * above 'struct dpif_flow_put'. * Return 0 if successful, otherwise returns a positive errno value. */ - int (*flow_put)(struct netdev *, struct match *, struct nlattr *actions, - size_t actions_len, const ovs_u128 *ufid, - struct offload_info *info, struct dpif_flow_stats *); + int (*flow_put)(struct dpif *, struct netdev *, struct match *, + struct nlattr *actions, size_t actions_len, + const ovs_u128 *ufid, struct offload_info *info, + struct dpif_flow_stats *); /* Queries a flow specified by ufid on netdev. * Fills output buffer as 'wbuffer' in flow_dump_next, which diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c index 1adbb32..815105f 100644 --- a/lib/netdev-offload-tc.c +++ b/lib/netdev-offload-tc.c @@ -1141,9 +1141,10 @@ flower_match_to_tun_opt(struct tc_flower *flower, const struct flow_tnl *tnl, } static int -netdev_tc_flow_put(struct netdev *netdev, struct match *match, - struct nlattr *actions, size_t actions_len, - const ovs_u128 *ufid, struct offload_info *info, +netdev_tc_flow_put(struct dpif *dpif OVS_UNUSED, struct netdev *netdev, + struct match *match, struct nlattr *actions, + size_t actions_len, const ovs_u128 *ufid, + struct offload_info *info, struct dpif_flow_stats *stats) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20); diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c index ae01acd..71b20f3 100644 --- a/lib/netdev-offload.c +++ b/lib/netdev-offload.c @@ -226,17 +226,18 @@ netdev_flow_dump_next(struct netdev_flow_dump *dump, struct match *match, } int -netdev_flow_put(struct netdev *netdev, struct match *match, - struct nlattr *actions, size_t act_len, - const ovs_u128 *ufid, struct offload_info *info, +netdev_flow_put(struct dpif *dpif, struct netdev *netdev, + struct match *match, struct nlattr *actions, + size_t act_len, const ovs_u128 *ufid, + struct offload_info *info, struct dpif_flow_stats *stats) { const struct netdev_flow_api *flow_api = ovsrcu_get(const struct netdev_flow_api *, &netdev->flow_api); return (flow_api && flow_api->flow_put) - ? flow_api->flow_put(netdev, match, actions, act_len, ufid, - info, stats) + ? flow_api->flow_put(dpif, netdev, match, actions, + act_len, ufid, info, stats) : EOPNOTSUPP; } diff --git a/lib/netdev-offload.h b/lib/netdev-offload.h index 97a5006..d9a08b2 100644 --- a/lib/netdev-offload.h +++ b/lib/netdev-offload.h @@ -20,6 +20,7 @@ #include "openvswitch/netdev.h" #include "openvswitch/types.h" +#include "dpif-provider.h" #include "packets.h" #include "flow.h" @@ -80,7 +81,8 @@ bool netdev_flow_dump_next(struct netdev_flow_dump *, struct match *, struct nlattr **actions, struct dpif_flow_stats *, struct dpif_flow_attrs *, ovs_u128 *ufid, struct ofpbuf *rbuffer, struct ofpbuf *wbuffer); -int netdev_flow_put(struct netdev *, struct match *, struct nlattr *actions, +int netdev_flow_put(struct dpif *, struct netdev *, + struct match *, struct nlattr *actions, size_t actions_len, const ovs_u128 *, struct offload_info *, struct dpif_flow_stats *); int netdev_flow_get(struct netdev *, struct match *, struct nlattr **actions, -- 1.8.3.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
