From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DFA84A0471 for ; Thu, 18 Jul 2019 05:37:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EB5D81B9A0; Thu, 18 Jul 2019 05:36:40 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id EF6971B95C; Thu, 18 Jul 2019 05:36:34 +0200 (CEST) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 7814530C39E; Wed, 17 Jul 2019 20:36:32 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 7814530C39E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1563420992; bh=DA/7E6DqhzCiX5YpENVroQa+hY+ERj5tfEbZA8uq3vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KUFjz+3196QAQmGL9jtTNAuUGY3E2klWij65mxwI1C6lyeAokYXHN8Syx82fW8OV0 3ZjaX8WEU2Uk3c1201pLO2gTSQgSudred2Nz5wam6RlpCcdKzBEtp+5sV5Z3jp6Db7 4bH+XqBEHaoPC2m0/qtNKQDM9MoCfkCGk+JaXHsY= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.122.43.105]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id D0536AC0761; Wed, 17 Jul 2019 20:36:31 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Kalesh AP , stable@dpdk.org, Somnath Kotur Date: Thu, 18 Jul 2019 09:05:59 +0530 Message-Id: <20190718033616.37605-6-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190718033616.37605-1-ajit.khaparde@broadcom.com> References: <20190718033616.37605-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 05/22] net/bnxt: fix setting primary MAC address 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kalesh AP 1. Default filter is tied to VNIC 0 at index 0. After finding the filter with mac_index 0 and set the new MAC address, looping through remaining filters is unnecessary. 2. Added a check for NULL MAC address. 3. bnxt_hwrm_set_l2_filter() clears the existing filter configuration first before applying new filter settings. Hence there is no need to invoke bnxt_hwrm_clear_l2_filter() explicitly in bnxt_set_default_mac_addr_op(). Fixes: d69851df12b2d ("net/bnxt: support multicast filter and set MAC addr") Cc: stable@dpdk.org Reviewed-by: Somnath Kotur Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 7e0fca31e..455d8a3bf 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1699,26 +1699,28 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp)) return -EPERM; - memcpy(bp->mac_addr, addr, sizeof(bp->mac_addr)); + if (rte_is_zero_ether_addr(addr)) + return -EINVAL; STAILQ_FOREACH(filter, &vnic->filter, next) { /* Default Filter is at Index 0 */ if (filter->mac_index != 0) continue; - rc = bnxt_hwrm_clear_l2_filter(bp, filter); - if (rc) - return rc; + memcpy(filter->l2_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN); memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); filter->flags |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX; filter->enables |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK; + rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter); if (rc) return rc; - filter->mac_index = 0; + + memcpy(bp->mac_addr, addr, RTE_ETHER_ADDR_LEN); PMD_DRV_LOG(DEBUG, "Set MAC addr\n"); + return 0; } return 0; -- 2.20.1 (Apple Git-117)