Porting BGE Driver to IFLIB...



  • I am embarking on a project into a dark place without a flashlight...porting the BGE driver to the IFlib. I have very limited knowledge on software development and is more of an end user as well as an open source enthusiast. I am also a longtime Mac person who likes to re-purpose Mac hardware. I have been wanting to use Suricata, and soon Snort inline mode with Netmap but the BGE driver isn't supported. So, I contacted both the Netmap creator as well as the BGE driver creator (he hasn't looked at it for over 15yrs) and shared my intention.

    That led me to look at how the VMware driver was ported here: https://reviews.freebsd.org/D18761

    Of course that immediately appeared overwhelming. FreeBSD is removing or has removed several old drivers (10/100mb) or limited used drivers from version 12. Also, the BGE driver 1000mb is not in version 12. I spoke here of a plan here:(https://forum.netgate.com/topic/144928/thunderbolt-pcie-enclosere-and-intel-nic); however, I am sure others could use the BGE driver as well.

    So, I have access to the BGE source code...how to start?



  • Just to update thread, the Netmap developer is helping me...will report back once it's completed. I must say it's a steep learning curve for a neophyte.


  • Netgate Administrator

    Nice! Is there any public discussion of this anywhere we can follow?

    Steve



  • @stephenw10 said in Porting BGE Driver to IFLIB...Help!:

    Nice! Is there any public discussion of this anywhere we can follow?

    Steve

    Well, not yet Steve...it's overwhelming to say the least...so; I am taking baby steps.



  • Just another update to this thread to share what I had learned. The first suggestion was for me to look at how the vmx(4) was ported to the IFLib: https://reviews.freebsd.org/D18761 That quickly became extremely overwhelming to say the least. That’s when the Netmap developer pointed out that he had provided tools to enable any driver to port to the IFLib, which supports Netmap…see man page: https://www.unix.com/man-page/freebsd/4/netmap/

    These are the following steps:

    1.	Install FreeBSD (11 or 12) on a virtual machine.
    2.	Install these packages: Git, Gmake, and Gcc or Clang…note, if you install FreeBSD with SCR Tree, all those would already installed.
    3.	Get the Netmap tools: $ git clone https://github.com/luigirizzo/netmap 
    4.	Go to the Netmap tool:  $ cd /netmap/apps/pkt-gen
    5.	Run pkt-gen on NIC driver, example, in my case it is the Broadcom driver bge: #pkt-gen -I bge0 -f rx
    6.	Run Gmake, which converts the driver and launch cc to compile it: $ gmake
    7.	copy the file and place in your pfSense production box: /usr/local/bin - $ sudo cp pkt-gen /usr/local/bin
    

    Your NIC driver would now be supported by Netmap so you can use Suricata and soon Snort in inline mode. Please note in the above step 7, you will be copying the file from your FreeBSD VM, so you may need a jump drive to transport. Also, please note that I did not need to do this as I took another option as stated here: https://forum.netgate.com/topic/144928/thunderbolt-pcie-enclosere-and-intel-nic



  • @NollipfSense said in Porting BGE Driver to IFLIB...:

    That’s when the Netmap developer pointed out that he had provided tools to enable any driver to port to the IFLib, which supports Netmap…see man page: https://www.unix.com/man-page/freebsd/4/netmap/

    Correction per developer:

    I'm sorry, but I think there has been a misunderstanding.
    There are no "tools to enable to port any driver to iflib". The end result of the steps listed there is just that you have the pkt-gen test program built and installed.
    You can read about pkt-gen here https://github.com/freebsd/freebsd/blob/master/tools/tools/netmap/pkt-gen.8
    In any case, you don't really need to worry about iflib and native netmap support. Netmap will work on any NIC because it has a feature called "emulated netmap adapter. This means that you can use Suricata/Bro with netmap on any NIC.


Log in to reply