Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1426789rdb; Sat, 18 Nov 2023 16:33:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvi7bsREXBzQBE+O3kaNslKUC5GSoJvp6wU9XtF8O+9hVdIbnbfI02Z8q7eluETuqEFuq1 X-Received: by 2002:a05:620a:8427:b0:76f:20df:f032 with SMTP id pc39-20020a05620a842700b0076f20dff032mr3326388qkn.69.1700353988591; Sat, 18 Nov 2023 16:33:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700353988; cv=none; d=google.com; s=arc-20160816; b=RrgwHlRIR5C/cOevh/0OJmXiVlCwgv78QU50swRs3uGFPV4US6eDZQcvbFh4U9eUub NzrCp+c70LDUSM6E6Exftj/h9MYTBxD1SAXtpW6FIi/FY6BXCWcQxu5HEIDBMUT0gVOz Dopv6eb0G/v8puBvM7AtG6kAZWGfgHOLrhqEKyMgI/uNul4Gmo1Zi2CjHFC0wU7vr9EZ FFLRjfUHdB6YoeHA6+4RZ9PmECwA5Ljb+Y8fz6zDK0cDfg2zea5l9PSZOuOmu5gUly4K 1KdvzWh9KRu11oa4Y8Z8TZ9g6obLJy2nadRgZ0ezh1gDglfoI7Rh9guA90TZpGHMxKsF nn+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=NQbvG9CtYoDwTOuaZlGQ3qkEGYRr7f7M4drTshza2BU=; fh=thxoyNlPoWqZZshvgqrbiRnCqF2++zlp6OPkK9Qkx9w=; b=HnJH+nADAq9icMliKonxDj7INtCRSXK9l6WlCuEmrpUWEsSXaPXsXVwB6l8FwBLNvy LmocxrxwZvy2LZ/KcK/5P2wk5itdVYtd+pRPT6+VKac8ol3P1YREoFmP3KQmbDErRxpj r5tDdUNMKBp9iLCQQ9QJ68ZhYmZYbqQiYesMFqQ4T1lu8SmSRBU5SIryBxQs+pkCyqph jj6VSRXlkfrA1tcmEv5vVv+TcZGh6qZgdTojibsNOGTISMChZemCcpg2yUeJtksJV/f2 S/rouTZFVXWbf4SLgfKuHEQDS4UR7RzvtbhWVJOB2R7UK6eM7RhkfzvDU62Td8Kec5wt ha7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Dj0D1S2G; spf=pass (google.com: domain of linux-crypto+bounces-183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-183-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i16-20020a05620a249000b00774830a1570si4821497qkn.225.2023.11.18.16.33.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 16:33:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Dj0D1S2G; spf=pass (google.com: domain of linux-crypto+bounces-183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-183-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 46FFE1C20403 for ; Sun, 19 Nov 2023 00:33:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E4B415C9 for ; Sun, 19 Nov 2023 00:33:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Dj0D1S2G" X-Original-To: linux-crypto@vger.kernel.org Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD37EB6; Sat, 18 Nov 2023 15:23:59 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-32d9effe314so2268404f8f.3; Sat, 18 Nov 2023 15:23:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700349838; x=1700954638; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NQbvG9CtYoDwTOuaZlGQ3qkEGYRr7f7M4drTshza2BU=; b=Dj0D1S2GjtZSpLQ9bWYNnIElHqA5BJ8Vm7W7PIa3MBbUdaO1UbcZg2QrdtMDrjfLdw 0PDT9LxQmEL2BxzdfGZhzivdclziQhnKyqnec4+DZvPpaDPealm/HKtO8gc8gtRFFw74 alF2++AuG2g7flf5kjafNCS20yfZghYm6lfBpVP19Hi7u72F/2mibaYP1v5slwpQULke vnMnFclu5Ee0V2G5h32y5lEmx7MVdF8/o55Hue0MjPWqWvD+ZpblZKgz/PGKLJxH8Jy2 x/1OmOSqc1vd0xUlDxymEAdTiKmwL4xDAp9iQ4eGgrKPyiVg1Fwgxp9kPpwV+Rz3sDAp OCvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700349838; x=1700954638; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NQbvG9CtYoDwTOuaZlGQ3qkEGYRr7f7M4drTshza2BU=; b=FA4E/ysjeB2Hy6qv/Eaz60Uf0+ASMbBrkHzAfOBPS4jWu3c7JAySceoFaarZuNoudS BmeIPzvx5GYyBLEcD/LeMWiSQO1OEHLFh4kJLx+Y4rcAKxwg/wxCxTQEry2fVoEmdLwI F0JSSIKCSbQnaW6g0dwfy2aV3HCCk5imN8hpe+VTlq91rSDRmpENdKob0pZF75TqsvDy 6TH1k2Fp0AoJeBzj3ox8hJBmZlWoiE1jfm3Slm+vRYOK1wvrYol5Ne4+PqtkMn3tM2gS ed2RqlUy5M03fC8kZNWNCmp3bU9FjgRBOBZOUitZF/cNWqGs4JZEoFky3mnbD437vgjs j9Sw== X-Gm-Message-State: AOJu0YyYqV6LtXf17dvMmyIq+zrdjSmUJ2ZFJxR9R/LuvpR3lGxzI1G6 Yw+7gRUHe/jfXZj4nWRLv/b5XzjS7JIrU+tJ4Xw= X-Received: by 2002:a5d:6052:0:b0:32d:aa11:221d with SMTP id j18-20020a5d6052000000b0032daa11221dmr2285193wrt.27.1700349837560; Sat, 18 Nov 2023 15:23:57 -0800 (PST) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231118225451.2132137-1-vadfed@meta.com> In-Reply-To: <20231118225451.2132137-1-vadfed@meta.com> From: Alexei Starovoitov Date: Sat, 18 Nov 2023 15:23:46 -0800 Message-ID: Subject: Re: [PATCH bpf-next v5 1/2] bpf: add skcipher API support to TC/XDP programs To: Vadim Fedorenko Cc: Vadim Fedorenko , Jakub Kicinski , Martin KaFai Lau , Andrii Nakryiko , Alexei Starovoitov , Mykola Lysenko , Herbert Xu , Network Development , Linux Crypto Mailing List , bpf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Nov 18, 2023 at 2:55=E2=80=AFPM Vadim Fedorenko w= rote: > > +/** > + * struct bpf_crypto_lskcipher_ctx - refcounted BPF sync skcipher contex= t structure > + * @tfm: The pointer to crypto_sync_skcipher struct. > + * @rcu: The RCU head used to free the crypto context with RCU saf= ety. > + * @usage: Object reference counter. When the refcount goes to 0, th= e > + * memory is released back to the BPF allocator, which provi= des > + * RCU safety. > + */ > +struct bpf_crypto_lskcipher_ctx { > + struct crypto_lskcipher *tfm; > + struct rcu_head rcu; > + refcount_t usage; > +}; > + > +__bpf_kfunc_start_defs(); > + > +/** > + * bpf_crypto_lskcipher_ctx_create() - Create a mutable BPF crypto conte= xt. Let's drop 'lskcipher' from the kfunc names and ctx struct. bpf users don't need to know the internal implementation details. bpf_crypto_encrypt/decrypt() is clear enough.