forked from GrapheneOS/linux-hardened
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
smc: netlink interface for SMC sockets
Support for SMC socket monitoring via netlink sockets of protocol NETLINK_SOCK_DIAG. Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Showing
10 changed files
with
379 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Shared Memory Communications over RDMA (SMC-R) and RoCE | ||
* | ||
* Definitions for the SMC module (socket related) | ||
* | ||
* Copyright IBM Corp. 2016 | ||
* | ||
* Author(s): Ursula Braun <ubraun@linux.vnet.ibm.com> | ||
*/ | ||
#ifndef _SMC_H | ||
#define _SMC_H | ||
|
||
struct smc_hashinfo { | ||
rwlock_t lock; | ||
struct hlist_head ht; | ||
}; | ||
|
||
int smc_hash_sk(struct sock *sk); | ||
void smc_unhash_sk(struct sock *sk); | ||
#endif /* _SMC_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#ifndef _UAPI_SMC_DIAG_H_ | ||
#define _UAPI_SMC_DIAG_H_ | ||
|
||
#include <linux/types.h> | ||
#include <linux/inet_diag.h> | ||
#include <rdma/ib_verbs.h> | ||
|
||
/* Request structure */ | ||
struct smc_diag_req { | ||
__u8 diag_family; | ||
__u8 pad[2]; | ||
__u8 diag_ext; /* Query extended information */ | ||
struct inet_diag_sockid id; | ||
}; | ||
|
||
/* Base info structure. It contains socket identity (addrs/ports/cookie) based | ||
* on the internal clcsock, and more SMC-related socket data | ||
*/ | ||
struct smc_diag_msg { | ||
__u8 diag_family; | ||
__u8 diag_state; | ||
__u8 diag_fallback; | ||
__u8 diag_shutdown; | ||
struct inet_diag_sockid id; | ||
|
||
__u32 diag_uid; | ||
__u64 diag_inode; | ||
}; | ||
|
||
/* Extensions */ | ||
|
||
enum { | ||
SMC_DIAG_NONE, | ||
SMC_DIAG_CONNINFO, | ||
SMC_DIAG_LGRINFO, | ||
SMC_DIAG_SHUTDOWN, | ||
__SMC_DIAG_MAX, | ||
}; | ||
|
||
#define SMC_DIAG_MAX (__SMC_DIAG_MAX - 1) | ||
|
||
/* SMC_DIAG_CONNINFO */ | ||
|
||
struct smc_diag_cursor { | ||
__u16 reserved; | ||
__u16 wrap; | ||
__u32 count; | ||
}; | ||
|
||
struct smc_diag_conninfo { | ||
__u32 token; /* unique connection id */ | ||
__u32 sndbuf_size; /* size of send buffer */ | ||
__u32 rmbe_size; /* size of RMB element */ | ||
__u32 peer_rmbe_size; /* size of peer RMB element */ | ||
/* local RMB element cursors */ | ||
struct smc_diag_cursor rx_prod; /* received producer cursor */ | ||
struct smc_diag_cursor rx_cons; /* received consumer cursor */ | ||
/* peer RMB element cursors */ | ||
struct smc_diag_cursor tx_prod; /* sent producer cursor */ | ||
struct smc_diag_cursor tx_cons; /* sent consumer cursor */ | ||
__u8 rx_prod_flags; /* received producer flags */ | ||
__u8 rx_conn_state_flags; /* recvd connection flags*/ | ||
__u8 tx_prod_flags; /* sent producer flags */ | ||
__u8 tx_conn_state_flags; /* sent connection flags*/ | ||
/* send buffer cursors */ | ||
struct smc_diag_cursor tx_prep; /* prepared to be sent cursor */ | ||
struct smc_diag_cursor tx_sent; /* sent cursor */ | ||
struct smc_diag_cursor tx_fin; /* confirmed sent cursor */ | ||
}; | ||
|
||
/* SMC_DIAG_LINKINFO */ | ||
|
||
struct smc_diag_linkinfo { | ||
__u8 link_id; /* link identifier */ | ||
__u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */ | ||
__u8 ibport; /* RDMA device port number */ | ||
__u8 gid[40]; /* local GID */ | ||
__u8 peer_gid[40]; /* peer GID */ | ||
}; | ||
|
||
struct smc_diag_lgrinfo { | ||
struct smc_diag_linkinfo lnk[1]; | ||
__u8 role; | ||
}; | ||
#endif /* _UAPI_SMC_DIAG_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
obj-$(CONFIG_SMC) += smc.o | ||
obj-$(CONFIG_SMC_DIAG) += smc_diag.o | ||
smc-y := af_smc.o smc_pnet.o smc_ib.o smc_clc.o smc_core.o smc_wr.o smc_llc.o | ||
smc-y += smc_cdc.o smc_tx.o smc_rx.o smc_close.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.