From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8164E3B71C7 for ; Fri, 24 Jul 2026 16:39:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784911199; cv=none; b=j+Fy1qFjq6kdl9zEKQ9FIWwHqguAV1TYJmq0rvew2DLKwfzhQy5WqgofgrRIqN3TEV/4877t9KGUmkLvbHf+kbyE3YPxewtr773ZHNoSvXRrAGDrr9WrFExATQQrt2v46r7NHi6elNN2m1rL2UyDuG0TfDgGlZvZohIlRUrZf4Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784911199; c=relaxed/simple; bh=rxpQc12lsUWEKrXL6hgR5Ul4ob5uHCzCMUR1TSqQtxI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z4R57yU+NoGIojtNnHS5Us7lrl8wxDelgWJE17Y038GimW+4M/gPXqwItFFQjVBsU8MpJU4EEFdASHJQnNsHaQiePJh0JnGW+2iIZAVTKHSVUasuXO7QN9ngwoluQjijYk8fckRKnY38sO0p1HF192SpLFwQ/f2jjDK9vgIwz7A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=erjUYXfu; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="erjUYXfu" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-845c92bc464so549370b3a.2 for ; Fri, 24 Jul 2026 09:39:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784911198; x=1785515998; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=hhTRsMUDFAKZh60GY3lXmo5DTZVRrbo+NNX8ufmzfOc=; b=erjUYXfuLYe4+SuorcxzU+FMwuXss9uxmfHrCUQYWGk3zfybKZBSf/WlWldJk7FNBC tAshTeDxYSpMkZQ9oMCYrGYBYugRAZXXPjsq4MznEeiw6KuJl48JCUJza13yBdFV2Gcg eK/Fch37D9EfjOo27NBD2rOiMCPvK7PfjDZVOGMTj2Gqr3EN1/bqx4+iO1p3tK63FR9e xY2j42LNR8nmq2o/Ep769+R1StMlAES3JE0cEpIkmT4a/jCnRACQZes6nGcItlcZwowA lTmeRyt4PKxrIxUlIpBvdf+kXc2uQLlODIuLqhydzlYxWVG8RcDroarCPvAYuoq+sGhX hO3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784911198; x=1785515998; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hhTRsMUDFAKZh60GY3lXmo5DTZVRrbo+NNX8ufmzfOc=; b=Mqr5mMKk6EIWs4o6ATf8wYNrOHSA7Hh72XPgaJi3gcOK0AZ2fhYJ20/PBlQz48KISV hOxrRfOGYElolaxMmfSDS3QNT4+j9YRwI7oHf32jADES97WWWMUsCnZKVarl3FZV4nda qOeCZui95vlf0uElypPssACu5BZabpKkT9FvWlIpcoR5YoSEbxvnGg6ZnReQFAJPUXZB k90jOGbrR5xobOYdPbAyagkEJcrxh0sIAVAqb8tv9uj9mPl3ehJhktrfgB8clJyxxCP9 QXHG9J8JOkMSpvd2xgyHgyrW9pNH9UcMLQuZDbfeQuM0xNlcWAEXD+oAirE++R89es6S xkjA== X-Forwarded-Encrypted: i=1; AHgh+RoTYQ8bo5rZyOyzRS4fUwUurr0bOtRdpgjT5pk/JXTtsrGm/AvmzIrbaVAfThZcmv6Kdy1HELoIr3wrkmw=@vger.kernel.org X-Gm-Message-State: AOJu0Yw54RdgVuvNY0/AbHxDUDnLgh5kwWIIWPWq06PmYGF8L+y2YX8z YpBWVTcGYFyX32O0VmHtdyc9lCDwkSuZigwrhg/PS3A7WrUTNBE7VnrZ X-Gm-Gg: AR+sD13XggZeL0FBoSe0o9C1jIFqvWYedq010oeqq2mhKd2Yj/A+h7gjfSfTDMRicDR 9ZLZohhw/cM2T8sa+VGJmNhalpFP2tdrQ39U5BcUc0oAyJhISK8nJGfqgj5ojbYYOflOTQyhLR+ dYsis7n4RCnvnTy/QdVpD9V44+3RjUgZ7OdcQOHtt29QdJo8g8BRpevUn1LznvJfMIXN64VhDXC LL6l6h/h99ewdatC9GL0iH3AIx7ao0ygJNep1KoVlenBM3m+oAFypumeld3l/9ZomUpZx9I0k1D shUX4XogiymL0xbXtwAnZq/GtlsbPqdWvPivC9RLceFEbRG8J2RqdkvFqXAcdTLyteZCLL01a9X cyA67J+Enc9Bv51z2RleT2p0ZHQKWQIBHoiQN5Z4UXxXuEtdATNNGkPSS/Y4v2+sd+tj4khfUPi fFfn/54ZPeQusy8Cx8G2uvo+4= X-Received: by 2002:a05:6a00:430c:b0:848:47db:a0ac with SMTP id d2e1a72fcca58-84e2b8aa987mr8703690b3a.27.1784911197498; Fri, 24 Jul 2026 09:39:57 -0700 (PDT) Received: from devvm29614.prn0.facebook.com ([2a03:2880:ff:70::]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84e5341d8f0sm163841b3a.44.2026.07.24.09.39.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2026 09:39:56 -0700 (PDT) Date: Fri, 24 Jul 2026 09:39:54 -0700 From: Bobby Eshleman To: Jakub Kicinski Cc: Donald Hunter , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Andrew Lunn , Gerd Hoffmann , Vivek Kasireddy , Sumit Semwal , Christian =?iso-8859-1?Q?K=F6nig?= , Shuah Khan , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, linux-kselftest@vger.kernel.org, sdf@fomichev.me, razor@blackwall.org, daniel@iogearbox.net, almasrymina@google.com, matttbe@kernel.org, skhawaja@google.com, dw@davidwei.uk, Joe Damato , Bobby Eshleman Subject: Re: [PATCH net-next v5 1/3] net: devmem: allow rx-buf-size > PAGE_SIZE per dmabuf binding Message-ID: References: <20260708-tcpdm-large-niovs-v5-0-34bf6fac941b@meta.com> <20260708-tcpdm-large-niovs-v5-1-34bf6fac941b@meta.com> <20260721110713.325d36ba@kernel.org> <20260724072419.62778bbe@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260724072419.62778bbe@kernel.org> On Fri, Jul 24, 2026 at 07:24:19AM -0700, Jakub Kicinski wrote: > On Thu, 23 Jul 2026 16:58:14 -0700 Bobby Eshleman wrote: > > > > + if (info->attrs[NETDEV_A_DMABUF_RX_BUF_SIZE]) { > > > > + u32 rx_buf_size = nla_get_u32(info->attrs[NETDEV_A_DMABUF_RX_BUF_SIZE]); > > > > + > > > > + if (!rx_buf_size || !is_power_of_2(rx_buf_size) || > > > > + rx_buf_size < PAGE_SIZE) { > > > > > > we should add a check: min: page-size in the Netlink policy? > > > > I played around with this adding: > > > > Documentation/netlink/specs/netdev.yaml: > > definitions: > > + - > > + type: const > > + name: page-size > > + value: 4096 # dummy value, to pass ynl_gen_c.py checks > > + header: asm/page.h > > + scope: kernel > > > > Generating: > > > > +static const struct netlink_range_validation > > netdev_a_dmabuf_rx_page_size_range = { > > + .min = PAGE_SIZE, > > + .max = U32_MAX, > > +}; > > + > > > > ... but the dummy 4096 is kind of annoying. ynl_gen_c.py can't know the > > value of PAGE_SIZE but needs some value for its arithmetic checks (e.g., > > confirm min < max is true). > > > > Should we stick with using a dummy value, or should we add a patch > > teaching ynl_gen_c.py to allow value-less consts (skip the arithmetic > > checks)? > > Let's stick to a dummy one for now, but maybe something obviously dummy > like 0 ? 0 sounds good to me. > > BTW did you add both min and max checks? Cause the only risk with using > a dummy value would be that the policy will be rendered inline, and > inline policy is u16 so 64k wouldn't fit. But your sample above has a > max of u32_max which forces the out-of-line policy, which is what we > want. Yep, u32_max: + name: rx-page-size ... + checks: + min: page-size + max: u32-max Sorry, probably should have just sent the whole patch instead of replying hunk-by-hunk. BTW, how expressive do we want these policies? For example, would absorbing the power_of_2 check into a policy be valid in the future? or is that too bespoke? Best, Bobby