# be2net.ko manual compile error

## mrhe

Hi, i want to use SR-IOV on my Ethernet controller: Emulex Corporation OneConnect 10Gb,  but with standard driver i cant create num_vfs .

```
# modinfo be2net

filename:       /lib/modules/4.4.1/kernel/drivers/net/ethernet/emulex/benet/be2net.ko

license:        GPL

author:         Emulex Corporation

description:    Emulex OneConnect NIC Driver 10.6.0.3

version:        10.6.0.3

srcversion:     3C310951A3004AB6BE28A82

alias:          pci:v000010DFd00000728sv*sd*bc*sc*i*

alias:          pci:v000010DFd00000720sv*sd*bc*sc*i*

alias:          pci:v000010DFd0000E228sv*sd*bc*sc*i*

alias:          pci:v000010DFd0000E220sv*sd*bc*sc*i*

alias:          pci:v000019A2d00000710sv*sd*bc*sc*i*

alias:          pci:v000019A2d00000700sv*sd*bc*sc*i*

alias:          pci:v000019A2d00000221sv*sd*bc*sc*i*

alias:          pci:v000019A2d00000211sv*sd*bc*sc*i*

depends:

intree:         Y

vermagic:       4.4.1 SMP mod_unload

parm:           num_vfs:Number of PCI VFs to initialize (uint)

parm:           rx_frag_size:Size of a fragment that holds rcvd data. (ushort)

```

im trying to make a new driver...

