[ovs-dev] Subject=Re: Re: [PATCH v5 1/5] dpif-netdev: associate flow with a mark id
jiaquan song
songjiaquanjx at gmail.com
Thu Jan 11 07:10:12 UTC 2018
....
+static void
+try_netdev_flow_put(struct dp_netdev_pmd_thread *pmd, odp_port_t in_port,
+ struct dp_netdev_flow *flow, struct match *match,
+ const struct nlattr *actions, size_t actions_len)
+{
+ struct offload_info info;
+ struct dp_netdev_port *port;
+ bool modification = flow->mark != INVALID_FLOW_MARK;
+ const char *op = modification ? "modify" : "add";
+ uint32_t mark;
+ int ret;
+
+ port = dp_netdev_lookup_port(pmd->dp, in_port);
+ if (!port) {
+ return;
+ }
+
+ ovs_mutex_lock(&flow_mark.mutex);
+
+ if (modification) {
+ mark = flow->mark;
+ } else {
+ if (!netdev_is_flow_api_enabled()) {
As netdev_flow_api_enabled is a global flag, can you move this check
to the top of this function (or even out of it)?
It seems that mutex is lock/unlock each time, even flow offload is not enabled.
+ goto out;
+ }
+
+ /*
+ * If a mega flow has already been offloaded (from other PMD
+ * instances), do not offload it again.
+ */
+ mark = megaflow_to_mark_find(&flow->mega_ufid);
+ if (mark != INVALID_FLOW_MARK) {
+ VLOG_DBG("flow has already been offloaded with mark %u\n", mark);
+ mark_to_flow_associate(mark, flow);
+ goto out;
+ }
+
+ mark = flow_mark_alloc();
+ if (mark == INVALID_FLOW_MARK) {
+ VLOG_ERR("failed to allocate flow mark!\n");
+ goto out;
+ }
+ }
More information about the dev
mailing list