drivers/infiniband/core/addr.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/core/addr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/core/addr.c- Extension
.c- Size
- 21798 bytes
- Lines
- 868
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mutex.hlinux/inetdevice.hlinux/slab.hlinux/workqueue.hnet/arp.hnet/neighbour.hnet/route.hnet/netevent.hnet/ip6_route.hrdma/ib_addr.hrdma/ib_cache.hrdma/ib_sa.hrdma/ib.hrdma/rdma_netlink.hnet/netlink.hcore_priv.h
Detected Declarations
struct addr_reqstruct resolve_cb_contextfunction ib_nl_process_ip_rsepfunction ib_nl_handle_ip_res_respfunction ib_nl_ip_send_msgfunction rdma_addr_sizefunction rdma_addr_size_in6function rdma_addr_size_kssfunction rdma_copy_src_l2_addrfunction rdma_find_ndev_for_src_ip_rcufunction for_each_netdev_rcufunction rdma_translate_ipfunction set_timeoutfunction queue_reqfunction ib_nl_fetch_hafunction dst_fetch_hafunction has_gatewayfunction fetch_hafunction addr4_resolvefunction addr6_resolvefunction addr6_resolvefunction is_dst_localfunction addr_resolve_neighfunction rdma_set_src_addr_rcufunction set_addr_netns_by_gid_rcufunction rdma_addr_set_net_defaultsfunction addr_resolvefunction process_one_reqfunction rdma_resolve_ipfunction roce_resolve_route_from_pathfunction rdma_resolve_ipfunction resolve_cbfunction rdma_addr_find_l2_eth_by_grhfunction netevent_callbackfunction addr_initfunction addr_cleanupexport rdma_addr_sizeexport rdma_addr_size_in6export rdma_addr_size_kssexport rdma_copy_src_l2_addrexport rdma_translate_ipexport rdma_resolve_ipexport rdma_addr_cancel
Annotated Snippet
struct addr_req {
struct list_head list;
struct sockaddr_storage src_addr;
struct sockaddr_storage dst_addr;
struct rdma_dev_addr *addr;
void *context;
void (*callback)(int status, struct sockaddr *src_addr,
struct rdma_dev_addr *addr, void *context);
unsigned long timeout;
struct delayed_work work;
bool resolve_by_gid_attr; /* Consider gid attr in resolve phase */
int status;
u32 seq;
};
static atomic_t ib_nl_addr_request_seq = ATOMIC_INIT(0);
static DEFINE_SPINLOCK(lock);
static LIST_HEAD(req_list);
static struct workqueue_struct *addr_wq;
static const struct nla_policy ib_nl_addr_policy[LS_NLA_TYPE_MAX] = {
[LS_NLA_TYPE_DGID] = {.type = NLA_BINARY,
.len = sizeof(struct rdma_nla_ls_gid),
.validation_type = NLA_VALIDATE_MIN,
.min = sizeof(struct rdma_nla_ls_gid)},
};
static void ib_nl_process_ip_rsep(const struct nlmsghdr *nlh)
{
struct nlattr *tb[LS_NLA_TYPE_MAX] = {};
union ib_gid gid;
struct addr_req *req;
int found = 0;
int ret;
if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR)
return;
ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh),
nlmsg_len(nlh), ib_nl_addr_policy, NULL);
if (ret)
return;
if (!tb[LS_NLA_TYPE_DGID])
return;
memcpy(&gid, nla_data(tb[LS_NLA_TYPE_DGID]), sizeof(gid));
spin_lock_bh(&lock);
list_for_each_entry(req, &req_list, list) {
if (nlh->nlmsg_seq != req->seq)
continue;
/* We set the DGID part, the rest was set earlier */
rdma_addr_set_dgid(req->addr, &gid);
req->status = 0;
found = 1;
break;
}
spin_unlock_bh(&lock);
if (!found)
pr_info("Couldn't find request waiting for DGID: %pI6\n",
&gid);
}
int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
struct nlmsghdr *nlh,
struct netlink_ext_ack *extack)
{
if ((nlh->nlmsg_flags & NLM_F_REQUEST) ||
!(NETLINK_CB(skb).sk))
return -EPERM;
ib_nl_process_ip_rsep(nlh);
return 0;
}
static int ib_nl_ip_send_msg(struct rdma_dev_addr *dev_addr,
const void *daddr,
u32 seq, u16 family)
{
struct sk_buff *skb = NULL;
struct nlmsghdr *nlh;
struct rdma_ls_ip_resolve_header *header;
void *data;
size_t size;
int attrtype;
int len;
Annotation
- Immediate include surface: `linux/mutex.h`, `linux/inetdevice.h`, `linux/slab.h`, `linux/workqueue.h`, `net/arp.h`, `net/neighbour.h`, `net/route.h`, `net/netevent.h`.
- Detected declarations: `struct addr_req`, `struct resolve_cb_context`, `function ib_nl_process_ip_rsep`, `function ib_nl_handle_ip_res_resp`, `function ib_nl_ip_send_msg`, `function rdma_addr_size`, `function rdma_addr_size_in6`, `function rdma_addr_size_kss`, `function rdma_copy_src_l2_addr`, `function rdma_find_ndev_for_src_ip_rcu`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.