```
 be2net-4.4.245.0 # make

make[1]: Entering directory '/usr/src/linux-4.4.1'

  CC [M]  /usr/src/be2net-4.4.245.0/be_main.o

In file included from /usr/src/be2net-4.4.245.0/be.h:44:0,

                 from /usr/src/be2net-4.4.245.0/be_main.c:24:

/usr/src/be2net-4.4.245.0/be_compat.h: In function ‘__vlan_put_tag_fixed’:

/usr/src/be2net-4.4.245.0/be_compat.h:490:9: error: implicit declaration of function ‘__vlan_put_tag’ [-Werror=implicit-function-declaration]

  struct sk_buff *new_skb = __vlan_put_tag(skb, vlan_tag);

         ^

/usr/src/be2net-4.4.245.0/be_compat.h:490:28: warning: initialization makes pointer from integer without a cast

  struct sk_buff *new_skb = __vlan_put_tag(skb, vlan_tag);

                            ^

/usr/src/be2net-4.4.245.0/be_compat.h: In function ‘vlan_hwaccel_receive_skb_compat’:

/usr/src/be2net-4.4.245.0/be_compat.h:515:2: error: too few arguments to function ‘__vlan_hwaccel_put_tag’

  __vlan_hwaccel_put_tag(skb, vlan_tci);

  ^

In file included from /usr/src/be2net-4.4.245.0/be.h:33:0,

                 from /usr/src/be2net-4.4.245.0/be_main.c:24:

include/linux/if_vlan.h:409:20: note: declared here

 static inline void __vlan_hwaccel_put_tag(struct sk_buff *skb,

                    ^

In file included from /usr/src/be2net-4.4.245.0/be.h:44:0,

                 from /usr/src/be2net-4.4.245.0/be_main.c:24:

/usr/src/be2net-4.4.245.0/be_compat.h: In function ‘vlan_gro_frags_compat’:

/usr/src/be2net-4.4.245.0/be_compat.h:523:2: error: too few arguments to function ‘__vlan_hwaccel_put_tag’

  __vlan_hwaccel_put_tag(napi->skb, vlan_tci);

  ^

In file included from /usr/src/be2net-4.4.245.0/be.h:33:0,

                 from /usr/src/be2net-4.4.245.0/be_main.c:24:

include/linux/if_vlan.h:409:20: note: declared here

 static inline void __vlan_hwaccel_put_tag(struct sk_buff *skb,

                    ^

In file included from /usr/src/be2net-4.4.245.0/be_main.c:24:0:

/usr/src/be2net-4.4.245.0/be.h: In function ‘be_get_tx_vlan_tag’:

/usr/src/be2net-4.4.245.0/be.h:678:2: error: implicit declaration of function ‘vlan_tx_tag_get’ [-Werror=implicit-function-declaration]

  vlan_tag = vlan_tx_tag_get(skb);

  ^

In file included from /usr/src/be2net-4.4.245.0/be_main.c:23:0:

/usr/src/be2net-4.4.245.0/be_main.c: At top level:

/usr/src/be2net-4.4.245.0/be_main.c:30:26: error: ‘be_dev_ids’ undeclared here (not in a function)

 MODULE_DEVICE_TABLE(pci, be_dev_ids);

                          ^

include/linux/module.h:223:21: note: in definition of macro ‘MODULE_DEVICE_TABLE’

 extern const typeof(name) __mod_##type##__##name##_device_table  \

                     ^

include/linux/module.h:223:27: error: conflicting type qualifiers for ‘__mod_pci__be_dev_ids_device_table’

 extern const typeof(name) __mod_##type##__##name##_device_table  \

                           ^

/usr/src/be2net-4.4.245.0/be_main.c:72:1: note: in expansion of macro ‘MODULE_DEVICE_TABLE’

 MODULE_DEVICE_TABLE(pci, be_dev_ids);

 ^

include/linux/module.h:223:27: note: previous declaration of ‘__mod_pci__be_dev_ids_device_table’ was here

 extern const typeof(name) __mod_##type##__##name##_device_table  \

                           ^

/usr/src/be2net-4.4.245.0/be_main.c:30:1: note: in expansion of macro ‘MODULE_DEVICE_TABLE’

 MODULE_DEVICE_TABLE(pci, be_dev_ids);

 ^

/usr/src/be2net-4.4.245.0/be_main.c: In function ‘be_get_stats64’:

/usr/src/be2net-4.4.245.0/be_main.c:571:4: error: implicit declaration of function ‘u64_stats_fetch_begin_bh’ [-Werror=implicit-function-declaration]

    start = u64_stats_fetch_begin_bh(&rx_stats->sync);

    ^

/usr/src/be2net-4.4.245.0/be_main.c:574:3: error: implicit declaration of function ‘u64_stats_fetch_retry_bh’ [-Werror=implicit-function-declaration]

   } while (u64_stats_fetch_retry_bh(&rx_stats->sync, start));

   ^

/usr/src/be2net-4.4.245.0/be_main.c: In function ‘be_vlan_tag_chk’:

/usr/src/be2net-4.4.245.0/be_main.c:686:2: error: implicit declaration of function ‘vlan_tx_tag_present’ [-Werror=implicit-function-declaration]

  return vlan_tx_tag_present(skb) || adapter->pvid || adapter->qnq_vid;

  ^

/usr/src/be2net-4.4.245.0/be_main.c: In function ‘be_get_vf_config’:

/usr/src/be2net-4.4.245.0/be_main.c:1227:4: error: ‘struct ifla_vf_info’ has no member named ‘tx_rate’

  vi->tx_rate = vf_cfg->tx_rate;

    ^

/usr/src/be2net-4.4.245.0/be_main.c: At top level:

/usr/src/be2net-4.4.245.0/be_main.c:3874:2: warning: initialization from incompatible pointer type

  .ndo_vlan_rx_add_vid = be_vlan_add_vid,

  ^

/usr/src/be2net-4.4.245.0/be_main.c:3874:2: warning: (near initialization for ‘be_netdev_ops.ndo_vlan_rx_add_vid’)

/usr/src/be2net-4.4.245.0/be_main.c:3875:2: warning: initialization from incompatible pointer type

  .ndo_vlan_rx_kill_vid = be_vlan_rem_vid,

  ^

/usr/src/be2net-4.4.245.0/be_main.c:3875:2: warning: (near initialization for ‘be_netdev_ops.ndo_vlan_rx_kill_vid’)

/usr/src/be2net-4.4.245.0/be_main.c:3879:2: error: unknown field ‘ndo_set_vf_tx_rate’ specified in initializer

  .ndo_set_vf_tx_rate = be_set_vf_tx_rate,

  ^

/usr/src/be2net-4.4.245.0/be_main.c:3879:2: warning: initialization from incompatible pointer type

/usr/src/be2net-4.4.245.0/be_main.c:3879:2: warning: (near initialization for ‘be_netdev_ops.ndo_set_vf_rate’)

/usr/src/be2net-4.4.245.0/be_main.c: In function ‘be_netdev_init’:

/usr/src/be2net-4.4.245.0/be_main.c:3920:3: error: ‘NETIF_F_HW_VLAN_TX’ undeclared (first use in this function)

   NETIF_F_HW_VLAN_TX;

   ^

/usr/src/be2net-4.4.245.0/be_main.c:3920:3: note: each undeclared identifier is reported only once for each function it appears in

/usr/src/be2net-4.4.245.0/be_main.c:3924:44: error: ‘NETIF_F_HW_VLAN_RX’ undeclared (first use in this function)

  netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_RX;

                                            ^

/usr/src/be2net-4.4.245.0/be_main.c:3937:23: error: ‘NETIF_F_HW_VLAN_FILTER’ undeclared (first use in this function)

   netdev->features |= NETIF_F_HW_VLAN_FILTER;

                       ^

/usr/src/be2net-4.4.245.0/be_main.c:3960:48: warning: assignment from incompatible pointer type

                 be_netdev_ops.ndo_select_queue = be_select_queue;

                                                ^

/usr/src/be2net-4.4.245.0/be_main.c:3963:2: error: implicit declaration of function ‘SET_ETHTOOL_OPS’ [-Werror=implicit-function-declaration]

  SET_ETHTOOL_OPS(netdev, &be_ethtool_ops);

  ^

/usr/src/be2net-4.4.245.0/be_main.c: At top level:

/usr/src/be2net-4.4.245.0/be_main.c:4152:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘be_remove’

 static void __devexit be_remove(struct pci_dev *pdev)

                       ^

/usr/src/be2net-4.4.245.0/be_main.c:4488:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘be_probe’

 static int __devinit be_probe(struct pci_dev *pdev,

                      ^

/usr/src/be2net-4.4.245.0/be_main.c:4832:11: error: ‘be_probe’ undeclared here (not in a function)

  .probe = be_probe,

           ^

/usr/src/be2net-4.4.245.0/be_main.c:4833:12: error: ‘be_remove’ undeclared here (not in a function)

  .remove = be_remove,

            ^

/usr/src/be2net-4.4.245.0/be_main.c:3912:12: warning: ‘be_netdev_init’ defined but not used [-Wunused-function]

 static int be_netdev_init(struct net_device *netdev)

            ^

/usr/src/be2net-4.4.245.0/be_main.c:4048:13: warning: ‘be_ctrl_cleanup’ defined but not used [-Wunused-function]

 static void be_ctrl_cleanup(struct be_adapter *adapter)

             ^

/usr/src/be2net-4.4.245.0/be_main.c:4065:12: warning: ‘be_ctrl_init’ defined but not used [-Wunused-function]

 static int be_ctrl_init(struct be_adapter *adapter)

            ^

/usr/src/be2net-4.4.245.0/be_main.c:4124:13: warning: ‘be_stats_cleanup’ defined but not used [-Wunused-function]

 static void be_stats_cleanup(struct be_adapter *adapter)

             ^

/usr/src/be2net-4.4.245.0/be_main.c:4133:12: warning: ‘be_stats_init’ defined but not used [-Wunused-function]

 static int be_stats_init(struct be_adapter *adapter)

            ^

/usr/src/be2net-4.4.245.0/be_main.c:4214:12: warning: ‘be_get_initial_config’ defined but not used [-Wunused-function]

 static int be_get_initial_config(struct be_adapter *adapter)

            ^

/usr/src/be2net-4.4.245.0/be_main.c:4241:12: warning: ‘be_dev_type_check’ defined but not used [-Wunused-function]

 static int be_dev_type_check(struct be_adapter *adapter)

            ^

/usr/src/be2net-4.4.245.0/be_main.c:4385:13: warning: ‘be_func_recovery_task’ defined but not used [-Wunused-function]

 static void be_func_recovery_task(struct work_struct *work)

             ^

/usr/src/be2net-4.4.245.0/be_main.c:4413:13: warning: ‘be_worker’ defined but not used [-Wunused-function]

 static void be_worker(struct work_struct *work)

             ^

/usr/src/be2net-4.4.245.0/be_main.c:4451:13: warning: ‘be_reset_required’ defined but not used [-Wunused-function]

 static bool be_reset_required(struct be_adapter *adapter)

             ^

/usr/src/be2net-4.4.245.0/be_main.c:4456:14: warning: ‘port_speed_string’ defined but not used [-Wunused-function]

 static char *port_speed_string(struct be_adapter *adapter)

              ^

/usr/src/be2net-4.4.245.0/be_main.c:4471:14: warning: ‘mc_name’ defined but not used [-Wunused-function]

 static char *mc_name(struct be_adapter *adapter)

              ^

cc1: some warnings being treated as errors

scripts/Makefile.build:258: recipe for target '/usr/src/be2net-4.4.245.0/be_main.o' failed

make[2]: *** [/usr/src/be2net-4.4.245.0/be_main.o] Error 1

Makefile:1384: recipe for target '_module_/usr/src/be2net-4.4.245.0' failed

make[1]: *** [_module_/usr/src/be2net-4.4.245.0] Error 2

make[1]: Leaving directory '/usr/src/linux-4.4.1'

Makefile:141: recipe for target 'default' failed

make: *** [default] Error 2

```

