const struct rte_flow_action actions[],
struct rte_flow_error *error);
+static void
+tap_flow_free(struct pmd_internals *pmd,
+ struct rte_flow *flow);
+
static int
tap_flow_destroy(struct rte_eth_dev *dev,
struct rte_flow *flow,
flow->msg.t.tcm_handle = handle;
}
+/**
+ * Free the flow opened file descriptors and allocated memory
+ *
+ * @param[in] flow
+ * Pointer to the flow to free
+ *
+ */
+static void
+tap_flow_free(struct pmd_internals *pmd, struct rte_flow *flow)
+{
+ int i;
+
+ if (!flow)
+ return;
+
+ if (pmd->rss_enabled) {
+ /* Close flow BPF file descriptors */
+ for (i = 0; i < SEC_MAX; i++)
+ if (flow->bpf_fd[i] != 0) {
+ close(flow->bpf_fd[i]);
+ flow->bpf_fd[i] = 0;
+ }
+
+ /* Release the map key for this RSS rule */
+ bpf_rss_key(KEY_CMD_RELEASE, &flow->key_idx);
+ flow->key_idx = 0;
+ }
+
+ /* Free flow allocated memory */
+ rte_free(flow);
+}
+
/**
* Create a flow.
*
if (remote_flow)
rte_free(remote_flow);
if (flow)
- rte_free(flow);
+ tap_flow_free(pmd, flow);
return NULL;
}
struct rte_flow_error *error)
{
struct rte_flow *remote_flow = flow->remote_flow;
- int i;
int ret = 0;
LIST_REMOVE(flow, next);
"couldn't receive kernel ack to our request");
goto end;
}
- /* Close opened BPF file descriptors of this flow */
- for (i = 0; i < SEC_MAX; i++)
- if (flow->bpf_fd[i] != 0) {
- close(flow->bpf_fd[i]);
- flow->bpf_fd[i] = 0;
- }
-
- /* Release map key for this RSS rule */
- ret = bpf_rss_key(KEY_CMD_RELEASE, &flow->key_idx);
- if (ret < 0) {
- rte_flow_error_set(
- error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
- "Failed to release BPF RSS key");
-
- goto end;
- }
if (remote_flow) {
remote_flow->msg.nh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
end:
if (remote_flow)
rte_free(remote_flow);
- rte_free(flow);
+ tap_flow_free(pmd, flow);
return ret;
}