From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by mail.toke.dk (Postfix) with ESMTPS id 0371E9DA234 for ; Fri, 6 Jan 2023 18:17:36 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=nxhl4YlR Received: by mail-pj1-x1030.google.com with SMTP id q64so2081197pjq.4 for ; Fri, 06 Jan 2023 09:17:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+BszObA54pUrS6LbjCGZnkDETNcwahguKQU7tKjQAnc=; b=nxhl4YlRNgXEL6DzvFH0wf5sH3oKGJZwZW5j+mDfxIXt/jrXR/AvYhsm/DTbSwyH2M GlVyjfa8U81CTQwoVMfXXM2deCySN+LnBLXtMlTopy7jvlxMkgRJdUOzny0vjF5Gu80u UUJNnnceo33J2VG8PCW6A2hog6DTu34bTcfJ362Y/YfH9TSEa6TT8vTobx9p8UFTYMjh CAbsws84tyQQ/RS6kIbTZLWTsPGP8aZDfVZj2Eij1KZRa5N4wrs13BPG099tAQeFfZ9H 3vAP33Fl5lpJx7ZS93miXyFDImJjBrdnJ9Zk3Ifn8nxSvSa2NBoZa6RbD16lNXnZPT7V /3nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=+BszObA54pUrS6LbjCGZnkDETNcwahguKQU7tKjQAnc=; b=2dcDnlCdsjnk9+MFaZx+bWaJgqKDobrYl5gGOMeJxXLq+xM1rWCCiWj1tCK4TxztPm lyAMfBssxqvl/3dLnmSfu1uS2rys8ou4uAPLxHHIIwU2eOjqz4wcVFvHIQY7xnYmwnbd IRCRh6sq07xlKzLbu3Gc1cpZkEIAkq1A1i6592PGc7V4kWltz+r/KR6dWq5/SyOKUbv1 UkP5++u5gDY2XJnP9o03Rabgo8ZDSdp6/knrj+ZSP5daL7BRFTbTvWqX/C5icB5dfNCz H6kaKOaFAr+GFbx4+BeZwErJFaXIZOW8Xo00/BiuWcDfHBcjvfOzA3CKtb7xEQiiRi1n NEqA== X-Gm-Message-State: AFqh2ko0O/Lqt2KGaqkQ4oDy1hSQwWrGFpzc79kZMxDVcZb9+XzdR7P6 4Hu5JqNykvPA9VwR5d/VMa5hS7Hz263tVeh2xIbdWA== X-Google-Smtp-Source: AMrXdXsHeN7kO1opdugoqFTEsv0uWWRotDtg2lt7BlV0dLV+THh3uWF07Tz6TyKnsVTE2MPc28OY8yjdWAMHnomHBKM= X-Received: by 2002:a17:90a:8b92:b0:218:9107:381b with SMTP id z18-20020a17090a8b9200b002189107381bmr4368808pjn.75.1673025454798; Fri, 06 Jan 2023 09:17:34 -0800 (PST) MIME-Version: 1.0 References: <20230104215949.529093-1-sdf@google.com> <20230104215949.529093-6-sdf@google.com> <2795feb1-c968-b588-6a4c-9716afd8ecf2@linux.dev> In-Reply-To: <2795feb1-c968-b588-6a4c-9716afd8ecf2@linux.dev> From: Stanislav Fomichev Date: Fri, 6 Jan 2023 09:17:23 -0800 Message-ID: To: Martin KaFai Lau Content-Type: text/plain; charset="UTF-8" Message-ID-Hash: 2YPYGC46IC3PLWGV73TXUQDMMMRZW4E4 X-Message-ID-Hash: 2YPYGC46IC3PLWGV73TXUQDMMMRZW4E4 X-MailFrom: sdf@google.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org, bpf@vger.kernel.org X-Mailman-Version: 3.3.7 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v6 05/17] bpf: Introduce device-bound XDP programs List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, Jan 5, 2023 at 4:41 PM Martin KaFai Lau wrote: > > On 1/4/23 1:59 PM, Stanislav Fomichev wrote: > > @@ -199,12 +197,12 @@ int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr) > > attr->prog_type != BPF_PROG_TYPE_XDP) > > return -EINVAL; > > > > - if (attr->prog_flags) > > + if (attr->prog_flags & ~BPF_F_XDP_DEV_BOUND_ONLY) > > return -EINVAL; > > > > - offload = kzalloc(sizeof(*offload), GFP_USER); > > The kzalloc is still needed. Although a latter patch added it bad, it is better > not to miss it in the first place. Oh, good catch, probably lost during reshuffling some changes around, will undo. > > - if (!offload) > > - return -ENOMEM; > > + if (attr->prog_type == BPF_PROG_TYPE_SCHED_CLS && > > + attr->prog_flags & BPF_F_XDP_DEV_BOUND_ONLY) > > + return -EINVAL; > > > > offload->prog = prog; > > >