someone have that problem too? 

```
# gcc-config -l

 [1] x86_64-pc-linux-gnu-4.9.3
```

----------

## NeddySeagoon

mrhe,

I guess that be2net auto loads on boot?

modinfo shows

```
parm:           num_vfs:Number of PCI VFs to initialize (uint) 
```

So 

```
modprobe -r be2net

modprobe num_vfs=10
```

should remove the be2net module, then reload it creating 10 vfs.

Choose a number to suit yourself.

Once it works manually, you can make it work automatically too.

```
/usr/src/be2net-4.4.245.0/be_compat.h:490:9: error: implicit declaration of function ‘__vlan_put_tag’ [-Werror=implicit-function-declaration]

  struct sk_buff *new_skb = __vlan_put_tag(skb, vlan_tag); 
```

Your out of kernel be2net driver is looking for a function definition for __vlan_put_tag and not finding it.

This is either a problem with the source code or the setting of the build environment.

However it might work anyway.  gcc is being told -Werror=implicit-function-declaration, wich means to treat implicit-function-declarations as errors.

It considered bad practice to depend on implicit-function-declarations but they used to work.

----------

## mrhe

 *NeddySeagoon wrote:*   

> mrhe,
> 
> I guess that be2net auto loads on boot?
> 
> modinfo shows
> ...

 

