Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp72181rdb; Wed, 1 Nov 2023 17:38:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGK0+CA+YD8s6ZvLixEo50BD3lv8Pd77BfLrIQdY1M1pAMWIubZfnyFoe3esCF2stmUkoWs X-Received: by 2002:a17:90b:3592:b0:27c:ed8e:1840 with SMTP id mm18-20020a17090b359200b0027ced8e1840mr13299536pjb.10.1698885495963; Wed, 01 Nov 2023 17:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698885495; cv=none; d=google.com; s=arc-20160816; b=05n0DoSWCBq46BrJUJOlQvkJogUhIzezPR9EwYJG7+fvvzfBPviGpGeQVqcnsqQoHZ ZeC+TUBX9PuZSLdNpRt+JOIP2cRpYhIVjCECk9xq8lic3aj1XEn13CCyHNFi7a8Xq/zF H7XVOI82ss+8JuE0pbaodk9B13hED+qAFRA2TVah+UV2cfU4DybMaDGbcxU0BX/QM9GX DXpdZ9N+Q8fW2MCDBUNOpjmFOzMx8NgZZ11kltVBK4q1DsTrOls6dKlPk6wleLI1PN1e ox1Nt/7xJoyTGZrz6JySDVqkoVaw4UmqQ1e0NP9dDnI1WlNAbS8kZ3jplTCP1OZrwwuq 3+AA== 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=+V3C17W+NUJRqaDBjl23ZCi2Matx5/XILyFgz0Y7j34=; fh=90uMuZVyQ7hejxtwG5D9j2q9sE+xUjJ735Oyi9x+ZWo=; b=kWs6P+YE8TPa65GUaJCXCbuCUoDy+MbkRPDUP/u280t9897UJUjXBgCcEwsgcdCByX xqCIV2+gvL+xc9WRqHK6YUK3CRj0Xrv7P5AWx97WqqIX3CVG6PzAqRZBZsx25o5vuszi 3doBmyuN3V5AcpmeMliJ4PLgUkRkaZmiRxCuYUdBGH72mGt/lD9wwihsou9VoOIgmSQI aHQ6HixR5ssXXGkG4Pk/a4SlNUVI03doD4N9O5mt6UopcLPoDfaT9ZtGPTAMcp0ask8F WWSTzk5AZPpyrckDXSIcXO7Al69ZL1CqEVgmJsYXDWI6CNa7/0x96ifYEp0cZOOd2lFy sIEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Pd15eFvk; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:8 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. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id n35-20020a17090a2ca600b002800b3ccd42si1819018pjd.164.2023.11.01.17.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 17:38:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Pd15eFvk; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:8 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 0343E8106F5A; Wed, 1 Nov 2023 17:38:11 -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 S234468AbjKBAiK (ORCPT + 99 others); Wed, 1 Nov 2023 20:38:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231511AbjKBAiJ (ORCPT ); Wed, 1 Nov 2023 20:38:09 -0400 Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 910A9E8 for ; Wed, 1 Nov 2023 17:38:03 -0700 (PDT) Message-ID: <5bd504bb-6d0b-0a6c-0c12-37174ff22a2e@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1698885482; 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=+V3C17W+NUJRqaDBjl23ZCi2Matx5/XILyFgz0Y7j34=; b=Pd15eFvkGfkcFcFakNa21xg/MqsDjv5OM5YwT/t3/41aBS8JGw4nRqRN7+m0x4tj2Hifmu mKQ/6hiRTS5PLEW1FWlFXwKlmO2mkwOf/cF050H35x1Q5coHZvMrgQ4iZVju62cMIJDIot Uv9xfjVAUAlbaEhQBlIdD2HOr7t8yqg= Date: Thu, 2 Nov 2023 00:38:00 +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 Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, linux-crypto@vger.kernel.org, Jakub Kicinski , Andrii Nakryiko , Alexei Starovoitov , Mykola Lysenko , Vadim Fedorenko 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]); Wed, 01 Nov 2023 17:38:11 -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. > Yeah, but they are in the same module. We do not declare prototypes of kfuncs in linux/bpf.h and that's why we cannot use them outside of helpers.c. The same problem was with bpf_dynptr_is_rdonly() I believe. >> create __bpf_dynptr_slice() which will be internal part of bpf_kfunc? > > > > > >