drivers/infiniband/sw/rxe/rxe_net.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/sw/rxe/rxe_net.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/sw/rxe/rxe_net.c- Extension
.c- Size
- 18975 bytes
- Lines
- 850
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/skbuff.hlinux/if_arp.hlinux/netdevice.hlinux/if.hlinux/if_vlan.hnet/udp_tunnel.hnet/sch_generic.hlinux/netfilter.hrdma/ib_addr.hrxe.hrxe_net.hrxe_loc.hrxe_ns.h
Detected Declarations
function rxe_reclassify_recv_socketfunction rxe_udp_encap_recvfunction rxe_release_udp_tunnelfunction prepare_udp_hdrfunction prepare_ipv4_hdrfunction prepare_ipv6_hdrfunction prepare4function prepare6function rxe_preparefunction rxe_skb_tx_dtorfunction rxe_sendfunction rxe_loopbackfunction rxe_xmit_packetfunction rxe_net_addfunction rxe_sock_putfunction rxe_net_delfunction rxe_port_eventfunction rxe_port_upfunction rxe_port_downfunction rxe_set_port_statefunction rxe_notifyfunction rxe_net_ipv4_initfunction rxe_net_ipv6_initfunction rxe_register_notifierfunction rxe_net_exitfunction rxe_net_init
Annotated Snippet
if (av->network_type == RXE_NETWORK_TYPE_IPV4) {
struct in_addr *saddr;
struct in_addr *daddr;
saddr = &av->sgid_addr._sockaddr_in.sin_addr;
daddr = &av->dgid_addr._sockaddr_in.sin_addr;
dst = rxe_find_route4(qp, net, ndev, saddr, daddr);
} else if (av->network_type == RXE_NETWORK_TYPE_IPV6) {
struct in6_addr *saddr6;
struct in6_addr *daddr6;
saddr6 = &av->sgid_addr._sockaddr_in6.sin6_addr;
daddr6 = &av->dgid_addr._sockaddr_in6.sin6_addr;
dst = rxe_find_route6(qp, net, ndev, saddr6, daddr6);
#if IS_ENABLED(CONFIG_IPV6)
if (dst)
qp->dst_cookie =
rt6_get_cookie((struct rt6_info *)dst);
#endif
}
if (dst && (qp_type(qp) == IB_QPT_RC)) {
dst_hold(dst);
sk_dst_set(qp->sk->sk, dst);
}
}
return dst;
}
static int rxe_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
{
struct udphdr *udph;
struct rxe_dev *rxe;
struct net_device *ndev = skb->dev;
struct rxe_pkt_info *pkt = SKB_TO_PKT(skb);
/* takes a reference on rxe->ib_dev
* drop when skb is freed
*/
rxe = rxe_get_dev_from_net(ndev);
if (!rxe && is_vlan_dev(ndev))
rxe = rxe_get_dev_from_net(vlan_dev_real_dev(ndev));
if (!rxe)
goto drop;
if (skb_linearize(skb)) {
ib_device_put(&rxe->ib_dev);
goto drop;
}
udph = udp_hdr(skb);
pkt->rxe = rxe;
pkt->port_num = 1;
pkt->hdr = (u8 *)(udph + 1);
pkt->mask = RXE_GRH_MASK;
pkt->paylen = be16_to_cpu(udph->len) - sizeof(*udph);
/* remove udp header */
skb_pull(skb, sizeof(struct udphdr));
rxe_rcv(skb);
return 0;
drop:
kfree_skb(skb);
return 0;
}
static struct socket *rxe_setup_udp_tunnel(struct net *net, __be16 port,
bool ipv6)
{
int err;
struct socket *sock;
struct udp_port_cfg udp_cfg = { };
struct udp_tunnel_sock_cfg tnl_cfg = { };
if (ipv6) {
udp_cfg.family = AF_INET6;
udp_cfg.ipv6_v6only = 1;
} else {
udp_cfg.family = AF_INET;
}
udp_cfg.local_udp_port = port;
/* Create UDP socket */
err = udp_sock_create(net, &udp_cfg, &sock);
if (err < 0)
return ERR_PTR(err);
Annotation
- Immediate include surface: `linux/skbuff.h`, `linux/if_arp.h`, `linux/netdevice.h`, `linux/if.h`, `linux/if_vlan.h`, `net/udp_tunnel.h`, `net/sch_generic.h`, `linux/netfilter.h`.
- Detected declarations: `function rxe_reclassify_recv_socket`, `function rxe_udp_encap_recv`, `function rxe_release_udp_tunnel`, `function prepare_udp_hdr`, `function prepare_ipv4_hdr`, `function prepare_ipv6_hdr`, `function prepare4`, `function prepare6`, `function rxe_prepare`, `function rxe_skb_tx_dtor`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: source 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.