mirror of
https://github.com/openvswitch/ovs
synced 2025-09-05 08:45:23 +00:00
netdev-offload: Use dpif type instead of class.
There is no real difference between the 'class' and 'type' in the context of common lookup operations inside netdev-offload module because it only checks the value of pointers without using the value itself. However, 'type' has some meaning and can be used by offload provides on the initialization phase to check if this type of Flow API in pair with the netdev type could be used in particular datapath type. For example, this is needed to check if Linux flow API could be used for current tunneling vport because it could be used only if tunneling vport belongs to system datapath, i.e. has backing linux interface. This is needed to unblock tunneling offloads in userspace datapath with DPDK flow API. Acked-by: Eli Britstein <elibr@mellanox.com> Acked-by: Roni Bar Yanai <roniba@mellanox.com> Acked-by: Ophir Munk <ophirmu@mellanox.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
@@ -1120,6 +1120,7 @@ dpif_netlink_port_get_pid(const struct dpif *dpif_, odp_port_t port_no)
|
||||
static int
|
||||
dpif_netlink_flow_flush(struct dpif *dpif_)
|
||||
{
|
||||
const char *dpif_type_str = dpif_normalize_type(dpif_type(dpif_));
|
||||
const struct dpif_netlink *dpif = dpif_netlink_cast(dpif_);
|
||||
struct dpif_netlink_flow flow;
|
||||
|
||||
@@ -1128,7 +1129,7 @@ dpif_netlink_flow_flush(struct dpif *dpif_)
|
||||
flow.dp_ifindex = dpif->dp_ifindex;
|
||||
|
||||
if (netdev_is_flow_api_enabled()) {
|
||||
netdev_ports_flow_flush(dpif_->dpif_class);
|
||||
netdev_ports_flow_flush(dpif_type_str);
|
||||
}
|
||||
|
||||
return dpif_netlink_flow_transact(&flow, NULL, NULL);
|
||||
@@ -1445,7 +1446,7 @@ start_netdev_dump(const struct dpif *dpif_,
|
||||
ovs_mutex_lock(&dump->netdev_lock);
|
||||
dump->netdev_current_dump = 0;
|
||||
dump->netdev_dumps
|
||||
= netdev_ports_flow_dump_create(dpif_->dpif_class,
|
||||
= netdev_ports_flow_dump_create(dpif_normalize_type(dpif_type(dpif_)),
|
||||
&dump->netdev_dumps_num,
|
||||
dump->up.terse);
|
||||
ovs_mutex_unlock(&dump->netdev_lock);
|
||||
@@ -2002,6 +2003,7 @@ dpif_netlink_operate__(struct dpif_netlink *dpif,
|
||||
static int
|
||||
parse_flow_get(struct dpif_netlink *dpif, struct dpif_flow_get *get)
|
||||
{
|
||||
const char *dpif_type_str = dpif_normalize_type(dpif_type(&dpif->dpif));
|
||||
struct dpif_flow *dpif_flow = get->flow;
|
||||
struct match match;
|
||||
struct nlattr *actions;
|
||||
@@ -2016,8 +2018,8 @@ parse_flow_get(struct dpif_netlink *dpif, struct dpif_flow_get *get)
|
||||
int err;
|
||||
|
||||
ofpbuf_use_stack(&buf, &act_buf, sizeof act_buf);
|
||||
err = netdev_ports_flow_get(dpif->dpif.dpif_class, &match,
|
||||
&actions, get->ufid, &stats, &attrs, &buf);
|
||||
err = netdev_ports_flow_get(dpif_type_str, &match, &actions, get->ufid,
|
||||
&stats, &attrs, &buf);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
@@ -2042,8 +2044,8 @@ parse_flow_get(struct dpif_netlink *dpif, struct dpif_flow_get *get)
|
||||
static int
|
||||
parse_flow_put(struct dpif_netlink *dpif, struct dpif_flow_put *put)
|
||||
{
|
||||
const char *dpif_type_str = dpif_normalize_type(dpif_type(&dpif->dpif));
|
||||
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
|
||||
const struct dpif_class *dpif_class = dpif->dpif.dpif_class;
|
||||
struct match match;
|
||||
odp_port_t in_port;
|
||||
const struct nlattr *nla;
|
||||
@@ -2065,7 +2067,7 @@ parse_flow_put(struct dpif_netlink *dpif, struct dpif_flow_put *put)
|
||||
}
|
||||
|
||||
in_port = match.flow.in_port.odp_port;
|
||||
dev = netdev_ports_get(in_port, dpif_class);
|
||||
dev = netdev_ports_get(in_port, dpif_type_str);
|
||||
if (!dev) {
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
@@ -2078,7 +2080,7 @@ parse_flow_put(struct dpif_netlink *dpif, struct dpif_flow_put *put)
|
||||
odp_port_t out_port;
|
||||
|
||||
out_port = nl_attr_get_odp_port(nla);
|
||||
outdev = netdev_ports_get(out_port, dpif_class);
|
||||
outdev = netdev_ports_get(out_port, dpif_type_str);
|
||||
if (!outdev) {
|
||||
err = EOPNOTSUPP;
|
||||
goto out;
|
||||
@@ -2094,7 +2096,6 @@ 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;
|
||||
info.recirc_id_shared_with_tc = (dpif->user_features
|
||||
@@ -2198,8 +2199,10 @@ try_send_to_netdev(struct dpif_netlink *dpif, struct dpif_op *op)
|
||||
break;
|
||||
}
|
||||
|
||||
err = netdev_ports_flow_del(dpif->dpif.dpif_class, del->ufid,
|
||||
del->stats);
|
||||
err = netdev_ports_flow_del(
|
||||
dpif_normalize_type(dpif_type(&dpif->dpif)),
|
||||
del->ufid,
|
||||
del->stats);
|
||||
log_flow_del_message(&dpif->dpif, &this_module, del, 0);
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user