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 E273D29CB for ; Mon, 3 Sep 2018 08:47:36 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 973A2780055; Mon, 3 Sep 2018 06:47:34 +0000 (UTC) Received: from [192.168.38.17] (91.220.146.112) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 3 Sep 2018 07:47:29 +0100 To: Gaetan Rivet CC: , Evgeny Im References: <1535730814-24624-1-git-send-email-arybchenko@solarflare.com> <1535730814-24624-3-git-send-email-arybchenko@solarflare.com> From: Andrew Rybchenko Message-ID: Date: Mon, 3 Sep 2018 09:47:30 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1535730814-24624-3-git-send-email-arybchenko@solarflare.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [91.220.146.112] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24070.003 X-TM-AS-Result: No-9.021900-8.000000-10 X-TMASE-MatchedRID: 5+1rHnqhWUQOwH4pD14DsPHkpkyUphL9TJDl9FKHbrkKogmGusPLbzBu JIwLCXmgS+UUxwTSbsDElJGJo11T3Ipj2Ncv8Tgyl1zsjZ1/6axxueIW2fKuyO7E75kpJwpGo8W MkQWv6iUD0yuKrQIMCAGLeSok4rrZC24oEZ6SpSmb4wHqRpnaDpClROEK7ycYffTsZlCWy3NgG/ pel2UJ00TzqUN1v6dk5uI57dICyvE0D4DB4KK60FSVwJ1l9YGDW5KLzZQqYdm8/ixzgvdq94fMZ MegLDIeGU0pKnas+RbnCJftFZkZizYJYNFU00e7N+XOQZygrvY= X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--9.021900-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24070.003 X-MDID: 1535957256-yqGlXy2GRcOI Subject: Re: [dpdk-dev] [PATCH 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:47:37 -0000 On 08/31/2018 06:53 PM, Andrew Rybchenko wrote: > From: Evgeny Im > > Signed-off-by: Evgeny Im > Signed-off-by: Andrew Rybchenko <...> > diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c > index 24e91c931..2583cff58 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) { > + ret = -ENOMEM; Self-NACK since it fails for empty list set since rte_realloc() returns NULL. Will fix in v2. > + 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) <...>