if (dev->data->promiscuous != edev->data->promiscuous) {
DEBUG("Configuring promiscuous");
if (dev->data->promiscuous)
- rte_eth_promiscuous_enable(PORT_ID(sdev));
+ ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
else
- rte_eth_promiscuous_disable(PORT_ID(sdev));
+ ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+ if (ret != 0) {
+ ERROR("Failed to apply promiscuous mode");
+ return ret;
+ }
} else {
DEBUG("promiscuous already set");
}
{
struct sub_device *sdev;
uint8_t i;
+ int ret = 0;
fs_lock(dev, 0);
- FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
- rte_eth_promiscuous_enable(PORT_ID(sdev));
+ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+ ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
+ ret = fs_err(sdev, ret);
+ if (ret != 0) {
+ ERROR("Promiscuous mode enable failed for subdevice %d",
+ PORT_ID(sdev));
+ break;
+ }
+ }
+ if (ret != 0) {
+ /* Rollback in the case of failure */
+ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+ ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+ ret = fs_err(sdev, ret);
+ if (ret != 0)
+ ERROR("Promiscuous mode disable during rollback failed for subdevice %d",
+ PORT_ID(sdev));
+ }
+ }
fs_unlock(dev, 0);
}
{
struct sub_device *sdev;
uint8_t i;
+ int ret = 0;
fs_lock(dev, 0);
- FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
- rte_eth_promiscuous_disable(PORT_ID(sdev));
+ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+ ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+ ret = fs_err(sdev, ret);
+ if (ret != 0) {
+ ERROR("Promiscuous mode disable failed for subdevice %d",
+ PORT_ID(sdev));
+ break;
+ }
+ }
+ if (ret != 0) {
+ /* Rollback in the case of failure */
+ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+ ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
+ ret = fs_err(sdev, ret);
+ if (ret != 0)
+ ERROR("Promiscuous mode enable during rollback failed for subdevice %d",
+ PORT_ID(sdev));
+ }
+ }
fs_unlock(dev, 0);
}