MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tap_flow_destroy_pmd

Function tap_flow_destroy_pmd

dpdk/drivers/net/tap/tap_flow.c:1494–1554  ·  view source on GitHub ↗

* Destroy a flow using pointer to pmd_internal. * * @param[in, out] pmd * Pointer to private structure. * @param[in] flow * Pointer to the flow to destroy. * @param[in, out] error * Pointer to the flow error handler * * @return 0 if the flow could be destroyed, -1 otherwise. */

Source from the content-addressed store, hash-verified

1492 * @return 0 if the flow could be destroyed, -1 otherwise.
1493 */
1494static int
1495tap_flow_destroy_pmd(struct pmd_internals *pmd,
1496 struct rte_flow *flow,
1497 struct rte_flow_error *error)
1498{
1499 struct rte_flow *remote_flow = flow->remote_flow;
1500 int ret = 0;
1501
1502 LIST_REMOVE(flow, next);
1503 flow->msg.nh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
1504 flow->msg.nh.nlmsg_type = RTM_DELTFILTER;
1505
1506 ret = tap_nl_send(pmd->nlsk_fd, &flow->msg.nh);
1507 if (ret < 0) {
1508 rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
1509 NULL, "couldn't send request to kernel");
1510 goto end;
1511 }
1512 ret = tap_nl_recv_ack(pmd->nlsk_fd);
1513 /* If errno is ENOENT, the rule is already no longer in the kernel. */
1514 if (ret < 0 && errno == ENOENT)
1515 ret = 0;
1516 if (ret < 0) {
1517 TAP_LOG(ERR,
1518 "Kernel refused TC filter rule deletion (%d): %s",
1519 errno, strerror(errno));
1520 rte_flow_error_set(
1521 error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
1522 "couldn't receive kernel ack to our request");
1523 goto end;
1524 }
1525
1526 if (remote_flow) {
1527 remote_flow->msg.nh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
1528 remote_flow->msg.nh.nlmsg_type = RTM_DELTFILTER;
1529
1530 ret = tap_nl_send(pmd->nlsk_fd, &remote_flow->msg.nh);
1531 if (ret < 0) {
1532 rte_flow_error_set(
1533 error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
1534 NULL, "Failure sending nl request");
1535 goto end;
1536 }
1537 ret = tap_nl_recv_ack(pmd->nlsk_fd);
1538 if (ret < 0 && errno == ENOENT)
1539 ret = 0;
1540 if (ret < 0) {
1541 TAP_LOG(ERR,
1542 "Kernel refused TC filter rule deletion (%d): %s",
1543 errno, strerror(errno));
1544 rte_flow_error_set(
1545 error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
1546 NULL, "Failure trying to receive nl ack");
1547 goto end;
1548 }
1549 }
1550end:
1551 rte_free(remote_flow);

Callers 4

tap_flow_destroyFunction · 0.85
tap_flow_isolateFunction · 0.85
tap_flow_implicit_flushFunction · 0.85

Calls 5

tap_nl_sendFunction · 0.85
rte_flow_error_setFunction · 0.85
tap_nl_recv_ackFunction · 0.85
rte_freeFunction · 0.85
tap_flow_freeFunction · 0.85

Tested by

no test coverage detected