thx for responce, i try that way wich i found on emulex manual. But wont dont work look 

```
 

#rmmod be2net

# modprobe be2net num_vfs=16

# ip addr show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo

       valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000

    link/ether 5c:f3:fc:xx:xx:xx brd ff:ff:ff:ff:ff:ff

    inet 172.17.10.241/24 brd 172.17.10.255 scope global eth0

       valid_lft forever preferred_lft forever

3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000

    link/ether 5c:f3:fc:xx:xx:xx brd ff:ff:ff:ff:ff:ff

10: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop portid 0100000000423831393530353139593131 state DOWN group default qlen 1000

    link/ether 00:00:c9:xx:xx:xx brd ff:ff:ff:ff:ff:ff

11: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop portid 0200000000423831393530353139593131 state DOWN group default qlen 1000

    link/ether 00:00:c9:xx:xx:xx brd ff:ff:ff:ff:ff:ff

#dmesg

[ 7348.590256] be2net : Module param num_vfs is obsolete.

[ 7348.590259] be2net : Use sysfs method to enable VFs

[ 7348.590310] be2net 0000:1a:00.0: be2net version is 10.6.0.3

[ 7348.763161] be2net 0000:1a:00.0: FW config: function_mode=0x30003, function_caps=0x7

[ 7348.783162] be2net 0000:1a:00.0: Max: txqs 16, rxqs 17, rss 16, eqs 16, vfs 0

[ 7348.783164] be2net 0000:1a:00.0: Max: uc-macs 30, mc-macs 64, vlans 15

[ 7348.783270] be2net 0000:1a:00.0: enabled 8 MSI-x vector(s) for NIC

[ 7349.007164] be2net 0000:1a:00.0: created 8 TX queue(s)

[ 7349.043162] be2net 0000:1a:00.0: created 9 RX queue(s)

[ 7349.085787] be2net 0000:1a:00.0: FW version is 4.0.1062.0

[ 7349.086290] be2net 0000:1a:00.0: HW Flow control - TX:1 RX:1

[ 7349.087120] be2net 0000:1a:00.0: Emulex OneConnect(be3): PF vNIC-2 port 0

[ 7349.087166] be2net 0000:1a:00.1: be2net version is 10.6.0.3

[ 7349.260163] be2net 0000:1a:00.1: FW config: function_mode=0x30003, function_caps=0x7

[ 7349.280164] be2net 0000:1a:00.1: Max: txqs 16, rxqs 17, rss 16, eqs 16, vfs 0

[ 7349.280165] be2net 0000:1a:00.1: Max: uc-macs 30, mc-macs 64, vlans 15

[ 7349.280291] be2net 0000:1a:00.1: enabled 8 MSI-x vector(s) for NIC

[ 7349.498166] be2net 0000:1a:00.1: created 8 TX queue(s)

[ 7349.534164] be2net 0000:1a:00.1: created 9 RX queue(s)

[ 7349.576689] be2net 0000:1a:00.1: FW version is 4.0.1062.0

[ 7349.577192] be2net 0000:1a:00.1: HW Flow control - TX:1 RX:1

[ 7349.578015] be2net 0000:1a:00.1: Emulex OneConnect(be3): PF vNIC-2 port 1

```

