Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / include / uapi / scsi / scsi_netlink.h
blob1b1737c3c9d80fb5eacef776df6f6205dac44747
1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3 * SCSI Transport Netlink Interface
4 * Used for the posting of outbound SCSI transport events
6 * Copyright (C) 2006 James Smart, Emulex Corporation
7 */
8 #ifndef SCSI_NETLINK_H
9 #define SCSI_NETLINK_H
11 #include <linux/netlink.h>
12 #include <linux/types.h>
15 * This file intended to be included by both kernel and user space
18 /* Single Netlink Message type to send all SCSI Transport messages */
19 #define SCSI_TRANSPORT_MSG NLMSG_MIN_TYPE + 1
21 /* SCSI Transport Broadcast Groups */
22 /* leaving groups 0 and 1 unassigned */
23 #define SCSI_NL_GRP_FC_EVENTS (1<<2) /* Group 2 */
24 #define SCSI_NL_GRP_CNT 3
27 /* SCSI_TRANSPORT_MSG event message header */
28 struct scsi_nl_hdr {
29 __u8 version;
30 __u8 transport;
31 __u16 magic;
32 __u16 msgtype;
33 __u16 msglen;
34 } __attribute__((aligned(sizeof(__u64))));
36 /* scsi_nl_hdr->version value */
37 #define SCSI_NL_VERSION 1
39 /* scsi_nl_hdr->magic value */
40 #define SCSI_NL_MAGIC 0xA1B2
42 /* scsi_nl_hdr->transport value */
43 #define SCSI_NL_TRANSPORT 0
44 #define SCSI_NL_TRANSPORT_FC 1
45 #define SCSI_NL_MAX_TRANSPORTS 2
47 /* Transport-based scsi_nl_hdr->msgtype values are defined in each transport */
50 * GENERIC SCSI scsi_nl_hdr->msgtype Values
52 /* kernel -> user */
53 #define SCSI_NL_SHOST_VENDOR 0x0001
54 /* user -> kernel */
55 /* SCSI_NL_SHOST_VENDOR msgtype is kernel->user and user->kernel */
59 * Message Structures :
62 /* macro to round up message lengths to 8byte boundary */
63 #define SCSI_NL_MSGALIGN(len) (((len) + 7) & ~7)
67 * SCSI HOST Vendor Unique messages :
68 * SCSI_NL_SHOST_VENDOR
70 * Note: The Vendor Unique message payload will begin directly after
71 * this structure, with the length of the payload per vmsg_datalen.
73 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
74 * formatting requirements specified below
76 struct scsi_nl_host_vendor_msg {
77 struct scsi_nl_hdr snlh; /* must be 1st element ! */
78 __u64 vendor_id;
79 __u16 host_no;
80 __u16 vmsg_datalen;
81 } __attribute__((aligned(sizeof(__u64))));
85 * Vendor ID:
86 * If transports post vendor-unique events, they must pass a well-known
87 * 32-bit vendor identifier. This identifier consists of 8 bits indicating
88 * the "type" of identifier contained, and 24 bits of id data.
90 * Identifiers for each type:
91 * PCI : ID data is the 16 bit PCI Registered Vendor ID
93 #define SCSI_NL_VID_TYPE_SHIFT 56
94 #define SCSI_NL_VID_TYPE_MASK ((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
95 #define SCSI_NL_VID_TYPE_PCI ((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
96 #define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK)
99 #define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen) \
101 (hdr)->version = SCSI_NL_VERSION; \
102 (hdr)->transport = t; \
103 (hdr)->magic = SCSI_NL_MAGIC; \
104 (hdr)->msgtype = mtype; \
105 (hdr)->msglen = mlen; \
108 #endif /* SCSI_NETLINK_H */