drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c- Extension
.c- Size
- 19524 bytes
- Lines
- 712
- Domain
- Driver Families
- Bucket
- drivers/net
- 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/netdevice.hlinux/ip.hlinux/ipv6.hnet/ip6_checksum.hlinux/bitfield.hrmnet_config.hrmnet_map.hrmnet_private.hrmnet_vnd.h
Detected Declarations
function rmnet_map_ipv4_dl_csum_trailerfunction rmnet_map_ipv6_dl_csum_trailerfunction rmnet_map_ipv4_dl_csum_trailerfunction rmnet_map_ipv6_dl_csum_trailerfunction rmnet_map_complement_ipv4_txporthdr_csum_fieldfunction rmnet_map_ipv4_ul_csum_headerfunction rmnet_map_complement_ipv6_txporthdr_csum_fieldfunction rmnet_map_ipv6_ul_csum_headerfunction rmnet_map_ipv6_ul_csum_headerfunction deaggregatefunction rmnet_map_checksum_downlink_packetfunction rmnet_map_v4_checksum_uplink_packetfunction rmnet_map_checksum_uplink_packetfunction rmnet_map_process_next_hdr_packetfunction reset_aggr_paramsfunction rmnet_send_skbfunction rmnet_map_flush_tx_packet_workfunction rmnet_map_flush_tx_packet_queuefunction rmnet_map_tx_aggregatefunction rmnet_map_update_ul_agg_configfunction rmnet_map_tx_aggregate_initfunction rmnet_map_tx_aggregate_exit
Annotated Snippet
if (skb->protocol == htons(ETH_P_IP)) {
u16 ip_len = ((struct iphdr *)iph)->ihl * 4;
proto = ((struct iphdr *)iph)->protocol;
trans = iph + ip_len;
} else if (IS_ENABLED(CONFIG_IPV6) &&
skb->protocol == htons(ETH_P_IPV6)) {
u16 ip_len = sizeof(struct ipv6hdr);
proto = ((struct ipv6hdr *)iph)->nexthdr;
trans = iph + ip_len;
} else {
priv->stats.csum_err_invalid_ip_version++;
goto sw_csum;
}
check = rmnet_map_get_csum_field(proto, trans);
if (check) {
skb->ip_summed = CHECKSUM_NONE;
/* Ask for checksum offloading */
ul_header->csum_info |= MAPV5_CSUMINFO_VALID_FLAG;
priv->stats.csum_hw++;
return;
}
}
sw_csum:
priv->stats.csum_sw++;
}
/* Adds MAP header to front of skb->data
* Padding is calculated and set appropriately in MAP header. Mux ID is
* initialized to 0.
*/
struct rmnet_map_header *rmnet_map_add_map_header(struct sk_buff *skb,
int hdrlen,
struct rmnet_port *port,
int pad)
{
struct rmnet_map_header *map_header;
u32 padding, map_datalen;
map_datalen = skb->len - hdrlen;
map_header = (struct rmnet_map_header *)
skb_push(skb, sizeof(struct rmnet_map_header));
memset(map_header, 0, sizeof(struct rmnet_map_header));
/* Set next_hdr bit for csum offload packets */
if (port->data_format & RMNET_FLAGS_EGRESS_MAP_CKSUMV5)
map_header->flags |= MAP_NEXT_HEADER_FLAG;
if (pad == RMNET_MAP_NO_PAD_BYTES) {
map_header->pkt_len = htons(map_datalen);
return map_header;
}
BUILD_BUG_ON(MAP_PAD_LEN_MASK < 3);
padding = ALIGN(map_datalen, 4) - map_datalen;
if (padding == 0)
goto done;
if (skb_tailroom(skb) < padding)
return NULL;
skb_put_zero(skb, padding);
done:
map_header->pkt_len = htons(map_datalen + padding);
/* This is a data packet, so the CMD bit is 0 */
map_header->flags = padding & MAP_PAD_LEN_MASK;
return map_header;
}
/* Deaggregates a single packet
* A whole new buffer is allocated for each portion of an aggregated frame.
* Caller should keep calling deaggregate() on the source skb until 0 is
* returned, indicating that there are no more packets to deaggregate. Caller
* is responsible for freeing the original skb.
*/
struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb,
struct rmnet_port *port)
{
struct rmnet_map_v5_csum_header *next_hdr = NULL;
struct rmnet_map_header *maph;
void *data = skb->data;
struct sk_buff *skbn;
u8 nexthdr_type;
u32 packet_len;
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/ip.h`, `linux/ipv6.h`, `net/ip6_checksum.h`, `linux/bitfield.h`, `rmnet_config.h`, `rmnet_map.h`, `rmnet_private.h`.
- Detected declarations: `function rmnet_map_ipv4_dl_csum_trailer`, `function rmnet_map_ipv6_dl_csum_trailer`, `function rmnet_map_ipv4_dl_csum_trailer`, `function rmnet_map_ipv6_dl_csum_trailer`, `function rmnet_map_complement_ipv4_txporthdr_csum_field`, `function rmnet_map_ipv4_ul_csum_header`, `function rmnet_map_complement_ipv6_txporthdr_csum_field`, `function rmnet_map_ipv6_ul_csum_header`, `function rmnet_map_ipv6_ul_csum_header`, `function deaggregate`.
- Atlas domain: Driver Families / drivers/net.
- 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.