# Intel ix driver no longer compile correcty in 12.2



## pos (Nov 5, 2020)

Hi
I am using the intel ix driver instead of the one in FreeBSD (ix-3.3.18.tar.gz). https://downloadcenter.intel.com/do...10-Gigabit-Network-Connections-Under-FreeBSD-

I have been using this for a long time. This is due to my 10G test and transparent VLAN devel etc...

After upgrading from 12.1-p10 to 12.2-RELEASE I can no longer compile this. I threw the /usr/src away and downloaded 12.2  src fresh fresh. Same problem. 

I have not yet done any digging. But if someone has as clue, it would be very much appreciated...



> 15:45:10 xanadu:~/ix-3.3.18/src # make
> machine -> /usr/src/sys/amd64/include
> x86 -> /usr/src/sys/x86/include
> awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/kern/device_if.m -h
> ...



Tnx
Peo


----------



## SirDice (Nov 5, 2020)

Use the port net/intel-ix-kmod.


----------



## SirDice (Nov 5, 2020)

Port is slightly older (3.3.14) but if I modify the version to 3.3.18 it builds just fine on 12.2-STABLE. I can't test if it actually works because I don't have the hardware.

So if you really need 3.3.18 I would suggest opening a PR and ask the maintainer if they can update it and/or supply a patch to update the port.


----------



## Emrion (Nov 5, 2020)

Just a guess: maybe /usr/src/sys/net/if_var.h previously did not contain the iflladdr_cb_t definition. You can try to comment it out in ./freebsd_compat_common.h.


----------



## SirDice (Nov 5, 2020)

I suspect it's actually a compiler option. That same bit of code produces a warning, not an error, if I build my modified port.


```
--- ixgbe_netmap.o ---
In file included from ixgbe_netmap.c:81:
In file included from ./ixgbe.h:93:
./freebsd_compat_common.h:142:15: warning: redefinition of typedef 'iflladdr_cb_t' is a C11 feature [-Wtypedef-redefinition]
typedef u_int iflladdr_cb_t(void *, struct sockaddr_dl *, u_int);
              ^
/usr/src/sys/net/if_var.h:742:15: note: previous definition is here
typedef u_int iflladdr_cb_t(void *, struct sockaddr_dl *, u_int);
              ^
--- freebsd_compat_common.o ---
In file included from freebsd_compat_common.c:44:
./freebsd_compat_common.h:142:15: warning: redefinition of typedef 'iflladdr_cb_t' is a C11 feature [-Wtypedef-redefinition]
typedef u_int iflladdr_cb_t(void *, struct sockaddr_dl *, u_int);
              ^
/usr/src/sys/net/if_var.h:742:15: note: previous definition is here
typedef u_int iflladdr_cb_t(void *, struct sockaddr_dl *, u_int);
              ^
1 warning generated.
```


----------



## pos (Nov 5, 2020)

SirDice said:


> Use the port net/intel-ix-kmod.


I does not update as quickly and lacks options so I have to rebuild it...


----------



## pos (Nov 5, 2020)

SirDice said:


> Port is slightly older (3.3.14) but if I modify the version to 3.3.18 it builds just fine on 12.2-STABLE. I can't test if it actually works because I don't have the hardware.
> 
> So if you really need 3.3.18 I would suggest opening a PR and ask the maintainer if they can update it and/or supply a patch to update the port.


Same problem on 3.3.14 as I used before trying 3.3.18. 

I upgraded to 12.2-RELEASE and at the same time saw 3.3.18, but it did not work. Then I tried to compile 3.3.14 That did compile fine on 12.1. But 3.3.14 had the same problem on 12.2 as 3.3.18


----------



## SirDice (Nov 5, 2020)

pos said:


> I does not update as quickly


Talk to the maintainer.



pos said:


> lacks options so I have to rebuild it...


What options are missing? Again, talk to the maintainer and ask if he can add the missing options.

Fixing the port will benefit _everybody_, not just you.


----------



## pos (Nov 5, 2020)

SirDice said:


