Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4b1b7d3

Browse files
Hans Wippeldavem330
Hans Wippel
authored andcommittedJun 30, 2018
net/smc: add SMC-D diag support
This patch adds diag support for SMC-D. Signed-off-by: Hans Wippel <hwippel@linux.ibm.com> Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Suggested-by: Thomas Richter <tmricht@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4134984 commit 4b1b7d3

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
 

‎include/uapi/linux/smc_diag.h

+10
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ enum {
3535
SMC_DIAG_CONNINFO,
3636
SMC_DIAG_LGRINFO,
3737
SMC_DIAG_SHUTDOWN,
38+
SMC_DIAG_DMBINFO,
3839
__SMC_DIAG_MAX,
3940
};
4041

@@ -83,4 +84,13 @@ struct smc_diag_lgrinfo {
8384
struct smc_diag_linkinfo lnk[1];
8485
__u8 role;
8586
};
87+
88+
struct smcd_diag_dmbinfo { /* SMC-D Socket internals */
89+
__u32 linkid; /* Link identifier */
90+
__u64 peer_gid; /* Peer GID */
91+
__u64 my_gid; /* My GID */
92+
__u64 token; /* Token of DMB */
93+
__u64 peer_token; /* Token of remote DMBE */
94+
};
95+
8696
#endif /* _UAPI_SMC_DIAG_H_ */

‎net/smc/smc_diag.c

+15
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,21 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb,
156156
if (nla_put(skb, SMC_DIAG_LGRINFO, sizeof(linfo), &linfo) < 0)
157157
goto errout;
158158
}
159+
if (smc->conn.lgr && smc->conn.lgr->is_smcd &&
160+
(req->diag_ext & (1 << (SMC_DIAG_DMBINFO - 1))) &&
161+
!list_empty(&smc->conn.lgr->list)) {
162+
struct smc_connection *conn = &smc->conn;
163+
struct smcd_diag_dmbinfo dinfo = {
164+
.linkid = *((u32 *)conn->lgr->id),
165+
.peer_gid = conn->lgr->peer_gid,
166+
.my_gid = conn->lgr->smcd->local_gid,
167+
.token = conn->rmb_desc->token,
168+
.peer_token = conn->peer_token
169+
};
170+
171+
if (nla_put(skb, SMC_DIAG_DMBINFO, sizeof(dinfo), &dinfo) < 0)
172+
goto errout;
173+
}
159174

160175
nlmsg_end(skb, nlh);
161176
return 0;

0 commit comments

Comments
 (0)
Please sign in to comment.