NTB bug fixes to address an incorrect ntb_mw_count reference in the NTB

transport, improperly bringing down the link if SPADs are corrupted, and
 an out-of-order issue regarding link negotiation and data passing.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJZokFeAAoJEG5mS6x6i9IjwS8P/1fFjRt6q4Xr+/PGgYZzY+OH
 7Rnbhx89PuWECJuh0k2r2L0R4IsXueejTRkQyjE++AffwcuidnYdgHZwSUSgA3MR
 PuOXNA7PCRe1DW6BDe+Uvwigx+RUlQltQFihopi9YITu667/YlSNu2MWplpQxbTo
 RKDh2WhiI5SGsFtfS1CPkxtcvOqJEelR5yFuT6LUazw7EYbpjWBiRwTx5SovcncV
 bmLQEPSvOe1+HMJza1kBXr/UrnwryGz1CeoIWQk42bJePCedzMQpNxz/K9r3gol2
 Eem9Zbn+f5fAaogQiDAXi7aTObqf5LqzN3XdJjmKBq5buGGEt5+HUTkzWpYnvrlL
 M2kjc8NnxBb8Nx5BsTlOhUgvT81vCVJL25QFv5tN903Bc4qQG6/DXwqcLGIKszJ4
 rZw1n4dm0eWq4lPbUSLC8hKj6aV2yIwA1+nI7hbuky6vmX0rNxSHe/RRQsjUFIoP
 0NNDZGuIUGHJQuVeg9xaH6EOGi0xQdfZ/rXFoTaPW7JrDr7C4gAbVQYnGt/wJwvz
 cnmix+nS70VfZAW0JD9z4Qax3yyVbosQpYFMEwNfGcWqQ36A6tm0pzDpmb5M5tQp
 K90kBpfEUMETeH+vqMdc0c8Rn2mgu/YH/AOXdsyeYAqo/b9iLDztBPXJjWUcoGeB
 u68MYTfE+n1RUsycafn4
 =qmzC
 -----END PGP SIGNATURE-----

Merge tag 'ntb-4.13-bugfixes' of git://github.com/jonmason/ntb

Pull NTB fixes from Jon Mason:
 "NTB bug fixes to address an incorrect ntb_mw_count reference in the
  NTB transport, improperly bringing down the link if SPADs are
  corrupted, and an out-of-order issue regarding link negotiation and
  data passing"

* tag 'ntb-4.13-bugfixes' of git://github.com/jonmason/ntb:
  ntb: ntb_test: ensure the link is up before trying to configure the mws
  ntb: transport shouldn't disable link due to bogus values in SPADs
  ntb: use correct mw_count function in ntb_tool and ntb_transport
This commit is contained in:
Linus Torvalds 2017-08-27 17:01:54 -07:00
commit fff4e7a0e6
3 changed files with 7 additions and 5 deletions

View File

@ -924,10 +924,8 @@ out1:
ntb_free_mw(nt, i); ntb_free_mw(nt, i);
/* if there's an actual failure, we should just bail */ /* if there's an actual failure, we should just bail */
if (rc < 0) { if (rc < 0)
ntb_link_disable(ndev);
return; return;
}
out: out:
if (ntb_link_is_up(ndev, NULL, NULL) == 1) if (ntb_link_is_up(ndev, NULL, NULL) == 1)
@ -1059,7 +1057,7 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
int node; int node;
int rc, i; int rc, i;
mw_count = ntb_mw_count(ndev, PIDX); mw_count = ntb_peer_mw_count(ndev);
if (!ndev->ops->mw_set_trans) { if (!ndev->ops->mw_set_trans) {
dev_err(&ndev->dev, "Inbound MW based NTB API is required\n"); dev_err(&ndev->dev, "Inbound MW based NTB API is required\n");

View File

@ -959,7 +959,7 @@ static int tool_probe(struct ntb_client *self, struct ntb_dev *ntb)
tc->ntb = ntb; tc->ntb = ntb;
init_waitqueue_head(&tc->link_wq); init_waitqueue_head(&tc->link_wq);
tc->mw_count = min(ntb_mw_count(tc->ntb, PIDX), MAX_MWS); tc->mw_count = min(ntb_peer_mw_count(tc->ntb), MAX_MWS);
for (i = 0; i < tc->mw_count; i++) { for (i = 0; i < tc->mw_count; i++) {
rc = tool_init_mw(tc, i); rc = tool_init_mw(tc, i);
if (rc) if (rc)

View File

@ -333,6 +333,10 @@ function ntb_tool_tests()
link_test $LOCAL_TOOL $REMOTE_TOOL link_test $LOCAL_TOOL $REMOTE_TOOL
link_test $REMOTE_TOOL $LOCAL_TOOL link_test $REMOTE_TOOL $LOCAL_TOOL
#Ensure the link is up on both sides before continuing
write_file Y $LOCAL_TOOL/link_event
write_file Y $REMOTE_TOOL/link_event
for PEER_TRANS in $(ls $LOCAL_TOOL/peer_trans*); do for PEER_TRANS in $(ls $LOCAL_TOOL/peer_trans*); do
PT=$(basename $PEER_TRANS) PT=$(basename $PEER_TRANS)
write_file $MW_SIZE $LOCAL_TOOL/$PT write_file $MW_SIZE $LOCAL_TOOL/$PT