# Compile and load a newer network driver



## pos (Feb 28, 2019)

Hi

If my question is stupid is just because I am new to FreeBSD (have been using mostly OpenBSD, Linux, Solaris and others....). I just moved a firewall over from OpenBSD 6.4 to FreeBSD 12.0 and did some conversion of PF  back to old syntax and some network tuning. Now I can fill the 10gbe card. PF with good SMP is better... 

To the point...

I have downloaded and compiled a newer intel NIC driver. The one shipped with FreeBSD 12.0 worked ok though... I compiled the latest if_ix.ko from Intels ix-3.3.6 package. I backed up the old /boot/kernel/if_ix.ko and then copied my new module to /boot/kernel/ and did a reboot. My card is a  "AOC-STGN-i2S - Supermicro Intel 82599ES 2-port 10Gbit SFP+ PCIe x8"

My question is... 
How can I tell if my newly compiled driver is used after a reboot? The system works flawlessly. But There is no printout in "dmesg" or in "pciconf -lbcev" regarding the "ix"-driver version used. Old (i.e FreeBSD default) or new driver?

No I have not dig enough about FreeBSD kernel. So this post is, sad to say, because I have not had the time yet to read about the FreeBSD kernel...

Tnx in advance
/Peo


----------



## pos (Mar 1, 2019)

Many thanks Wozzeck.Live ! Very good info!

Backed it all out back to the kernel defaults. (I said I had not spent time checking up how to do it correctly. Will do. Already started to like FreeBSD).


Now... I installed the port intel-ix-kmod-3.3.6_1 and added if_ix_updated_load="YES" to /boot/loader.conf.local After reboot I could see:
--snip--
module_register: cannot register pci/ix from kernel; already loaded from if_ix_updated.ko
Module pci/ix failed to register: 17
--snip--

Which should be good.

A kldstat -v also showed ix_updated.ko.

Good, but...

One interface (the one with all VLANs on it) refused to go online after boot (i.e no carrier). 

After a few tests...

*The interface does not go up at boot (i.e no carrier) if:*
- if_ix_updated.ko overrides kernel default module with an error message seen in dmesg by adding its load to loader.conf.local.  Doing "ifconfig ix2 down" and "ifconfig ix2 up" after boot is done and it worked.

*The interface goes up as it should at boot if:*

Default shipped kernel module is used
If copying if_ix_updated.ko  to /boot/kernel/if_ix.ko and reboot. Which is horrible, yes 


Could the reason be a timeout or so? Or what could this problem depend on?  Any suggestions? It is just the override process that caused problem as the new module works as it should if the default module is overwritten with the new from ports. The interface is an SFP+ with a 10GBase-T Gbic in it. I have not tested another interface that have the same driver and is a native 10Base-T interface (i.e not in an SFP+ port)  and checked it the problem is there too.

/Peo


----------



## olli@ (Mar 1, 2019)

I'm wondering why you are trying to do that? The driver included with FreeBSD should work better.


----------



## pos (Mar 1, 2019)

Tried to change the NIC to a card that uses same driver (Intel X550-T2) but has only 10GBase-T ports instead of SFP+. This works flawlessly in all of the above mentioned cases. So it seems to be some kind of timeout or so as I thought with the SFP+ that is triggered with this setup overriding internal modules....


----------



## pos (Mar 1, 2019)

olli@ 
Why would a _much_ older driver work better? The current Intel driver are _many_ releases a head. I dont say any one of them will be worse. But please back up your statement. If you have info that back up your statement, please post it. Or at least post why you think so. Otherwise it is better you do not post the comment at all as it does not give anybody nothing.... Are you perhaps guessing?

I have done tons of network test and the built in driver does not work better! It is very good though...

Why I use a newer one is because: Newer drivers  includes fixes, optimisations and new features. Thats why.... If you on the other hand can say anything against this and back it up, it would be very appreciated info that I carefully will evaluate.


----------



## olli@ (Mar 2, 2019)

Is the driver in FreeBSD's base system really _that_ much older? What features is it missing exactly? And if intel's newer driver is so much better, then why hasn't it been imported into FreeBSD? Drivers that are in FreeBSD's base system are usually better integrated with the system than “external” drivers because they're maintained along with the rest of the kernel's infrastructure. The developers have fixed a lot of problems in the driver and integrated it better with other kernel features (e.g. it is now using iflib) – does the newer driver from intel contain all those fixes, too? For example, see the SVN history of if_ix.c.


----------



## pos (Mar 3, 2019)

The base system driver seems to be a few years older (plus the fixes in the community of course). But what fixes that has been fixed in source in parallel to what Intel have done, I don't know. And no, I don't miss any features. Just assuming a two year newer official driver is better from a performance perspective. But this I am testing right now... Maybe I back this out to the base systems built in driver.

 I assume Intel is not only adding new features, but mostly bug fixes and performance stuff. The last imported version from Intel to FreeBSD source tree I could find was 3.2.12 two year ago (the last I found by scanning source tree). It is probably even older as it was imported two year ago.... The last 3.2 driver from Intel download area is 3.2.18. Now the latest official driver is 3.3.6 from late august 2018. This is the one I am testing right now.



> And if intel's newer driver is so much better, then why hasn't it been imported into FreeBSD?


Well... If it is good already, why would Intel spend time releasing new versions...

I see your point though... If I don't see any better performance with the new driver, after my test I will probably go back to base system driver. I mean, why make it more complex if it does give you anything


----------

