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 E490343AE5; Sat, 10 Feb 2024 11:42:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5511142EB6; Sat, 10 Feb 2024 11:42:43 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2139.outbound.protection.outlook.com [40.107.223.139]) by mails.dpdk.org (Postfix) with ESMTP id 4AFA0402DF for ; Sat, 10 Feb 2024 11:42:41 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IwzQ7O0mUmvWA7Kp3ledAc19HEfF5bZP+SjI9hMNxX2Zn8HhXgwOq1vBOZ3e8vaE/mVa2BCpIRrheuXJ2WM5kqJDyav1eSsVwkWHu01S7QXMQ4O2HMJlyyPPdWXFkQv3yPbKvMWI/GFtl1c/SWErZ4QruRMb7NLQTP3yYBchiviQ5kuYXwSicnHZU6QKmMqvx4y2f3ofeuF8+oP7H937ibk299w1zr77uCbauXJ6qq/nVqPXTr4oFumihjms2NCR3uGzacjBOBwFuUkA0EODiwj+FxyGGEkM8gHQMl2hFdSjGXVQxVlJwm1YFzMJX5u2a8IcAEQfqJ2kflWFVqXWWQ== 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=EzZD/GOFHPqdhbaIpbSOt0szFjCYGwB5Oq0kaenUcFY=; b=S3rc4XNS5zZo2n767UR8CextzbPG01O4YeFp2WjwzTMxBzQJqeTOIHIjTSo5A0Qkv6PEuHH7KYT5ZbWPwnlMpgAA+Jem5wFTl8wxQbnrnHqAPU3tRI0nwfEu83nsFqLJpyJ6JO8KceXycA3NCR3VhxIlAWFgu/Mmto5g+BtmYTtKadkcx6sB1fMay0+yY4ypV6AxHgOr7Rhxe3dr27YjGE2BYLdNVI1SEluSomcLvfroMJmZFIF5I7idDWBpI1qfd8t+zhbTbTobkYC2ai+qtFQOXKGzlopcAKElKQEvJg1VpBrgR7N7k2sZqZfqbwzp4iFz8leadmb5t7V4U9cEZQ== 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=EzZD/GOFHPqdhbaIpbSOt0szFjCYGwB5Oq0kaenUcFY=; b=fMuAVDizscJ1V3egaz5wm92SijnzeUt+oXtNoQlCjUIBvxROIcPpkXrUIWfKdIBlelLdlasadJZvCktflBVNvOzQAn+VIU6dfTtwnzNmUBJXKLKEf7s68YX6wZ5aRf/1vebhzylR/O6oWgvYpxhTelUTAeyVUM8CjMozi63nwjQ= 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 PH0PR13MB5421.namprd13.prod.outlook.com (2603:10b6:510:142::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.24; Sat, 10 Feb 2024 10:42:40 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa%7]) with mapi id 15.20.7270.031; Sat, 10 Feb 2024 10:42:39 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , Peng Zhang Subject: [PATCH 2/4] net/nfp: add interface to check representor Date: Sat, 10 Feb 2024 18:42:11 +0800 Message-Id: <20240210104214.1248772-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240210104214.1248772-1-chaoyong.he@corigine.com> References: <20240210104214.1248772-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR02CA0129.apcprd02.prod.outlook.com (2603:1096:4:188::19) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB5421:EE_ X-MS-Office365-Filtering-Correlation-Id: 47241f7b-2d8a-4b4d-1d55-08dc2a2500d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GgRE6qAZKGx3ZpVcjb7yAgNP+FhpfdM9wyFzRiixJXPRBfanncWX9GVJwkME6XXJZfurzym7joDJzO3mJG0KDXGK/LQPd4i2/gnBdF/7t7B6boKGOJUpBJbOqGtpEeF3PDGaKopzNOraI3grruFg8sXaEmHeeD7yYScCuFt8wrsR1pLdqfrw1WTGiTMiUEiJ/60R++A6CGgHk0SW34X/N/AqhYK9DgVG+dB2jNi942Yntgk4+JGHOuTQBe21Kd03lKYFs836IuuKzRm71lTCspQfTLqbp+QIDJhLAjGcZpceUk4bvgUmi2dPACFSAph1I02MZBoQZQ/3c6ThvaNOJDMuur2VM6rKb0HwNkBanCj3kWtupLcf9bhZbz+55kT3y3CjvanvbZX8mGSCPGYSsITaO0/oGX8ChuPZqy2iTDra9+bQ8cYclIZf58qrmtRQdk8F6RQGKn6hEaPIi2e9v9D4BdiChUSO01JWCNuAn+H4R9ZLYpkcXliq5Nmx4TzAjaOKp35TGTs3kLNtkgMq0wsnDrf5ILFOUeKjsMLgZjdJpYI62SYAQhp3KdfzSQcSSYMsqk6hi6QU5FqKFxkMuGL6m/ZYb/GoJ+pUr4IIdX1MfufRg3NU+Mnr9hwhoaoH 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:(13230031)(346002)(366004)(39830400003)(396003)(136003)(376002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(38100700002)(66556008)(6666004)(52116002)(478600001)(316002)(86362001)(6512007)(6486002)(5660300002)(6506007)(4326008)(66946007)(44832011)(66476007)(2906002)(6916009)(2616005)(8676002)(1076003)(107886003)(83380400001)(26005)(41300700001)(54906003)(8936002)(36756003)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Jno1Ti9H6nnSR0umhRK4odnBHS8mKzCh1xd8BK4oMvOMqf0ZWD3ZIfNnKr6H?= =?us-ascii?Q?WeUcem40zGIZ1IlA62eMLQ/sQ0cMXXRJJvgHqv9DWPD28pasSvTTAiZhjBG5?= =?us-ascii?Q?k5n7ACQ1pnhv8zxmf+sgy6ZH2v2sEoIIdnOwNoIkohXKRsa/kzIqROk7JgRI?= =?us-ascii?Q?4m51FXLOiWU0V7xzNALDSZQEQuiVA1DQ5Wu71I2dNkmy99tFao8DRrOOLtmE?= =?us-ascii?Q?8s49QiQyJWS2mT3uXXAw4oKMfCETDXnzzL0pBFMV7muizCwCR0qd4qCIJJjW?= =?us-ascii?Q?TCBzyz7fVxHxGW/SDvfL4cDC7eNFZMf5NL38yFka4KH+KoXP/PbtielBmvNK?= =?us-ascii?Q?6U+1InI+D1Gr+NfddB4I3uDW9BvEm+tVz5TyI3YkAH2n57Yp/yG5YDIiepgO?= =?us-ascii?Q?yleu2BZGDttoN51CosiLvQRLKRTZ4J8FS4JDAM0VwLfmIrZpnHWkBticKPip?= =?us-ascii?Q?HNZoSQz7SeibgXa9sGxFDvPHIAaIZ02MzZI9S54tzIpJADEH+JeJTnNYYnot?= =?us-ascii?Q?vqgJx9D/QovpM7d/zf0O9yGXX2M0LMQTVynXMeTJHVfR/e3geOqABAVEQk/S?= =?us-ascii?Q?j24KZzZLkln6EI1eOBpvXimhbr7nrQ+nqOdT44xpxud9pg8ffvQBT6XJIyXy?= =?us-ascii?Q?hGFbRk//eKJw5+/dLqEuVAfut6HRPubaBDt0llpMD0zMcGtVzaumiMNDn2YR?= =?us-ascii?Q?hcdFpLMBwuOvL+3g3kYG7adjUFq5us1DR6CCgIzhkKOsZ4+rFSkRYmtXBdfA?= =?us-ascii?Q?1pE5Xv5i2TcgXnkDh0Cv20OfaNrd4KXciroALdbY84rmOZYcIyxY0+7ocdyV?= =?us-ascii?Q?IjCU7OTkyyblCmS8F4vA7SmeG4lz6f/+yx1oNj1+x6gW7SALpnzOooH3XTRI?= =?us-ascii?Q?KgWWAj7+cZC2PMti2JKWOmBxz1E8UPGeNSWYMejHVwc8+/24AhHq7Lf+poAi?= =?us-ascii?Q?7KMGfSY4aw4lnWxB55QXwwK8s30krLFtTJahPkPKgKpjcDPN7s5907we8HOW?= =?us-ascii?Q?CnH18CM+yf0BKAnBquvi/TEMHyXMG8z0oc8nVsEO+YmdnKeCEzDrTrraNNpS?= =?us-ascii?Q?zaaE7FJt215Ylwc3tcfpqlGGE1hsvv+F6xjNOAU1iQ8x6mkR2taHL4FgYfSZ?= =?us-ascii?Q?K74M/4m9ifkE8XDuvQADTVD17Pgy6jloibfC//1d9eRBv0/jE/u5QZBK6QQ5?= =?us-ascii?Q?AHa47atjqODaLW97PSzY6djdrke0neu2PuWRmxFZosp0TtzosGfPJgq1qJts?= =?us-ascii?Q?9OwavCJBh4QAoM5323ZfLBr5JWqwUOIvGgszkNbVAVlPlnPX2JcLge/Mb6LH?= =?us-ascii?Q?aQausxIg+Ary+Tn63+JoWpdlJA4maJhiUTNZZk1hoFIqadrj+Mal77QvUaJg?= =?us-ascii?Q?ENNhP9/HYs8odbdUHohSIxmd0WxufT219gYYUUVc99jNsyEgTQF1T90bcSFH?= =?us-ascii?Q?IfseNxM+rRKMv0vgK9IIm2lAEYZL4/2VKHM0ZBxSV4sfnuW8u8suj9tIFsf1?= =?us-ascii?Q?gfdm/5zdvyqjm53jApGxE72eHXuEBqUaq9kzMsvEsnqFaj3LALTmhhdJe5YN?= =?us-ascii?Q?y59x/YNLY0sNSqJv+w5oR7o6vuVIfBckR8LK12dw4fd7AXo5u8Xwc8eyclRm?= =?us-ascii?Q?zQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47241f7b-2d8a-4b4d-1d55-08dc2a2500d3 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2024 10:42:39.8814 (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: MPfWSny/h9SrqazyMVlnTb9vyKO5wj2ZWhQ0U6og2ALF1GN4N2/5M//ROXJOWZ3/xfPoR9ES0hWYkxP37boqja0K86hizrLmqkrFrbGvCME= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5421 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: Long Wu Add a interface to check if a device is a representor. Signed-off-by: Long Wu Reviewed-by: Chaoyong He Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower_flow.c | 2 +- drivers/net/nfp/nfp_mtr.c | 2 +- drivers/net/nfp/nfp_net_common.c | 10 ++++++++-- drivers/net/nfp/nfp_net_common.h | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c index 8667f8e901..07833fdbdb 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.c +++ b/drivers/net/nfp/flower/nfp_flower_flow.c @@ -4348,7 +4348,7 @@ int nfp_flow_ops_get(struct rte_eth_dev *dev, const struct rte_flow_ops **ops) { - if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0) { + if (!nfp_net_dev_is_repr(dev)) { *ops = NULL; PMD_DRV_LOG(ERR, "Port is not a representor."); return -EINVAL; diff --git a/drivers/net/nfp/nfp_mtr.c b/drivers/net/nfp/nfp_mtr.c index 255977ec22..11da5c07ed 100644 --- a/drivers/net/nfp/nfp_mtr.c +++ b/drivers/net/nfp/nfp_mtr.c @@ -1066,7 +1066,7 @@ static const struct rte_mtr_ops nfp_mtr_ops = { int nfp_net_mtr_ops_get(struct rte_eth_dev *dev, void *arg) { - if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0) { + if (!nfp_net_dev_is_repr(dev)) { PMD_DRV_LOG(ERR, "Port is not a representor"); return -EINVAL; } diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 72c9a41b00..7a0b0c9973 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -156,6 +156,12 @@ static const uint32_t nfp_net_link_speed_nfp2rte[] = { [NFP_NET_CFG_STS_LINK_RATE_100G] = RTE_ETH_SPEED_NUM_100G, }; +bool +nfp_net_dev_is_repr(const struct rte_eth_dev *eth_dev) +{ + return ((eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0); +} + static uint16_t nfp_net_link_speed_rte2nfp(uint16_t speed) { @@ -241,7 +247,7 @@ nfp_net_get_hw(const struct rte_eth_dev *dev) { struct nfp_net_hw *hw; - if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) { + if (nfp_net_dev_is_repr(dev)) { struct nfp_flower_representor *repr; repr = dev->data->dev_private; hw = repr->app_fw_flower->pf_hw; @@ -2139,7 +2145,7 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev, hw = nfp_net_get_hw(dev); - if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) { + if (nfp_net_dev_is_repr(dev)) { snprintf(vnic_version, FW_VER_LEN, "%d.%d.%d.%d", hw->ver.extend, hw->ver.class, hw->ver.major, hw->ver.minor); diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index e374739022..1d96b0e9d1 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -307,6 +307,7 @@ int nfp_net_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa); int nfp_net_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa); +bool nfp_net_dev_is_repr(const struct rte_eth_dev *eth_dev); #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\ ((struct nfp_app_fw_nic *)app_fw_priv) -- 2.39.1