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 A6E2B45459; Wed, 19 Jun 2024 12:12:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4328F42E53; Wed, 19 Jun 2024 12:11:58 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2093.outbound.protection.outlook.com [40.107.236.93]) by mails.dpdk.org (Postfix) with ESMTP id 8566142DC9 for ; Wed, 19 Jun 2024 12:11:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kc0qCyXzpXAdHlHfim9sbwpVlrnNJVtOtdLMmFHNVQALwqz0OCcZNVmZlDP7HXsBVXLNSVNZQPMUvdivCMXL1FU0zEPpSxdb7ezPZvevRg9ABotwx+5818bIUUa9UlMEkMnKDsLu76JYV5w7MAj9rRNoyrRz6BrvF2vFuFmHqEP8Hrom0m0CnH5jf21+Q0vMQIrrVS5o7JpKsQMb1fGrBeRBCjGE7BiY/uB5IXa0KPnP7xdDH2jjXGBRol5gRDdlrT9wxiYiM8O471jbXWD4zXD2OKra+p5fL8W+iHuW8ekoMfplC0PCp3cQF7LF0NQd5ucXCpCPCW+p3sI1l37LmQ== 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=biPg49MWpw808yVtRnxAkdFeHXzcnQC2pVdZxLXsYTI=; b=N0zAV/Z9p4PX5pBPMpYt8bkBlsn6ze5uHY6FAqQGL95u/Gxi22P0lgxRQN1EDPUFncdgc/Ng61wrna5R62cFkpfyi7Dlx9Ls/s37jf2egXz9eGCnPAzcz/HMQH9VTaKVzf8UOSGk9NeMEeXpHhOIk9XbIRM32cV2akyOW71+h/X+LdCVY42h2fs7PFwhw+mwOYq5rafefiQl1Fyn3cxN97qewIyJyir8Vf/sjmTzHWKKofy63o1+94GD49xhb3y+XiHYZ6NfmBqGDd8eZGCTdMauUY+uH1LhqWADTAeY0SlTEt7VlBH1hMbxKKVXWAULTJYaT8Si3ntCat7biAConQ== 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=biPg49MWpw808yVtRnxAkdFeHXzcnQC2pVdZxLXsYTI=; b=ERHhftJNXkgif/QPp91QzYddZZXehCgg/rjDrfw9b79tegKBd+67TWxlm+ncwV++INeg559l3b+PwvSEyP1zqwf/jjqYvcOb6jQLz7lGZBGrHL+BPDzjYdAGOaDK5diJz31MEfzIIRB1vbntYlzH2gR4dzgFP6Oyal2Awbo0PvE= 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 MWHPR13MB7153.namprd13.prod.outlook.com (2603:10b6:303:283::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.19; Wed, 19 Jun 2024 10:11:54 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7677.030; Wed, 19 Jun 2024 10:11:54 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu Subject: [PATCH 2/2] net/nfp: implement the device packet type set interface Date: Wed, 19 Jun 2024 18:11:34 +0800 Message-Id: <20240619101134.3480274-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240619101134.3480274-1-chaoyong.he@corigine.com> References: <20240619101134.3480274-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BY3PR05CA0038.namprd05.prod.outlook.com (2603:10b6:a03:39b::13) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MWHPR13MB7153:EE_ X-MS-Office365-Filtering-Correlation-Id: 06659aee-6b1c-4faf-9617-08dc90483e83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|52116011|376011|1800799021|366013|38350700011; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?+HkAVy497xYVbVolwINaw1VUnREuguox8G3h9Lxs/5bVIFhiXFqJmzhmRNDo?= =?us-ascii?Q?/3OtOBv94iHqP/zDeYjESKTq9oomZEn+YEIRQ9KA/fY8gNOQroU3lECUi3M6?= =?us-ascii?Q?8cD3ULIC6r17Su8aDDxUWQ7vAYsJUHVGvv0X9Z8hBOWBYLgs9fGlxRGPBsoc?= =?us-ascii?Q?cVWjJkjLcVPdIMorIORZmK6kl9pOJVHYStuNdQyUVWeLt/gE2HUaYnJTn8PH?= =?us-ascii?Q?jEfzEaPlELp2ISdB5pW7xjn2+MnQiEI/VuXATPfl+r6nwjC/sdeqpkutaWKY?= =?us-ascii?Q?gNUFD5v5oiGH5JgdZDdI1PhgxsLZBkepDG4K2wtr0leskATnVQoWU4yELyhF?= =?us-ascii?Q?Gnf5sAJlbspuGwxogX3t2HiT5/QvHoPgEgxWBMQ3+08QH5JmQa2yTSyZG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IfDeyKIT1D4qcWGatu4KQVjAmWiKnkWI+WSqh6?= =?us-ascii?Q?yJiI6DGzL+8sL1hYrWgz7FL2N1yJmm/wdRBJ8HAfJCGKOi7ay6/NihUmFwg7?= =?us-ascii?Q?7rrZIQA=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(52116011)(376011)(1800799021)(366013)(38350700011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?QLEXcmLm4diKNa59GdZbMIDQUBJqdQB77WMH3oHtlI4QTMy1Gc4bfrAj7T+T?= =?us-ascii?Q?L85XoIM9Wre8PgRGHbbcmVDAWZc3P4Ln/ziW6vV8KJ/6JuuKYAh43dMoE8pW?= =?us-ascii?Q?b58ha6XJy2JeXmepaBCpbH7iuLdFK77dACk6HXDWevT1L3oDvIzgLHOyBSJF?= =?us-ascii?Q?zz8turetdLTf4pOe6pldJD9u+EBwwok4fixv5esU9z8YDtqHy3EuF2k9AfDp?= =?us-ascii?Q?iAUpTYypWXYvB5SDnG5hGjDuO2mEOoHLtIzeeYNo7JQLF9u9/tJfOUwN2z7L?= =?us-ascii?Q?7VGIOYg4PseD++YWzBL6QeDNaR8zaOwr9yQgOK3ubJHtEt+686s638O9geZI?= =?us-ascii?Q?i4tGz1i/XGj660MTO+Rxgop9YYcC8zIWJBlKW/frOMFZ/BhiDJP8LEUlfZtQ?= =?us-ascii?Q?3yMtQkiD9stxUBfcWg41cc6gsgDvqC8KVgAf4lPGOw6TDxBFpnad9jDRs/2O?= =?us-ascii?Q?pdV1ZczFsrYOlH7mdExcDcb1sq4ng33NU+rj+cTkoXY6RpZq8okELZ+sd7vC?= =?us-ascii?Q?Q2BWyzQa1rUmM5Qj3L3CL1hww/D1Z66L6LFytB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ascii?Q?rwJlxRljOrtwMIL+ietpDABa/jyrgFTib6CBXaIVNPNUBrWReckLLfArcEYZ?= =?us-ascii?Q?wqcWBggG0Qmj20mCkEVulmkOHDeIROWygthPD1oMn4DKtqeuRsuoEpV4dj9+?= =?us-ascii?Q?LQ1Uw8Tm3z9bXgltYtkmYuQyHdMh3fiAKWsLKu8jNzySlZCM0mNGdH7f5vvX?= =?us-ascii?Q?jw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06659aee-6b1c-4faf-9617-08dc90483e83 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 10:11:54.3156 (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: JP3qbTA5AqMaW6gJ1G/RX2vARkxxm9kGgjsu0frDXUGhoUYNyZ2CJs70Zqa93G4VjYw9zchk0s+vqrXQPaBR4Pf3kuyaOJQdqqyY/ahHyqo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR13MB7153 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 Using the Rx packet offload flag rather than the device capability to control the packet type offload configuration. Also implement the device packet type set interface to let application can set the Rx packet offload flag. Signed-off-by: Long Wu --- drivers/net/nfp/nfp_ethdev.c | 7 +++++-- drivers/net/nfp/nfp_net_common.c | 26 +++++++++++++++++++++++++- drivers/net/nfp/nfp_net_common.h | 1 + 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 9867db9729..b04bc955b5 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -414,8 +414,10 @@ nfp_net_start(struct rte_eth_dev *dev) /* Enable packet type offload by extend ctrl word1. */ cap_extend = hw->cap_ext; - if ((cap_extend & NFP_NET_CFG_CTRL_PKT_TYPE) != 0) - ctrl_extend = NFP_NET_CFG_CTRL_PKT_TYPE; + if ((rxmode->offloads & RTE_ETH_RX_OFFLOAD_PTYPES) != 0) { + if ((cap_extend & NFP_NET_CFG_CTRL_PKT_TYPE) != 0) + ctrl_extend = NFP_NET_CFG_CTRL_PKT_TYPE; + } if ((rxmode->offloads & RTE_ETH_RX_OFFLOAD_SECURITY) != 0 || (txmode->offloads & RTE_ETH_TX_OFFLOAD_SECURITY) != 0) { @@ -884,6 +886,7 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = { .xstats_get_names_by_id = nfp_net_xstats_get_names_by_id, .dev_infos_get = nfp_net_infos_get, .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, + .dev_ptypes_set = nfp_net_ptypes_set, .mtu_set = nfp_net_dev_mtu_set, .mac_addr_set = nfp_net_set_mac_addr, .vlan_offload_set = nfp_net_vlan_offload_set, diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index f8566d94d7..5616160686 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -1326,6 +1326,9 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_SECURITY; } + if ((cap_extend & NFP_NET_CFG_CTRL_PKT_TYPE) != 0) + dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_PTYPES; + dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { .pthresh = DEFAULT_RX_PTHRESH, @@ -1461,13 +1464,34 @@ nfp_net_supported_ptypes_get(struct rte_eth_dev *dev, size_t *no_of_elements) return NULL; net_hw = dev->data->dev_private; - if ((net_hw->super.ctrl_ext & NFP_NET_CFG_CTRL_PKT_TYPE) == 0) + if ((net_hw->super.cap_ext & NFP_NET_CFG_CTRL_PKT_TYPE) == 0) return NULL; *no_of_elements = RTE_DIM(ptypes); return ptypes; } +int +nfp_net_ptypes_set(struct rte_eth_dev *dev, + uint32_t ptype_mask) +{ + struct rte_eth_rxmode *rxmode; + + if (dev->data->dev_started != 0) { + PMD_DRV_LOG(ERR, "Please stop port %s", dev->data->name); + return -EBUSY; + } + + rxmode = &dev->data->dev_conf.rxmode; + + if (ptype_mask == 0) + rxmode->offloads &= ~RTE_ETH_RX_OFFLOAD_PTYPES; + else + rxmode->offloads |= RTE_ETH_RX_OFFLOAD_PTYPES; + + return 0; +} + int nfp_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index b5c6152857..b43f815951 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -291,6 +291,7 @@ int nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); const uint32_t *nfp_net_supported_ptypes_get(struct rte_eth_dev *dev, size_t *no_of_elements); +int nfp_net_ptypes_set(struct rte_eth_dev *dev, uint32_t ptype_mask); int nfp_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); int nfp_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id); void nfp_net_params_setup(struct nfp_net_hw *hw); -- 2.39.1