> I suspect it's actually a compiler option. That same bit of code produces a warning, not an error, if I build my modified port.
> 
> 
> ```
> ...


I get an error so it does not build at all. 

I will dig into it later today


----------



## pos (Nov 5, 2020)

SirDice said:


> Talk to the maintainer.
> 
> 
> What options are missing? Again, talk to the maintainer and ask if he can add the missing options.
> ...


Transparent VLANs is one. I had a mail discussion with the maintainer of the port earlier. He added one compile option I needed. But the FreeBSD driver lacks so much stuff Intel have in the Linux driver. So I am doing some transparent VLAN modifications myself in the source. Some stuff is half there...

I started with SR-IOV, but directly saw transparent VLANs was missing i FreeBSD. But of course there in Linux and windows... So I am spending some spare tim on that.

B t w.... I used to use that port...


----------



## SirDice (Nov 5, 2020)

This looks relevant:

```
MAKE_ENV+=      WERROR=""
```
So try something like `make -DWERROR`

I get the exact same `redefinition of typedef` messages, complaining about the same thing. But with the port they're warnings, not errors.


----------



## Emrion (Nov 5, 2020)

I downloaded the driver, commented out the iflladdr_cb_t definition in ./freebsd_compat_common.h.

You know what? It compiles successfully (on a 12.2-RELEASE). I can't test further as I don't have the hardware.


----------



## Emrion (Nov 7, 2020)

In fact, the problem lies there:

```
#if __FreeBSD_version < 1300051
struct sockaddr_dl;
typedef u_int iflladdr_cb_t(void *, struct sockaddr_dl *, u_int);
u_int if_foreach_lladdr(if_t ifp, iflladdr_cb_t cb, void *cb_arg);
u_int if_foreach_llmaddr(if_t ifp, iflladdr_cb_t cb, void *cb_arg);
u_int if_lladdr_count(if_t ifp);
u_int if_llmaddr_count(if_t ifp);
#endif
```
This code works:

```
#if __FreeBSD_version < 1202000
struct sockaddr_dl;
typedef u_int iflladdr_cb_t(void *, struct sockaddr_dl *, u_int);
#endif
#if __FreeBSD_version < 1300051
u_int if_foreach_lladdr(if_t ifp, iflladdr_cb_t cb, void *cb_arg);
u_int if_foreach_llmaddr(if_t ifp, iflladdr_cb_t cb, void *cb_arg);
u_int if_lladdr_count(if_t ifp);
u_int if_llmaddr_count(if_t ifp);
#endif
```
I attach the patch if someone is interested.


----------



## pi@ (Nov 8, 2020)

Thanks for the patch. I've put it into a PR, see





						250943 – net/intel-ix-kmod: update to 3.3.18
					






					bugs.freebsd.org


----------



## pos (Nov 10, 2020)

FYI

I communicated with Intel a couple of days ago. Yesterday they said:

--snip--
We've had a fix internally for this, but it didn't make it into our latest downloadcenter driver release.

Instead, we should have a new version that works with FreeBSD 12.2 out near the end of the year.
--snip--


----------



## Emrion (Nov 10, 2020)

pos said:


> FYI
> 
> I communicated with Intel a couple of days ago. Yesterday they said:
> 
> ...


I don't understand your point. You have a patch, but you will wait until Christmas? 
After all, that's the right time.


----------



## pos (Nov 10, 2020)

Emrion said:


> I don't understand your point. You have a patch, but you will wait until Christmas?
> After all, that's the right time.



 

Well...  My point was to feed it back to intel so they could correct the source, not to wait  I fixed it myself directly after posting here. Before the patch in this thread....


----------



## Emrion (Nov 11, 2020)

Emrion said:


> Just a guess: maybe /usr/src/sys/net/if_var.h previously did not contain the iflladdr_cb_t definition. You can try to comment it out in ./freebsd_compat_common.h.


And before that as well, I suppose.


----------



## pos (Nov 11, 2020)

Emrion said:


> And before that as well, I suppose.


Before that was posted, I don't know  ha ha I was looking into the code and do not watch the forum every minute, even though I love this forum. I was earlier a fan of OpenBSD for so may years I cannot count. But now I like FreeBSD more. And the FreeBSD forum is great with many competent nice people. The original post was before I even had a time to look at the problem, and there are som many competent persons i this forum. I though someone already had seen it. That's all.

 I do other mods in the code as well. Well... trying....    to do some stuff around transparent VLANs so SR-IOV would be more usable. I have done some presentations on FreeBSD meetups regarding KVM to BHYVE migration with SR-IOV and VLANS. Then I came across the lack of transparent VLANs in FreeBSD. That was what took my interest in this. SR-IOV works for some cards due to great work done by another guy. But the VF function for transparent VLANs is missing in the FreeBSD driver, but is there in the Linux and windows driver. On spare time I try to make a working "transparentvlan" addition   This is also the reason I do not use the existing intel-ix-kmod at the moment. It is going slowly forward though as I not have that much time to spare and also have to look at other code blocks outside the driver as well.


----------



## warwickt (Jan 9, 2021)

Gentlemen, I wish to report that your intel-ix-kmod-3.3.18 patch intel-ixl-kmod/files/patch-freebsd__compat__common.h works very well on our FreeBSD 12.2 ZFS server with the heavy lifting 10GbE LAN and its Intel X500-T1.

Your patch appears so far to enable a better through put with several workstation hosts that use the non-Intel flavour ..  Aquantia ACQ107 PCI-e Asus XG-C100C's and MacOS ACQ107NICs.

 apply patch to /usr/ports/net

```
|===================================================================
|--- intel-ix-kmod/Makefile    (revision 554434)
|+++ intel-ix-kmod/Makefile    (working copy)
--------------------------
Patching file intel-ix-kmod/Makefile using Plan A...
Hunk #1 succeeded at 2 with fuzz 1.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: intel-ix-kmod/distinfo
|===================================================================
|--- intel-ix-kmod/distinfo    (revision 554434)
|+++ intel-ix-kmod/distinfo    (working copy)
--------------------------
Patching file intel-ix-kmod/distinfo using Plan A...
Hunk #1 succeeded at 1.
done
```

 assemble and link:
`cd /usr/ports; portmaster net/intel-ix-kmod`
 check the inventory

```
# pkg info intel-ix-kmod-3.3.18
intel-ix-kmod-3.3.18
Name           : intel-ix-kmod
Version        : 3.3.18
Installed on   : Sat Jan  9 13:15:39 2021 HKT
Origin         : net/intel-ix-kmod
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : net kld
Licenses       : BSD2CLAUSE
Maintainer     : freebsd@intel.com
WWW            : https://downloadcenter.intel.com
Comment        : 10 gigabit FreeBSD Base Driver for Intel(R) Network Connections
Options        :
    NETMAP_AUTO    : on
    NETMAP_OFF     : off
    NETMAP_ON      : off
    SRIOV          : off
Annotations    :
    FreeBSD_version: 1201000
Flat size      : 343KiB
Description    :
This release includes the 10 gigabit FreeBSD*-based driver for Intel(R) Network
Connections.
The ix driver supports all 10 gigabit network connections based on
82599, 82598EB, X520, X540, and X550 series controllers.
WWW: https://downloadcenter.intel.com
```

 Change the startup the .ko in /boot/modules/if_ix_updated.ko

```
if_ix_updated_load="YES"
```

 See where it landed after startup..

```
# kldstat -hv -n if_ix_updated.ko
Id Refs Address             Size Name
6    1 0xffffffff82a3f000  360K if_ix_updated.ko (/boot/modules/if_ix_updated.ko)
    Contains modules:
         Id Name
          8 pci/ix
```

Works well for the last 12 hours .
Many Thanks to you all and sundry for your marvellous dedication and effort.
WarwickT
Hong Kong


----------



## Emrion (Jan 9, 2021)

At least, my little work will be of some use. Some people seem to make patches and keep them to themselves...


----------

