This adds net namespace ID to diag of linkgroup, helps us to distinguish different namespaces, and net_cookie is unique in the whole system.
Unified · Split
| @@ -119,6 +119,8 @@ enum { · 118 unmodified lines | |||
| 119 | SMC_NLA_LGR_R_CONNS_NUM, /* u32 */ | 119 | SMC_NLA_LGR_R_CONNS_NUM, /* u32 */ |
| 120 | SMC_NLA_LGR_R_V2_COMMON, /* nest */ | 120 | SMC_NLA_LGR_R_V2_COMMON, /* nest */ |
| 121 | SMC_NLA_LGR_R_V2, /* nest */ | 121 | SMC_NLA_LGR_R_V2, /* nest */ |
| 122 | SMC_NLA_LGR_R_NET_COOKIE, /* u64 */ | ||
| 123 | SMC_NLA_LGR_R_PAD, /* flag */ | ||
| 122 | __SMC_NLA_LGR_R_MAX, | 124 | __SMC_NLA_LGR_R_MAX, |
| 123 | SMC_NLA_LGR_R_MAX = __SMC_NLA_LGR_R_MAX - 1 | 125 | SMC_NLA_LGR_R_MAX = __SMC_NLA_LGR_R_MAX - 1 |
| 124 | }; | 126 | }; |
| @@ -84,11 +84,12 @@ struct smc_diag_conninfo { · 83 unmodified lines | |||
| 84 | /* SMC_DIAG_LINKINFO */ | 84 | /* SMC_DIAG_LINKINFO */ |
| 85 | 85 | ||
| 86 | struct smc_diag_linkinfo { | 86 | struct smc_diag_linkinfo { |
| 87 | __u8 link_id; /* link identifier */ | 87 | __u8 link_id; /* link identifier */ |
| 88 | __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */ | 88 | __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */ |
| 89 | __u8 ibport; /* RDMA device port number */ | 89 | __u8 ibport; /* RDMA device port number */ |
| 90 | __u8 gid[40]; /* local GID */ | 90 | __u8 gid[40]; /* local GID */ |
| 91 | __u8 peer_gid[40]; /* peer GID */ | 91 | __u8 peer_gid[40]; /* peer GID */ |
| 92 | __aligned_u64 net_cookie; /* RDMA device net namespace */ | ||
| 92 | }; | 93 | }; |
| 93 | 94 | ||
| 94 | struct smc_diag_lgrinfo { | 95 | struct smc_diag_lgrinfo { |
| @@ -348,6 +348,9 @@ static int smc_nl_fill_lgr(struct smc_link_group *lgr, · 347 unmodified lines | |||
| 348 | goto errattr; | 348 | goto errattr; |
| 349 | if (nla_put_u8(skb, SMC_NLA_LGR_R_VLAN_ID, lgr->vlan_id)) | 349 | if (nla_put_u8(skb, SMC_NLA_LGR_R_VLAN_ID, lgr->vlan_id)) |
| 350 | goto errattr; | 350 | goto errattr; |
| 351 | if (nla_put_u64_64bit(skb, SMC_NLA_LGR_R_NET_COOKIE, | ||
| 352 | lgr->net->net_cookie, SMC_NLA_LGR_R_PAD)) | ||
| 353 | goto errattr; | ||
| 351 | memcpy(smc_target, lgr->pnet_id, SMC_MAX_PNETID_LEN); | 354 | memcpy(smc_target, lgr->pnet_id, SMC_MAX_PNETID_LEN); |
| 352 | smc_target[SMC_MAX_PNETID_LEN] = 0; | 355 | smc_target[SMC_MAX_PNETID_LEN] = 0; |
| 353 | if (nla_put_string(skb, SMC_NLA_LGR_R_PNETID, smc_target)) | 356 | if (nla_put_string(skb, SMC_NLA_LGR_R_PNETID, smc_target)) |
| @@ -145,19 +145,21 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, · 144 unmodified lines | |||
| 145 | if (smc->conn.lgr && !smc->conn.lgr->is_smcd && | 145 | if (smc->conn.lgr && !smc->conn.lgr->is_smcd && |
| 146 | (req->diag_ext & (1 << (SMC_DIAG_LGRINFO - 1))) && | 146 | (req->diag_ext & (1 << (SMC_DIAG_LGRINFO - 1))) && |
| 147 | !list_empty(&smc->conn.lgr->list)) { | 147 | !list_empty(&smc->conn.lgr->list)) { |
| 148 | struct smc_link *link = smc->conn.lnk; | ||
| 149 | struct net *net = read_pnet(&link->smcibdev->ibdev->coredev.rdma_net); | ||
| 150 | |||
| 148 | struct smc_diag_lgrinfo linfo = { | 151 | struct smc_diag_lgrinfo linfo = { |
| 149 | .role = smc->conn.lgr->role, | 152 | .role = smc->conn.lgr->role, |
| 150 | .lnk[0].ibport = smc->conn.lnk->ibport, | 153 | .lnk[0].ibport = link->ibport, |
| 151 | .lnk[0].link_id = smc->conn.lnk->link_id, | 154 | .lnk[0].link_id = link->link_id, |
| 155 | .lnk[0].net_cookie = net->net_cookie, | ||
| 152 | }; | 156 | }; |
| 153 | 157 | ||
| 154 | memcpy(linfo.lnk[0].ibname, | 158 | memcpy(linfo.lnk[0].ibname, |
| 155 | smc->conn.lgr->lnk[0].smcibdev->ibdev->name, | 159 | smc->conn.lgr->lnk[0].smcibdev->ibdev->name, |
| 156 | sizeof(smc->conn.lnk->smcibdev->ibdev->name)); | 160 | sizeof(link->smcibdev->ibdev->name)); |
| 157 | smc_gid_be16_convert(linfo.lnk[0].gid, | 161 | smc_gid_be16_convert(linfo.lnk[0].gid, link->gid); |
| 158 | smc->conn.lnk->gid); | 162 | smc_gid_be16_convert(linfo.lnk[0].peer_gid, link->peer_gid); |
| 159 | smc_gid_be16_convert(linfo.lnk[0].peer_gid, | ||
| 160 | smc->conn.lnk->peer_gid); | ||
| 161 | 163 | ||
| 162 | if (nla_put(skb, SMC_DIAG_LGRINFO, sizeof(linfo), &linfo) < 0) | 164 | if (nla_put(skb, SMC_DIAG_LGRINFO, sizeof(linfo), &linfo) < 0) |
| 163 | goto errout; | 165 | goto errout; |