summaryrefslogtreecommitdiff
path: root/lib/netdev-offload.h
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@ovn.org>2021-12-17 01:05:57 +0100
committerIlya Maximets <i.maximets@ovn.org>2021-12-17 21:31:55 +0100
commit11441385c2f788320799ba29b344098b917d8827 (patch)
treeb7b66d27e07555ee99a04496c5063cc39a59c598 /lib/netdev-offload.h
parentec2aa2ab4689d156a5397e3379b8c9f7521473d4 (diff)
downloadopenvswitch-11441385c2f788320799ba29b344098b917d8827.tar.gz
bridge: Fix incorrect configuration of netdev's dpif type.
netdev_set_dpif_type() can only be used with a normalized dpif type as an argument, which is a constant static string derived from a type of a dpif_class or a constant string "system". Usage of a same constant string allows netdev-offload module to compare types by simply comparing pointers. OTOH, 'br->ofproto->type' is a dynamic string that: a. Can be NULL. b. Even if not NULL and equal, can be a different dynamically allocated string. Both these qualities breaks assumptions made by all other modules related to HW offload, breaking the functionality. Fix that by moving netdev_set_dpif_type() to dpif.c and calling with a correct constant string as an argument. The call moved from bridge.c to dpif.c, because we need to have access to the dpif class, but bridge.c should not. Not trying to set the dpif_type inside the netdev_ports_insert(), because it's used now outside the offloading context. So, it's cleaner to move the netdev_set_dpif_type() call outside of the netdev-offload module. Additionally removed the redundant call from the netdev_ports_insert() and refactored the function, since it doesn't need an extra argument anymore. Fixes: 4f19a78a61c5 ("netdev-vport: Fix userspace tunnel ioctl(SIOCGIFINDEX) info logs.") Reported-by: Roi Dayan <roid@nvidia.com> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2021-December/390117.html Signed-off-by: Ilya Maximets <i.maximets@ovn.org> Reviewed-by: Lin Huang <linhuang@ruijie.com.cn> Acked-by: Roi Dayan <roid@nvidia.com>
Diffstat (limited to 'lib/netdev-offload.h')
-rw-r--r--lib/netdev-offload.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/netdev-offload.h b/lib/netdev-offload.h
index e7fcedae9..43a98d499 100644
--- a/lib/netdev-offload.h
+++ b/lib/netdev-offload.h
@@ -108,8 +108,7 @@ bool netdev_is_offload_rebalance_policy_enabled(void);
int netdev_flow_get_n_flows(struct netdev *netdev, uint64_t *n_flows);
struct dpif_port;
-int netdev_ports_insert(struct netdev *, const char *dpif_type,
- struct dpif_port *);
+int netdev_ports_insert(struct netdev *, struct dpif_port *);
struct netdev *netdev_ports_get(odp_port_t port, const char *dpif_type);
int netdev_ports_remove(odp_port_t port, const char *dpif_type);
odp_port_t netdev_ifindex_to_odp_port(int ifindex);