From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail.toke.dk; spf=pass (mailfrom) smtp.mailfrom=linux.dev (client-ip=91.218.175.219; helo=out-219.mta0.migadu.com; envelope-from=martin.lau@linux.dev; receiver=) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=bH0L/MpM Received: from out-219.mta0.migadu.com (out-219.mta0.migadu.com [91.218.175.219]) by mail.toke.dk (Postfix) with ESMTPS id 85D569D9C8B for ; Fri, 6 Jan 2023 01:41:10 +0100 (CET) Message-ID: <2795feb1-c968-b588-6a4c-9716afd8ecf2@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1672965668; 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=DCetod+Tkx15F+pJNS7nDOL6jC7i12c59IQP74mv1y8=; b=bH0L/MpMn3CAiFR3YXI5WE1p6Qw/YBZ+u292mSee+KGlGY95rXzkmV8d4LnlX5uYrTFZfp KS+gDpXsC7zZ1sI+g25hsAf9ZK+neXtsfeUKzj9PkYP+czxnmpHTvzp0B+X6v1pLAODzMr z7ZTdgtuQemQmODuNr8Hhd0r3TxI9vI= Date: Thu, 5 Jan 2023 16:41:01 -0800 MIME-Version: 1.0 Content-Language: en-US To: Stanislav Fomichev References: <20230104215949.529093-1-sdf@google.com> <20230104215949.529093-6-sdf@google.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <20230104215949.529093-6-sdf@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Message-ID-Hash: OWK344MIMJOHMMYJ7ESGFSVGGTSU36IJ X-Message-ID-Hash: OWK344MIMJOHMMYJ7ESGFSVGGTSU36IJ X-MailFrom: martin.lau@linux.dev 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 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. > - 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; >