Skip to content

Commit bc49d81

Browse files
jk-ozlabsdavem330
authored andcommitted
mctp: Add MCTP base
Add basic Kconfig, an initial (empty) af_mctp source object, and {AF,PF}_MCTP definitions, and the required definitions for a new protocol type. Signed-off-by: Jeremy Kerr <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 658e6b1 commit bc49d81

File tree

12 files changed

+66
-3
lines changed

12 files changed

+66
-3
lines changed

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11032,6 +11032,13 @@ F: drivers/mailbox/arm_mhuv2.c
1103211032
F: include/linux/mailbox/arm_mhuv2_message.h
1103311033
F: Documentation/devicetree/bindings/mailbox/arm,mhuv2.yaml
1103411034

11035+
MANAGEMENT COMPONENT TRANSPORT PROTOCOL (MCTP)
11036+
M: Jeremy Kerr <[email protected]>
11037+
M: Matt Johnston <[email protected]>
11038+
11039+
S: Maintained
11040+
F: net/mctp/
11041+
1103511042
MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
1103611043
M: Michael Kerrisk <[email protected]>
1103711044

include/linux/socket.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,11 @@ struct ucred {
223223
* reuses AF_INET address family
224224
*/
225225
#define AF_XDP 44 /* XDP sockets */
226+
#define AF_MCTP 45 /* Management component
227+
* transport protocol
228+
*/
226229

227-
#define AF_MAX 45 /* For now.. */
230+
#define AF_MAX 46 /* For now.. */
228231

229232
/* Protocol families, same as address families. */
230233
#define PF_UNSPEC AF_UNSPEC
@@ -274,6 +277,7 @@ struct ucred {
274277
#define PF_QIPCRTR AF_QIPCRTR
275278
#define PF_SMC AF_SMC
276279
#define PF_XDP AF_XDP
280+
#define PF_MCTP AF_MCTP
277281
#define PF_MAX AF_MAX
278282

279283
/* Maximum queue length specifiable by listen. */

include/uapi/linux/mctp.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
/*
3+
* Management Component Transport Protocol (MCTP)
4+
*
5+
* Copyright (c) 2021 Code Construct
6+
* Copyright (c) 2021 Google
7+
*/
8+
9+
#ifndef __UAPI_MCTP_H
10+
#define __UAPI_MCTP_H
11+
12+
struct sockaddr_mctp {
13+
};
14+
15+
#endif /* __UAPI_MCTP_H */

net/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ source "net/bluetooth/Kconfig"
363363
source "net/rxrpc/Kconfig"
364364
source "net/kcm/Kconfig"
365365
source "net/strparser/Kconfig"
366+
source "net/mctp/Kconfig"
366367

367368
config FIB_RULES
368369
bool

net/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,4 @@ obj-$(CONFIG_QRTR) += qrtr/
7878
obj-$(CONFIG_NET_NCSI) += ncsi/
7979
obj-$(CONFIG_XDP_SOCKETS) += xdp/
8080
obj-$(CONFIG_MPTCP) += mptcp/
81+
obj-$(CONFIG_MCTP) += mctp/

net/core/sock.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ static struct lock_class_key af_family_kern_slock_keys[AF_MAX];
226226
x "AF_IEEE802154", x "AF_CAIF" , x "AF_ALG" , \
227227
x "AF_NFC" , x "AF_VSOCK" , x "AF_KCM" , \
228228
x "AF_QIPCRTR", x "AF_SMC" , x "AF_XDP" , \
229+
x "AF_MCTP" , \
229230
x "AF_MAX"
230231

231232
static const char *const af_family_key_strings[AF_MAX+1] = {

net/mctp/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
menuconfig MCTP
3+
depends on NET
4+
tristate "MCTP core protocol support"
5+
help
6+
Management Component Transport Protocol (MCTP) is an in-system
7+
protocol for communicating between management controllers and
8+
their managed devices (peripherals, host processors, etc.). The
9+
protocol is defined by DMTF specification DSP0236.
10+
11+
This option enables core MCTP support. For communicating with other
12+
devices, you'll want to enable a driver for a specific hardware
13+
channel.

net/mctp/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
obj-$(CONFIG_MCTP) += mctp.o
3+
mctp-objs := af_mctp.o

net/mctp/af_mctp.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Management Component Transport Protocol (MCTP)
4+
*
5+
* Copyright (c) 2021 Code Construct
6+
* Copyright (c) 2021 Google
7+
*/
8+
9+
#include <linux/module.h>
10+
11+
MODULE_DESCRIPTION("MCTP core");
12+
MODULE_LICENSE("GPL v2");
13+
MODULE_AUTHOR("Jeremy Kerr <[email protected]>");

net/socket.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ static const char * const pf_family_names[] = {
212212
[PF_QIPCRTR] = "PF_QIPCRTR",
213213
[PF_SMC] = "PF_SMC",
214214
[PF_XDP] = "PF_XDP",
215+
[PF_MCTP] = "PF_MCTP",
215216
};
216217

217218
/*

0 commit comments

Comments
 (0)