Skip to contentSkip to conversation

net/smc: fixes 2020-11-18

PATCH Applied Karsten Graul 2 participants 4 messages Nov 18, 2020 – Nov 19, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover net/smc: fixes 2020-11-18

Please apply the following patch series for smc to netdev's net tree.

Patch 1 fixes the matching of link groups because with SMC-Dv2 the vlanid should no longer be part of this matching. Patch 2 removes a sparse message.

Karsten Graul (2):
net/smc: fix matching of existing link groups net/smc: fix direct access to ib_gid_addr->ndev in
smc_ib_determine_gid()

 net/smc/af_smc.c   | 3 ++-
 net/smc/smc_core.c | 3 ++-
 net/smc/smc_ib.c   | 6 +++---
 3 files changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 net/smc: fix matching of existing link groups

With the multi-subnet support of SMC-Dv2 the match for existing link groups should not include the vlanid of the network device. Set ini->smcd_version accordingly before the call to smc_conn_create() and use this value in smc_conn_create() to skip the vlanid check.

Fixes 5c21c4ccafe8 ("net/smc: determine accepted ISM devices")
---
 net/smc/af_smc.c   | 3 ++-
 net/smc/smc_core.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
net/smc/af_smc.c +2 -1
index e9f487c8c6d5..5dd4faaf7d6e 100644
@@ -979,7 +979,8 @@ static int __smc_connect(struct smc_sock *smc)
 
 	/* check if smc modes and versions of CLC proposal and accept match */
 	rc = smc_connect_check_aclc(ini, aclc);
-	version = aclc->hdr.version == SMC_V1 ? SMC_V1 : version;
+	version = aclc->hdr.version == SMC_V1 ? SMC_V1 : SMC_V2;
+	ini->smcd_version = version;
 	if (rc)
 		goto vlan_cleanup;
 
net/smc/smc_core.c +2 -1
index 2b19863f7171..af96f813c075 100644
@@ -1309,7 +1309,8 @@ int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini)
 				    ini->ism_peer_gid[ini->ism_selected]) :
 		     smcr_lgr_match(lgr, ini->ib_lcl, role, ini->ib_clcqpn)) &&
 		    !lgr->sync_err &&
-		    lgr->vlan_id == ini->vlan_id &&
+		    (ini->smcd_version == SMC_V2 ||
+		     lgr->vlan_id == ini->vlan_id) &&
 		    (role == SMC_CLNT || ini->is_smcd ||
 		     lgr->conns_num < SMC_RMBS_PER_LGR_MAX)) {
 			/* link group found */
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 net/smc: fix direct access to ib_gid_addr->ndev in smc_ib_determine_gid()

In reply to Karsten Graul

Sparse complaints 3 times about:
net/smc/smc_ib.c:203:52: warning: incorrect type in argument 1 (different address spaces)
net/smc/smc_ib.c:203:52: expected struct net_device const *dev
net/smc/smc_ib.c:203:52: got struct net_device [noderef] __rcu *const ndev

Fix that by using the existing and validated ndev variable instead of accessing attr->ndev directly.

Fixes 5102eca9039b ("net/smc: Use rdma_read_gid_l2_fields to L2 fields")
---
 net/smc/smc_ib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/smc/smc_ib.c +3 -3
index 1c314dbdc7fa..fc766b537ac7 100644
@@ -198,9 +198,9 @@ int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
 		rcu_read_lock();
 		ndev = rdma_read_gid_attr_ndev_rcu(attr);
 		if (!IS_ERR(ndev) &&
-		    ((!vlan_id && !is_vlan_dev(attr->ndev)) ||
-		     (vlan_id && is_vlan_dev(attr->ndev) &&
-		      vlan_dev_vlan_id(attr->ndev) == vlan_id)) &&
+		    ((!vlan_id && !is_vlan_dev(ndev)) ||
+		     (vlan_id && is_vlan_dev(ndev) &&
+		      vlan_dev_vlan_id(ndev) == vlan_id)) &&
 		    attr->gid_type == IB_GID_TYPE_ROCE) {
 			rcu_read_unlock();
 			if (gid)
Signature · 1 line
2.17.1
#3 lore raw
In reply to Karsten Graul
This series was applied to netdev/net.git (refs/heads/master):

Hello:

This series was applied to netdev/net.git (refs/heads/master):

Quoted 11 lines · On Wed, 18 Nov 2020 22:40:36 +0100 you wrote:

Please apply the following patch series for smc to netdev's net tree.

Patch 1 fixes the matching of link groups because with SMC-Dv2 the vlanid should no longer be part of this matching. Patch 2 removes a sparse message.

Karsten Graul (2):
net/smc: fix matching of existing link groups net/smc: fix direct access to ib_gid_addr->ndev in
smc_ib_determine_gid()

[...]

Here is the summary with links:
- [net,1/2] net/smc: fix matching of existing link groups

    https://git.kernel.org/netdev/net/c/0530bd6e6a3d
  - [net,2/2] net/smc: fix direct access to ib_gid_addr->ndev in smc_ib_determine_gid()
    https://git.kernel.org/netdev/net/c/41a0be3f8f6b

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html