From: Andrew Rybchenko <arybchenko@solarflare.com>
To: Gaetan Rivet <gaetan.rivet@6wind.com>
Cc: <dev@dpdk.org>, Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH v2 2/7] net/failsafe: check code of allmulticast mode switch
Date: Tue, 24 Sep 2019 13:56:08 +0100 [thread overview]
Message-ID: <1569329773-10185-3-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1569329773-10185-1-git-send-email-arybchenko@solarflare.com>
m>
<1569329773-10185-1-git-send-email-arybchenko@solarflare.com>
From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
rte_eth_allmulticast_enable()/rte_eth_allmulticast_disable() return
value was changed from void to int, so this patch modify usage
of these functions across net/failsafe according to new return type.
Try to keep all-multicast mode consistent across all active
devices in the case of failure.
Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
drivers/net/failsafe/failsafe_ether.c | 8 +++--
drivers/net/failsafe/failsafe_ops.c | 44 ++++++++++++++++++++++++---
2 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c
index bd38f1c1e..93deacd13 100644
--- a/drivers/net/failsafe/failsafe_ether.c
+++ b/drivers/net/failsafe/failsafe_ether.c
@@ -140,9 +140,13 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev,
if (dev->data->all_multicast != edev->data->all_multicast) {
DEBUG("Configuring all_multicast");
if (dev->data->all_multicast)
- rte_eth_allmulticast_enable(PORT_ID(sdev));
+ ret = rte_eth_allmulticast_enable(PORT_ID(sdev));
else
- rte_eth_allmulticast_disable(PORT_ID(sdev));
+ ret = rte_eth_allmulticast_disable(PORT_ID(sdev));
+ if (ret != 0) {
+ ERROR("Failed to apply allmulticast mode");
+ return ret;
+ }
} else {
DEBUG("all_multicast already set");
}
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index 91aa56c6f..b382661ff 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -723,10 +723,28 @@ fs_allmulticast_enable(struct rte_eth_dev *dev)
{
struct sub_device *sdev;
uint8_t i;
+ int ret = 0;
fs_lock(dev, 0);
- FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
- rte_eth_allmulticast_enable(PORT_ID(sdev));
+ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+ ret = rte_eth_allmulticast_enable(PORT_ID(sdev));
+ ret = fs_err(sdev, ret);
+ if (ret != 0) {
+ ERROR("All-multicast 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_allmulticast_disable(PORT_ID(sdev));
+ ret = fs_err(sdev, ret);
+ if (ret != 0)
+ ERROR("All-multicast mode disable during rollback failed for subdevice %d",
+ PORT_ID(sdev));
+ }
+ }
fs_unlock(dev, 0);
}
@@ -735,10 +753,28 @@ fs_allmulticast_disable(struct rte_eth_dev *dev)
{
struct sub_device *sdev;
uint8_t i;
+ int ret = 0;
fs_lock(dev, 0);
- FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
- rte_eth_allmulticast_disable(PORT_ID(sdev));
+ FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+ ret = rte_eth_allmulticast_disable(PORT_ID(sdev));
+ ret = fs_err(sdev, ret);
+ if (ret != 0) {
+ ERROR("All-multicast 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_allmulticast_enable(PORT_ID(sdev));
+ ret = fs_err(sdev, ret);
+ if (ret != 0)
+ ERROR("All-multicast mode enable during rollback failed for subdevice %d",
+ PORT_ID(sdev));
+ }
+ }
fs_unlock(dev, 0);
}
--
2.17.1
next prev parent reply other threads:[~2019-09-24 12:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-24 12:56 [dpdk-dev] [PATCH v2 0/7] ethdev: change allmulticast controls to return status Andrew Rybchenko
2019-09-24 12:56 ` [dpdk-dev] [PATCH v2 1/7] ethdev: change allmulticast mode API to return errors Andrew Rybchenko
2019-09-24 12:56 ` Andrew Rybchenko [this message]
2019-09-24 12:56 ` [dpdk-dev] [PATCH v2 3/7] net/bonding: check code of allmulticast mode switch Andrew Rybchenko
2019-09-24 12:56 ` [dpdk-dev] [PATCH v2 4/7] ethdev: change allmulticast callbacks to return status Andrew Rybchenko
2019-09-26 2:00 ` Yang, Qiming
2019-09-26 7:41 ` Ferruh Yigit
2019-09-24 12:56 ` [dpdk-dev] [PATCH v2 5/7] ethdev: do nothing if all-multicast mode is applied again Andrew Rybchenko
2019-09-24 12:56 ` [dpdk-dev] [PATCH v2 6/7] app/testpmd: check code of allmulticast mode switch Andrew Rybchenko
2019-09-24 12:56 ` [dpdk-dev] [PATCH v2 7/7] examples/ipv4_multicast: check allmulticast enable status Andrew Rybchenko
2019-09-24 16:41 ` [dpdk-dev] [PATCH v2 0/7] ethdev: change allmulticast controls to return status Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1569329773-10185-3-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=Ivan.Ilchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=gaetan.rivet@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).