[net-next,v5,7/9] net/smc: support extended GID in SMC-D lgr netlink attribute

Message ID 1702021259-41504-8-git-send-email-guwen@linux.alibaba.com
State New
Headers
Series net/smc: implement SMCv2.1 virtual ISM device support |

Commit Message

Wen Gu Dec. 8, 2023, 7:40 a.m. UTC
  Virtual ISM devices introduced in SMCv2.1 requires a 128 bit extended
GID vs. the existing ISM 64bit GID. So the 2nd 64 bit of extended GID
should be included in SMC-D linkgroup netlink attribute as well.

Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
---
 include/uapi/linux/smc.h      | 2 ++
 include/uapi/linux/smc_diag.h | 2 ++
 net/smc/smc_core.c            | 6 ++++++
 net/smc/smc_diag.c            | 2 ++
 4 files changed, 12 insertions(+)
  

Comments

Alexandra Winter Dec. 11, 2023, 9:39 a.m. UTC | #1
On 08.12.23 08:40, Wen Gu wrote:
> Virtual ISM devices introduced in SMCv2.1 requires a 128 bit extended
> GID vs. the existing ISM 64bit GID. So the 2nd 64 bit of extended GID
> should be included in SMC-D linkgroup netlink attribute as well.
> 
> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
> ---

This patch did not apply cleanly.
Please always base patches on the current net-next
  
Wen Gu Dec. 11, 2023, 10:09 a.m. UTC | #2
On 2023/12/11 17:39, Alexandra Winter wrote:
> 
> 
> On 08.12.23 08:40, Wen Gu wrote:
>> Virtual ISM devices introduced in SMCv2.1 requires a 128 bit extended
>> GID vs. the existing ISM 64bit GID. So the 2nd 64 bit of extended GID
>> should be included in SMC-D linkgroup netlink attribute as well.
>>
>> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
>> ---
> 
> This patch did not apply cleanly.
> Please always base patches on the current net-next

Strange.. I can apply them cleanly with the latest net-next
(6e944cc68633 ("Merge branch 'rswitch-jumbo-frames'")).

Could you please try again? Thanks.
  
Alexandra Winter Dec. 11, 2023, 11:50 a.m. UTC | #3
On 11.12.23 11:09, Wen Gu wrote:
> 
> 
> On 2023/12/11 17:39, Alexandra Winter wrote:
>>
>>
>> On 08.12.23 08:40, Wen Gu wrote:
>>> Virtual ISM devices introduced in SMCv2.1 requires a 128 bit extended
>>> GID vs. the existing ISM 64bit GID. So the 2nd 64 bit of extended GID
>>> should be included in SMC-D linkgroup netlink attribute as well.
>>>
>>> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
>>> ---
>>
>> This patch did not apply cleanly.
>> Please always base patches on the current net-next
> 
> Strange.. I can apply them cleanly with the latest net-next
> (6e944cc68633 ("Merge branch 'rswitch-jumbo-frames'")).
> 
> Could you please try again? Thanks.
> 

Sorry, the patches were somehow re-ordered when I downloaded them from
https://lore.kernel.org/netdev/4ad3a168-f506-fc21-582d-fe8764f404c0@linux.alibaba.com/t.mbox.gz

Everything is ok with this patch.
  

Patch

diff --git a/include/uapi/linux/smc.h b/include/uapi/linux/smc.h
index 837fcd4..b531e3e 100644
--- a/include/uapi/linux/smc.h
+++ b/include/uapi/linux/smc.h
@@ -160,6 +160,8 @@  enum {
 	SMC_NLA_LGR_D_CHID,		/* u16 */
 	SMC_NLA_LGR_D_PAD,		/* flag */
 	SMC_NLA_LGR_D_V2_COMMON,	/* nest */
+	SMC_NLA_LGR_D_EXT_GID,		/* u64 */
+	SMC_NLA_LGR_D_PEER_EXT_GID,	/* u64 */
 	__SMC_NLA_LGR_D_MAX,
 	SMC_NLA_LGR_D_MAX = __SMC_NLA_LGR_D_MAX - 1
 };
diff --git a/include/uapi/linux/smc_diag.h b/include/uapi/linux/smc_diag.h
index 8cb3a6f..58eceb7 100644
--- a/include/uapi/linux/smc_diag.h
+++ b/include/uapi/linux/smc_diag.h
@@ -107,6 +107,8 @@  struct smcd_diag_dmbinfo {		/* SMC-D Socket internals */
 	__aligned_u64	my_gid;		/* My GID */
 	__aligned_u64	token;		/* Token of DMB */
 	__aligned_u64	peer_token;	/* Token of remote DMBE */
+	__aligned_u64	peer_gid_ext;	/* Peer GID (extended part) */
+	__aligned_u64	my_gid_ext;	/* My GID (extended part) */
 };
 
 #endif /* _UAPI_SMC_DIAG_H_ */
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 672eff0..95cc954 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -526,9 +526,15 @@  static int smc_nl_fill_smcd_lgr(struct smc_link_group *lgr,
 	if (nla_put_u64_64bit(skb, SMC_NLA_LGR_D_GID,
 			      smcd_gid.gid, SMC_NLA_LGR_D_PAD))
 		goto errattr;
+	if (nla_put_u64_64bit(skb, SMC_NLA_LGR_D_EXT_GID,
+			      smcd_gid.gid_ext, SMC_NLA_LGR_D_PAD))
+		goto errattr;
 	if (nla_put_u64_64bit(skb, SMC_NLA_LGR_D_PEER_GID, lgr->peer_gid.gid,
 			      SMC_NLA_LGR_D_PAD))
 		goto errattr;
+	if (nla_put_u64_64bit(skb, SMC_NLA_LGR_D_PEER_EXT_GID,
+			      lgr->peer_gid.gid_ext, SMC_NLA_LGR_D_PAD))
+		goto errattr;
 	if (nla_put_u8(skb, SMC_NLA_LGR_D_VLAN_ID, lgr->vlan_id))
 		goto errattr;
 	if (nla_put_u32(skb, SMC_NLA_LGR_D_CONNS_NUM, lgr->conns_num))
diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c
index c180c18..3fbe14e 100644
--- a/net/smc/smc_diag.c
+++ b/net/smc/smc_diag.c
@@ -175,8 +175,10 @@  static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb,
 
 		dinfo.linkid = *((u32 *)conn->lgr->id);
 		dinfo.peer_gid = conn->lgr->peer_gid.gid;
+		dinfo.peer_gid_ext = conn->lgr->peer_gid.gid_ext;
 		smcd->ops->get_local_gid(smcd, &smcd_gid);
 		dinfo.my_gid = smcd_gid.gid;
+		dinfo.my_gid_ext = smcd_gid.gid_ext;
 		dinfo.token = conn->rmb_desc->token;
 		dinfo.peer_token = conn->peer_token;