Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. |
Roland Dreier | 2a1d9b7 | 2005-08-10 23:03:10 -0700 | [diff] [blame] | 3 | * Copyright (c) 2005 Intel Corporation. All rights reserved. |
| 4 | * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
| 6 | * This software is available to you under a choice of one of two |
| 7 | * licenses. You may choose to be licensed under the terms of the GNU |
| 8 | * General Public License (GPL) Version 2, available from the file |
| 9 | * COPYING in the main directory of this source tree, or the |
| 10 | * OpenIB.org BSD license below: |
| 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or |
| 13 | * without modification, are permitted provided that the following |
| 14 | * conditions are met: |
| 15 | * |
| 16 | * - Redistributions of source code must retain the above |
| 17 | * copyright notice, this list of conditions and the following |
| 18 | * disclaimer. |
| 19 | * |
| 20 | * - Redistributions in binary form must reproduce the above |
| 21 | * copyright notice, this list of conditions and the following |
| 22 | * disclaimer in the documentation and/or other materials |
| 23 | * provided with the distribution. |
| 24 | * |
| 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 32 | * SOFTWARE. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | */ |
| 34 | |
| 35 | #ifndef _IB_CACHE_H |
| 36 | #define _IB_CACHE_H |
| 37 | |
Roland Dreier | a4d61e8 | 2005-08-25 13:40:04 -0700 | [diff] [blame] | 38 | #include <rdma/ib_verbs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /** |
| 41 | * ib_get_cached_gid - Returns a cached GID table entry |
| 42 | * @device: The device to query. |
| 43 | * @port_num: The port number of the device to query. |
| 44 | * @index: The index into the cached GID table to query. |
| 45 | * @gid: The GID value found at the specified index. |
Matan Barak | 55ee3ab | 2015-10-15 18:38:45 +0300 | [diff] [blame] | 46 | * @attr: The GID attribute found at the specified index (only in RoCE). |
| 47 | * NULL means ignore (output parameter). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | * |
| 49 | * ib_get_cached_gid() fetches the specified GID table entry stored in |
| 50 | * the local software cache. |
| 51 | */ |
| 52 | int ib_get_cached_gid(struct ib_device *device, |
| 53 | u8 port_num, |
| 54 | int index, |
Matan Barak | 55ee3ab | 2015-10-15 18:38:45 +0300 | [diff] [blame] | 55 | union ib_gid *gid, |
| 56 | struct ib_gid_attr *attr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | |
| 58 | /** |
| 59 | * ib_find_cached_gid - Returns the port number and GID table index where |
| 60 | * a specified GID value occurs. |
| 61 | * @device: The device to query. |
| 62 | * @gid: The GID value to search for. |
Matan Barak | b39ffa1 | 2015-12-23 14:56:47 +0200 | [diff] [blame] | 63 | * @gid_type: The GID type to search for. |
Matan Barak | 55ee3ab | 2015-10-15 18:38:45 +0300 | [diff] [blame] | 64 | * @ndev: In RoCE, the net device of the device. NULL means ignore. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | * @port_num: The port number of the device where the GID value was found. |
| 66 | * @index: The index into the cached GID table where the GID was found. This |
| 67 | * parameter may be NULL. |
| 68 | * |
| 69 | * ib_find_cached_gid() searches for the specified GID value in |
| 70 | * the local software cache. |
| 71 | */ |
Matan Barak | 55ee3ab | 2015-10-15 18:38:45 +0300 | [diff] [blame] | 72 | int ib_find_cached_gid(struct ib_device *device, |
Ira Weiny | 73cdaae | 2015-05-31 17:15:31 -0400 | [diff] [blame] | 73 | const union ib_gid *gid, |
Matan Barak | b39ffa1 | 2015-12-23 14:56:47 +0200 | [diff] [blame] | 74 | enum ib_gid_type gid_type, |
Matan Barak | 55ee3ab | 2015-10-15 18:38:45 +0300 | [diff] [blame] | 75 | struct net_device *ndev, |
| 76 | u8 *port_num, |
| 77 | u16 *index); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
| 79 | /** |
Matan Barak | d300ec5 | 2015-10-15 18:38:46 +0300 | [diff] [blame] | 80 | * ib_find_cached_gid_by_port - Returns the GID table index where a specified |
| 81 | * GID value occurs |
| 82 | * @device: The device to query. |
| 83 | * @gid: The GID value to search for. |
Matan Barak | b39ffa1 | 2015-12-23 14:56:47 +0200 | [diff] [blame] | 84 | * @gid_type: The GID type to search for. |
Matan Barak | d300ec5 | 2015-10-15 18:38:46 +0300 | [diff] [blame] | 85 | * @port_num: The port number of the device where the GID value sould be |
| 86 | * searched. |
| 87 | * @ndev: In RoCE, the net device of the device. Null means ignore. |
| 88 | * @index: The index into the cached GID table where the GID was found. This |
| 89 | * parameter may be NULL. |
| 90 | * |
| 91 | * ib_find_cached_gid() searches for the specified GID value in |
| 92 | * the local software cache. |
| 93 | */ |
| 94 | int ib_find_cached_gid_by_port(struct ib_device *device, |
| 95 | const union ib_gid *gid, |
Matan Barak | b39ffa1 | 2015-12-23 14:56:47 +0200 | [diff] [blame] | 96 | enum ib_gid_type gid_type, |
Matan Barak | d300ec5 | 2015-10-15 18:38:46 +0300 | [diff] [blame] | 97 | u8 port_num, |
| 98 | struct net_device *ndev, |
| 99 | u16 *index); |
Matan Barak | 99b27e3 | 2015-10-15 18:38:50 +0300 | [diff] [blame] | 100 | |
| 101 | int ib_find_gid_by_filter(struct ib_device *device, |
| 102 | const union ib_gid *gid, |
| 103 | u8 port_num, |
| 104 | bool (*filter)(const union ib_gid *gid, |
| 105 | const struct ib_gid_attr *, |
| 106 | void *), |
| 107 | void *context, u16 *index); |
Matan Barak | d300ec5 | 2015-10-15 18:38:46 +0300 | [diff] [blame] | 108 | /** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | * ib_get_cached_pkey - Returns a cached PKey table entry |
| 110 | * @device: The device to query. |
| 111 | * @port_num: The port number of the device to query. |
| 112 | * @index: The index into the cached PKey table to query. |
| 113 | * @pkey: The PKey value found at the specified index. |
| 114 | * |
| 115 | * ib_get_cached_pkey() fetches the specified PKey table entry stored in |
| 116 | * the local software cache. |
| 117 | */ |
| 118 | int ib_get_cached_pkey(struct ib_device *device_handle, |
| 119 | u8 port_num, |
| 120 | int index, |
| 121 | u16 *pkey); |
| 122 | |
| 123 | /** |
| 124 | * ib_find_cached_pkey - Returns the PKey table index where a specified |
| 125 | * PKey value occurs. |
| 126 | * @device: The device to query. |
| 127 | * @port_num: The port number of the device to search for the PKey. |
| 128 | * @pkey: The PKey value to search for. |
| 129 | * @index: The index into the cached PKey table where the PKey was found. |
| 130 | * |
| 131 | * ib_find_cached_pkey() searches the specified PKey table in |
| 132 | * the local software cache. |
| 133 | */ |
| 134 | int ib_find_cached_pkey(struct ib_device *device, |
| 135 | u8 port_num, |
| 136 | u16 pkey, |
| 137 | u16 *index); |
| 138 | |
Jack Morgenstein | 6fb9cdb | 2006-06-17 20:37:34 -0700 | [diff] [blame] | 139 | /** |
Jack Morgenstein | 73aaa74 | 2012-08-03 08:40:39 +0000 | [diff] [blame] | 140 | * ib_find_exact_cached_pkey - Returns the PKey table index where a specified |
| 141 | * PKey value occurs. Comparison uses the FULL 16 bits (incl membership bit) |
| 142 | * @device: The device to query. |
| 143 | * @port_num: The port number of the device to search for the PKey. |
| 144 | * @pkey: The PKey value to search for. |
| 145 | * @index: The index into the cached PKey table where the PKey was found. |
| 146 | * |
| 147 | * ib_find_exact_cached_pkey() searches the specified PKey table in |
| 148 | * the local software cache. |
| 149 | */ |
| 150 | int ib_find_exact_cached_pkey(struct ib_device *device, |
| 151 | u8 port_num, |
| 152 | u16 pkey, |
| 153 | u16 *index); |
| 154 | |
| 155 | /** |
Jack Morgenstein | 6fb9cdb | 2006-06-17 20:37:34 -0700 | [diff] [blame] | 156 | * ib_get_cached_lmc - Returns a cached lmc table entry |
| 157 | * @device: The device to query. |
| 158 | * @port_num: The port number of the device to query. |
| 159 | * @lmc: The lmc value for the specified port for that device. |
| 160 | * |
| 161 | * ib_get_cached_lmc() fetches the specified lmc table entry stored in |
| 162 | * the local software cache. |
| 163 | */ |
| 164 | int ib_get_cached_lmc(struct ib_device *device, |
| 165 | u8 port_num, |
| 166 | u8 *lmc); |
| 167 | |
Jack Wang | 9e2c3f1 | 2017-01-02 13:19:24 +0100 | [diff] [blame] | 168 | /** |
| 169 | * ib_get_cached_port_state - Returns a cached port state table entry |
| 170 | * @device: The device to query. |
| 171 | * @port_num: The port number of the device to query. |
| 172 | * @port_state: port_state for the specified port for that device. |
| 173 | * |
| 174 | * ib_get_cached_port_state() fetches the specified port_state table entry stored in |
| 175 | * the local software cache. |
| 176 | */ |
| 177 | int ib_get_cached_port_state(struct ib_device *device, |
| 178 | u8 port_num, |
| 179 | enum ib_port_state *port_active); |
| 180 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | #endif /* _IB_CACHE_H */ |