Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1058384lql; Tue, 12 Mar 2024 06:23:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVqNRek6wCpYqMTc6o0KGNKzo89GBRlMR/dOeHTvjPlFMshHyWaq41HfCoEJOZfXNy7bf+5WgPUcf3msytZBCFdFwwySFNqvwupenaMWA== X-Google-Smtp-Source: AGHT+IESXEX0179lVRYvLrZ/inyfE/avjFwAsVS6BOzdrIo59a+khV2fdfXI2iBsm1qyInTfV/Oy X-Received: by 2002:a17:902:748a:b0:1dd:7163:b58e with SMTP id h10-20020a170902748a00b001dd7163b58emr9107438pll.41.1710249832485; Tue, 12 Mar 2024 06:23:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710249832; cv=pass; d=google.com; s=arc-20160816; b=gEyg3c02qKo5XdLu/rxUSpKP93Ho7EZdTyBFpYHmqtBz0K48J2dYRGUEYbeBpl1R7Z aTSifx+wAluc9ScbRJXTqw5+TeWUtCTEbK97J+nsQVbsXgaWSQY7TwnLAPl6NAcNSuV3 3ZzLxSWRU3dYZcNns0kba2eYEraxaB3zplsAIZ+zXLRAJi0D59iNfwgv4CGfnSvVca17 RtaZ7WTo5ciciQqeWDenYIrW5+o7B1rFqlY0urQkqHewEKAR0AKQhdqaHDQ4D9irWOmK Dd/FfiZfqp8WPqh+Cfo/qrA/GgR4XxXJYpNFdCbo6q24Q8uZsLFkOzvKDXUYcMdcQuOJ Lxmw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=canlvOloh4zEnLanokN/WjQ62JpW1VdMiHVT6vaC3r4=; fh=MEMt71Pb6T2Jo5nYQfgyucE3o5M2SfAIPSLp/4yAoek=; b=aiuLMZOhv+HCcvrzKjmUqURz4cFeyJPqiGPk5TZgsce/wqE/So+NFjCFw3fA/Bktsw VYfMpk1H5yXjhWnNrROkX/hdsevqwB3YOkg/MONhv46XQDEuP7W7s20oEN7kfP2fk19X W/Cq6huAAQ54yXVd701PhlL9mkC/N/8g+j9MjBcSRC/LFyAHrtc46EJ1T/uSvuzBDaB9 eoSALEyFbaYv1ygsVU3AN+4Z3gnr7gm0RsQqWvplAQeWZzBgEUoBWcIMBEicLCRymYWe MKOEa/Y1wn+EKPeaXI82zXT4vq7NyP2S+VmMZgPZb3eTtFrWVGeCZspDqexlTLdnfWTJ B4vw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=OuydTOmX; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-100286-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100286-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q3-20020a17090311c300b001da15580d4bsi7136329plh.90.2024.03.12.06.23.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 06:23:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100286-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=OuydTOmX; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-100286-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100286-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2A2F0284528 for ; Tue, 12 Mar 2024 13:23:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03FED7B3D6; Tue, 12 Mar 2024 13:23:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="OuydTOmX" Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF8067A146 for ; Tue, 12 Mar 2024 13:22:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710249778; cv=none; b=jHLVwhhFev5QQR6m/WTnjUJ28eAJBDVWt1bVuh5016pE8avf7iRxkphaVXAIinDFHSvsZbMgaeOQ2tL6gz+r5ztieLQ9H8rZtE+/PUuxdsNdLOrIIvREuzTPUejqCWWE6qTSIpVWAyuXClUYv39r7EIl4HVBQRwXKZcLFcHDH40= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710249778; c=relaxed/simple; bh=Y46qZiPIxVqm/+2ngjD2p6sQy4AqjAerfnqGZzoaKmI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L9qnUzmWMsssmr3Rwt8YjGrlhF1aov70l/AP4SK+dmul5yP0jinu81aof9MlM8IERzC1DfGsLC3AIV3no86BosAMdwMVyq9elcMNSaeaTnxqgEmVJ2324rzADr0VPB5jvrVcltxuw1kKgain2UONJscwO5pSQ7YSzEt5Ni9rWg0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=OuydTOmX; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4132fc7dea7so9036245e9.3 for ; Tue, 12 Mar 2024 06:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1710249775; x=1710854575; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=canlvOloh4zEnLanokN/WjQ62JpW1VdMiHVT6vaC3r4=; b=OuydTOmXjAgBW/KtkDX66JejwhUpiqvW2Wa3rCu4zj77hM5SnyEy+WDp6kH3GTbxMO aKx8zqQ180glogzfE2DJ8r22Dhug1PbheI9jHzBeF6i+dZjnfsiA4uyScw4J6iGT14EH 4PoK3CvcLBxFQNNnND4EAQIFlgoYG16veJZgsQd/H1LKRs0vrt+y93NWn8MZ/RY6qQXk SaxUZfedevPu7R20/qogKIr5DZXTG6MW6q5MXj+Uz9jfnRUE/HcqfAJ1YUMF7oE7F7n1 BQoWGKc8R+/0TmQhk8zZjjpYBoI9cUf+XztTwFiPUm2o8UU1Ma263DzBaQRuvhohIH5d DGWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710249775; x=1710854575; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=canlvOloh4zEnLanokN/WjQ62JpW1VdMiHVT6vaC3r4=; b=pDiH1xqgKLqyIPpD6O2KJle+A7Ydmlmpaing0N3dEmADqPm5MDVWLFhCZeIcnX5tuF cLwJYzeIGtgLlUgcPllBeXgCfd5ChTPeDQvskgxRlWxsDRh6UHMst53Vu3Tsd5nt41k2 nPOLNHA+/waxfHo3EZz6UFNGK6hbwtB2BrN5LYtQhMTb1AFhZ/Wd7wyObciV5ev0nuMx T4q7E5IlFmIvlEG/QAsaM7ZJLGo8udog+2T408IaWu4/ejyuFrOELiNDwInRfxcHS2UY 0U/Ur4cPYo8FXt2kPor0MuqsKszIg552KIenHNapYldziRA+w4/JeIkYBYzUEBKAhrF4 OGuA== X-Forwarded-Encrypted: i=1; AJvYcCXsLBqvgzDsDZu6Atzh74h55vit8QkBrxWGahfM5Fy45UbCN7BLYF0GpJwhM2wDgHyCsWW8DMTobOUWpiluqVxMBw+o5H6pXFuPUPuP X-Gm-Message-State: AOJu0YwprIGUJubKWllIGIxeUYlS+mfDvVdmBqXeiN6ub1syGO7iSYhw 3owj2OXhB9+jVzpv/tqF3FEeyyFNyQBUx/mABfu5LwwgRtsRGh6fUD8rAVbzFZDrYzj7t6sZ0Vl Z X-Received: by 2002:a05:600c:5386:b0:413:2a5e:e41a with SMTP id hg6-20020a05600c538600b004132a5ee41amr142273wmb.16.1710249775339; Tue, 12 Mar 2024 06:22:55 -0700 (PDT) Received: from [127.0.1.1] (laubervilliers-657-1-248-155.w90-24.abo.wanadoo.fr. [90.24.137.155]) by smtp.gmail.com with ESMTPSA id r13-20020adff10d000000b0033b278cf5fesm8980167wro.102.2024.03.12.06.22.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 06:22:54 -0700 (PDT) From: Julien Panis Date: Tue, 12 Mar 2024 14:22:41 +0100 Subject: [PATCH v4 2/3] net: ethernet: ti: Add desc_infos member to struct k3_cppi_desc_pool Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240223-am65-cpsw-xdp-basic-v4-2-38361a63a48b@baylibre.com> References: <20240223-am65-cpsw-xdp-basic-v4-0-38361a63a48b@baylibre.com> In-Reply-To: <20240223-am65-cpsw-xdp-basic-v4-0-38361a63a48b@baylibre.com> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Simon Horman , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Julien Panis X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1710249771; l=3220; i=jpanis@baylibre.com; s=20230526; h=from:subject:message-id; bh=Y46qZiPIxVqm/+2ngjD2p6sQy4AqjAerfnqGZzoaKmI=; b=g1nyAYAcdeU1+dv3h4OJB8y6oIMZ3uYJvNtapYLWKSdX0MixO9UdSg1Ux9oGUZW3LIPaZ70SO 724XsCr2ir/D8zM56jb3JLtke/6IV/gwfg62/RJ8Jb7XRxjNuq+hEsu X-Developer-Key: i=jpanis@baylibre.com; a=ed25519; pk=8eSM4/xkiHWz2M1Cw1U3m2/YfPbsUdEJPCWY3Mh9ekQ= This patch introduces a member and the related accessors which can be used to store descriptor specific additional information. This member can store, for instance, an ID to differentiate a skb TX buffer type from a xdpf TX buffer type. Signed-off-by: Julien Panis --- drivers/net/ethernet/ti/k3-cppi-desc-pool.c | 24 ++++++++++++++++++++++++ drivers/net/ethernet/ti/k3-cppi-desc-pool.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/ethernet/ti/k3-cppi-desc-pool.c b/drivers/net/ethernet/ti/k3-cppi-desc-pool.c index fe8203c05731..d0c68d722ef2 100644 --- a/drivers/net/ethernet/ti/k3-cppi-desc-pool.c +++ b/drivers/net/ethernet/ti/k3-cppi-desc-pool.c @@ -22,6 +22,7 @@ struct k3_cppi_desc_pool { size_t mem_size; size_t num_desc; struct gen_pool *gen_pool; + void **desc_infos; }; void k3_cppi_desc_pool_destroy(struct k3_cppi_desc_pool *pool) @@ -72,6 +73,15 @@ k3_cppi_desc_pool_create_name(struct device *dev, size_t size, goto gen_pool_create_fail; } + pool->desc_infos = devm_kcalloc(dev, pool->num_desc, + sizeof(*pool->desc_infos), GFP_KERNEL); + if (!pool->desc_infos) { + ret = -ENOMEM; + dev_err(pool->dev, "pool descriptor infos alloc failed %d\n", ret); + kfree_const(pool_name); + goto gen_pool_desc_infos_alloc_fail; + } + pool->gen_pool->name = pool_name; pool->cpumem = dma_alloc_coherent(pool->dev, pool->mem_size, @@ -94,6 +104,8 @@ k3_cppi_desc_pool_create_name(struct device *dev, size_t size, dma_free_coherent(pool->dev, pool->mem_size, pool->cpumem, pool->dma_addr); dma_alloc_fail: + devm_kfree(pool->dev, pool->desc_infos); +gen_pool_desc_infos_alloc_fail: gen_pool_destroy(pool->gen_pool); /* frees pool->name */ gen_pool_create_fail: devm_kfree(pool->dev, pool); @@ -144,5 +156,17 @@ void *k3_cppi_desc_pool_cpuaddr(struct k3_cppi_desc_pool *pool) } EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_cpuaddr); +void k3_cppi_desc_pool_desc_info_set(struct k3_cppi_desc_pool *pool, int desc_idx, void *info) +{ + pool->desc_infos[desc_idx] = info; +} +EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_desc_info_set); + +void *k3_cppi_desc_pool_desc_info(struct k3_cppi_desc_pool *pool, int desc_idx) +{ + return pool->desc_infos[desc_idx]; +} +EXPORT_SYMBOL_GPL(k3_cppi_desc_pool_desc_info); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("TI K3 CPPI5 descriptors pool API"); diff --git a/drivers/net/ethernet/ti/k3-cppi-desc-pool.h b/drivers/net/ethernet/ti/k3-cppi-desc-pool.h index 149d5579a5e2..0076596307e7 100644 --- a/drivers/net/ethernet/ti/k3-cppi-desc-pool.h +++ b/drivers/net/ethernet/ti/k3-cppi-desc-pool.h @@ -28,5 +28,7 @@ void k3_cppi_desc_pool_free(struct k3_cppi_desc_pool *pool, void *addr); size_t k3_cppi_desc_pool_avail(struct k3_cppi_desc_pool *pool); size_t k3_cppi_desc_pool_desc_size(struct k3_cppi_desc_pool *pool); void *k3_cppi_desc_pool_cpuaddr(struct k3_cppi_desc_pool *pool); +void k3_cppi_desc_pool_desc_info_set(struct k3_cppi_desc_pool *pool, int desc_idx, void *info); +void *k3_cppi_desc_pool_desc_info(struct k3_cppi_desc_pool *pool, int desc_idx); #endif /* K3_CPPI_DESC_POOL_H_ */ -- 2.37.3