Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Ursula Braun | 9bf9abe | 2017-01-09 16:55:21 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
| 4 | * |
| 5 | * Definitions for LLC (link layer control) message handling |
| 6 | * |
| 7 | * Copyright IBM Corp. 2016 |
| 8 | * |
| 9 | * Author(s): Klaus Wacker <Klaus.Wacker@de.ibm.com> |
| 10 | * Ursula Braun <ubraun@linux.vnet.ibm.com> |
| 11 | */ |
| 12 | |
| 13 | #ifndef SMC_LLC_H |
| 14 | #define SMC_LLC_H |
| 15 | |
| 16 | #include "smc_wr.h" |
| 17 | |
| 18 | #define SMC_LLC_FLAG_RESP 0x80 |
| 19 | |
| 20 | #define SMC_LLC_WAIT_FIRST_TIME (5 * HZ) |
Karsten Graul | 52bedf3 | 2018-03-01 13:51:32 +0100 | [diff] [blame] | 21 | #define SMC_LLC_WAIT_TIME (2 * HZ) |
Ursula Braun | 9bf9abe | 2017-01-09 16:55:21 +0100 | [diff] [blame] | 22 | |
| 23 | enum smc_llc_reqresp { |
| 24 | SMC_LLC_REQ, |
| 25 | SMC_LLC_RESP |
| 26 | }; |
| 27 | |
| 28 | enum smc_llc_msg_type { |
| 29 | SMC_LLC_CONFIRM_LINK = 0x01, |
Karsten Graul | 52bedf3 | 2018-03-01 13:51:32 +0100 | [diff] [blame] | 30 | SMC_LLC_ADD_LINK = 0x02, |
| 31 | SMC_LLC_DELETE_LINK = 0x04, |
Karsten Graul | 4ed75de | 2018-03-01 13:51:30 +0100 | [diff] [blame] | 32 | SMC_LLC_CONFIRM_RKEY = 0x06, |
Karsten Graul | 313164d | 2018-03-01 13:51:29 +0100 | [diff] [blame] | 33 | SMC_LLC_TEST_LINK = 0x07, |
Karsten Graul | 4ed75de | 2018-03-01 13:51:30 +0100 | [diff] [blame] | 34 | SMC_LLC_CONFIRM_RKEY_CONT = 0x08, |
| 35 | SMC_LLC_DELETE_RKEY = 0x09, |
Ursula Braun | 9bf9abe | 2017-01-09 16:55:21 +0100 | [diff] [blame] | 36 | }; |
| 37 | |
Ursula Braun | 9bf9abe | 2017-01-09 16:55:21 +0100 | [diff] [blame] | 38 | /* transmit */ |
Ursula Braun | 947541f | 2018-07-25 16:35:30 +0200 | [diff] [blame] | 39 | int smc_llc_send_confirm_link(struct smc_link *lnk, |
Ursula Braun | 9bf9abe | 2017-01-09 16:55:21 +0100 | [diff] [blame] | 40 | enum smc_llc_reqresp reqresp); |
Ursula Braun | 7005ada | 2018-07-25 16:35:31 +0200 | [diff] [blame] | 41 | int smc_llc_send_add_link(struct smc_link *link, u8 mac[], u8 gid[], |
Karsten Graul | 52bedf3 | 2018-03-01 13:51:32 +0100 | [diff] [blame] | 42 | enum smc_llc_reqresp reqresp); |
| 43 | int smc_llc_send_delete_link(struct smc_link *link, |
Karsten Graul | 0d18a0cb | 2018-07-25 16:35:33 +0200 | [diff] [blame] | 44 | enum smc_llc_reqresp reqresp, bool orderly); |
Karsten Graul | 2a4c57a | 2018-05-15 17:04:59 +0200 | [diff] [blame] | 45 | int smc_llc_link_init(struct smc_link *link); |
Karsten Graul | 877ae5b | 2018-05-02 16:56:44 +0200 | [diff] [blame] | 46 | void smc_llc_link_active(struct smc_link *link, int testlink_time); |
Karsten Graul | 0d18a0cb | 2018-07-25 16:35:33 +0200 | [diff] [blame] | 47 | void smc_llc_link_deleting(struct smc_link *link); |
Karsten Graul | 877ae5b | 2018-05-02 16:56:44 +0200 | [diff] [blame] | 48 | void smc_llc_link_inactive(struct smc_link *link); |
Karsten Graul | 2a4c57a | 2018-05-15 17:04:59 +0200 | [diff] [blame] | 49 | void smc_llc_link_clear(struct smc_link *link); |
Karsten Graul | 44aa81c | 2018-05-15 17:04:55 +0200 | [diff] [blame] | 50 | int smc_llc_do_confirm_rkey(struct smc_link *link, |
| 51 | struct smc_buf_desc *rmb_desc); |
Karsten Graul | 60e03c6 | 2018-11-22 10:26:42 +0100 | [diff] [blame] | 52 | int smc_llc_do_delete_rkey(struct smc_link *link, |
| 53 | struct smc_buf_desc *rmb_desc); |
Ursula Braun | 9bf9abe | 2017-01-09 16:55:21 +0100 | [diff] [blame] | 54 | int smc_llc_init(void) __init; |
| 55 | |
| 56 | #endif /* SMC_LLC_H */ |