2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +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:
Ilya Maximets
2020-07-08 06:38:29 +00:00
parent 48c1ab5d74
commit 8842fdf1b3
8 changed files with 76 additions and 76 deletions

View File

@@ -2383,10 +2383,11 @@ static int
mark_to_flow_disassociate(struct dp_netdev_pmd_thread *pmd,
struct dp_netdev_flow *flow)
{
int ret = 0;
uint32_t mark = flow->mark;
const char *dpif_type_str = dpif_normalize_type(pmd->dp->class->type);
struct cmap_node *mark_node = CONST_CAST(struct cmap_node *,
&flow->mark_node);
uint32_t mark = flow->mark;
int ret = 0;
cmap_remove(&flow_mark.mark_to_flow, mark_node, hash_int(mark, 0));
flow->mark = INVALID_FLOW_MARK;
@@ -2399,7 +2400,7 @@ mark_to_flow_disassociate(struct dp_netdev_pmd_thread *pmd,
struct netdev *port;
odp_port_t in_port = flow->flow.in_port.odp_port;
port = netdev_ports_get(in_port, pmd->dp->class);
port = netdev_ports_get(in_port, dpif_type_str);
if (port) {
/* Taking a global 'port_mutex' to fulfill thread safety
* restrictions for the netdev-offload-dpdk module. */
@@ -2507,9 +2508,9 @@ static int
dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload)
{
struct dp_netdev_pmd_thread *pmd = offload->pmd;
const struct dpif_class *dpif_class = pmd->dp->class;
struct dp_netdev_flow *flow = offload->flow;
odp_port_t in_port = flow->flow.in_port.odp_port;
const char *dpif_type_str = dpif_normalize_type(pmd->dp->class->type);
bool modification = offload->op == DP_NETDEV_FLOW_OFFLOAD_OP_MOD;
struct offload_info info;
struct netdev *port;
@@ -2545,9 +2546,8 @@ dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload)
}
}
info.flow_mark = mark;
info.dpif_class = dpif_class;
port = netdev_ports_get(in_port, pmd->dp->class);
port = netdev_ports_get(in_port, dpif_type_str);
if (!port || netdev_vport_is_vport_class(port->netdev_class)) {
netdev_close(port);
goto err_free;
@@ -3161,7 +3161,8 @@ dpif_netdev_get_flow_offload_status(const struct dp_netdev *dp,
return false;
}
netdev = netdev_ports_get(netdev_flow->flow.in_port.odp_port, dp->class);
netdev = netdev_ports_get(netdev_flow->flow.in_port.odp_port,
dpif_normalize_type(dp->class->type));
if (!netdev) {
return false;
}