> rte API is not thread safe. We have to get netdev mutex before uing it and > also before using fields of netdev structure. > > This is important because offload API used from the separate thread and > could be used at the same time with other netdev functions called from the > main thread.
This look ok to me. I've added Ophir also in case he has any comments. Ian > > CC: Finn Christensen <[email protected]> > Fixes: e8a2b5bf92bb ("netdev-dpdk: implement flow offload with rte flow") > Signed-off-by: Ilya Maximets <[email protected]> > --- > lib/netdev-dpdk.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index > 7fe5eb087..78a981d8f 100644 > --- a/lib/netdev-dpdk.c > +++ b/lib/netdev-dpdk.c > @@ -4511,15 +4511,21 @@ end_proto_check: > add_flow_pattern(&patterns, RTE_FLOW_ITEM_TYPE_END, NULL, NULL); > > struct rte_flow_action_mark mark; > + struct rte_flow_action_rss *rss; > + > mark.id = info->flow_mark; > add_flow_action(&actions, RTE_FLOW_ACTION_TYPE_MARK, &mark); > > - struct rte_flow_action_rss *rss; > + ovs_mutex_lock(&dev->mutex); > + > rss = add_flow_rss_action(&actions, netdev); > add_flow_action(&actions, RTE_FLOW_ACTION_TYPE_END, NULL); > > flow = rte_flow_create(dev->port_id, &flow_attr, patterns.items, > actions.actions, &error); > + > + ovs_mutex_unlock(&dev->mutex); > + > free(rss); > if (!flow) { > VLOG_ERR("rte flow creat error: %u : message : %s\n", @@ -4639,6 > +4645,8 @@ netdev_dpdk_destroy_rte_flow(struct netdev_dpdk *dev, > struct rte_flow_error error; > int ret; > > + ovs_mutex_lock(&dev->mutex); > + > ret = rte_flow_destroy(dev->port_id, rte_flow, &error); > if (ret == 0) { > ufid_to_rte_flow_disassociate(ufid); > @@ -4649,6 +4657,7 @@ netdev_dpdk_destroy_rte_flow(struct netdev_dpdk > *dev, > error.type, error.message); > } > > + ovs_mutex_unlock(&dev->mutex); > return ret; > } > > -- > 2.17.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
