brintos

brintos / linux-shallow public Read only

0
0
Text · 2.8 KiB · 1b1737c Raw
110 lines · c
1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */2/*3 *  SCSI Transport Netlink Interface4 *    Used for the posting of outbound SCSI transport events5 *6 *  Copyright (C) 2006   James Smart, Emulex Corporation7 */8#ifndef SCSI_NETLINK_H9#define SCSI_NETLINK_H10 11#include <linux/netlink.h>12#include <linux/types.h>13 14/*15 * This file intended to be included by both kernel and user space16 */17 18/* Single Netlink Message type to send all SCSI Transport messages */19#define SCSI_TRANSPORT_MSG		NLMSG_MIN_TYPE + 120 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			325 26 27/* SCSI_TRANSPORT_MSG event message header */28struct scsi_nl_hdr {29	__u8 version;30	__u8 transport;31	__u16 magic;32	__u16 msgtype;33	__u16 msglen;34} __attribute__((aligned(sizeof(__u64))));35 36/* scsi_nl_hdr->version value */37#define SCSI_NL_VERSION				138 39/* scsi_nl_hdr->magic value */40#define SCSI_NL_MAGIC				0xA1B241 42/* scsi_nl_hdr->transport value */43#define SCSI_NL_TRANSPORT			044#define SCSI_NL_TRANSPORT_FC			145#define SCSI_NL_MAX_TRANSPORTS			246 47/* Transport-based scsi_nl_hdr->msgtype values are defined in each transport */48 49/*50 * GENERIC SCSI scsi_nl_hdr->msgtype Values51 */52	/* kernel -> user */53#define SCSI_NL_SHOST_VENDOR			0x000154	/* user -> kernel */55/* SCSI_NL_SHOST_VENDOR msgtype is kernel->user and user->kernel */56 57 58/*59 * Message Structures :60 */61 62/* macro to round up message lengths to 8byte boundary */63#define SCSI_NL_MSGALIGN(len)		(((len) + 7) & ~7)64 65 66/*67 * SCSI HOST Vendor Unique messages :68 *   SCSI_NL_SHOST_VENDOR69 *70 * Note: The Vendor Unique message payload will begin directly after71 * 	 this structure, with the length of the payload per vmsg_datalen.72 *73 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID74 *   formatting requirements specified below75 */76struct 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))));82 83 84/*85 * Vendor ID:86 *   If transports post vendor-unique events, they must pass a well-known87 *   32-bit vendor identifier. This identifier consists of 8 bits indicating88 *   the "type" of identifier contained, and 24 bits of id data.89 *90 *   Identifiers for each type:91 *    PCI :  ID data is the 16 bit PCI Registered Vendor ID92 */93#define SCSI_NL_VID_TYPE_SHIFT		5694#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)97 98 99#define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen)			\100	{							\101	(hdr)->version = SCSI_NL_VERSION;			\102	(hdr)->transport = t;					\103	(hdr)->magic = SCSI_NL_MAGIC;				\104	(hdr)->msgtype = mtype;					\105	(hdr)->msglen = mlen;					\106	}107 108#endif /* SCSI_NETLINK_H */109 110