b46925a24a
IB/hfi1: Restore kfree in dummy_netdev cleanup
...
We need to do some rework on the dummy netdev. Calling the free_netdev()
would normally make sense, and that will be addressed in an upcoming
patch. For now just revert the behavior to what it was before keeping the
unused variable removal part of the patch.
The dd->dumm_netdev is mainly used for packet receiving through
alloc_netdev_mqs() for typical net devices. A a result, it should be freed
with kfree instead of free_netdev() that leads to a crash when unloading
the hfi1 module:
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 8000000855b54067 P4D 8000000855b54067 PUD 84a4f5067 PMD 0
Oops: 0000 [#1 ] SMP PTI
CPU: 73 PID: 10299 Comm: modprobe Not tainted 5.6.0-rc5+ #1
Hardware name: Intel Corporation S2600WT2R/S2600WT2R, BIOS SE5C610.86B.01.01.0016.033120161139 03/31/2016
RIP: 0010:__hw_addr_flush+0x12/0x80
Code: 40 00 48 83 c4 08 4c 89 e7 5b 5d 41 5c e9 76 77 18 00 66 0f 1f 44 00 00 0f 1f 44 00 00 41 54 49 89 fc 55 53 48 8b 1f 48 39 df <48> 8b 2b 75 08 eb 4a 48 89 eb 48 89 c5 48 89 df e8 99 bf d0 ff 84
RSP: 0018:ffffb40e08783db8 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000002
RDX: ffffb40e00000000 RSI: 0000000000000246 RDI: ffff88ab13662298
RBP: ffff88ab13662000 R08: 0000000000001549 R09: 0000000000001549
R10: 0000000000000001 R11: 0000000000aaaaaa R12: ffff88ab13662298
R13: ffff88ab1b259e20 R14: ffff88ab1b259e42 R15: 0000000000000000
FS: 00007fb39b534740(0000) GS:ffff88b31f940000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000084d3ea004 CR4: 00000000003606e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
dev_addr_flush+0x15/0x30
free_netdev+0x7e/0x130
hfi1_netdev_free+0x59/0x70 [hfi1]
remove_one+0x65/0x110 [hfi1]
pci_device_remove+0x3b/0xc0
device_release_driver_internal+0xec/0x1b0
driver_detach+0x46/0x90
bus_remove_driver+0x58/0xd0
pci_unregister_driver+0x26/0xa0
hfi1_mod_cleanup+0xc/0xd54 [hfi1]
__x64_sys_delete_module+0x16c/0x260
? exit_to_usermode_loop+0xa4/0xc0
do_syscall_64+0x5b/0x200
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fixes: 193ba03141
("IB/hfi1: Use free_netdev() in hfi1_netdev_free()")
Link: https://lore.kernel.org/r/20200623203224.106975.16926.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com >
Signed-off-by: Kaike Wan <kaike.wan@intel.com >
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com >
2020-06-24 15:54:08 -03:00
193ba03141
IB/hfi1: Use free_netdev() in hfi1_netdev_free()
...
dummy_netdev shold be freed by free_netdev() instead of kfree(). Also
remove unneeded variable 'priv'
Fixes: 4730f4a6c6
("IB/hfi1: Activate the dummy netdev")
Link: https://lore.kernel.org/r/20200602061635.31224-1-yuehaibing@huawei.com
Signed-off-by: YueHaibing <yuehaibing@huawei.com >
Reported-by: kbuild test robot <lkp@intel.com >
Reported-by: Dan Carpenter <dan.carpenter@oracle.com >
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-06-02 21:35:03 -03:00
4730f4a6c6
IB/hfi1: Activate the dummy netdev
...
As described in earlier patches, ipoib netdev will share receive
contexts with existing VNIC netdev through a dummy netdev. The
following changes are made to achieve that:
- Set up netdev receive contexts after user contexts. A function is
added to count the available netdev receive contexts.
- Add functions to set/get receive map table free index.
- Rename NUM_VNIC_MAP_ENTRIES as NUM_NETDEV_MAP_ENTRIES.
- Let the dummy netdev own the receive contexts instead of VNIC.
- Allocate the dummy netdev when the hfi1 device is added and free it
when the device is removed.
- Initialize AIP RSM rules when the IpoIb rxq is initialized and
remove the rules when it is de-initialized.
- Convert VNIC to use the dummy netdev.
Link: https://lore.kernel.org/r/20200511160649.173205.4626.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com >
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Sadanand Warrier <sadanand.warrier@intel.com >
Signed-off-by: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 11:23:56 -03:00
370caa5b58
IB/hfi1: Add rx functions for dummy netdev
...
This patch adds the rx functions for the dummy netdev:
- Functions to allocate/free the dummy netdev.
- Functions to allocate/free receiving contexts for the netdev.
- Functions to initialize/de-initialize the receive queue.
- Functions to enable/disable the receive queue.
Link: https://lore.kernel.org/r/20200511160643.173205.75087.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com >
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Sadanand Warrier <sadanand.warrier@intel.com >
Signed-off-by: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Signed-off-by: Kaike Wan <kaike.wan@intel.com >
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 11:23:56 -03:00
6991abcb99
IB/hfi1: Add functions to receive accelerated ipoib packets
...
Ipoib netdev will share receive contexts with existing VNIC netdev.
To achieve that, a dummy netdev is allocated with hfi1_devdata to
own the receive contexts, and ipoib and VNIC netdevs will be put
on top of it. Each receive context is associated with a single
NAPI object.
This patch adds the functions to receive incoming packets for
accelerated ipoib.
Link: https://lore.kernel.org/r/20200511160631.173205.54184.stgit@awfm-01.aw.intel.com
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com >
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Sadanand Warrier <sadanand.warrier@intel.com >
Signed-off-by: Grzegorz Andrejczuk <grzegorz.andrejczuk@intel.com >
Signed-off-by: Kaike Wan <kaike.wan@intel.com >
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com >
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com >
2020-05-21 11:23:56 -03:00