Microsemi / switchtec-kernel

A kernel module for the Microsemi PCIe switch
GNU General Public License v2.0
45 stars 31 forks source link

NTB link cannot up #25

Closed ghost closed 6 years ago

ghost commented 6 years ago

The link_sta is initialized by switchtec_ntb_link_enable() when loading ntb_transport module. Because the peer does not load driver, the ntb link will not be up. When the peer loads the ntb_hw_switchtec module, the switchtec_ntb_reinit_peer() and switchtec_ntb_init_shared_mw() will be called. The link_sta will not be re-initialized. the ntb link cannot be up.

This issue can be reproduced by following test. Test Setup: Host 1 <- -> Switchtec <- -> Host 2

Test Steps:

  1. Load drivers on host 1 modprob ntb insmod switchtec.ko insmod ntb_hw_switchtec,ko modprob ntb_transport modprob ntb_netdev
  2. Load drivers on host 2.
  3. Check the NTB link

Thanks joey

lsgunth commented 6 years ago

Hmm, well the reinit stuff was never properly tested as I don't have a multi-host setup.

I don't think your solution is very good though. For starters, link_sta should be set to 1 or 0 not NTB_SPEED_GEN1.

It should probably be set to the value it was at before the reinit is done. I expect it would also be a good idea to ensure the local spads keep their values too. Which probably means we should rework it so that it sets up the peer's registers and doesn't deallocate/reallocate the shared memory.

ghost commented 6 years ago

Hi Logan,

Thanks for the comment. I updated the fix. please help to review it.

For the local spads, we can rework it later on.

Thanks Joey