From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 290515B26 for ; Mon, 3 Sep 2018 08:55:40 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us4.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 92F8B14005B; Mon, 3 Sep 2018 06:55:34 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 2 Sep 2018 23:55:32 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Sun, 2 Sep 2018 23:55:31 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id w836tQbV010765; Mon, 3 Sep 2018 07:55:26 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 36D781626D3; Mon, 3 Sep 2018 07:55:26 +0100 (BST) From: Andrew Rybchenko To: Gaetan Rivet CC: , Evgeny Im Date: Mon, 3 Sep 2018 07:55:22 +0100 Message-ID: <1535957722-17569-3-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1535957722-17569-1-git-send-email-arybchenko@solarflare.com> References: <1535730814-24624-1-git-send-email-arybchenko@solarflare.com> <1535957722-17569-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24068.005 X-TM-AS-Result: No-4.976500-4.000000-10 X-TMASE-MatchedRID: Fz0Eq0xINt/Ot+/gOYaZxQPZZctd3P4BjiWciALpTNO7qpOHKudqcz0J SifQ1MZ59spbMCBlXHHKkgEz9Jd6P0PbYPqd/GaJd6fzD5/TRZGOhEhoAl74KFSOymiJfTYXA9q jI0r4m/ca03qUqg7CvZwWEYogmngsOXJUfyM1K02EJ5wBUYI5/QrefVId6fzV0zabL4+/4cuRXS 5OutA+GUeecoNEFPrpYcY5lcZ9pDwxFdXyW/P+XeEbUg4xvs+wn+BtC63aUh6bKItl61J/yZ+in TK0bC9eKrauXd3MZDXRn1Psjz8VhqQLrsNBRhVv+30lqBKVl54xFH9lwHuU01/AcnRwbXsAGyWz 8Gic+bifO/NIfVHahnHRsEzkrOolU0pKf+5OwzwiLV7d9yx+FzigZBQJvBjlD6DuZ3COjrnoW0N kKZgEnW3LgNyHejuiQwymtxuJ6y0= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--4.976500-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24068.005 X-MDID: 1535957735-rexkmjBO81q9 Subject: [dpdk-dev] [PATCH v2 2/2] net/failsafe: support multicast address list set X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2018 06:55:40 -0000 From: Evgeny Im Signed-off-by: Evgeny Im Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/failsafe.ini | 1 + doc/guides/rel_notes/release_18_11.rst | 6 ++++ drivers/net/failsafe/failsafe.c | 1 + drivers/net/failsafe/failsafe_ether.c | 17 +++++++++ drivers/net/failsafe/failsafe_ops.c | 48 +++++++++++++++++++++++++ drivers/net/failsafe/failsafe_private.h | 2 ++ 6 files changed, 75 insertions(+) diff --git a/doc/guides/nics/features/failsafe.ini b/doc/guides/nics/features/failsafe.ini index 83cc99d19..39ee57965 100644 --- a/doc/guides/nics/features/failsafe.ini +++ b/doc/guides/nics/features/failsafe.ini @@ -12,6 +12,7 @@ Jumbo frame = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y +Multicast MAC filter = Y VLAN filter = Y Flow control = Y Flow API = Y diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst index 24204e67b..54e0e4ee4 100644 --- a/doc/guides/rel_notes/release_18_11.rst +++ b/doc/guides/rel_notes/release_18_11.rst @@ -54,6 +54,12 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Updated failsafe driver.** + + Updated the failsafe driver including the following changes: + + * Support multicast MAC address set. + API Changes ----------- diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 657919f93..c3999f026 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -304,6 +304,7 @@ fs_rte_eth_free(const char *name) ret = pthread_mutex_destroy(&PRIV(dev)->hotplug_mutex); if (ret) ERROR("Error while destroying hotplug mutex"); + rte_free(PRIV(dev)->mcast_addrs); rte_free(PRIV(dev)); rte_eth_dev_release_port(dev); return ret; diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 5b5cb3b49..5078feabe 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -424,6 +424,23 @@ failsafe_eth_dev_state_sync(struct rte_eth_dev *dev) ret = dev->dev_ops->dev_start(dev); if (ret) goto err_remove; + /* + * Propagate multicast MAC addresses to sub-devices, + * if non zero number of addresses is set. + * The condition is required to avoid breakage of failsafe + * for sub-devices which do not support the operation + * if the feature is really not used. + */ + if (PRIV(dev)->nb_mcast_addr > 0) { + ret = dev->dev_ops->set_mc_addr_list(dev, + PRIV(dev)->mcast_addrs, + PRIV(dev)->nb_mcast_addr); + if (ret) { + ERROR("Could not set list of multicast addresses to sub_device %d", + i); + goto err_remove; + } + } return 0; err_remove: FOREACH_SUBDEV(sdev, i, dev) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 24e91c931..082685bb1 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -952,6 +952,53 @@ fs_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) return 0; } +static int +fs_set_mc_addr_list(struct rte_eth_dev *dev, + struct ether_addr *mc_addr_set, uint32_t nb_mc_addr) +{ + struct sub_device *sdev; + uint8_t i; + int ret; + + fs_lock(dev, 0); + FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { + ret = rte_eth_dev_set_mc_addr_list(PORT_ID(sdev), + mc_addr_set, nb_mc_addr); + if (ret != 0) { + ERROR("Operation rte_eth_dev_set_mc_addr_list failed for sub_device %d with error %d", + i, ret); + goto rollback; + } + } + /* Do not reallocate/save if the method is called from sync */ + if (mc_addr_set != PRIV(dev)->mcast_addrs) { + void *mcast_addrs = rte_realloc(PRIV(dev)->mcast_addrs, + nb_mc_addr * sizeof(PRIV(dev)->mcast_addrs[0]), 0); + if (mcast_addrs == NULL && nb_mc_addr > 0) { + ret = -ENOMEM; + goto rollback; + } + PRIV(dev)->mcast_addrs = mcast_addrs; + rte_memcpy(PRIV(dev)->mcast_addrs, mc_addr_set, + nb_mc_addr * sizeof(PRIV(dev)->mcast_addrs[0])); + } + PRIV(dev)->nb_mcast_addr = nb_mc_addr; + fs_unlock(dev, 0); + return 0; + +rollback: + FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { + int rc = rte_eth_dev_set_mc_addr_list(PORT_ID(sdev), + PRIV(dev)->mcast_addrs, PRIV(dev)->nb_mcast_addr); + if (rc != 0) { + ERROR("Multicast MAC address list rollback for sub_device %d failed with error %d", + i, rc); + } + } + fs_unlock(dev, 0); + return ret; +} + static int fs_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) @@ -1036,6 +1083,7 @@ const struct eth_dev_ops failsafe_ops = { .mac_addr_remove = fs_mac_addr_remove, .mac_addr_add = fs_mac_addr_add, .mac_addr_set = fs_mac_addr_set, + .set_mc_addr_list = fs_set_mc_addr_list, .rss_hash_update = fs_rss_hash_update, .filter_ctrl = fs_filter_ctrl, }; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 886af8616..abbe73e87 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -143,6 +143,8 @@ struct fs_priv { uint32_t nb_mac_addr; struct ether_addr mac_addrs[FAILSAFE_MAX_ETHADDR]; uint32_t mac_addr_pool[FAILSAFE_MAX_ETHADDR]; + uint32_t nb_mcast_addr; + struct ether_addr *mcast_addrs; /* current capabilities */ struct rte_eth_dev_info infos; struct rte_eth_dev_owner my_owner; /* Unique owner. */ -- 2.17.1