From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45C4146152; Fri, 31 Jan 2025 09:08:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 02EFF427DF; Fri, 31 Jan 2025 09:07:22 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 154E0427DA for ; Fri, 31 Jan 2025 09:07:20 +0100 (CET) Received: from pps.filterd (m0431383.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50V70SGk004967 for ; Fri, 31 Jan 2025 00:07:20 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=+ VVJwN0ApKnhXHwmtC5uT5XHWTST64zqSgxKuyDYhLc=; b=K+Fv+P9fD86LiXB1a mwyvEi4q+fjcEAY2tT8bYIInGoTbDhUDfJ64VP8qh2SDlelHqm3Qp29sEI31X/cr Jk8vsZOnydgh/w/dnLQUWj1gu7C7zGvkPkWVrBjcZsqTX0WAOPZO96LEc1gc3XOG 9wZWYqD+tXyOzTdxZFI3JkJzSEPhCr2sUxGH5JyKm2AxUJq0K1Y9gTba1RyO98aU addJ34tRO5RoSX8tQU11rMaYWGf1IxhF3exgKttO8iJCEydLPeqHPxNxgGmyMTB/ WswFuLxhtOpGtghBLEVA6u2IGZsY9T6/8pjWB8yRJOAAhMbC6nk+XmEYKn3AUWsl eLwSA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 44gsr3g38r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 31 Jan 2025 00:07:20 -0800 (PST) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 31 Jan 2025 00:07:19 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 31 Jan 2025 00:07:18 -0800 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 9DC523F7089; Fri, 31 Jan 2025 00:07:16 -0800 (PST) From: Nithin Dabilpuram To: , Nithin Dabilpuram , "Kiran Kumar K" , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: Subject: [PATCH 33/34] net/cnxk: update MC address list configure API Date: Fri, 31 Jan 2025 13:35:28 +0530 Message-ID: <20250131080530.3224977-33-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250131080530.3224977-1-ndabilpuram@marvell.com> References: <20250131080530.3224977-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: rfzWsCpt4tQxLq5QkVLNiQ7zVARqUWD0 X-Proofpoint-GUID: rfzWsCpt4tQxLq5QkVLNiQ7zVARqUWD0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-31_03,2025-01-30_01,2024-11-22_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Satha Rao Return -ENOSPC when there is no space to update the complete MC address list, without flushing the existing list of addresses. Signed-off-by: Satha Rao --- drivers/net/cnxk/cnxk_ethdev_ops.c | 32 ++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c index 5b0948e07a..9970c5ff5c 100644 --- a/drivers/net/cnxk/cnxk_ethdev_ops.c +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c @@ -1117,17 +1117,14 @@ cnxk_nix_rss_hash_conf_get(struct rte_eth_dev *eth_dev, return 0; } -int -cnxk_nix_mc_addr_list_configure(struct rte_eth_dev *eth_dev, - struct rte_ether_addr *mc_addr_set, - uint32_t nb_mc_addr) +static inline int +nix_mc_addr_list_flush(struct rte_eth_dev *eth_dev) { struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); struct rte_eth_dev_data *data = eth_dev->data; struct rte_ether_addr null_mac_addr; struct roc_nix *nix = &dev->nix; - int rc, index; - uint32_t i; + int i, rc = 0; memset(&null_mac_addr, 0, sizeof(null_mac_addr)); @@ -1148,15 +1145,34 @@ cnxk_nix_mc_addr_list_configure(struct rte_eth_dev *eth_dev, } } + return rc; +} + +int +cnxk_nix_mc_addr_list_configure(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_addr_set, + uint32_t nb_mc_addr) +{ + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); + struct rte_eth_dev_data *data = eth_dev->data; + struct roc_nix *nix = &dev->nix; + int index, mc_addr_cnt = 0; + uint32_t i; + if (!mc_addr_set || !nb_mc_addr) - return 0; + return nix_mc_addr_list_flush(eth_dev); + + /* Count multicast MAC addresses in list */ + for (i = 0; i < dev->max_mac_entries; i++) + if (rte_is_multicast_ether_addr(&data->mac_addrs[i])) + mc_addr_cnt++; /* Check for available space */ if (nb_mc_addr > - ((uint32_t)(dev->max_mac_entries - dev->dmac_filter_count))) { + ((uint32_t)(dev->max_mac_entries - (dev->dmac_filter_count - mc_addr_cnt)))) { plt_err("No space is available to add multicast filters"); return -ENOSPC; } + nix_mc_addr_list_flush(eth_dev); /* Multicast addresses are to be installed */ for (i = 0; i < nb_mc_addr; i++) { -- 2.34.1