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 F2B2F45A34; Thu, 26 Sep 2024 09:16:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E8594025D; Thu, 26 Sep 2024 09:16:47 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2117.outbound.protection.outlook.com [40.107.212.117]) by mails.dpdk.org (Postfix) with ESMTP id 2D9EA400EF for ; Thu, 26 Sep 2024 09:16:46 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ilk6rxjDMk9hla5yupgwEkcV+DF9NAWda+BsBAzSbBm2wXnd+jn2bMQj2V04lcVBzBOsSzo6jKxIXAk8oJ3TikwPWYbj9J4lJMfnX729LdAjX+WqXHq3nh755VXotUT5R/Tjr9T90u1qxh7S2OeFwWGTnDK6QF0bA0l0KRfg65ykuxpQwnT97j5E6q5agcFXm5d7YTxgGf8qPjVAioLQ0RLRPxgqHgwYU/iSBnZHi/3LVrtpKMWb80ueiVszlzRMXWzmEjhPO0nZUAlKov50xTQ1fBKA31md3RUL/32U9/d37JhGI2ynnFMe45U9jXFZ5C0rOZyb0RlXFaJBXFkauQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Py/2aiaz8MgCOEjURe63HkQT7vLLiXcUDIOcjnCFmqg=; b=vpeZMyVWEu7lKxVQK/TEpAVvVgHbvogFMZVU0C6ARGUa+eEzAXldrALHgoKnG3A5hjPDsXCpujc3na94Ie0hTC/9bxLfNvO1iJZ96+Yh7kES0CSomW0ovTTBSAVUqhLuDglCpUKKvQAN57apkI2WUu7M7aMk+H/RoMZPqGkpRRaTiDHXk8anyS43YxpfFRFsUKfIt49zzlgNfthG9f96Dcf8Qj5L25T9+Twl4WZYqn0JwuWV+YYVgvowq1XmNxuDsHhFAftu54XISBNMkEbi5uHHMo85hXldm8pqnZik0Epz1zoC9IeZy3j6WO/Xqa8PuoaE5+o7wF6xO0GGBy22bQ== 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=Py/2aiaz8MgCOEjURe63HkQT7vLLiXcUDIOcjnCFmqg=; b=mTu388I8LsbIWBEWNhZIDbwA1f/Ys4soPwG/ZcOaoOjF7sdYqCLHkPGirUCJrhwuKBRerW+vitW3ZsGUqdKRiSpHOI5EZPLaq/gK0m24qqlCRG7r+q2dPwysYCieay6eO+QF0pakNzd6Ldam/UsovfOAY4Y9+hYg5a/m7a+3wGY= 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 LV3PR13MB7200.namprd13.prod.outlook.com (2603:10b6:408:281::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.28; Thu, 26 Sep 2024 07:16:43 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%5]) with mapi id 15.20.8005.021; Thu, 26 Sep 2024 07:16:42 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He Subject: [PATCH v2] net/nfp: implement the device packet type set interface Date: Thu, 26 Sep 2024 15:16:20 +0800 Message-Id: <20240926071620.3366399-1-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: SG2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:54::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_|LV3PR13MB7200:EE_ X-MS-Office365-Filtering-Correlation-Id: 10bb6fa7-9b2f-41ba-9038-08dcddfb2bed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?EfLdPaTri2nTLNX3CyOvwfI8HAbbdeilHzixqwRNnjW86jvRW6UgqjG21+1u?= =?us-ascii?Q?UI25qIAHlbvRrmzRNMIFnrkJjXq7t4F4CJ2Zn3X47jlN6aoBFzMELyZjokK0?= =?us-ascii?Q?Xwy2W0fxl2R4EA/NuSkvCx0SALgkkMB78DGt6rcYPwyzBsQfRW7dNdHQ7oc/?= =?us-ascii?Q?zYXjXToqxijZPEFRwfkBWpY+TcbDJO6Mbc3dJKTVdy/3GBSkfFiyAUiHKZ5A?= =?us-ascii?Q?ENFeimwU+1vlgbaMmPAxWiIM/IG+st++GbXf3Y4119ZGuaMZIIQabojgBphs?= =?us-ascii?Q?JjYUf8qiTj86YjZBGu1cOsTfukYAkpQuiUmVDAGUrITxjfuipzFRVZBhHn2K?= =?us-ascii?Q?IB6KuguDvCe4YaMzfbIN1nPT8rMADV5I3JgLwUDp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ve+fwuVScb9cPLkPe/Z/PpfLVIxNvd0AR7OP4mi3puLOb?= =?us-ascii?Q?gyfBKxmbbtirsp1Yc76B4dRxGAM6jniLdG/5N31kmKzTBw=3D=3D?= 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:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?fp7GVBu25V+ct7zKI+IEw1S1OhiBhvMfjOAjrJSczTIgXnB7+eA1q7QnRc/z?= =?us-ascii?Q?GlqDNAnhPAT+JgIcC8gueLOqUBXF/AkL7V5HDH5+xBHWvR9eDe2NGydozLYs?= =?us-ascii?Q?MhVIDQrwPjm5eb/WRiE7uAR/tAF5U5uO6sOrrARZxwLHStAbDFDs1O0BO6ys?= =?us-ascii?Q?mwMT6wbF6ZFh3G9NqwDtec3l5xZCII+qB41i39m4shY/zZcfgHysIw1NmRRg?= =?us-ascii?Q?kZB2vCxYvCpRcmb1AeQ4XrRXCpa7WlJ2nY5k3mALZ9OytQ4L2XnnQZ0QIpTC?= =?us-ascii?Q?L+DLQYKec/vohTm53Div2wYaZT+5twwUTHqRnZp8xYFExB62fzjRMOnGCEgs?= =?us-ascii?Q?pahc13GbWJEn4XToEFbWVSeSK6+GuxfzPN+tQf1xLneFWyB763zY7vp1nCHS?= =?us-ascii?Q?mJQ+r6OGTiLWElyPS+EHL9PRXMUynoP9lvqnuIAAPuJW/35Y4KIJsk34zMEh?= =?us-ascii?Q?WE2Om9M4QEXl1/EH6x93KOBlz5Mll9fWeyhQ/uyjy3SnHsfN1j1NSiTCBA3M?= =?us-ascii?Q?MI/VDKjOOyRfYdBFnkBt3s+v4JTgkeRcw9NQq82JVVKq8D0TQN0XIxB4N+Ou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4612ee0bG5EXjj84NRpcSml+023UtT+tlO?= =?us-ascii?Q?bXdmjZUCzy9guOpIWMDJfzQgC6P9i5ZfJBVZWFEuqJrlElFo+Pg8XYKTwlrK?= =?us-ascii?Q?jRrXNJsliZDjoogtiLgwGJPDfvuuZDL8w4NL0EQwwConJFEvK5SAMmF/Um9Z?= =?us-ascii?Q?LQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10bb6fa7-9b2f-41ba-9038-08dcddfb2bed X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 07:16:42.6019 (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: f/LhoKP1NqZQPRlHEHf8z9zQK1XWH69WZBsX8t9xvuDUdSC4SG+fWuHgKd9JPanctX0wFkX7W4JZzMYsRWhlt09zEseVqmis33rlY38P0oQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR13MB7200 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 Reviewed-by: Chaoyong He --- V2: * Following the advice from reviewer, abandon the modification of RTE layer. --- drivers/net/nfp/nfp_ethdev.c | 1 + drivers/net/nfp/nfp_net_common.c | 42 +++++++++++++++++++++++++++++++- drivers/net/nfp/nfp_net_common.h | 1 + 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index bd35df2dc9..09c15eedac 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -932,6 +932,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 3d916cd147..0b71d55366 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -1459,13 +1459,53 @@ 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) +{ + int ret; + uint32_t update; + uint32_t ctrl_ext; + struct nfp_hw *hw; + struct nfp_net_hw *net_hw; + + net_hw = dev->data->dev_private; + hw = &net_hw->super; + + if ((hw->cap_ext & NFP_NET_CFG_CTRL_PKT_TYPE) == 0) + return -ENOTSUP; + + ctrl_ext = hw->ctrl_ext; + if (ptype_mask == 0) { + if ((ctrl_ext & NFP_NET_CFG_CTRL_PKT_TYPE) == 0) + return 0; + + ctrl_ext &= ~NFP_NET_CFG_CTRL_PKT_TYPE; + } else { + if ((ctrl_ext & NFP_NET_CFG_CTRL_PKT_TYPE) != 0) + return 0; + + ctrl_ext |= NFP_NET_CFG_CTRL_PKT_TYPE; + } + + update = NFP_NET_CFG_UPDATE_GEN; + + ret = nfp_ext_reconfig(hw, ctrl_ext, update); + if (ret != 0) + return ret; + + hw->ctrl_ext = ctrl_ext; + + 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 bebb754ced..3c4d305b01 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -315,6 +315,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