include/rdma/ib_addr.h
Source file repositories/reference/linux-study-clean/include/rdma/ib_addr.h
File Facts
- System
- Linux kernel
- Corpus path
include/rdma/ib_addr.h- Extension
.h- Size
- 7335 bytes
- Lines
- 248
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ethtool.hlinux/in.hlinux/in6.hlinux/if_arp.hlinux/netdevice.hlinux/inetdevice.hlinux/socket.hlinux/if_vlan.hnet/ipv6.hnet/if_inet6.hnet/ip.hrdma/ib_verbs.hrdma/ib_pack.hnet/net_namespace.h
Detected Declarations
struct rdma_dev_addrfunction ib_addr_get_pkeyfunction ib_addr_set_pkeyfunction ib_addr_get_mgidfunction rdma_addr_gid_offsetfunction rdma_vlan_dev_vlan_idfunction rdma_ip2gidfunction rdma_gid2ipfunction rdma_addr_get_sgidfunction rdma_addr_set_sgidfunction rdma_addr_get_dgidfunction rdma_addr_set_dgidfunction iboe_get_mtufunction rdma_link_local_addrfunction rdma_get_ll_macfunction rdma_is_multicast_addrfunction rdma_get_mcast_macfunction rdma_get_vlan_id
Annotated Snippet
struct rdma_dev_addr {
unsigned char src_dev_addr[MAX_ADDR_LEN];
unsigned char dst_dev_addr[MAX_ADDR_LEN];
unsigned char broadcast[MAX_ADDR_LEN];
unsigned short dev_type;
int bound_dev_if;
enum rdma_transport_type transport;
struct net *net;
const struct ib_gid_attr *sgid_attr;
enum rdma_network_type network;
int hoplimit;
};
/**
* rdma_translate_ip - Translate a local IP address to an RDMA hardware
* address.
*
* The dev_addr->net field must be initialized.
*/
int rdma_translate_ip(const struct sockaddr *addr,
struct rdma_dev_addr *dev_addr);
/**
* rdma_resolve_ip - Resolve source and destination IP addresses to
* RDMA hardware addresses.
* @src_addr: An optional source address to use in the resolution. If a
* source address is not provided, a usable address will be returned via
* the callback.
* @dst_addr: The destination address to resolve.
* @addr: A reference to a data location that will receive the resolved
* addresses. The data location must remain valid until the callback has
* been invoked. The net field of the addr struct must be valid.
* @timeout_ms: Amount of time to wait for the address resolution to complete.
* @callback: Call invoked once address resolution has completed, timed out,
* or been canceled. A status of 0 indicates success.
* @resolve_by_gid_attr: Resolve the ip based on the GID attribute from
* rdma_dev_addr.
* @context: User-specified context associated with the call.
*/
int rdma_resolve_ip(struct sockaddr *src_addr, const struct sockaddr *dst_addr,
struct rdma_dev_addr *addr, unsigned long timeout_ms,
void (*callback)(int status, struct sockaddr *src_addr,
struct rdma_dev_addr *addr, void *context),
bool resolve_by_gid_attr, void *context);
void rdma_addr_cancel(struct rdma_dev_addr *addr);
int rdma_addr_size(const struct sockaddr *addr);
int rdma_addr_size_in6(struct sockaddr_in6 *addr);
int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr);
static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr)
{
return ((u16)dev_addr->broadcast[8] << 8) | (u16)dev_addr->broadcast[9];
}
static inline void ib_addr_set_pkey(struct rdma_dev_addr *dev_addr, u16 pkey)
{
dev_addr->broadcast[8] = pkey >> 8;
dev_addr->broadcast[9] = (unsigned char) pkey;
}
static inline void ib_addr_get_mgid(struct rdma_dev_addr *dev_addr,
union ib_gid *gid)
{
memcpy(gid, dev_addr->broadcast + 4, sizeof *gid);
}
static inline int rdma_addr_gid_offset(struct rdma_dev_addr *dev_addr)
{
return dev_addr->dev_type == ARPHRD_INFINIBAND ? 4 : 0;
}
static inline u16 rdma_vlan_dev_vlan_id(const struct net_device *dev)
{
return is_vlan_dev(dev) ? vlan_dev_vlan_id(dev) : 0xffff;
}
static inline int rdma_ip2gid(struct sockaddr *addr, union ib_gid *gid)
{
switch (addr->sa_family) {
case AF_INET:
ipv6_addr_set_v4mapped(((struct sockaddr_in *)
addr)->sin_addr.s_addr,
(struct in6_addr *)gid);
break;
case AF_INET6:
*(struct in6_addr *)&gid->raw =
((struct sockaddr_in6 *)addr)->sin6_addr;
break;
Annotation
- Immediate include surface: `linux/ethtool.h`, `linux/in.h`, `linux/in6.h`, `linux/if_arp.h`, `linux/netdevice.h`, `linux/inetdevice.h`, `linux/socket.h`, `linux/if_vlan.h`.
- Detected declarations: `struct rdma_dev_addr`, `function ib_addr_get_pkey`, `function ib_addr_set_pkey`, `function ib_addr_get_mgid`, `function rdma_addr_gid_offset`, `function rdma_vlan_dev_vlan_id`, `function rdma_ip2gid`, `function rdma_gid2ip`, `function rdma_addr_get_sgid`, `function rdma_addr_set_sgid`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.