Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp388113rdb; Thu, 2 Nov 2023 06:44:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGo2N5WkaXND08tRobbH5aW/l/xP53tdpSfBiKwSphYa5gp4Y6P6dxVXMQrUYksoQ8CskuI X-Received: by 2002:a05:6358:6f82:b0:168:e637:a819 with SMTP id s2-20020a0563586f8200b00168e637a819mr22832003rwn.12.1698932685176; Thu, 02 Nov 2023 06:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698932685; cv=none; d=google.com; s=arc-20160816; b=BaYSGEl+VbuVfZaKsxjdW3vBFLqF6su0ZqKTQwjSRzMYZBDHcrT2Hqj/h+LOh/I9y2 gqdXj/U49vXD6Vetu2W0DzejopTQ9B9o64t7q56DzmswbYu6e9EthXUHTBMU79p10ISq JSYgsd753B+BiXcYPDdrKPfJwAol98tC/W8OsIVgF9Md00/MnsAmCqO1D6/jbB9cC9Ze uM478s7OqfTdkf4H79ou8GVb1XT3ggmUHA0rYF2Sk0cTjMUNwFCXKZFdn3IRajvRuUqY Ap7pKd46RwosVpwki2MUVNR1X4ZejEhg3KBVNFq/d7BDdSqJ7s5jDYHk2G859QDnAiPu W5eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=DTwsvEmzpAhkFeS3ka+z/7oD+5A+b+o8OiW8/532NK8=; fh=DfxcZpYKmU5l6YY+o3WMxrTZ/cR/tHs2zW33B/UMi5M=; b=v4JhONh8HGkl4Trx9RZ/p5Y5dsKbXdi74Ga1jwR9SBlzADGxMCx6spXPO6vcTPFQGv GolEZVQ3mqIn/8w1NChct+rPOpnGRzViMBRCYh5Zxf2mPthtg3H8/bEf+2+GPoYzM79u 7cxsZGZXcK71TcX1VEnnt0ryONVQUtYOx623lSdzv9MCw0pZGiNJm/qw+svO4sGtfHi7 xq8F8ZTR7dHPvzrBi5zsOLB/6oE7nYlmh/JdMu5y3EEUc5IK+lqEghG2i1FnC+9uHJb6 zS0os/bQUgKbN6gFP6UhVWCBfy131eCMeegcZWUnJ1IekJ0W3nIrTqV0RqI2ebCpyZRI C02Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mmRYxBfT; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id r6-20020a632b06000000b0058986c61bb6si1888108pgr.706.2023.11.02.06.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 06:44:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mmRYxBfT; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 638BF806E54E; Thu, 2 Nov 2023 06:44:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234971AbjKBNoi (ORCPT + 99 others); Thu, 2 Nov 2023 09:44:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229822AbjKBNoh (ORCPT ); Thu, 2 Nov 2023 09:44:37 -0400 X-Greylist: delayed 164772 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 02 Nov 2023 06:44:31 PDT Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54AF8A6; Thu, 2 Nov 2023 06:44:31 -0700 (PDT) Message-ID: <4258aabd-5f7b-4b7f-ab43-408b69bfdc58@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1698932669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DTwsvEmzpAhkFeS3ka+z/7oD+5A+b+o8OiW8/532NK8=; b=mmRYxBfTPMqUnOevJs2i2n/PQ2FSWXnoLZCAPkqb9GifUye+mw9JQnOpVepQ2pc1PZJpMG pfhMcilABjbX0HwQ7maZZoGrTWGQ9YvLfCD3LyflGCjlJ9/KoqG8XeBAwUs1f8xh16zQzf z3x7MMzpz6wTy02+tXcoku2JycRmiek= Date: Thu, 2 Nov 2023 13:44:24 +0000 MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v3 1/2] bpf: add skcipher API support to TC/XDP programs Content-Language: en-US To: Martin KaFai Lau , Song Liu Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, linux-crypto@vger.kernel.org, Jakub Kicinski , Andrii Nakryiko , Alexei Starovoitov , Mykola Lysenko , Vadim Fedorenko , "David S. Miller" , Herbert Xu References: <20231031134900.1432945-1-vadfed@meta.com> <91a6d5a7-7b18-48a2-9a74-7c00509467f8@linux.dev> <6947046d-27e3-90ee-3419-0b480af0abb0@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Vadim Fedorenko In-Reply-To: <6947046d-27e3-90ee-3419-0b480af0abb0@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 02 Nov 2023 06:44:37 -0700 (PDT) On 01/11/2023 23:41, Martin KaFai Lau wrote: > On 11/1/23 3:50 PM, Vadim Fedorenko wrote: >>>> +static void *__bpf_dynptr_data_ptr(const struct bpf_dynptr_kern *ptr) >>>> +{ >>>> +    enum bpf_dynptr_type type; >>>> + >>>> +    if (!ptr->data) >>>> +        return NULL; >>>> + >>>> +    type = bpf_dynptr_get_type(ptr); >>>> + >>>> +    switch (type) { >>>> +    case BPF_DYNPTR_TYPE_LOCAL: >>>> +    case BPF_DYNPTR_TYPE_RINGBUF: >>>> +        return ptr->data + ptr->offset; >>>> +    case BPF_DYNPTR_TYPE_SKB: >>>> +        return skb_pointer_if_linear(ptr->data, ptr->offset, >>>> __bpf_dynptr_size(ptr)); >>>> +    case BPF_DYNPTR_TYPE_XDP: >>>> +    { >>>> +        void *xdp_ptr = bpf_xdp_pointer(ptr->data, ptr->offset, >>>> __bpf_dynptr_size(ptr)); >>> >>> I suspect what it is doing here (for skb and xdp in particular) is >>> very similar to bpf_dynptr_slice. Please check if >>> bpf_dynptr_slice(ptr, 0, NULL, sz) will work. >>> >> >> Well, yes, it's simplified version of bpf_dynptr_slice. The problem is >> that bpf_dynptr_slice bpf_kfunc which cannot be used in another >> bpf_kfunc. Should I refactor the code to use it in both places? Like > > Sorry, scrolled too fast in my earlier reply :( > > I am not aware of this limitation. What error does it have? > The bpf_dynptr_slice_rdwr kfunc() is also calling the bpf_dynptr_slice() > kfunc. > >> create __bpf_dynptr_slice() which will be internal part of bpf_kfunc? Apparently Song has a patch to expose these bpf_dynptr_slice* functions ton in-kernel users. https://lore.kernel.org/bpf/20231024235551.2769174-2-song@kernel.org/ Should I wait for it to be merged before sending next version?