so i try manual with sysfs, but in sys i cant find in

```
 0000:1a:00.0 # pwd

/sys/bus/pci/devices/0000:1a:00.0
```

```
0000:1a:00.0 # ls -lah

total 0

drwxr-xr-x 6 root root    0 Feb 17 18:19 .

drwxr-xr-x 6 root root    0 Feb 17 18:19 ..

-rw-r--r-- 1 root root 4.0K Feb 17 20:38 broken_parity_status

-r--r--r-- 1 root root 4.0K Feb 17 19:03 class

-rw-r--r-- 1 root root  256 Feb 17 18:19 config

-r--r--r-- 1 root root 4.0K Feb 17 20:38 consistent_dma_mask_bits

-rw-r--r-- 1 root root 4.0K Feb 17 20:38 d3cold_allowed

-r--r--r-- 1 root root 4.0K Feb 17 18:19 device

-r--r--r-- 1 root root 4.0K Feb 17 20:38 dma_mask_bits

lrwxrwxrwx 1 root root    0 Feb 17 20:22 driver -> ../../../../bus/pci/drivers/be2net

-rw-r--r-- 1 root root 4.0K Feb 17 20:38 driver_override

-rw-r--r-- 1 root root 4.0K Feb 17 20:38 enable

lrwxrwxrwx 1 root root    0 Feb 17 20:39 firmware_node -> ../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:08/device:09

drwxr-xr-x 3 root root    0 Feb 17 20:22 hwmon

lrwxrwxrwx 1 root root    0 Feb 17 20:39 iommu -> ../../../virtual/iommu/dmar0

lrwxrwxrwx 1 root root    0 Feb 17 20:39 iommu_group -> ../../../../kernel/iommu_groups/4

-r--r--r-- 1 root root 4.0K Feb 17 19:03 irq

-r--r--r-- 1 root root 4.0K Feb 17 20:38 local_cpulist

-r--r--r-- 1 root root 4.0K Feb 17 20:38 local_cpus

-r--r--r-- 1 root root 4.0K Feb 17 20:38 modalias

-rw-r--r-- 1 root root 4.0K Feb 17 20:38 msi_bus

drwxr-xr-x 2 root root    0 Feb 17 20:38 msi_irqs

drwxr-xr-x 3 root root    0 Feb 17 20:22 net

-rw-r--r-- 1 root root 4.0K Feb 17 20:38 numa_node

drwxr-xr-x 2 root root    0 Feb 17 20:38 power

--w--w---- 1 root root 4.0K Feb 17 20:38 remove

--w--w---- 1 root root 4.0K Feb 17 20:38 rescan

--w------- 1 root root 4.0K Feb 17 20:38 reset

-r--r--r-- 1 root root 4.0K Feb 17 19:03 resource

-rw------- 1 root root  16K Feb 17 20:38 resource0

-rw------- 1 root root 128K Feb 17 20:38 resource2

-rw------- 1 root root 128K Feb 17 20:38 resource4

-rw------- 1 root root 256K Feb 17 20:38 rom

lrwxrwxrwx 1 root root    0 Feb 17 18:19 subsystem -> ../../../../bus/pci

-r--r--r-- 1 root root 4.0K Feb 17 20:38 subsystem_device

-r--r--r-- 1 root root 4.0K Feb 17 20:38 subsystem_vendor

-rw-r--r-- 1 root root 4.0K Feb 17 18:19 uevent

-r--r--r-- 1 root root 4.0K Feb 17 18:19 vendor

-rw------- 1 root root  32K Feb 17 20:38 vpd
```

file like sriov_numvfs to put numbert of vfs

----------

