| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2005 Voltaire Inc. All rights reserved. |
|---|
| 3 | 4 | * Copyright (c) 2005 Intel Corporation. All rights reserved. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This software is available to you under a choice of one of two |
|---|
| 6 | | - * licenses. You may choose to be licensed under the terms of the GNU |
|---|
| 7 | | - * General Public License (GPL) Version 2, available from the file |
|---|
| 8 | | - * COPYING in the main directory of this source tree, or the |
|---|
| 9 | | - * OpenIB.org BSD license below: |
|---|
| 10 | | - * |
|---|
| 11 | | - * Redistribution and use in source and binary forms, with or |
|---|
| 12 | | - * without modification, are permitted provided that the following |
|---|
| 13 | | - * conditions are met: |
|---|
| 14 | | - * |
|---|
| 15 | | - * - Redistributions of source code must retain the above |
|---|
| 16 | | - * copyright notice, this list of conditions and the following |
|---|
| 17 | | - * disclaimer. |
|---|
| 18 | | - * |
|---|
| 19 | | - * - Redistributions in binary form must reproduce the above |
|---|
| 20 | | - * copyright notice, this list of conditions and the following |
|---|
| 21 | | - * disclaimer in the documentation and/or other materials |
|---|
| 22 | | - * provided with the distribution. |
|---|
| 23 | | - * |
|---|
| 24 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|---|
| 25 | | - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|---|
| 26 | | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|---|
| 27 | | - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
|---|
| 28 | | - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|---|
| 29 | | - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|---|
| 30 | | - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|---|
| 31 | | - * SOFTWARE. |
|---|
| 32 | 5 | */ |
|---|
| 33 | 6 | |
|---|
| 34 | | -#if !defined(IB_ADDR_H) |
|---|
| 7 | +#ifndef IB_ADDR_H |
|---|
| 35 | 8 | #define IB_ADDR_H |
|---|
| 36 | 9 | |
|---|
| 37 | 10 | #include <linux/in.h> |
|---|
| .. | .. |
|---|
| 46 | 19 | #include <net/ip.h> |
|---|
| 47 | 20 | #include <rdma/ib_verbs.h> |
|---|
| 48 | 21 | #include <rdma/ib_pack.h> |
|---|
| 49 | | -#include <net/ipv6.h> |
|---|
| 50 | 22 | #include <net/net_namespace.h> |
|---|
| 51 | 23 | |
|---|
| 52 | 24 | /** |
|---|
| .. | .. |
|---|
| 95 | 67 | * @timeout_ms: Amount of time to wait for the address resolution to complete. |
|---|
| 96 | 68 | * @callback: Call invoked once address resolution has completed, timed out, |
|---|
| 97 | 69 | * or been canceled. A status of 0 indicates success. |
|---|
| 70 | + * @resolve_by_gid_attr: Resolve the ip based on the GID attribute from |
|---|
| 71 | + * rdma_dev_addr. |
|---|
| 98 | 72 | * @context: User-specified context associated with the call. |
|---|
| 99 | 73 | */ |
|---|
| 100 | 74 | int rdma_resolve_ip(struct sockaddr *src_addr, const struct sockaddr *dst_addr, |
|---|
| 101 | | - struct rdma_dev_addr *addr, int timeout_ms, |
|---|
| 75 | + struct rdma_dev_addr *addr, unsigned long timeout_ms, |
|---|
| 102 | 76 | void (*callback)(int status, struct sockaddr *src_addr, |
|---|
| 103 | 77 | struct rdma_dev_addr *addr, void *context), |
|---|
| 104 | | - void *context); |
|---|
| 78 | + bool resolve_by_gid_attr, void *context); |
|---|
| 105 | 79 | |
|---|
| 106 | 80 | void rdma_addr_cancel(struct rdma_dev_addr *addr); |
|---|
| 107 | | - |
|---|
| 108 | | -void rdma_copy_addr(struct rdma_dev_addr *dev_addr, |
|---|
| 109 | | - const struct net_device *dev, |
|---|
| 110 | | - const unsigned char *dst_dev_addr); |
|---|
| 111 | 81 | |
|---|
| 112 | 82 | int rdma_addr_size(const struct sockaddr *addr); |
|---|
| 113 | 83 | int rdma_addr_size_in6(struct sockaddr_in6 *addr); |
|---|
| .. | .. |
|---|
| 221 | 191 | return IB_MTU_256; |
|---|
| 222 | 192 | else |
|---|
| 223 | 193 | return 0; |
|---|
| 224 | | -} |
|---|
| 225 | | - |
|---|
| 226 | | -static inline int iboe_get_rate(struct net_device *dev) |
|---|
| 227 | | -{ |
|---|
| 228 | | - struct ethtool_link_ksettings cmd; |
|---|
| 229 | | - int err; |
|---|
| 230 | | - |
|---|
| 231 | | - rtnl_lock(); |
|---|
| 232 | | - err = __ethtool_get_link_ksettings(dev, &cmd); |
|---|
| 233 | | - rtnl_unlock(); |
|---|
| 234 | | - if (err) |
|---|
| 235 | | - return IB_RATE_PORT_CURRENT; |
|---|
| 236 | | - |
|---|
| 237 | | - if (cmd.base.speed >= 40000) |
|---|
| 238 | | - return IB_RATE_40_GBPS; |
|---|
| 239 | | - else if (cmd.base.speed >= 30000) |
|---|
| 240 | | - return IB_RATE_30_GBPS; |
|---|
| 241 | | - else if (cmd.base.speed >= 20000) |
|---|
| 242 | | - return IB_RATE_20_GBPS; |
|---|
| 243 | | - else if (cmd.base.speed >= 10000) |
|---|
| 244 | | - return IB_RATE_10_GBPS; |
|---|
| 245 | | - else |
|---|
| 246 | | - return IB_RATE_PORT_CURRENT; |
|---|
| 247 | 194 | } |
|---|
| 248 | 195 | |
|---|
| 249 | 196 | static inline int rdma_link_local_addr(struct in6_addr *addr) |
|---|