xref: /openbmc/linux/net/smc/smc_llc.h (revision 171fa692)
1 /*
2  *  Shared Memory Communications over RDMA (SMC-R) and RoCE
3  *
4  *  Definitions for LLC (link layer control) message handling
5  *
6  *  Copyright IBM Corp. 2016
7  *
8  *  Author(s):  Klaus Wacker <Klaus.Wacker@de.ibm.com>
9  *              Ursula Braun <ubraun@linux.vnet.ibm.com>
10  */
11 
12 #ifndef SMC_LLC_H
13 #define SMC_LLC_H
14 
15 #include "smc_wr.h"
16 
17 #define SMC_LLC_FLAG_RESP		0x80
18 
19 #define SMC_LLC_WAIT_FIRST_TIME		(5 * HZ)
20 
21 enum smc_llc_reqresp {
22 	SMC_LLC_REQ,
23 	SMC_LLC_RESP
24 };
25 
26 enum smc_llc_msg_type {
27 	SMC_LLC_CONFIRM_LINK		= 0x01,
28 };
29 
30 #define SMC_LLC_DATA_LEN		40
31 
32 struct smc_llc_hdr {
33 	struct smc_wr_rx_hdr common;
34 	u8 length;	/* 44 */
35 	u8 reserved;
36 	u8 flags;
37 };
38 
39 struct smc_llc_msg_confirm_link {	/* type 0x01 */
40 	struct smc_llc_hdr hd;
41 	u8 sender_mac[ETH_ALEN];
42 	u8 sender_gid[SMC_GID_SIZE];
43 	u8 sender_qp_num[3];
44 	u8 link_num;
45 	u8 link_uid[SMC_LGR_ID_SIZE];
46 	u8 max_links;
47 	u8 reserved[9];
48 };
49 
50 union smc_llc_msg {
51 	struct smc_llc_msg_confirm_link confirm_link;
52 	struct {
53 		struct smc_llc_hdr hdr;
54 		u8 data[SMC_LLC_DATA_LEN];
55 	} raw;
56 };
57 
58 /* transmit */
59 int smc_llc_send_confirm_link(struct smc_link *lnk, u8 mac[], union ib_gid *gid,
60 			      enum smc_llc_reqresp reqresp);
61 int smc_llc_init(void) __init;
62 
63 #endif /* SMC_LLC_H */
64