From owner-freebsd-net@freebsd.org Sun Nov 19 18:56:45 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0F7DDBB3B1 for ; Sun, 19 Nov 2017 18:56:45 +0000 (UTC) (envelope-from csalgau@users.sourceforge.net) Received: from mx02.buh.bitdefender.com (mx02.bbu.dsd.mx.bitdefender.com [91.199.104.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "*.mx.bitdefender.com", Issuer "thawte SSL CA - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1059B18E4 for ; Sun, 19 Nov 2017 18:56:44 +0000 (UTC) (envelope-from csalgau@users.sourceforge.net) Received: (qmail 26492 invoked from network); 19 Nov 2017 20:50:00 +0200 Received: from mx01robo.bbu.dsd.mx.bitdefender.com (10.17.80.60) by mx02.buh.bitdefender.com with AES128-GCM-SHA256 encrypted SMTP; 19 Nov 2017 20:50:00 +0200 Received: (qmail 29112 invoked from network); 19 Nov 2017 20:49:59 +0200 Received: from unknown (HELO ?10.210.20.54?) (10.210.20.54) by mx01robo.bbu.dsd.mx.bitdefender.com with SMTP; 19 Nov 2017 20:49:59 +0200 To: freebsd-net@freebsd.org From: Catalin Salgau Subject: BPF packet pagesize limit Openpgp: preference=signencrypt Message-ID: <966f384c-10b4-d018-efb1-68a7064c9521@users.sourceforge.net> Date: Sun, 19 Nov 2017 20:49:59 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Thunderbird/56.0 MIME-Version: 1.0 Content-Language: en-GB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Nov 2017 18:56:45 -0000 Hello, I'm trying to address the limitation in (upstream) net/vblade that was brought up in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205164 This is related to writes larger than hw.pagesize but smaller than the configured MTU with BPF. I traced this to sys/net/bpf.c where calls to bpfwrite() will use bpf_movein() which in turn uses m_get2() to allocate a single mbuf. This will fail if the requested mbuf size is larger than MJUMPAGESIZE (defined as PAGE_SIZE on x86). I believe this should use m_getm2() and populate multiple mbufs. Code in NetBSD explicitly notes that they omit mbuf chaining, but this is not documentated behaviour in the man page. Any chance of having this fixed in a supported release, or getting a usable/documented workaround? Thanks.