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 5B7A1A0032; Sat, 22 Oct 2022 10:12:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E7DFE400D6; Sat, 22 Oct 2022 10:12:26 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2108.outbound.protection.outlook.com [40.107.102.108]) by mails.dpdk.org (Postfix) with ESMTP id BFF7A40042 for ; Sat, 22 Oct 2022 10:12:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DwHCsvyAP4MEiRpDOUQOGtv2nO29JmPzylko60GE21x6ZaBrxKsGifdj6Vzq4E5w7iLcUD8tXO6gJw3vFFDjow1odnvJAIhXNeAOE3qoIOdEZCIXxjzi2lYfakx6lWtCTgFTbRBdIZ5g5onsjkHDGDHNxc0TQQ8aeX/5Yi3zutA4Y1dnhTGEwcOgTCuDZOoG6V5S9HW1zSJ9ACLapoklm896i7eSbq4pCStT+EwvNgjH56Wky/WZVm6DlXsBP3vZR3dW8F6EeVdRpxcOVRrFnPa2hz7FbzQRMDt2E2oBW0YudsWKMNtP9ofDp1YJhSllxe9DpLFI1rbXkViyWO93lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JE+05Oq5ZZu7pyPoOl+x5kjEq5Q78vEZ4Pzb2ubncow=; b=AfdcXH2lzLj9QXOzyODhy+6yMLOgY1g9WF5HD7MQZ1D9GA/1KDbwWiu6Dt73aRFZIEOxUJLNI/mMIJY7H6tsq1lhOFYxkipB4wjtvN2V0A6r6DiGY5U9iJFL7Ky9Lo1MFhkEn02uq04PPOl3drN04Py5atdxrSQvRVrxxm65GCys1Zj6W8B0CPC6ddLS5HYlzswaGjhcwQWoaOGJBM7s4ulih82O9TycQ7xZUbiatZLmKnAPb2aqWNB6HjB4+TdDnorbjClkZbQYNtJ8cH2GmcDQZRp1njKjAj9q2rugJqcNJKddO5wcmLjbAuNl0+ZipWE6rklvenHq2Ilr2piWgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JE+05Oq5ZZu7pyPoOl+x5kjEq5Q78vEZ4Pzb2ubncow=; b=TofJDBnOy0kae0xRVaYFccPYbdzN141KjpaRq55RZuddmJzsGN2YYJBb7V52vJbu12mmiSKfrZCN/DHe7UFkT76xL6FR8fxv3IFOLX0H6r2Qko7QVLYqZX6XiDzi6lsD4PcnQmqHWM3FAS8O7jKn1L0Sdr7w1MmQat+dTPiDijE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by BLAPR13MB4739.namprd13.prod.outlook.com (2603:10b6:208:306::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.20; Sat, 22 Oct 2022 08:12:15 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b%4]) with mapi id 15.20.5723.014; Sat, 22 Oct 2022 08:12:14 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v7] net/nfp: fix the promiscuous mode functions Date: Sat, 22 Oct 2022 16:11:48 +0800 Message-Id: <1666426308-9806-1-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666339323-24016-3-git-send-email-chaoyong.he@corigine.com> References: <1666339323-24016-3-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain X-ClientProxiedBy: SI2PR01CA0048.apcprd01.prod.exchangelabs.com (2603:1096:4:193::17) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BLAPR13MB4739:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ca6bb4e-b5a2-4296-3d2f-08dab40520d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GdmiEHtyeCSzg+rDVskQG1RpLl+ug+NHRrocMPPjPLx11dVMu47fggsZrOGypoM9yYdz44IBT08Uho3EDWGYCzeCqOSgKsAVf0YuPfTLVioNudBWBOfXa7T6fFauu9Ddtx7GKmlAtoxuoODw8B99r3jjLz3aegk8oBp6vqaH4/L5oUkzgBpcMTK9UxS5BDCW8FdWSAcUmf0dCeMeb8TuATQWvB5r5i+H6C9xDH3Ey3lR80QdTGLV80NV6gag3f7VX8/k4kW+fWVxaIeyNuW4EJSotGwAs4ORV17o8L40qAPK2DVqOKooR3tUrX/Yftx8ZRqnnAAIniMYvQbbjicQJ26Pm4otRnvcvxxZBvYxV84+xW4JwlmqguDy058zLRAcc/T57xh5ye6mNqSmy+avylnZD6liyxMmVbRzU/C+BzeNLoKJp9yisIsYKbEXANm+Lh/G0AG41bF9ZYQKuCMPce5Ug5XBKf+JBXP7Y2LAvSnTS87RRdXw18zaTmp5dHmvmmdGjPtM3bSnkdHw2+7tzizZR1WmWHfvMhh1wumSblx8CLoHu+kNeyqjFROSoT2BZzyv8eIUmJ1c4tH9pMmoLcAbD+49QhLi5SO05raPoG18spSo3T9pAgn0YrIRN558aDiV8/3LOEGBVf0gctd+8PARsE/bFG6e+2ssVPDxVdshHkxNYcllFkeUga/EmxHODLeIuNi9G2cVDJ39ZZDTXmTfs+NNmRjH1ldACs0oe6KRaeht+Txdql/rEgtKkLue0AGN2SVKShr2UnICoB0acA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(346002)(376002)(366004)(396003)(39830400003)(451199015)(2616005)(186003)(83380400001)(86362001)(38350700002)(38100700002)(2906002)(44832011)(6916009)(5660300002)(107886003)(41300700001)(6666004)(8936002)(478600001)(26005)(6506007)(6512007)(66556008)(66946007)(8676002)(4326008)(316002)(6486002)(52116002)(66476007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dyFPVbzbptx0x90ryYLU5rLdZZ6u4cCMEpxz2+5lJaWR6bg5D9p+BhplZslc?= =?us-ascii?Q?jMPfF43Q6IaqHylJbqmaewsCmu/2LTL97b+/72hmKS2mUjEBejGqqp5/P0J7?= =?us-ascii?Q?HQxbJez+lJgMWPARlOGvFDsuyaTYgeL5rGhcVZBQ8SfH/sgqwfKhXyHPYofo?= =?us-ascii?Q?LVIDCx4aHqCwJLRZOflOfPRt4HZ/GU4KabicMrB/1y/X7qG1xX7yBkrfQiyd?= =?us-ascii?Q?/TEXUaM5GL0KTMExbwV6oTZVVmbf5CXdZGT3ehU4W+U3Au02IhYV46QDrojK?= =?us-ascii?Q?POk7AE1FPhpnpPJNJV1aHZ85ByXyv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AzCumIVuNwS/8bytdDB4Q6A7JpBDq92NVJkXGDIJq5eiH2PMvDHZ3?= =?us-ascii?Q?EQkzbZbUv2KqkTkUxo1/i1FjP/PI9HtPDEqmHnqsPU629LL97TuoKcDgega/?= =?us-ascii?Q?wS5NVMh1vmZ5v9VWiwhrVTQbE9RfgJh866sW5Mnj4iuCquaYOaaBqYWezseZ?= =?us-ascii?Q?VVEA+iq9rPCHCPKz07PnXSNMuDaZ3ax1cUaarrf9dmOahWOI2URdnf05lGJo?= =?us-ascii?Q?/6aWNRHhu5fa2wDLxFskpt/gccugF8KB5VNSQGADNPoPZ2i+wDf/j+yYj2A+?= =?us-ascii?Q?QjoLGBz5w+BjCw+YXU83CNlezD59UhNwquVD/QzES9CrYRpAVXW4QZnGIKJo?= =?us-ascii?Q?Ksc+wFBvmRaNP0wJqBnHfiAm2s0hXalp8RoTfGteAsLpBUya3kw/6zSomXSr?= =?us-ascii?Q?GA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ca6bb4e-b5a2-4296-3d2f-08dab40520d3 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2022 08:12:14.8802 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MAMO57xQ1K4NYp2x+AIx+qbhDUwp7tYpxy6ya/AM7CLlBOlclvXDrqDHmoTYtwUSGM5xTlf0va2yQ69yV4xB6puQVw/bOD6iJ0YD4LVriWk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR13MB4739 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 The original functions of promiscuous mode can't process the representor port rightly, revise the logic to do that. Fixes: e1124c4f8a45 ("net/nfp: add flower representor framework") Signed-off-by: Chaoyong He --- drivers/net/nfp/flower/nfp_flower.h | 2 ++ drivers/net/nfp/flower/nfp_flower_representor.c | 47 +++---------------------- drivers/net/nfp/flower/nfp_flower_representor.h | 2 ++ drivers/net/nfp/nfp_common.c | 10 +++++- 4 files changed, 17 insertions(+), 44 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.h b/drivers/net/nfp/flower/nfp_flower.h index 12a0fb5..f199741 100644 --- a/drivers/net/nfp/flower/nfp_flower.h +++ b/drivers/net/nfp/flower/nfp_flower.h @@ -6,6 +6,8 @@ #ifndef _NFP_FLOWER_H_ #define _NFP_FLOWER_H_ +#include "../nfp_common.h" + /* * Flower fallback and ctrl path always adds and removes * 8 bytes of prepended data. Tx descriptors must point diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index f1cd298..5809c83 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -414,45 +414,6 @@ } static int -nfp_flower_repr_promiscuous_enable(struct rte_eth_dev *dev) -{ - struct nfp_net_hw *pf_hw; - struct nfp_flower_representor *repr; - - repr = (struct nfp_flower_representor *)dev->data->dev_private; - pf_hw = repr->app_fw_flower->pf_hw; - - if (!(pf_hw->cap & NFP_NET_CFG_CTRL_PROMISC)) { - PMD_DRV_LOG(INFO, "Promiscuous mode not supported"); - return -ENOTSUP; - } - - if (pf_hw->ctrl & NFP_NET_CFG_CTRL_PROMISC) { - PMD_DRV_LOG(INFO, "Promiscuous mode already enabled"); - return 0; - } - - return nfp_net_promisc_enable(pf_hw->eth_dev); -} - -static int -nfp_flower_repr_promiscuous_disable(struct rte_eth_dev *dev) -{ - struct nfp_net_hw *pf_hw; - struct nfp_flower_representor *repr; - - repr = (struct nfp_flower_representor *)dev->data->dev_private; - pf_hw = repr->app_fw_flower->pf_hw; - - if ((pf_hw->ctrl & NFP_NET_CFG_CTRL_PROMISC) == 0) { - PMD_DRV_LOG(INFO, "Promiscuous mode already disabled"); - return 0; - } - - return nfp_net_promisc_disable(pf_hw->eth_dev); -} - -static int nfp_flower_repr_mac_addr_set(struct rte_eth_dev *ethdev, struct rte_ether_addr *mac_addr) { @@ -566,8 +527,8 @@ .stats_get = nfp_flower_repr_stats_get, .stats_reset = nfp_flower_repr_stats_reset, - .promiscuous_enable = nfp_flower_repr_promiscuous_enable, - .promiscuous_disable = nfp_flower_repr_promiscuous_disable, + .promiscuous_enable = nfp_net_promisc_enable, + .promiscuous_disable = nfp_net_promisc_enable, .mac_addr_set = nfp_flower_repr_mac_addr_set, }; @@ -587,8 +548,8 @@ .stats_get = nfp_flower_repr_stats_get, .stats_reset = nfp_flower_repr_stats_reset, - .promiscuous_enable = nfp_flower_repr_promiscuous_enable, - .promiscuous_disable = nfp_flower_repr_promiscuous_disable, + .promiscuous_enable = nfp_net_promisc_enable, + .promiscuous_disable = nfp_net_promisc_enable, .mac_addr_set = nfp_flower_repr_mac_addr_set, diff --git a/drivers/net/nfp/flower/nfp_flower_representor.h b/drivers/net/nfp/flower/nfp_flower_representor.h index af44ef3..685cbe4 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.h +++ b/drivers/net/nfp/flower/nfp_flower_representor.h @@ -6,6 +6,8 @@ #ifndef _NFP_FLOWER_REPRESENTOR_H_ #define _NFP_FLOWER_REPRESENTOR_H_ +#include "nfp_flower.h" + /* * enum nfp_repr_type - type of representor * @NFP_REPR_TYPE_PHYS_PORT: external NIC port diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index 277ea23..463eb64 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -37,6 +37,8 @@ #include "nfpcore/nfp_rtsym.h" #include "nfpcore/nfp_nsp.h" +#include "flower/nfp_flower_representor.h" + #include "nfp_common.h" #include "nfp_ctrl.h" #include "nfp_rxtx.h" @@ -412,10 +414,16 @@ uint32_t new_ctrl, update = 0; struct nfp_net_hw *hw; int ret; + struct nfp_flower_representor *repr; PMD_DRV_LOG(DEBUG, "Promiscuous mode enable"); - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) { + repr = dev->data->dev_private; + hw = repr->app_fw_flower->pf_hw; + } else { + hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + } if (!(hw->cap & NFP_NET_CFG_CTRL_PROMISC)) { PMD_INIT_LOG(INFO, "Promiscuous mode not supported"); -- 1.8.3.1