Hi Kris,
First bad commit (maybe != root cause):
tree:
https://github.com/intel/linux-intel-lts.git 4.19/android_r
head: 9f2d2ee2b02288b762796b8d0d95a1d6bf805cab
commit: b652a52d36a85d1b731921ba08e701d7150ce200 [19120/24638] Merge branch
'aosp/android-4.19-stable' into android_r
config: alpha-randconfig-s031-20210910 (attached as .config)
compiler: alpha-linux-gcc (GCC) 11.2.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
#
https://github.com/intel/linux-intel-lts/commit/b652a52d36a85d1b731921ba0...
git remote add intel-linux-intel-lts
https://github.com/intel/linux-intel-lts.git
git fetch --no-tags intel-linux-intel-lts 4.19/android_r
git checkout b652a52d36a85d1b731921ba08e701d7150ce200
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=alpha
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
drivers/staging/igb_avb/igb_main.c:4213:31: sparse: sparse: undefined identifier
'txring_txq'
drivers/staging/igb_avb/igb_main.c:7368:35: sparse: sparse: undefined identifier
'txring_txq'
> drivers/staging/igb_avb/igb_main.c:306:27: sparse: sparse:
incorrect type in initializer (different base types) @@ expected restricted __poll_t (
*poll )( ... ) @@ got unsigned int ( * )( ... ) @@
drivers/staging/igb_avb/igb_main.c:306:27: sparse: expected restricted __poll_t (
*poll )( ... )
drivers/staging/igb_avb/igb_main.c:306:27: sparse: got unsigned int ( * )( ... )
> drivers/staging/igb_avb/igb_main.c:503:22: sparse: sparse:
incorrect type in assignment (different base types) @@ expected unsigned short
[usertype] port @@ got restricted __be16 [usertype] @@
drivers/staging/igb_avb/igb_main.c:503:22: sparse: expected unsigned short [usertype]
port
drivers/staging/igb_avb/igb_main.c:503:22: sparse: got restricted __be16
[usertype]
> drivers/staging/igb_avb/igb_main.c:4445:6: sparse: sparse: symbol
'igb_full_sync_mac_table' was not declared. Should it be static?
> drivers/staging/igb_avb/igb_main.c:4454:6: sparse: sparse: symbol
'igb_sync_mac_table' was not declared. Should it be static?
drivers/staging/igb_avb/igb_main.c:5562:30: sparse: sparse: undefined identifier
'txring_txq'
drivers/staging/igb_avb/igb_main.c:6131:22: sparse: sparse: using member 'type'
in incomplete struct ptp_clock_event
drivers/staging/igb_avb/igb_main.c:6131:30: sparse: sparse: undefined identifier
'PTP_CLOCK_PPS'
drivers/staging/igb_avb/igb_main.c:6132:28: sparse: sparse: no member
'ptp_caps' in struct igb_adapter
drivers/staging/igb_avb/igb_main.c:6133:25: sparse: sparse: undefined identifier
'ptp_clock_event'
drivers/staging/igb_avb/igb_main.c:6141:39: sparse: sparse: no member
'ptp_tx_work' in struct igb_adapter
drivers/staging/igb_avb/igb_main.c:6146:35: sparse: sparse: no member
'tmreg_lock' in struct igb_adapter
drivers/staging/igb_avb/igb_main.c:6147:44: sparse: sparse: no member 'perout'
in struct igb_adapter
drivers/staging/igb_avb/igb_main.c:6155:24: sparse: sparse: no member 'perout'
in struct igb_adapter
drivers/staging/igb_avb/igb_main.c:6156:37: sparse: sparse: no member
'tmreg_lock' in struct igb_adapter
drivers/staging/igb_avb/igb_main.c:6161:35: sparse: sparse: no member
'tmreg_lock' in struct igb_adapter
drivers/staging/igb_avb/igb_main.c:6162:44: sparse: sparse: no member 'perout'
in struct igb_adapter
drivers/staging/igb_avb/igb_main.c:6169:24: sparse: sparse: no member 'perout'
in struct igb_adapter
drivers/staging/igb_avb/igb_main.c:6170:37: sparse: sparse: no member
'tmreg_lock' in struct igb_adapter
drivers/staging/igb_avb/igb_main.c:6177:22: sparse: sparse: using member 'type'
in incomplete struct ptp_clock_event
drivers/staging/igb_avb/igb_main.c:6177:30: sparse: sparse: undefined identifier
'PTP_CLOCK_EXTTS'
drivers/staging/igb_avb/igb_main.c:6178:22: sparse: sparse: using member
'index' in incomplete struct ptp_clock_event
drivers/staging/igb_avb/igb_main.c:6179:22: sparse: sparse: using member
'timestamp' in incomplete struct ptp_clock_event
drivers/staging/igb_avb/igb_main.c:6180:17: sparse: sparse: undefined identifier
'ptp_clock_event'
drivers/staging/igb_avb/igb_main.c:6187:22: sparse: sparse: using member 'type'
in incomplete struct ptp_clock_event
drivers/staging/igb_avb/igb_main.c:6187:30: sparse: sparse: undefined identifier
'PTP_CLOCK_EXTTS'
drivers/staging/igb_avb/igb_main.c:6188:22: sparse: sparse: using member
'index' in incomplete struct ptp_clock_event
drivers/staging/igb_avb/igb_main.c:6189:22: sparse: sparse: using member
'timestamp' in incomplete struct ptp_clock_event
drivers/staging/igb_avb/igb_main.c:6190:17: sparse: sparse: undefined identifier
'ptp_clock_event'
> drivers/staging/igb_avb/igb_main.c:7871:37: sparse: sparse: cast
to restricted __be16
> drivers/staging/igb_avb/igb_main.c:7871:37: sparse: sparse: cast to restricted
__be16
> drivers/staging/igb_avb/igb_main.c:7871:37: sparse: sparse: cast to restricted
__be16
> drivers/staging/igb_avb/igb_main.c:7871:37: sparse: sparse: cast to restricted
__be16
> drivers/staging/igb_avb/igb_main.c:7871:35: sparse: sparse: incorrect type in
assignment (different base types) @@ expected restricted __be16 [usertype] tot_len @@
got int @@
drivers/staging/igb_avb/igb_main.c:7871:35: sparse: expected
restricted __be16 [usertype] tot_len
drivers/staging/igb_avb/igb_main.c:7871:35: sparse: got int
drivers/staging/igb_avb/igb_main.c:8238:31: sparse: sparse: cast to restricted __be16
drivers/staging/igb_avb/igb_main.c:8238:31: sparse: sparse: cast to restricted __be16
drivers/staging/igb_avb/igb_main.c:8238:31: sparse: sparse: cast to restricted __be16
drivers/staging/igb_avb/igb_main.c:8238:31: sparse: sparse: cast to restricted __be16
drivers/staging/igb_avb/igb_main.c: note: in included file (through
include/linux/bitops.h, include/linux/kernel.h, include/linux/list.h, ...):
arch/alpha/include/asm/bitops.h:380:13: sparse: sparse: undefined identifier
'__builtin_alpha_cmpbge'
arch/alpha/include/asm/bitops.h:382:13: sparse: sparse: undefined identifier
'__builtin_alpha_extbl'
drivers/staging/igb_avb/igb_main.c: note: in included file (through
include/uapi/linux/swab.h, include/linux/swab.h,
include/uapi/linux/byteorder/little_endian.h, ...):
arch/alpha/include/uapi/asm/swab.h:29:14: sparse: sparse: undefined identifier
'__builtin_alpha_inslh'
arch/alpha/include/uapi/asm/swab.h:30:14: sparse: sparse: undefined identifier
'__builtin_alpha_inswl'
In file included from include/linux/sctp.h:57,
from drivers/staging/igb_avb/igb.h:64,
from drivers/staging/igb_avb/igb_main.c:69:
include/uapi/linux/sctp.h:390:1: warning: alignment 4 of 'struct
sctp_paddr_change' is less than 8 [-Wpacked-not-aligned]
390 | } __attribute__((packed, aligned(4)));
| ^
include/uapi/linux/sctp.h:719:1: warning: alignment 4 of 'struct
sctp_setpeerprim' is less than 8 [-Wpacked-not-aligned]
719 | } __attribute__((packed, aligned(4)));
| ^
include/uapi/linux/sctp.h:718:33: warning: 'sspp_addr' offset 4 in 'struct
sctp_setpeerprim' isn't aligned to 8 [-Wpacked-not-aligned]
718 | struct sockaddr_storage sspp_addr;
| ^~~~~~~~~
include/uapi/linux/sctp.h:732:1: warning: alignment 4 of 'struct sctp_prim' is
less than 8 [-Wpacked-not-aligned]
732 | } __attribute__((packed, aligned(4)));
| ^
include/uapi/linux/sctp.h:731:33: warning: 'ssp_addr' offset 4 in 'struct
sctp_prim' isn't aligned to 8 [-Wpacked-not-aligned]
731 | struct sockaddr_storage ssp_addr;
| ^~~~~~~~
include/uapi/linux/sctp.h:783:1: warning: alignment 4 of 'struct
sctp_paddrparams' is less than 8 [-Wpacked-not-aligned]
783 | } __attribute__((packed, aligned(4)));
| ^
include/uapi/linux/sctp.h:775:33: warning: 'spp_address' offset 4 in
'struct sctp_paddrparams' isn't aligned to 8 [-Wpacked-not-aligned]
775 | struct sockaddr_storage spp_address;
| ^~~~~~~~~~~
include/uapi/linux/sctp.h:896:1: warning: alignment 4 of 'struct
sctp_paddrinfo' is less than 8 [-Wpacked-not-aligned]
896 | } __attribute__((packed, aligned(4)));
| ^
include/uapi/linux/sctp.h:890:33: warning: 'spinfo_address' offset 4 in
'struct sctp_paddrinfo' isn't aligned to 8 [-Wpacked-not-aligned]
890 | struct sockaddr_storage spinfo_address;
| ^~~~~~~~~~~~~~
drivers/staging/igb_avb/igb_main.c: In function 'igb_check_swap_media':
drivers/staging/igb_avb/igb_main.c:1648:14: warning: variable 'link' set but
not used [-Wunused-but-set-variable]
1648 | bool link;
| ^~~~
drivers/staging/igb_avb/igb_main.c: At top level:
drivers/staging/igb_avb/igb_main.c:1950:6: warning: no previous prototype for
'igb_enable_mas' [-Wmissing-prototypes]
1950 | void igb_enable_mas(struct igb_adapter *adapter)
| ^~~~~~~~~~~~~~
drivers/staging/igb_avb/igb_main.c:2589:6: warning: no previous prototype for
'igb_rar_set' [-Wmissing-prototypes]
2589 | void igb_rar_set(struct igb_adapter *adapter, u32 index)
| ^~~~~~~~~~~
drivers/staging/igb_avb/igb_main.c: In function 'igb_clean_tx_ring':
drivers/staging/igb_avb/igb_main.c:4213:31: error: implicit declaration of function
'txring_txq' [-Werror=implicit-function-declaration]
4213 | netdev_tx_reset_queue(txring_txq(tx_ring));
| ^~~~~~~~~~
drivers/staging/igb_avb/igb_main.c:4213:31: warning: passing argument 1 of
'netdev_tx_reset_queue' makes pointer from integer without a cast
[-Wint-conversion]
4213 | netdev_tx_reset_queue(txring_txq(tx_ring));
| ^~~~~~~~~~~~~~~~~~~
| |
| int
In file included from drivers/staging/igb_avb/igb_main.c:48:
include/linux/netdevice.h:3299:63: note: expected 'struct netdev_queue *' but
argument is of type 'int'
3299 | static inline void netdev_tx_reset_queue(struct netdev_queue *q)
| ~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/igb_avb/igb_main.c: At top level:
drivers/staging/igb_avb/igb_main.c:4445:6: warning: no previous prototype for
'igb_full_sync_mac_table' [-Wmissing-prototypes]
4445 | void igb_full_sync_mac_table(struct igb_adapter *adapter)
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/staging/igb_avb/igb_main.c:4454:6: warning: no previous prototype for
'igb_sync_mac_table' [-Wmissing-prototypes]
4454 | void igb_sync_mac_table(struct igb_adapter *adapter)
| ^~~~~~~~~~~~~~~~~~
drivers/staging/igb_avb/igb_main.c:5265:6: warning: no previous prototype for
'igb_tx_ctxtdesc' [-Wmissing-prototypes]
5265 | void igb_tx_ctxtdesc(struct igb_ring *tx_ring, u32 vlan_macip_lens,
| ^~~~~~~~~~~~~~~
drivers/staging/igb_avb/igb_main.c: In function 'igb_tx_map':
drivers/staging/igb_avb/igb_main.c:5562:30: warning: passing argument 1 of
'netdev_tx_sent_queue' makes pointer from integer without a cast
[-Wint-conversion]
5562 | netdev_tx_sent_queue(txring_txq(tx_ring), first->bytecount);
| ^~~~~~~~~~~~~~~~~~~
| |
| int
In file included from drivers/staging/igb_avb/igb_main.c:48:
include/linux/netdevice.h:3221:62: note: expected 'struct netdev_queue *' but
argument is of type 'int'
3221 | static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
drivers/staging/igb_avb/igb_main.c: In function 'igb_tsync_interrupt':
drivers/staging/igb_avb/igb_main.c:6126:32: error: storage size of 'event'
isn't known
6126 | struct ptp_clock_event event;
| ^~~~~
drivers/staging/igb_avb/igb_main.c:6131:30: error: 'PTP_CLOCK_PPS' undeclared
(first use in this function)
6131 | event.type = PTP_CLOCK_PPS;
| ^~~~~~~~~~~~~
drivers/staging/igb_avb/igb_main.c:6131:30: note: each undeclared identifier is
reported only once for each function it appears in
drivers/staging/igb_avb/igb_main.c:6132:28: error: 'struct igb_adapter' has no
member named 'ptp_caps'
6132 | if (adapter->ptp_caps.pps)
| ^~
drivers/staging/igb_avb/igb_main.c:6133:25: error: implicit declaration of function
'ptp_clock_event' [-Werror=implicit-function-declaration]
6133 | ptp_clock_event(adapter->ptp_clock, &event);
| ^~~~~~~~~~~~~~~
vim +306 drivers/staging/igb_avb/igb_main.c
34ea8dc24190e2 Vyas, Tarun 2018-09-05 297
34ea8dc24190e2 Vyas, Tarun 2018-09-05 298 static void igb_init_fw(struct igb_adapter
*adapter);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 299 static void igb_init_dmac(struct igb_adapter
*adapter, u32 pba);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 300 /* user-mode IO API registrations */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 301 static struct file_operations igb_fops = {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 302 .owner = THIS_MODULE,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 303 .llseek = no_llseek,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 304 .read = igb_read,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 305 .write = igb_write,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 @306 .poll = igb_pollfd,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 307 .open = igb_open_file,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 308 .release = igb_close_file,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 309 .mmap = igb_mmap,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 310 .unlocked_ioctl = igb_ioctl_file,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 311 #if defined(CONFIG_IGB_SUPPORT_32BIT_IOCTL)
34ea8dc24190e2 Vyas, Tarun 2018-09-05 312 .compat_ioctl = igb_ioctl_file,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 313 #endif
34ea8dc24190e2 Vyas, Tarun 2018-09-05 314 };
34ea8dc24190e2 Vyas, Tarun 2018-09-05 315
34ea8dc24190e2 Vyas, Tarun 2018-09-05 316 static struct miscdevice igb_miscdev = {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 317 .minor = MISC_DYNAMIC_MINOR,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 318 .name = "igb_avb",
34ea8dc24190e2 Vyas, Tarun 2018-09-05 319 .fops = &igb_fops,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 320 };
34ea8dc24190e2 Vyas, Tarun 2018-09-05 321
34ea8dc24190e2 Vyas, Tarun 2018-09-05 322 static struct pci_driver igb_driver = {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 323 .name = igb_driver_name,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 324 .id_table = igb_pci_tbl,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 325 .probe = igb_probe,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 326 .remove = __devexit_p(igb_remove),
34ea8dc24190e2 Vyas, Tarun 2018-09-05 327 #ifdef CONFIG_PM
34ea8dc24190e2 Vyas, Tarun 2018-09-05 328 #ifdef HAVE_SYSTEM_SLEEP_PM_OPS
34ea8dc24190e2 Vyas, Tarun 2018-09-05 329 .driver.pm = &igb_pm_ops,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 330 #else
34ea8dc24190e2 Vyas, Tarun 2018-09-05 331 .suspend = igb_suspend,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 332 .resume = igb_resume,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 333 #endif /* HAVE_SYSTEM_SLEEP_PM_OPS */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 334 #endif /* CONFIG_PM */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 335 #ifndef USE_REBOOT_NOTIFIER
34ea8dc24190e2 Vyas, Tarun 2018-09-05 336 .shutdown = igb_shutdown,
34ea8dc24190e2 Vyas, Tarun 2018-09-05 337 #endif
34ea8dc24190e2 Vyas, Tarun 2018-09-05 338 #ifdef HAVE_PCI_ERS
34ea8dc24190e2 Vyas, Tarun 2018-09-05 339 .err_handler = &igb_err_handler
34ea8dc24190e2 Vyas, Tarun 2018-09-05 340 #endif
34ea8dc24190e2 Vyas, Tarun 2018-09-05 341 };
34ea8dc24190e2 Vyas, Tarun 2018-09-05 342
34ea8dc24190e2 Vyas, Tarun 2018-09-05 343 /* u32 e1000_read_reg(struct e1000_hw *hw, u32
reg); */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 344
34ea8dc24190e2 Vyas, Tarun 2018-09-05 345 MODULE_AUTHOR("Intel Corporation,
<e1000-devel(a)lists.sourceforge.net>");
34ea8dc24190e2 Vyas, Tarun 2018-09-05 346 MODULE_DESCRIPTION("Intel(R) Gigabit
Ethernet Network Driver");
34ea8dc24190e2 Vyas, Tarun 2018-09-05 347 MODULE_LICENSE("GPL");
34ea8dc24190e2 Vyas, Tarun 2018-09-05 348 MODULE_VERSION(DRV_VERSION);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 349
34ea8dc24190e2 Vyas, Tarun 2018-09-05 350 static void igb_vfta_set(struct igb_adapter
*adapter, u32 vid, bool add)
34ea8dc24190e2 Vyas, Tarun 2018-09-05 351 {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 352 struct e1000_hw *hw = &adapter->hw;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 353 struct e1000_host_mng_dhcp_cookie *mng_cookie
= &hw->mng_cookie;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 354 u32 index = (vid >>
E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 355 u32 mask = 1 << (vid &
E1000_VFTA_ENTRY_BIT_SHIFT_MASK);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 356 u32 vfta;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 357
34ea8dc24190e2 Vyas, Tarun 2018-09-05 358 /*
34ea8dc24190e2 Vyas, Tarun 2018-09-05 359 * if this is the management vlan the only
option is to add it in so
34ea8dc24190e2 Vyas, Tarun 2018-09-05 360 * that the management pass through will
continue to work
34ea8dc24190e2 Vyas, Tarun 2018-09-05 361 */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 362 if ((mng_cookie->status &
E1000_MNG_DHCP_COOKIE_STATUS_VLAN) &&
34ea8dc24190e2 Vyas, Tarun 2018-09-05 363 (vid == mng_cookie->vlan_id))
34ea8dc24190e2 Vyas, Tarun 2018-09-05 364 add = TRUE;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 365
34ea8dc24190e2 Vyas, Tarun 2018-09-05 366 vfta = adapter->shadow_vfta[index];
34ea8dc24190e2 Vyas, Tarun 2018-09-05 367
34ea8dc24190e2 Vyas, Tarun 2018-09-05 368 if (add)
34ea8dc24190e2 Vyas, Tarun 2018-09-05 369 vfta |= mask;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 370 else
34ea8dc24190e2 Vyas, Tarun 2018-09-05 371 vfta &= ~mask;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 372
34ea8dc24190e2 Vyas, Tarun 2018-09-05 373 e1000_write_vfta(hw, index, vfta);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 374 adapter->shadow_vfta[index] = vfta;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 375 }
34ea8dc24190e2 Vyas, Tarun 2018-09-05 376
34ea8dc24190e2 Vyas, Tarun 2018-09-05 377 static int debug = NETIF_MSG_DRV |
NETIF_MSG_PROBE;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 378 module_param(debug, int, 0);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 379 MODULE_PARM_DESC(debug, "Debug level
(0=none, ..., 16=all)");
34ea8dc24190e2 Vyas, Tarun 2018-09-05 380
34ea8dc24190e2 Vyas, Tarun 2018-09-05 381
34ea8dc24190e2 Vyas, Tarun 2018-09-05 382 static int tx_size = 256; /*default value*/
34ea8dc24190e2 Vyas, Tarun 2018-09-05 383 module_param(tx_size, int, 0);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 384 MODULE_PARM_DESC(tx_size, "Tx Ring size
passed in insmod parameter");
34ea8dc24190e2 Vyas, Tarun 2018-09-05 385 /**
34ea8dc24190e2 Vyas, Tarun 2018-09-05 386 * igb_init_module - Driver Registration
Routine
34ea8dc24190e2 Vyas, Tarun 2018-09-05 387 *
34ea8dc24190e2 Vyas, Tarun 2018-09-05 388 * igb_init_module is the first routine called
when the driver is
34ea8dc24190e2 Vyas, Tarun 2018-09-05 389 * loaded. All it does is register with the
PCI subsystem.
34ea8dc24190e2 Vyas, Tarun 2018-09-05 390 **/
34ea8dc24190e2 Vyas, Tarun 2018-09-05 391 static int __init igb_init_module(void)
34ea8dc24190e2 Vyas, Tarun 2018-09-05 392 {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 393 int ret;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 394
34ea8dc24190e2 Vyas, Tarun 2018-09-05 395 pr_info("%s - version %s\n",
34ea8dc24190e2 Vyas, Tarun 2018-09-05 396 igb_driver_string,
igb_driver_version);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 397
34ea8dc24190e2 Vyas, Tarun 2018-09-05 398 pr_info("%s\n", igb_copyright);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 399 #ifdef IGB_HWMON
34ea8dc24190e2 Vyas, Tarun 2018-09-05 400 /* only use IGB_PROCFS if IGB_HWMON is not
defined */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 401 #else
34ea8dc24190e2 Vyas, Tarun 2018-09-05 402 #ifdef IGB_PROCFS
34ea8dc24190e2 Vyas, Tarun 2018-09-05 403 if (igb_procfs_topdir_init())
34ea8dc24190e2 Vyas, Tarun 2018-09-05 404 pr_info("Procfs failed to initialize
topdir\n");
34ea8dc24190e2 Vyas, Tarun 2018-09-05 405 #endif /* IGB_PROCFS */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 406 #endif /* IGB_HWMON */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 407
34ea8dc24190e2 Vyas, Tarun 2018-09-05 408 #ifdef IGB_DCA
34ea8dc24190e2 Vyas, Tarun 2018-09-05 409 dca_register_notify(&dca_notifier);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 410 #endif
34ea8dc24190e2 Vyas, Tarun 2018-09-05 411 misc_register(&igb_miscdev);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 412 ret = pci_register_driver(&igb_driver);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 413 #ifdef USE_REBOOT_NOTIFIER
34ea8dc24190e2 Vyas, Tarun 2018-09-05 414 if (ret >= 0)
34ea8dc24190e2 Vyas, Tarun 2018-09-05 415
register_reboot_notifier(&igb_notifier_reboot);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 416 #endif
34ea8dc24190e2 Vyas, Tarun 2018-09-05 417 return ret;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 418 }
34ea8dc24190e2 Vyas, Tarun 2018-09-05 419
34ea8dc24190e2 Vyas, Tarun 2018-09-05 420 module_init(igb_init_module);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 421
34ea8dc24190e2 Vyas, Tarun 2018-09-05 422 /**
34ea8dc24190e2 Vyas, Tarun 2018-09-05 423 * igb_exit_module - Driver Exit Cleanup
Routine
34ea8dc24190e2 Vyas, Tarun 2018-09-05 424 *
34ea8dc24190e2 Vyas, Tarun 2018-09-05 425 * igb_exit_module is called just before the
driver is removed
34ea8dc24190e2 Vyas, Tarun 2018-09-05 426 * from memory.
34ea8dc24190e2 Vyas, Tarun 2018-09-05 427 **/
34ea8dc24190e2 Vyas, Tarun 2018-09-05 428 static void __exit igb_exit_module(void)
34ea8dc24190e2 Vyas, Tarun 2018-09-05 429 {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 430 #ifdef IGB_DCA
34ea8dc24190e2 Vyas, Tarun 2018-09-05 431 dca_unregister_notify(&dca_notifier);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 432 #endif
34ea8dc24190e2 Vyas, Tarun 2018-09-05 433 #ifdef USE_REBOOT_NOTIFIER
34ea8dc24190e2 Vyas, Tarun 2018-09-05 434
unregister_reboot_notifier(&igb_notifier_reboot);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 435 #endif
34ea8dc24190e2 Vyas, Tarun 2018-09-05 436 misc_deregister(&igb_miscdev);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 437 pci_unregister_driver(&igb_driver);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 438
34ea8dc24190e2 Vyas, Tarun 2018-09-05 439 #ifdef IGB_HWMON
34ea8dc24190e2 Vyas, Tarun 2018-09-05 440 /* only compile IGB_PROCFS if IGB_HWMON is not
defined */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 441 #else
34ea8dc24190e2 Vyas, Tarun 2018-09-05 442 #ifdef IGB_PROCFS
34ea8dc24190e2 Vyas, Tarun 2018-09-05 443 igb_procfs_topdir_exit();
34ea8dc24190e2 Vyas, Tarun 2018-09-05 444 #endif /* IGB_PROCFS */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 445 #endif /* IGB_HWMON */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 446 }
34ea8dc24190e2 Vyas, Tarun 2018-09-05 447
34ea8dc24190e2 Vyas, Tarun 2018-09-05 448 module_exit(igb_exit_module);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 449
34ea8dc24190e2 Vyas, Tarun 2018-09-05 450 #define Q_IDX_82576(i) (((i & 0x1)
<< 3) + (i >> 1))
34ea8dc24190e2 Vyas, Tarun 2018-09-05 451 /**
34ea8dc24190e2 Vyas, Tarun 2018-09-05 452 * igb_cache_ring_register - Descriptor ring
to register mapping
34ea8dc24190e2 Vyas, Tarun 2018-09-05 453 * @adapter: board private structure to
initialize
34ea8dc24190e2 Vyas, Tarun 2018-09-05 454 *
34ea8dc24190e2 Vyas, Tarun 2018-09-05 455 * Once we know the feature-set enabled for
the device, we'll cache
34ea8dc24190e2 Vyas, Tarun 2018-09-05 456 * the register offset the descriptor ring is
assigned to.
34ea8dc24190e2 Vyas, Tarun 2018-09-05 457 **/
34ea8dc24190e2 Vyas, Tarun 2018-09-05 458 static void igb_cache_ring_register(struct
igb_adapter *adapter)
34ea8dc24190e2 Vyas, Tarun 2018-09-05 459 {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 460 int i = 0, j = 0;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 461 u32 rbase_offset =
adapter->vfs_allocated_count;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 462
34ea8dc24190e2 Vyas, Tarun 2018-09-05 463 for (; i < adapter->num_rx_queues;
i++)
34ea8dc24190e2 Vyas, Tarun 2018-09-05 464 adapter->rx_ring[i]->reg_idx =
rbase_offset + i;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 465 for (; j < adapter->num_tx_queues;
j++)
34ea8dc24190e2 Vyas, Tarun 2018-09-05 466 adapter->tx_ring[j]->reg_idx =
rbase_offset + j;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 467 }
34ea8dc24190e2 Vyas, Tarun 2018-09-05 468
34ea8dc24190e2 Vyas, Tarun 2018-09-05 469 u32 e1000_read_reg(struct e1000_hw *hw, u32
reg)
34ea8dc24190e2 Vyas, Tarun 2018-09-05 470 {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 471 struct igb_adapter *igb = container_of(hw,
struct igb_adapter, hw);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 472 u8 __iomem *hw_addr =
READ_ONCE(hw->hw_addr);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 473 u32 value = 0;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 474
34ea8dc24190e2 Vyas, Tarun 2018-09-05 475 if (E1000_REMOVED(hw_addr))
34ea8dc24190e2 Vyas, Tarun 2018-09-05 476 return ~value;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 477
34ea8dc24190e2 Vyas, Tarun 2018-09-05 478 value = readl(&hw_addr[reg]);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 479
34ea8dc24190e2 Vyas, Tarun 2018-09-05 480 /* reads should not return all F's */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 481 if (!(~value) && (!reg ||
!(~readl(hw_addr)))) {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 482 struct net_device *netdev = igb->netdev;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 483
34ea8dc24190e2 Vyas, Tarun 2018-09-05 484 hw->hw_addr = NULL;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 485 netif_device_detach(netdev);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 486 netdev_err(netdev, "PCIe link lost,
device now detached\n");
34ea8dc24190e2 Vyas, Tarun 2018-09-05 487 }
34ea8dc24190e2 Vyas, Tarun 2018-09-05 488
34ea8dc24190e2 Vyas, Tarun 2018-09-05 489 return value;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 490 }
34ea8dc24190e2 Vyas, Tarun 2018-09-05 491
34ea8dc24190e2 Vyas, Tarun 2018-09-05 492 static void igb_configure_lli(struct
igb_adapter *adapter)
34ea8dc24190e2 Vyas, Tarun 2018-09-05 493 {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 494 struct e1000_hw *hw = &adapter->hw;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 495 u16 port;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 496
34ea8dc24190e2 Vyas, Tarun 2018-09-05 497 /* LLI should only be enabled for MSI-X or
MSI interrupts */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 498 if (!adapter->msix_entries &&
!(adapter->flags & IGB_FLAG_HAS_MSI))
34ea8dc24190e2 Vyas, Tarun 2018-09-05 499 return;
34ea8dc24190e2 Vyas, Tarun 2018-09-05 500
34ea8dc24190e2 Vyas, Tarun 2018-09-05 501 if (adapter->lli_port) {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 502 /* use filter 0 for port */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 @503 port = htons((u16)adapter->lli_port);
34ea8dc24190e2 Vyas, Tarun 2018-09-05 504 E1000_WRITE_REG(hw, E1000_IMIR(0),
34ea8dc24190e2 Vyas, Tarun 2018-09-05 505 (port | E1000_IMIR_PORT_IM_EN));
34ea8dc24190e2 Vyas, Tarun 2018-09-05 506 E1000_WRITE_REG(hw, E1000_IMIREXT(0),
34ea8dc24190e2 Vyas, Tarun 2018-09-05 507 (E1000_IMIREXT_SIZE_BP |
E1000_IMIREXT_CTRL_BP));
34ea8dc24190e2 Vyas, Tarun 2018-09-05 508 }
34ea8dc24190e2 Vyas, Tarun 2018-09-05 509
34ea8dc24190e2 Vyas, Tarun 2018-09-05 510 if (adapter->flags &
IGB_FLAG_LLI_PUSH) {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 511 /* use filter 1 for push flag */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 512 E1000_WRITE_REG(hw, E1000_IMIR(1),
34ea8dc24190e2 Vyas, Tarun 2018-09-05 513 (E1000_IMIR_PORT_BP |
E1000_IMIR_PORT_IM_EN));
34ea8dc24190e2 Vyas, Tarun 2018-09-05 514 E1000_WRITE_REG(hw, E1000_IMIREXT(1),
34ea8dc24190e2 Vyas, Tarun 2018-09-05 515 (E1000_IMIREXT_SIZE_BP |
E1000_IMIREXT_CTRL_PSH));
34ea8dc24190e2 Vyas, Tarun 2018-09-05 516 }
34ea8dc24190e2 Vyas, Tarun 2018-09-05 517
34ea8dc24190e2 Vyas, Tarun 2018-09-05 518 if (adapter->lli_size) {
34ea8dc24190e2 Vyas, Tarun 2018-09-05 519 /* use filter 2 for size */
34ea8dc24190e2 Vyas, Tarun 2018-09-05 520 E1000_WRITE_REG(hw, E1000_IMIR(2),
34ea8dc24190e2 Vyas, Tarun 2018-09-05 521 (E1000_IMIR_PORT_BP |
E1000_IMIR_PORT_IM_EN));
34ea8dc24190e2 Vyas, Tarun 2018-09-05 522 E1000_WRITE_REG(hw, E1000_IMIREXT(2),
34ea8dc24190e2 Vyas, Tarun 2018-09-05 523 (adapter->lli_size |
E1000_IMIREXT_CTRL_BP));
34ea8dc24190e2 Vyas, Tarun 2018-09-05 524 }
34ea8dc24190e2 Vyas, Tarun 2018-09-05 525
:::::: The code at line 306 was first introduced by commit
:::::: 34ea8dc24190e2a6708fa89231618fe2e92702c5 staging: Add AVnu based Intel IGB driver
:::::: TO: Vyas, Tarun <tarun.vyas(a)intel.com>
:::::: CC: Pan, Kris <kris.pan(a)intel.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org