From nobody Fri Dec 24 11:18:47 2021 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E0E9A1900B68 for ; Fri, 24 Dec 2021 11:18:55 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JL4M349Mpz3HP4; Fri, 24 Dec 2021 11:18:55 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from localhost (unknown [93.176.181.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: royger) by smtp.freebsd.org (Postfix) with ESMTPSA id 06CC026D57; Fri, 24 Dec 2021 11:18:54 +0000 (UTC) (envelope-from royger@FreeBSD.org) Date: Fri, 24 Dec 2021 12:18:47 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: freebsd-net@freebsd.org Cc: firemeteor@users.sourceforge.net Subject: mbuf data crossing a page boundary Message-ID: List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640344735; 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; bh=ouG0LanjtsH7gSsNlVUZPOHWUcQPhIqom93mHXEItlE=; b=P6uXw2p2C5EqP/JxYLd4xkFXBUydnWeIFsiEO45Betm/0QkpI2iS6nnDIRX6Sqi4NnmwB1 vvpL0AQrcZZ+uwmlyB3h/v1EZQzVCpHaHe3Un/ezP2y98GvkA9WdLW5DUqhII55XLwWwmn lyOUIZEZOgv+NDZnz8hLdkU25pxKF8gkL8ClCHIZWQ0IMjbk/fAPKdwWIkTXuPo6RM2zsK 1VjbFMYEsLVX/01HCCfFDfyszhEVFRjy9D3uSoID64GnmyJJZBirlDjC4yxFWehqqXpV2k +ztdp4cnbiVUa1UW9msi5anCGBwfsebvB4DqtCSq3rAXG5u1RIOru3c+0vI6YA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640344735; a=rsa-sha256; cv=none; b=GjZDV0jVY2fQmYRN0/exr6qPxETDBIyYELTVN4p0/4iub7Q4zKfYRricjdyUT0fgA7sS4Q oXgL7fjLBu/paZaHqHB5+0agAl8JNFJGb4EJFChhRcPkNvtLkqWR305la32s1pj5UT44Ds zc6G8zM7QucJuyHBFCLzygRq39Ho1jZpwa0oCnaWtFQohYeQxn7ARCu3Zt04dZ9ZkuJpU1 DVU2MreLUqpsuaHy6pOSlvPbe+UsiBq4L6Kh38jLJDOttRULr2kiS97WHslpPJs9qUKtN8 nV9AbSX6X8yxMKAsjayO4Lb+XXAb4bwxB/4gMhUgkWTjAJgLr/3bfHeO9wgwYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N Hello, A user (on Cc) recently reported an issue on xen-devel when using FreeBSD as a Xen guest on a Linux host. Upon further examination the issue is caused by FreeBSD Xen virtual network adapter receiving an mbuf that contains a data buffer that crosses a page boundary. This is not an mbuf chain, a single mbuf that has 'mtod(m, vm_offset_t) & PAGE_MASK) + m->m_len > PAGE_SIZE'. The Xen virtual network interface doesn't support jumbo frames or anything like that, here is the ifconfig output of the adapter: xn0: flags=8843 metric 0 mtu 1500 options=503 ether 00:18:3c:51:6e:4c inet 192.168.1.9 netmask 0xffffff00 broadcast 192.168.1.255 media: Ethernet manual status: active nd6 options=1 This issue seems to be only reproducible when using the iSCSI target mode on FreeBSD. Is it expected for network interfaces to handle mbufs that have data crossing a page boundary even when not supporting jumbo frames? If so, what's the best way to handle those? I would think using bus_dma, but it seems overkill to use it just to split an mbuf that crosses a page boundary. I could also add code in the Xen virtual adapter to split those mbufs, but it's a bit clumsy IMO. For reference, the xen-devel thread where this is also discussed: https://lists.xenproject.org/archives/html/xen-devel/2021-12/msg01581.html Thanks, Roger.