X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Ffailsafe%2Ffailsafe_flow.c;h=c072d1e9162d67b781c757283782a3e5e22211e2;hb=e940646b20fa;hp=0098672bdad898ebe108b078ce5770be42d8b7b0;hpb=b737a1ee57b6d7a868f71ab97894398fac61963b;p=dpdk.git diff --git a/drivers/net/failsafe/failsafe_flow.c b/drivers/net/failsafe/failsafe_flow.c index 0098672bda..c072d1e916 100644 --- a/drivers/net/failsafe/failsafe_flow.c +++ b/drivers/net/failsafe/failsafe_flow.c @@ -87,7 +87,7 @@ fs_flow_validate(struct rte_eth_dev *dev, DEBUG("Calling rte_flow_validate on sub_device %d", i); ret = rte_flow_validate(PORT_ID(sdev), attr, patterns, actions, error); - if (ret) { + if ((ret = fs_err(sdev, ret))) { ERROR("Operation rte_flow_validate failed for sub_device %d" " with error %d", i, ret); return ret; @@ -111,7 +111,7 @@ fs_flow_create(struct rte_eth_dev *dev, FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { flow->flows[i] = rte_flow_create(PORT_ID(sdev), attr, patterns, actions, error); - if (flow->flows[i] == NULL) { + if (flow->flows[i] == NULL && fs_err(sdev, -rte_errno)) { ERROR("Failed to create flow on sub_device %d", i); goto err; @@ -150,7 +150,7 @@ fs_flow_destroy(struct rte_eth_dev *dev, continue; local_ret = rte_flow_destroy(PORT_ID(sdev), flow->flows[i], error); - if (local_ret) { + if ((local_ret = fs_err(sdev, local_ret))) { ERROR("Failed to destroy flow on sub_device %d: %d", i, local_ret); if (ret == 0) @@ -175,7 +175,7 @@ fs_flow_flush(struct rte_eth_dev *dev, FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { DEBUG("Calling rte_flow_flush on sub_device %d", i); ret = rte_flow_flush(PORT_ID(sdev), error); - if (ret) { + if ((ret = fs_err(sdev, ret))) { ERROR("Operation rte_flow_flush failed for sub_device %d" " with error %d", i, ret); return ret; @@ -199,17 +199,50 @@ fs_flow_query(struct rte_eth_dev *dev, sdev = TX_SUBDEV(dev); if (sdev != NULL) { - return rte_flow_query(PORT_ID(sdev), - flow->flows[SUB_ID(sdev)], type, arg, error); + int ret = rte_flow_query(PORT_ID(sdev), + flow->flows[SUB_ID(sdev)], + type, arg, error); + + if ((ret = fs_err(sdev, ret))) + return ret; } WARN("No active sub_device to query about its flow"); return -1; } +static int +fs_flow_isolate(struct rte_eth_dev *dev, + int set, + struct rte_flow_error *error) +{ + struct sub_device *sdev; + uint8_t i; + int ret; + + FOREACH_SUBDEV(sdev, i, dev) { + if (sdev->state < DEV_PROBED) + continue; + DEBUG("Calling rte_flow_isolate on sub_device %d", i); + if (PRIV(dev)->flow_isolated != sdev->flow_isolated) + WARN("flow isolation mode of sub_device %d in incoherent state.", + i); + ret = rte_flow_isolate(PORT_ID(sdev), set, error); + if ((ret = fs_err(sdev, ret))) { + ERROR("Operation rte_flow_isolate failed for sub_device %d" + " with error %d", i, ret); + return ret; + } + sdev->flow_isolated = set; + } + PRIV(dev)->flow_isolated = set; + return 0; +} + const struct rte_flow_ops fs_flow_ops = { .validate = fs_flow_validate, .create = fs_flow_create, .destroy = fs_flow_destroy, .flush = fs_flow_flush, .query = fs_flow_query, + .isolate = fs_flow_isolate, };