From owner-freebsd-net@freebsd.org Sat Aug 15 22:05:48 2020 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2BA73A8071; Sat, 15 Aug 2020 22:05:48 +0000 (UTC) (envelope-from zeising+freebsd@daemonic.se) Received: from mail.daemonic.se (mail.daemonic.se [176.58.89.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTZBM3RBHz4nj3; Sat, 15 Aug 2020 22:05:47 +0000 (UTC) (envelope-from zeising+freebsd@daemonic.se) Received: from cid.daemonic.se (localhost [IPv6:::1]) by mail.daemonic.se (Postfix) with ESMTP id 4BTZBC1jDpz3mrf; Sat, 15 Aug 2020 22:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=daemonic.se; h= content-transfer-encoding:content-language:content-type :content-type:in-reply-to:mime-version:user-agent:date:date :message-id:from:from:references:subject:subject:received :received; s=20151023; t=1597529138; bh=H/BMOCP0VLae9Q1AjbE0UFcq fN19ItS9eXX0A7PdQJE=; b=doQqBauJoNRhly/dYRJD9FCA4O1me7vNcuWelFBl /h7BXwSa49lKLLiRF2ktajaD/L+KKGv/JTPNInTG73Cf3mHlO1svTBvZ1gULotgN rLuIp8gNAbEGd0kGVZw4+8qZkzN48P8Q1T7pHES2wJgJXhqchtdsZVjzSrdpjfAd Mk4= X-Virus-Scanned: amavisd-new at daemonic.se Received: from mail.daemonic.se ([IPv6:::1]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256) by cid.daemonic.se (mailscanner.daemonic.se [IPv6:::1]) (amavisd-new, port 10587) with ESMTPS id sFmiP2Aj6z9V; Sat, 15 Aug 2020 22:05:38 +0000 (UTC) Received: from garnet.daemonic.se (unknown [IPv6:2001:470:dca9:1201:e1ce:76ff:7f12:7a12]) by mail.daemonic.se (Postfix) with ESMTPSA id 4BTZBB3KNSz3mrC; Sat, 15 Aug 2020 22:05:38 +0000 (UTC) Subject: Re: Add support for building Linux-only network drivers To: net@freebsd.org, freebsd-net@freebsd.org References: <20200724070128.GD21738@mcp.nocebo.space> <23f13fd1-e8eb-0a66-03cc-9caf26208e7b@daemonic.se> <20200815215909.GA22866@mcp.nocebo.space> From: Niclas Zeising Message-ID: <7d5c55ab-bbf6-f8bc-954e-eb3739c13b4a@daemonic.se> Date: Sun, 16 Aug 2020 00:05:30 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200815215909.GA22866@mcp.nocebo.space> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1597529148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=D8ZmkinS3Xa6O28YKj2QwLzaQTU0ZKnBHTTOH3S+QP8=; b=QNlU76NCgEDZV6W6zmlvdtzQ/LYrGwjfcUw2+9nV+64d4dSQL7jPX+HzGxI12sfqzSyP2E UC9h67YPkMzkS+pH++bOvmyTQa3JWr6ZWcI61M8Aja2WmUY3GXsrBJyI2JLQ5cRS9H1PWQ +eg2SxAkbZivddbQ6J+RK/04OCzWxBRbkLpPeOJbrvl4tYqXzsKB7a9Bzz16xATKbvT2Sm d7plC3VlMQ4dHb1tqSQ2VdEcX16JgPKT7y+2sa/9F41hMo+csU/T16qGRv4q5NRmBNw2Dk /QtcUCka8b0QXzKZULTYwWpp1XjENq3DZ5kpLdZ7SSmORNNlHQqEhcTbSs2dgw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1597529148; a=rsa-sha256; cv=none; b=ciz8PdsT3T4ujXf+7hasmwT8YY6HzCD9ObeFUpR/KK1AeHM11NkYmoCP8IWgVu+fB92IEx QnApyszMz1ERa8e7K4ChFgSFcR1On4M1R86pSU79hi5b6zFVV7qtiyH6b1utOCcXDQ9qMr 8e5il7znPs4gZJjadsDy9qn49mnBx1GBXdqAj2dJEsWLBBDzRPCoe1vM8fz3xZyTsBVukD coxOROhe7EST0ELuD3ew02P46Qn7ibg0fF6V0pNL7DrHEmQ+dej1i1aKm6wucOEfi5xLty +DKtsz+KfqgBxi0kSYPacY3jg2HUzd45tTGnvAZ8iexJ+b/Th0LJTwOZTTj0PA== ARC-Authentication-Results: i=1; mx1.freebsd.org; dkim=pass header.d=daemonic.se header.s=20151023 header.b=doQqBauJ; spf=pass (mx1.freebsd.org: domain of zeising@daemonic.se designates 176.58.89.161 as permitted sender) smtp.mailfrom=zeising@daemonic.se X-Rspamd-Queue-Id: 4BTZBM3RBHz4nj3 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=daemonic.se header.s=20151023 header.b=doQqBauJ; dmarc=pass (policy=none) header.from=daemonic.se; spf=pass (mx1.freebsd.org: domain of zeising@daemonic.se designates 176.58.89.161 as permitted sender) smtp.mailfrom=zeising@daemonic.se X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[daemonic.se:s=20151023]; NEURAL_HAM_MEDIUM(-1.09)[-1.089]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; ARC_SIGNED(0.00)[i=1]; NEURAL_HAM_LONG(-1.01)[-1.008]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[daemonic.se:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[daemonic.se,none]; NEURAL_HAM_SHORT(-0.91)[-0.908]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:36236, ipnet:176.58.89.0/24, country:US]; TAGGED_FROM(0.00)[freebsd]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Aug 2020 22:05:48 -0000 On 2020-08-15 23:59, zerous wrote: > On Fri, Jul 24, 2020 at 07:42:32PM +0200, Niclas Zeising wrote: >> >> Hi! >> The Linux compatibility layer, aka Linuxolator, is for running userland >> Linux binaries on FreeBSD. I think what you're looking for is the Linux >> KPI, or lkpi. I believe Mellanox network card drivers are using this, and I >> know the drm-kmod graphics drivers are. This might be a starting point for >> you. > > Hi, > > I was just wondering if I could find more documentation about > linuxolator. I have been reading up "FreeBSD Device Drivers" and I > think it will help me in understanding network drivers, but I couldn't > find much information on the linux kernel api other than a blog on > drm-kmod (setup). > > Naveen > THe linuxolator, as I told you, is for running userland Linux binaries on FreeBSD, and has nothing to do with wanting to build Linux-only network drivers. I suggest you look at the code for the lkpi, you can find it here: https://github.com/freebsd/freebsd/tree/master/sys/compat/linuxkpi/common There are also drivers in the tree using it, such as mellanox network drivers, I think. The lkpi is meant to work like on Linux, but you probably need some glue to set up modules and so on. I suggest you start with looking at the relevant code. Regards -- Niclas