Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
0002 /*
0003  * Copyright (c) 2004 Topspin Communications.  All rights reserved.
0004  * Copyright (c) 2005 Intel Corporation. All rights reserved.
0005  * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
0006  */
0007 
0008 #ifndef _IB_CACHE_H
0009 #define _IB_CACHE_H
0010 
0011 #include <rdma/ib_verbs.h>
0012 
0013 int rdma_query_gid(struct ib_device *device, u32 port_num, int index,
0014            union ib_gid *gid);
0015 void *rdma_read_gid_hw_context(const struct ib_gid_attr *attr);
0016 const struct ib_gid_attr *rdma_find_gid(struct ib_device *device,
0017                     const union ib_gid *gid,
0018                     enum ib_gid_type gid_type,
0019                     struct net_device *ndev);
0020 const struct ib_gid_attr *rdma_find_gid_by_port(struct ib_device *ib_dev,
0021                         const union ib_gid *gid,
0022                         enum ib_gid_type gid_type,
0023                         u32 port,
0024                         struct net_device *ndev);
0025 const struct ib_gid_attr *rdma_find_gid_by_filter(
0026     struct ib_device *device, const union ib_gid *gid, u32 port_num,
0027     bool (*filter)(const union ib_gid *gid, const struct ib_gid_attr *,
0028                void *),
0029     void *context);
0030 
0031 int rdma_read_gid_l2_fields(const struct ib_gid_attr *attr,
0032                 u16 *vlan_id, u8 *smac);
0033 struct net_device *rdma_read_gid_attr_ndev_rcu(const struct ib_gid_attr *attr);
0034 
0035 /**
0036  * ib_get_cached_pkey - Returns a cached PKey table entry
0037  * @device: The device to query.
0038  * @port_num: The port number of the device to query.
0039  * @index: The index into the cached PKey table to query.
0040  * @pkey: The PKey value found at the specified index.
0041  *
0042  * ib_get_cached_pkey() fetches the specified PKey table entry stored in
0043  * the local software cache.
0044  */
0045 int ib_get_cached_pkey(struct ib_device    *device_handle,
0046                u32                  port_num,
0047                int                  index,
0048                u16                 *pkey);
0049 
0050 /**
0051  * ib_find_cached_pkey - Returns the PKey table index where a specified
0052  *   PKey value occurs.
0053  * @device: The device to query.
0054  * @port_num: The port number of the device to search for the PKey.
0055  * @pkey: The PKey value to search for.
0056  * @index: The index into the cached PKey table where the PKey was found.
0057  *
0058  * ib_find_cached_pkey() searches the specified PKey table in
0059  * the local software cache.
0060  */
0061 int ib_find_cached_pkey(struct ib_device    *device,
0062             u32                  port_num,
0063             u16                  pkey,
0064             u16                 *index);
0065 
0066 /**
0067  * ib_find_exact_cached_pkey - Returns the PKey table index where a specified
0068  *   PKey value occurs. Comparison uses the FULL 16 bits (incl membership bit)
0069  * @device: The device to query.
0070  * @port_num: The port number of the device to search for the PKey.
0071  * @pkey: The PKey value to search for.
0072  * @index: The index into the cached PKey table where the PKey was found.
0073  *
0074  * ib_find_exact_cached_pkey() searches the specified PKey table in
0075  * the local software cache.
0076  */
0077 int ib_find_exact_cached_pkey(struct ib_device    *device,
0078                   u32                  port_num,
0079                   u16                  pkey,
0080                   u16                 *index);
0081 
0082 /**
0083  * ib_get_cached_lmc - Returns a cached lmc table entry
0084  * @device: The device to query.
0085  * @port_num: The port number of the device to query.
0086  * @lmc: The lmc value for the specified port for that device.
0087  *
0088  * ib_get_cached_lmc() fetches the specified lmc table entry stored in
0089  * the local software cache.
0090  */
0091 int ib_get_cached_lmc(struct ib_device *device,
0092               u32               port_num,
0093               u8                *lmc);
0094 
0095 /**
0096  * ib_get_cached_port_state - Returns a cached port state table entry
0097  * @device: The device to query.
0098  * @port_num: The port number of the device to query.
0099  * @port_state: port_state for the specified port for that device.
0100  *
0101  * ib_get_cached_port_state() fetches the specified port_state table entry stored in
0102  * the local software cache.
0103  */
0104 int ib_get_cached_port_state(struct ib_device *device,
0105                  u32               port_num,
0106                   enum ib_port_state *port_active);
0107 
0108 bool rdma_is_zero_gid(const union ib_gid *gid);
0109 const struct ib_gid_attr *rdma_get_gid_attr(struct ib_device *device,
0110                         u32 port_num, int index);
0111 void rdma_put_gid_attr(const struct ib_gid_attr *attr);
0112 void rdma_hold_gid_attr(const struct ib_gid_attr *attr);
0113 ssize_t rdma_query_gid_table(struct ib_device *device,
0114                  struct ib_uverbs_gid_entry *entries,
0115                  size_t max_entries);
0116 
0117 #endif /* _IB_CACHE_H */