AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/10/09 10:43 flow patch-triage
9m Args:
null

Results:
{
  "EnableConfigs": [
    "RMNET",
    "NET_VENDOR_QUALCOMM"
  ],
  "FocusSymbols": [
    "rmnet_map_process_next_hdr_packet",
    "rmnet_map_segment_coal_skb",
    "rmnet_map_coal_segment_loop",
    "__rmnet_map_segment_coal_skb",
    "rmnet_map_coal_validate_bounds",
    "rmnet_map_coal_parse_ip_hdr",
    "rmnet_map_coal_parse_trans_hdr",
    "rmnet_map_data_check_coal_header",
    "rmnet_map_validate_packet_len",
    "rmnet_newlink",
    "rmnet_changelink",
    "rmnet_vnd_update_dev_mtu"
  ],
  "KMSANReasoning": "The patch implements downlink hardware coalescing (MAPv5 coalescing header) and related statistics accounting in Qualcomm's rmnet network driver.\n\n1. Analysis of potential uninitialized memory risks:\n- Ethtool statistics: `rmnet_get_ethtool_stats` allocates `snapshot` with `kzalloc_obj`, zero-initializes `total_stats = { }`, and copies `total_stats.ethtool_stats`. The `ethtool_stats` struct group is composed strictly of 64-bit integer fields (`u64`) with no padding holes, and all fields are explicitly accumulated. The count matches `rmnet_gstrings_stats`.\n- Per-CPU statistics: `priv-\u003epcpu_stats` is allocated via `alloc_percpu()` during device initialization, ensuring all fields are zero-initialized.\n- Network stack statistics: In `rmnet_get_stats64` and `rmnet_get_queue_stats_rx`, local stats snapshots are zero-initialized (`= { }`) and copy functions write only the intended fields into structures managed by the core networking subsystem.\n- Internal metadata \u0026 SKB construction: `struct rmnet_map_coal_metadata coal_meta` is explicitly zeroed with `memset` before parsing headers. In `__rmnet_map_segment_coal_skb`, new segment SKBs allocated via `alloc_skb` have their entire valid data range (`hlen + dlen`) populated by `skb_put_data` and header `memcpy` operations; no uninitialized buffer areas remain in the delivered SKBs.\n- Control flow and branching: All local variables (`data_format`, `nlo_err_mask`, `num_nlos`, `num_pkts`, `gro`, etc.) are either explicitly initialized or set prior to being evaluated in conditional branches.\n\n2. KASAN vs KMSAN applicability:\n- The risks introduced by this change involve network packet parsing, header bounds validation, and buffer offset calculations (e.g., in `rmnet_map_coal_validate_bounds`, `rmnet_map_segment_coal_skb`, and `rmnet_map_validate_packet_len`). Any potential logic flaws in length calculations or header offsets could cause out-of-bounds buffer reads or invalid SKB operations, which are detected by standard KASAN and standard kernel assertions.\n- KMSAN is not applicable because no uninitialized memory reads or information leaks to userspace are introduced. Therefore, running a dedicated KMSAN fuzzing session is not justified.",
  "NeedsKMSAN": false,
  "Reasoning": "The Qualcomm rmnet driver is a virtual network device driver accessible via rtnetlink (RTM_NEWLINK with kind 'rmnet') that attaches to any existing network device (such as virtual dummy, veth, or tun interfaces) without requiring physical hardware. This patch implements MAPv5 downlink hardware packet coalescing, introducing extensive packet parsing, bounds checking, NLO error handling, skb segmentation, and GSO metadata generation. Complex parsing and skb manipulation on the network ingress path is a prime candidate for fuzz testing.",
  "WorthFuzzing": true
}

1/1 2026/10/09 10:43 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 0fee58b4fc90270ec5b3cc8520b6ab96b146031e\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Fri Oct 9 10:43:23 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst b/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst\nindex 5aedbabb73827..52f92d2fba311 100644\n--- a/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst\n+++ b/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst\n@@ -125,8 +125,8 @@ Command (1)/ Data (0) bit value is to indicate if the packet is a MAP command\n or data packet. Command packet is used for transport level flow control. Data\n packets are standard IP packets.\n \n-Next header is used to indicate the presence of another header, currently is\n-limited to checksum header.\n+Next header is used to indicate the presence of another header, currently\n+limited to the checksum and coalescing headers.\n \n Padding is the number of bytes to be appended to the payload to\n ensure 4 byte alignment.\n@@ -150,11 +150,11 @@ Header Type is to indicate the type of header, this usually is set to CHECKSUM\n \n Header types\n \n-= ===============\n+= ======================\n 0 Reserved\n-1 Reserved\n+1 coalescing header\n 2 checksum header\n-= ===============\n+= ======================\n \n Checksum Valid is to indicate whether the header checksum is valid. Value of 1\n implies that checksum is calculated on this packet and is valid, value of 0\n@@ -162,8 +162,109 @@ indicates that the calculated packet checksum is invalid.\n \n Reserved bits must be zero when sent and ignored when received.\n \n-e. MAP packet v1/v5 (command specific)\n---------------------------------------\n+e. Coalescing header v5\n+------------------------\n+\n+Hardware can coalesce multiple same-flow IP packets into a single MAP frame\n+to reduce per-packet overhead at high data rates.  Packets are grouped into\n+NLOs, with all packets in each NLO having the same length.  The coalescing\n+header (header type 1) describes the coalesced content.\n+\n+Packet format::\n+\n+  Bit         0 - 6         7          8           9-11         12-15\n+  Function  Header Type  Next Header  CSUM valid  Num NLOs    (reserved)\n+\n+  Bit        16-19        20-23\n+  Function  Close value  Close type\n+\n+  Bit        24-27        28-31\n+  Function  (reserved)    VEID\n+\n+  Bit           32 - 47        48 - 55            56 - 63\n+  Function   Packet length  CSUM error bitmap  Num packets (NLO 0)\n+\n+  ... (up to 6 NLO entries total, same 32-bit format per entry)\n+\n+Header Type is set to 1 (coalescing).\n+\n+The MAP header ``pkt_len`` includes the coalescing header, coalesced packet\n+data, and any MAP padding.\n+\n+Num NLOs (Number-Length Objects) is the count of active NLO entries\n+(1 – 6).  Each NLO describes a group of consecutive coalesced packets\n+that all share the same IP packet length.\n+\n+Num NLOs identifies the active prefix of the six NLO slots.  The header\n+always contains all six slots and remains 28 bytes long regardless of Num\n+NLOs.  A slot with ``num_packets == 0`` ends the active NLO prefix.  The\n+full coalescing header is included in the MAP header's ``pkt_len``.\n+\n+Some hardware may report Num NLOs incorrectly.  For compatibility, receivers\n+should derive the active prefix from ``num_packets`` when needed.  This\n+requires unused slots to have ``num_packets == 0``.\n+\n+CSUM valid (bit 8) is a frame-level indication that the hardware checksum is\n+valid for all packets in the frame. It is distinct from the per-packet CSUM\n+error bitmap in each NLO entry.\n+\n+For a single-NLO, single-packet frame, CSUM valid must not be trusted when\n+the close reason is a FIN/PSH close, a packet limit, a byte limit, or a time\n+limit.  In these cases, the rmnet driver treats the packet checksum as\n+unverified and lets the network stack validate it instead of relying on the\n+coalescing checksum indications.\n+IPv4 UDP packets with a zero checksum remain valid because that checksum is\n+optional.\n+\n+Close type and close value encode the hardware reason that coalescing\n+was terminated for this frame:\n+\n+Close type values:\n+\n+= ==============================\n+0 non-coalesced (single packet)\n+1 IP flow miss\n+2 transport flow miss\n+3 hardware limit (see value)\n+4 coalescing closed (FIN/PSH)\n+= ==============================\n+\n+Close value (used when close type is 3):\n+\n+= ==================\n+0 NL limit reached\n+1 packet limit\n+2 byte limit\n+3 time limit\n+4 eviction\n+= ==================\n+\n+VEID is the virtual endpoint ID of the originating flow.\n+\n+Each NLO entry::\n+\n+  Bit         0 - 15        16 - 23            24 - 31\n+  Function  Pkt length   CSUM error bitmap   Num packets\n+\n+Pkt length is the full IP packet length, including the IP header, transport\n+header, and payload, for every packet in this NLO group. The IP and transport\n+headers are present once in the coalesced frame and are not repeated for each\n+packet.\n+\n+CSUM error bitmap is one 48-bit stream formed by concatenating the\n+``csum_error_bitmap`` bytes from all six NLO slots in slot order. Packet 0\n+corresponds to bit 0 of slot 0's bitmap byte, and bits are consumed from\n+least significant bit to most significant bit. The bit stream is indexed by\n+the packet's absolute position in the frame and does not restart at an NLO\n+boundary. If an NLO contains more than eight packets, its error bits\n+continue into the bitmap byte of the following slot. Bitmap bytes in slots\n+after the active NLO prefix may therefore contain continuation bits and must\n+not be ignored.\n+\n+Num packets is the count of coalesced packets described by this NLO.\n+\n+f. MAP packet v1/v5 (command specific)\n+---------------------------------------\n \n Packet format::\n \n@@ -187,7 +288,7 @@ Command types\n 3 is for error during processing of commands\n = ==========================================\n \n-f. Aggregation\n+g. Aggregation\n --------------\n \n Aggregation is multiple MAP packets (can be data or command) delivered to\n@@ -208,3 +309,39 @@ rmnet userspace configuration is done through netlink using iproute2\n https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/\n \n The driver uses rtnl_link_ops for communication.\n+\n+The data format flags controlling the ingress and egress processing\n+pipeline are set via the ``IFLA_RMNET_FLAGS`` attribute\n+(``struct ifla_rmnet_flags``).\n+\n+Relevant ingress flags:\n+\n+``RMNET_FLAGS_INGRESS_DEAGGREGATION``\n+  Enable MAP frame de-aggregation.\n+\n+``RMNET_FLAGS_INGRESS_MAP_CKSUMV4``\n+  Enable MAPv4 downlink checksum offload.\n+\n+``RMNET_FLAGS_INGRESS_MAP_CKSUMV5``\n+  Enable MAPv5 downlink checksum offload (header type 2).\n+\n+``RMNET_FLAGS_INGRESS_COALESCE``\n+  Enable MAPv5 downlink hardware coalescing (header type 1).\n+  This flag requires ``RMNET_FLAGS_INGRESS_MAP_CKSUMV5``. MAPv4 and\n+  MAPv5 checksum flags cannot be enabled together in either direction.\n+  A direction may leave checksum offload disabled. Invalid combinations\n+  are rejected.\n+  When RX checksum offload and ``rx-gro-hw`` are enabled, valid\n+  multi-packet coalesced frames can be delivered as batched GSO SKBs.\n+  Otherwise, multi-packet coalesced frames are rejected. A coalesced frame\n+  containing one packet is delivered as a normal non-GSO skb. IP options,\n+  IPv6 extension headers, and zero-payload packets can also prevent GSO\n+  processing for a frame.\n+\n+Relevant egress flags:\n+\n+``RMNET_FLAGS_EGRESS_MAP_CKSUMV4``\n+  Enable MAPv4 uplink checksum offload.\n+\n+``RMNET_FLAGS_EGRESS_MAP_CKSUMV5``\n+  Enable MAPv5 uplink checksum offload.\ndiff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c\nindex 61b04c6c0390e..ec882ad371ab7 100644\n--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c\n+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c\n@@ -26,6 +26,31 @@ static int rmnet_is_real_dev_registered(const struct net_device *real_dev)\n \treturn rcu_access_pointer(real_dev-\u003erx_handler) == rmnet_rx_handler;\n }\n \n+/* Only three MAP configurations are supported: MAPv1 (no checksum\n+ * offload), MAPv4 (v4 checksum offload) and MAPv5 (v5 checksum\n+ * offload). MAP command support is orthogonal and permitted with any\n+ * of the three. Checksum offload versions are selected independently\n+ * for ingress and egress, but only one version may be enabled across\n+ * the device. Mixing v4 and v5 checksum flags is not supported. DL\n+ * packet coalescing additionally requires a MAPv5 configuration.\n+ */\n+static bool rmnet_config_data_format_valid(u32 data_format)\n+{\n+\tu32 v4_mask = RMNET_FLAGS_INGRESS_MAP_CKSUMV4 |\n+\t\t      RMNET_FLAGS_EGRESS_MAP_CKSUMV4;\n+\tu32 v5_mask = RMNET_FLAGS_INGRESS_MAP_CKSUMV5 |\n+\t\t      RMNET_FLAGS_EGRESS_MAP_CKSUMV5;\n+\n+\tif ((data_format \u0026 v4_mask) \u0026\u0026 (data_format \u0026 v5_mask))\n+\t\treturn false;\n+\n+\tif ((data_format \u0026 RMNET_FLAGS_INGRESS_COALESCE) \u0026\u0026\n+\t    !(data_format \u0026 RMNET_FLAGS_INGRESS_MAP_CKSUMV5))\n+\t\treturn false;\n+\n+\treturn true;\n+}\n+\n /* Needs rtnl lock */\n struct rmnet_port*\n rmnet_get_port_rtnl(const struct net_device *real_dev)\n@@ -143,6 +168,20 @@ static int rmnet_newlink(struct net_device *dev,\n \t\treturn -ENODEV;\n \t}\n \n+\tif (data[IFLA_RMNET_FLAGS]) {\n+\t\tstruct ifla_rmnet_flags *flags;\n+\n+\t\tflags = nla_data(data[IFLA_RMNET_FLAGS]);\n+\t\tdata_format \u0026= ~flags-\u003emask;\n+\t\tdata_format |= flags-\u003eflags \u0026 flags-\u003emask;\n+\t}\n+\n+\tif (!rmnet_config_data_format_valid(data_format)) {\n+\t\tNL_SET_ERR_MSG_MOD(extack,\n+\t\t\t\t   \"unsupported MAP checksum flag combination\");\n+\t\treturn -EINVAL;\n+\t}\n+\n \tep = kzalloc_obj(*ep);\n \tif (!ep)\n \t\treturn -ENOMEM;\n@@ -154,7 +193,8 @@ static int rmnet_newlink(struct net_device *dev,\n \t\tgoto err0;\n \n \tport = rmnet_get_port_rtnl(real_dev);\n-\terr = rmnet_vnd_newlink(mux_id, dev, port, real_dev, ep, extack);\n+\terr = rmnet_vnd_newlink(mux_id, dev, port, real_dev, ep, extack,\n+\t\t\t\tdata_format);\n \tif (err)\n \t\tgoto err1;\n \n@@ -162,24 +202,23 @@ static int rmnet_newlink(struct net_device *dev,\n \tif (err \u003c 0)\n \t\tgoto err2;\n \n+\t/* Update existing MTUs before publishing the shared data format. */\n+\terr = rmnet_vnd_update_dev_mtu(port, real_dev, data_format);\n+\tif (err)\n+\t\tgoto err3;\n+\n \tport-\u003ermnet_mode = mode;\n \tport-\u003ermnet_dev = dev;\n \n \thlist_add_head_rcu(\u0026ep-\u003ehlnode, \u0026port-\u003emuxed_ep[mux_id]);\n \n-\tif (data[IFLA_RMNET_FLAGS]) {\n-\t\tstruct ifla_rmnet_flags *flags;\n-\n-\t\tflags = nla_data(data[IFLA_RMNET_FLAGS]);\n-\t\tdata_format \u0026= ~flags-\u003emask;\n-\t\tdata_format |= flags-\u003eflags \u0026 flags-\u003emask;\n-\t}\n-\n \tnetdev_dbg(dev, \"data format [0x%08X]\\n\", data_format);\n \tWRITE_ONCE(port-\u003edata_format, data_format);\n \n \treturn 0;\n \n+err3:\n+\tnetdev_upper_dev_unlink(real_dev, dev);\n err2:\n \tunregister_netdevice(dev);\n \trmnet_vnd_dellink(mux_id, port, ep);\n@@ -301,9 +340,13 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],\n \t\t\t    struct netlink_ext_ack *extack)\n {\n \tstruct rmnet_priv *priv = netdev_priv(dev);\n+\tstruct ifla_rmnet_flags *flags;\n \tstruct net_device *real_dev;\n \tstruct rmnet_port *port;\n+\tu32 old_data_format;\n+\tu32 data_format;\n \tu16 mux_id;\n+\tint err;\n \n \tif (!dev)\n \t\treturn -ENODEV;\n@@ -320,6 +363,19 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],\n \n \tport = rmnet_get_port_rtnl(real_dev);\n \n+\tif (data[IFLA_RMNET_FLAGS]) {\n+\t\told_data_format = READ_ONCE(port-\u003edata_format);\n+\t\tflags = nla_data(data[IFLA_RMNET_FLAGS]);\n+\t\tdata_format = old_data_format \u0026 ~flags-\u003emask;\n+\t\tdata_format |= flags-\u003eflags \u0026 flags-\u003emask;\n+\n+\t\tif (!rmnet_config_data_format_valid(data_format)) {\n+\t\t\tNL_SET_ERR_MSG_MOD(extack,\n+\t\t\t\t\t   \"unsupported MAP checksum flag combination\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n \tif (data[IFLA_RMNET_MUX_ID]) {\n \t\tmux_id = nla_get_u16(data[IFLA_RMNET_MUX_ID]);\n \n@@ -346,21 +402,13 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],\n \t}\n \n \tif (data[IFLA_RMNET_FLAGS]) {\n-\t\tstruct ifla_rmnet_flags *flags;\n-\t\tu32 old_data_format;\n-\t\tu32 data_format;\n-\n-\t\told_data_format = port-\u003edata_format;\n-\t\tflags = nla_data(data[IFLA_RMNET_FLAGS]);\n-\t\tdata_format = old_data_format \u0026 ~flags-\u003emask;\n-\t\tdata_format |= flags-\u003eflags \u0026 flags-\u003emask;\n-\t\tWRITE_ONCE(port-\u003edata_format, data_format);\n-\n-\t\tif (rmnet_vnd_update_dev_mtu(port, real_dev)) {\n-\t\t\tWRITE_ONCE(port-\u003edata_format, old_data_format);\n+\t\terr = rmnet_vnd_update_dev_mtu(port, real_dev, data_format);\n+\t\tif (err) {\n \t\t\tNL_SET_ERR_MSG_MOD(extack, \"Invalid MTU on real dev\");\n-\t\t\treturn -EINVAL;\n+\t\t\treturn err;\n \t\t}\n+\n+\t\tWRITE_ONCE(port-\u003edata_format, data_format);\n \t}\n \n \treturn 0;\ndiff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h\nindex 5adda0323dda7..917d31f6eded7 100644\n--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h\n+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h\n@@ -63,31 +63,105 @@ struct rmnet_vnd_stats {\n \tu32 tx_drops;\n };\n \n+struct rmnet_priv_stats {\n+\t/* Network stack RX statistics for all rmnet receive paths */\n+\tu64 rx_hw_gro_packets;\n+\tu64 rx_hw_gro_wire_packets;\n+\tu64 rx_alloc_fail;\n+\tu64 rx_dropped;\n+\n+\t/* Custom diagnostics for the coalescing receive path */\n+\tstruct_group(ethtool_stats, /* ethtool statistics */\n+\t\tu64 csum_ok;\n+\t\tu64 csum_ip4_header_bad;\n+\t\tu64 csum_valid_unset;\n+\t\tu64 csum_validation_failed;\n+\t\tu64 csum_err_bad_buffer;\n+\t\tu64 csum_err_invalid_ip_version;\n+\t\tu64 csum_err_invalid_transport;\n+\t\tu64 csum_fragmented_pkt;\n+\t\tu64 csum_skipped;\n+\t\tu64 csum_sw;\n+\t\tu64 csum_hw;\n+\t\t/* Coalescing-only counters. Some are subsets of the standard counters. */\n+\t\tu64 coal_alloc_fail;\n+\t\tu64 coal_rx;\n+\t\tu64 coal_pkts;\n+\t\tu64 coal_hdr_err;\n+\t\tu64 coal_hdr_pkt_err;\n+\t\tu64 coal_bounds_err;\n+\t\tu64 coal_csum_err;\n+\t\tu64 coal_csum_drop;\n+\t\tu64 coal_reconstruct;\n+\t\tu64 coal_ip_invalid;\n+\t\tu64 coal_trans_invalid;\n+\t\t/* close-reason sub-counters */\n+\t\tu64 coal_close_non_coal;\n+\t\tu64 coal_close_ip_miss;\n+\t\tu64 coal_close_trans_miss;\n+\t\tu64 coal_close_hw_nl;\n+\t\tu64 coal_close_hw_pkt;\n+\t\tu64 coal_close_hw_byte;\n+\t\tu64 coal_close_hw_time;\n+\t\tu64 coal_close_hw_evict;\n+\t\tu64 coal_close_coal;\n+\t);\n+};\n+\n+struct rmnet_pcpu_priv_stats {\n+\t/* Network stack RX statistics for all rmnet receive paths */\n+\tu64_stats_t rx_hw_gro_packets;\n+\tu64_stats_t rx_hw_gro_wire_packets;\n+\tu64_stats_t rx_alloc_fail;\n+\tu64_stats_t rx_dropped;\n+\n+\t/* Custom diagnostics for the coalescing receive path */\n+\tu64_stats_t csum_ok;\n+\tu64_stats_t csum_ip4_header_bad;\n+\tu64_stats_t csum_valid_unset;\n+\tu64_stats_t csum_validation_failed;\n+\tu64_stats_t csum_err_bad_buffer;\n+\tu64_stats_t csum_err_invalid_ip_version;\n+\tu64_stats_t csum_err_invalid_transport;\n+\tu64_stats_t csum_fragmented_pkt;\n+\tu64_stats_t csum_skipped;\n+\tu64_stats_t csum_sw;\n+\tu64_stats_t csum_hw;\n+\t/* Coalescing-only counters. Some are subsets of the standard counters. */\n+\tu64_stats_t coal_alloc_fail;\n+\tu64_stats_t coal_rx;\n+\tu64_stats_t coal_pkts;\n+\tu64_stats_t coal_hdr_err;\n+\tu64_stats_t coal_hdr_pkt_err;\n+\tu64_stats_t coal_bounds_err;\n+\tu64_stats_t coal_csum_err;\n+\tu64_stats_t coal_csum_drop;\n+\tu64_stats_t coal_reconstruct;\n+\tu64_stats_t coal_ip_invalid;\n+\tu64_stats_t coal_trans_invalid;\n+\t/* close-reason sub-counters */\n+\tu64_stats_t coal_close_non_coal;\n+\tu64_stats_t coal_close_ip_miss;\n+\tu64_stats_t coal_close_trans_miss;\n+\tu64_stats_t coal_close_hw_nl;\n+\tu64_stats_t coal_close_hw_pkt;\n+\tu64_stats_t coal_close_hw_byte;\n+\tu64_stats_t coal_close_hw_time;\n+\tu64_stats_t coal_close_hw_evict;\n+\tu64_stats_t coal_close_coal;\n+};\n+\n struct rmnet_pcpu_stats {\n \tstruct rmnet_vnd_stats stats;\n+\tstruct rmnet_pcpu_priv_stats priv_stats;\n \tstruct u64_stats_sync syncp;\n };\n \n-struct rmnet_priv_stats {\n-\tu64 csum_ok;\n-\tu64 csum_ip4_header_bad;\n-\tu64 csum_valid_unset;\n-\tu64 csum_validation_failed;\n-\tu64 csum_err_bad_buffer;\n-\tu64 csum_err_invalid_ip_version;\n-\tu64 csum_err_invalid_transport;\n-\tu64 csum_fragmented_pkt;\n-\tu64 csum_skipped;\n-\tu64 csum_sw;\n-\tu64 csum_hw;\n-};\n-\n struct rmnet_priv {\n \tu8 mux_id;\n \tstruct net_device *real_dev;\n \tstruct rmnet_pcpu_stats __percpu *pcpu_stats;\n \tstruct gro_cells gro_cells;\n-\tstruct rmnet_priv_stats stats;\n };\n \n struct rmnet_port *rmnet_get_port_rcu(const struct net_device *real_dev);\ndiff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c\nindex aa5523f4618eb..bb867ceb01c1c 100644\n--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c\n+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c\n@@ -50,6 +50,16 @@ rmnet_deliver_skb(struct sk_buff *skb)\n \tgro_cells_receive(\u0026priv-\u003egro_cells, skb);\n }\n \n+static void rmnet_deliver_skb_list(struct sk_buff_head *head)\n+{\n+\tstruct sk_buff *skb;\n+\n+\twhile ((skb = __skb_dequeue(head))) {\n+\t\trmnet_set_skb_proto(skb);\n+\t\trmnet_deliver_skb(skb);\n+\t}\n+}\n+\n /* MAP handler */\n \n static void\n@@ -59,6 +69,7 @@ __rmnet_map_ingress_handler(struct sk_buff *skb,\n {\n \tstruct rmnet_map_header *map_header = (void *)skb-\u003edata;\n \tstruct rmnet_endpoint *ep;\n+\tstruct sk_buff_head list;\n \tu16 len, pad;\n \tu8 mux_id;\n \n@@ -83,12 +94,13 @@ __rmnet_map_ingress_handler(struct sk_buff *skb,\n \n \tskb-\u003edev = ep-\u003eegress_dev;\n \n-\tif ((data_format \u0026 RMNET_FLAGS_INGRESS_MAP_CKSUMV5) \u0026\u0026\n+\t__skb_queue_head_init(\u0026list);\n+\n+\tif ((data_format \u0026\n+\t     (RMNET_FLAGS_INGRESS_MAP_CKSUMV5 | RMNET_FLAGS_INGRESS_COALESCE)) \u0026\u0026\n \t    (map_header-\u003eflags \u0026 MAP_NEXT_HEADER_FLAG)) {\n-\t\tif (rmnet_map_process_next_hdr_packet(skb, len))\n+\t\tif (rmnet_map_process_next_hdr_packet(skb, \u0026list, len, data_format))\n \t\t\tgoto free_skb;\n-\t\tskb_pull(skb, sizeof(*map_header));\n-\t\trmnet_set_skb_proto(skb);\n \t} else {\n \t\t/* Subtract MAP header */\n \t\tskb_pull(skb, sizeof(*map_header));\n@@ -96,10 +108,11 @@ __rmnet_map_ingress_handler(struct sk_buff *skb,\n \t\tif (data_format \u0026 RMNET_FLAGS_INGRESS_MAP_CKSUMV4 \u0026\u0026\n \t\t    !rmnet_map_checksum_downlink_packet(skb, len + pad))\n \t\t\tskb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n+\t\tskb_trim(skb, len);\n+\t\t__skb_queue_tail(\u0026list, skb);\n \t}\n \n-\tskb_trim(skb, len);\n-\trmnet_deliver_skb(skb);\n+\trmnet_deliver_skb_list(\u0026list);\n \treturn;\n \n free_skb:\ndiff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h\nindex 0977e495f5915..77ddac6023c01 100644\n--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h\n+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h\n@@ -6,6 +6,22 @@\n #define _RMNET_MAP_H_\n #include \u003clinux/if_rmnet.h\u003e\n \n+enum rmnet_map_v5_close_type {\n+\tRMNET_MAP_COAL_CLOSE_NON_COAL,\n+\tRMNET_MAP_COAL_CLOSE_IP_MISS,\n+\tRMNET_MAP_COAL_CLOSE_TRANS_MISS,\n+\tRMNET_MAP_COAL_CLOSE_HW,\n+\tRMNET_MAP_COAL_CLOSE_COAL,\n+};\n+\n+enum rmnet_map_v5_close_value {\n+\tRMNET_MAP_COAL_CLOSE_HW_NL,\n+\tRMNET_MAP_COAL_CLOSE_HW_PKT,\n+\tRMNET_MAP_COAL_CLOSE_HW_BYTE,\n+\tRMNET_MAP_COAL_CLOSE_HW_TIME,\n+\tRMNET_MAP_COAL_CLOSE_HW_EVICT,\n+};\n+\n struct rmnet_map_control_command {\n \tu8  command_name;\n \tu8  cmd_type:2;\n@@ -53,7 +69,9 @@ void rmnet_map_checksum_uplink_packet(struct sk_buff *skb,\n \t\t\t\t      struct rmnet_port *port,\n \t\t\t\t      struct net_device *orig_dev,\n \t\t\t\t      int csum_type);\n-int rmnet_map_process_next_hdr_packet(struct sk_buff *skb, u16 len);\n+int rmnet_map_process_next_hdr_packet(struct sk_buff *skb,\n+\t\t\t\t      struct sk_buff_head *list,\n+\t\t\t\t      u16 len, u32 data_format);\n unsigned int rmnet_map_tx_aggregate(struct sk_buff *skb, struct rmnet_port *port,\n \t\t\t\t    struct net_device *orig_dev);\n void rmnet_map_tx_aggregate_init(struct rmnet_port *port);\ndiff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c\nindex 39d6d084e73f0..74d64b7066e2b 100644\n--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c\n+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c\n@@ -7,7 +7,11 @@\n #include \u003clinux/netdevice.h\u003e\n #include \u003clinux/ip.h\u003e\n #include \u003clinux/ipv6.h\u003e\n+#include \u003clinux/tcp.h\u003e\n+#include \u003clinux/udp.h\u003e\n+#include \u003cnet/ip.h\u003e\n #include \u003cnet/ip6_checksum.h\u003e\n+#include \u003cnet/ipv6.h\u003e\n #include \u003clinux/bitfield.h\u003e\n #include \"rmnet_config.h\"\n #include \"rmnet_map.h\"\n@@ -17,6 +21,19 @@\n #define RMNET_MAP_DEAGGR_SPACING  64\n #define RMNET_MAP_DEAGGR_HEADROOM (RMNET_MAP_DEAGGR_SPACING / 2)\n \n+struct rmnet_map_coal_metadata {\n+\tvoid *ip_header;\n+\tvoid *trans_header;\n+\tu16 ip_len;\n+\tu16 trans_len;\n+\tu16 data_offset;\n+\tu16 data_len;\n+\tu8 ip_proto;\n+\tu8 trans_proto;\n+\tu8 pkt_count;\n+\tbool zero_csum;\n+};\n+\n static __sum16 *rmnet_map_get_csum_field(unsigned char protocol,\n \t\t\t\t\t const void *txporthdr)\n {\n@@ -36,34 +53,45 @@ rmnet_map_ipv4_dl_csum_trailer(struct sk_buff *skb,\n {\n \tstruct iphdr *ip4h = (struct iphdr *)skb-\u003edata;\n \tvoid *txporthdr = skb-\u003edata + ip4h-\u003eihl * 4;\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n \t__sum16 *csum_field, pseudo_csum;\n \t__sum16 ip_payload_csum;\n \n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n+\n \t/* Computing the checksum over just the IPv4 header--including its\n \t * checksum field--should yield 0.  If it doesn't, the IP header\n \t * is bad, so return an error and let the IP layer drop it.\n \t */\n \tif (ip_fast_csum(ip4h, ip4h-\u003eihl)) {\n-\t\tpriv-\u003estats.csum_ip4_header_bad++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_ip4_header_bad);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\treturn -EINVAL;\n \t}\n \n \t/* We don't support checksum offload on IPv4 fragments */\n \tif (ip_is_fragment(ip4h)) {\n-\t\tpriv-\u003estats.csum_fragmented_pkt++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_fragmented_pkt);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\treturn -EOPNOTSUPP;\n \t}\n \n \t/* Checksum offload is only supported for UDP and TCP protocols */\n \tcsum_field = rmnet_map_get_csum_field(ip4h-\u003eprotocol, txporthdr);\n \tif (!csum_field) {\n-\t\tpriv-\u003estats.csum_err_invalid_transport++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_err_invalid_transport);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\treturn -EPROTONOSUPPORT;\n \t}\n \n \t/* RFC 768: UDP checksum is optional for IPv4, and is 0 if unused */\n \tif (!*csum_field \u0026\u0026 ip4h-\u003eprotocol == IPPROTO_UDP) {\n-\t\tpriv-\u003estats.csum_skipped++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_skipped);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\treturn 0;\n \t}\n \n@@ -96,11 +124,15 @@ rmnet_map_ipv4_dl_csum_trailer(struct sk_buff *skb,\n \n \t/* The cast is required to ensure only the low 16 bits are examined */\n \tif (ip_payload_csum != (__sum16)~pseudo_csum) {\n-\t\tpriv-\u003estats.csum_validation_failed++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_validation_failed);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\treturn -EINVAL;\n \t}\n \n-\tpriv-\u003estats.csum_ok++;\n+\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_ok);\n+\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \treturn 0;\n }\n \n@@ -112,16 +144,21 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb,\n {\n \tstruct ipv6hdr *ip6h = (struct ipv6hdr *)skb-\u003edata;\n \tvoid *txporthdr = skb-\u003edata + sizeof(*ip6h);\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n \t__sum16 *csum_field, pseudo_csum;\n \t__sum16 ip6_payload_csum;\n \t__be16 ip_header_csum;\n \n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n+\n \t/* Checksum offload is only supported for UDP and TCP protocols;\n \t * the packet cannot include any IPv6 extension headers\n \t */\n \tcsum_field = rmnet_map_get_csum_field(ip6h-\u003enexthdr, txporthdr);\n \tif (!csum_field) {\n-\t\tpriv-\u003estats.csum_err_invalid_transport++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_err_invalid_transport);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\treturn -EPROTONOSUPPORT;\n \t}\n \n@@ -147,11 +184,15 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb,\n \t * examined.\n \t */\n \tif (ip6_payload_csum != (__sum16)~pseudo_csum) {\n-\t\tpriv-\u003estats.csum_validation_failed++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_validation_failed);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\treturn -EINVAL;\n \t}\n \n-\tpriv-\u003estats.csum_ok++;\n+\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_ok);\n+\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \treturn 0;\n }\n #else\n@@ -246,6 +287,9 @@ static void rmnet_map_v5_checksum_uplink_packet(struct sk_buff *skb,\n {\n \tstruct rmnet_priv *priv = netdev_priv(orig_dev);\n \tstruct rmnet_map_v5_csum_header *ul_header;\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n+\n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n \n \tul_header = skb_push(skb, sizeof(*ul_header));\n \tmemset(ul_header, 0, sizeof(*ul_header));\n@@ -270,7 +314,9 @@ static void rmnet_map_v5_checksum_uplink_packet(struct sk_buff *skb,\n \t\t\tproto = ((struct ipv6hdr *)iph)-\u003enexthdr;\n \t\t\ttrans = iph + ip_len;\n \t\t} else {\n-\t\t\tpriv-\u003estats.csum_err_invalid_ip_version++;\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_err_invalid_ip_version);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\t\tgoto sw_csum;\n \t\t}\n \n@@ -279,13 +325,17 @@ static void rmnet_map_v5_checksum_uplink_packet(struct sk_buff *skb,\n \t\t\tskb-\u003eip_summed = CHECKSUM_NONE;\n \t\t\t/* Ask for checksum offloading */\n \t\t\tul_header-\u003ecsum_info |= MAPV5_CSUMINFO_VALID_FLAG;\n-\t\t\tpriv-\u003estats.csum_hw++;\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_hw);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\t\treturn;\n \t\t}\n \t}\n \n sw_csum:\n-\tpriv-\u003estats.csum_sw++;\n+\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_sw);\n+\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n }\n \n /* Adds MAP header to front of skb-\u003edata\n@@ -337,8 +387,8 @@ u32 rmnet_map_validate_packet_len(struct sk_buff *skb, u32 data_format)\n {\n \tstruct rmnet_map_v5_csum_header *next_hdr = NULL;\n \tstruct rmnet_map_header *maph;\n-\tvoid *data = skb-\u003edata;\n \tu32 packet_len;\n+\tu8 hdr_type;\n \n \tif (skb-\u003elen \u003c sizeof(*maph))\n \t\treturn 0;\n@@ -353,24 +403,28 @@ u32 rmnet_map_validate_packet_len(struct sk_buff *skb, u32 data_format)\n \n \tif (data_format \u0026 RMNET_FLAGS_INGRESS_MAP_CKSUMV4) {\n \t\tpacket_len += sizeof(struct rmnet_map_dl_csum_trailer);\n-\t} else if ((data_format \u0026 RMNET_FLAGS_INGRESS_MAP_CKSUMV5) \u0026\u0026\n+\t} else if ((data_format \u0026\n+\t\t    (RMNET_FLAGS_INGRESS_MAP_CKSUMV5 | RMNET_FLAGS_INGRESS_COALESCE)) \u0026\u0026\n \t\t   !(maph-\u003eflags \u0026 MAP_CMD_FLAG)) {\n-\t\t/* Mapv5 data pkt without csum hdr is invalid */\n \t\tif (!(maph-\u003eflags \u0026 MAP_NEXT_HEADER_FLAG))\n \t\t\treturn 0;\n \n-\t\tpacket_len += sizeof(*next_hdr);\n-\t\tnext_hdr = data + sizeof(*maph);\n+\t\tif (skb-\u003elen \u003c sizeof(*maph) + sizeof(*next_hdr))\n+\t\t\treturn 0;\n+\n+\t\tnext_hdr = (struct rmnet_map_v5_csum_header *)(skb-\u003edata + sizeof(*maph));\n+\t\thdr_type = u8_get_bits(next_hdr-\u003eheader_info,\n+\t\t\t\t       MAPV5_HDRINFO_HDR_TYPE_FMASK);\n+\n+\t\tif (hdr_type == RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD)\n+\t\t\tpacket_len += sizeof(*next_hdr);\n+\t\telse if (hdr_type != RMNET_MAP_HEADER_TYPE_COALESCING)\n+\t\t\treturn 0;\n \t}\n \n \tif (skb-\u003elen \u003c packet_len)\n \t\treturn 0;\n \n-\tif (next_hdr \u0026\u0026\n-\t    u8_get_bits(next_hdr-\u003eheader_info, MAPV5_HDRINFO_HDR_TYPE_FMASK) !=\n-\t    RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD)\n-\t\treturn 0;\n-\n \treturn packet_len;\n }\n \n@@ -413,16 +467,23 @@ int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len)\n {\n \tstruct rmnet_priv *priv = netdev_priv(skb-\u003edev);\n \tstruct rmnet_map_dl_csum_trailer *csum_trailer;\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n+\n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n \n \tif (unlikely(!(skb-\u003edev-\u003efeatures \u0026 NETIF_F_RXCSUM))) {\n-\t\tpriv-\u003estats.csum_sw++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_sw);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\treturn -EOPNOTSUPP;\n \t}\n \n \tcsum_trailer = (struct rmnet_map_dl_csum_trailer *)(skb-\u003edata + len);\n \n \tif (!(csum_trailer-\u003eflags \u0026 MAP_CSUM_DL_VALID_FLAG)) {\n-\t\tpriv-\u003estats.csum_valid_unset++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_valid_unset);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\treturn -EINVAL;\n \t}\n \n@@ -432,7 +493,9 @@ int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len)\n \tif (IS_ENABLED(CONFIG_IPV6) \u0026\u0026 skb-\u003eprotocol == htons(ETH_P_IPV6))\n \t\treturn rmnet_map_ipv6_dl_csum_trailer(skb, csum_trailer, priv);\n \n-\tpriv-\u003estats.csum_err_invalid_ip_version++;\n+\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_err_invalid_ip_version);\n+\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \n \treturn -EPROTONOSUPPORT;\n }\n@@ -442,8 +505,11 @@ static void rmnet_map_v4_checksum_uplink_packet(struct sk_buff *skb,\n {\n \tstruct rmnet_priv *priv = netdev_priv(orig_dev);\n \tstruct rmnet_map_ul_csum_header *ul_header;\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n \tvoid *iphdr;\n \n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n+\n \tul_header = (struct rmnet_map_ul_csum_header *)\n \t\t    skb_push(skb, sizeof(struct rmnet_map_ul_csum_header));\n \n@@ -459,22 +525,30 @@ static void rmnet_map_v4_checksum_uplink_packet(struct sk_buff *skb,\n \n \tif (skb-\u003eprotocol == htons(ETH_P_IP)) {\n \t\trmnet_map_ipv4_ul_csum_header(iphdr, ul_header, skb);\n-\t\tpriv-\u003estats.csum_hw++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_hw);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\treturn;\n \t}\n \n \tif (IS_ENABLED(CONFIG_IPV6) \u0026\u0026 skb-\u003eprotocol == htons(ETH_P_IPV6)) {\n \t\trmnet_map_ipv6_ul_csum_header(iphdr, ul_header, skb);\n-\t\tpriv-\u003estats.csum_hw++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_hw);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \t\treturn;\n \t}\n \n-\tpriv-\u003estats.csum_err_invalid_ip_version++;\n+\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_err_invalid_ip_version);\n+\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n \n sw_csum:\n \tmemset(ul_header, 0, sizeof(*ul_header));\n \n-\tpriv-\u003estats.csum_sw++;\n+\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_sw);\n+\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n }\n \n /* Generates UL checksum meta info header for IPv4 and IPv6 over TCP and UDP\n@@ -497,34 +571,847 @@ void rmnet_map_checksum_uplink_packet(struct sk_buff *skb,\n \t}\n }\n \n-/* Process a MAPv5 packet header */\n-int rmnet_map_process_next_hdr_packet(struct sk_buff *skb,\n-\t\t\t\t      u16 len)\n+static struct rmnet_map_v5_csum_header *\n+rmnet_map_get_next_hdr(struct sk_buff *skb)\n {\n-\tstruct rmnet_priv *priv = netdev_priv(skb-\u003edev);\n-\tstruct rmnet_map_v5_csum_header *next_hdr;\n-\tu8 nexthdr_type;\n+\treturn (struct rmnet_map_v5_csum_header *)(skb-\u003edata +\n+\t\t\t\t\t\t   sizeof(struct rmnet_map_header));\n+}\n+\n+static u8 rmnet_map_get_next_hdr_type(struct sk_buff *skb)\n+{\n+\tstruct rmnet_map_v5_csum_header *hdr = rmnet_map_get_next_hdr(skb);\n+\n+\treturn u8_get_bits(hdr-\u003eheader_info, MAPV5_HDRINFO_HDR_TYPE_FMASK);\n+}\n+\n+static bool rmnet_map_get_csum_valid(struct sk_buff *skb)\n+{\n+\tstruct rmnet_map_v5_csum_header *hdr = rmnet_map_get_next_hdr(skb);\n \n-\tnext_hdr = (struct rmnet_map_v5_csum_header *)(skb-\u003edata +\n-\t\t\tsizeof(struct rmnet_map_header));\n+\treturn !!(hdr-\u003ecsum_info \u0026 MAPV5_CSUMINFO_VALID_FLAG);\n+}\n+\n+/* Stamp GSO metadata so the network stack can segment a coalesced SKB. */\n+static void rmnet_map_gso_stamp(struct sk_buff *skb,\n+\t\t\t\tstruct rmnet_map_coal_metadata *coal_meta)\n+{\n+\tstruct skb_shared_info *shinfo = skb_shinfo(skb);\n \n-\tnexthdr_type = u8_get_bits(next_hdr-\u003eheader_info,\n-\t\t\t\t   MAPV5_HDRINFO_HDR_TYPE_FMASK);\n+\tif (coal_meta-\u003etrans_proto == IPPROTO_TCP)\n+\t\tshinfo-\u003egso_type = (coal_meta-\u003eip_proto == 4) ?\n+\t\t\t\t   SKB_GSO_TCPV4 : SKB_GSO_TCPV6;\n+\telse\n+\t\tshinfo-\u003egso_type = SKB_GSO_UDP_L4;\n \n-\tif (nexthdr_type != RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD)\n+\tshinfo-\u003egso_size = coal_meta-\u003edata_len;\n+\tshinfo-\u003egso_segs = coal_meta-\u003epkt_count;\n+}\n+\n+/* Set the transport checksum to the pseudo-header checksum and request\n+ * partial checksum offload, letting the NIC or stack finish it.\n+ */\n+static void rmnet_map_partial_csum(struct sk_buff *skb,\n+\t\t\t\t   struct rmnet_map_coal_metadata *coal_meta)\n+{\n+\tu16 pkt_len = skb-\u003elen - coal_meta-\u003eip_len;\n+\tunsigned char *data = skb-\u003edata;\n+\t__sum16 pseudo;\n+\n+\tif (coal_meta-\u003eip_proto == 4) {\n+\t\tstruct iphdr *iph = (struct iphdr *)data;\n+\n+\t\tpseudo = ~csum_tcpudp_magic(iph-\u003esaddr, iph-\u003edaddr,\n+\t\t\t\t\t    pkt_len, coal_meta-\u003etrans_proto, 0);\n+\t} else {\n+\t\tstruct ipv6hdr *ip6h = (struct ipv6hdr *)data;\n+\n+\t\tpseudo = ~csum_ipv6_magic(\u0026ip6h-\u003esaddr, \u0026ip6h-\u003edaddr,\n+\t\t\t\t\t  pkt_len, coal_meta-\u003etrans_proto, 0);\n+\t}\n+\n+\tif (coal_meta-\u003etrans_proto == IPPROTO_TCP) {\n+\t\tstruct tcphdr *tp = (struct tcphdr *)(data + coal_meta-\u003eip_len);\n+\n+\t\ttp-\u003echeck = pseudo;\n+\t\tskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n+\t} else {\n+\t\tstruct udphdr *up = (struct udphdr *)(data + coal_meta-\u003eip_len);\n+\n+\t\tup-\u003echeck = pseudo;\n+\t\tskb-\u003ecsum_offset = offsetof(struct udphdr, check);\n+\t}\n+\n+\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\n+\tskb-\u003ecsum_start = skb-\u003edata + coal_meta-\u003eip_len - skb-\u003ehead;\n+}\n+\n+/* On some hardware, num_nlos in the coalescing header can be reported\n+ * incorrectly under certain conditions even though the per-NLO num_packets\n+ * fields it is meant to summarize are correct. Recompute the NLO count from\n+ * the contiguous nl_pairs[] prefix rather than trusting the declared value.\n+ * The first empty NLO marks the end of the prefix. Entries after it are not\n+ * processed.\n+ */\n+static int rmnet_map_v5_get_num_nlos(const struct rmnet_map_v5_coal_header *coal_hdr)\n+{\n+\tint nlos;\n+\n+\tfor (nlos = 0; nlos \u003c RMNET_MAP_V5_MAX_NLOS; nlos++)\n+\t\tif (!coal_hdr-\u003enl_pairs[nlos].num_packets)\n+\t\t\tbreak;\n+\n+\tif (!nlos)\n \t\treturn -EINVAL;\n \n-\tif (unlikely(!(skb-\u003edev-\u003efeatures \u0026 NETIF_F_RXCSUM))) {\n-\t\tpriv-\u003estats.csum_sw++;\n-\t} else if (next_hdr-\u003ecsum_info \u0026 MAPV5_CSUMINFO_VALID_FLAG) {\n-\t\tpriv-\u003estats.csum_ok++;\n-\t\tskb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n+\treturn nlos;\n+}\n+\n+static void rmnet_map_v5_set_nlos(struct rmnet_map_v5_coal_header *coal_hdr,\n+\t\t\t\t  u8 nlos)\n+{\n+\tcoal_hdr-\u003ecoal_info = u8_encode_bits(nlos, MAPV5_COALINFO_NUM_NLOS_FMASK) |\n+\t\t\t\t      (coal_hdr-\u003ecoal_info \u0026 MAPV5_COALINFO_CSUM_VALID_FLAG);\n+}\n+\n+/* The frame-level CSUM_VALID indication for a single NLO, single packet\n+ * coalescing frame cannot be trusted when the close reason is a TCP FIN/PSH,\n+ * a packet count limit, a byte count limit or a time limit.\n+ */\n+static bool rmnet_map_v5_csum_fixup(struct rmnet_map_v5_coal_header *coal_hdr)\n+{\n+\tu8 close_value = u8_get_bits(coal_hdr-\u003eclose_info,\n+\t\t\t\t     MAPV5_CLOSEINFO_CLOSE_VALUE_FMASK);\n+\tu8 close_type = u8_get_bits(coal_hdr-\u003eclose_info,\n+\t\t\t\t    MAPV5_CLOSEINFO_CLOSE_TYPE_FMASK);\n+\tu8 num_nlos = u8_get_bits(coal_hdr-\u003ecoal_info,\n+\t\t\t\t  MAPV5_COALINFO_NUM_NLOS_FMASK);\n+\n+\t/* Only applies to single NLO, single packet frames */\n+\tif (num_nlos != 1 || coal_hdr-\u003enl_pairs[0].num_packets != 1)\n+\t\treturn false;\n+\n+\t/* TCP FIN or PSH triggered the close */\n+\tif (close_type == RMNET_MAP_COAL_CLOSE_COAL)\n+\t\treturn true;\n+\n+\t/* Hit a hardware limit */\n+\tif (close_type == RMNET_MAP_COAL_CLOSE_HW) {\n+\t\tswitch (close_value) {\n+\t\tcase RMNET_MAP_COAL_CLOSE_HW_PKT:\n+\t\tcase RMNET_MAP_COAL_CLOSE_HW_BYTE:\n+\t\tcase RMNET_MAP_COAL_CLOSE_HW_TIME:\n+\t\t\treturn true;\n+\t\t}\n+\t}\n+\n+\treturn false;\n+}\n+\n+/* Carve one logical segment from a coalesced SKB and append it to the list.\n+ * Adjusts TCP sequence numbers, IP IDs/lengths, and checksum state.\n+ */\n+static void\n+__rmnet_map_segment_coal_skb(struct sk_buff *coal_skb,\n+\t\t\t     struct rmnet_map_coal_metadata *coal_meta,\n+\t\t\t     struct sk_buff_head *list, u8 pkt_id,\n+\t\t\t     bool csum_valid)\n+{\n+\tu32 dlen = coal_meta-\u003edata_len * coal_meta-\u003epkt_count;\n+\tstruct rmnet_priv *priv = netdev_priv(coal_skb-\u003edev);\n+\tu32 hlen = coal_meta-\u003eip_len + coal_meta-\u003etrans_len;\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n+\tstruct sk_buff *skbn;\n+\n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n+\n+\t/* RFC 768: UDP checksum is optional for IPv4, and is 0 if unused.\n+\t * Such packets are never actually bad, regardless of what the\n+\t * checksum bitmap says.\n+\t */\n+\tif (!csum_valid \u0026\u0026 coal_meta-\u003ezero_csum)\n+\t\tcsum_valid = true;\n+\n+\tif (!csum_valid) {\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t/* rx_dropped is standard accounting. coal_csum_drop is its\n+\t\t * coalescing-specific checksum error subset.\n+\t\t */\n+\t\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.rx_dropped, coal_meta-\u003epkt_count);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_csum_drop);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\tgoto next_pkt;\n+\t}\n+\n+\tskbn = alloc_skb(hlen + dlen + RMNET_MAP_DEAGGR_HEADROOM, GFP_ATOMIC);\n+\tif (!skbn) {\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t/* The coal counter is the coalescing subset of the standard\n+\t\t * allocation failure and RX drop counters.\n+\t\t */\n+\t\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.rx_alloc_fail, coal_meta-\u003epkt_count);\n+\t\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.rx_dropped, coal_meta-\u003epkt_count);\n+\t\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.coal_alloc_fail, coal_meta-\u003epkt_count);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\tgoto next_pkt;\n+\t}\n+\n+\tskb_reserve(skbn, hlen + RMNET_MAP_DEAGGR_HEADROOM);\n+\tskb_put_data(skbn,\n+\t\t     coal_skb-\u003edata + coal_meta-\u003eip_len + coal_meta-\u003etrans_len +\n+\t\t     coal_meta-\u003edata_offset,\n+\t\t     dlen);\n+\n+\t/* Restore transport header */\n+\tskb_push(skbn, coal_meta-\u003etrans_len);\n+\tmemcpy(skbn-\u003edata, coal_meta-\u003etrans_header, coal_meta-\u003etrans_len);\n+\tskb_reset_transport_header(skbn);\n+\n+\tif (coal_meta-\u003etrans_proto == IPPROTO_TCP) {\n+\t\tstruct tcphdr *th = tcp_hdr(skbn);\n+\n+\t\tth-\u003eseq = htonl(ntohl(th-\u003eseq) + coal_meta-\u003edata_offset);\n+\t\t/* Strip dangerous flags from non-final segments */\n+\t\tif ((th-\u003efin || th-\u003epsh) \u0026\u0026\n+\t\t    hlen + coal_meta-\u003edata_offset + dlen \u003c coal_skb-\u003elen) {\n+\t\t\tth-\u003efin = 0;\n+\t\t\tth-\u003epsh = 0;\n+\t\t}\n+\t} else if (coal_meta-\u003etrans_proto == IPPROTO_UDP) {\n+\t\tstruct udphdr *uh = udp_hdr(skbn);\n+\n+\t\tuh-\u003elen = htons(skbn-\u003elen);\n+\t}\n+\n+\t/* Restore IP header */\n+\tskb_push(skbn, coal_meta-\u003eip_len);\n+\tmemcpy(skbn-\u003edata, coal_meta-\u003eip_header, coal_meta-\u003eip_len);\n+\tskb_reset_network_header(skbn);\n+\n+\tif (coal_meta-\u003eip_proto == 4) {\n+\t\tstruct iphdr *iph = ip_hdr(skbn);\n+\n+\t\tiph-\u003eid = htons(ntohs(iph-\u003eid) + pkt_id);\n+\t\tiph-\u003etot_len = htons(skbn-\u003elen);\n+\t\tiph-\u003echeck = 0;\n+\t\tiph-\u003echeck = ip_fast_csum(iph, iph-\u003eihl);\n+\t} else {\n+\t\tipv6_hdr(skbn)-\u003epayload_len =\n+\t\t\thtons(skbn-\u003elen - sizeof(struct ipv6hdr));\n+\t}\n+\n+\trmnet_map_partial_csum(skbn, coal_meta);\n+\n+\tskbn-\u003edev = coal_skb-\u003edev;\n+\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_reconstruct);\n+\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\n+\tif (coal_meta-\u003epkt_count \u003e 1)\n+\t\trmnet_map_gso_stamp(skbn, coal_meta);\n+\n+\t__skb_queue_tail(list, skbn);\n+\n+next_pkt:\n+\tcoal_meta-\u003edata_offset += dlen;\n+\tcoal_meta-\u003epkt_count = 0;\n+}\n+\n+/* Parse the IP header of the coalesced frame and perform basic\n+ * validation of header fields.\n+ */\n+static bool rmnet_map_coal_parse_ip_hdr(struct sk_buff *coal_skb,\n+\t\t\t\t\tstruct rmnet_map_coal_metadata *meta,\n+\t\t\t\t\tbool *gro)\n+{\n+\tstruct rmnet_priv *priv = netdev_priv(coal_skb-\u003edev);\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n+\tstruct ipv6hdr *ip6h;\n+\tstruct iphdr *iph;\n+\t__be16 frag_off;\n+\tu8 protocol;\n+\tint ret;\n+\n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n+\n+\tif (coal_skb-\u003elen \u003c sizeof(*iph)) {\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\treturn false;\n+\t}\n+\n+\tiph = (struct iphdr *)coal_skb-\u003edata;\n+\n+\tif (iph-\u003eversion == 4) {\n+\t\tmeta-\u003eip_proto = 4;\n+\t\tmeta-\u003eip_len = iph-\u003eihl * 4;\n+\t\tmeta-\u003etrans_proto = iph-\u003eprotocol;\n+\t\tmeta-\u003eip_header = iph;\n+\t\tif (meta-\u003eip_len \u003c sizeof(*iph) || coal_skb-\u003elen \u003c meta-\u003eip_len) {\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tif (ip_is_fragment(iph)) {\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tif (iph-\u003eihl != 5)\n+\t\t\t*gro = false;\n+\t} else if (iph-\u003eversion == 6) {\n+\t\tif (coal_skb-\u003elen \u003c sizeof(*ip6h)) {\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tip6h = (struct ipv6hdr *)iph;\n+\t\tprotocol = ip6h-\u003enexthdr;\n+\t\tmeta-\u003eip_proto = 6;\n+\t\tret = ipv6_skip_exthdr(coal_skb, sizeof(*ip6h), \u0026protocol,\n+\t\t\t\t       \u0026frag_off);\n+\t\tif (ret \u003c 0 || frag_off || ret \u003e U16_MAX) {\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tmeta-\u003eip_len = (u16)ret;\n+\t\tmeta-\u003etrans_proto = protocol;\n+\t\tmeta-\u003eip_header = ip6h;\n+\t\tif (coal_skb-\u003elen \u003c meta-\u003eip_len) {\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tif (meta-\u003eip_len \u003e sizeof(*ip6h))\n+\t\t\t*gro = false;\n+\t} else {\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n+/* Parse the transport header following the IP header into coal_meta. The\n+ * available length is checked before any field is read.\n+ */\n+static bool rmnet_map_coal_parse_trans_hdr(struct sk_buff *coal_skb,\n+\t\t\t\t\t   struct rmnet_map_coal_metadata *meta)\n+{\n+\tstruct rmnet_priv *priv = netdev_priv(coal_skb-\u003edev);\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n+\tstruct udphdr *uh;\n+\tstruct tcphdr *th;\n+\tu32 avail;\n+\tu8 *base;\n+\n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n+\n+\tif (meta-\u003eip_len \u003e coal_skb-\u003elen) {\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_trans_invalid);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\treturn false;\n+\t}\n+\n+\tbase = (u8 *)meta-\u003eip_header + meta-\u003eip_len;\n+\tavail = coal_skb-\u003elen - meta-\u003eip_len;\n+\n+\tif (meta-\u003etrans_proto == IPPROTO_TCP) {\n+\t\tif (avail \u003c sizeof(*th)) {\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_trans_invalid);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tth = (struct tcphdr *)base;\n+\t\tmeta-\u003etrans_len = th-\u003edoff * 4;\n+\t\tmeta-\u003etrans_header = th;\n+\t\tif (meta-\u003etrans_len \u003c sizeof(*th) || avail \u003c meta-\u003etrans_len) {\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_trans_invalid);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\treturn false;\n+\t\t}\n+\t} else if (meta-\u003etrans_proto == IPPROTO_UDP) {\n+\t\tif (avail \u003c sizeof(*uh)) {\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_trans_invalid);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tuh = (struct udphdr *)base;\n+\t\tmeta-\u003etrans_len = sizeof(*uh);\n+\t\tmeta-\u003etrans_header = uh;\n+\t\tif (meta-\u003eip_proto == 4 \u0026\u0026 !uh-\u003echeck)\n+\t\t\tmeta-\u003ezero_csum = true;\n \t} else {\n-\t\tpriv-\u003estats.csum_valid_unset++;\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_trans_invalid);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n+/* Reject the frame unless the total data bytes claimed by all NLOs\n+ * exactly match the actual payload in the SKB. Each pkt_len covers\n+ * IP+transport headers plus per-packet data. Headers appear once, so\n+ * subtract hlen per packet and track the running sum against available\n+ * data. An exact match is required, not just an upper bound, so that\n+ * GSO metadata stamped from the NLOs stays consistent with the real\n+ * SKB length.\n+ */\n+static bool rmnet_map_coal_validate_bounds(struct sk_buff *coal_skb,\n+\t\t\t\t\t   struct rmnet_map_v5_coal_header *coal_hdr,\n+\t\t\t\t\t   u8 num_nlos, u32 hlen, bool *gro)\n+{\n+\tu32 total_data = 0;\n+\tu32 nlo_len;\n+\tu16 plen;\n+\tu8 i;\n+\n+\tif (hlen \u003e coal_skb-\u003elen)\n+\t\treturn false;\n+\n+\tfor (i = 0; i \u003c num_nlos; i++) {\n+\t\tplen = ntohs(coal_hdr-\u003enl_pairs[i].pkt_len);\n+\n+\t\tif (plen \u003c hlen)\n+\t\t\treturn false;\n+\n+\t\t/* Zero-payload packets cannot use GSO with a zero gso_size. */\n+\t\tif (plen == hlen)\n+\t\t\t*gro = false;\n+\n+\t\tnlo_len = (u32)(plen - hlen) * coal_hdr-\u003enl_pairs[i].num_packets;\n+\t\tif (nlo_len \u003e coal_skb-\u003elen - hlen - total_data)\n+\t\t\treturn false;\n+\n+\t\ttotal_data += nlo_len;\n+\t}\n+\n+\treturn total_data == coal_skb-\u003elen - hlen;\n+}\n+\n+/* Attempt the GRO-friendly fast path for a single-NLO, checksum-valid frame\n+ * by reusing the original SKB and stamping GSO metadata instead of copying\n+ * out each segment.  Returns true if the frame was consumed via the fast\n+ * path, or false if the caller should fall back to full segmentation.\n+ */\n+static bool rmnet_map_coal_gro_fast_path(struct sk_buff *coal_skb,\n+\t\t\t\t\t struct rmnet_map_v5_coal_header *coal_hdr,\n+\t\t\t\t\t struct rmnet_map_coal_metadata *coal_meta,\n+\t\t\t\t\t struct sk_buff_head *list,\n+\t\t\t\t\t u8 num_nlos, bool gro)\n+{\n+\tu32 hlen = coal_meta-\u003eip_len + coal_meta-\u003etrans_len;\n+\n+\tif (!gro || num_nlos != 1 ||\n+\t    !(coal_hdr-\u003ecoal_info \u0026 MAPV5_COALINFO_CSUM_VALID_FLAG))\n+\t\treturn false;\n+\n+\tcoal_meta-\u003edata_len = ntohs(coal_hdr-\u003enl_pairs[0].pkt_len) - hlen;\n+\tcoal_meta-\u003epkt_count = coal_hdr-\u003enl_pairs[0].num_packets;\n+\n+\tcoal_skb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n+\tif (coal_meta-\u003epkt_count \u003e 1) {\n+\t\trmnet_map_partial_csum(coal_skb, coal_meta);\n+\t\trmnet_map_gso_stamp(coal_skb, coal_meta);\n+\t}\n+\n+\t__skb_queue_tail(list, coal_skb);\n+\treturn true;\n+}\n+\n+/* NLO packet lengths are already bounds-checked by\n+ * rmnet_map_coal_validate_bounds() so no further validation is needed here.\n+ */\n+static void rmnet_map_coal_segment_loop(struct sk_buff *coal_skb,\n+\t\t\t\t\tstruct rmnet_map_v5_coal_header *coal_hdr,\n+\t\t\t\t\tstruct rmnet_map_coal_metadata *coal_meta,\n+\t\t\t\t\tstruct sk_buff_head *list,\n+\t\t\t\t\tu64 nlo_err_mask, bool gro, u8 num_nlos)\n+{\n+\tstruct rmnet_priv *priv = netdev_priv(coal_skb-\u003edev);\n+\tu32 hlen = coal_meta-\u003eip_len + coal_meta-\u003etrans_len;\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n+\tu8 pkt, total_pkt = 0;\n+\tbool csum_err;\n+\tu16 pkt_len;\n+\tu8 nlo;\n+\n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n+\n+\tfor (nlo = 0; nlo \u003c num_nlos; nlo++) {\n+\t\tpkt_len = ntohs(coal_hdr-\u003enl_pairs[nlo].pkt_len);\n+\t\tpkt_len -= hlen;\n+\t\tcoal_meta-\u003edata_len = pkt_len;\n+\n+\t\t/* nlo_err_mask is one flat bitstream across all NLOs. Shift\n+\t\t * it once per packet in absolute frame order and do not\n+\t\t * re-align at the NLO boundary above. See the comment on\n+\t\t * rmnet_map_data_check_coal_header() for why.\n+\t\t */\n+\t\tfor (pkt = 0; pkt \u003c coal_hdr-\u003enl_pairs[nlo].num_packets;\n+\t\t     pkt++, total_pkt++, nlo_err_mask \u003e\u003e= 1) {\n+\t\t\tcsum_err = nlo_err_mask \u0026 1;\n+\n+\t\t\tif (csum_err) {\n+\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_csum_err);\n+\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\t}\n+\n+\t\t\tif (!gro) {\n+\t\t\t\tcoal_meta-\u003epkt_count = 1;\n+\t\t\t\t__rmnet_map_segment_coal_skb(coal_skb, coal_meta,\n+\t\t\t\t\t\t\t     list, total_pkt,\n+\t\t\t\t\t\t\t     !csum_err);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\tif (csum_err) {\n+\t\t\t\tif (coal_meta-\u003epkt_count)\n+\t\t\t\t\t__rmnet_map_segment_coal_skb(coal_skb,\n+\t\t\t\t\t\t\t\t     coal_meta,\n+\t\t\t\t\t\t\t\t     list,\n+\t\t\t\t\t\t\t\t     total_pkt -\n+\t\t\t\t\t\t\t\t     coal_meta-\u003epkt_count,\n+\t\t\t\t\t\t\t\t     true);\n+\t\t\t\tcoal_meta-\u003epkt_count = 1;\n+\t\t\t\t__rmnet_map_segment_coal_skb(coal_skb, coal_meta,\n+\t\t\t\t\t\t\t     list, total_pkt,\n+\t\t\t\t\t\t\t     false);\n+\t\t\t} else {\n+\t\t\t\tcoal_meta-\u003epkt_count++;\n+\t\t\t}\n+\t\t}\n+\n+\t\t/* Flush remaining packets from this NLO */\n+\t\tif (coal_meta-\u003epkt_count)\n+\t\t\t__rmnet_map_segment_coal_skb(coal_skb, coal_meta, list,\n+\t\t\t\t\t\t     total_pkt - coal_meta-\u003epkt_count, true);\n+\t}\n+}\n+\n+/* Expand a coalesced SKB into individual IP packets placed on the list.\n+ * NLOs with checksum errors are dropped. __rmnet_map_ingress_handler will\n+ * free the SKB in the error case.\n+ */\n+static int rmnet_map_segment_coal_skb(struct sk_buff *coal_skb,\n+\t\t\t\t      u64 nlo_err_mask,\n+\t\t\t\t      struct sk_buff_head *list,\n+\t\t\t\t      u16 len, u16 total_pkts, u8 num_nlos)\n+{\n+\tbool gro_hw = coal_skb-\u003edev-\u003efeatures \u0026 NETIF_F_GRO_HW;\n+\tbool rxcsum = coal_skb-\u003edev-\u003efeatures \u0026 NETIF_F_RXCSUM;\n+\tstruct rmnet_priv *priv = netdev_priv(coal_skb-\u003edev);\n+\tstruct rmnet_map_v5_coal_header *coal_hdr;\n+\tstruct rmnet_map_coal_metadata coal_meta;\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n+\tbool gro = gro_hw;\n+\tu32 hlen;\n+\n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n+\n+\tmemset(\u0026coal_meta, 0, sizeof(coal_meta));\n+\n+\t/* Drop any MAP frame padding. The coal header is counted in len */\n+\tskb_pull(coal_skb, sizeof(struct rmnet_map_header));\n+\tskb_trim(coal_skb, len);\n+\tcoal_hdr = (struct rmnet_map_v5_coal_header *)coal_skb-\u003edata;\n+\trmnet_map_v5_set_nlos(coal_hdr, num_nlos);\n+\tskb_pull(coal_skb, sizeof(*coal_hdr));\n+\n+\tif (!rmnet_map_coal_parse_ip_hdr(coal_skb, \u0026coal_meta, \u0026gro))\n+\t\treturn -EINVAL;\n+\n+\tif (!rmnet_map_coal_parse_trans_hdr(coal_skb, \u0026coal_meta))\n+\t\treturn -EINVAL;\n+\n+\thlen = coal_meta.ip_len + coal_meta.trans_len;\n+\n+\tif (!rmnet_map_coal_validate_bounds(coal_skb, coal_hdr, num_nlos, hlen,\n+\t\t\t\t\t    \u0026gro)) {\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_bounds_err);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Device capability gates coalesced delivery. Packet format can still\n+\t * disable GSO and use the per-packet fallback below.\n+\t */\n+\tif (total_pkts \u003e 1 \u0026\u0026 (!rxcsum || !gro_hw))\n+\t\treturn -EINVAL;\n+\n+\tif (gro \u0026\u0026 total_pkts \u003e 1) {\n+\t\t/* Standard counters cover delivered HW-GRO skbs. coal_rx and\n+\t\t * coal_pkts cover coalescing input regardless of HW-GRO.\n+\t\t */\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.rx_hw_gro_packets);\n+\t\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.rx_hw_gro_wire_packets, total_pkts);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t}\n+\n+\tif (total_pkts == 1 \u0026\u0026 (!rxcsum || !gro_hw)) {\n+\t\tcoal_skb-\u003eip_summed = CHECKSUM_NONE;\n+\t\t__skb_queue_tail(list, coal_skb);\n+\t\treturn 0;\n+\t}\n+\n+\tif (rmnet_map_v5_csum_fixup(coal_hdr) \u0026\u0026 !coal_meta.zero_csum) {\n+\t\tcoal_skb-\u003eip_summed = CHECKSUM_NONE;\n+\t\t__skb_queue_tail(list, coal_skb);\n+\t\treturn 0;\n+\t}\n+\n+\tif (rmnet_map_coal_gro_fast_path(coal_skb, coal_hdr, \u0026coal_meta, list,\n+\t\t\t\t\t num_nlos, gro))\n+\t\treturn 0;\n+\n+\trmnet_map_coal_segment_loop(coal_skb, coal_hdr, \u0026coal_meta, list,\n+\t\t\t\t    nlo_err_mask, gro, num_nlos);\n+\n+\treturn 0;\n+}\n+\n+/* Log the hardware close-reason counter for a coalescing header. */\n+static void rmnet_map_data_log_close_stats(struct rmnet_pcpu_stats *pcpu_ptr,\n+\t\t\t\t\t   u8 type, u8 code)\n+{\n+\tswitch (type) {\n+\tcase RMNET_MAP_COAL_CLOSE_NON_COAL:\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_non_coal);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\tbreak;\n+\tcase RMNET_MAP_COAL_CLOSE_IP_MISS:\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_ip_miss);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\tbreak;\n+\tcase RMNET_MAP_COAL_CLOSE_TRANS_MISS:\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_trans_miss);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\tbreak;\n+\tcase RMNET_MAP_COAL_CLOSE_HW:\n+\t\tswitch (code) {\n+\t\tcase RMNET_MAP_COAL_CLOSE_HW_NL:\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_hw_nl);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tbreak;\n+\t\tcase RMNET_MAP_COAL_CLOSE_HW_PKT:\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_hw_pkt);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tbreak;\n+\t\tcase RMNET_MAP_COAL_CLOSE_HW_BYTE:\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_hw_byte);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tbreak;\n+\t\tcase RMNET_MAP_COAL_CLOSE_HW_TIME:\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_hw_time);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tbreak;\n+\t\tcase RMNET_MAP_COAL_CLOSE_HW_EVICT:\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_hw_evict);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tbreak;\n+\t\t}\n+\t\tbreak;\n+\tcase RMNET_MAP_COAL_CLOSE_COAL:\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_coal);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\tbreak;\n+\tdefault:\n+\t\tbreak;\n \t}\n+}\n \n-\t/* Pull csum v5 header */\n-\tskb_pull(skb, sizeof(*next_hdr));\n+/* Validate the coalescing header and build the checksum error mask.\n+ *\n+ * Checks performed:\n+ *  - MAP pkt_len accommodates the coal header (coal header is counted in\n+ *    pkt_len. pkt_len \u003c sizeof(*coal_hdr) means no payload is possible).\n+ *  - num_nlos is in [1, RMNET_MAP_V5_MAX_NLOS].\n+ *  - Total packet count does not exceed RMNET_MAP_V5_MAX_PACKETS.\n+ *\n+ * nlo_err_mask is NOT six independent per-NLO bitmaps. Each nl_pairs\n+ * slot only has room for an 8 bit csum_error_bitmap, but a single NLO\n+ * can carry more than 8 packets (up to RMNET_MAP_V5_MAX_PACKETS), so\n+ * hardware spills a wide NLO's error bits into the csum_error_bitmap\n+ * bytes of the following slots rather than truncating them. The\n+ * six bitmap bytes are therefore always concatenated in slot order\n+ * into one flat RMNET_MAP_V5_MAX_NLOS * 8 = RMNET_MAP_V5_MAX_PACKETS\n+ * bit value, addressed by a packet's absolute position in the frame,\n+ * regardless of how many NLOs are actually in use. Receivers must\n+ * walk it as a single contiguous stream and must not expect it to\n+ * align it at NLO boundaries.\n+ */\n+static int rmnet_map_data_check_coal_header(struct sk_buff *skb,\n+\t\t\t\t\t    u64 *nlo_err_mask,\n+\t\t\t\t\t    u8 *num_nlos,\n+\t\t\t\t\t    u16 *num_pkts)\n+{\n+\tstruct rmnet_map_header *maph = (struct rmnet_map_header *)skb-\u003edata;\n+\tstruct rmnet_priv *priv = netdev_priv(skb-\u003edev);\n+\tstruct rmnet_map_v5_coal_header *coal_hdr;\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n+\tu16 pkts = 0;\n+\tu64 mask = 0;\n+\tint nlos;\n+\tint i;\n+\n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n+\n+\t/* coal header is counted in pkt_len */\n+\tif (ntohs(maph-\u003epkt_len) \u003c sizeof(*coal_hdr)) {\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_hdr_err);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tcoal_hdr = (struct rmnet_map_v5_coal_header *)(skb-\u003edata + sizeof(*maph));\n+\tnlos = rmnet_map_v5_get_num_nlos(coal_hdr);\n+\tif (nlos \u003c 0) {\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_hdr_err);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t*num_nlos = nlos;\n+\tfor (i = 0; i \u003c RMNET_MAP_V5_MAX_NLOS; i++) {\n+\t\tu8 err = coal_hdr-\u003enl_pairs[i].csum_error_bitmap;\n+\t\tu8 pkt = coal_hdr-\u003enl_pairs[i].num_packets;\n+\n+\t\tmask |= ((u64)err) \u003c\u003c (8 * i);\n+\t\tif (i \u003c *num_nlos) {\n+\t\t\tpkts += pkt;\n+\t\t\tif (pkts \u003e RMNET_MAP_V5_MAX_PACKETS) {\n+\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_hdr_pkt_err);\n+\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t/* coal_pkts counts packets reported by the hardware, independent of\n+\t * whether the frame is later delivered through HW-GRO.\n+\t */\n+\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.coal_pkts, pkts);\n+\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\trmnet_map_data_log_close_stats(pcpu_ptr,\n+\t\t\t\t       u8_get_bits(coal_hdr-\u003eclose_info,\n+\t\t\t\t\t\t   MAPV5_CLOSEINFO_CLOSE_TYPE_FMASK),\n+\t\t\t\t       u8_get_bits(coal_hdr-\u003eclose_info,\n+\t\t\t\t\t\t   MAPV5_CLOSEINFO_CLOSE_VALUE_FMASK));\n+\n+\t*nlo_err_mask = mask;\n+\t*num_pkts = pkts;\n+\treturn 0;\n+}\n+\n+int rmnet_map_process_next_hdr_packet(struct sk_buff *skb,\n+\t\t\t\t      struct sk_buff_head *list,\n+\t\t\t\t      u16 len, u32 data_format)\n+{\n+\tstruct rmnet_priv *priv = netdev_priv(skb-\u003edev);\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n+\tu64 nlo_err_mask;\n+\tu16 num_pkts;\n+\tu8 num_nlos;\n+\tint rc;\n+\n+\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n+\n+\tswitch (rmnet_map_get_next_hdr_type(skb)) {\n+\tcase RMNET_MAP_HEADER_TYPE_COALESCING:\n+\t\tif (!(data_format \u0026 RMNET_FLAGS_INGRESS_COALESCE))\n+\t\t\treturn -EINVAL;\n+\n+\t\t/* coal_rx counts coalescing input, not delivered HW-GRO skbs. */\n+\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_rx);\n+\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\trc = rmnet_map_data_check_coal_header(skb, \u0026nlo_err_mask,\n+\t\t\t\t\t\t      \u0026num_nlos, \u0026num_pkts);\n+\t\tif (rc)\n+\t\t\treturn rc;\n+\n+\t\t/* Coalescing rewrites shared packet data and GSO metadata. */\n+\t\tif (skb_unclone(skb, GFP_ATOMIC))\n+\t\t\treturn -ENOMEM;\n+\n+\t\trc = rmnet_map_segment_coal_skb(skb, nlo_err_mask, list, len,\n+\t\t\t\t\t\tnum_pkts, num_nlos);\n+\t\tif (rc)\n+\t\t\treturn rc;\n+\n+\t\tif (skb_peek(list) != skb) {\n+\t\t\tif (skb_queue_empty(list))\n+\t\t\t\tkfree_skb(skb);\n+\t\t\telse\n+\t\t\t\tconsume_skb(skb);\n+\t\t}\n+\t\tbreak;\n+\n+\tcase RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD:\n+\t\tif (unlikely(!(skb-\u003edev-\u003efeatures \u0026 NETIF_F_RXCSUM))) {\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_sw);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t} else if (rmnet_map_get_csum_valid(skb)) {\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_ok);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tskb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n+\t\t} else {\n+\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_valid_unset);\n+\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n+\t\t}\n+\n+\t\tskb_pull(skb, sizeof(struct rmnet_map_header) +\n+\t\t\t      sizeof(struct rmnet_map_v5_csum_header));\n+\t\tskb_trim(skb, len);\n+\t\t__skb_queue_tail(list, skb);\n+\t\tbreak;\n+\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n \n \treturn 0;\n }\ndiff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c\nindex 5f921cddf82b4..d76af4788243b 100644\n--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c\n+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c\n@@ -7,6 +7,7 @@\n #include \u003clinux/capability.h\u003e\n #include \u003clinux/etherdevice.h\u003e\n #include \u003clinux/ethtool.h\u003e\n+#include \u003cnet/netdev_queues.h\u003e\n #include \u003clinux/if_arp.h\u003e\n #include \u003clinux/netlink.h\u003e\n #include \u003cnet/pkt_sched.h\u003e\n@@ -66,27 +67,25 @@ static netdev_tx_t rmnet_vnd_start_xmit(struct sk_buff *skb,\n \treturn NETDEV_TX_OK;\n }\n \n-static int rmnet_vnd_headroom(struct rmnet_port *port)\n+static int rmnet_vnd_headroom(u32 data_format)\n {\n \tu32 headroom;\n \n \theadroom = sizeof(struct rmnet_map_header);\n \n-\tif (port-\u003edata_format \u0026 RMNET_FLAGS_EGRESS_MAP_CKSUMV4)\n+\tif (data_format \u0026 RMNET_FLAGS_EGRESS_MAP_CKSUMV4)\n \t\theadroom += sizeof(struct rmnet_map_ul_csum_header);\n \n \treturn headroom;\n }\n \n-static int rmnet_vnd_change_mtu(struct net_device *rmnet_dev, int new_mtu)\n+static int rmnet_vnd_change_mtu_with_format(struct net_device *rmnet_dev,\n+\t\t\t\t\t    int new_mtu, u32 data_format)\n {\n \tstruct rmnet_priv *priv = netdev_priv(rmnet_dev);\n-\tstruct rmnet_port *port;\n \tu32 headroom;\n \n-\tport = rmnet_get_port_rtnl(priv-\u003ereal_dev);\n-\n-\theadroom = rmnet_vnd_headroom(port);\n+\theadroom = rmnet_vnd_headroom(data_format);\n \n \tif (new_mtu \u003c 0 || new_mtu \u003e RMNET_MAX_PACKET_SIZE ||\n \t    new_mtu \u003e (priv-\u003ereal_dev-\u003emtu - headroom))\n@@ -96,6 +95,17 @@ static int rmnet_vnd_change_mtu(struct net_device *rmnet_dev, int new_mtu)\n \treturn 0;\n }\n \n+static int rmnet_vnd_change_mtu(struct net_device *rmnet_dev, int new_mtu)\n+{\n+\tstruct rmnet_priv *priv = netdev_priv(rmnet_dev);\n+\tstruct rmnet_port *port;\n+\n+\tport = rmnet_get_port_rtnl(priv-\u003ereal_dev);\n+\n+\treturn rmnet_vnd_change_mtu_with_format(rmnet_dev, new_mtu,\n+\t\t\t\t\t\tREAD_ONCE(port-\u003edata_format));\n+}\n+\n static int rmnet_vnd_get_iflink(const struct net_device *dev)\n {\n \tstruct rmnet_priv *priv = netdev_priv(dev);\n@@ -132,8 +142,10 @@ static void rmnet_vnd_uninit(struct net_device *dev)\n static void rmnet_get_stats64(struct net_device *dev,\n \t\t\t      struct rtnl_link_stats64 *s)\n {\n+\tstruct rmnet_priv_stats total_priv_stats = { };\n \tstruct rmnet_priv *priv = netdev_priv(dev);\n \tstruct rmnet_vnd_stats total_stats = { };\n+\tstruct rmnet_priv_stats priv_snapshot;\n \tstruct rmnet_pcpu_stats *pcpu_ptr;\n \tstruct rmnet_vnd_stats snapshot;\n \tunsigned int cpu, start;\n@@ -144,6 +156,8 @@ static void rmnet_get_stats64(struct net_device *dev,\n \t\tdo {\n \t\t\tstart = u64_stats_fetch_begin(\u0026pcpu_ptr-\u003esyncp);\n \t\t\tsnapshot = pcpu_ptr-\u003estats;\t/* struct assignment */\n+\t\t\tu64_stats_copy(\u0026priv_snapshot, \u0026pcpu_ptr-\u003epriv_stats,\n+\t\t\t\t       sizeof(priv_snapshot));\n \t\t} while (u64_stats_fetch_retry(\u0026pcpu_ptr-\u003esyncp, start));\n \n \t\ttotal_stats.rx_pkts += snapshot.rx_pkts;\n@@ -151,6 +165,7 @@ static void rmnet_get_stats64(struct net_device *dev,\n \t\ttotal_stats.tx_pkts += snapshot.tx_pkts;\n \t\ttotal_stats.tx_bytes += snapshot.tx_bytes;\n \t\ttotal_stats.tx_drops += snapshot.tx_drops;\n+\t\ttotal_priv_stats.rx_dropped += priv_snapshot.rx_dropped;\n \t}\n \n \ts-\u003erx_packets = total_stats.rx_pkts;\n@@ -158,8 +173,45 @@ static void rmnet_get_stats64(struct net_device *dev,\n \ts-\u003etx_packets = total_stats.tx_pkts;\n \ts-\u003etx_bytes = total_stats.tx_bytes;\n \ts-\u003etx_dropped = total_stats.tx_drops;\n+\ts-\u003erx_dropped = total_priv_stats.rx_dropped;\n+}\n+\n+/* Report standard network stack RX statistics. These are distinct from the\n+ * rmnet-specific coalescing diagnostics exposed through ethtool.\n+ */\n+static void rmnet_get_queue_stats_rx(struct net_device *dev, int idx,\n+\t\t\t\t     struct netdev_queue_stats_rx *stats)\n+{\n+\tstruct rmnet_priv *priv = netdev_priv(dev);\n+\tstruct rmnet_priv_stats total_stats = { };\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n+\tstruct rmnet_priv_stats snapshot;\n+\tunsigned int cpu, start;\n+\n+\tfor_each_possible_cpu(cpu) {\n+\t\tpcpu_ptr = per_cpu_ptr(priv-\u003epcpu_stats, cpu);\n+\n+\t\tdo {\n+\t\t\tstart = u64_stats_fetch_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_copy(\u0026snapshot, \u0026pcpu_ptr-\u003epriv_stats,\n+\t\t\t\t       sizeof(snapshot));\n+\t\t} while (u64_stats_fetch_retry(\u0026pcpu_ptr-\u003esyncp, start));\n+\n+\t\ttotal_stats.rx_hw_gro_packets += snapshot.rx_hw_gro_packets;\n+\t\ttotal_stats.rx_hw_gro_wire_packets +=\n+\t\t\tsnapshot.rx_hw_gro_wire_packets;\n+\t\ttotal_stats.rx_alloc_fail += snapshot.rx_alloc_fail;\n+\t}\n+\n+\tstats-\u003ehw_gro_packets = total_stats.rx_hw_gro_packets;\n+\tstats-\u003ehw_gro_wire_packets = total_stats.rx_hw_gro_wire_packets;\n+\tstats-\u003ealloc_fail = total_stats.rx_alloc_fail;\n }\n \n+static const struct netdev_stat_ops rmnet_stat_ops = {\n+\t.get_queue_stats_rx = rmnet_get_queue_stats_rx,\n+};\n+\n static const struct net_device_ops rmnet_vnd_ops = {\n \t.ndo_start_xmit = rmnet_vnd_start_xmit,\n \t.ndo_change_mtu = rmnet_vnd_change_mtu,\n@@ -183,8 +235,34 @@ static const char rmnet_gstrings_stats[][ETH_GSTRING_LEN] = {\n \t\"Checksum skipped\",\n \t\"Checksum computed in software\",\n \t\"Checksum computed in hardware\",\n+\t/* DL coalescing */\n+\t\"Coal alloc packet drops\",\n+\t\"Coal frames received\",\n+\t\"Packets in coal frames\",\n+\t\"Coal header errors\",\n+\t\"Coal hdr pkt count errors\",\n+\t\"Coal bounds errors\",\n+\t\"Coal checksum errors\",\n+\t\"Coal packets csum err drops\",\n+\t\"Coal segments reconstructed\",\n+\t\"Coal invalid IP packet\",\n+\t\"Coal invalid transport\",\n+\t/* close reasons */\n+\t\"Coal closed: non-coal\",\n+\t\"Coal closed: IP miss\",\n+\t\"Coal closed: transport miss\",\n+\t\"Coal closed: hw NL limit\",\n+\t\"Coal closed: hw pkt limit\",\n+\t\"Coal closed: hw byte limit\",\n+\t\"Coal closed: hw time limit\",\n+\t\"Coal closed: hw evict\",\n+\t\"Coal closed: FIN/PSH\",\n };\n \n+static_assert(ARRAY_SIZE(rmnet_gstrings_stats) ==\n+\t      (sizeof(struct rmnet_priv_stats) -\n+\t       offsetof(struct rmnet_priv_stats, csum_ok)) / sizeof(u64));\n+\n static void rmnet_get_strings(struct net_device *dev, u32 stringset, u8 *buf)\n {\n \tswitch (stringset) {\n@@ -209,12 +287,68 @@ static void rmnet_get_ethtool_stats(struct net_device *dev,\n \t\t\t\t    struct ethtool_stats *stats, u64 *data)\n {\n \tstruct rmnet_priv *priv = netdev_priv(dev);\n-\tstruct rmnet_priv_stats *st = \u0026priv-\u003estats;\n+\tstruct rmnet_priv_stats total_stats = { };\n+\tstruct rmnet_pcpu_stats *pcpu_ptr;\n+\tstruct rmnet_priv_stats *snapshot;\n+\tunsigned int cpu, start;\n \n \tif (!data)\n \t\treturn;\n \n-\tmemcpy(data, st, ARRAY_SIZE(rmnet_gstrings_stats) * sizeof(u64));\n+\tsnapshot = kzalloc_obj(*snapshot);\n+\tif (!snapshot)\n+\t\treturn;\n+\n+\tfor_each_possible_cpu(cpu) {\n+\t\tpcpu_ptr = per_cpu_ptr(priv-\u003epcpu_stats, cpu);\n+\n+\t\tdo {\n+\t\t\tstart = u64_stats_fetch_begin(\u0026pcpu_ptr-\u003esyncp);\n+\t\t\tu64_stats_copy(snapshot, \u0026pcpu_ptr-\u003epriv_stats,\n+\t\t\t\t       sizeof(*snapshot));\n+\t\t} while (u64_stats_fetch_retry(\u0026pcpu_ptr-\u003esyncp, start));\n+\n+\t\ttotal_stats.csum_ok += snapshot-\u003ecsum_ok;\n+\t\ttotal_stats.csum_ip4_header_bad += snapshot-\u003ecsum_ip4_header_bad;\n+\t\ttotal_stats.csum_valid_unset += snapshot-\u003ecsum_valid_unset;\n+\t\ttotal_stats.csum_validation_failed += snapshot-\u003ecsum_validation_failed;\n+\t\ttotal_stats.csum_err_bad_buffer += snapshot-\u003ecsum_err_bad_buffer;\n+\t\ttotal_stats.csum_err_invalid_ip_version +=\n+\t\t\tsnapshot-\u003ecsum_err_invalid_ip_version;\n+\t\ttotal_stats.csum_err_invalid_transport +=\n+\t\t\tsnapshot-\u003ecsum_err_invalid_transport;\n+\t\ttotal_stats.csum_fragmented_pkt += snapshot-\u003ecsum_fragmented_pkt;\n+\t\ttotal_stats.csum_skipped += snapshot-\u003ecsum_skipped;\n+\t\ttotal_stats.csum_sw += snapshot-\u003ecsum_sw;\n+\t\ttotal_stats.csum_hw += snapshot-\u003ecsum_hw;\n+\t\t/* Custom rmnet coalescing diagnostics follow. */\n+\t\ttotal_stats.coal_alloc_fail += snapshot-\u003ecoal_alloc_fail;\n+\t\ttotal_stats.coal_rx += snapshot-\u003ecoal_rx;\n+\t\ttotal_stats.coal_pkts += snapshot-\u003ecoal_pkts;\n+\t\ttotal_stats.coal_hdr_err += snapshot-\u003ecoal_hdr_err;\n+\t\ttotal_stats.coal_hdr_pkt_err += snapshot-\u003ecoal_hdr_pkt_err;\n+\t\ttotal_stats.coal_bounds_err += snapshot-\u003ecoal_bounds_err;\n+\t\ttotal_stats.coal_csum_err += snapshot-\u003ecoal_csum_err;\n+\t\ttotal_stats.coal_csum_drop += snapshot-\u003ecoal_csum_drop;\n+\t\ttotal_stats.coal_reconstruct += snapshot-\u003ecoal_reconstruct;\n+\t\ttotal_stats.coal_ip_invalid += snapshot-\u003ecoal_ip_invalid;\n+\t\ttotal_stats.coal_trans_invalid += snapshot-\u003ecoal_trans_invalid;\n+\t\ttotal_stats.coal_close_non_coal += snapshot-\u003ecoal_close_non_coal;\n+\t\ttotal_stats.coal_close_ip_miss += snapshot-\u003ecoal_close_ip_miss;\n+\t\ttotal_stats.coal_close_trans_miss += snapshot-\u003ecoal_close_trans_miss;\n+\t\ttotal_stats.coal_close_hw_nl += snapshot-\u003ecoal_close_hw_nl;\n+\t\ttotal_stats.coal_close_hw_pkt += snapshot-\u003ecoal_close_hw_pkt;\n+\t\ttotal_stats.coal_close_hw_byte += snapshot-\u003ecoal_close_hw_byte;\n+\t\ttotal_stats.coal_close_hw_time += snapshot-\u003ecoal_close_hw_time;\n+\t\ttotal_stats.coal_close_hw_evict += snapshot-\u003ecoal_close_hw_evict;\n+\t\ttotal_stats.coal_close_coal += snapshot-\u003ecoal_close_coal;\n+\t}\n+\n+\tkfree(snapshot);\n+\n+\t/* The first four fields are reported through netdev queue statistics. */\n+\tmemcpy(data, \u0026total_stats.ethtool_stats,\n+\t       sizeof(total_stats.ethtool_stats));\n }\n \n static int rmnet_get_coalesce(struct net_device *dev,\n@@ -308,8 +442,7 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,\n \t\t      struct rmnet_port *port,\n \t\t      struct net_device *real_dev,\n \t\t      struct rmnet_endpoint *ep,\n-\t\t      struct netlink_ext_ack *extack)\n-\n+\t\t      struct netlink_ext_ack *extack, u32 data_format)\n {\n \tstruct rmnet_priv *priv = netdev_priv(rmnet_dev);\n \tu32 headroom;\n@@ -323,12 +456,16 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,\n \trmnet_dev-\u003ehw_features = NETIF_F_RXCSUM;\n \trmnet_dev-\u003ehw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;\n \trmnet_dev-\u003ehw_features |= NETIF_F_SG;\n+\trmnet_dev-\u003ehw_features |= NETIF_F_GRO_HW;\n+\trmnet_dev-\u003estat_ops = \u0026rmnet_stat_ops;\n \n \tpriv-\u003ereal_dev = real_dev;\n \n-\theadroom = rmnet_vnd_headroom(port);\n+\theadroom = rmnet_vnd_headroom(data_format);\n \n-\tif (rmnet_vnd_change_mtu(rmnet_dev, real_dev-\u003emtu - headroom)) {\n+\tif (rmnet_vnd_change_mtu_with_format(rmnet_dev,\n+\t\t\t\t\t     real_dev-\u003emtu - headroom,\n+\t\t\t\t\t     data_format)) {\n \t\tNL_SET_ERR_MSG_MOD(extack, \"Invalid MTU on real dev\");\n \t\treturn -EINVAL;\n \t}\n@@ -375,17 +512,15 @@ int rmnet_vnd_do_flow_control(struct net_device *rmnet_dev, int enable)\n \treturn 0;\n }\n \n-int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev)\n+static int rmnet_vnd_validate_mtu(struct rmnet_port *port,\n+\t\t\t\t  struct net_device *real_dev, u32 data_format)\n {\n \tstruct hlist_node *tmp_ep;\n \tstruct rmnet_endpoint *ep;\n-\tstruct rmnet_port *port;\n \tunsigned long bkt_ep;\n \tu32 headroom;\n \n-\tport = rmnet_get_port_rtnl(real_dev);\n-\n-\theadroom = rmnet_vnd_headroom(port);\n+\theadroom = rmnet_vnd_headroom(data_format);\n \n \thash_for_each_safe(port-\u003emuxed_ep, bkt_ep, tmp_ep, ep, hlnode) {\n \t\tif (ep-\u003eegress_dev-\u003emtu \u003e (real_dev-\u003emtu - headroom))\n@@ -395,23 +530,39 @@ int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev)\n \treturn 0;\n }\n \n+int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev)\n+{\n+\tstruct rmnet_port *port;\n+\n+\tport = rmnet_get_port_rtnl(real_dev);\n+\n+\treturn rmnet_vnd_validate_mtu(port, real_dev,\n+\t\t\t\t      READ_ONCE(port-\u003edata_format));\n+}\n+\n int rmnet_vnd_update_dev_mtu(struct rmnet_port *port,\n-\t\t\t     struct net_device *real_dev)\n+\t\t\t     struct net_device *real_dev, u32 data_format)\n {\n \tstruct hlist_node *tmp_ep;\n \tstruct rmnet_endpoint *ep;\n \tunsigned long bkt_ep;\n \tu32 headroom;\n+\tint new_mtu;\n \n-\theadroom = rmnet_vnd_headroom(port);\n+\theadroom = rmnet_vnd_headroom(data_format);\n+\tif (real_dev-\u003emtu \u003c headroom)\n+\t\treturn -EINVAL;\n+\n+\tnew_mtu = real_dev-\u003emtu - headroom;\n+\tif (new_mtu \u003e RMNET_MAX_PACKET_SIZE)\n+\t\treturn -EINVAL;\n \n \thash_for_each_safe(port-\u003emuxed_ep, bkt_ep, tmp_ep, ep, hlnode) {\n-\t\tif (ep-\u003eegress_dev-\u003emtu \u003c= (real_dev-\u003emtu - headroom))\n+\t\tif (ep-\u003eegress_dev-\u003emtu \u003c= new_mtu)\n \t\t\tcontinue;\n \n-\t\tif (rmnet_vnd_change_mtu(ep-\u003eegress_dev,\n-\t\t\t\t\t real_dev-\u003emtu - headroom))\n-\t\t\treturn -1;\n+\t\t/* The target MTU was validated before updating any endpoint. */\n+\t\tWRITE_ONCE(ep-\u003eegress_dev-\u003emtu, new_mtu);\n \t}\n \n \treturn 0;\ndiff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h\nindex c2b2baf86894e..901ef36900ac3 100644\n--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h\n+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h\n@@ -12,7 +12,7 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,\n \t\t      struct rmnet_port *port,\n \t\t      struct net_device *real_dev,\n \t\t      struct rmnet_endpoint *ep,\n-\t\t      struct netlink_ext_ack *extack);\n+\t\t      struct netlink_ext_ack *extack, u32 data_format);\n int rmnet_vnd_dellink(u8 id, struct rmnet_port *port,\n \t\t      struct rmnet_endpoint *ep);\n void rmnet_vnd_rx_fixup(struct sk_buff *skb, struct net_device *dev);\n@@ -21,5 +21,5 @@ void rmnet_vnd_tx_fixup(struct sk_buff *skb, struct net_device *dev);\n void rmnet_vnd_setup(struct net_device *dev);\n int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev);\n int rmnet_vnd_update_dev_mtu(struct rmnet_port *port,\n-\t\t\t     struct net_device *real_dev);\n+\t\t\t     struct net_device *real_dev, u32 data_format);\n #endif /* _RMNET_VND_H_ */\ndiff --git a/include/linux/if_rmnet.h b/include/linux/if_rmnet.h\nindex c44bf6e80ecb4..5df4d417f3d2c 100644\n--- a/include/linux/if_rmnet.h\n+++ b/include/linux/if_rmnet.h\n@@ -70,5 +70,36 @@ struct rmnet_map_v5_csum_header {\n #define MAPV5_HDRINFO_HDR_TYPE_FMASK\tGENMASK(7, 1)\n #define MAPV5_CSUMINFO_VALID_FLAG\tBIT(7)\n \n+#define RMNET_MAP_HEADER_TYPE_COALESCING   1\n #define RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD 2\n+\n+/* MAPv5 coalescing header */\n+#define RMNET_MAP_V5_MAX_NLOS\t\t6\n+#define RMNET_MAP_V5_MAX_PACKETS\t48\n+\n+/* One Number-Length Object pair: per-NLO packet count and length. */\n+struct rmnet_map_v5_nl_pair {\n+\t__be16 pkt_len;\n+\tu8  csum_error_bitmap;\n+\tu8  num_packets;\n+} __aligned(1);\n+\n+/* MAPv5 coalescing header: describes up to RMNET_MAP_V5_MAX_NLOS NLOs.\n+ * The header immediately follows the MAP header in the frame and is\n+ * included in the MAP pkt_len field.\n+ */\n+struct rmnet_map_v5_coal_header {\n+\tu8  header_info;\t/* MAPV5_HDRINFO_NXT_HDR_FLAG, MAPV5_HDRINFO_HDR_TYPE_FMASK */\n+\tu8  coal_info;\t\t/* MAPV5_COALINFO_* */\n+\tu8  close_info;\t\t/* MAPV5_CLOSEINFO_* */\n+\tu8  veid_info;\t\t/* MAPV5_VEIDINFO_* */\n+\tstruct rmnet_map_v5_nl_pair nl_pairs[RMNET_MAP_V5_MAX_NLOS];\n+} __aligned(1);\n+\n+#define MAPV5_COALINFO_NUM_NLOS_FMASK\t\tGENMASK(6, 4)\n+#define MAPV5_COALINFO_CSUM_VALID_FLAG\t\tBIT(7)\n+#define MAPV5_CLOSEINFO_CLOSE_TYPE_FMASK\tGENMASK(3, 0)\n+#define MAPV5_CLOSEINFO_CLOSE_VALUE_FMASK\tGENMASK(7, 4)\n+#define MAPV5_VEIDINFO_VEID_FMASK\t\tGENMASK(3, 0)\n+\n #endif /* !(_LINUX_IF_RMNET_H_) */\ndiff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h\nindex 245b362045253..349fcddc6622f 100644\n--- a/include/uapi/linux/if_link.h\n+++ b/include/uapi/linux/if_link.h\n@@ -2022,6 +2022,7 @@ enum {\n #define RMNET_FLAGS_EGRESS_MAP_CKSUMV4            (1U \u003c\u003c 3)\n #define RMNET_FLAGS_INGRESS_MAP_CKSUMV5           (1U \u003c\u003c 4)\n #define RMNET_FLAGS_EGRESS_MAP_CKSUMV5            (1U \u003c\u003c 5)\n+#define RMNET_FLAGS_INGRESS_COALESCE              (1U \u003c\u003c 6)\n \n enum {\n \tIFLA_RMNET_UNSPEC,\n"
}

2/1 2026/10/09 10:43 agent patch-evaluator
3m Model:
core

Args:
null

Results:
{
  "EnableConfigs": [
    "RMNET",
    "NET_VENDOR_QUALCOMM"
  ],
  "FocusSymbols": [
    "rmnet_map_process_next_hdr_packet",
    "rmnet_map_segment_coal_skb",
    "rmnet_map_coal_segment_loop",
    "__rmnet_map_segment_coal_skb",
    "rmnet_map_coal_validate_bounds",
    "rmnet_map_coal_parse_ip_hdr",
    "rmnet_map_coal_parse_trans_hdr",
    "rmnet_map_data_check_coal_header",
    "rmnet_map_validate_packet_len",
    "rmnet_newlink",
    "rmnet_changelink",
    "rmnet_vnd_update_dev_mtu"
  ],
  "Reasoning": "The Qualcomm rmnet driver is a virtual network device driver accessible via rtnetlink (RTM_NEWLINK with kind 'rmnet') that attaches to any existing network device (such as virtual dummy, veth, or tun interfaces) without requiring physical hardware. This patch implements MAPv5 downlink hardware packet coalescing, introducing extensive packet parsing, bounds checking, NLO error handling, skb segmentation, and GSO metadata generation. Complex parsing and skb manipulation on the network ingress path is a prime candidate for fuzz testing.",
  "WorthFuzzing": true
}

Instruction:
You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.

================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.

- REACHABILITY IS THE PRIMARY GATE:
  Fuzzing can only discover bugs in code that can actually execute in standard virtualized
  environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
  If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
  regardless of whether it adds assertions or complex logic.

- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
  Patch authors routinely label changes as "cleanups", "refactorings", or state
  "No functional change intended". Do NOT take these claims at face value.
  Code refactorings that rearrange logic, introduce helper functions, or alter state management
  in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
  If reachable executable code is modified or refactored, it MUST be fuzzed.

- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
  When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
  BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
  Even if the author believes the invariant always holds, fuzzing is essential to verify whether
  an unusual sequence of operations can violate it.

================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:

- Non-kernel and non-executable changes:
  * Modifications to Documentation/, comments, or spelling fixes.
  * User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
    that do not affect the compiled kernel image (vmlinux) or kernel modules.
  * Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
    that do not alter control flow or data structures.
  * Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
  * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
    ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
  * Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
    physical PCI hot-unplug or manual sysfs driver unbinding.
  * Code paths exclusive to architectures other than the target architecture.

================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
  * Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
    BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
  * Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
  * Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
  * Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).

================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:

- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
  Do NOT list generic, ubiquitous functions called by almost every program in the corpus
  (including, but not limited to: general memory allocators and deallocators, page fault
  and trap handlers, or core synchronization primitives; this is not an exhaustive list).
  Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
  which severely dilutes fuzzing effort away from the actual changes.

- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
  List functions that specifically implement the logic being added or altered, or direct API entrypoints
  for the subsystem feature under review.

- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
  Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
  distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
  If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
  functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).

================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 0fee58b4fc90270ec5b3cc8520b6ab96b146031e
Author: syz-cluster <triage@syzkaller.com>
Date:   Fri Oct 9 10:43:23 2026 +0000

    syz-cluster: applied patch under review

diff --git a/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst b/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
index 5aedbabb73827..52f92d2fba311 100644
--- a/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
+++ b/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
@@ -125,8 +125,8 @@ Command (1)/ Data (0) bit value is to indicate if the packet is a MAP command
 or data packet. Command packet is used for transport level flow control. Data
 packets are standard IP packets.
 
-Next header is used to indicate the presence of another header, currently is
-limited to checksum header.
+Next header is used to indicate the presence of another header, currently
+limited to the checksum and coalescing headers.
 
 Padding is the number of bytes to be appended to the payload to
 ensure 4 byte alignment.
@@ -150,11 +150,11 @@ Header Type is to indicate the type of header, this usually is set to CHECKSUM
 
 Header types
 
-= ===============
+= ======================
 0 Reserved
-1 Reserved
+1 coalescing header
 2 checksum header
-= ===============
+= ======================
 
 Checksum Valid is to indicate whether the header checksum is valid. Value of 1
 implies that checksum is calculated on this packet and is valid, value of 0
@@ -162,8 +162,109 @@ indicates that the calculated packet checksum is invalid.
 
 Reserved bits must be zero when sent and ignored when received.
 
-e. MAP packet v1/v5 (command specific)
---------------------------------------
+e. Coalescing header v5
+------------------------
+
+Hardware can coalesce multiple same-flow IP packets into a single MAP frame
+to reduce per-packet overhead at high data rates.  Packets are grouped into
+NLOs, with all packets in each NLO having the same length.  The coalescing
+header (header type 1) describes the coalesced content.
+
+Packet format::
+
+  Bit         0 - 6         7          8           9-11         12-15
+  Function  Header Type  Next Header  CSUM valid  Num NLOs    (reserved)
+
+  Bit        16-19        20-23
+  Function  Close value  Close type
+
+  Bit        24-27        28-31
+  Function  (reserved)    VEID
+
+  Bit           32 - 47        48 - 55            56 - 63
+  Function   Packet length  CSUM error bitmap  Num packets (NLO 0)
+
+  ... (up to 6 NLO entries total, same 32-bit format per entry)
+
+Header Type is set to 1 (coalescing).
+
+The MAP header ``pkt_len`` includes the coalescing header, coalesced packet
+data, and any MAP padding.
+
+Num NLOs (Number-Length Objects) is the count of active NLO entries
+(1 – 6).  Each NLO describes a group of consecutive coalesced packets
+that all share the same IP packet length.
+
+Num NLOs identifies the active prefix of the six NLO slots.  The header
+always contains all six slots and remains 28 bytes long regardless of Num
+NLOs.  A slot with ``num_packets == 0`` ends the active NLO prefix.  The
+full coalescing header is included in the MAP header's ``pkt_len``.
+
+Some hardware may report Num NLOs incorrectly.  For compatibility, receivers
+should derive the active prefix from ``num_packets`` when needed.  This
+requires unused slots to have ``num_packets == 0``.
+
+CSUM valid (bit 8) is a frame-level indication that the hardware checksum is
+valid for all packets in the frame. It is distinct from the per-packet CSUM
+error bitmap in each NLO entry.
+
+For a single-NLO, single-packet frame, CSUM valid must not be trusted when
+the close reason is a FIN/PSH close, a packet limit, a byte limit, or a time
+limit.  In these cases, the rmnet driver treats the packet checksum as
+unverified and lets the network stack validate it instead of relying on the
+coalescing checksum indications.
+IPv4 UDP packets with a zero checksum remain valid because that checksum is
+optional.
+
+Close type and close value encode the hardware reason that coalescing
+was terminated for this frame:
+
+Close type values:
+
+= ==============================
+0 non-coalesced (single packet)
+1 IP flow miss
+2 transport flow miss
+3 hardware limit (see value)
+4 coalescing closed (FIN/PSH)
+= ==============================
+
+Close value (used when close type is 3):
+
+= ==================
+0 NL limit reached
+1 packet limit
+2 byte limit
+3 time limit
+4 eviction
+= ==================
+
+VEID is the virtual endpoint ID of the originating flow.
+
+Each NLO entry::
+
+  Bit         0 - 15        16 - 23            24 - 31
+  Function  Pkt length   CSUM error bitmap   Num packets
+
+Pkt length is the full IP packet length, including the IP header, transport
+header, and payload, for every packet in this NLO group. The IP and transport
+headers are present once in the coalesced frame and are not repeated for each
+packet.
+
+CSUM error bitmap is one 48-bit stream formed by concatenating the
+``csum_error_bitmap`` bytes from all six NLO slots in slot order. Packet 0
+corresponds to bit 0 of slot 0's bitmap byte, and bits are consumed from
+least significant bit to most significant bit. The bit stream is indexed by
+the packet's absolute position in the frame and does not restart at an NLO
+boundary. If an NLO contains more than eight packets, its error bits
+continue into the bitmap byte of the following slot. Bitmap bytes in slots
+after the active NLO prefix may therefore contain continuation bits and must
+not be ignored.
+
+Num packets is the count of coalesced packets described by this NLO.
+
+f. MAP packet v1/v5 (command specific)
+---------------------------------------
 
 Packet format::
 
@@ -187,7 +288,7 @@ Command types
 3 is for error during processing of commands
 = ==========================================
 
-f. Aggregation
+g. Aggregation
 --------------
 
 Aggregation is multiple MAP packets (can be data or command) delivered to
@@ -208,3 +309,39 @@ rmnet userspace configuration is done through netlink using iproute2
 https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/
 
 The driver uses rtnl_link_ops for communication.
+
+The data format flags controlling the ingress and egress processing
+pipeline are set via the ``IFLA_RMNET_FLAGS`` attribute
+(``struct ifla_rmnet_flags``).
+
+Relevant ingress flags:
+
+``RMNET_FLAGS_INGRESS_DEAGGREGATION``
+  Enable MAP frame de-aggregation.
+
+``RMNET_FLAGS_INGRESS_MAP_CKSUMV4``
+  Enable MAPv4 downlink checksum offload.
+
+``RMNET_FLAGS_INGRESS_MAP_CKSUMV5``
+  Enable MAPv5 downlink checksum offload (header type 2).
+
+``RMNET_FLAGS_INGRESS_COALESCE``
+  Enable MAPv5 downlink hardware coalescing (header type 1).
+  This flag requires ``RMNET_FLAGS_INGRESS_MAP_CKSUMV5``. MAPv4 and
+  MAPv5 checksum flags cannot be enabled together in either direction.
+  A direction may leave checksum offload disabled. Invalid combinations
+  are rejected.
+  When RX checksum offload and ``rx-gro-hw`` are enabled, valid
+  multi-packet coalesced frames can be delivered as batched GSO SKBs.
+  Otherwise, multi-packet coalesced frames are rejected. A coalesced frame
+  containing one packet is delivered as a normal non-GSO skb. IP options,
+  IPv6 extension headers, and zero-payload packets can also prevent GSO
+  processing for a frame.
+
+Relevant egress flags:
+
+``RMNET_FLAGS_EGRESS_MAP_CKSUMV4``
+  Enable MAPv4 uplink checksum offload.
+
+``RMNET_FLAGS_EGRESS_MAP_CKSUMV5``
+  Enable MAPv5 uplink checksum offload.
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
index 61b04c6c0390e..ec882ad371ab7 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
@@ -26,6 +26,31 @@ static int rmnet_is_real_dev_registered(const struct net_device *real_dev)
 	return rcu_access_pointer(real_dev->rx_handler) == rmnet_rx_handler;
 }
 
+/* Only three MAP configurations are supported: MAPv1 (no checksum
+ * offload), MAPv4 (v4 checksum offload) and MAPv5 (v5 checksum
+ * offload). MAP command support is orthogonal and permitted with any
+ * of the three. Checksum offload versions are selected independently
+ * for ingress and egress, but only one version may be enabled across
+ * the device. Mixing v4 and v5 checksum flags is not supported. DL
+ * packet coalescing additionally requires a MAPv5 configuration.
+ */
+static bool rmnet_config_data_format_valid(u32 data_format)
+{
+	u32 v4_mask = RMNET_FLAGS_INGRESS_MAP_CKSUMV4 |
+		      RMNET_FLAGS_EGRESS_MAP_CKSUMV4;
+	u32 v5_mask = RMNET_FLAGS_INGRESS_MAP_CKSUMV5 |
+		      RMNET_FLAGS_EGRESS_MAP_CKSUMV5;
+
+	if ((data_format & v4_mask) && (data_format & v5_mask))
+		return false;
+
+	if ((data_format & RMNET_FLAGS_INGRESS_COALESCE) &&
+	    !(data_format & RMNET_FLAGS_INGRESS_MAP_CKSUMV5))
+		return false;
+
+	return true;
+}
+
 /* Needs rtnl lock */
 struct rmnet_port*
 rmnet_get_port_rtnl(const struct net_device *real_dev)
@@ -143,6 +168,20 @@ static int rmnet_newlink(struct net_device *dev,
 		return -ENODEV;
 	}
 
+	if (data[IFLA_RMNET_FLAGS]) {
+		struct ifla_rmnet_flags *flags;
+
+		flags = nla_data(data[IFLA_RMNET_FLAGS]);
+		data_format &= ~flags->mask;
+		data_format |= flags->flags & flags->mask;
+	}
+
+	if (!rmnet_config_data_format_valid(data_format)) {
+		NL_SET_ERR_MSG_MOD(extack,
+				   "unsupported MAP checksum flag combination");
+		return -EINVAL;
+	}
+
 	ep = kzalloc_obj(*ep);
 	if (!ep)
 		return -ENOMEM;
@@ -154,7 +193,8 @@ static int rmnet_newlink(struct net_device *dev,
 		goto err0;
 
 	port = rmnet_get_port_rtnl(real_dev);
-	err = rmnet_vnd_newlink(mux_id, dev, port, real_dev, ep, extack);
+	err = rmnet_vnd_newlink(mux_id, dev, port, real_dev, ep, extack,
+				data_format);
 	if (err)
 		goto err1;
 
@@ -162,24 +202,23 @@ static int rmnet_newlink(struct net_device *dev,
 	if (err < 0)
 		goto err2;
 
+	/* Update existing MTUs before publishing the shared data format. */
+	err = rmnet_vnd_update_dev_mtu(port, real_dev, data_format);
+	if (err)
+		goto err3;
+
 	port->rmnet_mode = mode;
 	port->rmnet_dev = dev;
 
 	hlist_add_head_rcu(&ep->hlnode, &port->muxed_ep[mux_id]);
 
-	if (data[IFLA_RMNET_FLAGS]) {
-		struct ifla_rmnet_flags *flags;
-
-		flags = nla_data(data[IFLA_RMNET_FLAGS]);
-		data_format &= ~flags->mask;
-		data_format |= flags->flags & flags->mask;
-	}
-
 	netdev_dbg(dev, "data format [0x%08X]\n", data_format);
 	WRITE_ONCE(port->data_format, data_format);
 
 	return 0;
 
+err3:
+	netdev_upper_dev_unlink(real_dev, dev);
 err2:
 	unregister_netdevice(dev);
 	rmnet_vnd_dellink(mux_id, port, ep);
@@ -301,9 +340,13 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
 			    struct netlink_ext_ack *extack)
 {
 	struct rmnet_priv *priv = netdev_priv(dev);
+	struct ifla_rmnet_flags *flags;
 	struct net_device *real_dev;
 	struct rmnet_port *port;
+	u32 old_data_format;
+	u32 data_format;
 	u16 mux_id;
+	int err;
 
 	if (!dev)
 		return -ENODEV;
@@ -320,6 +363,19 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
 
 	port = rmnet_get_port_rtnl(real_dev);
 
+	if (data[IFLA_RMNET_FLAGS]) {
+		old_data_format = READ_ONCE(port->data_format);
+		flags = nla_data(data[IFLA_RMNET_FLAGS]);
+		data_format = old_data_format & ~flags->mask;
+		data_format |= flags->flags & flags->mask;
+
+		if (!rmnet_config_data_format_valid(data_format)) {
+			NL_SET_ERR_MSG_MOD(extack,
+					   "unsupported MAP checksum flag combination");
+			return -EINVAL;
+		}
+	}
+
 	if (data[IFLA_RMNET_MUX_ID]) {
 		mux_id = nla_get_u16(data[IFLA_RMNET_MUX_ID]);
 
@@ -346,21 +402,13 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
 	}
 
 	if (data[IFLA_RMNET_FLAGS]) {
-		struct ifla_rmnet_flags *flags;
-		u32 old_data_format;
-		u32 data_format;
-
-		old_data_format = port->data_format;
-		flags = nla_data(data[IFLA_RMNET_FLAGS]);
-		data_format = old_data_format & ~flags->mask;
-		data_format |= flags->flags & flags->mask;
-		WRITE_ONCE(port->data_format, data_format);
-
-		if (rmnet_vnd_update_dev_mtu(port, real_dev)) {
-			WRITE_ONCE(port->data_format, old_data_format);
+		err = rmnet_vnd_update_dev_mtu(port, real_dev, data_format);
+		if (err) {
 			NL_SET_ERR_MSG_MOD(extack, "Invalid MTU on real dev");
-			return -EINVAL;
+			return err;
 		}
+
+		WRITE_ONCE(port->data_format, data_format);
 	}
 
 	return 0;
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h
index 5adda0323dda7..917d31f6eded7 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h
@@ -63,31 +63,105 @@ struct rmnet_vnd_stats {
 	u32 tx_drops;
 };
 
+struct rmnet_priv_stats {
+	/* Network stack RX statistics for all rmnet receive paths */
+	u64 rx_hw_gro_packets;
+	u64 rx_hw_gro_wire_packets;
+	u64 rx_alloc_fail;
+	u64 rx_dropped;
+
+	/* Custom diagnostics for the coalescing receive path */
+	struct_group(ethtool_stats, /* ethtool statistics */
+		u64 csum_ok;
+		u64 csum_ip4_header_bad;
+		u64 csum_valid_unset;
+		u64 csum_validation_failed;
+		u64 csum_err_bad_buffer;
+		u64 csum_err_invalid_ip_version;
+		u64 csum_err_invalid_transport;
+		u64 csum_fragmented_pkt;
+		u64 csum_skipped;
+		u64 csum_sw;
+		u64 csum_hw;
+		/* Coalescing-only counters. Some are subsets of the standard counters. */
+		u64 coal_alloc_fail;
+		u64 coal_rx;
+		u64 coal_pkts;
+		u64 coal_hdr_err;
+		u64 coal_hdr_pkt_err;
+		u64 coal_bounds_err;
+		u64 coal_csum_err;
+		u64 coal_csum_drop;
+		u64 coal_reconstruct;
+		u64 coal_ip_invalid;
+		u64 coal_trans_invalid;
+		/* close-reason sub-counters */
+		u64 coal_close_non_coal;
+		u64 coal_close_ip_miss;
+		u64 coal_close_trans_miss;
+		u64 coal_close_hw_nl;
+		u64 coal_close_hw_pkt;
+		u64 coal_close_hw_byte;
+		u64 coal_close_hw_time;
+		u64 coal_close_hw_evict;
+		u64 coal_close_coal;
+	);
+};
+
+struct rmnet_pcpu_priv_stats {
+	/* Network stack RX statistics for all rmnet receive paths */
+	u64_stats_t rx_hw_gro_packets;
+	u64_stats_t rx_hw_gro_wire_packets;
+	u64_stats_t rx_alloc_fail;
+	u64_stats_t rx_dropped;
+
+	/* Custom diagnostics for the coalescing receive path */
+	u64_stats_t csum_ok;
+	u64_stats_t csum_ip4_header_bad;
+	u64_stats_t csum_valid_unset;
+	u64_stats_t csum_validation_failed;
+	u64_stats_t csum_err_bad_buffer;
+	u64_stats_t csum_err_invalid_ip_version;
+	u64_stats_t csum_err_invalid_transport;
+	u64_stats_t csum_fragmented_pkt;
+	u64_stats_t csum_skipped;
+	u64_stats_t csum_sw;
+	u64_stats_t csum_hw;
+	/* Coalescing-only counters. Some are subsets of the standard counters. */
+	u64_stats_t coal_alloc_fail;
+	u64_stats_t coal_rx;
+	u64_stats_t coal_pkts;
+	u64_stats_t coal_hdr_err;
+	u64_stats_t coal_hdr_pkt_err;
+	u64_stats_t coal_bounds_err;
+	u64_stats_t coal_csum_err;
+	u64_stats_t coal_csum_drop;
+	u64_stats_t coal_reconstruct;
+	u64_stats_t coal_ip_invalid;
+	u64_stats_t coal_trans_invalid;
+	/* close-reason sub-counters */
+	u64_stats_t coal_close_non_coal;
+	u64_stats_t coal_close_ip_miss;
+	u64_stats_t coal_close_trans_miss;
+	u64_stats_t coal_close_hw_nl;
+	u64_stats_t coal_close_hw_pkt;
+	u64_stats_t coal_close_hw_byte;
+	u64_stats_t coal_close_hw_time;
+	u64_stats_t coal_close_hw_evict;
+	u64_stats_t coal_close_coal;
+};
+
 struct rmnet_pcpu_stats {
 	struct rmnet_vnd_stats stats;
+	struct rmnet_pcpu_priv_stats priv_stats;
 	struct u64_stats_sync syncp;
 };
 
-struct rmnet_priv_stats {
-	u64 csum_ok;
-	u64 csum_ip4_header_bad;
-	u64 csum_valid_unset;
-	u64 csum_validation_failed;
-	u64 csum_err_bad_buffer;
-	u64 csum_err_invalid_ip_version;
-	u64 csum_err_invalid_transport;
-	u64 csum_fragmented_pkt;
-	u64 csum_skipped;
-	u64 csum_sw;
-	u64 csum_hw;
-};
-
 struct rmnet_priv {
 	u8 mux_id;
 	struct net_device *real_dev;
 	struct rmnet_pcpu_stats __percpu *pcpu_stats;
 	struct gro_cells gro_cells;
-	struct rmnet_priv_stats stats;
 };
 
 struct rmnet_port *rmnet_get_port_rcu(const struct net_device *real_dev);
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
index aa5523f4618eb..bb867ceb01c1c 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
@@ -50,6 +50,16 @@ rmnet_deliver_skb(struct sk_buff *skb)
 	gro_cells_receive(&priv->gro_cells, skb);
 }
 
+static void rmnet_deliver_skb_list(struct sk_buff_head *head)
+{
+	struct sk_buff *skb;
+
+	while ((skb = __skb_dequeue(head))) {
+		rmnet_set_skb_proto(skb);
+		rmnet_deliver_skb(skb);
+	}
+}
+
 /* MAP handler */
 
 static void
@@ -59,6 +69,7 @@ __rmnet_map_ingress_handler(struct sk_buff *skb,
 {
 	struct rmnet_map_header *map_header = (void *)skb->data;
 	struct rmnet_endpoint *ep;
+	struct sk_buff_head list;
 	u16 len, pad;
 	u8 mux_id;
 
@@ -83,12 +94,13 @@ __rmnet_map_ingress_handler(struct sk_buff *skb,
 
 	skb->dev = ep->egress_dev;
 
-	if ((data_format & RMNET_FLAGS_INGRESS_MAP_CKSUMV5) &&
+	__skb_queue_head_init(&list);
+
+	if ((data_format &
+	     (RMNET_FLAGS_INGRESS_MAP_CKSUMV5 | RMNET_FLAGS_INGRESS_COALESCE)) &&
 	    (map_header->flags & MAP_NEXT_HEADER_FLAG)) {
-		if (rmnet_map_process_next_hdr_packet(skb, len))
+		if (rmnet_map_process_next_hdr_packet(skb, &list, len, data_format))
 			goto free_skb;
-		skb_pull(skb, sizeof(*map_header));
-		rmnet_set_skb_proto(skb);
 	} else {
 		/* Subtract MAP header */
 		skb_pull(skb, sizeof(*map_header));
@@ -96,10 +108,11 @@ __rmnet_map_ingress_handler(struct sk_buff *skb,
 		if (data_format & RMNET_FLAGS_INGRESS_MAP_CKSUMV4 &&
 		    !rmnet_map_checksum_downlink_packet(skb, len + pad))
 			skb->ip_summed = CHECKSUM_UNNECESSARY;
+		skb_trim(skb, len);
+		__skb_queue_tail(&list, skb);
 	}
 
-	skb_trim(skb, len);
-	rmnet_deliver_skb(skb);
+	rmnet_deliver_skb_list(&list);
 	return;
 
 free_skb:
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
index 0977e495f5915..77ddac6023c01 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
@@ -6,6 +6,22 @@
 #define _RMNET_MAP_H_
 #include <linux/if_rmnet.h>
 
+enum rmnet_map_v5_close_type {
+	RMNET_MAP_COAL_CLOSE_NON_COAL,
+	RMNET_MAP_COAL_CLOSE_IP_MISS,
+	RMNET_MAP_COAL_CLOSE_TRANS_MISS,
+	RMNET_MAP_COAL_CLOSE_HW,
+	RMNET_MAP_COAL_CLOSE_COAL,
+};
+
+enum rmnet_map_v5_close_value {
+	RMNET_MAP_COAL_CLOSE_HW_NL,
+	RMNET_MAP_COAL_CLOSE_HW_PKT,
+	RMNET_MAP_COAL_CLOSE_HW_BYTE,
+	RMNET_MAP_COAL_CLOSE_HW_TIME,
+	RMNET_MAP_COAL_CLOSE_HW_EVICT,
+};
+
 struct rmnet_map_control_command {
 	u8  command_name;
 	u8  cmd_type:2;
@@ -53,7 +69,9 @@ void rmnet_map_checksum_uplink_packet(struct sk_buff *skb,
 				      struct rmnet_port *port,
 				      struct net_device *orig_dev,
 				      int csum_type);
-int rmnet_map_process_next_hdr_packet(struct sk_buff *skb, u16 len);
+int rmnet_map_process_next_hdr_packet(struct sk_buff *skb,
+				      struct sk_buff_head *list,
+				      u16 len, u32 data_format);
 unsigned int rmnet_map_tx_aggregate(struct sk_buff *skb, struct rmnet_port *port,
 				    struct net_device *orig_dev);
 void rmnet_map_tx_aggregate_init(struct rmnet_port *port);
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
index 39d6d084e73f0..74d64b7066e2b 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
@@ -7,7 +7,11 @@
 #include <linux/netdevice.h>
 #include <linux/ip.h>
 #include <linux/ipv6.h>
+#include <linux/tcp.h>
+#include <linux/udp.h>
+#include <net/ip.h>
 #include <net/ip6_checksum.h>
+#include <net/ipv6.h>
 #include <linux/bitfield.h>
 #include "rmnet_config.h"
 #include "rmnet_map.h"
@@ -17,6 +21,19 @@
 #define RMNET_MAP_DEAGGR_SPACING  64
 #define RMNET_MAP_DEAGGR_HEADROOM (RMNET_MAP_DEAGGR_SPACING / 2)
 
+struct rmnet_map_coal_metadata {
+	void *ip_header;
+	void *trans_header;
+	u16 ip_len;
+	u16 trans_len;
+	u16 data_offset;
+	u16 data_len;
+	u8 ip_proto;
+	u8 trans_proto;
+	u8 pkt_count;
+	bool zero_csum;
+};
+
 static __sum16 *rmnet_map_get_csum_field(unsigned char protocol,
 					 const void *txporthdr)
 {
@@ -36,34 +53,45 @@ rmnet_map_ipv4_dl_csum_trailer(struct sk_buff *skb,
 {
 	struct iphdr *ip4h = (struct iphdr *)skb->data;
 	void *txporthdr = skb->data + ip4h->ihl * 4;
+	struct rmnet_pcpu_stats *pcpu_ptr;
 	__sum16 *csum_field, pseudo_csum;
 	__sum16 ip_payload_csum;
 
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
 	/* Computing the checksum over just the IPv4 header--including its
 	 * checksum field--should yield 0.  If it doesn't, the IP header
 	 * is bad, so return an error and let the IP layer drop it.
 	 */
 	if (ip_fast_csum(ip4h, ip4h->ihl)) {
-		priv->stats.csum_ip4_header_bad++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_ip4_header_bad);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EINVAL;
 	}
 
 	/* We don't support checksum offload on IPv4 fragments */
 	if (ip_is_fragment(ip4h)) {
-		priv->stats.csum_fragmented_pkt++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_fragmented_pkt);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EOPNOTSUPP;
 	}
 
 	/* Checksum offload is only supported for UDP and TCP protocols */
 	csum_field = rmnet_map_get_csum_field(ip4h->protocol, txporthdr);
 	if (!csum_field) {
-		priv->stats.csum_err_invalid_transport++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_err_invalid_transport);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EPROTONOSUPPORT;
 	}
 
 	/* RFC 768: UDP checksum is optional for IPv4, and is 0 if unused */
 	if (!*csum_field && ip4h->protocol == IPPROTO_UDP) {
-		priv->stats.csum_skipped++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_skipped);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return 0;
 	}
 
@@ -96,11 +124,15 @@ rmnet_map_ipv4_dl_csum_trailer(struct sk_buff *skb,
 
 	/* The cast is required to ensure only the low 16 bits are examined */
 	if (ip_payload_csum != (__sum16)~pseudo_csum) {
-		priv->stats.csum_validation_failed++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_validation_failed);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EINVAL;
 	}
 
-	priv->stats.csum_ok++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_ok);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 	return 0;
 }
 
@@ -112,16 +144,21 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb,
 {
 	struct ipv6hdr *ip6h = (struct ipv6hdr *)skb->data;
 	void *txporthdr = skb->data + sizeof(*ip6h);
+	struct rmnet_pcpu_stats *pcpu_ptr;
 	__sum16 *csum_field, pseudo_csum;
 	__sum16 ip6_payload_csum;
 	__be16 ip_header_csum;
 
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
 	/* Checksum offload is only supported for UDP and TCP protocols;
 	 * the packet cannot include any IPv6 extension headers
 	 */
 	csum_field = rmnet_map_get_csum_field(ip6h->nexthdr, txporthdr);
 	if (!csum_field) {
-		priv->stats.csum_err_invalid_transport++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_err_invalid_transport);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EPROTONOSUPPORT;
 	}
 
@@ -147,11 +184,15 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb,
 	 * examined.
 	 */
 	if (ip6_payload_csum != (__sum16)~pseudo_csum) {
-		priv->stats.csum_validation_failed++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_validation_failed);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EINVAL;
 	}
 
-	priv->stats.csum_ok++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_ok);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 	return 0;
 }
 #else
@@ -246,6 +287,9 @@ static void rmnet_map_v5_checksum_uplink_packet(struct sk_buff *skb,
 {
 	struct rmnet_priv *priv = netdev_priv(orig_dev);
 	struct rmnet_map_v5_csum_header *ul_header;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
 
 	ul_header = skb_push(skb, sizeof(*ul_header));
 	memset(ul_header, 0, sizeof(*ul_header));
@@ -270,7 +314,9 @@ static void rmnet_map_v5_checksum_uplink_packet(struct sk_buff *skb,
 			proto = ((struct ipv6hdr *)iph)->nexthdr;
 			trans = iph + ip_len;
 		} else {
-			priv->stats.csum_err_invalid_ip_version++;
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.csum_err_invalid_ip_version);
+			u64_stats_update_end(&pcpu_ptr->syncp);
 			goto sw_csum;
 		}
 
@@ -279,13 +325,17 @@ static void rmnet_map_v5_checksum_uplink_packet(struct sk_buff *skb,
 			skb->ip_summed = CHECKSUM_NONE;
 			/* Ask for checksum offloading */
 			ul_header->csum_info |= MAPV5_CSUMINFO_VALID_FLAG;
-			priv->stats.csum_hw++;
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.csum_hw);
+			u64_stats_update_end(&pcpu_ptr->syncp);
 			return;
 		}
 	}
 
 sw_csum:
-	priv->stats.csum_sw++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_sw);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 }
 
 /* Adds MAP header to front of skb->data
@@ -337,8 +387,8 @@ u32 rmnet_map_validate_packet_len(struct sk_buff *skb, u32 data_format)
 {
 	struct rmnet_map_v5_csum_header *next_hdr = NULL;
 	struct rmnet_map_header *maph;
-	void *data = skb->data;
 	u32 packet_len;
+	u8 hdr_type;
 
 	if (skb->len < sizeof(*maph))
 		return 0;
@@ -353,24 +403,28 @@ u32 rmnet_map_validate_packet_len(struct sk_buff *skb, u32 data_format)
 
 	if (data_format & RMNET_FLAGS_INGRESS_MAP_CKSUMV4) {
 		packet_len += sizeof(struct rmnet_map_dl_csum_trailer);
-	} else if ((data_format & RMNET_FLAGS_INGRESS_MAP_CKSUMV5) &&
+	} else if ((data_format &
+		    (RMNET_FLAGS_INGRESS_MAP_CKSUMV5 | RMNET_FLAGS_INGRESS_COALESCE)) &&
 		   !(maph->flags & MAP_CMD_FLAG)) {
-		/* Mapv5 data pkt without csum hdr is invalid */
 		if (!(maph->flags & MAP_NEXT_HEADER_FLAG))
 			return 0;
 
-		packet_len += sizeof(*next_hdr);
-		next_hdr = data + sizeof(*maph);
+		if (skb->len < sizeof(*maph) + sizeof(*next_hdr))
+			return 0;
+
+		next_hdr = (struct rmnet_map_v5_csum_header *)(skb->data + sizeof(*maph));
+		hdr_type = u8_get_bits(next_hdr->header_info,
+				       MAPV5_HDRINFO_HDR_TYPE_FMASK);
+
+		if (hdr_type == RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD)
+			packet_len += sizeof(*next_hdr);
+		else if (hdr_type != RMNET_MAP_HEADER_TYPE_COALESCING)
+			return 0;
 	}
 
 	if (skb->len < packet_len)
 		return 0;
 
-	if (next_hdr &&
-	    u8_get_bits(next_hdr->header_info, MAPV5_HDRINFO_HDR_TYPE_FMASK) !=
-	    RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD)
-		return 0;
-
 	return packet_len;
 }
 
@@ -413,16 +467,23 @@ int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len)
 {
 	struct rmnet_priv *priv = netdev_priv(skb->dev);
 	struct rmnet_map_dl_csum_trailer *csum_trailer;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
 
 	if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) {
-		priv->stats.csum_sw++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_sw);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EOPNOTSUPP;
 	}
 
 	csum_trailer = (struct rmnet_map_dl_csum_trailer *)(skb->data + len);
 
 	if (!(csum_trailer->flags & MAP_CSUM_DL_VALID_FLAG)) {
-		priv->stats.csum_valid_unset++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_valid_unset);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EINVAL;
 	}
 
@@ -432,7 +493,9 @@ int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len)
 	if (IS_ENABLED(CONFIG_IPV6) && skb->protocol == htons(ETH_P_IPV6))
 		return rmnet_map_ipv6_dl_csum_trailer(skb, csum_trailer, priv);
 
-	priv->stats.csum_err_invalid_ip_version++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_err_invalid_ip_version);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 
 	return -EPROTONOSUPPORT;
 }
@@ -442,8 +505,11 @@ static void rmnet_map_v4_checksum_uplink_packet(struct sk_buff *skb,
 {
 	struct rmnet_priv *priv = netdev_priv(orig_dev);
 	struct rmnet_map_ul_csum_header *ul_header;
+	struct rmnet_pcpu_stats *pcpu_ptr;
 	void *iphdr;
 
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
 	ul_header = (struct rmnet_map_ul_csum_header *)
 		    skb_push(skb, sizeof(struct rmnet_map_ul_csum_header));
 
@@ -459,22 +525,30 @@ static void rmnet_map_v4_checksum_uplink_packet(struct sk_buff *skb,
 
 	if (skb->protocol == htons(ETH_P_IP)) {
 		rmnet_map_ipv4_ul_csum_header(iphdr, ul_header, skb);
-		priv->stats.csum_hw++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_hw);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return;
 	}
 
 	if (IS_ENABLED(CONFIG_IPV6) && skb->protocol == htons(ETH_P_IPV6)) {
 		rmnet_map_ipv6_ul_csum_header(iphdr, ul_header, skb);
-		priv->stats.csum_hw++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_hw);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return;
 	}
 
-	priv->stats.csum_err_invalid_ip_version++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_err_invalid_ip_version);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 
 sw_csum:
 	memset(ul_header, 0, sizeof(*ul_header));
 
-	priv->stats.csum_sw++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_sw);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 }
 
 /* Generates UL checksum meta info header for IPv4 and IPv6 over TCP and UDP
@@ -497,34 +571,847 @@ void rmnet_map_checksum_uplink_packet(struct sk_buff *skb,
 	}
 }
 
-/* Process a MAPv5 packet header */
-int rmnet_map_process_next_hdr_packet(struct sk_buff *skb,
-				      u16 len)
+static struct rmnet_map_v5_csum_header *
+rmnet_map_get_next_hdr(struct sk_buff *skb)
 {
-	struct rmnet_priv *priv = netdev_priv(skb->dev);
-	struct rmnet_map_v5_csum_header *next_hdr;
-	u8 nexthdr_type;
+	return (struct rmnet_map_v5_csum_header *)(skb->data +
+						   sizeof(struct rmnet_map_header));
+}
+
+static u8 rmnet_map_get_next_hdr_type(struct sk_buff *skb)
+{
+	struct rmnet_map_v5_csum_header *hdr = rmnet_map_get_next_hdr(skb);
+
+	return u8_get_bits(hdr->header_info, MAPV5_HDRINFO_HDR_TYPE_FMASK);
+}
+
+static bool rmnet_map_get_csum_valid(struct sk_buff *skb)
+{
+	struct rmnet_map_v5_csum_header *hdr = rmnet_map_get_next_hdr(skb);
 
-	next_hdr = (struct rmnet_map_v5_csum_header *)(skb->data +
-			sizeof(struct rmnet_map_header));
+	return !!(hdr->csum_info & MAPV5_CSUMINFO_VALID_FLAG);
+}
+
+/* Stamp GSO metadata so the network stack can segment a coalesced SKB. */
+static void rmnet_map_gso_stamp(struct sk_buff *skb,
+				struct rmnet_map_coal_metadata *coal_meta)
+{
+	struct skb_shared_info *shinfo = skb_shinfo(skb);
 
-	nexthdr_type = u8_get_bits(next_hdr->header_info,
-				   MAPV5_HDRINFO_HDR_TYPE_FMASK);
+	if (coal_meta->trans_proto == IPPROTO_TCP)
+		shinfo->gso_type = (coal_meta->ip_proto == 4) ?
+				   SKB_GSO_TCPV4 : SKB_GSO_TCPV6;
+	else
+		shinfo->gso_type = SKB_GSO_UDP_L4;
 
-	if (nexthdr_type != RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD)
+	shinfo->gso_size = coal_meta->data_len;
+	shinfo->gso_segs = coal_meta->pkt_count;
+}
+
+/* Set the transport checksum to the pseudo-header checksum and request
+ * partial checksum offload, letting the NIC or stack finish it.
+ */
+static void rmnet_map_partial_csum(struct sk_buff *skb,
+				   struct rmnet_map_coal_metadata *coal_meta)
+{
+	u16 pkt_len = skb->len - coal_meta->ip_len;
+	unsigned char *data = skb->data;
+	__sum16 pseudo;
+
+	if (coal_meta->ip_proto == 4) {
+		struct iphdr *iph = (struct iphdr *)data;
+
+		pseudo = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
+					    pkt_len, coal_meta->trans_proto, 0);
+	} else {
+		struct ipv6hdr *ip6h = (struct ipv6hdr *)data;
+
+		pseudo = ~csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
+					  pkt_len, coal_meta->trans_proto, 0);
+	}
+
+	if (coal_meta->trans_proto == IPPROTO_TCP) {
+		struct tcphdr *tp = (struct tcphdr *)(data + coal_meta->ip_len);
+
+		tp->check = pseudo;
+		skb->csum_offset = offsetof(struct tcphdr, check);
+	} else {
+		struct udphdr *up = (struct udphdr *)(data + coal_meta->ip_len);
+
+		up->check = pseudo;
+		skb->csum_offset = offsetof(struct udphdr, check);
+	}
+
+	skb->ip_summed = CHECKSUM_PARTIAL;
+	skb->csum_start = skb->data + coal_meta->ip_len - skb->head;
+}
+
+/* On some hardware, num_nlos in the coalescing header can be reported
+ * incorrectly under certain conditions even though the per-NLO num_packets
+ * fields it is meant to summarize are correct. Recompute the NLO count from
+ * the contiguous nl_pairs[] prefix rather than trusting the declared value.
+ * The first empty NLO marks the end of the prefix. Entries after it are not
+ * processed.
+ */
+static int rmnet_map_v5_get_num_nlos(const struct rmnet_map_v5_coal_header *coal_hdr)
+{
+	int nlos;
+
+	for (nlos = 0; nlos < RMNET_MAP_V5_MAX_NLOS; nlos++)
+		if (!coal_hdr->nl_pairs[nlos].num_packets)
+			break;
+
+	if (!nlos)
 		return -EINVAL;
 
-	if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) {
-		priv->stats.csum_sw++;
-	} else if (next_hdr->csum_info & MAPV5_CSUMINFO_VALID_FLAG) {
-		priv->stats.csum_ok++;
-		skb->ip_summed = CHECKSUM_UNNECESSARY;
+	return nlos;
+}
+
+static void rmnet_map_v5_set_nlos(struct rmnet_map_v5_coal_header *coal_hdr,
+				  u8 nlos)
+{
+	coal_hdr->coal_info = u8_encode_bits(nlos, MAPV5_COALINFO_NUM_NLOS_FMASK) |
+				      (coal_hdr->coal_info & MAPV5_COALINFO_CSUM_VALID_FLAG);
+}
+
+/* The frame-level CSUM_VALID indication for a single NLO, single packet
+ * coalescing frame cannot be trusted when the close reason is a TCP FIN/PSH,
+ * a packet count limit, a byte count limit or a time limit.
+ */
+static bool rmnet_map_v5_csum_fixup(struct rmnet_map_v5_coal_header *coal_hdr)
+{
+	u8 close_value = u8_get_bits(coal_hdr->close_info,
+				     MAPV5_CLOSEINFO_CLOSE_VALUE_FMASK);
+	u8 close_type = u8_get_bits(coal_hdr->close_info,
+				    MAPV5_CLOSEINFO_CLOSE_TYPE_FMASK);
+	u8 num_nlos = u8_get_bits(coal_hdr->coal_info,
+				  MAPV5_COALINFO_NUM_NLOS_FMASK);
+
+	/* Only applies to single NLO, single packet frames */
+	if (num_nlos != 1 || coal_hdr->nl_pairs[0].num_packets != 1)
+		return false;
+
+	/* TCP FIN or PSH triggered the close */
+	if (close_type == RMNET_MAP_COAL_CLOSE_COAL)
+		return true;
+
+	/* Hit a hardware limit */
+	if (close_type == RMNET_MAP_COAL_CLOSE_HW) {
+		switch (close_value) {
+		case RMNET_MAP_COAL_CLOSE_HW_PKT:
+		case RMNET_MAP_COAL_CLOSE_HW_BYTE:
+		case RMNET_MAP_COAL_CLOSE_HW_TIME:
+			return true;
+		}
+	}
+
+	return false;
+}
+
+/* Carve one logical segment from a coalesced SKB and append it to the list.
+ * Adjusts TCP sequence numbers, IP IDs/lengths, and checksum state.
+ */
+static void
+__rmnet_map_segment_coal_skb(struct sk_buff *coal_skb,
+			     struct rmnet_map_coal_metadata *coal_meta,
+			     struct sk_buff_head *list, u8 pkt_id,
+			     bool csum_valid)
+{
+	u32 dlen = coal_meta->data_len * coal_meta->pkt_count;
+	struct rmnet_priv *priv = netdev_priv(coal_skb->dev);
+	u32 hlen = coal_meta->ip_len + coal_meta->trans_len;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	struct sk_buff *skbn;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	/* RFC 768: UDP checksum is optional for IPv4, and is 0 if unused.
+	 * Such packets are never actually bad, regardless of what the
+	 * checksum bitmap says.
+	 */
+	if (!csum_valid && coal_meta->zero_csum)
+		csum_valid = true;
+
+	if (!csum_valid) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		/* rx_dropped is standard accounting. coal_csum_drop is its
+		 * coalescing-specific checksum error subset.
+		 */
+		u64_stats_add(&pcpu_ptr->priv_stats.rx_dropped, coal_meta->pkt_count);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_csum_drop);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		goto next_pkt;
+	}
+
+	skbn = alloc_skb(hlen + dlen + RMNET_MAP_DEAGGR_HEADROOM, GFP_ATOMIC);
+	if (!skbn) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		/* The coal counter is the coalescing subset of the standard
+		 * allocation failure and RX drop counters.
+		 */
+		u64_stats_add(&pcpu_ptr->priv_stats.rx_alloc_fail, coal_meta->pkt_count);
+		u64_stats_add(&pcpu_ptr->priv_stats.rx_dropped, coal_meta->pkt_count);
+		u64_stats_add(&pcpu_ptr->priv_stats.coal_alloc_fail, coal_meta->pkt_count);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		goto next_pkt;
+	}
+
+	skb_reserve(skbn, hlen + RMNET_MAP_DEAGGR_HEADROOM);
+	skb_put_data(skbn,
+		     coal_skb->data + coal_meta->ip_len + coal_meta->trans_len +
+		     coal_meta->data_offset,
+		     dlen);
+
+	/* Restore transport header */
+	skb_push(skbn, coal_meta->trans_len);
+	memcpy(skbn->data, coal_meta->trans_header, coal_meta->trans_len);
+	skb_reset_transport_header(skbn);
+
+	if (coal_meta->trans_proto == IPPROTO_TCP) {
+		struct tcphdr *th = tcp_hdr(skbn);
+
+		th->seq = htonl(ntohl(th->seq) + coal_meta->data_offset);
+		/* Strip dangerous flags from non-final segments */
+		if ((th->fin || th->psh) &&
+		    hlen + coal_meta->data_offset + dlen < coal_skb->len) {
+			th->fin = 0;
+			th->psh = 0;
+		}
+	} else if (coal_meta->trans_proto == IPPROTO_UDP) {
+		struct udphdr *uh = udp_hdr(skbn);
+
+		uh->len = htons(skbn->len);
+	}
+
+	/* Restore IP header */
+	skb_push(skbn, coal_meta->ip_len);
+	memcpy(skbn->data, coal_meta->ip_header, coal_meta->ip_len);
+	skb_reset_network_header(skbn);
+
+	if (coal_meta->ip_proto == 4) {
+		struct iphdr *iph = ip_hdr(skbn);
+
+		iph->id = htons(ntohs(iph->id) + pkt_id);
+		iph->tot_len = htons(skbn->len);
+		iph->check = 0;
+		iph->check = ip_fast_csum(iph, iph->ihl);
+	} else {
+		ipv6_hdr(skbn)->payload_len =
+			htons(skbn->len - sizeof(struct ipv6hdr));
+	}
+
+	rmnet_map_partial_csum(skbn, coal_meta);
+
+	skbn->dev = coal_skb->dev;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.coal_reconstruct);
+	u64_stats_update_end(&pcpu_ptr->syncp);
+
+	if (coal_meta->pkt_count > 1)
+		rmnet_map_gso_stamp(skbn, coal_meta);
+
+	__skb_queue_tail(list, skbn);
+
+next_pkt:
+	coal_meta->data_offset += dlen;
+	coal_meta->pkt_count = 0;
+}
+
+/* Parse the IP header of the coalesced frame and perform basic
+ * validation of header fields.
+ */
+static bool rmnet_map_coal_parse_ip_hdr(struct sk_buff *coal_skb,
+					struct rmnet_map_coal_metadata *meta,
+					bool *gro)
+{
+	struct rmnet_priv *priv = netdev_priv(coal_skb->dev);
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	struct ipv6hdr *ip6h;
+	struct iphdr *iph;
+	__be16 frag_off;
+	u8 protocol;
+	int ret;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	if (coal_skb->len < sizeof(*iph)) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return false;
+	}
+
+	iph = (struct iphdr *)coal_skb->data;
+
+	if (iph->version == 4) {
+		meta->ip_proto = 4;
+		meta->ip_len = iph->ihl * 4;
+		meta->trans_proto = iph->protocol;
+		meta->ip_header = iph;
+		if (meta->ip_len < sizeof(*iph) || coal_skb->len < meta->ip_len) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		if (ip_is_fragment(iph)) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		if (iph->ihl != 5)
+			*gro = false;
+	} else if (iph->version == 6) {
+		if (coal_skb->len < sizeof(*ip6h)) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		ip6h = (struct ipv6hdr *)iph;
+		protocol = ip6h->nexthdr;
+		meta->ip_proto = 6;
+		ret = ipv6_skip_exthdr(coal_skb, sizeof(*ip6h), &protocol,
+				       &frag_off);
+		if (ret < 0 || frag_off || ret > U16_MAX) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		meta->ip_len = (u16)ret;
+		meta->trans_proto = protocol;
+		meta->ip_header = ip6h;
+		if (coal_skb->len < meta->ip_len) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		if (meta->ip_len > sizeof(*ip6h))
+			*gro = false;
+	} else {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return false;
+	}
+
+	return true;
+}
+
+/* Parse the transport header following the IP header into coal_meta. The
+ * available length is checked before any field is read.
+ */
+static bool rmnet_map_coal_parse_trans_hdr(struct sk_buff *coal_skb,
+					   struct rmnet_map_coal_metadata *meta)
+{
+	struct rmnet_priv *priv = netdev_priv(coal_skb->dev);
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	struct udphdr *uh;
+	struct tcphdr *th;
+	u32 avail;
+	u8 *base;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	if (meta->ip_len > coal_skb->len) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_trans_invalid);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return false;
+	}
+
+	base = (u8 *)meta->ip_header + meta->ip_len;
+	avail = coal_skb->len - meta->ip_len;
+
+	if (meta->trans_proto == IPPROTO_TCP) {
+		if (avail < sizeof(*th)) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_trans_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		th = (struct tcphdr *)base;
+		meta->trans_len = th->doff * 4;
+		meta->trans_header = th;
+		if (meta->trans_len < sizeof(*th) || avail < meta->trans_len) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_trans_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+	} else if (meta->trans_proto == IPPROTO_UDP) {
+		if (avail < sizeof(*uh)) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_trans_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		uh = (struct udphdr *)base;
+		meta->trans_len = sizeof(*uh);
+		meta->trans_header = uh;
+		if (meta->ip_proto == 4 && !uh->check)
+			meta->zero_csum = true;
 	} else {
-		priv->stats.csum_valid_unset++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_trans_invalid);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return false;
+	}
+
+	return true;
+}
+
+/* Reject the frame unless the total data bytes claimed by all NLOs
+ * exactly match the actual payload in the SKB. Each pkt_len covers
+ * IP+transport headers plus per-packet data. Headers appear once, so
+ * subtract hlen per packet and track the running sum against available
+ * data. An exact match is required, not just an upper bound, so that
+ * GSO metadata stamped from the NLOs stays consistent with the real
+ * SKB length.
+ */
+static bool rmnet_map_coal_validate_bounds(struct sk_buff *coal_skb,
+					   struct rmnet_map_v5_coal_header *coal_hdr,
+					   u8 num_nlos, u32 hlen, bool *gro)
+{
+	u32 total_data = 0;
+	u32 nlo_len;
+	u16 plen;
+	u8 i;
+
+	if (hlen > coal_skb->len)
+		return false;
+
+	for (i = 0; i < num_nlos; i++) {
+		plen = ntohs(coal_hdr->nl_pairs[i].pkt_len);
+
+		if (plen < hlen)
+			return false;
+
+		/* Zero-payload packets cannot use GSO with a zero gso_size. */
+		if (plen == hlen)
+			*gro = false;
+
+		nlo_len = (u32)(plen - hlen) * coal_hdr->nl_pairs[i].num_packets;
+		if (nlo_len > coal_skb->len - hlen - total_data)
+			return false;
+
+		total_data += nlo_len;
+	}
+
+	return total_data == coal_skb->len - hlen;
+}
+
+/* Attempt the GRO-friendly fast path for a single-NLO, checksum-valid frame
+ * by reusing the original SKB and stamping GSO metadata instead of copying
+ * out each segment.  Returns true if the frame was consumed via the fast
+ * path, or false if the caller should fall back to full segmentation.
+ */
+static bool rmnet_map_coal_gro_fast_path(struct sk_buff *coal_skb,
+					 struct rmnet_map_v5_coal_header *coal_hdr,
+					 struct rmnet_map_coal_metadata *coal_meta,
+					 struct sk_buff_head *list,
+					 u8 num_nlos, bool gro)
+{
+	u32 hlen = coal_meta->ip_len + coal_meta->trans_len;
+
+	if (!gro || num_nlos != 1 ||
+	    !(coal_hdr->coal_info & MAPV5_COALINFO_CSUM_VALID_FLAG))
+		return false;
+
+	coal_meta->data_len = ntohs(coal_hdr->nl_pairs[0].pkt_len) - hlen;
+	coal_meta->pkt_count = coal_hdr->nl_pairs[0].num_packets;
+
+	coal_skb->ip_summed = CHECKSUM_UNNECESSARY;
+	if (coal_meta->pkt_count > 1) {
+		rmnet_map_partial_csum(coal_skb, coal_meta);
+		rmnet_map_gso_stamp(coal_skb, coal_meta);
+	}
+
+	__skb_queue_tail(list, coal_skb);
+	return true;
+}
+
+/* NLO packet lengths are already bounds-checked by
+ * rmnet_map_coal_validate_bounds() so no further validation is needed here.
+ */
+static void rmnet_map_coal_segment_loop(struct sk_buff *coal_skb,
+					struct rmnet_map_v5_coal_header *coal_hdr,
+					struct rmnet_map_coal_metadata *coal_meta,
+					struct sk_buff_head *list,
+					u64 nlo_err_mask, bool gro, u8 num_nlos)
+{
+	struct rmnet_priv *priv = netdev_priv(coal_skb->dev);
+	u32 hlen = coal_meta->ip_len + coal_meta->trans_len;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	u8 pkt, total_pkt = 0;
+	bool csum_err;
+	u16 pkt_len;
+	u8 nlo;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	for (nlo = 0; nlo < num_nlos; nlo++) {
+		pkt_len = ntohs(coal_hdr->nl_pairs[nlo].pkt_len);
+		pkt_len -= hlen;
+		coal_meta->data_len = pkt_len;
+
+		/* nlo_err_mask is one flat bitstream across all NLOs. Shift
+		 * it once per packet in absolute frame order and do not
+		 * re-align at the NLO boundary above. See the comment on
+		 * rmnet_map_data_check_coal_header() for why.
+		 */
+		for (pkt = 0; pkt < coal_hdr->nl_pairs[nlo].num_packets;
+		     pkt++, total_pkt++, nlo_err_mask >>= 1) {
+			csum_err = nlo_err_mask & 1;
+
+			if (csum_err) {
+				u64_stats_update_begin(&pcpu_ptr->syncp);
+				u64_stats_inc(&pcpu_ptr->priv_stats.coal_csum_err);
+				u64_stats_update_end(&pcpu_ptr->syncp);
+			}
+
+			if (!gro) {
+				coal_meta->pkt_count = 1;
+				__rmnet_map_segment_coal_skb(coal_skb, coal_meta,
+							     list, total_pkt,
+							     !csum_err);
+				continue;
+			}
+
+			if (csum_err) {
+				if (coal_meta->pkt_count)
+					__rmnet_map_segment_coal_skb(coal_skb,
+								     coal_meta,
+								     list,
+								     total_pkt -
+								     coal_meta->pkt_count,
+								     true);
+				coal_meta->pkt_count = 1;
+				__rmnet_map_segment_coal_skb(coal_skb, coal_meta,
+							     list, total_pkt,
+							     false);
+			} else {
+				coal_meta->pkt_count++;
+			}
+		}
+
+		/* Flush remaining packets from this NLO */
+		if (coal_meta->pkt_count)
+			__rmnet_map_segment_coal_skb(coal_skb, coal_meta, list,
+						     total_pkt - coal_meta->pkt_count, true);
+	}
+}
+
+/* Expand a coalesced SKB into individual IP packets placed on the list.
+ * NLOs with checksum errors are dropped. __rmnet_map_ingress_handler will
+ * free the SKB in the error case.
+ */
+static int rmnet_map_segment_coal_skb(struct sk_buff *coal_skb,
+				      u64 nlo_err_mask,
+				      struct sk_buff_head *list,
+				      u16 len, u16 total_pkts, u8 num_nlos)
+{
+	bool gro_hw = coal_skb->dev->features & NETIF_F_GRO_HW;
+	bool rxcsum = coal_skb->dev->features & NETIF_F_RXCSUM;
+	struct rmnet_priv *priv = netdev_priv(coal_skb->dev);
+	struct rmnet_map_v5_coal_header *coal_hdr;
+	struct rmnet_map_coal_metadata coal_meta;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	bool gro = gro_hw;
+	u32 hlen;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	memset(&coal_meta, 0, sizeof(coal_meta));
+
+	/* Drop any MAP frame padding. The coal header is counted in len */
+	skb_pull(coal_skb, sizeof(struct rmnet_map_header));
+	skb_trim(coal_skb, len);
+	coal_hdr = (struct rmnet_map_v5_coal_header *)coal_skb->data;
+	rmnet_map_v5_set_nlos(coal_hdr, num_nlos);
+	skb_pull(coal_skb, sizeof(*coal_hdr));
+
+	if (!rmnet_map_coal_parse_ip_hdr(coal_skb, &coal_meta, &gro))
+		return -EINVAL;
+
+	if (!rmnet_map_coal_parse_trans_hdr(coal_skb, &coal_meta))
+		return -EINVAL;
+
+	hlen = coal_meta.ip_len + coal_meta.trans_len;
+
+	if (!rmnet_map_coal_validate_bounds(coal_skb, coal_hdr, num_nlos, hlen,
+					    &gro)) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_bounds_err);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return -EINVAL;
+	}
+
+	/* Device capability gates coalesced delivery. Packet format can still
+	 * disable GSO and use the per-packet fallback below.
+	 */
+	if (total_pkts > 1 && (!rxcsum || !gro_hw))
+		return -EINVAL;
+
+	if (gro && total_pkts > 1) {
+		/* Standard counters cover delivered HW-GRO skbs. coal_rx and
+		 * coal_pkts cover coalescing input regardless of HW-GRO.
+		 */
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.rx_hw_gro_packets);
+		u64_stats_add(&pcpu_ptr->priv_stats.rx_hw_gro_wire_packets, total_pkts);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+	}
+
+	if (total_pkts == 1 && (!rxcsum || !gro_hw)) {
+		coal_skb->ip_summed = CHECKSUM_NONE;
+		__skb_queue_tail(list, coal_skb);
+		return 0;
+	}
+
+	if (rmnet_map_v5_csum_fixup(coal_hdr) && !coal_meta.zero_csum) {
+		coal_skb->ip_summed = CHECKSUM_NONE;
+		__skb_queue_tail(list, coal_skb);
+		return 0;
+	}
+
+	if (rmnet_map_coal_gro_fast_path(coal_skb, coal_hdr, &coal_meta, list,
+					 num_nlos, gro))
+		return 0;
+
+	rmnet_map_coal_segment_loop(coal_skb, coal_hdr, &coal_meta, list,
+				    nlo_err_mask, gro, num_nlos);
+
+	return 0;
+}
+
+/* Log the hardware close-reason counter for a coalescing header. */
+static void rmnet_map_data_log_close_stats(struct rmnet_pcpu_stats *pcpu_ptr,
+					   u8 type, u8 code)
+{
+	switch (type) {
+	case RMNET_MAP_COAL_CLOSE_NON_COAL:
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_non_coal);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		break;
+	case RMNET_MAP_COAL_CLOSE_IP_MISS:
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_ip_miss);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		break;
+	case RMNET_MAP_COAL_CLOSE_TRANS_MISS:
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_trans_miss);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		break;
+	case RMNET_MAP_COAL_CLOSE_HW:
+		switch (code) {
+		case RMNET_MAP_COAL_CLOSE_HW_NL:
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_hw_nl);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			break;
+		case RMNET_MAP_COAL_CLOSE_HW_PKT:
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_hw_pkt);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			break;
+		case RMNET_MAP_COAL_CLOSE_HW_BYTE:
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_hw_byte);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			break;
+		case RMNET_MAP_COAL_CLOSE_HW_TIME:
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_hw_time);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			break;
+		case RMNET_MAP_COAL_CLOSE_HW_EVICT:
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_hw_evict);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			break;
+		default:
+			break;
+		}
+		break;
+	case RMNET_MAP_COAL_CLOSE_COAL:
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_coal);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		break;
+	default:
+		break;
 	}
+}
 
-	/* Pull csum v5 header */
-	skb_pull(skb, sizeof(*next_hdr));
+/* Validate the coalescing header and build the checksum error mask.
+ *
+ * Checks performed:
+ *  - MAP pkt_len accommodates the coal header (coal header is counted in
+ *    pkt_len. pkt_len < sizeof(*coal_hdr) means no payload is possible).
+ *  - num_nlos is in [1, RMNET_MAP_V5_MAX_NLOS].
+ *  - Total packet count does not exceed RMNET_MAP_V5_MAX_PACKETS.
+ *
+ * nlo_err_mask is NOT six independent per-NLO bitmaps. Each nl_pairs
+ * slot only has room for an 8 bit csum_error_bitmap, but a single NLO
+ * can carry more than 8 packets (up to RMNET_MAP_V5_MAX_PACKETS), so
+ * hardware spills a wide NLO's error bits into the csum_error_bitmap
+ * bytes of the following slots rather than truncating them. The
+ * six bitmap bytes are therefore always concatenated in slot order
+ * into one flat RMNET_MAP_V5_MAX_NLOS * 8 = RMNET_MAP_V5_MAX_PACKETS
+ * bit value, addressed by a packet's absolute position in the frame,
+ * regardless of how many NLOs are actually in use. Receivers must
+ * walk it as a single contiguous stream and must not expect it to
+ * align it at NLO boundaries.
+ */
+static int rmnet_map_data_check_coal_header(struct sk_buff *skb,
+					    u64 *nlo_err_mask,
+					    u8 *num_nlos,
+					    u16 *num_pkts)
+{
+	struct rmnet_map_header *maph = (struct rmnet_map_header *)skb->data;
+	struct rmnet_priv *priv = netdev_priv(skb->dev);
+	struct rmnet_map_v5_coal_header *coal_hdr;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	u16 pkts = 0;
+	u64 mask = 0;
+	int nlos;
+	int i;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	/* coal header is counted in pkt_len */
+	if (ntohs(maph->pkt_len) < sizeof(*coal_hdr)) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_hdr_err);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return -EINVAL;
+	}
+
+	coal_hdr = (struct rmnet_map_v5_coal_header *)(skb->data + sizeof(*maph));
+	nlos = rmnet_map_v5_get_num_nlos(coal_hdr);
+	if (nlos < 0) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_hdr_err);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return -EINVAL;
+	}
+
+	*num_nlos = nlos;
+	for (i = 0; i < RMNET_MAP_V5_MAX_NLOS; i++) {
+		u8 err = coal_hdr->nl_pairs[i].csum_error_bitmap;
+		u8 pkt = coal_hdr->nl_pairs[i].num_packets;
+
+		mask |= ((u64)err) << (8 * i);
+		if (i < *num_nlos) {
+			pkts += pkt;
+			if (pkts > RMNET_MAP_V5_MAX_PACKETS) {
+				u64_stats_update_begin(&pcpu_ptr->syncp);
+				u64_stats_inc(&pcpu_ptr->priv_stats.coal_hdr_pkt_err);
+				u64_stats_update_end(&pcpu_ptr->syncp);
+				return -EINVAL;
+			}
+		}
+	}
+
+	/* coal_pkts counts packets reported by the hardware, independent of
+	 * whether the frame is later delivered through HW-GRO.
+	 */
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_add(&pcpu_ptr->priv_stats.coal_pkts, pkts);
+	u64_stats_update_end(&pcpu_ptr->syncp);
+	rmnet_map_data_log_close_stats(pcpu_ptr,
+				       u8_get_bits(coal_hdr->close_info,
+						   MAPV5_CLOSEINFO_CLOSE_TYPE_FMASK),
+				       u8_get_bits(coal_hdr->close_info,
+						   MAPV5_CLOSEINFO_CLOSE_VALUE_FMASK));
+
+	*nlo_err_mask = mask;
+	*num_pkts = pkts;
+	return 0;
+}
+
+int rmnet_map_process_next_hdr_packet(struct sk_buff *skb,
+				      struct sk_buff_head *list,
+				      u16 len, u32 data_format)
+{
+	struct rmnet_priv *priv = netdev_priv(skb->dev);
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	u64 nlo_err_mask;
+	u16 num_pkts;
+	u8 num_nlos;
+	int rc;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	switch (rmnet_map_get_next_hdr_type(skb)) {
+	case RMNET_MAP_HEADER_TYPE_COALESCING:
+		if (!(data_format & RMNET_FLAGS_INGRESS_COALESCE))
+			return -EINVAL;
+
+		/* coal_rx counts coalescing input, not delivered HW-GRO skbs. */
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_rx);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		rc = rmnet_map_data_check_coal_header(skb, &nlo_err_mask,
+						      &num_nlos, &num_pkts);
+		if (rc)
+			return rc;
+
+		/* Coalescing rewrites shared packet data and GSO metadata. */
+		if (skb_unclone(skb, GFP_ATOMIC))
+			return -ENOMEM;
+
+		rc = rmnet_map_segment_coal_skb(skb, nlo_err_mask, list, len,
+						num_pkts, num_nlos);
+		if (rc)
+			return rc;
+
+		if (skb_peek(list) != skb) {
+			if (skb_queue_empty(list))
+				kfree_skb(skb);
+			else
+				consume_skb(skb);
+		}
+		break;
+
+	case RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD:
+		if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.csum_sw);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+		} else if (rmnet_map_get_csum_valid(skb)) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.csum_ok);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			skb->ip_summed = CHECKSUM_UNNECESSARY;
+		} else {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.csum_valid_unset);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+		}
+
+		skb_pull(skb, sizeof(struct rmnet_map_header) +
+			      sizeof(struct rmnet_map_v5_csum_header));
+		skb_trim(skb, len);
+		__skb_queue_tail(list, skb);
+		break;
+
+	default:
+		return -EINVAL;
+	}
 
 	return 0;
 }
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
index 5f921cddf82b4..d76af4788243b 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
@@ -7,6 +7,7 @@
 #include <linux/capability.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
+#include <net/netdev_queues.h>
 #include <linux/if_arp.h>
 #include <linux/netlink.h>
 #include <net/pkt_sched.h>
@@ -66,27 +67,25 @@ static netdev_tx_t rmnet_vnd_start_xmit(struct sk_buff *skb,
 	return NETDEV_TX_OK;
 }
 
-static int rmnet_vnd_headroom(struct rmnet_port *port)
+static int rmnet_vnd_headroom(u32 data_format)
 {
 	u32 headroom;
 
 	headroom = sizeof(struct rmnet_map_header);
 
-	if (port->data_format & RMNET_FLAGS_EGRESS_MAP_CKSUMV4)
+	if (data_format & RMNET_FLAGS_EGRESS_MAP_CKSUMV4)
 		headroom += sizeof(struct rmnet_map_ul_csum_header);
 
 	return headroom;
 }
 
-static int rmnet_vnd_change_mtu(struct net_device *rmnet_dev, int new_mtu)
+static int rmnet_vnd_change_mtu_with_format(struct net_device *rmnet_dev,
+					    int new_mtu, u32 data_format)
 {
 	struct rmnet_priv *priv = netdev_priv(rmnet_dev);
-	struct rmnet_port *port;
 	u32 headroom;
 
-	port = rmnet_get_port_rtnl(priv->real_dev);
-
-	headroom = rmnet_vnd_headroom(port);
+	headroom = rmnet_vnd_headroom(data_format);
 
 	if (new_mtu < 0 || new_mtu > RMNET_MAX_PACKET_SIZE ||
 	    new_mtu > (priv->real_dev->mtu - headroom))
@@ -96,6 +95,17 @@ static int rmnet_vnd_change_mtu(struct net_device *rmnet_dev, int new_mtu)
 	return 0;
 }
 
+static int rmnet_vnd_change_mtu(struct net_device *rmnet_dev, int new_mtu)
+{
+	struct rmnet_priv *priv = netdev_priv(rmnet_dev);
+	struct rmnet_port *port;
+
+	port = rmnet_get_port_rtnl(priv->real_dev);
+
+	return rmnet_vnd_change_mtu_with_format(rmnet_dev, new_mtu,
+						READ_ONCE(port->data_format));
+}
+
 static int rmnet_vnd_get_iflink(const struct net_device *dev)
 {
 	struct rmnet_priv *priv = netdev_priv(dev);
@@ -132,8 +142,10 @@ static void rmnet_vnd_uninit(struct net_device *dev)
 static void rmnet_get_stats64(struct net_device *dev,
 			      struct rtnl_link_stats64 *s)
 {
+	struct rmnet_priv_stats total_priv_stats = { };
 	struct rmnet_priv *priv = netdev_priv(dev);
 	struct rmnet_vnd_stats total_stats = { };
+	struct rmnet_priv_stats priv_snapshot;
 	struct rmnet_pcpu_stats *pcpu_ptr;
 	struct rmnet_vnd_stats snapshot;
 	unsigned int cpu, start;
@@ -144,6 +156,8 @@ static void rmnet_get_stats64(struct net_device *dev,
 		do {
 			start = u64_stats_fetch_begin(&pcpu_ptr->syncp);
 			snapshot = pcpu_ptr->stats;	/* struct assignment */
+			u64_stats_copy(&priv_snapshot, &pcpu_ptr->priv_stats,
+				       sizeof(priv_snapshot));
 		} while (u64_stats_fetch_retry(&pcpu_ptr->syncp, start));
 
 		total_stats.rx_pkts += snapshot.rx_pkts;
@@ -151,6 +165,7 @@ static void rmnet_get_stats64(struct net_device *dev,
 		total_stats.tx_pkts += snapshot.tx_pkts;
 		total_stats.tx_bytes += snapshot.tx_bytes;
 		total_stats.tx_drops += snapshot.tx_drops;
+		total_priv_stats.rx_dropped += priv_snapshot.rx_dropped;
 	}
 
 	s->rx_packets = total_stats.rx_pkts;
@@ -158,8 +173,45 @@ static void rmnet_get_stats64(struct net_device *dev,
 	s->tx_packets = total_stats.tx_pkts;
 	s->tx_bytes = total_stats.tx_bytes;
 	s->tx_dropped = total_stats.tx_drops;
+	s->rx_dropped = total_priv_stats.rx_dropped;
+}
+
+/* Report standard network stack RX statistics. These are distinct from the
+ * rmnet-specific coalescing diagnostics exposed through ethtool.
+ */
+static void rmnet_get_queue_stats_rx(struct net_device *dev, int idx,
+				     struct netdev_queue_stats_rx *stats)
+{
+	struct rmnet_priv *priv = netdev_priv(dev);
+	struct rmnet_priv_stats total_stats = { };
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	struct rmnet_priv_stats snapshot;
+	unsigned int cpu, start;
+
+	for_each_possible_cpu(cpu) {
+		pcpu_ptr = per_cpu_ptr(priv->pcpu_stats, cpu);
+
+		do {
+			start = u64_stats_fetch_begin(&pcpu_ptr->syncp);
+			u64_stats_copy(&snapshot, &pcpu_ptr->priv_stats,
+				       sizeof(snapshot));
+		} while (u64_stats_fetch_retry(&pcpu_ptr->syncp, start));
+
+		total_stats.rx_hw_gro_packets += snapshot.rx_hw_gro_packets;
+		total_stats.rx_hw_gro_wire_packets +=
+			snapshot.rx_hw_gro_wire_packets;
+		total_stats.rx_alloc_fail += snapshot.rx_alloc_fail;
+	}
+
+	stats->hw_gro_packets = total_stats.rx_hw_gro_packets;
+	stats->hw_gro_wire_packets = total_stats.rx_hw_gro_wire_packets;
+	stats->alloc_fail = total_stats.rx_alloc_fail;
 }
 
+static const struct netdev_stat_ops rmnet_stat_ops = {
+	.get_queue_stats_rx = rmnet_get_queue_stats_rx,
+};
+
 static const struct net_device_ops rmnet_vnd_ops = {
 	.ndo_start_xmit = rmnet_vnd_start_xmit,
 	.ndo_change_mtu = rmnet_vnd_change_mtu,
@@ -183,8 +235,34 @@ static const char rmnet_gstrings_stats[][ETH_GSTRING_LEN] = {
 	"Checksum skipped",
 	"Checksum computed in software",
 	"Checksum computed in hardware",
+	/* DL coalescing */
+	"Coal alloc packet drops",
+	"Coal frames received",
+	"Packets in coal frames",
+	"Coal header errors",
+	"Coal hdr pkt count errors",
+	"Coal bounds errors",
+	"Coal checksum errors",
+	"Coal packets csum err drops",
+	"Coal segments reconstructed",
+	"Coal invalid IP packet",
+	"Coal invalid transport",
+	/* close reasons */
+	"Coal closed: non-coal",
+	"Coal closed: IP miss",
+	"Coal closed: transport miss",
+	"Coal closed: hw NL limit",
+	"Coal closed: hw pkt limit",
+	"Coal closed: hw byte limit",
+	"Coal closed: hw time limit",
+	"Coal closed: hw evict",
+	"Coal closed: FIN/PSH",
 };
 
+static_assert(ARRAY_SIZE(rmnet_gstrings_stats) ==
+	      (sizeof(struct rmnet_priv_stats) -
+	       offsetof(struct rmnet_priv_stats, csum_ok)) / sizeof(u64));
+
 static void rmnet_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
 {
 	switch (stringset) {
@@ -209,12 +287,68 @@ static void rmnet_get_ethtool_stats(struct net_device *dev,
 				    struct ethtool_stats *stats, u64 *data)
 {
 	struct rmnet_priv *priv = netdev_priv(dev);
-	struct rmnet_priv_stats *st = &priv->stats;
+	struct rmnet_priv_stats total_stats = { };
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	struct rmnet_priv_stats *snapshot;
+	unsigned int cpu, start;
 
 	if (!data)
 		return;
 
-	memcpy(data, st, ARRAY_SIZE(rmnet_gstrings_stats) * sizeof(u64));
+	snapshot = kzalloc_obj(*snapshot);
+	if (!snapshot)
+		return;
+
+	for_each_possible_cpu(cpu) {
+		pcpu_ptr = per_cpu_ptr(priv->pcpu_stats, cpu);
+
+		do {
+			start = u64_stats_fetch_begin(&pcpu_ptr->syncp);
+			u64_stats_copy(snapshot, &pcpu_ptr->priv_stats,
+				       sizeof(*snapshot));
+		} while (u64_stats_fetch_retry(&pcpu_ptr->syncp, start));
+
+		total_stats.csum_ok += snapshot->csum_ok;
+		total_stats.csum_ip4_header_bad += snapshot->csum_ip4_header_bad;
+		total_stats.csum_valid_unset += snapshot->csum_valid_unset;
+		total_stats.csum_validation_failed += snapshot->csum_validation_failed;
+		total_stats.csum_err_bad_buffer += snapshot->csum_err_bad_buffer;
+		total_stats.csum_err_invalid_ip_version +=
+			snapshot->csum_err_invalid_ip_version;
+		total_stats.csum_err_invalid_transport +=
+			snapshot->csum_err_invalid_transport;
+		total_stats.csum_fragmented_pkt += snapshot->csum_fragmented_pkt;
+		total_stats.csum_skipped += snapshot->csum_skipped;
+		total_stats.csum_sw += snapshot->csum_sw;
+		total_stats.csum_hw += snapshot->csum_hw;
+		/* Custom rmnet coalescing diagnostics follow. */
+		total_stats.coal_alloc_fail += snapshot->coal_alloc_fail;
+		total_stats.coal_rx += snapshot->coal_rx;
+		total_stats.coal_pkts += snapshot->coal_pkts;
+		total_stats.coal_hdr_err += snapshot->coal_hdr_err;
+		total_stats.coal_hdr_pkt_err += snapshot->coal_hdr_pkt_err;
+		total_stats.coal_bounds_err += snapshot->coal_bounds_err;
+		total_stats.coal_csum_err += snapshot->coal_csum_err;
+		total_stats.coal_csum_drop += snapshot->coal_csum_drop;
+		total_stats.coal_reconstruct += snapshot->coal_reconstruct;
+		total_stats.coal_ip_invalid += snapshot->coal_ip_invalid;
+		total_stats.coal_trans_invalid += snapshot->coal_trans_invalid;
+		total_stats.coal_close_non_coal += snapshot->coal_close_non_coal;
+		total_stats.coal_close_ip_miss += snapshot->coal_close_ip_miss;
+		total_stats.coal_close_trans_miss += snapshot->coal_close_trans_miss;
+		total_stats.coal_close_hw_nl += snapshot->coal_close_hw_nl;
+		total_stats.coal_close_hw_pkt += snapshot->coal_close_hw_pkt;
+		total_stats.coal_close_hw_byte += snapshot->coal_close_hw_byte;
+		total_stats.coal_close_hw_time += snapshot->coal_close_hw_time;
+		total_stats.coal_close_hw_evict += snapshot->coal_close_hw_evict;
+		total_stats.coal_close_coal += snapshot->coal_close_coal;
+	}
+
+	kfree(snapshot);
+
+	/* The first four fields are reported through netdev queue statistics. */
+	memcpy(data, &total_stats.ethtool_stats,
+	       sizeof(total_stats.ethtool_stats));
 }
 
 static int rmnet_get_coalesce(struct net_device *dev,
@@ -308,8 +442,7 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,
 		      struct rmnet_port *port,
 		      struct net_device *real_dev,
 		      struct rmnet_endpoint *ep,
-		      struct netlink_ext_ack *extack)
-
+		      struct netlink_ext_ack *extack, u32 data_format)
 {
 	struct rmnet_priv *priv = netdev_priv(rmnet_dev);
 	u32 headroom;
@@ -323,12 +456,16 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,
 	rmnet_dev->hw_features = NETIF_F_RXCSUM;
 	rmnet_dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
 	rmnet_dev->hw_features |= NETIF_F_SG;
+	rmnet_dev->hw_features |= NETIF_F_GRO_HW;
+	rmnet_dev->stat_ops = &rmnet_stat_ops;
 
 	priv->real_dev = real_dev;
 
-	headroom = rmnet_vnd_headroom(port);
+	headroom = rmnet_vnd_headroom(data_format);
 
-	if (rmnet_vnd_change_mtu(rmnet_dev, real_dev->mtu - headroom)) {
+	if (rmnet_vnd_change_mtu_with_format(rmnet_dev,
+					     real_dev->mtu - headroom,
+					     data_format)) {
 		NL_SET_ERR_MSG_MOD(extack, "Invalid MTU on real dev");
 		return -EINVAL;
 	}
@@ -375,17 +512,15 @@ int rmnet_vnd_do_flow_control(struct net_device *rmnet_dev, int enable)
 	return 0;
 }
 
-int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev)
+static int rmnet_vnd_validate_mtu(struct rmnet_port *port,
+				  struct net_device *real_dev, u32 data_format)
 {
 	struct hlist_node *tmp_ep;
 	struct rmnet_endpoint *ep;
-	struct rmnet_port *port;
 	unsigned long bkt_ep;
 	u32 headroom;
 
-	port = rmnet_get_port_rtnl(real_dev);
-
-	headroom = rmnet_vnd_headroom(port);
+	headroom = rmnet_vnd_headroom(data_format);
 
 	hash_for_each_safe(port->muxed_ep, bkt_ep, tmp_ep, ep, hlnode) {
 		if (ep->egress_dev->mtu > (real_dev->mtu - headroom))
@@ -395,23 +530,39 @@ int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev)
 	return 0;
 }
 
+int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev)
+{
+	struct rmnet_port *port;
+
+	port = rmnet_get_port_rtnl(real_dev);
+
+	return rmnet_vnd_validate_mtu(port, real_dev,
+				      READ_ONCE(port->data_format));
+}
+
 int rmnet_vnd_update_dev_mtu(struct rmnet_port *port,
-			     struct net_device *real_dev)
+			     struct net_device *real_dev, u32 data_format)
 {
 	struct hlist_node *tmp_ep;
 	struct rmnet_endpoint *ep;
 	unsigned long bkt_ep;
 	u32 headroom;
+	int new_mtu;
 
-	headroom = rmnet_vnd_headroom(port);
+	headroom = rmnet_vnd_headroom(data_format);
+	if (real_dev->mtu < headroom)
+		return -EINVAL;
+
+	new_mtu = real_dev->mtu - headroom;
+	if (new_mtu > RMNET_MAX_PACKET_SIZE)
+		return -EINVAL;
 
 	hash_for_each_safe(port->muxed_ep, bkt_ep, tmp_ep, ep, hlnode) {
-		if (ep->egress_dev->mtu <= (real_dev->mtu - headroom))
+		if (ep->egress_dev->mtu <= new_mtu)
 			continue;
 
-		if (rmnet_vnd_change_mtu(ep->egress_dev,
-					 real_dev->mtu - headroom))
-			return -1;
+		/* The target MTU was validated before updating any endpoint. */
+		WRITE_ONCE(ep->egress_dev->mtu, new_mtu);
 	}
 
 	return 0;
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h
index c2b2baf86894e..901ef36900ac3 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h
@@ -12,7 +12,7 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,
 		      struct rmnet_port *port,
 		      struct net_device *real_dev,
 		      struct rmnet_endpoint *ep,
-		      struct netlink_ext_ack *extack);
+		      struct netlink_ext_ack *extack, u32 data_format);
 int rmnet_vnd_dellink(u8 id, struct rmnet_port *port,
 		      struct rmnet_endpoint *ep);
 void rmnet_vnd_rx_fixup(struct sk_buff *skb, struct net_device *dev);
@@ -21,5 +21,5 @@ void rmnet_vnd_tx_fixup(struct sk_buff *skb, struct net_device *dev);
 void rmnet_vnd_setup(struct net_device *dev);
 int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev);
 int rmnet_vnd_update_dev_mtu(struct rmnet_port *port,
-			     struct net_device *real_dev);
+			     struct net_device *real_dev, u32 data_format);
 #endif /* _RMNET_VND_H_ */
diff --git a/include/linux/if_rmnet.h b/include/linux/if_rmnet.h
index c44bf6e80ecb4..5df4d417f3d2c 100644
--- a/include/linux/if_rmnet.h
+++ b/include/linux/if_rmnet.h
@@ -70,5 +70,36 @@ struct rmnet_map_v5_csum_header {
 #define MAPV5_HDRINFO_HDR_TYPE_FMASK	GENMASK(7, 1)
 #define MAPV5_CSUMINFO_VALID_FLAG	BIT(7)
 
+#define RMNET_MAP_HEADER_TYPE_COALESCING   1
 #define RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD 2
+
+/* MAPv5 coalescing header */
+#define RMNET_MAP_V5_MAX_NLOS		6
+#define RMNET_MAP_V5_MAX_PACKETS	48
+
+/* One Number-Length Object pair: per-NLO packet count and length. */
+struct rmnet_map_v5_nl_pair {
+	__be16 pkt_len;
+	u8  csum_error_bitmap;
+	u8  num_packets;
+} __aligned(1);
+
+/* MAPv5 coalescing header: describes up to RMNET_MAP_V5_MAX_NLOS NLOs.
+ * The header immediately follows the MAP header in the frame and is
+ * included in the MAP pkt_len field.
+ */
+struct rmnet_map_v5_coal_header {
+	u8  header_info;	/* MAPV5_HDRINFO_NXT_HDR_FLAG, MAPV5_HDRINFO_HDR_TYPE_FMASK */
+	u8  coal_info;		/* MAPV5_COALINFO_* */
+	u8  close_info;		/* MAPV5_CLOSEINFO_* */
+	u8  veid_info;		/* MAPV5_VEIDINFO_* */
+	struct rmnet_map_v5_nl_pair nl_pairs[RMNET_MAP_V5_MAX_NLOS];
+} __aligned(1);
+
+#define MAPV5_COALINFO_NUM_NLOS_FMASK		GENMASK(6, 4)
+#define MAPV5_COALINFO_CSUM_VALID_FLAG		BIT(7)
+#define MAPV5_CLOSEINFO_CLOSE_TYPE_FMASK	GENMASK(3, 0)
+#define MAPV5_CLOSEINFO_CLOSE_VALUE_FMASK	GENMASK(7, 4)
+#define MAPV5_VEIDINFO_VEID_FMASK		GENMASK(3, 0)
+
 #endif /* !(_LINUX_IF_RMNET_H_) */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 245b362045253..349fcddc6622f 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -2022,6 +2022,7 @@ enum {
 #define RMNET_FLAGS_EGRESS_MAP_CKSUMV4            (1U << 3)
 #define RMNET_FLAGS_INGRESS_MAP_CKSUMV5           (1U << 4)
 #define RMNET_FLAGS_EGRESS_MAP_CKSUMV5            (1U << 5)
+#define RMNET_FLAGS_INGRESS_COALESCE              (1U << 6)
 
 enum {
 	IFLA_RMNET_UNSPEC,

3/2 2026/10/09 10:43 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 33062
							output: 39
							thoughts: 336
						

Thoughts:
**Initial Assessment of the Patch Series**

Okay, so I'm presented with a patch series targeting the Linux kernel. My first instinct is to get a handle on the scope of the changes. The user wants me to evaluate this, so let's start by looking at *what* is being modified. Ah, a list of files... I see:

*   `Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst`
*   `drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c`
*   `drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h`
*   `drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c`
*   `drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h`
*   `drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c`
*   `drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c`
*   `drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h`
*   `include/linux/if_rmnet.h`
*   `include/uapi/linux/if_link.h`

Alright, all those files are clearly part of the Qualcomm `rmnet` driver, specifically within the `drivers/net/ethernet/qualcomm` directory. Okay, *rmnet*. Now, I need to remind myself what precisely that *is*. Is it a virtual network device, perhaps a Realtek Network or a rtnl link? I need to understand this to determine the potential impact of these changes. My first thought is that it is a virtual network device, and I need to verify that and understand how it works within the Linux kernel. To that end, I should be looking at the network link and Kconfig. Is it reachable in standard virtualized environments, like QEMU and syzkaller? Let's check how `rmnet` functions within Linux and if it is something I can use in virtualized environments. I'll need to do some grepping for `rmnet` rtnl link operations and related Kconfig options to get a clearer picture.



4/2 2026/10/09 10:43 tool grepper
0m Args:
{
  "Expression": "rmnet_link_ops",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=426=static int rmnet_fill_info(struct sk_buff *skb, const struct net_device *dev)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-447-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:448:struct rtnl_link_ops rmnet_link_ops __read_mostly = {\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-449-\t.kind\t\t= \"rmnet\",\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=567=static int __init rmnet_init(void)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-574-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:575:\trc = rtnl_link_register(\u0026rmnet_link_ops);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-576-\tif (rc != 0) {\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=583=static void __exit rmnet_exit(void)\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-584-{\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:585:\trtnl_link_unregister(\u0026rmnet_link_ops);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-586-\tunregister_netdevice_notifier(\u0026rmnet_dev_notifier);\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.h=33=struct rmnet_port {\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.h-55-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.h:56:extern struct rtnl_link_ops rmnet_link_ops;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.h-57-\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c=441=int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-478-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c:479:\t\trmnet_dev-\u003ertnl_link_ops = \u0026rmnet_link_ops;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-480-\n"
}

5/2 2026/10/09 10:43 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 34656
							output: 55
							thoughts: 56
						

Thoughts:
Here's my summary, as though I'm thinking through this process:

**Diving into the Rmnet Implementation**

Okay, so `rmnet` is acting as an `rtnl_link_ops` implementation. Right, that makes sense. Let's start by looking into the source for `rmnet_config.c`. My hunch is that `rmnet_newlink` or something related to `rtnl_link_ops` will be defined in that file. That should give me the initial hooks into how the rmnet interface is created and configured. After that I’ll need to figure out the Kconfig options that enable `rmnet`. Knowing which Kconfig options are related to this driver will help in reproducing configurations and understanding the dependencies involved in getting this driver working.



6/2 2026/10/09 10:43 tool grepper
0m Args:
{
  "Expression": "RMNET",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet/Kconfig",
    "drivers/net/ethernet/qualcomm/rmnet/Makefile"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/Kconfig-2-#\ndrivers/net/ethernet/qualcomm/rmnet/Kconfig:3:# RMNET MAP driver\ndrivers/net/ethernet/qualcomm/rmnet/Kconfig-4-#\ndrivers/net/ethernet/qualcomm/rmnet/Kconfig-5-\ndrivers/net/ethernet/qualcomm/rmnet/Kconfig:6:menuconfig RMNET\ndrivers/net/ethernet/qualcomm/rmnet/Kconfig-7-\ttristate \"RmNet MAP driver\"\n--\ndrivers/net/ethernet/qualcomm/rmnet/Kconfig-10-\thelp\ndrivers/net/ethernet/qualcomm/rmnet/Kconfig:11:\t  If you select this, you will enable the RMNET module which is used\ndrivers/net/ethernet/qualcomm/rmnet/Kconfig-12-\t  for handling data in the multiplexing and aggregation protocol (MAP)\ndrivers/net/ethernet/qualcomm/rmnet/Kconfig:13:\t  format in the embedded data path. RMNET devices can be attached to\ndrivers/net/ethernet/qualcomm/rmnet/Kconfig-14-\t  any IP mode physical device.\n--\ndrivers/net/ethernet/qualcomm/rmnet/Makefile-2-#\ndrivers/net/ethernet/qualcomm/rmnet/Makefile:3:# Makefile for the RMNET module\ndrivers/net/ethernet/qualcomm/rmnet/Makefile-4-#\n--\ndrivers/net/ethernet/qualcomm/rmnet/Makefile=10=rmnet-y\t\t += rmnet_map_command.o\ndrivers/net/ethernet/qualcomm/rmnet/Makefile:11:obj-$(CONFIG_RMNET) += rmnet.o\n"
}

7/2 2026/10/09 10:43 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 35366
							output: 41
							thoughts: 21
						

Thoughts:
Okay, let's dive into this Kconfig file for Qualcomm's rmnet driver. I know the rmnet architecture; it's a key piece in Qualcomm's mobile platform networking. I'm expecting to see the configuration options for various features, perhaps interface support (USB, PCIe, etc.), power management settings, debug flags, and maybe even some conditional compilation based on target SoCs. My primary interest is in understanding how the driver's features are exposed to the kernel config and where the relevant dependencies lie, as well as if there are any new features which may influence my work. I'll need to pay close attention to the relationships between the different options and how they integrate into the broader Qualcomm Ethernet driver framework. There may also be relevant comments that inform my understanding of the design choices that were made. This should be interesting. Let's get started.



8/2 2026/10/09 10:43 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/Kconfig",
  "FirstLine": 1,
  "LineCount": 25
}

Results:
{
  "Contents": "   1:\t# SPDX-License-Identifier: GPL-2.0-only\n   2:\t#\n   3:\t# RMNET MAP driver\n   4:\t#\n   5:\t\n   6:\tmenuconfig RMNET\n   7:\t\ttristate \"RmNet MAP driver\"\n   8:\t\tdefault n\n   9:\t\tselect GRO_CELLS\n  10:\t\thelp\n  11:\t\t  If you select this, you will enable the RMNET module which is used\n  12:\t\t  for handling data in the multiplexing and aggregation protocol (MAP)\n  13:\t\t  format in the embedded data path. RMNET devices can be attached to\n  14:\t\t  any IP mode physical device.\n"
}

9/2 2026/10/09 10:43 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 35789
							output: 47
							thoughts: 77
						

Thoughts:
Okay, let's dive into this RMNET situation.

**Investigating the RMNET Dependency Landscape and User-Space Interaction**

Alright, first things first: I need to quickly ascertain if RMNET has any external dependencies, particularly anything that might influence its core functionality. A quick scan of the configuration options, and nope, nothing obvious jumps out. Just a straightforward `menuconfig RMNET` with the `select GRO_CELLS` directive. That's a good starting point, nothing too complex yet.

Now, let's shift gears and examine how this `rmnet` link is actually utilized in the broader system. I'm especially interested in whether userspace applications can dynamically create and manage RMNET links via rtnetlink (`RTM_NEWLINK`). That would be a crucial piece of the puzzle. I suspect that might be a core function, so the next step is definitely diving into `rmnet_config.c`. That should provide the details I need.



10/2 2026/10/09 10:43 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c",
  "FirstLine": 445,
  "LineCount": 45
}

Results:
{
  "Contents": " 445:\t\treturn 0;\n 446:\t}\n 447:\t\n 448:\tstruct rtnl_link_ops rmnet_link_ops __read_mostly = {\n 449:\t\t.kind\t\t= \"rmnet\",\n 450:\t\t.maxtype\t= IFLA_RMNET_MAX,\n 451:\t\t.priv_size\t= sizeof(struct rmnet_priv),\n 452:\t\t.setup\t\t= rmnet_vnd_setup,\n 453:\t\t.validate\t= rmnet_rtnl_validate,\n 454:\t\t.newlink\t= rmnet_newlink,\n 455:\t\t.dellink\t= rmnet_dellink,\n 456:\t\t.get_size\t= rmnet_get_size,\n 457:\t\t.changelink     = rmnet_changelink,\n 458:\t\t.policy\t\t= rmnet_policy,\n 459:\t\t.fill_info\t= rmnet_fill_info,\n 460:\t};\n 461:\t\n 462:\t/* Can be called from a RCU read-side critical section, with or\n 463:\t * without BH disabled.\n 464:\t */\n 465:\tstruct rmnet_port *rmnet_get_port_rcu(const struct net_device *real_dev)\n 466:\t{\n 467:\t\tif (!rmnet_is_real_dev_registered(real_dev))\n 468:\t\t\treturn NULL;\n 469:\t\n 470:\t\treturn rcu_dereference_check(real_dev-\u003erx_handler_data,\n 471:\t\t\t\t\t     rcu_read_lock_bh_held());\n 472:\t}\n 473:\t\n 474:\tstruct rmnet_endpoint *rmnet_get_endpoint(struct rmnet_port *port, u8 mux_id)\n 475:\t{\n 476:\t\tstruct rmnet_endpoint *ep;\n 477:\t\n 478:\t\thlist_for_each_entry_rcu(ep, \u0026port-\u003emuxed_ep[mux_id], hlnode,\n 479:\t\t\t\t\t lockdep_rtnl_is_held()) {\n 480:\t\t\tif (READ_ONCE(ep-\u003emux_id) == mux_id)\n 481:\t\t\t\treturn ep;\n 482:\t\t}\n 483:\t\n 484:\t\treturn NULL;\n 485:\t}\n 486:\t\n 487:\tint rmnet_add_bridge(struct net_device *rmnet_dev,\n 488:\t\t\t     struct net_device *slave_dev,\n 489:\t\t\t     struct netlink_ext_ack *extack)\n"
}

11/2 2026/10/09 10:43 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 36841
							output: 47
							thoughts: 48
						

Thoughts:
Okay, let's dive into this `rmnet_newlink` function. I need to understand its capabilities.

**Investigating the Capabilities of `rmnet_newlink`**

My first question is: What exactly does this function *do*? I need a clear understanding of its purpose and operation. Once I have that, I want to explore its flexibility. Specifically, can an `rmnet` device, created via this function, be linked to a virtual network device? I'm thinking along the lines of attaching it to a `dummy`, `loopback`, or even a `tun` device. This would open up some interesting possibilities. My next step will be to thoroughly examine the `rmnet_newlink` source code itself to answer this question and understand its internals.



12/2 2026/10/09 10:43 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c",
  "FirstLine": 140,
  "LineCount": 60
}

Results:
{
  "Contents": " 140:\t\n 141:\t\tnetdev_upper_dev_unlink(bridge_dev, rmnet_dev);\n 142:\t\trmnet_unregister_real_device(bridge_dev);\n 143:\t}\n 144:\t\n 145:\tstatic int rmnet_newlink(struct net_device *dev,\n 146:\t\t\t\t struct rtnl_newlink_params *params,\n 147:\t\t\t\t struct netlink_ext_ack *extack)\n 148:\t{\n 149:\t\tstruct net *link_net = rtnl_newlink_link_net(params);\n 150:\t\tu32 data_format = RMNET_FLAGS_INGRESS_DEAGGREGATION;\n 151:\t\tstruct nlattr **data = params-\u003edata;\n 152:\t\tstruct nlattr **tb = params-\u003etb;\n 153:\t\tstruct net_device *real_dev;\n 154:\t\tint mode = RMNET_EPMODE_VND;\n 155:\t\tstruct rmnet_endpoint *ep;\n 156:\t\tstruct rmnet_port *port;\n 157:\t\tint err = 0;\n 158:\t\tu16 mux_id;\n 159:\t\n 160:\t\tif (!tb[IFLA_LINK]) {\n 161:\t\t\tNL_SET_ERR_MSG_MOD(extack, \"link not specified\");\n 162:\t\t\treturn -EINVAL;\n 163:\t\t}\n 164:\t\n 165:\t\treal_dev = __dev_get_by_index(link_net, nla_get_u32(tb[IFLA_LINK]));\n 166:\t\tif (!real_dev) {\n 167:\t\t\tNL_SET_ERR_MSG_MOD(extack, \"link does not exist\");\n 168:\t\t\treturn -ENODEV;\n 169:\t\t}\n 170:\t\n 171:\t\tif (data[IFLA_RMNET_FLAGS]) {\n 172:\t\t\tstruct ifla_rmnet_flags *flags;\n 173:\t\n 174:\t\t\tflags = nla_data(data[IFLA_RMNET_FLAGS]);\n 175:\t\t\tdata_format \u0026= ~flags-\u003emask;\n 176:\t\t\tdata_format |= flags-\u003eflags \u0026 flags-\u003emask;\n 177:\t\t}\n 178:\t\n 179:\t\tif (!rmnet_config_data_format_valid(data_format)) {\n 180:\t\t\tNL_SET_ERR_MSG_MOD(extack,\n 181:\t\t\t\t\t   \"unsupported MAP checksum flag combination\");\n 182:\t\t\treturn -EINVAL;\n 183:\t\t}\n 184:\t\n 185:\t\tep = kzalloc_obj(*ep);\n 186:\t\tif (!ep)\n 187:\t\t\treturn -ENOMEM;\n 188:\t\n 189:\t\tmux_id = nla_get_u16(data[IFLA_RMNET_MUX_ID]);\n 190:\t\n 191:\t\terr = rmnet_register_real_device(real_dev, extack);\n 192:\t\tif (err)\n 193:\t\t\tgoto err0;\n 194:\t\n 195:\t\tport = rmnet_get_port_rtnl(real_dev);\n 196:\t\terr = rmnet_vnd_newlink(mux_id, dev, port, real_dev, ep, extack,\n 197:\t\t\t\t\tdata_format);\n 198:\t\tif (err)\n 199:\t\t\tgoto err1;\n"
}

13/2 2026/10/09 10:43 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 38046
							output: 41
							thoughts: 41
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:

**Analyzing `rmnet_register_real_device`**

Alright, my internal radar just pinged – *`rmnet_register_real_device(real_dev, extack)`*! Interesting... Let's dig in. I immediately recognize the function call; it's practically second nature to me at this point. My mind's already racing, pulling up the relevant documentation and header files. My primary thought is, "What does this specific registration function handle? What's its role within the RMNET framework?" I need to understand what's happening. I immediately start deconstructing it. I'm already anticipating that `real_dev` is the device structure for the physical hardware, and that `extack` probably holds an external acknowledgment or error tracking information. Now, let's trace the call and figure out *precisely* how that registration happens and what dependencies are involved. I'm thinking about driver initialization, device tree interaction, and any potential locking issues this call might introduce. Let's see how deep this rabbit hole goes.



14/2 2026/10/09 10:44 tool grepper
0m Args:
{
  "Expression": "rmnet_register_real_device",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=61=static int rmnet_unregister_real_device(struct net_device *real_dev)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-77-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:78:static int rmnet_register_real_device(struct net_device *real_dev,\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-79-\t\t\t\t      struct netlink_ext_ack *extack)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=145=static int rmnet_newlink(struct net_device *dev,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-190-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:191:\terr = rmnet_register_real_device(real_dev, extack);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-192-\tif (err)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=487=int rmnet_add_bridge(struct net_device *rmnet_dev,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-523-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:524:\terr = rmnet_register_real_device(slave_dev, extack);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-525-\tif (err)\n"
}

15/2 2026/10/09 10:44 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 38828
							output: 46
							thoughts: 14
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:

**Analyzing `rmnet_register_real_device`**

Alright, let's dive into this `rmnet_register_real_device` function. My initial thought is to understand its purpose within the broader RMNET framework. I'm expecting this to be the core function responsible for integrating a *real* device, presumably a physical hardware component, into the RMNET system. The "real" designation is key here, as it likely implies some level of abstraction or virtual representation for other devices.

I'm mentally preparing to scrutinize how it handles device initialization: resource allocation, IRQ registration if applicable, and most importantly, the interaction with underlying hardware drivers. I'll be looking for clues on how the function handles data flow – is it setting up queues, DMA channels, or perhaps configuring shared memory regions?

I'm anticipating checks for error conditions. Device registration is often a complex process, so I’ll be examining the function’s error handling to ensure robustness. The returns of the function would be of interest to me here. Is it robust? Do we need to consider side effects?

Ultimately, my goal here is to grasp the device's lifecycle within RMNET. I want to understand how a "real" device becomes an active, functional endpoint, ready to participate in data transmission and reception. I'll need to dissect the data structures being manipulated to see how the RMNET internal representation is kept synchronized with the hardware state. This is going to be good.



16/2 2026/10/09 10:44 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c",
  "FirstLine": 75,
  "LineCount": 45
}

Results:
{
  "Contents": "  75:\t\treturn 0;\n  76:\t}\n  77:\t\n  78:\tstatic int rmnet_register_real_device(struct net_device *real_dev,\n  79:\t\t\t\t\t      struct netlink_ext_ack *extack)\n  80:\t{\n  81:\t\tstruct rmnet_port *port;\n  82:\t\tint rc, entry;\n  83:\t\n  84:\t\tASSERT_RTNL();\n  85:\t\n  86:\t\tif (rmnet_is_real_dev_registered(real_dev)) {\n  87:\t\t\tport = rmnet_get_port_rtnl(real_dev);\n  88:\t\t\tif (port-\u003ermnet_mode != RMNET_EPMODE_VND) {\n  89:\t\t\t\tNL_SET_ERR_MSG_MOD(extack, \"bridge device already exists\");\n  90:\t\t\t\treturn -EINVAL;\n  91:\t\t\t}\n  92:\t\n  93:\t\t\treturn 0;\n  94:\t\t}\n  95:\t\n  96:\t\tport = kzalloc_obj(*port);\n  97:\t\tif (!port)\n  98:\t\t\treturn -ENOMEM;\n  99:\t\n 100:\t\tport-\u003edev = real_dev;\n 101:\t\trc = netdev_rx_handler_register(real_dev, rmnet_rx_handler, port);\n 102:\t\tif (rc) {\n 103:\t\t\tkfree(port);\n 104:\t\t\treturn -EBUSY;\n 105:\t\t}\n 106:\t\n 107:\t\tfor (entry = 0; entry \u003c RMNET_MAX_LOGICAL_EP; entry++)\n 108:\t\t\tINIT_HLIST_HEAD(\u0026port-\u003emuxed_ep[entry]);\n 109:\t\n 110:\t\trmnet_map_tx_aggregate_init(port);\n 111:\t\n 112:\t\tnetdev_dbg(real_dev, \"registered with rmnet\\n\");\n 113:\t\treturn 0;\n 114:\t}\n 115:\t\n 116:\tstatic void rmnet_unregister_bridge(struct rmnet_port *port)\n 117:\t{\n 118:\t\tstruct net_device *bridge_dev, *real_dev, *rmnet_dev;\n 119:\t\tstruct rmnet_port *real_port;\n"
}

17/2 2026/10/09 10:44 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 39852
							output: 39
							thoughts: 100
						

Thoughts:
Here's my analysis of the code snippet, distilled into a first-person perspective:

**Diving into the Network Device Registration**

Okay, take a look at this – `netdev_rx_handler_register(real_dev, rmnet_rx_handler, port)`! That's clever. It seems any network device, whether it's a simple dummy interface, a virtual Ethernet pair (veth), or something else entirely, can be registered as the `real_dev` for an RMNET link. So, incoming packets on that `real_dev` are going to be handled by `rmnet_rx_handler`. That's the hook. Now, I need to understand what `rmnet_rx_handler` actually *does*. Time to dig into `rmnet_handlers.c` and see what's going on under the hood.



18/2 2026/10/09 10:44 tool grepper
0m Args:
{
  "Expression": "rmnet_rx_handler",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=24=static int rmnet_is_real_dev_registered(const struct net_device *real_dev)\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-25-{\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:26:\treturn rcu_access_pointer(real_dev-\u003erx_handler) == rmnet_rx_handler;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-27-}\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=78=static int rmnet_register_real_device(struct net_device *real_dev,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-100-\tport-\u003edev = real_dev;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:101:\trc = netdev_rx_handler_register(real_dev, rmnet_rx_handler, port);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-102-\tif (rc) {\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c=205=rmnet_bridge_handler(struct sk_buff *skb, struct net_device *bridge_dev)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-221- */\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c:222:rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb)\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-223-{\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.h=12=void rmnet_egress_handler(struct sk_buff *skb);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.h-13-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.h:14:rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.h-15-\n"
}

19/2 2026/10/09 10:44 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 40782
							output: 47
							thoughts: 22
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:

**Diving into `rmnet_handlers.c`**

Alright, time to troubleshoot this rmnet issue. My first instinct is to zero in on the receive path, specifically the function responsible for handling incoming packets. Let's start with `rmnet_rx_handler` in `rmnet_handlers.c`. That's where the rubber meets the road, where the data hits the stack, right? I want to see how the packets are being processed as they are received. Is there any obvious problem in the initial packet parsing, or perhaps some mishandling of the buffers? Time to check.



20/2 2026/10/09 10:44 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c",
  "FirstLine": 220,
  "LineCount": 60
}

Results:
{
  "Contents": " 220:\t * egress device listed in the logical endpoint configuration.\n 221:\t */\n 222:\trx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb)\n 223:\t{\n 224:\t\tstruct sk_buff *skb = *pskb;\n 225:\t\tstruct rmnet_port *port;\n 226:\t\tstruct net_device *dev;\n 227:\t\n 228:\t\tif (!skb)\n 229:\t\t\tgoto done;\n 230:\t\n 231:\t\tif (skb_linearize(skb)) {\n 232:\t\t\tkfree_skb(skb);\n 233:\t\t\tgoto done;\n 234:\t\t}\n 235:\t\n 236:\t\tif (skb-\u003epkt_type == PACKET_LOOPBACK)\n 237:\t\t\treturn RX_HANDLER_PASS;\n 238:\t\n 239:\t\tdev = skb-\u003edev;\n 240:\t\tport = rmnet_get_port_rcu(dev);\n 241:\t\tif (unlikely(!port)) {\n 242:\t\t\tdev_core_stats_rx_nohandler_inc(skb-\u003edev);\n 243:\t\t\tkfree_skb(skb);\n 244:\t\t\tgoto done;\n 245:\t\t}\n 246:\t\n 247:\t\tswitch (port-\u003ermnet_mode) {\n 248:\t\tcase RMNET_EPMODE_VND:\n 249:\t\t\trmnet_map_ingress_handler(skb, port);\n 250:\t\t\tbreak;\n 251:\t\tcase RMNET_EPMODE_BRIDGE:\n 252:\t\t\trmnet_bridge_handler(skb, port-\u003ebridge_ep);\n 253:\t\t\tbreak;\n 254:\t\t}\n 255:\t\n 256:\tdone:\n 257:\t\treturn RX_HANDLER_CONSUMED;\n 258:\t}\n 259:\t\n 260:\t/* Modifies packet as per logical endpoint configuration and egress data format\n 261:\t * for egress device configured in logical endpoint. Packet is then transmitted\n 262:\t * on the egress device.\n 263:\t */\n 264:\tvoid rmnet_egress_handler(struct sk_buff *skb)\n 265:\t{\n 266:\t\tstruct net_device *orig_dev;\n 267:\t\tstruct rmnet_port *port;\n 268:\t\tstruct rmnet_priv *priv;\n 269:\t\tu8 mux_id;\n 270:\t\tint err;\n 271:\t\n 272:\t\tsk_pacing_shift_update(skb-\u003esk, 8);\n 273:\t\n 274:\t\torig_dev = skb-\u003edev;\n 275:\t\tpriv = netdev_priv(orig_dev);\n 276:\t\tskb-\u003edev = priv-\u003ereal_dev;\n 277:\t\tmux_id = READ_ONCE(priv-\u003emux_id);\n 278:\t\n 279:\t\tport = rmnet_get_port_rcu(skb-\u003edev);\n"
}

21/2 2026/10/09 10:44 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 41854
							output: 47
							thoughts: 17
						

Thoughts:
Okay, here's my interpretation of what's going on, thinking through this like I would in the field.

**Deconstructing the `rmnet_map_ingress_handler`**

Alright, so I need to understand what's happening from the perspective of `rmnet_map_ingress_handler`. Let's break this down. It sounds like this is the entry point for handling incoming packets, possibly in a specific context related to RMNET (Remote Medium NETwork) mapping. That immediately tells me this is likely dealing with some kind of network interface or driver setup, probably on a mobile platform or embedded device, given the RMNET terminology.

I'm probably dealing with traffic that's been mapped or translated in some way, probably involving some kind of IP routing, address translation, or tunneling. My initial questions would be: What kind of packets are we talking about? Where are they coming from, and where are they ultimately headed? What is the *mapping* doing? Is this NAT, GRE, or something entirely custom? Is there any packet classification happening beforehand that is relevant to this handler?

The naming suggests "ingress," so this is clearly on the *receiving* side of things, but it's important to keep in mind the eventual packet destination. So, this handler is responsible for taking these "mapped" packets and figuring out what to do with them, at the very least routing, but probably further manipulation.

I need to understand what data structures or context this handler relies on. Are there configuration parameters related to the RMNET setup that affect its behavior? Are there global variables? Where does the handler get its input from, and does it use the result of previous calls? I will need to understand what data it receives and what data it outputs. I will also be interested in how this handler interacts with other components in the system – other network layers, the hardware, and the application layer.

I would start by looking for a detailed comment block or documentation associated with this function. Then, I would look at the call stack: Who calls this, and how? The code within the handler itself, and how it handles different scenarios and error conditions. Also, debugging tools will be helpful here - tracing, logging, packet captures – to see what the handler *actually* does in practice, in real-world scenarios. It's time to dive in.



22/2 2026/10/09 10:44 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c",
  "FirstLine": 115,
  "LineCount": 50
}

Results:
{
  "Contents": " 115:\t\trmnet_deliver_skb_list(\u0026list);\n 116:\t\treturn;\n 117:\t\n 118:\tfree_skb:\n 119:\t\tkfree_skb(skb);\n 120:\t}\n 121:\t\n 122:\tstatic void\n 123:\trmnet_map_ingress_handler(struct sk_buff *skb,\n 124:\t\t\t\t  struct rmnet_port *port)\n 125:\t{\n 126:\t\tstruct sk_buff *skbn;\n 127:\t\tu32 data_format;\n 128:\t\n 129:\t\tif (skb-\u003edev-\u003etype == ARPHRD_ETHER) {\n 130:\t\t\tif (pskb_expand_head(skb, ETH_HLEN, 0, GFP_ATOMIC)) {\n 131:\t\t\t\tkfree_skb(skb);\n 132:\t\t\t\treturn;\n 133:\t\t\t}\n 134:\t\n 135:\t\t\tskb_push(skb, ETH_HLEN);\n 136:\t\t}\n 137:\t\n 138:\t\tdata_format = READ_ONCE(port-\u003edata_format);\n 139:\t\n 140:\t\tif (data_format \u0026 RMNET_FLAGS_INGRESS_DEAGGREGATION) {\n 141:\t\t\twhile ((skbn = rmnet_map_deaggregate(skb, data_format)) != NULL)\n 142:\t\t\t\t__rmnet_map_ingress_handler(skbn, port, data_format);\n 143:\t\n 144:\t\t\tconsume_skb(skb);\n 145:\t\t} else {\n 146:\t\t\tif (rmnet_map_validate_packet_len(skb, data_format))\n 147:\t\t\t\t__rmnet_map_ingress_handler(skb, port, data_format);\n 148:\t\t\telse\n 149:\t\t\t\tkfree_skb(skb);\n 150:\t\t}\n 151:\t}\n 152:\t\n 153:\tstatic int rmnet_map_egress_handler(struct sk_buff *skb,\n 154:\t\t\t\t\t    struct rmnet_port *port, u8 mux_id,\n 155:\t\t\t\t\t    struct net_device *orig_dev)\n 156:\t{\n 157:\t\tint required_headroom, additional_header_len, csum_type = 0;\n 158:\t\tstruct rmnet_map_header *map_header;\n 159:\t\tu32 data_format;\n 160:\t\n 161:\t\tadditional_header_len = 0;\n 162:\t\trequired_headroom = sizeof(struct rmnet_map_header);\n 163:\t\n 164:\t\tdata_format = READ_ONCE(port-\u003edata_format);\n"
}

23/2 2026/10/09 10:44 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 43175
							output: 28
							thoughts: 594
						

Thoughts:
**Analyzing the RMNET Data Path: A Deep Dive**

Okay, so `__rmnet_map_ingress_handler` calls `rmnet_map_process_next_hdr_packet`, which is the crucial point.  And now, it seems this latter function handles the `RMNET_MAP_HEADER_TYPE_COALESCING` type. This then branches out to these functions:

*   `rmnet_map_data_check_coal_header`
*   `rmnet_map_segment_coal_skb`, which then calls:
    *   `rmnet_map_coal_parse_ip_hdr`
    *   `rmnet_map_coal_parse_trans_hdr`
    *   `rmnet_map_coal_validate_bounds`
    *   `rmnet_map_coal_gro_fast_path`
    *   `rmnet_map_coal_segment_loop`, which eventually calls `__rmnet_map_segment_coal_skb`.

Now, the important question is: is any of this actually reachable?  Yes!  `rmnet` is a software network device, a link-layer protocol driver.  I can create an `rmnet` link over any existing network interface (veth, dummy, tun, tap, loopback) using rtnetlink with `RTM_NEWLINK` and specifying `kind "rmnet"`.

And, as I know, syzkaller has the capabilities, either through syzlang descriptions or netlink, to create these interfaces. Let's see if syzkaller is already interacting with `rmnet` or if it's configurable via netlink.  A quick check shows that `rtnl_link_ops "rmnet"` means it's standard netlink: something like `ip link add link dummy0 name rmnet0 type rmnet mux_id 1 ...`.

The best part is that an unprivileged user in a user/net namespace (which is the standard syzkaller setup) can create dummy interfaces, create `rmnet` virtual devices on top of them, and then send raw packets into the underlying `real_dev`, or inject packets via AF_PACKET or tun/tap!

Now, before I get too far, I need to verify if `CONFIG_RMNET` can even be enabled, and what dependencies it might have. Let's check the Kconfig.

Okay, in `drivers/net/ethernet/qualcomm/rmnet/Kconfig`:
```kconfig
menuconfig RMNET
	tristate "RmNet MAP driver"
	default n
	select GRO_CELLS
	help
	  If you select this, you will enable the RMNET module which is used
	  for handling data in the multiplexing and aggregation protocol (MAP)
	  format in the embedded data path. RMNET devices can be attached to
	  any IP mode physical device.
```

So `CONFIG_RMNET` is indeed a tristate option and depends on `GRO_CELLS`, and, by the looks of it, it's not enabled by default, which is not surprising. Finally, now I need to figure out where `drivers/net/ethernet/qualcomm/rmnet/Kconfig` is actually sourced from. I know the basics are there, but I will need to verify.



24/2 2026/10/09 10:44 tool grepper
0m Args:
{
  "Expression": "rmnet/Kconfig",
  "PathPrefixes": [
    "drivers/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/Kconfig=63=config QCOM_PPE\n--\ndrivers/net/ethernet/qualcomm/Kconfig-77-\ndrivers/net/ethernet/qualcomm/Kconfig:78:source \"drivers/net/ethernet/qualcomm/rmnet/Kconfig\"\ndrivers/net/ethernet/qualcomm/Kconfig-79-\n"
}

25/2 2026/10/09 10:44 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 44630
							output: 38
							thoughts: 38
						

Thoughts:
Here's my thought process, as requested:

**Investigating Qualcomm Ethernet Driver Configuration**

Okay, I need to understand the configuration options for this Qualcomm Ethernet driver. My first instinct is to dive into the Kconfig file, specifically the one located at `drivers/net/ethernet/qualcomm/Kconfig`. I'm thinking, "Let's zoom in on that Kconfig file around line 78." I figure that's a good starting point. I'm going to look closely at that section. I'm especially interested in whether or not there are any parent menu dependencies, or `if` conditions that control the visibility or availability of this specific configuration option. I need to understand the constraints on enabling this driver, if there are any, and how those are defined within the build system. This should give me the initial context I need to assess its configuration.



26/2 2026/10/09 10:44 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/Kconfig",
  "FirstLine": 1,
  "LineCount": 85
}

Results:
{
  "Contents": "   1:\t# SPDX-License-Identifier: GPL-2.0-only\n   2:\t#\n   3:\t# Qualcomm network device configuration\n   4:\t#\n   5:\t\n   6:\tconfig NET_VENDOR_QUALCOMM\n   7:\t\tbool \"Qualcomm devices\"\n   8:\t\tdefault y\n   9:\t\thelp\n  10:\t\t  If you have a network (Ethernet) card belonging to this class, say Y.\n  11:\t\n  12:\t\t  Note that the answer to this question doesn't directly affect the\n  13:\t\t  kernel: saying N will just cause the configurator to skip all\n  14:\t\t  the questions about Qualcomm cards. If you say Y, you will be asked\n  15:\t\t  for your specific card in the following questions.\n  16:\t\n  17:\tif NET_VENDOR_QUALCOMM\n  18:\t\n  19:\tconfig QCA7000\n  20:\t\ttristate\n  21:\t\thelp\n  22:\t\t  This enables support for the Qualcomm Atheros QCA7000.\n  23:\t\n  24:\tconfig QCA7000_SPI\n  25:\t\ttristate \"Qualcomm Atheros QCA7000 SPI support\"\n  26:\t\tselect QCA7000\n  27:\t\tdepends on SPI_MASTER \u0026\u0026 OF\n  28:\t\thelp\n  29:\t\t  This SPI protocol driver supports the Qualcomm Atheros QCA7000.\n  30:\t\n  31:\t\t  To compile this driver as a module, choose M here. The module\n  32:\t\t  will be called qcaspi.\n  33:\t\n  34:\tconfig QCA7000_UART\n  35:\t\ttristate \"Qualcomm Atheros QCA7000 UART support\"\n  36:\t\tselect QCA7000\n  37:\t\tdepends on SERIAL_DEV_BUS \u0026\u0026 OF\n  38:\t\thelp\n  39:\t\t  This UART protocol driver supports the Qualcomm Atheros QCA7000.\n  40:\t\n  41:\t\t  Currently the driver assumes these device UART settings:\n  42:\t\t    Data bits: 8\n  43:\t\t    Parity: None\n  44:\t\t    Stop bits: 1\n  45:\t\t    Flow control: None\n  46:\t\n  47:\t\t  To compile this driver as a module, choose M here. The module\n  48:\t\t  will be called qcauart.\n  49:\t\n  50:\tconfig QCOM_EMAC\n  51:\t\ttristate \"Qualcomm EMAC Gigabit Ethernet support\"\n  52:\t\tdepends on HAS_DMA \u0026\u0026 HAS_IOMEM\n  53:\t\tselect CRC32\n  54:\t\tselect PHYLIB\n  55:\t\thelp\n  56:\t\t  This driver supports the Qualcomm Technologies, Inc. Gigabit\n  57:\t\t  Ethernet Media Access Controller (EMAC). The controller\n  58:\t\t  supports IEEE 802.3-2002, half-duplex mode at 10/100 Mb/s,\n  59:\t\t  full-duplex mode at 10/100/1000Mb/s, Wake On LAN (WOL) for\n  60:\t\t  low power, Receive-Side Scaling (RSS), and IEEE 1588-2008\n  61:\t\t  Precision Clock Synchronization Protocol.\n  62:\t\n  63:\tconfig QCOM_PPE\n  64:\t\ttristate \"Qualcomm PPE Ethernet support\"\n  65:\t\tdepends on COMMON_CLK \u0026\u0026 HAS_IOMEM \u0026\u0026 OF\n  66:\t\tdepends on ARCH_QCOM || COMPILE_TEST\n  67:\t\tselect REGMAP_MMIO\n  68:\t\thelp\n  69:\t\t  This driver supports the Qualcomm Technologies, Inc. packet\n  70:\t\t  process engine (PPE) available with IPQ SoC. The PPE includes\n  71:\t\t  the Ethernet MACs, Ethernet DMA (EDMA) and switch core that\n  72:\t\t  supports L3 flow offload, L2 switch function, RSS and tunnel\n  73:\t\t  offload.\n  74:\t\n  75:\t\t  To compile this driver as a module, choose M here. The module\n  76:\t\t  will be called qcom-ppe.\n  77:\t\n  78:\tsource \"drivers/net/ethernet/qualcomm/rmnet/Kconfig\"\n  79:\t\n  80:\tendif # NET_VENDOR_QUALCOMM\n"
}

27/2 2026/10/09 10:44 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 46024
							output: 36
							thoughts: 83
						

Thoughts:
**Analyzing Qualcomm's Network Configuration**

Okay, so the `NET_VENDOR_QUALCOMM` option is enabled by default. That's a key starting point. And `RMNET`, which is something I'm very familiar with, is conditionally compiled based on `NET_VENDOR_QUALCOMM`. It's pretty straightforward, but this tells me the scope of what I need to look at is focused on Qualcomm-specific network configurations, or potentially just `RMNET` on its own. Now, to understand the broader context and see if there are any subtle interactions or dependencies, the logical next step is to examine the `NET_VENDOR_QUALCOMM` Kconfig entry. I'll need to check its parent in `drivers/net/ethernet/Kconfig` to see the broader dependencies or potential conflicts. That should provide the necessary context to determine if this default setting has any unexpected implications for the overall network stack.



28/2 2026/10/09 10:44 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "NET_VENDOR_QUALCOMM",
  "PathPrefixes": [
    "drivers/net/ethernet/Kconfig"
  ]
}

Results:
{
  "error": "no matches"
}

29/2 2026/10/09 10:44 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 46349
							output: 34
							thoughts: 19
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:

**Analyzing Network Driver Identification**

Alright, so I need to track down a specific network driver within the Linux kernel source, and I'm pretty sure it's associated with a Qualcomm device. My initial thought is the most direct approach: let's leverage `grep` to quickly scan the relevant directory. Specifically, I want to search for the string `NET_VENDOR_QUALCOMM`. This is a common and usually reliable macro used within the kernel to identify Qualcomm-specific network devices. Targeting the `drivers/net/ethernet/` directory is a good starting point, as that's where Ethernet drivers are typically located. This should narrow down the search space considerably and give me a manageable set of potential matches to investigate further. A quick `grep` will get me there faster than anything else.



30/2 2026/10/09 10:44 tool grepper
0m Args:
{
  "Expression": "NET_VENDOR_QUALCOMM",
  "PathPrefixes": [
    "drivers/net/ethernet/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/Makefile=78=obj-$(CONFIG_NET_VENDOR_QLOGIC) += qlogic/\ndrivers/net/ethernet/Makefile:79:obj-$(CONFIG_NET_VENDOR_QUALCOMM) += qualcomm/\ndrivers/net/ethernet/Makefile-80-obj-$(CONFIG_NET_VENDOR_REALTEK) += realtek/\n--\ndrivers/net/ethernet/qualcomm/Kconfig-5-\ndrivers/net/ethernet/qualcomm/Kconfig:6:config NET_VENDOR_QUALCOMM\ndrivers/net/ethernet/qualcomm/Kconfig-7-\tbool \"Qualcomm devices\"\n--\ndrivers/net/ethernet/qualcomm/Kconfig-16-\ndrivers/net/ethernet/qualcomm/Kconfig:17:if NET_VENDOR_QUALCOMM\ndrivers/net/ethernet/qualcomm/Kconfig-18-\n--\ndrivers/net/ethernet/qualcomm/Kconfig=78=source \"drivers/net/ethernet/qualcomm/rmnet/Kconfig\"\ndrivers/net/ethernet/qualcomm/Kconfig-79-\ndrivers/net/ethernet/qualcomm/Kconfig:80:endif # NET_VENDOR_QUALCOMM\n"
}

31/2 2026/10/09 10:44 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 46897
							output: 30
							thoughts: 22
						

Thoughts:
Okay, here's my summary, tailored for an expert audience, as if I'm thinking these things myself:

**Kconfig Inclusion Analysis**

Right, let's get down to brass tacks. I need to understand the configuration space related to Qualcomm Ethernet drivers. My initial thought is to trace the inclusion path for `drivers/net/ethernet/qualcomm/Kconfig`. I need to figure out *where* this configuration file is being brought into the build process. I'm after the dependencies, really. Understanding the `Kconfig` inclusion hierarchy is fundamental to knowing which options will be visible, under what circumstances, and how they relate to the broader network stack configuration. It's the starting point for any in-depth configuration analysis or modification of those Qualcomm ethernet drivers. I need to know the *context* of those options; who is including it and why.



32/2 2026/10/09 10:44 tool grepper
0m Args:
{
  "Expression": "qualcomm/Kconfig",
  "PathPrefixes": [
    "drivers/net/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/Kconfig=164=source \"drivers/net/ethernet/brocade/Kconfig\"\ndrivers/net/ethernet/Kconfig:165:source \"drivers/net/ethernet/qualcomm/Kconfig\"\ndrivers/net/ethernet/Kconfig-166-source \"drivers/net/ethernet/rdc/Kconfig\"\n"
}

33/2 2026/10/09 10:44 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 47234
							output: 40
							thoughts: 1445
						

Thoughts:
**Initial Assessment of RMNET Coalescing Support**

Okay, so I'm looking at this patch for `NET_VENDOR_QUALCOMM` and `RMNET`, which seems to be pretty standard networking stuff. The goal is to figure out if it's fuzz-worthy and what symbols to extract for that purpose. Let's dig in.

The diff introduces hardware coalescing in rmnet – specifically, it's about parsing the MAPv5 coalescing header, segmenting coalesced frames, stamping GSO data, and handling errors and stats. Immediately, it's clear this is complex, making it potentially fruitful for fuzzing.

I see a documentation update first, which explains the v5 coalescing header, including NLOs, packet formats, checksum validation, close types and values, and various flags. That gives me a head start on understanding the format.

Then, in `rmnet_config.c`, there's validation. We have `rmnet_config_data_format_valid` which checks flags and makes sure v4 and v5 checksums aren't mixed, and that `RMNET_FLAGS_INGRESS_COALESCE` is accompanied by `RMNET_FLAGS_INGRESS_MAP_CKSUMV5`. The `rmnet_newlink` and `rmnet_changelink` functions also validate flags, and update the MTU via calls to vendor-specific functions.

`rmnet_config.h` updates the stats. We see new `rmnet_priv_stats` and `rmnet_pcpu_priv_stats` structs, along with a slew of coalescing counters.

In `rmnet_handlers.c`, `rmnet_deliver_skb_list` processes the data. Specifically, in `__rmnet_map_ingress_handler`, it checks for certain flag combinations and calls `rmnet_map_process_next_hdr_packet` if the flags are set. Then the list is delivered.

`rmnet_map.h` defines enums for close types and values and the signature for `rmnet_map_process_next_hdr_packet` is updated.

Now we get to the core of it in `rmnet_map_data.c`. This is where the magic happens and where I expect the most interesting code to be. There is significant packet parsing and segmentation logic. We have:
- checksum field retrieval and stats accounting.
- packet length validation.
- GSO configuration.
- partial checksum calculations.
- functions for handling NLOs.
- `__rmnet_map_segment_coal_skb` allocates, slices, sets headers, calculates checksums and stamps GSO and queues to list.
- Functions to parse IPv4 and IPv6 headers, TCP/UDP headers and validate bounds.
- Fast path or segment loop code, checking various conditions.
- Error checking and handling.
- `rmnet_map_process_next_hdr_packet` performs the segmentation after an skb is uncloned.

`rmnet_vnd.c` has vendor specific functions for headroom calculations, MTU changes, stat reporting and setup for GRO HW.

Finally, we have header definitions in `if_rmnet.h` and `if_link.h`.

This is massive complex packet parsing, packet reconstruction, checksum calculation, and GSO creation logic!

This is a **definite** candidate for fuzzing. All those functions handling different cases, parsing headers, and manipulating packets? Yes.

I need to confirm reachability.
Is this code reachable in a standard virtualized environment? Does `rmnet` require a physical device? The documentation mentions RMNET can be attached to *any* IP mode physical device. But can it be virtual? I need to check `rmnet_is_real_dev_registered`, `rmnet_register_real_device`, `rmnet_vnd_newlink`, and particularly `rmnet_rtnl_validate` in `rmnet_config.c`. to determine if I can create an RMNET device over a virtual device like `ip link add link ... type rmnet`.



34/2 2026/10/09 10:45 tool grepper
0m Args:
{
  "Expression": "rmnet_rtnl_validate",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=315=static struct notifier_block rmnet_dev_notifier __read_mostly = {\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-318-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:319:static int rmnet_rtnl_validate(struct nlattr *tb[], struct nlattr *data[],\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-320-\t\t\t       struct netlink_ext_ack *extack)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=448=struct rtnl_link_ops rmnet_link_ops __read_mostly = {\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-452-\t.setup\t\t= rmnet_vnd_setup,\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:453:\t.validate\t= rmnet_rtnl_validate,\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-454-\t.newlink\t= rmnet_newlink,\n"
}

35/2 2026/10/09 10:45 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 49925
							output: 47
							thoughts: 13
						

Thoughts:
Okay, here's my interpretation of "Let's read `rmnet_rtnl_validate`", summarized from an expert's perspective:

**Diving into `rmnet_rtnl_validate`**

Alright, time to crack open `rmnet_rtnl_validate`. This usually means there's a routing or network configuration issue, specifically within the rmnet framework. I need to understand what this function is doing at the kernel level. Is it validating a message received over a netlink socket, perhaps related to a route, a link, or something else that uses netlink for communication? My first thought is what specific attributes it checks. Are we talking about packet filters, QoS parameters, or interface addresses? I'm probably looking for sanity checks to prevent malformed or malicious data from disrupting the network stack. I'll be focused on how it handles errors; does it log with appropriate levels, return specific error codes that are handled upstream, or trigger some sort of panic? A good validation function is crucial for network stability. It's often the front line of defense against exploitable vulnerabilities. Now, let's see how it actually *does* it. I'll need to figure out what data structures it's interacting with, whether it's using helpers like `nla_validate_policy`, and how strict its checks are. I expect to see checks for buffer overflows, invalid values, and potentially some kind of access control or permission validation if this is linked to user-space configuration. Alright, let's dive in and see what's actually under the hood.



36/2 2026/10/09 10:45 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c",
  "FirstLine": 315,
  "LineCount": 35
}

Results:
{
  "Contents": " 315:\tstatic struct notifier_block rmnet_dev_notifier __read_mostly = {\n 316:\t\t.notifier_call = rmnet_config_notify_cb,\n 317:\t};\n 318:\t\n 319:\tstatic int rmnet_rtnl_validate(struct nlattr *tb[], struct nlattr *data[],\n 320:\t\t\t\t       struct netlink_ext_ack *extack)\n 321:\t{\n 322:\t\tu16 mux_id;\n 323:\t\n 324:\t\tif (!data || !data[IFLA_RMNET_MUX_ID]) {\n 325:\t\t\tNL_SET_ERR_MSG_MOD(extack, \"MUX ID not specified\");\n 326:\t\t\treturn -EINVAL;\n 327:\t\t}\n 328:\t\n 329:\t\tmux_id = nla_get_u16(data[IFLA_RMNET_MUX_ID]);\n 330:\t\tif (mux_id \u003e (RMNET_MAX_LOGICAL_EP - 1)) {\n 331:\t\t\tNL_SET_ERR_MSG_MOD(extack, \"invalid MUX ID\");\n 332:\t\t\treturn -ERANGE;\n 333:\t\t}\n 334:\t\n 335:\t\treturn 0;\n 336:\t}\n 337:\t\n 338:\tstatic int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],\n 339:\t\t\t\t    struct nlattr *data[],\n 340:\t\t\t\t    struct netlink_ext_ack *extack)\n 341:\t{\n 342:\t\tstruct rmnet_priv *priv = netdev_priv(dev);\n 343:\t\tstruct ifla_rmnet_flags *flags;\n 344:\t\tstruct net_device *real_dev;\n 345:\t\tstruct rmnet_port *port;\n 346:\t\tu32 old_data_format;\n 347:\t\tu32 data_format;\n 348:\t\tu16 mux_id;\n 349:\t\tint err;\n"
}

37/2 2026/10/09 10:45 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 50878
							output: 47
							thoughts: 158
						

Thoughts:
**My Analysis of the rmnet Code**

Okay, let me break down what I'm seeing in this `rmnet` code. First, `rmnet_rtnl_validate` seems to have a very focused validation routine. I see it only checks two things: the presence of `data` and the value of `data[IFLA_RMNET_MUX_ID]`, and then makes sure the `mux_id` stays within reasonable bounds, specifically `mux_id <= RMNET_MAX_LOGICAL_EP - 1`. That’s quite a minimalist approach to validation, which, in my experience, could be a potential area for vulnerabilities if the input data isn't rigorously sanitized elsewhere.

Now, let's look at `rmnet_newlink`.  I spot that it verifies `tb[IFLA_LINK]` is provided, and then goes to look up a device, `real_dev`, using `__dev_get_by_index(...)`. And this is where it gets interesting, or perhaps concerning, depending on the context: it appears that *any* device can be used as `real_dev`. There's no apparent type or capability check here. That feels like a potential source of interesting, and possibly undesirable, behavior. The code then registers a receive handler, `rmnet_rx_handler`, for this `real_dev`, passing it the `port`.

Finally, to tie it all together, I should really look closer at what `rmnet_vnd_newlink` is doing. I need to understand how it interacts with these other functions, especially given the potential for vulnerabilities I just noticed. I'm going to dig into that now.



38/2 2026/10/09 10:45 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c",
  "FirstLine": 440,
  "LineCount": 50
}

Results:
{
  "Contents": " 440:\t\n 441:\tint rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,\n 442:\t\t\t      struct rmnet_port *port,\n 443:\t\t\t      struct net_device *real_dev,\n 444:\t\t\t      struct rmnet_endpoint *ep,\n 445:\t\t\t      struct netlink_ext_ack *extack, u32 data_format)\n 446:\t{\n 447:\t\tstruct rmnet_priv *priv = netdev_priv(rmnet_dev);\n 448:\t\tu32 headroom;\n 449:\t\tint rc;\n 450:\t\n 451:\t\tif (rmnet_get_endpoint(port, id)) {\n 452:\t\t\tNL_SET_ERR_MSG_MOD(extack, \"MUX ID already exists\");\n 453:\t\t\treturn -EBUSY;\n 454:\t\t}\n 455:\t\n 456:\t\trmnet_dev-\u003ehw_features = NETIF_F_RXCSUM;\n 457:\t\trmnet_dev-\u003ehw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;\n 458:\t\trmnet_dev-\u003ehw_features |= NETIF_F_SG;\n 459:\t\trmnet_dev-\u003ehw_features |= NETIF_F_GRO_HW;\n 460:\t\trmnet_dev-\u003estat_ops = \u0026rmnet_stat_ops;\n 461:\t\n 462:\t\tpriv-\u003ereal_dev = real_dev;\n 463:\t\n 464:\t\theadroom = rmnet_vnd_headroom(data_format);\n 465:\t\n 466:\t\tif (rmnet_vnd_change_mtu_with_format(rmnet_dev,\n 467:\t\t\t\t\t\t     real_dev-\u003emtu - headroom,\n 468:\t\t\t\t\t\t     data_format)) {\n 469:\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Invalid MTU on real dev\");\n 470:\t\t\treturn -EINVAL;\n 471:\t\t}\n 472:\t\n 473:\t\trc = register_netdevice(rmnet_dev);\n 474:\t\tif (!rc) {\n 475:\t\t\tep-\u003eegress_dev = rmnet_dev;\n 476:\t\t\tep-\u003emux_id = id;\n 477:\t\t\tport-\u003enr_rmnet_devs++;\n 478:\t\n 479:\t\t\trmnet_dev-\u003ertnl_link_ops = \u0026rmnet_link_ops;\n 480:\t\n 481:\t\t\tWRITE_ONCE(priv-\u003emux_id, id);\n 482:\t\n 483:\t\t\tnetdev_dbg(rmnet_dev, \"rmnet dev created\\n\");\n 484:\t\t}\n 485:\t\n 486:\t\treturn rc;\n 487:\t}\n 488:\t\n 489:\tint rmnet_vnd_dellink(u8 id, struct rmnet_port *port,\n"
}

39/2 2026/10/09 10:45 llm patch-evaluator
1m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 52252
							output: 308
							thoughts: 3055
						

Thoughts:
**Analysis of RmNet for Fuzzing Focus**

Alright, let's break this down. My understanding is that `rmnet` is a software-defined virtual network interface. It's designed to sit on top of any existing network interface like `veth` or `tun`, and it seems like the primary function is packet handling and virtual network manipulation, accessible through standard netlink commands, making it a prime candidate for fuzzing. Packets arrive on `real_dev`, triggering `rmnet_rx_handler`. This then calls functions that, from what I'm seeing, handle various aspects of parsing, coalescing, and managing these packets.

My initial thought is to confirm how syzkaller handles `rmnet` devices and whether it can create them using `RTM_NEWLINK` with `IFLA_INFO_KIND = "rmnet"`. The descriptions for `rtnetlink` and `IFLA_INFO_DATA` in syzkaller are promising. We're looking at a module with `WorthFuzzing=true`.

Now, it's about identifying the right focus for fuzzing. We need to avoid generic, frequently called functions. We want to pinpoint the *specific* feature logic and entrypoints. I've gone through the code changes and looked at what's been added or modified. The key here is to identify symbols that are accessible. I've paid careful attention to the static/non-static and inline/non-inline nature of the functions. The key functions are:

-   `rmnet_map_process_next_hdr_packet`
-   `rmnet_map_segment_coal_skb`
-   `rmnet_map_coal_segment_loop`
-   `__rmnet_map_segment_coal_skb`
-   `rmnet_map_coal_validate_bounds`
-   `rmnet_map_coal_parse_ip_hdr`
-   `rmnet_map_coal_parse_trans_hdr`
-   `rmnet_map_data_check_coal_header`
-   `rmnet_map_validate_packet_len`
-   `rmnet_newlink`
-   `rmnet_changelink`
-   `rmnet_vnd_update_dev_mtu`

These seem to be the core entry points and the meat of the packet processing and handling logic.

Next, we need to ensure the correct kernel configuration options are set.  The key configurations are `RMNET` and `NET_VENDOR_QUALCOMM`. These are the key dependencies.

A crucial aspect is that no specific hardware is needed. `rmnet` acts as a software protocol multiplexer. This means that we can interact with it through netlink, feed it packets, and analyze the response. The patch specifically deals with the downlink path, involving MAPv5 coalescing, NLO parsing, packet segmentation, GSO creation, checksum fixup, and boundary validation. This involves the parser and lots of packet-processing logic, handling untrusted input, and makes it highly susceptible to vulnerabilities, so this is an excellent target.

Therefore, for effective fuzzing, the following configuration should be set:

*   **WorthFuzzing**: true
*   **EnableConfigs**: \["RMNET", "NET\_VENDOR\_QUALCOMM"\]
*   **FocusSymbols**: \[
    *   "rmnet\_map\_process\_next\_hdr\_packet",
    *   "rmnet\_map\_segment\_coal\_skb",
    *   "rmnet\_map\_coal\_segment\_loop",
    *   "\_\_rmnet\_map\_segment\_coal\_skb",
    *   "rmnet\_map\_coal\_validate\_bounds",
    *   "rmnet\_map\_coal\_parse\_ip\_hdr",
    *   "rmnet\_map\_coal\_parse\_trans\_hdr",
    *   "rmnet\_map\_data\_check\_coal\_header",
    *   "rmnet\_map\_validate\_packet\_len",
    *   "rmnet\_newlink",
    *   "rmnet\_changelink",
    *   "rmnet\_vnd\_update\_dev\_mtu"
    \]

In short, `rmnet` presents a valuable target because it is accessible via netlink, implements complex packet processing, and has high potential for memory corruption vulnerabilities, all without needing any real hardware.



40/2 2026/10/09 10:46 tool set-results
0m Args:
{
  "EnableConfigs": [
    "RMNET",
    "NET_VENDOR_QUALCOMM"
  ],
  "FocusSymbols": [
    "rmnet_map_process_next_hdr_packet",
    "rmnet_map_segment_coal_skb",
    "rmnet_map_coal_segment_loop",
    "__rmnet_map_segment_coal_skb",
    "rmnet_map_coal_validate_bounds",
    "rmnet_map_coal_parse_ip_hdr",
    "rmnet_map_coal_parse_trans_hdr",
    "rmnet_map_data_check_coal_header",
    "rmnet_map_validate_packet_len",
    "rmnet_newlink",
    "rmnet_changelink",
    "rmnet_vnd_update_dev_mtu"
  ],
  "Reasoning": "The Qualcomm rmnet driver is a virtual network device driver accessible via rtnetlink (RTM_NEWLINK with kind 'rmnet') that attaches to any existing network device (such as virtual dummy, veth, or tun interfaces) without requiring physical hardware. This patch implements MAPv5 downlink hardware packet coalescing, introducing extensive packet parsing, bounds checking, NLO error handling, skb segmentation, and GSO metadata generation. Complex parsing and skb manipulation on the network ingress path is a prime candidate for fuzz testing.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": [
    "RMNET",
    "NET_VENDOR_QUALCOMM"
  ],
  "FocusSymbols": [
    "rmnet_map_process_next_hdr_packet",
    "rmnet_map_segment_coal_skb",
    "rmnet_map_coal_segment_loop",
    "__rmnet_map_segment_coal_skb",
    "rmnet_map_coal_validate_bounds",
    "rmnet_map_coal_parse_ip_hdr",
    "rmnet_map_coal_parse_trans_hdr",
    "rmnet_map_data_check_coal_header",
    "rmnet_map_validate_packet_len",
    "rmnet_newlink",
    "rmnet_changelink",
    "rmnet_vnd_update_dev_mtu"
  ],
  "Reasoning": "The Qualcomm rmnet driver is a virtual network device driver accessible via rtnetlink (RTM_NEWLINK with kind 'rmnet') that attaches to any existing network device (such as virtual dummy, veth, or tun interfaces) without requiring physical hardware. This patch implements MAPv5 downlink hardware packet coalescing, introducing extensive packet parsing, bounds checking, NLO error handling, skb segmentation, and GSO metadata generation. Complex parsing and skb manipulation on the network ingress path is a prime candidate for fuzz testing.",
  "WorthFuzzing": true
}

41/1 2026/10/09 10:46 action If
5m Args:
{
  "WorthFuzzing": true
}

Results:
null

42/2 2026/10/09 10:46 agent kmsan-evaluator
5m Model:
core

Args:
null

Results:
{
  "KMSANReasoning": "The patch implements downlink hardware coalescing (MAPv5 coalescing header) and related statistics accounting in Qualcomm's rmnet network driver.\n\n1. Analysis of potential uninitialized memory risks:\n- Ethtool statistics: `rmnet_get_ethtool_stats` allocates `snapshot` with `kzalloc_obj`, zero-initializes `total_stats = { }`, and copies `total_stats.ethtool_stats`. The `ethtool_stats` struct group is composed strictly of 64-bit integer fields (`u64`) with no padding holes, and all fields are explicitly accumulated. The count matches `rmnet_gstrings_stats`.\n- Per-CPU statistics: `priv-\u003epcpu_stats` is allocated via `alloc_percpu()` during device initialization, ensuring all fields are zero-initialized.\n- Network stack statistics: In `rmnet_get_stats64` and `rmnet_get_queue_stats_rx`, local stats snapshots are zero-initialized (`= { }`) and copy functions write only the intended fields into structures managed by the core networking subsystem.\n- Internal metadata \u0026 SKB construction: `struct rmnet_map_coal_metadata coal_meta` is explicitly zeroed with `memset` before parsing headers. In `__rmnet_map_segment_coal_skb`, new segment SKBs allocated via `alloc_skb` have their entire valid data range (`hlen + dlen`) populated by `skb_put_data` and header `memcpy` operations; no uninitialized buffer areas remain in the delivered SKBs.\n- Control flow and branching: All local variables (`data_format`, `nlo_err_mask`, `num_nlos`, `num_pkts`, `gro`, etc.) are either explicitly initialized or set prior to being evaluated in conditional branches.\n\n2. KASAN vs KMSAN applicability:\n- The risks introduced by this change involve network packet parsing, header bounds validation, and buffer offset calculations (e.g., in `rmnet_map_coal_validate_bounds`, `rmnet_map_segment_coal_skb`, and `rmnet_map_validate_packet_len`). Any potential logic flaws in length calculations or header offsets could cause out-of-bounds buffer reads or invalid SKB operations, which are detected by standard KASAN and standard kernel assertions.\n- KMSAN is not applicable because no uninitialized memory reads or information leaks to userspace are introduced. Therefore, running a dedicated KMSAN fuzzing session is not justified.",
  "NeedsKMSAN": false
}

Instruction:
You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.

CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
  a comprehensive suite of debugging tools and sanitizers, including KASAN
  (out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
  (locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
  or page allocations) and kernel-to-user memory info-leaks.

Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.

Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.

Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
   attributes, ioctl output arguments, socket options, or BPF buffers) where fields
   or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
   or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
   could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
   uninitialized bytes of existing buffers.

Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
  dereferences, locking deadlocks, or use-after-free bugs (these are already caught
  by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
  or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.

Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 0fee58b4fc90270ec5b3cc8520b6ab96b146031e
Author: syz-cluster <triage@syzkaller.com>
Date:   Fri Oct 9 10:43:23 2026 +0000

    syz-cluster: applied patch under review

diff --git a/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst b/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
index 5aedbabb73827..52f92d2fba311 100644
--- a/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
+++ b/Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
@@ -125,8 +125,8 @@ Command (1)/ Data (0) bit value is to indicate if the packet is a MAP command
 or data packet. Command packet is used for transport level flow control. Data
 packets are standard IP packets.
 
-Next header is used to indicate the presence of another header, currently is
-limited to checksum header.
+Next header is used to indicate the presence of another header, currently
+limited to the checksum and coalescing headers.
 
 Padding is the number of bytes to be appended to the payload to
 ensure 4 byte alignment.
@@ -150,11 +150,11 @@ Header Type is to indicate the type of header, this usually is set to CHECKSUM
 
 Header types
 
-= ===============
+= ======================
 0 Reserved
-1 Reserved
+1 coalescing header
 2 checksum header
-= ===============
+= ======================
 
 Checksum Valid is to indicate whether the header checksum is valid. Value of 1
 implies that checksum is calculated on this packet and is valid, value of 0
@@ -162,8 +162,109 @@ indicates that the calculated packet checksum is invalid.
 
 Reserved bits must be zero when sent and ignored when received.
 
-e. MAP packet v1/v5 (command specific)
---------------------------------------
+e. Coalescing header v5
+------------------------
+
+Hardware can coalesce multiple same-flow IP packets into a single MAP frame
+to reduce per-packet overhead at high data rates.  Packets are grouped into
+NLOs, with all packets in each NLO having the same length.  The coalescing
+header (header type 1) describes the coalesced content.
+
+Packet format::
+
+  Bit         0 - 6         7          8           9-11         12-15
+  Function  Header Type  Next Header  CSUM valid  Num NLOs    (reserved)
+
+  Bit        16-19        20-23
+  Function  Close value  Close type
+
+  Bit        24-27        28-31
+  Function  (reserved)    VEID
+
+  Bit           32 - 47        48 - 55            56 - 63
+  Function   Packet length  CSUM error bitmap  Num packets (NLO 0)
+
+  ... (up to 6 NLO entries total, same 32-bit format per entry)
+
+Header Type is set to 1 (coalescing).
+
+The MAP header ``pkt_len`` includes the coalescing header, coalesced packet
+data, and any MAP padding.
+
+Num NLOs (Number-Length Objects) is the count of active NLO entries
+(1 – 6).  Each NLO describes a group of consecutive coalesced packets
+that all share the same IP packet length.
+
+Num NLOs identifies the active prefix of the six NLO slots.  The header
+always contains all six slots and remains 28 bytes long regardless of Num
+NLOs.  A slot with ``num_packets == 0`` ends the active NLO prefix.  The
+full coalescing header is included in the MAP header's ``pkt_len``.
+
+Some hardware may report Num NLOs incorrectly.  For compatibility, receivers
+should derive the active prefix from ``num_packets`` when needed.  This
+requires unused slots to have ``num_packets == 0``.
+
+CSUM valid (bit 8) is a frame-level indication that the hardware checksum is
+valid for all packets in the frame. It is distinct from the per-packet CSUM
+error bitmap in each NLO entry.
+
+For a single-NLO, single-packet frame, CSUM valid must not be trusted when
+the close reason is a FIN/PSH close, a packet limit, a byte limit, or a time
+limit.  In these cases, the rmnet driver treats the packet checksum as
+unverified and lets the network stack validate it instead of relying on the
+coalescing checksum indications.
+IPv4 UDP packets with a zero checksum remain valid because that checksum is
+optional.
+
+Close type and close value encode the hardware reason that coalescing
+was terminated for this frame:
+
+Close type values:
+
+= ==============================
+0 non-coalesced (single packet)
+1 IP flow miss
+2 transport flow miss
+3 hardware limit (see value)
+4 coalescing closed (FIN/PSH)
+= ==============================
+
+Close value (used when close type is 3):
+
+= ==================
+0 NL limit reached
+1 packet limit
+2 byte limit
+3 time limit
+4 eviction
+= ==================
+
+VEID is the virtual endpoint ID of the originating flow.
+
+Each NLO entry::
+
+  Bit         0 - 15        16 - 23            24 - 31
+  Function  Pkt length   CSUM error bitmap   Num packets
+
+Pkt length is the full IP packet length, including the IP header, transport
+header, and payload, for every packet in this NLO group. The IP and transport
+headers are present once in the coalesced frame and are not repeated for each
+packet.
+
+CSUM error bitmap is one 48-bit stream formed by concatenating the
+``csum_error_bitmap`` bytes from all six NLO slots in slot order. Packet 0
+corresponds to bit 0 of slot 0's bitmap byte, and bits are consumed from
+least significant bit to most significant bit. The bit stream is indexed by
+the packet's absolute position in the frame and does not restart at an NLO
+boundary. If an NLO contains more than eight packets, its error bits
+continue into the bitmap byte of the following slot. Bitmap bytes in slots
+after the active NLO prefix may therefore contain continuation bits and must
+not be ignored.
+
+Num packets is the count of coalesced packets described by this NLO.
+
+f. MAP packet v1/v5 (command specific)
+---------------------------------------
 
 Packet format::
 
@@ -187,7 +288,7 @@ Command types
 3 is for error during processing of commands
 = ==========================================
 
-f. Aggregation
+g. Aggregation
 --------------
 
 Aggregation is multiple MAP packets (can be data or command) delivered to
@@ -208,3 +309,39 @@ rmnet userspace configuration is done through netlink using iproute2
 https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/
 
 The driver uses rtnl_link_ops for communication.
+
+The data format flags controlling the ingress and egress processing
+pipeline are set via the ``IFLA_RMNET_FLAGS`` attribute
+(``struct ifla_rmnet_flags``).
+
+Relevant ingress flags:
+
+``RMNET_FLAGS_INGRESS_DEAGGREGATION``
+  Enable MAP frame de-aggregation.
+
+``RMNET_FLAGS_INGRESS_MAP_CKSUMV4``
+  Enable MAPv4 downlink checksum offload.
+
+``RMNET_FLAGS_INGRESS_MAP_CKSUMV5``
+  Enable MAPv5 downlink checksum offload (header type 2).
+
+``RMNET_FLAGS_INGRESS_COALESCE``
+  Enable MAPv5 downlink hardware coalescing (header type 1).
+  This flag requires ``RMNET_FLAGS_INGRESS_MAP_CKSUMV5``. MAPv4 and
+  MAPv5 checksum flags cannot be enabled together in either direction.
+  A direction may leave checksum offload disabled. Invalid combinations
+  are rejected.
+  When RX checksum offload and ``rx-gro-hw`` are enabled, valid
+  multi-packet coalesced frames can be delivered as batched GSO SKBs.
+  Otherwise, multi-packet coalesced frames are rejected. A coalesced frame
+  containing one packet is delivered as a normal non-GSO skb. IP options,
+  IPv6 extension headers, and zero-payload packets can also prevent GSO
+  processing for a frame.
+
+Relevant egress flags:
+
+``RMNET_FLAGS_EGRESS_MAP_CKSUMV4``
+  Enable MAPv4 uplink checksum offload.
+
+``RMNET_FLAGS_EGRESS_MAP_CKSUMV5``
+  Enable MAPv5 uplink checksum offload.
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
index 61b04c6c0390e..ec882ad371ab7 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
@@ -26,6 +26,31 @@ static int rmnet_is_real_dev_registered(const struct net_device *real_dev)
 	return rcu_access_pointer(real_dev->rx_handler) == rmnet_rx_handler;
 }
 
+/* Only three MAP configurations are supported: MAPv1 (no checksum
+ * offload), MAPv4 (v4 checksum offload) and MAPv5 (v5 checksum
+ * offload). MAP command support is orthogonal and permitted with any
+ * of the three. Checksum offload versions are selected independently
+ * for ingress and egress, but only one version may be enabled across
+ * the device. Mixing v4 and v5 checksum flags is not supported. DL
+ * packet coalescing additionally requires a MAPv5 configuration.
+ */
+static bool rmnet_config_data_format_valid(u32 data_format)
+{
+	u32 v4_mask = RMNET_FLAGS_INGRESS_MAP_CKSUMV4 |
+		      RMNET_FLAGS_EGRESS_MAP_CKSUMV4;
+	u32 v5_mask = RMNET_FLAGS_INGRESS_MAP_CKSUMV5 |
+		      RMNET_FLAGS_EGRESS_MAP_CKSUMV5;
+
+	if ((data_format & v4_mask) && (data_format & v5_mask))
+		return false;
+
+	if ((data_format & RMNET_FLAGS_INGRESS_COALESCE) &&
+	    !(data_format & RMNET_FLAGS_INGRESS_MAP_CKSUMV5))
+		return false;
+
+	return true;
+}
+
 /* Needs rtnl lock */
 struct rmnet_port*
 rmnet_get_port_rtnl(const struct net_device *real_dev)
@@ -143,6 +168,20 @@ static int rmnet_newlink(struct net_device *dev,
 		return -ENODEV;
 	}
 
+	if (data[IFLA_RMNET_FLAGS]) {
+		struct ifla_rmnet_flags *flags;
+
+		flags = nla_data(data[IFLA_RMNET_FLAGS]);
+		data_format &= ~flags->mask;
+		data_format |= flags->flags & flags->mask;
+	}
+
+	if (!rmnet_config_data_format_valid(data_format)) {
+		NL_SET_ERR_MSG_MOD(extack,
+				   "unsupported MAP checksum flag combination");
+		return -EINVAL;
+	}
+
 	ep = kzalloc_obj(*ep);
 	if (!ep)
 		return -ENOMEM;
@@ -154,7 +193,8 @@ static int rmnet_newlink(struct net_device *dev,
 		goto err0;
 
 	port = rmnet_get_port_rtnl(real_dev);
-	err = rmnet_vnd_newlink(mux_id, dev, port, real_dev, ep, extack);
+	err = rmnet_vnd_newlink(mux_id, dev, port, real_dev, ep, extack,
+				data_format);
 	if (err)
 		goto err1;
 
@@ -162,24 +202,23 @@ static int rmnet_newlink(struct net_device *dev,
 	if (err < 0)
 		goto err2;
 
+	/* Update existing MTUs before publishing the shared data format. */
+	err = rmnet_vnd_update_dev_mtu(port, real_dev, data_format);
+	if (err)
+		goto err3;
+
 	port->rmnet_mode = mode;
 	port->rmnet_dev = dev;
 
 	hlist_add_head_rcu(&ep->hlnode, &port->muxed_ep[mux_id]);
 
-	if (data[IFLA_RMNET_FLAGS]) {
-		struct ifla_rmnet_flags *flags;
-
-		flags = nla_data(data[IFLA_RMNET_FLAGS]);
-		data_format &= ~flags->mask;
-		data_format |= flags->flags & flags->mask;
-	}
-
 	netdev_dbg(dev, "data format [0x%08X]\n", data_format);
 	WRITE_ONCE(port->data_format, data_format);
 
 	return 0;
 
+err3:
+	netdev_upper_dev_unlink(real_dev, dev);
 err2:
 	unregister_netdevice(dev);
 	rmnet_vnd_dellink(mux_id, port, ep);
@@ -301,9 +340,13 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
 			    struct netlink_ext_ack *extack)
 {
 	struct rmnet_priv *priv = netdev_priv(dev);
+	struct ifla_rmnet_flags *flags;
 	struct net_device *real_dev;
 	struct rmnet_port *port;
+	u32 old_data_format;
+	u32 data_format;
 	u16 mux_id;
+	int err;
 
 	if (!dev)
 		return -ENODEV;
@@ -320,6 +363,19 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
 
 	port = rmnet_get_port_rtnl(real_dev);
 
+	if (data[IFLA_RMNET_FLAGS]) {
+		old_data_format = READ_ONCE(port->data_format);
+		flags = nla_data(data[IFLA_RMNET_FLAGS]);
+		data_format = old_data_format & ~flags->mask;
+		data_format |= flags->flags & flags->mask;
+
+		if (!rmnet_config_data_format_valid(data_format)) {
+			NL_SET_ERR_MSG_MOD(extack,
+					   "unsupported MAP checksum flag combination");
+			return -EINVAL;
+		}
+	}
+
 	if (data[IFLA_RMNET_MUX_ID]) {
 		mux_id = nla_get_u16(data[IFLA_RMNET_MUX_ID]);
 
@@ -346,21 +402,13 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
 	}
 
 	if (data[IFLA_RMNET_FLAGS]) {
-		struct ifla_rmnet_flags *flags;
-		u32 old_data_format;
-		u32 data_format;
-
-		old_data_format = port->data_format;
-		flags = nla_data(data[IFLA_RMNET_FLAGS]);
-		data_format = old_data_format & ~flags->mask;
-		data_format |= flags->flags & flags->mask;
-		WRITE_ONCE(port->data_format, data_format);
-
-		if (rmnet_vnd_update_dev_mtu(port, real_dev)) {
-			WRITE_ONCE(port->data_format, old_data_format);
+		err = rmnet_vnd_update_dev_mtu(port, real_dev, data_format);
+		if (err) {
 			NL_SET_ERR_MSG_MOD(extack, "Invalid MTU on real dev");
-			return -EINVAL;
+			return err;
 		}
+
+		WRITE_ONCE(port->data_format, data_format);
 	}
 
 	return 0;
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h
index 5adda0323dda7..917d31f6eded7 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h
@@ -63,31 +63,105 @@ struct rmnet_vnd_stats {
 	u32 tx_drops;
 };
 
+struct rmnet_priv_stats {
+	/* Network stack RX statistics for all rmnet receive paths */
+	u64 rx_hw_gro_packets;
+	u64 rx_hw_gro_wire_packets;
+	u64 rx_alloc_fail;
+	u64 rx_dropped;
+
+	/* Custom diagnostics for the coalescing receive path */
+	struct_group(ethtool_stats, /* ethtool statistics */
+		u64 csum_ok;
+		u64 csum_ip4_header_bad;
+		u64 csum_valid_unset;
+		u64 csum_validation_failed;
+		u64 csum_err_bad_buffer;
+		u64 csum_err_invalid_ip_version;
+		u64 csum_err_invalid_transport;
+		u64 csum_fragmented_pkt;
+		u64 csum_skipped;
+		u64 csum_sw;
+		u64 csum_hw;
+		/* Coalescing-only counters. Some are subsets of the standard counters. */
+		u64 coal_alloc_fail;
+		u64 coal_rx;
+		u64 coal_pkts;
+		u64 coal_hdr_err;
+		u64 coal_hdr_pkt_err;
+		u64 coal_bounds_err;
+		u64 coal_csum_err;
+		u64 coal_csum_drop;
+		u64 coal_reconstruct;
+		u64 coal_ip_invalid;
+		u64 coal_trans_invalid;
+		/* close-reason sub-counters */
+		u64 coal_close_non_coal;
+		u64 coal_close_ip_miss;
+		u64 coal_close_trans_miss;
+		u64 coal_close_hw_nl;
+		u64 coal_close_hw_pkt;
+		u64 coal_close_hw_byte;
+		u64 coal_close_hw_time;
+		u64 coal_close_hw_evict;
+		u64 coal_close_coal;
+	);
+};
+
+struct rmnet_pcpu_priv_stats {
+	/* Network stack RX statistics for all rmnet receive paths */
+	u64_stats_t rx_hw_gro_packets;
+	u64_stats_t rx_hw_gro_wire_packets;
+	u64_stats_t rx_alloc_fail;
+	u64_stats_t rx_dropped;
+
+	/* Custom diagnostics for the coalescing receive path */
+	u64_stats_t csum_ok;
+	u64_stats_t csum_ip4_header_bad;
+	u64_stats_t csum_valid_unset;
+	u64_stats_t csum_validation_failed;
+	u64_stats_t csum_err_bad_buffer;
+	u64_stats_t csum_err_invalid_ip_version;
+	u64_stats_t csum_err_invalid_transport;
+	u64_stats_t csum_fragmented_pkt;
+	u64_stats_t csum_skipped;
+	u64_stats_t csum_sw;
+	u64_stats_t csum_hw;
+	/* Coalescing-only counters. Some are subsets of the standard counters. */
+	u64_stats_t coal_alloc_fail;
+	u64_stats_t coal_rx;
+	u64_stats_t coal_pkts;
+	u64_stats_t coal_hdr_err;
+	u64_stats_t coal_hdr_pkt_err;
+	u64_stats_t coal_bounds_err;
+	u64_stats_t coal_csum_err;
+	u64_stats_t coal_csum_drop;
+	u64_stats_t coal_reconstruct;
+	u64_stats_t coal_ip_invalid;
+	u64_stats_t coal_trans_invalid;
+	/* close-reason sub-counters */
+	u64_stats_t coal_close_non_coal;
+	u64_stats_t coal_close_ip_miss;
+	u64_stats_t coal_close_trans_miss;
+	u64_stats_t coal_close_hw_nl;
+	u64_stats_t coal_close_hw_pkt;
+	u64_stats_t coal_close_hw_byte;
+	u64_stats_t coal_close_hw_time;
+	u64_stats_t coal_close_hw_evict;
+	u64_stats_t coal_close_coal;
+};
+
 struct rmnet_pcpu_stats {
 	struct rmnet_vnd_stats stats;
+	struct rmnet_pcpu_priv_stats priv_stats;
 	struct u64_stats_sync syncp;
 };
 
-struct rmnet_priv_stats {
-	u64 csum_ok;
-	u64 csum_ip4_header_bad;
-	u64 csum_valid_unset;
-	u64 csum_validation_failed;
-	u64 csum_err_bad_buffer;
-	u64 csum_err_invalid_ip_version;
-	u64 csum_err_invalid_transport;
-	u64 csum_fragmented_pkt;
-	u64 csum_skipped;
-	u64 csum_sw;
-	u64 csum_hw;
-};
-
 struct rmnet_priv {
 	u8 mux_id;
 	struct net_device *real_dev;
 	struct rmnet_pcpu_stats __percpu *pcpu_stats;
 	struct gro_cells gro_cells;
-	struct rmnet_priv_stats stats;
 };
 
 struct rmnet_port *rmnet_get_port_rcu(const struct net_device *real_dev);
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
index aa5523f4618eb..bb867ceb01c1c 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
@@ -50,6 +50,16 @@ rmnet_deliver_skb(struct sk_buff *skb)
 	gro_cells_receive(&priv->gro_cells, skb);
 }
 
+static void rmnet_deliver_skb_list(struct sk_buff_head *head)
+{
+	struct sk_buff *skb;
+
+	while ((skb = __skb_dequeue(head))) {
+		rmnet_set_skb_proto(skb);
+		rmnet_deliver_skb(skb);
+	}
+}
+
 /* MAP handler */
 
 static void
@@ -59,6 +69,7 @@ __rmnet_map_ingress_handler(struct sk_buff *skb,
 {
 	struct rmnet_map_header *map_header = (void *)skb->data;
 	struct rmnet_endpoint *ep;
+	struct sk_buff_head list;
 	u16 len, pad;
 	u8 mux_id;
 
@@ -83,12 +94,13 @@ __rmnet_map_ingress_handler(struct sk_buff *skb,
 
 	skb->dev = ep->egress_dev;
 
-	if ((data_format & RMNET_FLAGS_INGRESS_MAP_CKSUMV5) &&
+	__skb_queue_head_init(&list);
+
+	if ((data_format &
+	     (RMNET_FLAGS_INGRESS_MAP_CKSUMV5 | RMNET_FLAGS_INGRESS_COALESCE)) &&
 	    (map_header->flags & MAP_NEXT_HEADER_FLAG)) {
-		if (rmnet_map_process_next_hdr_packet(skb, len))
+		if (rmnet_map_process_next_hdr_packet(skb, &list, len, data_format))
 			goto free_skb;
-		skb_pull(skb, sizeof(*map_header));
-		rmnet_set_skb_proto(skb);
 	} else {
 		/* Subtract MAP header */
 		skb_pull(skb, sizeof(*map_header));
@@ -96,10 +108,11 @@ __rmnet_map_ingress_handler(struct sk_buff *skb,
 		if (data_format & RMNET_FLAGS_INGRESS_MAP_CKSUMV4 &&
 		    !rmnet_map_checksum_downlink_packet(skb, len + pad))
 			skb->ip_summed = CHECKSUM_UNNECESSARY;
+		skb_trim(skb, len);
+		__skb_queue_tail(&list, skb);
 	}
 
-	skb_trim(skb, len);
-	rmnet_deliver_skb(skb);
+	rmnet_deliver_skb_list(&list);
 	return;
 
 free_skb:
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
index 0977e495f5915..77ddac6023c01 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h
@@ -6,6 +6,22 @@
 #define _RMNET_MAP_H_
 #include <linux/if_rmnet.h>
 
+enum rmnet_map_v5_close_type {
+	RMNET_MAP_COAL_CLOSE_NON_COAL,
+	RMNET_MAP_COAL_CLOSE_IP_MISS,
+	RMNET_MAP_COAL_CLOSE_TRANS_MISS,
+	RMNET_MAP_COAL_CLOSE_HW,
+	RMNET_MAP_COAL_CLOSE_COAL,
+};
+
+enum rmnet_map_v5_close_value {
+	RMNET_MAP_COAL_CLOSE_HW_NL,
+	RMNET_MAP_COAL_CLOSE_HW_PKT,
+	RMNET_MAP_COAL_CLOSE_HW_BYTE,
+	RMNET_MAP_COAL_CLOSE_HW_TIME,
+	RMNET_MAP_COAL_CLOSE_HW_EVICT,
+};
+
 struct rmnet_map_control_command {
 	u8  command_name;
 	u8  cmd_type:2;
@@ -53,7 +69,9 @@ void rmnet_map_checksum_uplink_packet(struct sk_buff *skb,
 				      struct rmnet_port *port,
 				      struct net_device *orig_dev,
 				      int csum_type);
-int rmnet_map_process_next_hdr_packet(struct sk_buff *skb, u16 len);
+int rmnet_map_process_next_hdr_packet(struct sk_buff *skb,
+				      struct sk_buff_head *list,
+				      u16 len, u32 data_format);
 unsigned int rmnet_map_tx_aggregate(struct sk_buff *skb, struct rmnet_port *port,
 				    struct net_device *orig_dev);
 void rmnet_map_tx_aggregate_init(struct rmnet_port *port);
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
index 39d6d084e73f0..74d64b7066e2b 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
@@ -7,7 +7,11 @@
 #include <linux/netdevice.h>
 #include <linux/ip.h>
 #include <linux/ipv6.h>
+#include <linux/tcp.h>
+#include <linux/udp.h>
+#include <net/ip.h>
 #include <net/ip6_checksum.h>
+#include <net/ipv6.h>
 #include <linux/bitfield.h>
 #include "rmnet_config.h"
 #include "rmnet_map.h"
@@ -17,6 +21,19 @@
 #define RMNET_MAP_DEAGGR_SPACING  64
 #define RMNET_MAP_DEAGGR_HEADROOM (RMNET_MAP_DEAGGR_SPACING / 2)
 
+struct rmnet_map_coal_metadata {
+	void *ip_header;
+	void *trans_header;
+	u16 ip_len;
+	u16 trans_len;
+	u16 data_offset;
+	u16 data_len;
+	u8 ip_proto;
+	u8 trans_proto;
+	u8 pkt_count;
+	bool zero_csum;
+};
+
 static __sum16 *rmnet_map_get_csum_field(unsigned char protocol,
 					 const void *txporthdr)
 {
@@ -36,34 +53,45 @@ rmnet_map_ipv4_dl_csum_trailer(struct sk_buff *skb,
 {
 	struct iphdr *ip4h = (struct iphdr *)skb->data;
 	void *txporthdr = skb->data + ip4h->ihl * 4;
+	struct rmnet_pcpu_stats *pcpu_ptr;
 	__sum16 *csum_field, pseudo_csum;
 	__sum16 ip_payload_csum;
 
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
 	/* Computing the checksum over just the IPv4 header--including its
 	 * checksum field--should yield 0.  If it doesn't, the IP header
 	 * is bad, so return an error and let the IP layer drop it.
 	 */
 	if (ip_fast_csum(ip4h, ip4h->ihl)) {
-		priv->stats.csum_ip4_header_bad++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_ip4_header_bad);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EINVAL;
 	}
 
 	/* We don't support checksum offload on IPv4 fragments */
 	if (ip_is_fragment(ip4h)) {
-		priv->stats.csum_fragmented_pkt++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_fragmented_pkt);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EOPNOTSUPP;
 	}
 
 	/* Checksum offload is only supported for UDP and TCP protocols */
 	csum_field = rmnet_map_get_csum_field(ip4h->protocol, txporthdr);
 	if (!csum_field) {
-		priv->stats.csum_err_invalid_transport++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_err_invalid_transport);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EPROTONOSUPPORT;
 	}
 
 	/* RFC 768: UDP checksum is optional for IPv4, and is 0 if unused */
 	if (!*csum_field && ip4h->protocol == IPPROTO_UDP) {
-		priv->stats.csum_skipped++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_skipped);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return 0;
 	}
 
@@ -96,11 +124,15 @@ rmnet_map_ipv4_dl_csum_trailer(struct sk_buff *skb,
 
 	/* The cast is required to ensure only the low 16 bits are examined */
 	if (ip_payload_csum != (__sum16)~pseudo_csum) {
-		priv->stats.csum_validation_failed++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_validation_failed);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EINVAL;
 	}
 
-	priv->stats.csum_ok++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_ok);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 	return 0;
 }
 
@@ -112,16 +144,21 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb,
 {
 	struct ipv6hdr *ip6h = (struct ipv6hdr *)skb->data;
 	void *txporthdr = skb->data + sizeof(*ip6h);
+	struct rmnet_pcpu_stats *pcpu_ptr;
 	__sum16 *csum_field, pseudo_csum;
 	__sum16 ip6_payload_csum;
 	__be16 ip_header_csum;
 
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
 	/* Checksum offload is only supported for UDP and TCP protocols;
 	 * the packet cannot include any IPv6 extension headers
 	 */
 	csum_field = rmnet_map_get_csum_field(ip6h->nexthdr, txporthdr);
 	if (!csum_field) {
-		priv->stats.csum_err_invalid_transport++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_err_invalid_transport);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EPROTONOSUPPORT;
 	}
 
@@ -147,11 +184,15 @@ rmnet_map_ipv6_dl_csum_trailer(struct sk_buff *skb,
 	 * examined.
 	 */
 	if (ip6_payload_csum != (__sum16)~pseudo_csum) {
-		priv->stats.csum_validation_failed++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_validation_failed);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EINVAL;
 	}
 
-	priv->stats.csum_ok++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_ok);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 	return 0;
 }
 #else
@@ -246,6 +287,9 @@ static void rmnet_map_v5_checksum_uplink_packet(struct sk_buff *skb,
 {
 	struct rmnet_priv *priv = netdev_priv(orig_dev);
 	struct rmnet_map_v5_csum_header *ul_header;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
 
 	ul_header = skb_push(skb, sizeof(*ul_header));
 	memset(ul_header, 0, sizeof(*ul_header));
@@ -270,7 +314,9 @@ static void rmnet_map_v5_checksum_uplink_packet(struct sk_buff *skb,
 			proto = ((struct ipv6hdr *)iph)->nexthdr;
 			trans = iph + ip_len;
 		} else {
-			priv->stats.csum_err_invalid_ip_version++;
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.csum_err_invalid_ip_version);
+			u64_stats_update_end(&pcpu_ptr->syncp);
 			goto sw_csum;
 		}
 
@@ -279,13 +325,17 @@ static void rmnet_map_v5_checksum_uplink_packet(struct sk_buff *skb,
 			skb->ip_summed = CHECKSUM_NONE;
 			/* Ask for checksum offloading */
 			ul_header->csum_info |= MAPV5_CSUMINFO_VALID_FLAG;
-			priv->stats.csum_hw++;
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.csum_hw);
+			u64_stats_update_end(&pcpu_ptr->syncp);
 			return;
 		}
 	}
 
 sw_csum:
-	priv->stats.csum_sw++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_sw);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 }
 
 /* Adds MAP header to front of skb->data
@@ -337,8 +387,8 @@ u32 rmnet_map_validate_packet_len(struct sk_buff *skb, u32 data_format)
 {
 	struct rmnet_map_v5_csum_header *next_hdr = NULL;
 	struct rmnet_map_header *maph;
-	void *data = skb->data;
 	u32 packet_len;
+	u8 hdr_type;
 
 	if (skb->len < sizeof(*maph))
 		return 0;
@@ -353,24 +403,28 @@ u32 rmnet_map_validate_packet_len(struct sk_buff *skb, u32 data_format)
 
 	if (data_format & RMNET_FLAGS_INGRESS_MAP_CKSUMV4) {
 		packet_len += sizeof(struct rmnet_map_dl_csum_trailer);
-	} else if ((data_format & RMNET_FLAGS_INGRESS_MAP_CKSUMV5) &&
+	} else if ((data_format &
+		    (RMNET_FLAGS_INGRESS_MAP_CKSUMV5 | RMNET_FLAGS_INGRESS_COALESCE)) &&
 		   !(maph->flags & MAP_CMD_FLAG)) {
-		/* Mapv5 data pkt without csum hdr is invalid */
 		if (!(maph->flags & MAP_NEXT_HEADER_FLAG))
 			return 0;
 
-		packet_len += sizeof(*next_hdr);
-		next_hdr = data + sizeof(*maph);
+		if (skb->len < sizeof(*maph) + sizeof(*next_hdr))
+			return 0;
+
+		next_hdr = (struct rmnet_map_v5_csum_header *)(skb->data + sizeof(*maph));
+		hdr_type = u8_get_bits(next_hdr->header_info,
+				       MAPV5_HDRINFO_HDR_TYPE_FMASK);
+
+		if (hdr_type == RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD)
+			packet_len += sizeof(*next_hdr);
+		else if (hdr_type != RMNET_MAP_HEADER_TYPE_COALESCING)
+			return 0;
 	}
 
 	if (skb->len < packet_len)
 		return 0;
 
-	if (next_hdr &&
-	    u8_get_bits(next_hdr->header_info, MAPV5_HDRINFO_HDR_TYPE_FMASK) !=
-	    RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD)
-		return 0;
-
 	return packet_len;
 }
 
@@ -413,16 +467,23 @@ int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len)
 {
 	struct rmnet_priv *priv = netdev_priv(skb->dev);
 	struct rmnet_map_dl_csum_trailer *csum_trailer;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
 
 	if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) {
-		priv->stats.csum_sw++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_sw);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EOPNOTSUPP;
 	}
 
 	csum_trailer = (struct rmnet_map_dl_csum_trailer *)(skb->data + len);
 
 	if (!(csum_trailer->flags & MAP_CSUM_DL_VALID_FLAG)) {
-		priv->stats.csum_valid_unset++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_valid_unset);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return -EINVAL;
 	}
 
@@ -432,7 +493,9 @@ int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len)
 	if (IS_ENABLED(CONFIG_IPV6) && skb->protocol == htons(ETH_P_IPV6))
 		return rmnet_map_ipv6_dl_csum_trailer(skb, csum_trailer, priv);
 
-	priv->stats.csum_err_invalid_ip_version++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_err_invalid_ip_version);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 
 	return -EPROTONOSUPPORT;
 }
@@ -442,8 +505,11 @@ static void rmnet_map_v4_checksum_uplink_packet(struct sk_buff *skb,
 {
 	struct rmnet_priv *priv = netdev_priv(orig_dev);
 	struct rmnet_map_ul_csum_header *ul_header;
+	struct rmnet_pcpu_stats *pcpu_ptr;
 	void *iphdr;
 
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
 	ul_header = (struct rmnet_map_ul_csum_header *)
 		    skb_push(skb, sizeof(struct rmnet_map_ul_csum_header));
 
@@ -459,22 +525,30 @@ static void rmnet_map_v4_checksum_uplink_packet(struct sk_buff *skb,
 
 	if (skb->protocol == htons(ETH_P_IP)) {
 		rmnet_map_ipv4_ul_csum_header(iphdr, ul_header, skb);
-		priv->stats.csum_hw++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_hw);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return;
 	}
 
 	if (IS_ENABLED(CONFIG_IPV6) && skb->protocol == htons(ETH_P_IPV6)) {
 		rmnet_map_ipv6_ul_csum_header(iphdr, ul_header, skb);
-		priv->stats.csum_hw++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.csum_hw);
+		u64_stats_update_end(&pcpu_ptr->syncp);
 		return;
 	}
 
-	priv->stats.csum_err_invalid_ip_version++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_err_invalid_ip_version);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 
 sw_csum:
 	memset(ul_header, 0, sizeof(*ul_header));
 
-	priv->stats.csum_sw++;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.csum_sw);
+	u64_stats_update_end(&pcpu_ptr->syncp);
 }
 
 /* Generates UL checksum meta info header for IPv4 and IPv6 over TCP and UDP
@@ -497,34 +571,847 @@ void rmnet_map_checksum_uplink_packet(struct sk_buff *skb,
 	}
 }
 
-/* Process a MAPv5 packet header */
-int rmnet_map_process_next_hdr_packet(struct sk_buff *skb,
-				      u16 len)
+static struct rmnet_map_v5_csum_header *
+rmnet_map_get_next_hdr(struct sk_buff *skb)
 {
-	struct rmnet_priv *priv = netdev_priv(skb->dev);
-	struct rmnet_map_v5_csum_header *next_hdr;
-	u8 nexthdr_type;
+	return (struct rmnet_map_v5_csum_header *)(skb->data +
+						   sizeof(struct rmnet_map_header));
+}
+
+static u8 rmnet_map_get_next_hdr_type(struct sk_buff *skb)
+{
+	struct rmnet_map_v5_csum_header *hdr = rmnet_map_get_next_hdr(skb);
+
+	return u8_get_bits(hdr->header_info, MAPV5_HDRINFO_HDR_TYPE_FMASK);
+}
+
+static bool rmnet_map_get_csum_valid(struct sk_buff *skb)
+{
+	struct rmnet_map_v5_csum_header *hdr = rmnet_map_get_next_hdr(skb);
 
-	next_hdr = (struct rmnet_map_v5_csum_header *)(skb->data +
-			sizeof(struct rmnet_map_header));
+	return !!(hdr->csum_info & MAPV5_CSUMINFO_VALID_FLAG);
+}
+
+/* Stamp GSO metadata so the network stack can segment a coalesced SKB. */
+static void rmnet_map_gso_stamp(struct sk_buff *skb,
+				struct rmnet_map_coal_metadata *coal_meta)
+{
+	struct skb_shared_info *shinfo = skb_shinfo(skb);
 
-	nexthdr_type = u8_get_bits(next_hdr->header_info,
-				   MAPV5_HDRINFO_HDR_TYPE_FMASK);
+	if (coal_meta->trans_proto == IPPROTO_TCP)
+		shinfo->gso_type = (coal_meta->ip_proto == 4) ?
+				   SKB_GSO_TCPV4 : SKB_GSO_TCPV6;
+	else
+		shinfo->gso_type = SKB_GSO_UDP_L4;
 
-	if (nexthdr_type != RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD)
+	shinfo->gso_size = coal_meta->data_len;
+	shinfo->gso_segs = coal_meta->pkt_count;
+}
+
+/* Set the transport checksum to the pseudo-header checksum and request
+ * partial checksum offload, letting the NIC or stack finish it.
+ */
+static void rmnet_map_partial_csum(struct sk_buff *skb,
+				   struct rmnet_map_coal_metadata *coal_meta)
+{
+	u16 pkt_len = skb->len - coal_meta->ip_len;
+	unsigned char *data = skb->data;
+	__sum16 pseudo;
+
+	if (coal_meta->ip_proto == 4) {
+		struct iphdr *iph = (struct iphdr *)data;
+
+		pseudo = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
+					    pkt_len, coal_meta->trans_proto, 0);
+	} else {
+		struct ipv6hdr *ip6h = (struct ipv6hdr *)data;
+
+		pseudo = ~csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
+					  pkt_len, coal_meta->trans_proto, 0);
+	}
+
+	if (coal_meta->trans_proto == IPPROTO_TCP) {
+		struct tcphdr *tp = (struct tcphdr *)(data + coal_meta->ip_len);
+
+		tp->check = pseudo;
+		skb->csum_offset = offsetof(struct tcphdr, check);
+	} else {
+		struct udphdr *up = (struct udphdr *)(data + coal_meta->ip_len);
+
+		up->check = pseudo;
+		skb->csum_offset = offsetof(struct udphdr, check);
+	}
+
+	skb->ip_summed = CHECKSUM_PARTIAL;
+	skb->csum_start = skb->data + coal_meta->ip_len - skb->head;
+}
+
+/* On some hardware, num_nlos in the coalescing header can be reported
+ * incorrectly under certain conditions even though the per-NLO num_packets
+ * fields it is meant to summarize are correct. Recompute the NLO count from
+ * the contiguous nl_pairs[] prefix rather than trusting the declared value.
+ * The first empty NLO marks the end of the prefix. Entries after it are not
+ * processed.
+ */
+static int rmnet_map_v5_get_num_nlos(const struct rmnet_map_v5_coal_header *coal_hdr)
+{
+	int nlos;
+
+	for (nlos = 0; nlos < RMNET_MAP_V5_MAX_NLOS; nlos++)
+		if (!coal_hdr->nl_pairs[nlos].num_packets)
+			break;
+
+	if (!nlos)
 		return -EINVAL;
 
-	if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) {
-		priv->stats.csum_sw++;
-	} else if (next_hdr->csum_info & MAPV5_CSUMINFO_VALID_FLAG) {
-		priv->stats.csum_ok++;
-		skb->ip_summed = CHECKSUM_UNNECESSARY;
+	return nlos;
+}
+
+static void rmnet_map_v5_set_nlos(struct rmnet_map_v5_coal_header *coal_hdr,
+				  u8 nlos)
+{
+	coal_hdr->coal_info = u8_encode_bits(nlos, MAPV5_COALINFO_NUM_NLOS_FMASK) |
+				      (coal_hdr->coal_info & MAPV5_COALINFO_CSUM_VALID_FLAG);
+}
+
+/* The frame-level CSUM_VALID indication for a single NLO, single packet
+ * coalescing frame cannot be trusted when the close reason is a TCP FIN/PSH,
+ * a packet count limit, a byte count limit or a time limit.
+ */
+static bool rmnet_map_v5_csum_fixup(struct rmnet_map_v5_coal_header *coal_hdr)
+{
+	u8 close_value = u8_get_bits(coal_hdr->close_info,
+				     MAPV5_CLOSEINFO_CLOSE_VALUE_FMASK);
+	u8 close_type = u8_get_bits(coal_hdr->close_info,
+				    MAPV5_CLOSEINFO_CLOSE_TYPE_FMASK);
+	u8 num_nlos = u8_get_bits(coal_hdr->coal_info,
+				  MAPV5_COALINFO_NUM_NLOS_FMASK);
+
+	/* Only applies to single NLO, single packet frames */
+	if (num_nlos != 1 || coal_hdr->nl_pairs[0].num_packets != 1)
+		return false;
+
+	/* TCP FIN or PSH triggered the close */
+	if (close_type == RMNET_MAP_COAL_CLOSE_COAL)
+		return true;
+
+	/* Hit a hardware limit */
+	if (close_type == RMNET_MAP_COAL_CLOSE_HW) {
+		switch (close_value) {
+		case RMNET_MAP_COAL_CLOSE_HW_PKT:
+		case RMNET_MAP_COAL_CLOSE_HW_BYTE:
+		case RMNET_MAP_COAL_CLOSE_HW_TIME:
+			return true;
+		}
+	}
+
+	return false;
+}
+
+/* Carve one logical segment from a coalesced SKB and append it to the list.
+ * Adjusts TCP sequence numbers, IP IDs/lengths, and checksum state.
+ */
+static void
+__rmnet_map_segment_coal_skb(struct sk_buff *coal_skb,
+			     struct rmnet_map_coal_metadata *coal_meta,
+			     struct sk_buff_head *list, u8 pkt_id,
+			     bool csum_valid)
+{
+	u32 dlen = coal_meta->data_len * coal_meta->pkt_count;
+	struct rmnet_priv *priv = netdev_priv(coal_skb->dev);
+	u32 hlen = coal_meta->ip_len + coal_meta->trans_len;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	struct sk_buff *skbn;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	/* RFC 768: UDP checksum is optional for IPv4, and is 0 if unused.
+	 * Such packets are never actually bad, regardless of what the
+	 * checksum bitmap says.
+	 */
+	if (!csum_valid && coal_meta->zero_csum)
+		csum_valid = true;
+
+	if (!csum_valid) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		/* rx_dropped is standard accounting. coal_csum_drop is its
+		 * coalescing-specific checksum error subset.
+		 */
+		u64_stats_add(&pcpu_ptr->priv_stats.rx_dropped, coal_meta->pkt_count);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_csum_drop);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		goto next_pkt;
+	}
+
+	skbn = alloc_skb(hlen + dlen + RMNET_MAP_DEAGGR_HEADROOM, GFP_ATOMIC);
+	if (!skbn) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		/* The coal counter is the coalescing subset of the standard
+		 * allocation failure and RX drop counters.
+		 */
+		u64_stats_add(&pcpu_ptr->priv_stats.rx_alloc_fail, coal_meta->pkt_count);
+		u64_stats_add(&pcpu_ptr->priv_stats.rx_dropped, coal_meta->pkt_count);
+		u64_stats_add(&pcpu_ptr->priv_stats.coal_alloc_fail, coal_meta->pkt_count);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		goto next_pkt;
+	}
+
+	skb_reserve(skbn, hlen + RMNET_MAP_DEAGGR_HEADROOM);
+	skb_put_data(skbn,
+		     coal_skb->data + coal_meta->ip_len + coal_meta->trans_len +
+		     coal_meta->data_offset,
+		     dlen);
+
+	/* Restore transport header */
+	skb_push(skbn, coal_meta->trans_len);
+	memcpy(skbn->data, coal_meta->trans_header, coal_meta->trans_len);
+	skb_reset_transport_header(skbn);
+
+	if (coal_meta->trans_proto == IPPROTO_TCP) {
+		struct tcphdr *th = tcp_hdr(skbn);
+
+		th->seq = htonl(ntohl(th->seq) + coal_meta->data_offset);
+		/* Strip dangerous flags from non-final segments */
+		if ((th->fin || th->psh) &&
+		    hlen + coal_meta->data_offset + dlen < coal_skb->len) {
+			th->fin = 0;
+			th->psh = 0;
+		}
+	} else if (coal_meta->trans_proto == IPPROTO_UDP) {
+		struct udphdr *uh = udp_hdr(skbn);
+
+		uh->len = htons(skbn->len);
+	}
+
+	/* Restore IP header */
+	skb_push(skbn, coal_meta->ip_len);
+	memcpy(skbn->data, coal_meta->ip_header, coal_meta->ip_len);
+	skb_reset_network_header(skbn);
+
+	if (coal_meta->ip_proto == 4) {
+		struct iphdr *iph = ip_hdr(skbn);
+
+		iph->id = htons(ntohs(iph->id) + pkt_id);
+		iph->tot_len = htons(skbn->len);
+		iph->check = 0;
+		iph->check = ip_fast_csum(iph, iph->ihl);
+	} else {
+		ipv6_hdr(skbn)->payload_len =
+			htons(skbn->len - sizeof(struct ipv6hdr));
+	}
+
+	rmnet_map_partial_csum(skbn, coal_meta);
+
+	skbn->dev = coal_skb->dev;
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_inc(&pcpu_ptr->priv_stats.coal_reconstruct);
+	u64_stats_update_end(&pcpu_ptr->syncp);
+
+	if (coal_meta->pkt_count > 1)
+		rmnet_map_gso_stamp(skbn, coal_meta);
+
+	__skb_queue_tail(list, skbn);
+
+next_pkt:
+	coal_meta->data_offset += dlen;
+	coal_meta->pkt_count = 0;
+}
+
+/* Parse the IP header of the coalesced frame and perform basic
+ * validation of header fields.
+ */
+static bool rmnet_map_coal_parse_ip_hdr(struct sk_buff *coal_skb,
+					struct rmnet_map_coal_metadata *meta,
+					bool *gro)
+{
+	struct rmnet_priv *priv = netdev_priv(coal_skb->dev);
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	struct ipv6hdr *ip6h;
+	struct iphdr *iph;
+	__be16 frag_off;
+	u8 protocol;
+	int ret;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	if (coal_skb->len < sizeof(*iph)) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return false;
+	}
+
+	iph = (struct iphdr *)coal_skb->data;
+
+	if (iph->version == 4) {
+		meta->ip_proto = 4;
+		meta->ip_len = iph->ihl * 4;
+		meta->trans_proto = iph->protocol;
+		meta->ip_header = iph;
+		if (meta->ip_len < sizeof(*iph) || coal_skb->len < meta->ip_len) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		if (ip_is_fragment(iph)) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		if (iph->ihl != 5)
+			*gro = false;
+	} else if (iph->version == 6) {
+		if (coal_skb->len < sizeof(*ip6h)) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		ip6h = (struct ipv6hdr *)iph;
+		protocol = ip6h->nexthdr;
+		meta->ip_proto = 6;
+		ret = ipv6_skip_exthdr(coal_skb, sizeof(*ip6h), &protocol,
+				       &frag_off);
+		if (ret < 0 || frag_off || ret > U16_MAX) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		meta->ip_len = (u16)ret;
+		meta->trans_proto = protocol;
+		meta->ip_header = ip6h;
+		if (coal_skb->len < meta->ip_len) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		if (meta->ip_len > sizeof(*ip6h))
+			*gro = false;
+	} else {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_ip_invalid);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return false;
+	}
+
+	return true;
+}
+
+/* Parse the transport header following the IP header into coal_meta. The
+ * available length is checked before any field is read.
+ */
+static bool rmnet_map_coal_parse_trans_hdr(struct sk_buff *coal_skb,
+					   struct rmnet_map_coal_metadata *meta)
+{
+	struct rmnet_priv *priv = netdev_priv(coal_skb->dev);
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	struct udphdr *uh;
+	struct tcphdr *th;
+	u32 avail;
+	u8 *base;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	if (meta->ip_len > coal_skb->len) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_trans_invalid);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return false;
+	}
+
+	base = (u8 *)meta->ip_header + meta->ip_len;
+	avail = coal_skb->len - meta->ip_len;
+
+	if (meta->trans_proto == IPPROTO_TCP) {
+		if (avail < sizeof(*th)) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_trans_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		th = (struct tcphdr *)base;
+		meta->trans_len = th->doff * 4;
+		meta->trans_header = th;
+		if (meta->trans_len < sizeof(*th) || avail < meta->trans_len) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_trans_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+	} else if (meta->trans_proto == IPPROTO_UDP) {
+		if (avail < sizeof(*uh)) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_trans_invalid);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			return false;
+		}
+
+		uh = (struct udphdr *)base;
+		meta->trans_len = sizeof(*uh);
+		meta->trans_header = uh;
+		if (meta->ip_proto == 4 && !uh->check)
+			meta->zero_csum = true;
 	} else {
-		priv->stats.csum_valid_unset++;
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_trans_invalid);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return false;
+	}
+
+	return true;
+}
+
+/* Reject the frame unless the total data bytes claimed by all NLOs
+ * exactly match the actual payload in the SKB. Each pkt_len covers
+ * IP+transport headers plus per-packet data. Headers appear once, so
+ * subtract hlen per packet and track the running sum against available
+ * data. An exact match is required, not just an upper bound, so that
+ * GSO metadata stamped from the NLOs stays consistent with the real
+ * SKB length.
+ */
+static bool rmnet_map_coal_validate_bounds(struct sk_buff *coal_skb,
+					   struct rmnet_map_v5_coal_header *coal_hdr,
+					   u8 num_nlos, u32 hlen, bool *gro)
+{
+	u32 total_data = 0;
+	u32 nlo_len;
+	u16 plen;
+	u8 i;
+
+	if (hlen > coal_skb->len)
+		return false;
+
+	for (i = 0; i < num_nlos; i++) {
+		plen = ntohs(coal_hdr->nl_pairs[i].pkt_len);
+
+		if (plen < hlen)
+			return false;
+
+		/* Zero-payload packets cannot use GSO with a zero gso_size. */
+		if (plen == hlen)
+			*gro = false;
+
+		nlo_len = (u32)(plen - hlen) * coal_hdr->nl_pairs[i].num_packets;
+		if (nlo_len > coal_skb->len - hlen - total_data)
+			return false;
+
+		total_data += nlo_len;
+	}
+
+	return total_data == coal_skb->len - hlen;
+}
+
+/* Attempt the GRO-friendly fast path for a single-NLO, checksum-valid frame
+ * by reusing the original SKB and stamping GSO metadata instead of copying
+ * out each segment.  Returns true if the frame was consumed via the fast
+ * path, or false if the caller should fall back to full segmentation.
+ */
+static bool rmnet_map_coal_gro_fast_path(struct sk_buff *coal_skb,
+					 struct rmnet_map_v5_coal_header *coal_hdr,
+					 struct rmnet_map_coal_metadata *coal_meta,
+					 struct sk_buff_head *list,
+					 u8 num_nlos, bool gro)
+{
+	u32 hlen = coal_meta->ip_len + coal_meta->trans_len;
+
+	if (!gro || num_nlos != 1 ||
+	    !(coal_hdr->coal_info & MAPV5_COALINFO_CSUM_VALID_FLAG))
+		return false;
+
+	coal_meta->data_len = ntohs(coal_hdr->nl_pairs[0].pkt_len) - hlen;
+	coal_meta->pkt_count = coal_hdr->nl_pairs[0].num_packets;
+
+	coal_skb->ip_summed = CHECKSUM_UNNECESSARY;
+	if (coal_meta->pkt_count > 1) {
+		rmnet_map_partial_csum(coal_skb, coal_meta);
+		rmnet_map_gso_stamp(coal_skb, coal_meta);
+	}
+
+	__skb_queue_tail(list, coal_skb);
+	return true;
+}
+
+/* NLO packet lengths are already bounds-checked by
+ * rmnet_map_coal_validate_bounds() so no further validation is needed here.
+ */
+static void rmnet_map_coal_segment_loop(struct sk_buff *coal_skb,
+					struct rmnet_map_v5_coal_header *coal_hdr,
+					struct rmnet_map_coal_metadata *coal_meta,
+					struct sk_buff_head *list,
+					u64 nlo_err_mask, bool gro, u8 num_nlos)
+{
+	struct rmnet_priv *priv = netdev_priv(coal_skb->dev);
+	u32 hlen = coal_meta->ip_len + coal_meta->trans_len;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	u8 pkt, total_pkt = 0;
+	bool csum_err;
+	u16 pkt_len;
+	u8 nlo;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	for (nlo = 0; nlo < num_nlos; nlo++) {
+		pkt_len = ntohs(coal_hdr->nl_pairs[nlo].pkt_len);
+		pkt_len -= hlen;
+		coal_meta->data_len = pkt_len;
+
+		/* nlo_err_mask is one flat bitstream across all NLOs. Shift
+		 * it once per packet in absolute frame order and do not
+		 * re-align at the NLO boundary above. See the comment on
+		 * rmnet_map_data_check_coal_header() for why.
+		 */
+		for (pkt = 0; pkt < coal_hdr->nl_pairs[nlo].num_packets;
+		     pkt++, total_pkt++, nlo_err_mask >>= 1) {
+			csum_err = nlo_err_mask & 1;
+
+			if (csum_err) {
+				u64_stats_update_begin(&pcpu_ptr->syncp);
+				u64_stats_inc(&pcpu_ptr->priv_stats.coal_csum_err);
+				u64_stats_update_end(&pcpu_ptr->syncp);
+			}
+
+			if (!gro) {
+				coal_meta->pkt_count = 1;
+				__rmnet_map_segment_coal_skb(coal_skb, coal_meta,
+							     list, total_pkt,
+							     !csum_err);
+				continue;
+			}
+
+			if (csum_err) {
+				if (coal_meta->pkt_count)
+					__rmnet_map_segment_coal_skb(coal_skb,
+								     coal_meta,
+								     list,
+								     total_pkt -
+								     coal_meta->pkt_count,
+								     true);
+				coal_meta->pkt_count = 1;
+				__rmnet_map_segment_coal_skb(coal_skb, coal_meta,
+							     list, total_pkt,
+							     false);
+			} else {
+				coal_meta->pkt_count++;
+			}
+		}
+
+		/* Flush remaining packets from this NLO */
+		if (coal_meta->pkt_count)
+			__rmnet_map_segment_coal_skb(coal_skb, coal_meta, list,
+						     total_pkt - coal_meta->pkt_count, true);
+	}
+}
+
+/* Expand a coalesced SKB into individual IP packets placed on the list.
+ * NLOs with checksum errors are dropped. __rmnet_map_ingress_handler will
+ * free the SKB in the error case.
+ */
+static int rmnet_map_segment_coal_skb(struct sk_buff *coal_skb,
+				      u64 nlo_err_mask,
+				      struct sk_buff_head *list,
+				      u16 len, u16 total_pkts, u8 num_nlos)
+{
+	bool gro_hw = coal_skb->dev->features & NETIF_F_GRO_HW;
+	bool rxcsum = coal_skb->dev->features & NETIF_F_RXCSUM;
+	struct rmnet_priv *priv = netdev_priv(coal_skb->dev);
+	struct rmnet_map_v5_coal_header *coal_hdr;
+	struct rmnet_map_coal_metadata coal_meta;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	bool gro = gro_hw;
+	u32 hlen;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	memset(&coal_meta, 0, sizeof(coal_meta));
+
+	/* Drop any MAP frame padding. The coal header is counted in len */
+	skb_pull(coal_skb, sizeof(struct rmnet_map_header));
+	skb_trim(coal_skb, len);
+	coal_hdr = (struct rmnet_map_v5_coal_header *)coal_skb->data;
+	rmnet_map_v5_set_nlos(coal_hdr, num_nlos);
+	skb_pull(coal_skb, sizeof(*coal_hdr));
+
+	if (!rmnet_map_coal_parse_ip_hdr(coal_skb, &coal_meta, &gro))
+		return -EINVAL;
+
+	if (!rmnet_map_coal_parse_trans_hdr(coal_skb, &coal_meta))
+		return -EINVAL;
+
+	hlen = coal_meta.ip_len + coal_meta.trans_len;
+
+	if (!rmnet_map_coal_validate_bounds(coal_skb, coal_hdr, num_nlos, hlen,
+					    &gro)) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_bounds_err);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return -EINVAL;
+	}
+
+	/* Device capability gates coalesced delivery. Packet format can still
+	 * disable GSO and use the per-packet fallback below.
+	 */
+	if (total_pkts > 1 && (!rxcsum || !gro_hw))
+		return -EINVAL;
+
+	if (gro && total_pkts > 1) {
+		/* Standard counters cover delivered HW-GRO skbs. coal_rx and
+		 * coal_pkts cover coalescing input regardless of HW-GRO.
+		 */
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.rx_hw_gro_packets);
+		u64_stats_add(&pcpu_ptr->priv_stats.rx_hw_gro_wire_packets, total_pkts);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+	}
+
+	if (total_pkts == 1 && (!rxcsum || !gro_hw)) {
+		coal_skb->ip_summed = CHECKSUM_NONE;
+		__skb_queue_tail(list, coal_skb);
+		return 0;
+	}
+
+	if (rmnet_map_v5_csum_fixup(coal_hdr) && !coal_meta.zero_csum) {
+		coal_skb->ip_summed = CHECKSUM_NONE;
+		__skb_queue_tail(list, coal_skb);
+		return 0;
+	}
+
+	if (rmnet_map_coal_gro_fast_path(coal_skb, coal_hdr, &coal_meta, list,
+					 num_nlos, gro))
+		return 0;
+
+	rmnet_map_coal_segment_loop(coal_skb, coal_hdr, &coal_meta, list,
+				    nlo_err_mask, gro, num_nlos);
+
+	return 0;
+}
+
+/* Log the hardware close-reason counter for a coalescing header. */
+static void rmnet_map_data_log_close_stats(struct rmnet_pcpu_stats *pcpu_ptr,
+					   u8 type, u8 code)
+{
+	switch (type) {
+	case RMNET_MAP_COAL_CLOSE_NON_COAL:
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_non_coal);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		break;
+	case RMNET_MAP_COAL_CLOSE_IP_MISS:
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_ip_miss);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		break;
+	case RMNET_MAP_COAL_CLOSE_TRANS_MISS:
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_trans_miss);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		break;
+	case RMNET_MAP_COAL_CLOSE_HW:
+		switch (code) {
+		case RMNET_MAP_COAL_CLOSE_HW_NL:
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_hw_nl);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			break;
+		case RMNET_MAP_COAL_CLOSE_HW_PKT:
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_hw_pkt);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			break;
+		case RMNET_MAP_COAL_CLOSE_HW_BYTE:
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_hw_byte);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			break;
+		case RMNET_MAP_COAL_CLOSE_HW_TIME:
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_hw_time);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			break;
+		case RMNET_MAP_COAL_CLOSE_HW_EVICT:
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_hw_evict);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			break;
+		default:
+			break;
+		}
+		break;
+	case RMNET_MAP_COAL_CLOSE_COAL:
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_close_coal);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		break;
+	default:
+		break;
 	}
+}
 
-	/* Pull csum v5 header */
-	skb_pull(skb, sizeof(*next_hdr));
+/* Validate the coalescing header and build the checksum error mask.
+ *
+ * Checks performed:
+ *  - MAP pkt_len accommodates the coal header (coal header is counted in
+ *    pkt_len. pkt_len < sizeof(*coal_hdr) means no payload is possible).
+ *  - num_nlos is in [1, RMNET_MAP_V5_MAX_NLOS].
+ *  - Total packet count does not exceed RMNET_MAP_V5_MAX_PACKETS.
+ *
+ * nlo_err_mask is NOT six independent per-NLO bitmaps. Each nl_pairs
+ * slot only has room for an 8 bit csum_error_bitmap, but a single NLO
+ * can carry more than 8 packets (up to RMNET_MAP_V5_MAX_PACKETS), so
+ * hardware spills a wide NLO's error bits into the csum_error_bitmap
+ * bytes of the following slots rather than truncating them. The
+ * six bitmap bytes are therefore always concatenated in slot order
+ * into one flat RMNET_MAP_V5_MAX_NLOS * 8 = RMNET_MAP_V5_MAX_PACKETS
+ * bit value, addressed by a packet's absolute position in the frame,
+ * regardless of how many NLOs are actually in use. Receivers must
+ * walk it as a single contiguous stream and must not expect it to
+ * align it at NLO boundaries.
+ */
+static int rmnet_map_data_check_coal_header(struct sk_buff *skb,
+					    u64 *nlo_err_mask,
+					    u8 *num_nlos,
+					    u16 *num_pkts)
+{
+	struct rmnet_map_header *maph = (struct rmnet_map_header *)skb->data;
+	struct rmnet_priv *priv = netdev_priv(skb->dev);
+	struct rmnet_map_v5_coal_header *coal_hdr;
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	u16 pkts = 0;
+	u64 mask = 0;
+	int nlos;
+	int i;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	/* coal header is counted in pkt_len */
+	if (ntohs(maph->pkt_len) < sizeof(*coal_hdr)) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_hdr_err);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return -EINVAL;
+	}
+
+	coal_hdr = (struct rmnet_map_v5_coal_header *)(skb->data + sizeof(*maph));
+	nlos = rmnet_map_v5_get_num_nlos(coal_hdr);
+	if (nlos < 0) {
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_hdr_err);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		return -EINVAL;
+	}
+
+	*num_nlos = nlos;
+	for (i = 0; i < RMNET_MAP_V5_MAX_NLOS; i++) {
+		u8 err = coal_hdr->nl_pairs[i].csum_error_bitmap;
+		u8 pkt = coal_hdr->nl_pairs[i].num_packets;
+
+		mask |= ((u64)err) << (8 * i);
+		if (i < *num_nlos) {
+			pkts += pkt;
+			if (pkts > RMNET_MAP_V5_MAX_PACKETS) {
+				u64_stats_update_begin(&pcpu_ptr->syncp);
+				u64_stats_inc(&pcpu_ptr->priv_stats.coal_hdr_pkt_err);
+				u64_stats_update_end(&pcpu_ptr->syncp);
+				return -EINVAL;
+			}
+		}
+	}
+
+	/* coal_pkts counts packets reported by the hardware, independent of
+	 * whether the frame is later delivered through HW-GRO.
+	 */
+	u64_stats_update_begin(&pcpu_ptr->syncp);
+	u64_stats_add(&pcpu_ptr->priv_stats.coal_pkts, pkts);
+	u64_stats_update_end(&pcpu_ptr->syncp);
+	rmnet_map_data_log_close_stats(pcpu_ptr,
+				       u8_get_bits(coal_hdr->close_info,
+						   MAPV5_CLOSEINFO_CLOSE_TYPE_FMASK),
+				       u8_get_bits(coal_hdr->close_info,
+						   MAPV5_CLOSEINFO_CLOSE_VALUE_FMASK));
+
+	*nlo_err_mask = mask;
+	*num_pkts = pkts;
+	return 0;
+}
+
+int rmnet_map_process_next_hdr_packet(struct sk_buff *skb,
+				      struct sk_buff_head *list,
+				      u16 len, u32 data_format)
+{
+	struct rmnet_priv *priv = netdev_priv(skb->dev);
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	u64 nlo_err_mask;
+	u16 num_pkts;
+	u8 num_nlos;
+	int rc;
+
+	pcpu_ptr = this_cpu_ptr(priv->pcpu_stats);
+
+	switch (rmnet_map_get_next_hdr_type(skb)) {
+	case RMNET_MAP_HEADER_TYPE_COALESCING:
+		if (!(data_format & RMNET_FLAGS_INGRESS_COALESCE))
+			return -EINVAL;
+
+		/* coal_rx counts coalescing input, not delivered HW-GRO skbs. */
+		u64_stats_update_begin(&pcpu_ptr->syncp);
+		u64_stats_inc(&pcpu_ptr->priv_stats.coal_rx);
+		u64_stats_update_end(&pcpu_ptr->syncp);
+		rc = rmnet_map_data_check_coal_header(skb, &nlo_err_mask,
+						      &num_nlos, &num_pkts);
+		if (rc)
+			return rc;
+
+		/* Coalescing rewrites shared packet data and GSO metadata. */
+		if (skb_unclone(skb, GFP_ATOMIC))
+			return -ENOMEM;
+
+		rc = rmnet_map_segment_coal_skb(skb, nlo_err_mask, list, len,
+						num_pkts, num_nlos);
+		if (rc)
+			return rc;
+
+		if (skb_peek(list) != skb) {
+			if (skb_queue_empty(list))
+				kfree_skb(skb);
+			else
+				consume_skb(skb);
+		}
+		break;
+
+	case RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD:
+		if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.csum_sw);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+		} else if (rmnet_map_get_csum_valid(skb)) {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.csum_ok);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+			skb->ip_summed = CHECKSUM_UNNECESSARY;
+		} else {
+			u64_stats_update_begin(&pcpu_ptr->syncp);
+			u64_stats_inc(&pcpu_ptr->priv_stats.csum_valid_unset);
+			u64_stats_update_end(&pcpu_ptr->syncp);
+		}
+
+		skb_pull(skb, sizeof(struct rmnet_map_header) +
+			      sizeof(struct rmnet_map_v5_csum_header));
+		skb_trim(skb, len);
+		__skb_queue_tail(list, skb);
+		break;
+
+	default:
+		return -EINVAL;
+	}
 
 	return 0;
 }
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
index 5f921cddf82b4..d76af4788243b 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
@@ -7,6 +7,7 @@
 #include <linux/capability.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
+#include <net/netdev_queues.h>
 #include <linux/if_arp.h>
 #include <linux/netlink.h>
 #include <net/pkt_sched.h>
@@ -66,27 +67,25 @@ static netdev_tx_t rmnet_vnd_start_xmit(struct sk_buff *skb,
 	return NETDEV_TX_OK;
 }
 
-static int rmnet_vnd_headroom(struct rmnet_port *port)
+static int rmnet_vnd_headroom(u32 data_format)
 {
 	u32 headroom;
 
 	headroom = sizeof(struct rmnet_map_header);
 
-	if (port->data_format & RMNET_FLAGS_EGRESS_MAP_CKSUMV4)
+	if (data_format & RMNET_FLAGS_EGRESS_MAP_CKSUMV4)
 		headroom += sizeof(struct rmnet_map_ul_csum_header);
 
 	return headroom;
 }
 
-static int rmnet_vnd_change_mtu(struct net_device *rmnet_dev, int new_mtu)
+static int rmnet_vnd_change_mtu_with_format(struct net_device *rmnet_dev,
+					    int new_mtu, u32 data_format)
 {
 	struct rmnet_priv *priv = netdev_priv(rmnet_dev);
-	struct rmnet_port *port;
 	u32 headroom;
 
-	port = rmnet_get_port_rtnl(priv->real_dev);
-
-	headroom = rmnet_vnd_headroom(port);
+	headroom = rmnet_vnd_headroom(data_format);
 
 	if (new_mtu < 0 || new_mtu > RMNET_MAX_PACKET_SIZE ||
 	    new_mtu > (priv->real_dev->mtu - headroom))
@@ -96,6 +95,17 @@ static int rmnet_vnd_change_mtu(struct net_device *rmnet_dev, int new_mtu)
 	return 0;
 }
 
+static int rmnet_vnd_change_mtu(struct net_device *rmnet_dev, int new_mtu)
+{
+	struct rmnet_priv *priv = netdev_priv(rmnet_dev);
+	struct rmnet_port *port;
+
+	port = rmnet_get_port_rtnl(priv->real_dev);
+
+	return rmnet_vnd_change_mtu_with_format(rmnet_dev, new_mtu,
+						READ_ONCE(port->data_format));
+}
+
 static int rmnet_vnd_get_iflink(const struct net_device *dev)
 {
 	struct rmnet_priv *priv = netdev_priv(dev);
@@ -132,8 +142,10 @@ static void rmnet_vnd_uninit(struct net_device *dev)
 static void rmnet_get_stats64(struct net_device *dev,
 			      struct rtnl_link_stats64 *s)
 {
+	struct rmnet_priv_stats total_priv_stats = { };
 	struct rmnet_priv *priv = netdev_priv(dev);
 	struct rmnet_vnd_stats total_stats = { };
+	struct rmnet_priv_stats priv_snapshot;
 	struct rmnet_pcpu_stats *pcpu_ptr;
 	struct rmnet_vnd_stats snapshot;
 	unsigned int cpu, start;
@@ -144,6 +156,8 @@ static void rmnet_get_stats64(struct net_device *dev,
 		do {
 			start = u64_stats_fetch_begin(&pcpu_ptr->syncp);
 			snapshot = pcpu_ptr->stats;	/* struct assignment */
+			u64_stats_copy(&priv_snapshot, &pcpu_ptr->priv_stats,
+				       sizeof(priv_snapshot));
 		} while (u64_stats_fetch_retry(&pcpu_ptr->syncp, start));
 
 		total_stats.rx_pkts += snapshot.rx_pkts;
@@ -151,6 +165,7 @@ static void rmnet_get_stats64(struct net_device *dev,
 		total_stats.tx_pkts += snapshot.tx_pkts;
 		total_stats.tx_bytes += snapshot.tx_bytes;
 		total_stats.tx_drops += snapshot.tx_drops;
+		total_priv_stats.rx_dropped += priv_snapshot.rx_dropped;
 	}
 
 	s->rx_packets = total_stats.rx_pkts;
@@ -158,8 +173,45 @@ static void rmnet_get_stats64(struct net_device *dev,
 	s->tx_packets = total_stats.tx_pkts;
 	s->tx_bytes = total_stats.tx_bytes;
 	s->tx_dropped = total_stats.tx_drops;
+	s->rx_dropped = total_priv_stats.rx_dropped;
+}
+
+/* Report standard network stack RX statistics. These are distinct from the
+ * rmnet-specific coalescing diagnostics exposed through ethtool.
+ */
+static void rmnet_get_queue_stats_rx(struct net_device *dev, int idx,
+				     struct netdev_queue_stats_rx *stats)
+{
+	struct rmnet_priv *priv = netdev_priv(dev);
+	struct rmnet_priv_stats total_stats = { };
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	struct rmnet_priv_stats snapshot;
+	unsigned int cpu, start;
+
+	for_each_possible_cpu(cpu) {
+		pcpu_ptr = per_cpu_ptr(priv->pcpu_stats, cpu);
+
+		do {
+			start = u64_stats_fetch_begin(&pcpu_ptr->syncp);
+			u64_stats_copy(&snapshot, &pcpu_ptr->priv_stats,
+				       sizeof(snapshot));
+		} while (u64_stats_fetch_retry(&pcpu_ptr->syncp, start));
+
+		total_stats.rx_hw_gro_packets += snapshot.rx_hw_gro_packets;
+		total_stats.rx_hw_gro_wire_packets +=
+			snapshot.rx_hw_gro_wire_packets;
+		total_stats.rx_alloc_fail += snapshot.rx_alloc_fail;
+	}
+
+	stats->hw_gro_packets = total_stats.rx_hw_gro_packets;
+	stats->hw_gro_wire_packets = total_stats.rx_hw_gro_wire_packets;
+	stats->alloc_fail = total_stats.rx_alloc_fail;
 }
 
+static const struct netdev_stat_ops rmnet_stat_ops = {
+	.get_queue_stats_rx = rmnet_get_queue_stats_rx,
+};
+
 static const struct net_device_ops rmnet_vnd_ops = {
 	.ndo_start_xmit = rmnet_vnd_start_xmit,
 	.ndo_change_mtu = rmnet_vnd_change_mtu,
@@ -183,8 +235,34 @@ static const char rmnet_gstrings_stats[][ETH_GSTRING_LEN] = {
 	"Checksum skipped",
 	"Checksum computed in software",
 	"Checksum computed in hardware",
+	/* DL coalescing */
+	"Coal alloc packet drops",
+	"Coal frames received",
+	"Packets in coal frames",
+	"Coal header errors",
+	"Coal hdr pkt count errors",
+	"Coal bounds errors",
+	"Coal checksum errors",
+	"Coal packets csum err drops",
+	"Coal segments reconstructed",
+	"Coal invalid IP packet",
+	"Coal invalid transport",
+	/* close reasons */
+	"Coal closed: non-coal",
+	"Coal closed: IP miss",
+	"Coal closed: transport miss",
+	"Coal closed: hw NL limit",
+	"Coal closed: hw pkt limit",
+	"Coal closed: hw byte limit",
+	"Coal closed: hw time limit",
+	"Coal closed: hw evict",
+	"Coal closed: FIN/PSH",
 };
 
+static_assert(ARRAY_SIZE(rmnet_gstrings_stats) ==
+	      (sizeof(struct rmnet_priv_stats) -
+	       offsetof(struct rmnet_priv_stats, csum_ok)) / sizeof(u64));
+
 static void rmnet_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
 {
 	switch (stringset) {
@@ -209,12 +287,68 @@ static void rmnet_get_ethtool_stats(struct net_device *dev,
 				    struct ethtool_stats *stats, u64 *data)
 {
 	struct rmnet_priv *priv = netdev_priv(dev);
-	struct rmnet_priv_stats *st = &priv->stats;
+	struct rmnet_priv_stats total_stats = { };
+	struct rmnet_pcpu_stats *pcpu_ptr;
+	struct rmnet_priv_stats *snapshot;
+	unsigned int cpu, start;
 
 	if (!data)
 		return;
 
-	memcpy(data, st, ARRAY_SIZE(rmnet_gstrings_stats) * sizeof(u64));
+	snapshot = kzalloc_obj(*snapshot);
+	if (!snapshot)
+		return;
+
+	for_each_possible_cpu(cpu) {
+		pcpu_ptr = per_cpu_ptr(priv->pcpu_stats, cpu);
+
+		do {
+			start = u64_stats_fetch_begin(&pcpu_ptr->syncp);
+			u64_stats_copy(snapshot, &pcpu_ptr->priv_stats,
+				       sizeof(*snapshot));
+		} while (u64_stats_fetch_retry(&pcpu_ptr->syncp, start));
+
+		total_stats.csum_ok += snapshot->csum_ok;
+		total_stats.csum_ip4_header_bad += snapshot->csum_ip4_header_bad;
+		total_stats.csum_valid_unset += snapshot->csum_valid_unset;
+		total_stats.csum_validation_failed += snapshot->csum_validation_failed;
+		total_stats.csum_err_bad_buffer += snapshot->csum_err_bad_buffer;
+		total_stats.csum_err_invalid_ip_version +=
+			snapshot->csum_err_invalid_ip_version;
+		total_stats.csum_err_invalid_transport +=
+			snapshot->csum_err_invalid_transport;
+		total_stats.csum_fragmented_pkt += snapshot->csum_fragmented_pkt;
+		total_stats.csum_skipped += snapshot->csum_skipped;
+		total_stats.csum_sw += snapshot->csum_sw;
+		total_stats.csum_hw += snapshot->csum_hw;
+		/* Custom rmnet coalescing diagnostics follow. */
+		total_stats.coal_alloc_fail += snapshot->coal_alloc_fail;
+		total_stats.coal_rx += snapshot->coal_rx;
+		total_stats.coal_pkts += snapshot->coal_pkts;
+		total_stats.coal_hdr_err += snapshot->coal_hdr_err;
+		total_stats.coal_hdr_pkt_err += snapshot->coal_hdr_pkt_err;
+		total_stats.coal_bounds_err += snapshot->coal_bounds_err;
+		total_stats.coal_csum_err += snapshot->coal_csum_err;
+		total_stats.coal_csum_drop += snapshot->coal_csum_drop;
+		total_stats.coal_reconstruct += snapshot->coal_reconstruct;
+		total_stats.coal_ip_invalid += snapshot->coal_ip_invalid;
+		total_stats.coal_trans_invalid += snapshot->coal_trans_invalid;
+		total_stats.coal_close_non_coal += snapshot->coal_close_non_coal;
+		total_stats.coal_close_ip_miss += snapshot->coal_close_ip_miss;
+		total_stats.coal_close_trans_miss += snapshot->coal_close_trans_miss;
+		total_stats.coal_close_hw_nl += snapshot->coal_close_hw_nl;
+		total_stats.coal_close_hw_pkt += snapshot->coal_close_hw_pkt;
+		total_stats.coal_close_hw_byte += snapshot->coal_close_hw_byte;
+		total_stats.coal_close_hw_time += snapshot->coal_close_hw_time;
+		total_stats.coal_close_hw_evict += snapshot->coal_close_hw_evict;
+		total_stats.coal_close_coal += snapshot->coal_close_coal;
+	}
+
+	kfree(snapshot);
+
+	/* The first four fields are reported through netdev queue statistics. */
+	memcpy(data, &total_stats.ethtool_stats,
+	       sizeof(total_stats.ethtool_stats));
 }
 
 static int rmnet_get_coalesce(struct net_device *dev,
@@ -308,8 +442,7 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,
 		      struct rmnet_port *port,
 		      struct net_device *real_dev,
 		      struct rmnet_endpoint *ep,
-		      struct netlink_ext_ack *extack)
-
+		      struct netlink_ext_ack *extack, u32 data_format)
 {
 	struct rmnet_priv *priv = netdev_priv(rmnet_dev);
 	u32 headroom;
@@ -323,12 +456,16 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,
 	rmnet_dev->hw_features = NETIF_F_RXCSUM;
 	rmnet_dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
 	rmnet_dev->hw_features |= NETIF_F_SG;
+	rmnet_dev->hw_features |= NETIF_F_GRO_HW;
+	rmnet_dev->stat_ops = &rmnet_stat_ops;
 
 	priv->real_dev = real_dev;
 
-	headroom = rmnet_vnd_headroom(port);
+	headroom = rmnet_vnd_headroom(data_format);
 
-	if (rmnet_vnd_change_mtu(rmnet_dev, real_dev->mtu - headroom)) {
+	if (rmnet_vnd_change_mtu_with_format(rmnet_dev,
+					     real_dev->mtu - headroom,
+					     data_format)) {
 		NL_SET_ERR_MSG_MOD(extack, "Invalid MTU on real dev");
 		return -EINVAL;
 	}
@@ -375,17 +512,15 @@ int rmnet_vnd_do_flow_control(struct net_device *rmnet_dev, int enable)
 	return 0;
 }
 
-int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev)
+static int rmnet_vnd_validate_mtu(struct rmnet_port *port,
+				  struct net_device *real_dev, u32 data_format)
 {
 	struct hlist_node *tmp_ep;
 	struct rmnet_endpoint *ep;
-	struct rmnet_port *port;
 	unsigned long bkt_ep;
 	u32 headroom;
 
-	port = rmnet_get_port_rtnl(real_dev);
-
-	headroom = rmnet_vnd_headroom(port);
+	headroom = rmnet_vnd_headroom(data_format);
 
 	hash_for_each_safe(port->muxed_ep, bkt_ep, tmp_ep, ep, hlnode) {
 		if (ep->egress_dev->mtu > (real_dev->mtu - headroom))
@@ -395,23 +530,39 @@ int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev)
 	return 0;
 }
 
+int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev)
+{
+	struct rmnet_port *port;
+
+	port = rmnet_get_port_rtnl(real_dev);
+
+	return rmnet_vnd_validate_mtu(port, real_dev,
+				      READ_ONCE(port->data_format));
+}
+
 int rmnet_vnd_update_dev_mtu(struct rmnet_port *port,
-			     struct net_device *real_dev)
+			     struct net_device *real_dev, u32 data_format)
 {
 	struct hlist_node *tmp_ep;
 	struct rmnet_endpoint *ep;
 	unsigned long bkt_ep;
 	u32 headroom;
+	int new_mtu;
 
-	headroom = rmnet_vnd_headroom(port);
+	headroom = rmnet_vnd_headroom(data_format);
+	if (real_dev->mtu < headroom)
+		return -EINVAL;
+
+	new_mtu = real_dev->mtu - headroom;
+	if (new_mtu > RMNET_MAX_PACKET_SIZE)
+		return -EINVAL;
 
 	hash_for_each_safe(port->muxed_ep, bkt_ep, tmp_ep, ep, hlnode) {
-		if (ep->egress_dev->mtu <= (real_dev->mtu - headroom))
+		if (ep->egress_dev->mtu <= new_mtu)
 			continue;
 
-		if (rmnet_vnd_change_mtu(ep->egress_dev,
-					 real_dev->mtu - headroom))
-			return -1;
+		/* The target MTU was validated before updating any endpoint. */
+		WRITE_ONCE(ep->egress_dev->mtu, new_mtu);
 	}
 
 	return 0;
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h
index c2b2baf86894e..901ef36900ac3 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.h
@@ -12,7 +12,7 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,
 		      struct rmnet_port *port,
 		      struct net_device *real_dev,
 		      struct rmnet_endpoint *ep,
-		      struct netlink_ext_ack *extack);
+		      struct netlink_ext_ack *extack, u32 data_format);
 int rmnet_vnd_dellink(u8 id, struct rmnet_port *port,
 		      struct rmnet_endpoint *ep);
 void rmnet_vnd_rx_fixup(struct sk_buff *skb, struct net_device *dev);
@@ -21,5 +21,5 @@ void rmnet_vnd_tx_fixup(struct sk_buff *skb, struct net_device *dev);
 void rmnet_vnd_setup(struct net_device *dev);
 int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev);
 int rmnet_vnd_update_dev_mtu(struct rmnet_port *port,
-			     struct net_device *real_dev);
+			     struct net_device *real_dev, u32 data_format);
 #endif /* _RMNET_VND_H_ */
diff --git a/include/linux/if_rmnet.h b/include/linux/if_rmnet.h
index c44bf6e80ecb4..5df4d417f3d2c 100644
--- a/include/linux/if_rmnet.h
+++ b/include/linux/if_rmnet.h
@@ -70,5 +70,36 @@ struct rmnet_map_v5_csum_header {
 #define MAPV5_HDRINFO_HDR_TYPE_FMASK	GENMASK(7, 1)
 #define MAPV5_CSUMINFO_VALID_FLAG	BIT(7)
 
+#define RMNET_MAP_HEADER_TYPE_COALESCING   1
 #define RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD 2
+
+/* MAPv5 coalescing header */
+#define RMNET_MAP_V5_MAX_NLOS		6
+#define RMNET_MAP_V5_MAX_PACKETS	48
+
+/* One Number-Length Object pair: per-NLO packet count and length. */
+struct rmnet_map_v5_nl_pair {
+	__be16 pkt_len;
+	u8  csum_error_bitmap;
+	u8  num_packets;
+} __aligned(1);
+
+/* MAPv5 coalescing header: describes up to RMNET_MAP_V5_MAX_NLOS NLOs.
+ * The header immediately follows the MAP header in the frame and is
+ * included in the MAP pkt_len field.
+ */
+struct rmnet_map_v5_coal_header {
+	u8  header_info;	/* MAPV5_HDRINFO_NXT_HDR_FLAG, MAPV5_HDRINFO_HDR_TYPE_FMASK */
+	u8  coal_info;		/* MAPV5_COALINFO_* */
+	u8  close_info;		/* MAPV5_CLOSEINFO_* */
+	u8  veid_info;		/* MAPV5_VEIDINFO_* */
+	struct rmnet_map_v5_nl_pair nl_pairs[RMNET_MAP_V5_MAX_NLOS];
+} __aligned(1);
+
+#define MAPV5_COALINFO_NUM_NLOS_FMASK		GENMASK(6, 4)
+#define MAPV5_COALINFO_CSUM_VALID_FLAG		BIT(7)
+#define MAPV5_CLOSEINFO_CLOSE_TYPE_FMASK	GENMASK(3, 0)
+#define MAPV5_CLOSEINFO_CLOSE_VALUE_FMASK	GENMASK(7, 4)
+#define MAPV5_VEIDINFO_VEID_FMASK		GENMASK(3, 0)
+
 #endif /* !(_LINUX_IF_RMNET_H_) */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 245b362045253..349fcddc6622f 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -2022,6 +2022,7 @@ enum {
 #define RMNET_FLAGS_EGRESS_MAP_CKSUMV4            (1U << 3)
 #define RMNET_FLAGS_INGRESS_MAP_CKSUMV5           (1U << 4)
 #define RMNET_FLAGS_EGRESS_MAP_CKSUMV5            (1U << 5)
+#define RMNET_FLAGS_INGRESS_COALESCE              (1U << 6)
 
 enum {
 	IFLA_RMNET_UNSPEC,

43/3 2026/10/09 10:46 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 32274
							output: 42
							thoughts: 3742
						

Thoughts:
**KMSAN Evaluation of Qualcomm RMNET Driver Patch**

Alright, let's break this down systematically. My job is to determine if this patch series warrants a dedicated KMSAN fuzzing session. The key is to identify potential kernel memory leaks or uses of uninitialized memory that aren't already caught by KASAN or standard bug detectors. I need to focus on code that introduces new structures sent to userspace, relies on uninitialized variables in conditional logic, allocates complex data structures with potentially uninitialized fields, or allows access to uninitialized bytes through bounds checks. Let's see...

This patch adds support for hardware coalescing (MAPv5) to the Qualcomm rmnet driver. First, I need to look at what's been changed, starting with the file list. The documentation, configuration files, and driver files have been modified. I need to dig into the actual code changes. I'll read through them file by file.

My first concern is related to user-space exposure. I'll have to check if any new kernel structures are being sent to user space via functions like `copy_to_user`, netlink, ioctl, etc. I'll also watch for `put_user`, socket options, and BPF buffers. I'll focus on anything related to network statistics, which often involves structures that are populated within the kernel and then reported to user-space tools like `ethtool`.

I started with the ethtool stats. I'm carefully reviewing `rmnet_get_stats64`, `rmnet_get_queue_stats_rx` and `rmnet_get_ethtool_stats`. My goal is to ensure that the data being sent to userspace is properly initialized. I see that `rmnet_get_stats64` populates `rtnl_link_stats64` which is initialized by `rtnl` core. `rmnet_get_queue_stats_rx` deals with the `struct netdev_queue_stats_rx`. This should be fine as it only aggregates some stats and that struct should also be handled properly by the kernel.

Now for `rmnet_get_ethtool_stats`. This calls `rmnet_get_ethtool_stats`. It's reading stats from per-CPU stats and copying them to a `struct ethtool_stats`.  A `kzalloc` is performed to zero the object. A loop gets per-CPU stats and does `u64_stats_copy`. The data is copied via `memcpy` to a `data` pointer. It's likely that `data` is passed to the ethtool interface, so this is important! The `struct_group(ethtool_stats, ...)` suggests new statistics related to the coalescing feature. However, `total_stats` is properly zero-initialized and copied using `memcpy`.  I see there is a static assertion to make sure the data size is handled correctly. So this is looking good.

So far, it seems like the statistics-related code is handling initialization correctly. But I'll need to keep an eye out for other data structures that might be exposed. I still need to make sure that there isn't any other information leaked through the new `rmnet_map_v5_nl_pair` and `rmnet_map_v5_coal_header`. I must also make sure `data` is sized correctly. I'll continue this analysis in the next phase!



44/3 2026/10/09 10:47 tool grepper
0m Args:
{
  "Expression": "rmnet_get_sset_count",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c=266=static void rmnet_get_strings(struct net_device *dev, u32 stringset, u8 *buf)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-275-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c:276:static int rmnet_get_sset_count(struct net_device *dev, int sset)\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-277-{\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c=403=static const struct ethtool_ops rmnet_ethtool_ops = {\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-408-\t.get_strings = rmnet_get_strings,\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c:409:\t.get_sset_count = rmnet_get_sset_count,\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-410-};\n"
}

45/3 2026/10/09 10:47 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 37110
							output: 47
							thoughts: 23
						

Thoughts:
Okay, here's my take on those thoughts, tailored for an expert audience:

**Analyzing `rmnet_get_sset_count` in `rmnet_vnd.c`**

Alright, let's dive into `rmnet_get_sset_count` within `rmnet_vnd.c`. This is where the rubber meets the road, as we're likely dealing with some core functionality related to Session Set (SSET) management for RMNET, probably within a particular vendor implementation. I need to understand how the system keeps track of, and retrieves, the number of active SSETs. This will provide insight into how RMNET is handling concurrent data sessions, and what resources are being allocated. Specifically, I'm thinking about the implications for congestion control, QoS, and potentially the limitations of the hardware in managing multiple sessions concurrently. My primary interest is in looking at the potential for scalability or if there might be bottlenecks in the underlying implementation. I want to see if they've implemented any clever optimizations, such as using atomic operations, bitmasks, or pre-allocation of SSET entries. Let's see if this function's logic provides any hints about the underlying data structures used for the SSET pool. I'm also curious to see if there's any cleverness in the locking mechanisms employed to ensure thread safety when accessing and updating this count – spinlocks, mutexes, or something more sophisticated perhaps? The key here is to determine whether it’s a simple counter, or something more complex with state transitions.



46/3 2026/10/09 10:47 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c",
  "FirstLine": 265,
  "LineCount": 25
}

Results:
{
  "Contents": " 265:\t\n 266:\tstatic void rmnet_get_strings(struct net_device *dev, u32 stringset, u8 *buf)\n 267:\t{\n 268:\t\tswitch (stringset) {\n 269:\t\tcase ETH_SS_STATS:\n 270:\t\t\tmemcpy(buf, \u0026rmnet_gstrings_stats,\n 271:\t\t\t       sizeof(rmnet_gstrings_stats));\n 272:\t\t\tbreak;\n 273:\t\t}\n 274:\t}\n 275:\t\n 276:\tstatic int rmnet_get_sset_count(struct net_device *dev, int sset)\n 277:\t{\n 278:\t\tswitch (sset) {\n 279:\t\tcase ETH_SS_STATS:\n 280:\t\t\treturn ARRAY_SIZE(rmnet_gstrings_stats);\n 281:\t\tdefault:\n 282:\t\t\treturn -EOPNOTSUPP;\n 283:\t\t}\n 284:\t}\n 285:\t\n 286:\tstatic void rmnet_get_ethtool_stats(struct net_device *dev,\n 287:\t\t\t\t\t    struct ethtool_stats *stats, u64 *data)\n 288:\t{\n 289:\t\tstruct rmnet_priv *priv = netdev_priv(dev);\n"
}

47/3 2026/10/09 10:47 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 37869
							output: 30
							thoughts: 169
						

Thoughts:
**Analyzing the RMNET Statistics Gathering**

Okay, so `rmnet_get_sset_count` is straightforward enough; it's just returning the size of `rmnet_gstrings_stats`. Now, let's unpack this a bit. Looks like the size of `rmnet_gstrings_stats` is derived from a calculation involving the `rmnet_priv_stats` struct – it's basically taking the size of the struct, subtracting the offset of `csum_ok`, and dividing by the size of a `u64`. Clever, so we're figuring out how many `u64` fields are *before* the `csum_ok` member.

Right, and now I see it, the `total_stats.ethtool_stats` array is the same size, which means the calculations are consistent. And the size of that array is clearly equal to the number of elements in `rmnet_gstrings_stats`, all of these are `u64` values. The code explicitly initializes `total_stats` – so no garbage data surprises – and then accumulates from a `snapshot`. So, this is how we're gathering the ethtool stats.

But hang on, what's `u64_stats_copy` doing here? I'm going to quickly check how that function works; I need to understand how those stats are actually being handled and copied around. Just to make sure there are no gotchas.



48/3 2026/10/09 10:47 tool grepper
0m Args:
{
  "Expression": "u64_stats_copy",
  "PathPrefixes": [
    "include/"
  ]
}

Results:
{
  "Output": "include/linux/u64_stats_sync.h=77=static inline u64 u64_stats_read(const u64_stats_t *p)\n--\ninclude/linux/u64_stats_sync.h-81-\ninclude/linux/u64_stats_sync.h:82:static inline void *u64_stats_copy(void *dst, const void *src, size_t len)\ninclude/linux/u64_stats_sync.h-83-{\n--\ninclude/linux/u64_stats_sync.h=132=static inline u64 u64_stats_read(const u64_stats_t *p)\n--\ninclude/linux/u64_stats_sync.h-136-\ninclude/linux/u64_stats_sync.h:137:static inline void *u64_stats_copy(void *dst, const void *src, size_t len)\ninclude/linux/u64_stats_sync.h-138-{\n"
}

49/3 2026/10/09 10:47 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 38646
							output: 40
							thoughts: 32
						

Thoughts:
Okay, here's the summary, rendered as a first-person thought process, geared towards an expert:

**Diving into u64_stats_copy**

Alright, let's take a look at how `u64_stats_copy` is actually put together. I need to refresh my memory on the implementation details. Let me check the definition in `include/linux/u64_stats_sync.h`. I'm especially interested in how it handles synchronization and the underlying data structures. Knowing the nuances of this function is key to making sure that the relevant stats can be correctly moved into the user space. I need to recall if this uses atomic operations, or if there's a more complex locking scheme involved, especially concerning the memory ordering guarantees provided by the CPU architecture. I need to make sure that whatever's in place there is compatible with my current work. Got to keep in mind possible cache coherency issues, especially given that we're dealing with potentially shared counters that could be accessed by other CPUs.



50/3 2026/10/09 10:47 tool read-file
0m Args:
{
  "File": "include/linux/u64_stats_sync.h",
  "FirstLine": 75,
  "LineCount": 20
}

Results:
{
  "Contents": "  75:\t} u64_stats_t ;\n  76:\t\n  77:\tstatic inline u64 u64_stats_read(const u64_stats_t *p)\n  78:\t{\n  79:\t\treturn local64_read(\u0026p-\u003ev);\n  80:\t}\n  81:\t\n  82:\tstatic inline void *u64_stats_copy(void *dst, const void *src, size_t len)\n  83:\t{\n  84:\t\tBUILD_BUG_ON(len % sizeof(u64_stats_t));\n  85:\t\tfor (size_t i = 0; i \u003c len / sizeof(u64_stats_t); i++)\n  86:\t\t\t((u64 *)dst)[i] = local64_read(\u0026((local64_t *)src)[i]);\n  87:\t\treturn dst;\n  88:\t}\n  89:\t\n  90:\tstatic inline void u64_stats_set(u64_stats_t *p, u64 val)\n  91:\t{\n  92:\t\tlocal64_set(\u0026p-\u003ev, val);\n  93:\t}\n  94:\t\n"
}

51/3 2026/10/09 10:47 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 39255
							output: 38
							thoughts: 41
						

Thoughts:
Okay, here's my interpretation of that thought process, from an expert's perspective:

**Diving into RMNET Per-CPU Statistics**

Alright, so I'm looking at `priv_stats` within the `struct rmnet_pcpu_stats`. The obvious first question is always: where and when does this `pcpu_stats` thing get allocated? I know `priv_stats` is dynamically allocated when the per-cpu stats get allocated so I need to find the allocation of `pcpu_stats`. This is likely the key to understanding its lifetime and how it's used within the RMNET framework. Time to trace that back and see what's going on at the initialization level. No surprises yet, just good engineering practice - follow the breadcrumbs.



52/3 2026/10/09 10:47 tool grepper
0m Args:
{
  "Expression": "alloc_percpu",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c=116=static int rmnet_vnd_init(struct net_device *dev)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-120-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c:121:\tpriv-\u003epcpu_stats = alloc_percpu(struct rmnet_pcpu_stats);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-122-\tif (!priv-\u003epcpu_stats)\n"
}

53/3 2026/10/09 10:47 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 39660
							output: 49
							thoughts: 1554
						

Thoughts:
**Analyzing Per-CPU Statistics in RMNET**

Okay, so I'm looking at this `rmnet` code, and the first thing that jumps out is how `alloc_percpu` returns zero-initialized memory. That's good to know, sets a baseline. Now, in `rmnet_get_stats64`, I see this `priv_snapshot` struct being overwritten by `u64_stats_copy`. The critical question is `sizeof(priv_snapshot)`. I need to ensure the copy is complete and correct.

Hold on a second, let me cross-check the sizes of `struct rmnet_priv_stats` and `struct rmnet_pcpu_priv_stats` to verify this. Let's dig into `rmnet_config.h`... ah, here we go. It seems like both `struct rmnet_priv_stats` and `struct rmnet_pcpu_priv_stats` have the exact same members, in the exact same order. Excellent. Since `u64_stats_t` is essentially just a `u64`, the sizes must be identical. Which means the `u64_stats_copy` should indeed be copying everything correctly from the per-CPU data (`pcpu_ptr->priv_stats`) into the snapshot. Good.

Now that I've confirmed that the stats copying is probably right, I need to get an idea of the flow of packets coming into the driver, and see if there are any obvious race conditions or issues. I'll focus on how the packets are received, parsed, reconstructed, segmented, or cloned. Let me check the functions that manage these packet operations. I need to understand `__rmnet_map_ingress_handler`, `rmnet_map_process_next_hdr_packet`, `rmnet_map_segment_coal_skb`, and `__rmnet_map_segment_coal_skb`. I will start by focusing on `drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c`, and particularly, the code around `__rmnet_map_segment_coal_skb` to get context for how the packet processing works, and see where these statistics are being incremented or updated.



54/3 2026/10/09 10:48 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c",
  "FirstLine": 715,
  "LineCount": 90
}

Results:
{
  "Contents": " 715:\t__rmnet_map_segment_coal_skb(struct sk_buff *coal_skb,\n 716:\t\t\t\t     struct rmnet_map_coal_metadata *coal_meta,\n 717:\t\t\t\t     struct sk_buff_head *list, u8 pkt_id,\n 718:\t\t\t\t     bool csum_valid)\n 719:\t{\n 720:\t\tu32 dlen = coal_meta-\u003edata_len * coal_meta-\u003epkt_count;\n 721:\t\tstruct rmnet_priv *priv = netdev_priv(coal_skb-\u003edev);\n 722:\t\tu32 hlen = coal_meta-\u003eip_len + coal_meta-\u003etrans_len;\n 723:\t\tstruct rmnet_pcpu_stats *pcpu_ptr;\n 724:\t\tstruct sk_buff *skbn;\n 725:\t\n 726:\t\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n 727:\t\n 728:\t\t/* RFC 768: UDP checksum is optional for IPv4, and is 0 if unused.\n 729:\t\t * Such packets are never actually bad, regardless of what the\n 730:\t\t * checksum bitmap says.\n 731:\t\t */\n 732:\t\tif (!csum_valid \u0026\u0026 coal_meta-\u003ezero_csum)\n 733:\t\t\tcsum_valid = true;\n 734:\t\n 735:\t\tif (!csum_valid) {\n 736:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 737:\t\t\t/* rx_dropped is standard accounting. coal_csum_drop is its\n 738:\t\t\t * coalescing-specific checksum error subset.\n 739:\t\t\t */\n 740:\t\t\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.rx_dropped, coal_meta-\u003epkt_count);\n 741:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_csum_drop);\n 742:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 743:\t\t\tgoto next_pkt;\n 744:\t\t}\n 745:\t\n 746:\t\tskbn = alloc_skb(hlen + dlen + RMNET_MAP_DEAGGR_HEADROOM, GFP_ATOMIC);\n 747:\t\tif (!skbn) {\n 748:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 749:\t\t\t/* The coal counter is the coalescing subset of the standard\n 750:\t\t\t * allocation failure and RX drop counters.\n 751:\t\t\t */\n 752:\t\t\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.rx_alloc_fail, coal_meta-\u003epkt_count);\n 753:\t\t\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.rx_dropped, coal_meta-\u003epkt_count);\n 754:\t\t\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.coal_alloc_fail, coal_meta-\u003epkt_count);\n 755:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 756:\t\t\tgoto next_pkt;\n 757:\t\t}\n 758:\t\n 759:\t\tskb_reserve(skbn, hlen + RMNET_MAP_DEAGGR_HEADROOM);\n 760:\t\tskb_put_data(skbn,\n 761:\t\t\t     coal_skb-\u003edata + coal_meta-\u003eip_len + coal_meta-\u003etrans_len +\n 762:\t\t\t     coal_meta-\u003edata_offset,\n 763:\t\t\t     dlen);\n 764:\t\n 765:\t\t/* Restore transport header */\n 766:\t\tskb_push(skbn, coal_meta-\u003etrans_len);\n 767:\t\tmemcpy(skbn-\u003edata, coal_meta-\u003etrans_header, coal_meta-\u003etrans_len);\n 768:\t\tskb_reset_transport_header(skbn);\n 769:\t\n 770:\t\tif (coal_meta-\u003etrans_proto == IPPROTO_TCP) {\n 771:\t\t\tstruct tcphdr *th = tcp_hdr(skbn);\n 772:\t\n 773:\t\t\tth-\u003eseq = htonl(ntohl(th-\u003eseq) + coal_meta-\u003edata_offset);\n 774:\t\t\t/* Strip dangerous flags from non-final segments */\n 775:\t\t\tif ((th-\u003efin || th-\u003epsh) \u0026\u0026\n 776:\t\t\t    hlen + coal_meta-\u003edata_offset + dlen \u003c coal_skb-\u003elen) {\n 777:\t\t\t\tth-\u003efin = 0;\n 778:\t\t\t\tth-\u003epsh = 0;\n 779:\t\t\t}\n 780:\t\t} else if (coal_meta-\u003etrans_proto == IPPROTO_UDP) {\n 781:\t\t\tstruct udphdr *uh = udp_hdr(skbn);\n 782:\t\n 783:\t\t\tuh-\u003elen = htons(skbn-\u003elen);\n 784:\t\t}\n 785:\t\n 786:\t\t/* Restore IP header */\n 787:\t\tskb_push(skbn, coal_meta-\u003eip_len);\n 788:\t\tmemcpy(skbn-\u003edata, coal_meta-\u003eip_header, coal_meta-\u003eip_len);\n 789:\t\tskb_reset_network_header(skbn);\n 790:\t\n 791:\t\tif (coal_meta-\u003eip_proto == 4) {\n 792:\t\t\tstruct iphdr *iph = ip_hdr(skbn);\n 793:\t\n 794:\t\t\tiph-\u003eid = htons(ntohs(iph-\u003eid) + pkt_id);\n 795:\t\t\tiph-\u003etot_len = htons(skbn-\u003elen);\n 796:\t\t\tiph-\u003echeck = 0;\n 797:\t\t\tiph-\u003echeck = ip_fast_csum(iph, iph-\u003eihl);\n 798:\t\t} else {\n 799:\t\t\tipv6_hdr(skbn)-\u003epayload_len =\n 800:\t\t\t\thtons(skbn-\u003elen - sizeof(struct ipv6hdr));\n 801:\t\t}\n 802:\t\n 803:\t\trmnet_map_partial_csum(skbn, coal_meta);\n 804:\t\n"
}

55/3 2026/10/09 10:48 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 43404
							output: 49
							thoughts: 15
						

Thoughts:
Okay, I'm ready to delve into this section and distill the essence. Here's my perspective on lines 805-900:

**Analyzing the Segment: Lines 805-900**

Alright, let's zero in on this block of text. As I scan these lines, I'm immediately looking for the core arguments, the key premises, and any potential logical fallacies. I'm focusing on the structure of the reasoning presented here. Are we dealing with a deductive argument where the conclusion necessarily follows from the premises, or an inductive one, where the conclusion is probable based on observations? Are there any hidden assumptions lurking beneath the surface? I'm assessing the clarity of the language – are the terms well-defined or open to multiple interpretations? Ambiguity is a serious red flag, so I'm paying close attention to that.

I'm also considering the context. Does this section build upon previous arguments, or does it introduce entirely new concepts? Knowing the larger scope of the work will help me evaluate its place in the overall framework. Are there any examples or illustrations that support the claims being made? I'm gauging their effectiveness and relevance. If data is presented, I'm assessing the methodology. Are any sources cited? Are the proper statistical techniques being employed? Can I identify any potential biases, either in the gathering or interpretation of information?

I'm mentally outlining the claims. I'm noting any counterarguments that are presented or omitted. Are there any weaknesses in the author's defense? I'm particularly interested in seeing how this section contributes to my existing understanding of the subject, and if it challenges any existing assumptions. I will determine if the text builds on prior information, or contains completely new content. How does the author establish credibility? What evidence does the author use to support their claims? I'm searching for the author's overall purpose and intention. Is the objective to inform, persuade, or something else entirely? The true essence is found in these details.



56/3 2026/10/09 10:48 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c",
  "FirstLine": 805,
  "LineCount": 95
}

Results:
{
  "Contents": " 805:\t\tskbn-\u003edev = coal_skb-\u003edev;\n 806:\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 807:\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_reconstruct);\n 808:\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 809:\t\n 810:\t\tif (coal_meta-\u003epkt_count \u003e 1)\n 811:\t\t\trmnet_map_gso_stamp(skbn, coal_meta);\n 812:\t\n 813:\t\t__skb_queue_tail(list, skbn);\n 814:\t\n 815:\tnext_pkt:\n 816:\t\tcoal_meta-\u003edata_offset += dlen;\n 817:\t\tcoal_meta-\u003epkt_count = 0;\n 818:\t}\n 819:\t\n 820:\t/* Parse the IP header of the coalesced frame and perform basic\n 821:\t * validation of header fields.\n 822:\t */\n 823:\tstatic bool rmnet_map_coal_parse_ip_hdr(struct sk_buff *coal_skb,\n 824:\t\t\t\t\t\tstruct rmnet_map_coal_metadata *meta,\n 825:\t\t\t\t\t\tbool *gro)\n 826:\t{\n 827:\t\tstruct rmnet_priv *priv = netdev_priv(coal_skb-\u003edev);\n 828:\t\tstruct rmnet_pcpu_stats *pcpu_ptr;\n 829:\t\tstruct ipv6hdr *ip6h;\n 830:\t\tstruct iphdr *iph;\n 831:\t\t__be16 frag_off;\n 832:\t\tu8 protocol;\n 833:\t\tint ret;\n 834:\t\n 835:\t\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n 836:\t\n 837:\t\tif (coal_skb-\u003elen \u003c sizeof(*iph)) {\n 838:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 839:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n 840:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 841:\t\t\treturn false;\n 842:\t\t}\n 843:\t\n 844:\t\tiph = (struct iphdr *)coal_skb-\u003edata;\n 845:\t\n 846:\t\tif (iph-\u003eversion == 4) {\n 847:\t\t\tmeta-\u003eip_proto = 4;\n 848:\t\t\tmeta-\u003eip_len = iph-\u003eihl * 4;\n 849:\t\t\tmeta-\u003etrans_proto = iph-\u003eprotocol;\n 850:\t\t\tmeta-\u003eip_header = iph;\n 851:\t\t\tif (meta-\u003eip_len \u003c sizeof(*iph) || coal_skb-\u003elen \u003c meta-\u003eip_len) {\n 852:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 853:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n 854:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 855:\t\t\t\treturn false;\n 856:\t\t\t}\n 857:\t\n 858:\t\t\tif (ip_is_fragment(iph)) {\n 859:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 860:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n 861:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 862:\t\t\t\treturn false;\n 863:\t\t\t}\n 864:\t\n 865:\t\t\tif (iph-\u003eihl != 5)\n 866:\t\t\t\t*gro = false;\n 867:\t\t} else if (iph-\u003eversion == 6) {\n 868:\t\t\tif (coal_skb-\u003elen \u003c sizeof(*ip6h)) {\n 869:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 870:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n 871:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 872:\t\t\t\treturn false;\n 873:\t\t\t}\n 874:\t\n 875:\t\t\tip6h = (struct ipv6hdr *)iph;\n 876:\t\t\tprotocol = ip6h-\u003enexthdr;\n 877:\t\t\tmeta-\u003eip_proto = 6;\n 878:\t\t\tret = ipv6_skip_exthdr(coal_skb, sizeof(*ip6h), \u0026protocol,\n 879:\t\t\t\t\t       \u0026frag_off);\n 880:\t\t\tif (ret \u003c 0 || frag_off || ret \u003e U16_MAX) {\n 881:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 882:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n 883:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 884:\t\t\t\treturn false;\n 885:\t\t\t}\n 886:\t\n 887:\t\t\tmeta-\u003eip_len = (u16)ret;\n 888:\t\t\tmeta-\u003etrans_proto = protocol;\n 889:\t\t\tmeta-\u003eip_header = ip6h;\n 890:\t\t\tif (coal_skb-\u003elen \u003c meta-\u003eip_len) {\n 891:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 892:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n 893:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 894:\t\t\t\treturn false;\n 895:\t\t\t}\n 896:\t\n 897:\t\t\tif (meta-\u003eip_len \u003e sizeof(*ip6h))\n 898:\t\t\t\t*gro = false;\n 899:\t\t} else {\n"
}

57/3 2026/10/09 10:48 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 45538
							output: 50
							thoughts: 16
						

Thoughts:
Okay, here's the summary, rendered as a first-person thought process, assuming the reader is an expert in their field:

**Diving Back In: Lines 900-1000**

Alright, time to get back to it. Let's see what the next hundred lines reveal. I'm expecting this section to delve deeper into [**Assume the subject matter being studied is known to the expert and is mentioned, e.g., "the implications of the recent shift in the modeling parameters" or "the subtle nuances of the inter-species interaction data" or "the impact of the proposed algorithm on resource allocation"**]. I'll be looking specifically for [**mentioning key areas of interest within the subject matter, e.g., "any discrepancies from the previous simulations," "how they've addressed the boundary conditions," or "the efficiency gains compared to the baseline"**]. I want to see if they've accounted for [**mention a specific detail you'd expect to see, e.g., "the non-linear effects predicted in the earlier work," "the feedback loop I was concerned about," or "the potential for this system to enter a metastable state"**]. I'm particularly interested in how they handled [**mention a specific challenge, e.g., "the computational limitations at this scale," "the noise inherent in this type of data," or "the integration with external systems"**]. Let's see if this section provides the level of detail I'm looking for... I'm ready to parse and critically evaluate. I'll need to keep an eye out for anything that contradicts my existing understanding and be prepared to take extensive notes. Let's start.



58/3 2026/10/09 10:48 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c",
  "FirstLine": 900,
  "LineCount": 100
}

Results:
{
  "Contents": " 900:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 901:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_ip_invalid);\n 902:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 903:\t\t\treturn false;\n 904:\t\t}\n 905:\t\n 906:\t\treturn true;\n 907:\t}\n 908:\t\n 909:\t/* Parse the transport header following the IP header into coal_meta. The\n 910:\t * available length is checked before any field is read.\n 911:\t */\n 912:\tstatic bool rmnet_map_coal_parse_trans_hdr(struct sk_buff *coal_skb,\n 913:\t\t\t\t\t\t   struct rmnet_map_coal_metadata *meta)\n 914:\t{\n 915:\t\tstruct rmnet_priv *priv = netdev_priv(coal_skb-\u003edev);\n 916:\t\tstruct rmnet_pcpu_stats *pcpu_ptr;\n 917:\t\tstruct udphdr *uh;\n 918:\t\tstruct tcphdr *th;\n 919:\t\tu32 avail;\n 920:\t\tu8 *base;\n 921:\t\n 922:\t\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n 923:\t\n 924:\t\tif (meta-\u003eip_len \u003e coal_skb-\u003elen) {\n 925:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 926:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_trans_invalid);\n 927:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 928:\t\t\treturn false;\n 929:\t\t}\n 930:\t\n 931:\t\tbase = (u8 *)meta-\u003eip_header + meta-\u003eip_len;\n 932:\t\tavail = coal_skb-\u003elen - meta-\u003eip_len;\n 933:\t\n 934:\t\tif (meta-\u003etrans_proto == IPPROTO_TCP) {\n 935:\t\t\tif (avail \u003c sizeof(*th)) {\n 936:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 937:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_trans_invalid);\n 938:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 939:\t\t\t\treturn false;\n 940:\t\t\t}\n 941:\t\n 942:\t\t\tth = (struct tcphdr *)base;\n 943:\t\t\tmeta-\u003etrans_len = th-\u003edoff * 4;\n 944:\t\t\tmeta-\u003etrans_header = th;\n 945:\t\t\tif (meta-\u003etrans_len \u003c sizeof(*th) || avail \u003c meta-\u003etrans_len) {\n 946:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 947:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_trans_invalid);\n 948:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 949:\t\t\t\treturn false;\n 950:\t\t\t}\n 951:\t\t} else if (meta-\u003etrans_proto == IPPROTO_UDP) {\n 952:\t\t\tif (avail \u003c sizeof(*uh)) {\n 953:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 954:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_trans_invalid);\n 955:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 956:\t\t\t\treturn false;\n 957:\t\t\t}\n 958:\t\n 959:\t\t\tuh = (struct udphdr *)base;\n 960:\t\t\tmeta-\u003etrans_len = sizeof(*uh);\n 961:\t\t\tmeta-\u003etrans_header = uh;\n 962:\t\t\tif (meta-\u003eip_proto == 4 \u0026\u0026 !uh-\u003echeck)\n 963:\t\t\t\tmeta-\u003ezero_csum = true;\n 964:\t\t} else {\n 965:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n 966:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_trans_invalid);\n 967:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n 968:\t\t\treturn false;\n 969:\t\t}\n 970:\t\n 971:\t\treturn true;\n 972:\t}\n 973:\t\n 974:\t/* Reject the frame unless the total data bytes claimed by all NLOs\n 975:\t * exactly match the actual payload in the SKB. Each pkt_len covers\n 976:\t * IP+transport headers plus per-packet data. Headers appear once, so\n 977:\t * subtract hlen per packet and track the running sum against available\n 978:\t * data. An exact match is required, not just an upper bound, so that\n 979:\t * GSO metadata stamped from the NLOs stays consistent with the real\n 980:\t * SKB length.\n 981:\t */\n 982:\tstatic bool rmnet_map_coal_validate_bounds(struct sk_buff *coal_skb,\n 983:\t\t\t\t\t\t   struct rmnet_map_v5_coal_header *coal_hdr,\n 984:\t\t\t\t\t\t   u8 num_nlos, u32 hlen, bool *gro)\n 985:\t{\n 986:\t\tu32 total_data = 0;\n 987:\t\tu32 nlo_len;\n 988:\t\tu16 plen;\n 989:\t\tu8 i;\n 990:\t\n 991:\t\tif (hlen \u003e coal_skb-\u003elen)\n 992:\t\t\treturn false;\n 993:\t\n 994:\t\tfor (i = 0; i \u003c num_nlos; i++) {\n 995:\t\t\tplen = ntohs(coal_hdr-\u003enl_pairs[i].pkt_len);\n 996:\t\n 997:\t\t\tif (plen \u003c hlen)\n 998:\t\t\t\treturn false;\n 999:\t\n"
}

59/3 2026/10/09 10:48 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 47654
							output: 51
							thoughts: 17
						

Thoughts:
Okay, I'm ready. Let's do this. I'll summarize the text as if the thoughts described are my own.

**Analyzing Lines 1000-1100**

Alright, I'm diving back in. My initial approach will be to scrutinize lines 1000-1100. My methodology hinges on a detailed breakdown of the text at hand; I'll carefully consider the core arguments, rhetorical devices, and any underlying assumptions being made within this particular segment. From my perspective, context is paramount. I'm going to determine how this section builds on the preceding arguments and foreshadows any future developments, constantly cross-referencing to other sources I have available. I need to identify any subtle shifts in tone or emphasis; these are often critical indicators of underlying thematic tensions. Further, I will look for any instances of logical fallacies or inconsistencies. This is where my expertise comes into play: I'll be sifting through the evidence, weighing the claims, and ensuring that everything aligns with the broader framework of the subject matter. My primary goal here is to arrive at a precise, nuanced understanding of the passage's significance.



60/3 2026/10/09 10:48 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c",
  "FirstLine": 1000,
  "LineCount": 100
}

Results:
{
  "Contents": "1000:\t\t\t/* Zero-payload packets cannot use GSO with a zero gso_size. */\n1001:\t\t\tif (plen == hlen)\n1002:\t\t\t\t*gro = false;\n1003:\t\n1004:\t\t\tnlo_len = (u32)(plen - hlen) * coal_hdr-\u003enl_pairs[i].num_packets;\n1005:\t\t\tif (nlo_len \u003e coal_skb-\u003elen - hlen - total_data)\n1006:\t\t\t\treturn false;\n1007:\t\n1008:\t\t\ttotal_data += nlo_len;\n1009:\t\t}\n1010:\t\n1011:\t\treturn total_data == coal_skb-\u003elen - hlen;\n1012:\t}\n1013:\t\n1014:\t/* Attempt the GRO-friendly fast path for a single-NLO, checksum-valid frame\n1015:\t * by reusing the original SKB and stamping GSO metadata instead of copying\n1016:\t * out each segment.  Returns true if the frame was consumed via the fast\n1017:\t * path, or false if the caller should fall back to full segmentation.\n1018:\t */\n1019:\tstatic bool rmnet_map_coal_gro_fast_path(struct sk_buff *coal_skb,\n1020:\t\t\t\t\t\t struct rmnet_map_v5_coal_header *coal_hdr,\n1021:\t\t\t\t\t\t struct rmnet_map_coal_metadata *coal_meta,\n1022:\t\t\t\t\t\t struct sk_buff_head *list,\n1023:\t\t\t\t\t\t u8 num_nlos, bool gro)\n1024:\t{\n1025:\t\tu32 hlen = coal_meta-\u003eip_len + coal_meta-\u003etrans_len;\n1026:\t\n1027:\t\tif (!gro || num_nlos != 1 ||\n1028:\t\t    !(coal_hdr-\u003ecoal_info \u0026 MAPV5_COALINFO_CSUM_VALID_FLAG))\n1029:\t\t\treturn false;\n1030:\t\n1031:\t\tcoal_meta-\u003edata_len = ntohs(coal_hdr-\u003enl_pairs[0].pkt_len) - hlen;\n1032:\t\tcoal_meta-\u003epkt_count = coal_hdr-\u003enl_pairs[0].num_packets;\n1033:\t\n1034:\t\tcoal_skb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n1035:\t\tif (coal_meta-\u003epkt_count \u003e 1) {\n1036:\t\t\trmnet_map_partial_csum(coal_skb, coal_meta);\n1037:\t\t\trmnet_map_gso_stamp(coal_skb, coal_meta);\n1038:\t\t}\n1039:\t\n1040:\t\t__skb_queue_tail(list, coal_skb);\n1041:\t\treturn true;\n1042:\t}\n1043:\t\n1044:\t/* NLO packet lengths are already bounds-checked by\n1045:\t * rmnet_map_coal_validate_bounds() so no further validation is needed here.\n1046:\t */\n1047:\tstatic void rmnet_map_coal_segment_loop(struct sk_buff *coal_skb,\n1048:\t\t\t\t\t\tstruct rmnet_map_v5_coal_header *coal_hdr,\n1049:\t\t\t\t\t\tstruct rmnet_map_coal_metadata *coal_meta,\n1050:\t\t\t\t\t\tstruct sk_buff_head *list,\n1051:\t\t\t\t\t\tu64 nlo_err_mask, bool gro, u8 num_nlos)\n1052:\t{\n1053:\t\tstruct rmnet_priv *priv = netdev_priv(coal_skb-\u003edev);\n1054:\t\tu32 hlen = coal_meta-\u003eip_len + coal_meta-\u003etrans_len;\n1055:\t\tstruct rmnet_pcpu_stats *pcpu_ptr;\n1056:\t\tu8 pkt, total_pkt = 0;\n1057:\t\tbool csum_err;\n1058:\t\tu16 pkt_len;\n1059:\t\tu8 nlo;\n1060:\t\n1061:\t\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n1062:\t\n1063:\t\tfor (nlo = 0; nlo \u003c num_nlos; nlo++) {\n1064:\t\t\tpkt_len = ntohs(coal_hdr-\u003enl_pairs[nlo].pkt_len);\n1065:\t\t\tpkt_len -= hlen;\n1066:\t\t\tcoal_meta-\u003edata_len = pkt_len;\n1067:\t\n1068:\t\t\t/* nlo_err_mask is one flat bitstream across all NLOs. Shift\n1069:\t\t\t * it once per packet in absolute frame order and do not\n1070:\t\t\t * re-align at the NLO boundary above. See the comment on\n1071:\t\t\t * rmnet_map_data_check_coal_header() for why.\n1072:\t\t\t */\n1073:\t\t\tfor (pkt = 0; pkt \u003c coal_hdr-\u003enl_pairs[nlo].num_packets;\n1074:\t\t\t     pkt++, total_pkt++, nlo_err_mask \u003e\u003e= 1) {\n1075:\t\t\t\tcsum_err = nlo_err_mask \u0026 1;\n1076:\t\n1077:\t\t\t\tif (csum_err) {\n1078:\t\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1079:\t\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_csum_err);\n1080:\t\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1081:\t\t\t\t}\n1082:\t\n1083:\t\t\t\tif (!gro) {\n1084:\t\t\t\t\tcoal_meta-\u003epkt_count = 1;\n1085:\t\t\t\t\t__rmnet_map_segment_coal_skb(coal_skb, coal_meta,\n1086:\t\t\t\t\t\t\t\t     list, total_pkt,\n1087:\t\t\t\t\t\t\t\t     !csum_err);\n1088:\t\t\t\t\tcontinue;\n1089:\t\t\t\t}\n1090:\t\n1091:\t\t\t\tif (csum_err) {\n1092:\t\t\t\t\tif (coal_meta-\u003epkt_count)\n1093:\t\t\t\t\t\t__rmnet_map_segment_coal_skb(coal_skb,\n1094:\t\t\t\t\t\t\t\t\t     coal_meta,\n1095:\t\t\t\t\t\t\t\t\t     list,\n1096:\t\t\t\t\t\t\t\t\t     total_pkt -\n1097:\t\t\t\t\t\t\t\t\t     coal_meta-\u003epkt_count,\n1098:\t\t\t\t\t\t\t\t\t     true);\n1099:\t\t\t\t\tcoal_meta-\u003epkt_count = 1;\n"
}

61/3 2026/10/09 10:48 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 49736
							output: 51
							thoughts: 17
						

Thoughts:
Okay, I'm ready. Let's dive in.

**Analyzing Lines 1100-1200: A Focused Examination**

Alright, I'm turning my attention now to lines 1100 through 1200. My initial goal here isn't a surface-level overview, but a deep dive, extracting the core arguments and nuances. I'm focusing on the logical flow, the author's intended implications, and any potential points of contention or areas requiring further investigation. I'm looking for where the author reinforces any themes or introduces anything new within that section. Essentially, I want to form my own assessment, separate from any preconceived notions. I am looking for any relevant examples.



62/3 2026/10/09 10:48 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c",
  "FirstLine": 1100,
  "LineCount": 100
}

Results:
{
  "Contents": "1100:\t\t\t\t\t__rmnet_map_segment_coal_skb(coal_skb, coal_meta,\n1101:\t\t\t\t\t\t\t\t     list, total_pkt,\n1102:\t\t\t\t\t\t\t\t     false);\n1103:\t\t\t\t} else {\n1104:\t\t\t\t\tcoal_meta-\u003epkt_count++;\n1105:\t\t\t\t}\n1106:\t\t\t}\n1107:\t\n1108:\t\t\t/* Flush remaining packets from this NLO */\n1109:\t\t\tif (coal_meta-\u003epkt_count)\n1110:\t\t\t\t__rmnet_map_segment_coal_skb(coal_skb, coal_meta, list,\n1111:\t\t\t\t\t\t\t     total_pkt - coal_meta-\u003epkt_count, true);\n1112:\t\t}\n1113:\t}\n1114:\t\n1115:\t/* Expand a coalesced SKB into individual IP packets placed on the list.\n1116:\t * NLOs with checksum errors are dropped. __rmnet_map_ingress_handler will\n1117:\t * free the SKB in the error case.\n1118:\t */\n1119:\tstatic int rmnet_map_segment_coal_skb(struct sk_buff *coal_skb,\n1120:\t\t\t\t\t      u64 nlo_err_mask,\n1121:\t\t\t\t\t      struct sk_buff_head *list,\n1122:\t\t\t\t\t      u16 len, u16 total_pkts, u8 num_nlos)\n1123:\t{\n1124:\t\tbool gro_hw = coal_skb-\u003edev-\u003efeatures \u0026 NETIF_F_GRO_HW;\n1125:\t\tbool rxcsum = coal_skb-\u003edev-\u003efeatures \u0026 NETIF_F_RXCSUM;\n1126:\t\tstruct rmnet_priv *priv = netdev_priv(coal_skb-\u003edev);\n1127:\t\tstruct rmnet_map_v5_coal_header *coal_hdr;\n1128:\t\tstruct rmnet_map_coal_metadata coal_meta;\n1129:\t\tstruct rmnet_pcpu_stats *pcpu_ptr;\n1130:\t\tbool gro = gro_hw;\n1131:\t\tu32 hlen;\n1132:\t\n1133:\t\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n1134:\t\n1135:\t\tmemset(\u0026coal_meta, 0, sizeof(coal_meta));\n1136:\t\n1137:\t\t/* Drop any MAP frame padding. The coal header is counted in len */\n1138:\t\tskb_pull(coal_skb, sizeof(struct rmnet_map_header));\n1139:\t\tskb_trim(coal_skb, len);\n1140:\t\tcoal_hdr = (struct rmnet_map_v5_coal_header *)coal_skb-\u003edata;\n1141:\t\trmnet_map_v5_set_nlos(coal_hdr, num_nlos);\n1142:\t\tskb_pull(coal_skb, sizeof(*coal_hdr));\n1143:\t\n1144:\t\tif (!rmnet_map_coal_parse_ip_hdr(coal_skb, \u0026coal_meta, \u0026gro))\n1145:\t\t\treturn -EINVAL;\n1146:\t\n1147:\t\tif (!rmnet_map_coal_parse_trans_hdr(coal_skb, \u0026coal_meta))\n1148:\t\t\treturn -EINVAL;\n1149:\t\n1150:\t\thlen = coal_meta.ip_len + coal_meta.trans_len;\n1151:\t\n1152:\t\tif (!rmnet_map_coal_validate_bounds(coal_skb, coal_hdr, num_nlos, hlen,\n1153:\t\t\t\t\t\t    \u0026gro)) {\n1154:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1155:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_bounds_err);\n1156:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1157:\t\t\treturn -EINVAL;\n1158:\t\t}\n1159:\t\n1160:\t\t/* Device capability gates coalesced delivery. Packet format can still\n1161:\t\t * disable GSO and use the per-packet fallback below.\n1162:\t\t */\n1163:\t\tif (total_pkts \u003e 1 \u0026\u0026 (!rxcsum || !gro_hw))\n1164:\t\t\treturn -EINVAL;\n1165:\t\n1166:\t\tif (gro \u0026\u0026 total_pkts \u003e 1) {\n1167:\t\t\t/* Standard counters cover delivered HW-GRO skbs. coal_rx and\n1168:\t\t\t * coal_pkts cover coalescing input regardless of HW-GRO.\n1169:\t\t\t */\n1170:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1171:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.rx_hw_gro_packets);\n1172:\t\t\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.rx_hw_gro_wire_packets, total_pkts);\n1173:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1174:\t\t}\n1175:\t\n1176:\t\tif (total_pkts == 1 \u0026\u0026 (!rxcsum || !gro_hw)) {\n1177:\t\t\tcoal_skb-\u003eip_summed = CHECKSUM_NONE;\n1178:\t\t\t__skb_queue_tail(list, coal_skb);\n1179:\t\t\treturn 0;\n1180:\t\t}\n1181:\t\n1182:\t\tif (rmnet_map_v5_csum_fixup(coal_hdr) \u0026\u0026 !coal_meta.zero_csum) {\n1183:\t\t\tcoal_skb-\u003eip_summed = CHECKSUM_NONE;\n1184:\t\t\t__skb_queue_tail(list, coal_skb);\n1185:\t\t\treturn 0;\n1186:\t\t}\n1187:\t\n1188:\t\tif (rmnet_map_coal_gro_fast_path(coal_skb, coal_hdr, \u0026coal_meta, list,\n1189:\t\t\t\t\t\t num_nlos, gro))\n1190:\t\t\treturn 0;\n1191:\t\n1192:\t\trmnet_map_coal_segment_loop(coal_skb, coal_hdr, \u0026coal_meta, list,\n1193:\t\t\t\t\t    nlo_err_mask, gro, num_nlos);\n1194:\t\n1195:\t\treturn 0;\n1196:\t}\n1197:\t\n1198:\t/* Log the hardware close-reason counter for a coalescing header. */\n1199:\tstatic void rmnet_map_data_log_close_stats(struct rmnet_pcpu_stats *pcpu_ptr,\n"
}

63/3 2026/10/09 10:48 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 51785
							output: 51
							thoughts: 17
						

Thoughts:
Okay, I'm ready to dive into that text and synthesize its key ideas as if they're my own thoughts. Here's my take:

**Analyzing Lines 1200-1340: A Deep Dive**

Alright, time to get back to it. Let's see what these lines have in store for us. I'm focusing on lines 1200-1340, specifically. As an expert in this, I'm already anticipating the nuances and potential complexities these specific lines might contain. I'm looking for the core arguments being developed, any subtle shifts in perspective, and importantly, how this section fits into the larger framework of the argument or narrative. The context is vital here. Is this building on something established earlier, or introducing a new thread? I'm paying close attention to the evidence presented, assessing its strength and relevance. I'm also considering potential counterarguments – what are the implicit assumptions, and are there alternative interpretations? My goal is to extract the essential components of the author's message and determine whether I agree with them or where they might diverge from other viewpoints that are common knowledge in this field. I'm looking for where this section will lead me.



64/3 2026/10/09 10:48 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c",
  "FirstLine": 1200,
  "LineCount": 100
}

Results:
{
  "Contents": "1200:\t\t\t\t\t\t   u8 type, u8 code)\n1201:\t{\n1202:\t\tswitch (type) {\n1203:\t\tcase RMNET_MAP_COAL_CLOSE_NON_COAL:\n1204:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1205:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_non_coal);\n1206:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1207:\t\t\tbreak;\n1208:\t\tcase RMNET_MAP_COAL_CLOSE_IP_MISS:\n1209:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1210:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_ip_miss);\n1211:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1212:\t\t\tbreak;\n1213:\t\tcase RMNET_MAP_COAL_CLOSE_TRANS_MISS:\n1214:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1215:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_trans_miss);\n1216:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1217:\t\t\tbreak;\n1218:\t\tcase RMNET_MAP_COAL_CLOSE_HW:\n1219:\t\t\tswitch (code) {\n1220:\t\t\tcase RMNET_MAP_COAL_CLOSE_HW_NL:\n1221:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1222:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_hw_nl);\n1223:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1224:\t\t\t\tbreak;\n1225:\t\t\tcase RMNET_MAP_COAL_CLOSE_HW_PKT:\n1226:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1227:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_hw_pkt);\n1228:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1229:\t\t\t\tbreak;\n1230:\t\t\tcase RMNET_MAP_COAL_CLOSE_HW_BYTE:\n1231:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1232:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_hw_byte);\n1233:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1234:\t\t\t\tbreak;\n1235:\t\t\tcase RMNET_MAP_COAL_CLOSE_HW_TIME:\n1236:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1237:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_hw_time);\n1238:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1239:\t\t\t\tbreak;\n1240:\t\t\tcase RMNET_MAP_COAL_CLOSE_HW_EVICT:\n1241:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1242:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_hw_evict);\n1243:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1244:\t\t\t\tbreak;\n1245:\t\t\tdefault:\n1246:\t\t\t\tbreak;\n1247:\t\t\t}\n1248:\t\t\tbreak;\n1249:\t\tcase RMNET_MAP_COAL_CLOSE_COAL:\n1250:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1251:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_close_coal);\n1252:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1253:\t\t\tbreak;\n1254:\t\tdefault:\n1255:\t\t\tbreak;\n1256:\t\t}\n1257:\t}\n1258:\t\n1259:\t/* Validate the coalescing header and build the checksum error mask.\n1260:\t *\n1261:\t * Checks performed:\n1262:\t *  - MAP pkt_len accommodates the coal header (coal header is counted in\n1263:\t *    pkt_len. pkt_len \u003c sizeof(*coal_hdr) means no payload is possible).\n1264:\t *  - num_nlos is in [1, RMNET_MAP_V5_MAX_NLOS].\n1265:\t *  - Total packet count does not exceed RMNET_MAP_V5_MAX_PACKETS.\n1266:\t *\n1267:\t * nlo_err_mask is NOT six independent per-NLO bitmaps. Each nl_pairs\n1268:\t * slot only has room for an 8 bit csum_error_bitmap, but a single NLO\n1269:\t * can carry more than 8 packets (up to RMNET_MAP_V5_MAX_PACKETS), so\n1270:\t * hardware spills a wide NLO's error bits into the csum_error_bitmap\n1271:\t * bytes of the following slots rather than truncating them. The\n1272:\t * six bitmap bytes are therefore always concatenated in slot order\n1273:\t * into one flat RMNET_MAP_V5_MAX_NLOS * 8 = RMNET_MAP_V5_MAX_PACKETS\n1274:\t * bit value, addressed by a packet's absolute position in the frame,\n1275:\t * regardless of how many NLOs are actually in use. Receivers must\n1276:\t * walk it as a single contiguous stream and must not expect it to\n1277:\t * align it at NLO boundaries.\n1278:\t */\n1279:\tstatic int rmnet_map_data_check_coal_header(struct sk_buff *skb,\n1280:\t\t\t\t\t\t    u64 *nlo_err_mask,\n1281:\t\t\t\t\t\t    u8 *num_nlos,\n1282:\t\t\t\t\t\t    u16 *num_pkts)\n1283:\t{\n1284:\t\tstruct rmnet_map_header *maph = (struct rmnet_map_header *)skb-\u003edata;\n1285:\t\tstruct rmnet_priv *priv = netdev_priv(skb-\u003edev);\n1286:\t\tstruct rmnet_map_v5_coal_header *coal_hdr;\n1287:\t\tstruct rmnet_pcpu_stats *pcpu_ptr;\n1288:\t\tu16 pkts = 0;\n1289:\t\tu64 mask = 0;\n1290:\t\tint nlos;\n1291:\t\tint i;\n1292:\t\n1293:\t\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n1294:\t\n1295:\t\t/* coal header is counted in pkt_len */\n1296:\t\tif (ntohs(maph-\u003epkt_len) \u003c sizeof(*coal_hdr)) {\n1297:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1298:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_hdr_err);\n1299:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n"
}

65/3 2026/10/09 10:48 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 54136
							output: 50
							thoughts: 17
						

Thoughts:
Okay, I'm ready to dive into that text and synthesize those thoughts! Here's my perspective on lines 1300-1380, keeping in mind my expertise and the need for a fulsome summary:

**Analyzing Lines 1300-1380: A Deep Dive**

Alright, let's get down to brass tacks. I'm focusing on lines 1300-1380. My immediate thought is, "What specific argument or data set does this section contribute to?" Given my deep knowledge of the subject matter, I'm already anticipating the potential nuances. I want to pinpoint the author's primary objective within this segment. Are they establishing a baseline, critiquing a methodology, presenting new findings, or perhaps offering a synthesis of disparate viewpoints? The context will be key, and I’m ready to dissect the surrounding text to grasp the logical flow.

I'm mentally outlining potential themes I expect to see explored here. Given the line range, I'm expecting something potentially substantial, likely building on a previous idea or setting the stage for a later argument. I'm also preparing myself to analyze the author's chosen rhetoric. Are they using technical jargon, hedging their claims, or employing a more direct, assertive style? The rhetorical choices will reveal a lot about their confidence in the material.

As I read, I'll be meticulously evaluating the evidence presented, looking for any weaknesses in their logic or areas where the argumentation could be strengthened. I'm not just passively absorbing information; I'm actively questioning assumptions and constantly comparing their claims to my existing knowledge base. My brain is already starting to generate a list of counterarguments and supporting data from my own research. I'll need to see if the author addresses these potential challenges.

My expert eye is focused on noticing and marking any inconsistencies or contradictions within the text. Does the author adhere consistently to their stated methodology? Are there any logical leaps or unsupported conclusions? I'm already prepared to look for any hidden biases or subjective interpretations that might influence their findings.

I'm prepared to carefully evaluate any conclusions drawn in this section. Are they appropriate given the presented evidence? Do they represent a significant advancement, or are they minor contributions? I'm also considering the implications of these findings, and in which direction this section pushes the overall argument. Are we moving toward a broader synthesis, or are we examining a small sub-piece of the issue?

In summary, this segment will be thoroughly scrutinized. I'm expecting a carefully considered and well-supported discussion to justify my time and that of other experts.



66/3 2026/10/09 10:48 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c",
  "FirstLine": 1300,
  "LineCount": 80
}

Results:
{
  "Contents": "1300:\t\t\treturn -EINVAL;\n1301:\t\t}\n1302:\t\n1303:\t\tcoal_hdr = (struct rmnet_map_v5_coal_header *)(skb-\u003edata + sizeof(*maph));\n1304:\t\tnlos = rmnet_map_v5_get_num_nlos(coal_hdr);\n1305:\t\tif (nlos \u003c 0) {\n1306:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1307:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_hdr_err);\n1308:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1309:\t\t\treturn -EINVAL;\n1310:\t\t}\n1311:\t\n1312:\t\t*num_nlos = nlos;\n1313:\t\tfor (i = 0; i \u003c RMNET_MAP_V5_MAX_NLOS; i++) {\n1314:\t\t\tu8 err = coal_hdr-\u003enl_pairs[i].csum_error_bitmap;\n1315:\t\t\tu8 pkt = coal_hdr-\u003enl_pairs[i].num_packets;\n1316:\t\n1317:\t\t\tmask |= ((u64)err) \u003c\u003c (8 * i);\n1318:\t\t\tif (i \u003c *num_nlos) {\n1319:\t\t\t\tpkts += pkt;\n1320:\t\t\t\tif (pkts \u003e RMNET_MAP_V5_MAX_PACKETS) {\n1321:\t\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1322:\t\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_hdr_pkt_err);\n1323:\t\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1324:\t\t\t\t\treturn -EINVAL;\n1325:\t\t\t\t}\n1326:\t\t\t}\n1327:\t\t}\n1328:\t\n1329:\t\t/* coal_pkts counts packets reported by the hardware, independent of\n1330:\t\t * whether the frame is later delivered through HW-GRO.\n1331:\t\t */\n1332:\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1333:\t\tu64_stats_add(\u0026pcpu_ptr-\u003epriv_stats.coal_pkts, pkts);\n1334:\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1335:\t\trmnet_map_data_log_close_stats(pcpu_ptr,\n1336:\t\t\t\t\t       u8_get_bits(coal_hdr-\u003eclose_info,\n1337:\t\t\t\t\t\t\t   MAPV5_CLOSEINFO_CLOSE_TYPE_FMASK),\n1338:\t\t\t\t\t       u8_get_bits(coal_hdr-\u003eclose_info,\n1339:\t\t\t\t\t\t\t   MAPV5_CLOSEINFO_CLOSE_VALUE_FMASK));\n1340:\t\n1341:\t\t*nlo_err_mask = mask;\n1342:\t\t*num_pkts = pkts;\n1343:\t\treturn 0;\n1344:\t}\n1345:\t\n1346:\tint rmnet_map_process_next_hdr_packet(struct sk_buff *skb,\n1347:\t\t\t\t\t      struct sk_buff_head *list,\n1348:\t\t\t\t\t      u16 len, u32 data_format)\n1349:\t{\n1350:\t\tstruct rmnet_priv *priv = netdev_priv(skb-\u003edev);\n1351:\t\tstruct rmnet_pcpu_stats *pcpu_ptr;\n1352:\t\tu64 nlo_err_mask;\n1353:\t\tu16 num_pkts;\n1354:\t\tu8 num_nlos;\n1355:\t\tint rc;\n1356:\t\n1357:\t\tpcpu_ptr = this_cpu_ptr(priv-\u003epcpu_stats);\n1358:\t\n1359:\t\tswitch (rmnet_map_get_next_hdr_type(skb)) {\n1360:\t\tcase RMNET_MAP_HEADER_TYPE_COALESCING:\n1361:\t\t\tif (!(data_format \u0026 RMNET_FLAGS_INGRESS_COALESCE))\n1362:\t\t\t\treturn -EINVAL;\n1363:\t\n1364:\t\t\t/* coal_rx counts coalescing input, not delivered HW-GRO skbs. */\n1365:\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1366:\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.coal_rx);\n1367:\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1368:\t\t\trc = rmnet_map_data_check_coal_header(skb, \u0026nlo_err_mask,\n1369:\t\t\t\t\t\t\t      \u0026num_nlos, \u0026num_pkts);\n1370:\t\t\tif (rc)\n1371:\t\t\t\treturn rc;\n1372:\t\n1373:\t\t\t/* Coalescing rewrites shared packet data and GSO metadata. */\n1374:\t\t\tif (skb_unclone(skb, GFP_ATOMIC))\n1375:\t\t\t\treturn -ENOMEM;\n1376:\t\n1377:\t\t\trc = rmnet_map_segment_coal_skb(skb, nlo_err_mask, list, len,\n1378:\t\t\t\t\t\t\tnum_pkts, num_nlos);\n1379:\t\t\tif (rc)\n"
}

67/3 2026/10/09 10:48 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 56217
							output: 50
							thoughts: 17
						

Thoughts:
Okay, I'm ready to summarize those lines as my own thoughts, given my expertise in the field. Here we go:

**Digging Deeper: Lines 1380-1410**

Alright, I'm diving into lines 1380-1410. Let's see what we've got. Based on the context I've established, I'm expecting this section to elaborate on [Insert your expert understanding of the likely subject matter based on your prompt] It needs to be precise and build on the overall structure I've developed so far. I'm looking for the key arguments, evidence, or methodologies presented here. Are there any novel viewpoints emerging? Is it consistent with the overall thesis? I'm assessing this with a critical eye, considering the validity and implications. I want to identify any potential weaknesses or gaps in the reasoning. I'm going to determine if the author's claims are sufficiently supported, and whether this section advances our current understanding of the subject. I'm looking for connections to any existing literature or competing perspectives I know of. I'll need to remember any specific details here to form a complete understanding. Time to assess whether this lines fit in with previous material. I must see if there's any inconsistencies here or whether it is logically presented.



68/3 2026/10/09 10:48 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c",
  "FirstLine": 1380,
  "LineCount": 40
}

Results:
{
  "Contents": "1380:\t\t\t\treturn rc;\n1381:\t\n1382:\t\t\tif (skb_peek(list) != skb) {\n1383:\t\t\t\tif (skb_queue_empty(list))\n1384:\t\t\t\t\tkfree_skb(skb);\n1385:\t\t\t\telse\n1386:\t\t\t\t\tconsume_skb(skb);\n1387:\t\t\t}\n1388:\t\t\tbreak;\n1389:\t\n1390:\t\tcase RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD:\n1391:\t\t\tif (unlikely(!(skb-\u003edev-\u003efeatures \u0026 NETIF_F_RXCSUM))) {\n1392:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1393:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_sw);\n1394:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1395:\t\t\t} else if (rmnet_map_get_csum_valid(skb)) {\n1396:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1397:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_ok);\n1398:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1399:\t\t\t\tskb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n1400:\t\t\t} else {\n1401:\t\t\t\tu64_stats_update_begin(\u0026pcpu_ptr-\u003esyncp);\n1402:\t\t\t\tu64_stats_inc(\u0026pcpu_ptr-\u003epriv_stats.csum_valid_unset);\n1403:\t\t\t\tu64_stats_update_end(\u0026pcpu_ptr-\u003esyncp);\n1404:\t\t\t}\n1405:\t\n1406:\t\t\tskb_pull(skb, sizeof(struct rmnet_map_header) +\n1407:\t\t\t\t      sizeof(struct rmnet_map_v5_csum_header));\n1408:\t\t\tskb_trim(skb, len);\n1409:\t\t\t__skb_queue_tail(list, skb);\n1410:\t\t\tbreak;\n1411:\t\n1412:\t\tdefault:\n1413:\t\t\treturn -EINVAL;\n1414:\t\t}\n1415:\t\n1416:\t\treturn 0;\n1417:\t}\n1418:\t\n1419:\t#define RMNET_AGG_BYPASS_TIME_NSEC 10000000L\n"
}

69/3 2026/10/09 10:48 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 57257
							output: 44
							thoughts: 559
						

Thoughts:
**Analyzing Packet Length Validation in RMNET Mapping**

Okay, let's break down this `rmnet_map_validate_packet_len` function. It looks like it's crucial for validating the length of RMNET packets, specifically in `drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c`. My initial observation is that it aims to determine the valid length of an incoming `sk_buff` based on its structure and flags.

First, it checks if the packet is even large enough to contain the basic `rmnet_map_header`. If not, it bails out. Then, there's a quick check for the `MAP_CMD_FLAG`. If set, it returns the size of just the header. Otherwise, the function calculates the length considering other header types.

I can see the function dealing with different checksum and coalescing formats: `RMNET_FLAGS_INGRESS_MAP_CKSUMV4`, and a more complex conditional for `RMNET_FLAGS_INGRESS_MAP_CKSUMV5` and `RMNET_FLAGS_INGRESS_COALESCE`. If it's V5 with checksum or coalescing, and it's not a command, it verifies the existence of a `MAP_NEXT_HEADER_FLAG`. Then, it checks if the buffer has enough data for a `rmnet_map_v5_csum_header`. The `header_info` field within that header is examined to understand the type, and based on the type (`RMNET_MAP_HEADER_TYPE_CSUM_OFFLOAD` or `RMNET_MAP_HEADER_TYPE_COALESCING`), it updates the packet length. If it's something else, then the function will return 0.

Finally, the function compares the calculated length with the actual `skb->len`. If the calculated length exceeds the buffer length, it returns 0, indicating invalid. Otherwise, it returns the calculated `packet_len`.

I need to understand how this is used within the overall RMNET data flow, so I'll grep for the function name to see where it's called.



70/3 2026/10/09 10:48 tool grepper
0m Args:
{
  "Expression": "rmnet_map_validate_packet_len",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c=123=rmnet_map_ingress_handler(struct sk_buff *skb,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-145-\t} else {\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c:146:\t\tif (rmnet_map_validate_packet_len(skb, data_format))\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-147-\t\t\t__rmnet_map_ingress_handler(skb, port, data_format);\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map.h=79=void rmnet_map_update_ul_agg_config(struct rmnet_port *port, u32 size,\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map.h-80-\t\t\t\t    u32 count, u32 time);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map.h:81:u32 rmnet_map_validate_packet_len(struct sk_buff *skb, u32 data_format);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map.h-82-\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c=345=struct rmnet_map_header *rmnet_map_add_map_header(struct sk_buff *skb,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c-385-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:386:u32 rmnet_map_validate_packet_len(struct sk_buff *skb, u32 data_format)\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c-387-{\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c=437=struct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c-442-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:443:\tpacket_len = rmnet_map_validate_packet_len(skb, data_format);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c-444-\tif (!packet_len)\n"
}

71/3 2026/10/09 10:48 llm kmsan-evaluator
1m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 58993
							output: 49
							thoughts: 45
						

Thoughts:
Okay, let's dive into this. Here's my take on those thoughts, as if they're my own:

**Investigating the Deaggregation Process**

Alright, I'm thinking about the deaggregation process right now, and I'd like to get a clearer picture of what's happening. My gut tells me that the key to understanding this is going to be in the code, so I'm focusing my attention on `drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c`. Specifically, I'm going to jump in around line 440. That's usually a good spot to start digging into the packet handling or data structure manipulation in this driver. Let's see what gems are hidden there.



72/3 2026/10/09 10:49 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c",
  "FirstLine": 430,
  "LineCount": 40
}

Results:
{
  "Contents": " 430:\t\n 431:\t/* Deaggregates a single packet\n 432:\t * A whole new buffer is allocated for each portion of an aggregated frame.\n 433:\t * Caller should keep calling deaggregate() on the source skb until 0 is\n 434:\t * returned, indicating that there are no more packets to deaggregate. Caller\n 435:\t * is responsible for freeing the original skb.\n 436:\t */\n 437:\tstruct sk_buff *rmnet_map_deaggregate(struct sk_buff *skb,\n 438:\t\t\t\t\t      u32 data_format)\n 439:\t{\n 440:\t\tstruct sk_buff *skbn;\n 441:\t\tu32 packet_len;\n 442:\t\n 443:\t\tpacket_len = rmnet_map_validate_packet_len(skb, data_format);\n 444:\t\tif (!packet_len)\n 445:\t\t\treturn NULL;\n 446:\t\n 447:\t\tskbn = alloc_skb(packet_len + RMNET_MAP_DEAGGR_SPACING, GFP_ATOMIC);\n 448:\t\tif (!skbn)\n 449:\t\t\treturn NULL;\n 450:\t\n 451:\t\tskbn-\u003edev = skb-\u003edev;\n 452:\t\tskb_reserve(skbn, RMNET_MAP_DEAGGR_HEADROOM);\n 453:\t\tskb_put(skbn, packet_len);\n 454:\t\tmemcpy(skbn-\u003edata, skb-\u003edata, packet_len);\n 455:\t\tskb_pull(skb, packet_len);\n 456:\t\n 457:\t\treturn skbn;\n 458:\t}\n 459:\t\n 460:\t/* Validates packet checksums. Function takes a pointer to\n 461:\t * the beginning of a buffer which contains the IP payload +\n 462:\t * padding + checksum trailer.\n 463:\t * Only IPv4 and IPv6 are supported along with TCP \u0026 UDP.\n 464:\t * Fragmented or tunneled packets are not supported.\n 465:\t */\n 466:\tint rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len)\n 467:\t{\n 468:\t\tstruct rmnet_priv *priv = netdev_priv(skb-\u003edev);\n 469:\t\tstruct rmnet_map_dl_csum_trailer *csum_trailer;\n"
}

73/3 2026/10/09 10:49 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 59918
							output: 41
							thoughts: 2309
						

Thoughts:
**Analyzing RMNET Coalescing and Potential Vulnerabilities**

Okay, let's break this down. First, I need to understand what's happening in `rmnet_map_deaggregate` and, specifically, how the packet length is being validated. `rmnet_map_validate_packet_len` is key here. I see that it now includes checks for MAPv5 coalescing and csum offload. Previously, there was a difference in how csum offload and coalescing were handled. The crucial part is how `pkt_len` from the `rmnet_map_header` is used. For coalescing, `pkt_len` *includes* the coalescing header, but for csum offload it doesn't. That makes sense because the coalescing header is part of the "packet length" conceptually. The validation now appears to account for both scenarios correctly by checking the `hdr_type` field in the `next_hdr`.  The code validates `skb->len` against the calculated `packet_len`, ensuring the packet isn't truncated.

Now, let's look at `__rmnet_map_segment_coal_skb`. This function seems to be responsible for creating new skbs from the coalesced packets. `alloc_skb` allocates the new skb, `skb_reserve` sets the starting data pointer, and `skb_put_data` actually copies the data from the source (`coal_skb`). Then, both IP and transport headers are pushed on. The key observation is that *all* the data in the newly created `skbn` is copied from the source `coal_skb` or from meta-data obtained from `coal_skb` i.e. `coal_meta`. So, from a data initialization perspective, I don't see any immediate uninitialized memory problems.  However, this heavily relies on that the `coal_skb` and meta-data are valid and well-formed.

That brings me to a critical question: Could there be issues with how `coal_skb` is prepared, specifically regarding padding and data length? Let me trace where `len` comes from. I'm looking at `__rmnet_map_ingress_handler`. Here, `len` is calculated as `ntohs(map_header->pkt_len) - pad;`.  The interesting part is that `pad` is extracted from the `flags` field of the `map_header`. The function seems to assume that pad is valid by deducting it from the packet length. Let's see if there is any other checks on `pad`.

Let me look for where the padding length is validated. I'll search for `MAP_PAD_LEN_MASK`.  Wait a minute. I can see the validation in `rmnet_map_validate_packet_len`:
In `rmnet_map_validate_packet_len`:
```c
	packet_len = sizeof(*maph);
	packet_len += ntohs(maph->pkt_len);
...
	if (skb->len < packet_len)
		return 0;
```
Okay, `rmnet_map_validate_packet_len` ensures that `skb->len` is greater than or equal to `packet_len`. And `len = ntohs(map_header->pkt_len) - pad;`. I see the risk: if `pad > ntohs(map_header->pkt_len)`, then `len` would be negative, which is not checked in `__rmnet_map_segment_coal_skb`. This is something to consider!



74/3 2026/10/09 10:50 tool grepper
0m Args:
{
  "Expression": "MAP_PAD_LEN_MASK",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c=66=__rmnet_map_ingress_handler(struct sk_buff *skb,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-84-\tmux_id = map_header-\u003emux_id;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c:85:\tpad = map_header-\u003eflags \u0026 MAP_PAD_LEN_MASK;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-86-\tlen = ntohs(map_header-\u003epkt_len) - pad;\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c=345=struct rmnet_map_header *rmnet_map_add_map_header(struct sk_buff *skb,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c-366-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:367:\tBUILD_BUG_ON(MAP_PAD_LEN_MASK \u003c 3);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c-368-\tpadding = ALIGN(map_datalen, 4) - map_datalen;\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c-380-\t/* This is a data packet, so the CMD bit is 0 */\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:381:\tmap_header-\u003eflags = padding \u0026 MAP_PAD_LEN_MASK;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c-382-\n"
}

75/3 2026/10/09 10:50 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 63517
							output: 43
							thoughts: 983
						

Thoughts:
**Analyzing Potential Integer Underflow and Uninitialized Memory in RMNET Driver**

Okay, so I'm looking at this RMNET code and focusing on how packet length and buffer manipulation interact, particularly in the context of the coal header. My initial thought is about the use of `len`. I see it being used in `rmnet_map_data_check_coal_header` and `rmnet_map_segment_coal_skb`. Specifically, I'm concerned about the case where `len` could be less than the size of `*coal_hdr`.

I need to confirm the sequence of events. First, `rmnet_map_data_check_coal_header` checks if `ntohs(maph->pkt_len)` is less than `sizeof(*coal_hdr)`. Then, later, in `rmnet_map_segment_coal_skb`, we trim the `coal_skb` using `skb_trim(coal_skb, len)`, and then we try to `skb_pull(coal_skb, sizeof(*coal_hdr))`.

Here's the problem: if `ntohs(maph->pkt_len)` is greater than or equal to `sizeof(*coal_hdr)`, and we trim `coal_skb` to a *smaller* value `len` that *is less* than `sizeof(*coal_hdr)`, then the subsequent `skb_pull` would try to read beyond the remaining buffer size. That would be an integer underflow issue and lead to an out-of-bounds read or write. Fortunately, KASAN (Kernel Address Sanitizer) should catch this kind of buffer overread/underflow, but it's crucial to understand the vulnerability.

Now I need to address the uninitialized memory issue. I'm going through the code looking for variables that are read before they're written to. The most relevant parts are in `rmnet_config.c`. Specifically, I'm focused on the `data_format` variable in the `rmnet_changelink` and `rmnet_newlink` functions. In `rmnet_changelink`, `data_format` is initialized only within an `if (data[IFLA_RMNET_FLAGS])` block, but its value is subsequently used. I've to confirm that `data_format` isn't used before being initialized in all possible execution paths.

In `rmnet_newlink`, the situation is better because `data_format` is initialized to `RMNET_FLAGS_INGRESS_DEAGGREGATION` at the top of the function. Now I should verify the code around `rmnet_newlink`.

So, the key takeaway is that the underflow vulnerability is the most serious and is likely to be caught by KASAN. We need to be careful to make sure that len is initialized correctly. The uninitialized memory is the second important item to verify and ensure that data is read before write, which could be an issue too.



76/3 2026/10/09 10:50 tool grepper
0m Args:
{
  "Expression": "data_format",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=24=static int rmnet_is_real_dev_registered(const struct net_device *real_dev)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-36- */\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:37:static bool rmnet_config_data_format_valid(u32 data_format)\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-38-{\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-43-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:44:\tif ((data_format \u0026 v4_mask) \u0026\u0026 (data_format \u0026 v5_mask))\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-45-\t\treturn false;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-46-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:47:\tif ((data_format \u0026 RMNET_FLAGS_INGRESS_COALESCE) \u0026\u0026\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:48:\t    !(data_format \u0026 RMNET_FLAGS_INGRESS_MAP_CKSUMV5))\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-49-\t\treturn false;\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=145=static int rmnet_newlink(struct net_device *dev,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-149-\tstruct net *link_net = rtnl_newlink_link_net(params);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:150:\tu32 data_format = RMNET_FLAGS_INGRESS_DEAGGREGATION;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-151-\tstruct nlattr **data = params-\u003edata;\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-174-\t\tflags = nla_data(data[IFLA_RMNET_FLAGS]);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:175:\t\tdata_format \u0026= ~flags-\u003emask;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:176:\t\tdata_format |= flags-\u003eflags \u0026 flags-\u003emask;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-177-\t}\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-178-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:179:\tif (!rmnet_config_data_format_valid(data_format)) {\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-180-\t\tNL_SET_ERR_MSG_MOD(extack,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-196-\terr = rmnet_vnd_newlink(mux_id, dev, port, real_dev, ep, extack,\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:197:\t\t\t\tdata_format);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-198-\tif (err)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-205-\t/* Update existing MTUs before publishing the shared data format. */\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:206:\terr = rmnet_vnd_update_dev_mtu(port, real_dev, data_format);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-207-\tif (err)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-214-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:215:\tnetdev_dbg(dev, \"data format [0x%08X]\\n\", data_format);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:216:\tWRITE_ONCE(port-\u003edata_format, data_format);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-217-\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=338=static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-345-\tstruct rmnet_port *port;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:346:\tu32 old_data_format;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:347:\tu32 data_format;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-348-\tu16 mux_id;\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-366-\tif (data[IFLA_RMNET_FLAGS]) {\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:367:\t\told_data_format = READ_ONCE(port-\u003edata_format);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-368-\t\tflags = nla_data(data[IFLA_RMNET_FLAGS]);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:369:\t\tdata_format = old_data_format \u0026 ~flags-\u003emask;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:370:\t\tdata_format |= flags-\u003eflags \u0026 flags-\u003emask;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-371-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:372:\t\tif (!rmnet_config_data_format_valid(data_format)) {\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-373-\t\t\tNL_SET_ERR_MSG_MOD(extack,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-404-\tif (data[IFLA_RMNET_FLAGS]) {\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:405:\t\terr = rmnet_vnd_update_dev_mtu(port, real_dev, data_format);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-406-\t\tif (err) {\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-410-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:411:\t\tWRITE_ONCE(port-\u003edata_format, data_format);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-412-\t}\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c=426=static int rmnet_fill_info(struct sk_buff *skb, const struct net_device *dev)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-436-\tport = rmnet_get_port_rcu(priv-\u003ereal_dev);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:437:\tf.flags = port ? READ_ONCE(port-\u003edata_format) : 0;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.c-438-\trcu_read_unlock();\n"
}

77/3 2026/10/09 10:50 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 67279
							output: 47
							thoughts: 32
						

Thoughts:
Here's my take on the thought process, presented as a first-person summary geared towards an expert:

**Diving into `rmnet_fill_info`**

Okay, I'm going to take a closer look at this `rmnet_fill_info` function. Seems like it's a key part of the rmnet configuration. Time to dig into the code and see what makes it tick. Let's start by cracking open `rmnet_config.c`. Understanding its role here will be crucial. I'm especially interested in how it interacts with the lower layers and what data structures it might be manipulating. I anticipate this will reveal a core aspect of how the RMNET driver populates and potentially handles interface information.



78/3 2026/10/09 10:50 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c",
  "FirstLine": 425,
  "LineCount": 30
}

Results:
{
  "Contents": " 425:\t\n 426:\tstatic int rmnet_fill_info(struct sk_buff *skb, const struct net_device *dev)\n 427:\t{\n 428:\t\tconst struct rmnet_priv *priv = netdev_priv(dev);\n 429:\t\tconst struct rmnet_port *port;\n 430:\t\tstruct ifla_rmnet_flags f;\n 431:\t\n 432:\t\tif (nla_put_u16(skb, IFLA_RMNET_MUX_ID, READ_ONCE(priv-\u003emux_id)))\n 433:\t\t\treturn -EMSGSIZE;\n 434:\t\n 435:\t\trcu_read_lock();\n 436:\t\tport = rmnet_get_port_rcu(priv-\u003ereal_dev);\n 437:\t\tf.flags = port ? READ_ONCE(port-\u003edata_format) : 0;\n 438:\t\trcu_read_unlock();\n 439:\t\n 440:\t\tf.mask  = ~0;\n 441:\t\n 442:\t\tif (nla_put(skb, IFLA_RMNET_FLAGS, sizeof(f), \u0026f))\n 443:\t\t\treturn -EMSGSIZE;\n 444:\t\n 445:\t\treturn 0;\n 446:\t}\n 447:\t\n 448:\tstruct rtnl_link_ops rmnet_link_ops __read_mostly = {\n 449:\t\t.kind\t\t= \"rmnet\",\n 450:\t\t.maxtype\t= IFLA_RMNET_MAX,\n 451:\t\t.priv_size\t= sizeof(struct rmnet_priv),\n 452:\t\t.setup\t\t= rmnet_vnd_setup,\n 453:\t\t.validate\t= rmnet_rtnl_validate,\n 454:\t\t.newlink\t= rmnet_newlink,\n"
}

79/3 2026/10/09 10:50 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 68027
							output: 36
							thoughts: 960
						

Thoughts:
**Deep Dive into RMNET Coal Header Processing**

Okay, so this patch didn't touch `rmnet_fill_info`, good to know. Now, let's really dig into `rmnet_map_data_check_coal_header` and `rmnet_map_segment_coal_skb`. First, in `rmnet_map_segment_coal_skb`, I see that `coal_meta` is explicitly zeroed out with `memset`. That's important; it's the starting point. Then, `rmnet_map_coal_parse_ip_hdr` populates `coal_meta` with IP-related information: protocol, length, header pointer, etc. Following that, `rmnet_map_coal_parse_trans_hdr` handles the transport header, setting the length, header pointer and `zero_csum`. Finally, the fast path and segment loop use this information to determine data length, packet counts and offsets, which all seem to be initialized properly.

But, hang on, what about those input parameters: `nlo_err_mask`, `num_nlos`, and `num_pkts` in `rmnet_map_data_check_coal_header`? They are passed as pointers and are only set if the function returns success. So, if an error happens, the caller doesn't get bad data, which is as it should be.

Okay, now let's go deeper. `nlos = rmnet_map_v5_get_num_nlos(coal_hdr);`. `coal_hdr` is coming from packet data, so the number of NLOS is defined by the contents of the received packet. If no NLOS packets are defined, it returns an error, which makes sense. I see that the function iterates through the NLOS pairs until a zero is found.

One last thing, what about `ipv6_skip_exthdr`? I'm checking to make sure that `frag_off` is properly initialized, and it looks like it is. It's passed to `ipv6_skip_exthdr`, and that should initialize it. Now, I should probably grep to be absolutely certain... just to be safe.



80/3 2026/10/09 10:50 tool grepper
0m Args:
{
  "Expression": "int ipv6_skip_exthdr\\(",
  "PathPrefixes": [
    "net/ipv6/"
  ]
}

Results:
{
  "Output": "net/ipv6/exthdrs_core.c=25=EXPORT_SYMBOL(ipv6_ext_hdr);\n--\nnet/ipv6/exthdrs_core.c-71-\nnet/ipv6/exthdrs_core.c:72:int ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp,\nnet/ipv6/exthdrs_core.c-73-\t\t     __be16 *frag_offp)\n"
}

81/3 2026/10/09 10:50 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 69639
							output: 40
							thoughts: 30
						

Thoughts:
Here's my take on the thought process, summarized as you requested:

**Diving into IPv6 Extension Headers**

Okay, time to get my hands dirty. I need to refresh my memory on how the kernel handles IPv6 extension headers. Let's start by digging into `ipv6_skip_exthdr` in `net/ipv6/exthdrs_core.c`. This is where the real logic lies – figuring out which headers to process and how to skip the ones that aren't relevant for a particular operation, or that we need to handle specially. I expect this function holds the key to the basic iterative parsing of the extension headers chain. I'm keen to see the conditions under which it stops processing and when it decides to hand off further processing to a higher-level handler. Understanding this is fundamental to understanding IPv6 processing in general.



82/3 2026/10/09 10:50 tool read-file
0m Args:
{
  "File": "net/ipv6/exthdrs_core.c",
  "FirstLine": 70,
  "LineCount": 40
}

Results:
{
  "Contents": "  70:\t */\n  71:\t\n  72:\tint ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp,\n  73:\t\t\t     __be16 *frag_offp)\n  74:\t{\n  75:\t\tu8 nexthdr = *nexthdrp;\n  76:\t\tint exthdr_cnt = 0;\n  77:\t\n  78:\t\t*frag_offp = 0;\n  79:\t\n  80:\t\twhile (ipv6_ext_hdr(nexthdr)) {\n  81:\t\t\tstruct ipv6_opt_hdr _hdr, *hp;\n  82:\t\t\tint hdrlen;\n  83:\t\n  84:\t\t\tif (nexthdr == NEXTHDR_NONE)\n  85:\t\t\t\treturn -1;\n  86:\t\t\tif (unlikely(exthdr_cnt++ \u003e= IP6_MAX_EXT_HDRS_CNT))\n  87:\t\t\t\treturn -1;\n  88:\t\t\thp = skb_header_pointer(skb, start, sizeof(_hdr), \u0026_hdr);\n  89:\t\t\tif (!hp)\n  90:\t\t\t\treturn -1;\n  91:\t\t\tif (nexthdr == NEXTHDR_FRAGMENT) {\n  92:\t\t\t\t__be16 _frag_off, *fp;\n  93:\t\t\t\tfp = skb_header_pointer(skb,\n  94:\t\t\t\t\t\t\tstart+offsetof(struct frag_hdr,\n  95:\t\t\t\t\t\t\t\t       frag_off),\n  96:\t\t\t\t\t\t\tsizeof(_frag_off),\n  97:\t\t\t\t\t\t\t\u0026_frag_off);\n  98:\t\t\t\tif (!fp)\n  99:\t\t\t\t\treturn -1;\n 100:\t\n 101:\t\t\t\t*frag_offp = *fp;\n 102:\t\t\t\tif (ntohs(*frag_offp) \u0026 ~0x7)\n 103:\t\t\t\t\tbreak;\n 104:\t\t\t\thdrlen = 8;\n 105:\t\t\t} else if (nexthdr == NEXTHDR_AUTH)\n 106:\t\t\t\thdrlen = ipv6_authlen(hp);\n 107:\t\t\telse\n 108:\t\t\t\thdrlen = ipv6_optlen(hp);\n 109:\t\n"
}

83/3 2026/10/09 10:50 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 70472
							output: 30
							thoughts: 462
						

Thoughts:
**Initial Thoughts on IPv6 and RMNET RX Statistics**

Okay, first things first. I see that the `frag_off` variable is initialized to zero right at the beginning of `ipv6_skip_exthdr`. That's good; always a solid practice to ensure a known starting point.

Now, let's switch gears. I'm looking at `rmnet_vnd.c`, specifically the `rmnet_get_queue_stats_rx` function. Interesting. I see how they're aggregating statistics across CPUs with that loop and the `per_cpu_ptr` and synchronization with `u64_stats_fetch_begin` and `u64_stats_fetch_retry`. It looks like it's snapshotting the statistics, but I'm curious about the context. I'm seeing stats like `rx_hw_gro_packets`, `rx_hw_gro_wire_packets`, and `rx_alloc_fail`. Makes sense, hardware GRO and allocation failures are interesting stats, and it looks like a total is being built from per-CPU snapshots.

But wait a minute, how is this function actually *used* in the kernel? I need to understand where and when these statistics are being gathered. Time to search for calls to `rmnet_get_queue_stats_rx`.



84/3 2026/10/09 10:50 tool grepper
0m Args:
{
  "Expression": "get_queue_stats_rx",
  "PathPrefixes": [
    "net/"
  ]
}

Results:
{
  "Output": "net/core/netdev-genl.c=730=netdev_nl_stats_queue(struct net_device *netdev, struct sk_buff *rsp,\n--\nnet/core/netdev-genl.c-748-\t\tmemset(\u0026rx, 0xff, sizeof(rx));\nnet/core/netdev-genl.c:749:\t\tops-\u003eget_queue_stats_rx(netdev, i, \u0026rx);\nnet/core/netdev-genl.c-750-\t\tif (!memchr_inv(\u0026rx, 0xff, sizeof(rx)))\n--\nnet/core/netdev-genl.c=777=netdev_nl_stats_by_queue(struct net_device *netdev, struct sk_buff *rsp,\n--\nnet/core/netdev-genl.c-787-\ti = ctx-\u003erxq_idx;\nnet/core/netdev-genl.c:788:\twhile (ops-\u003eget_queue_stats_rx \u0026\u0026 i \u003c netdev-\u003ereal_num_rx_queues) {\nnet/core/netdev-genl.c-789-\t\terr = netdev_nl_stats_queue(netdev, rsp, NETDEV_QUEUE_TYPE_RX,\n--\nnet/core/netdev-genl.c=823=void netdev_stat_queue_sum(struct net_device *netdev,\n--\nnet/core/netdev-genl.c-837-\t\tmemset(\u0026rx, 0xff, sizeof(rx));\nnet/core/netdev-genl.c:838:\t\tif (ops-\u003eget_queue_stats_rx)\nnet/core/netdev-genl.c:839:\t\t\tops-\u003eget_queue_stats_rx(netdev, i, \u0026rx);\nnet/core/netdev-genl.c-840-\t\tnetdev_nl_stats_add(rx_sum, \u0026rx, sizeof(rx));\n"
}

85/3 2026/10/09 10:50 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 71738
							output: 43
							thoughts: 2867
						

Thoughts:
**Analyzing Potential Uninitialized Memory Reads in rmnet Driver**

Alright, let's break this down systematically. My initial observation is about the `netdev-genl` initialization of `rx` to `0xff`. This is the standard practice, meaning uninitialized fields remain at `0xff`. This aligns with the design to only serialize the populated fields, so that's expected.

My focus then shifts to the `rmnet_get_ethtool_stats` function. I see that `snapshot` is zero-allocated using `kzalloc_obj`, and `total_stats` is zero-initialized. The crucial part is that `data` is filled from `total_stats.ethtool_stats`, and every value in `total_stats.ethtool_stats` is accumulated from that zero-initialized `snapshot`. Given that `ARRAY_SIZE(rmnet_gstrings_stats)` correctly matches the size of `total_stats.ethtool_stats` divided by `u64` size, the stats strings correspond to values copied into `data`, so this is safe. No uninitialized memory is exposed to userspace.

Next, I delve into `rmnet_get_stats64`. Here, `priv_snapshot` is fully written by `u64_stats_copy`, which correctly copies `sizeof(priv_snapshot)` bytes. Also, `pcpu_ptr->priv_stats` was allocated via `alloc_percpu`. So, that's safe too.

Now, let's explore `rmnet_map_partial_csum`. I'm tracing `rmnet_map_partial_csum` because it does csum calculations. `data` is `skb->data`. In `__rmnet_map_segment_coal_skb`, the skb has the IP header pushed, transport header pushed, and payload put in it. `skb->len` is `hlen + dlen`. Thus, `pkt_len = skb->len - coal_meta->ip_len` = `trans_len + dlen`. Both `iph->saddr` and `iph->daddr` are safely copied from `coal_skb->data`. Then, `tp->check` gets assigned a valid `pseudo` value. The offsets for checksum start and offset are safely set. This looks fine; all values used are defined.

Moving on to `rmnet_map_coal_gro_fast_path`, I need to fully understand `coal_skb->data` when entering this function. Tracing through, after the `skb_pull` operations, `coal_skb->data` is now pointing directly to the IP header. The IP and transport headers are correctly parsed and validated. When entering `rmnet_map_coal_gro_fast_path`, `coal_skb->data` is still at the IP header. Thus, the subsequent `rmnet_map_partial_csum` calls and the rest of the logic operate on valid data. Then it calls `rmnet_deliver_skb_list(&list)`, where the `skb->protocol` is set from the IP version and the skb is delivered.

I also need to understand the scenarios involving `skb_peek(list) != skb` in `rmnet_map_process_next_hdr_packet`. If `coal_skb` is used directly, it is queued to `list`, and `skb_peek(list) == skb`, so it is not freed. If `coal_skb` is segmented, `skb` is freed.

Finally, I need to check the single packet / fixup paths. If `total_pkts == 1` and either checksum or GRO is disabled (single path) or `rmnet_map_v5_csum_fixup` is true (fixup path), the `coal_skb` is queued. If, however, `total_pkts == 1`, but checksum and GRO are both enabled, and `rmnet_map_v5_csum_fixup` is false, it proceeds into `rmnet_map_coal_gro_fast_path`. If the fast path succeeds (checksum is valid and num_nlos == 1), the `coal_meta->pkt_count` is 1, thus, the `skb` is queued to the list. If it fails, `rmnet_map_coal_segment_loop` allocates a new segment. Thus, no risk. `rmnet_set_skb_proto` looks safe.



86/3 2026/10/09 10:51 tool grepper
0m Args:
{
  "Expression": "rmnet_set_skb_proto",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-21-\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c:22:static void rmnet_set_skb_proto(struct sk_buff *skb)\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-23-{\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c=53=static void rmnet_deliver_skb_list(struct sk_buff_head *head)\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-57-\twhile ((skb = __skb_dequeue(head))) {\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c:58:\t\trmnet_set_skb_proto(skb);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-59-\t\trmnet_deliver_skb(skb);\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c=66=__rmnet_map_ingress_handler(struct sk_buff *skb,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-106-\t\tskb_pull(skb, sizeof(*map_header));\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c:107:\t\trmnet_set_skb_proto(skb);\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c-108-\t\tif (data_format \u0026 RMNET_FLAGS_INGRESS_MAP_CKSUMV4 \u0026\u0026\n"
}

87/3 2026/10/09 10:51 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 76070
							output: 46
							thoughts: 15
						

Thoughts:
Okay, let's dive into this. Here's my thought process on checking `rmnet_set_skb_proto`:

**Analyzing `rmnet_set_skb_proto`**

Right, `rmnet_set_skb_proto`. My initial reaction is to think, "What's the context? What's it doing?". I'm assuming it's related to the Radio Modem Network, or RMNET, and that `skb` is referring to a Socket Buffer. So, I need to understand what this function is actually doing with that socket buffer and how it relates to protocol handling within the RMNET framework. Is it setting a protocol field? Modifying it? Overwriting it? Is this function called often? What are the potential implications of its actions? The name itself suggests a function to "set" the protocol of the socket buffer, so the next step is to examine *how* it sets the protocol, and *why* this step is required. Is this part of an early initialization, or more dynamic? What are the possible values for the protocol to be set? Are there potential race conditions involved with these settings? And most importantly, is this function implemented properly, and in accordance with the specifications?



88/3 2026/10/09 10:51 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c",
  "FirstLine": 20,
  "LineCount": 20
}

Results:
{
  "Contents": "  20:\t/* Helper Functions */\n  21:\t\n  22:\tstatic void rmnet_set_skb_proto(struct sk_buff *skb)\n  23:\t{\n  24:\t\tswitch (skb-\u003edata[0] \u0026 0xF0) {\n  25:\t\tcase RMNET_IP_VERSION_4:\n  26:\t\t\tskb-\u003eprotocol = htons(ETH_P_IP);\n  27:\t\t\tbreak;\n  28:\t\tcase RMNET_IP_VERSION_6:\n  29:\t\t\tskb-\u003eprotocol = htons(ETH_P_IPV6);\n  30:\t\t\tbreak;\n  31:\t\tdefault:\n  32:\t\t\tskb-\u003eprotocol = htons(ETH_P_MAP);\n  33:\t\t\tbreak;\n  34:\t\t}\n  35:\t}\n  36:\t\n  37:\t/* Generic handler */\n  38:\t\n  39:\tstatic void\n"
}

89/3 2026/10/09 10:51 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 76641
							output: 42
							thoughts: 3500
						

Thoughts:
**Deep Dive into RMNET Data Handling: A Comprehensive Review**

Okay, let's break this down systematically. I'm focusing on potential data leaks or uninitialized memory vulnerabilities within this RMNET driver. My initial concern was around the `__rmnet_map_ingress_handler` function, specifically how it handles potential errors and the queueing of `skb`s. I needed to ensure that in the case of a processing error in the `rmnet_map_process_next_hdr_packet` function, no partially processed or uninitialized data makes its way out.

First, I examined the control flow. The code jumps to `free_skb` if `rmnet_map_process_next_hdr_packet` returns an error. The crucial point here is whether `list` (a queue of `skb`s) could have some packets added *before* that error. I drilled down into `rmnet_map_segment_coal_skb`, the function called within `rmnet_map_process_next_hdr_packet`. The code's structure appears sound; errors in `rmnet_map_segment_coal_skb` seem to always occur *before* any `skb` is added to the list, or in the worst case, it completes and delivers the packets. No partially queued `skb`s will be leaked.

Next, I turned my attention to a potential overflow within `rmnet_map_coal_validate_bounds` in relation to the `total_data` calculation. The code calculates `nlo_len = (u32)(plen - hlen) * coal_hdr->nl_pairs[i].num_packets;` and then sums these lengths into `total_data`. I confirmed that no integer overflow issues exist. This is because both `plen` and `num_packets` are of types `u16` and `u8` respectively, and their product fits within a `u32`. Furthermore, `total_data` never exceeds `coal_skb->len - hlen`. The final validation step, `total_data == coal_skb->len - hlen`, ensures that the packet lengths match as expected.

Then I checked the copy operation to a new skb via `skb_put_data`. I focused on whether uninitialized memory could be copied out as part of the new `skbn` skb. The allocated memory size, `hlen + dlen + RMNET_MAP_DEAGGR_HEADROOM`, and the data manipulation steps were checked. The checks were comprehensive, including buffer reservations and the sequence of `skb_push` and `skb_put_data` operations that construct the final `skbn`. Each byte in the new `skbn` is written, first from the original `coal_skb`, then from the headers and finally modifications to header fields, so no uninitialized data remains. This effectively confirms that all data written to the new `skbn` is valid.

I then revisited the IP header update section for completeness. The code modifies fields like `id`, `tot_len`, and checksum. However, these operations are focused on *existing* header fields within the newly constructed `skbn` and do not introduce uninitialized data.

Finally, I switched gears to investigate the initialization and potential leaks from the `rmnet_pcpu_stats`. It is allocated with `alloc_percpu` which returns zeroed memory via `kzalloc`.

The final check was to see if any ioctl, ethtool, or netlink operations potentially leak uninitialized memory. Let's dig deeper into `rmnet_get_ethtool_stats` again! I meticulously examined the `ethtool_stats` structure and verified its initialization using an empty struct and zeroed memory in the kernel. `total_stats = { };` ensures zero initialization, and `kzalloc_obj(*snapshot)` ensures zero initialization as well. The statistics are populated with data from per-CPU variables inside the `rmnet_get_ethtool_stats` function which are accumulated using a locked read. I paid close attention to the `memcpy` which copies the statistics to user space. It appears sound because both `total_stats` and `snapshot` are properly initialized. I confirmed the correct size of the `memcpy` by tracing the `ethtool_stats` size through the code. All statistics are initialized and no uninitialized memory leaks.



90/3 2026/10/09 10:51 tool grepper
0m Args:
{
  "Expression": "csum_err_bad_buffer",
  "PathPrefixes": [
    "drivers/net/ethernet/qualcomm/rmnet/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h=66=struct rmnet_priv_stats {\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.h-78-\t\tu64 csum_validation_failed;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.h:79:\t\tu64 csum_err_bad_buffer;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.h-80-\t\tu64 csum_err_invalid_ip_version;\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.h=111=struct rmnet_pcpu_priv_stats {\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.h-122-\tu64_stats_t csum_validation_failed;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.h:123:\tu64_stats_t csum_err_bad_buffer;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_config.h-124-\tu64_stats_t csum_err_invalid_ip_version;\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c=286=static void rmnet_get_ethtool_stats(struct net_device *dev,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-314-\t\ttotal_stats.csum_validation_failed += snapshot-\u003ecsum_validation_failed;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c:315:\t\ttotal_stats.csum_err_bad_buffer += snapshot-\u003ecsum_err_bad_buffer;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c-316-\t\ttotal_stats.csum_err_invalid_ip_version +=\n"
}

91/3 2026/10/09 10:51 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 81637
							output: 39
							thoughts: 1301
						

Thoughts:
**Deep Dive into RMNET Data Structures and Potential Uninitialized Memory Issues**

Okay, so I'm revisiting this `rmnet` code and trying to suss out any potential uninitialized memory issues. First, I noticed `csum_err_bad_buffer` was already in `rmnet_priv_stats` before the patch, and it remains at zero, so that's not a concern.

Then, I shifted my focus to `rmnet_pcpu_stats` on each CPU. When a CPU updates these stats, it uses `u64_stats_inc` on `pcpu_ptr->priv_stats.coal_bounds_err`. I needed to confirm those `pcpu_ptr->priv_stats` fields were initialized. Luckily, `alloc_percpu` zero-initializes memory, so that's handled. Good.

Next, I looked at `struct rmnet_map_v5_coal_header`. Could anything there be accessing uninitialized memory from packet buffers? Considering how skbs get to `rmnet_rx_handler` or `__rmnet_map_ingress_handler`, the packet data arrives from the real device, and the underlying device driver/network stack initializes the data. That's a reasonable safeguard.

Okay, let's consider GRO or GSO. I looked at `rmnet_map_gso_stamp`. Here, `gso_type`, `gso_size`, and `gso_segs` are set within `skb_shinfo`. Does setting these leave anything uninitialized in `skb_shinfo`? No, `skb_shared_info` is initialized when the skb is allocated either by `alloc_skb` or whatever allocated `coal_skb`, so that's good.

Next, I jumped into `rmnet_map_coal_segment_loop`. Specifically I looked at `total_pkt`, a `u8`, and if it can overflow. In `rmnet_map_data_check_coal_header`, I found the variable is checked against `RMNET_MAP_V5_MAX_PACKETS`, which is 48, which fits in `u8`. So `total_pkt` will never exceed that limit, good.

Then, I considered `pkt_id` in `__rmnet_map_segment_coal_skb`, which uses `total_pkt` or `total_pkt - coal_meta->pkt_count`. Fine. That looks safe.

I also looked at TCP sequence numbers: `th->seq = htonl(ntohl(th->seq) + coal_meta->data_offset)`. `coal_meta->data_offset` is a `u16`, that's fine.

Finally, TCP checksum and partial checksum. Here's where it gets interesting! I looked at how `skb->csum_start` is set for `CHECKSUM_PARTIAL`. How is `skb->csum_start` *supposed* to be set? I need to check other networking drivers or skb documentation. This needs more attention. It's the most likely spot for a subtle error or undefined behavior if it's not handled correctly.



92/3 2026/10/09 10:52 tool grepper
0m Args:
{
  "Expression": "skb-\u003ecsum_start = ",
  "PathPrefixes": [
    "net/",
    "drivers/net/"
  ]
}

Results:
{
  "Output": "drivers/net/ethernet/airoha/airoha_eth.c=745=static int airoha_qdma_lro_rx_skb(struct airoha_queue *q,\n--\ndrivers/net/ethernet/airoha/airoha_eth.c-872-\ndrivers/net/ethernet/airoha/airoha_eth.c:873:\tskb-\u003ecsum_start = skb_headroom(skb) + th_off;\ndrivers/net/ethernet/airoha/airoha_eth.c-874-\tskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c=3872=static int hns3_gro_complete(struct sk_buff *skb, u32 l234info)\n--\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c-3920-\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c:3921:\tskb-\u003ecsum_start = (unsigned char *)th - skb-\u003ehead;\ndrivers/net/ethernet/hisilicon/hns3/hns3_enet.c-3922-\tskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c=1082=static void mlx5e_shampo_update_ipv4_udp_hdr(struct mlx5e_rq *rq, struct iphdr *ipv4)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c-1094-\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c:1095:\tskb-\u003ecsum_start = (unsigned char *)uh - skb-\u003ehead;\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c-1096-\tskb-\u003ecsum_offset = offsetof(struct udphdr, check);\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c=1101=static void mlx5e_shampo_update_ipv6_udp_hdr(struct mlx5e_rq *rq, struct ipv6hdr *ipv6)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c-1113-\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c:1114:\tskb-\u003ecsum_start = (unsigned char *)uh - skb-\u003ehead;\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c-1115-\tskb-\u003ecsum_offset = offsetof(struct udphdr, check);\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c=1163=static void mlx5e_shampo_update_ipv4_tcp_hdr(struct mlx5e_rq *rq, struct iphdr *ipv4,\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c-1183-\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c:1184:\tskb-\u003ecsum_start = (unsigned char *)tcp - skb-\u003ehead;\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c-1185-\tskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c=1188=static void mlx5e_shampo_update_ipv6_tcp_hdr(struct mlx5e_rq *rq, struct ipv6hdr *ipv6,\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c-1201-\tskb_shinfo(skb)-\u003egso_type |= SKB_GSO_TCPV6;\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c:1202:\tskb-\u003ecsum_start = (unsigned char *)tcp - skb-\u003ehead;\ndrivers/net/ethernet/mellanox/mlx5/core/en_rx.c-1203-\tskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c=614=static void rmnet_map_partial_csum(struct sk_buff *skb,\n--\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c-645-\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:646:\tskb-\u003ecsum_start = skb-\u003edata + coal_meta-\u003eip_len - skb-\u003ehead;\ndrivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c-647-}\n--\ndrivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c=60=static struct sk_buff *stmmac_test_get_udp_skb(struct stmmac_priv *priv,\n--\ndrivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c-203-\t\tthdr-\u003echeck = ~tcp_v4_check(skb-\u003elen, ihdr-\u003esaddr, ihdr-\u003edaddr, 0);\ndrivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:204:\t\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\ndrivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c-205-\t\tskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n--\nnet/core/pktgen.c=3056=static struct sk_buff *fill_packet_ipv6(struct net_device *odev,\n--\nnet/core/pktgen.c-3169-\t\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\nnet/core/pktgen.c:3170:\t\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\nnet/core/pktgen.c-3171-\t\tskb-\u003ecsum_offset = offsetof(struct udphdr, check);\n--\nnet/core/selftests.c=19=struct sk_buff *net_test_get_skb(struct net_device *ndev, u8 id,\n--\nnet/core/selftests.c-130-\t\tthdr-\u003echeck = ~tcp_v4_check(l4len, ihdr-\u003esaddr, ihdr-\u003edaddr, 0);\nnet/core/selftests.c:131:\t\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\nnet/core/selftests.c-132-\t\tskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n--\nnet/core/skbuff.c=5829=bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off)\n--\nnet/core/skbuff.c-5839-\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\nnet/core/skbuff.c:5840:\tskb-\u003ecsum_start = csum_start;\nnet/core/skbuff.c-5841-\tskb-\u003ecsum_offset = off;\n--\nnet/ipv4/gre_offload.c=16=static struct sk_buff *gre_gso_segment(struct sk_buff *skb,\n--\nnet/ipv4/gre_offload.c-113-\t\t\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\nnet/ipv4/gre_offload.c:114:\t\t\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\nnet/ipv4/gre_offload.c-115-\t\t\tskb-\u003ecsum_offset = sizeof(*greh);\n--\nnet/ipv4/netfilter/nf_reject_ipv4.c=227=static void nf_reject_ip_tcphdr_put(struct sk_buff *nskb, const struct sk_buff *oldskb,\n--\nnet/ipv4/netfilter/nf_reject_ipv4.c-251-\tnskb-\u003eip_summed = CHECKSUM_PARTIAL;\nnet/ipv4/netfilter/nf_reject_ipv4.c:252:\tnskb-\u003ecsum_start = (unsigned char *)tcph - nskb-\u003ehead;\nnet/ipv4/netfilter/nf_reject_ipv4.c-253-\tnskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n--\nnet/ipv4/tcp_offload.c=370=void tcp_gro_complete(struct sk_buff *skb)\n--\nnet/ipv4/tcp_offload.c-377-\nnet/ipv4/tcp_offload.c:378:\tskb-\u003ecsum_start = (unsigned char *)th - skb-\u003ehead;\nnet/ipv4/tcp_offload.c-379-\tskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n--\nnet/ipv4/udp.c=1049=void udp4_hwcsum(struct sk_buff *skb, __be32 src, __be32 dst)\n--\nnet/ipv4/udp.c-1060-\t\t */\nnet/ipv4/udp.c:1061:\t\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\nnet/ipv4/udp.c-1062-\t\tskb-\u003ecsum_offset = offsetof(struct udphdr, check);\n--\nnet/ipv4/udp.c=1091=void udp_set_csum(bool nocheck, struct sk_buff *skb,\n--\nnet/ipv4/udp.c-1106-\t\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\nnet/ipv4/udp.c:1107:\t\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\nnet/ipv4/udp.c-1108-\t\tskb-\u003ecsum_offset = offsetof(struct udphdr, check);\n--\nnet/ipv4/udp_offload.c=172=static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,\n--\nnet/ipv4/udp_offload.c-302-\t\t\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\nnet/ipv4/udp_offload.c:303:\t\t\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\nnet/ipv4/udp_offload.c-304-\t\t\tskb-\u003ecsum_offset = offsetof(struct udphdr, check);\n--\nnet/ipv4/udp_offload.c=481=struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,\n--\nnet/ipv4/udp_offload.c-526-\t\t /* Setup csum, as fraglist skips this in udp4_gro_receive. */\nnet/ipv4/udp_offload.c:527:\t\tgso_skb-\u003ecsum_start = skb_transport_header(gso_skb) - gso_skb-\u003ehead;\nnet/ipv4/udp_offload.c-528-\t\tgso_skb-\u003ecsum_offset = offsetof(struct udphdr, check);\n--\nnet/ipv4/udp_offload.c=901=static int udp_gro_complete_segment(struct sk_buff *skb)\n--\nnet/ipv4/udp_offload.c-904-\nnet/ipv4/udp_offload.c:905:\tskb-\u003ecsum_start = (unsigned char *)uh - skb-\u003ehead;\nnet/ipv4/udp_offload.c-906-\tskb-\u003ecsum_offset = offsetof(struct udphdr, check);\n--\nnet/ipv6/ip6_checksum.c=68=void udp6_set_csum(bool nocheck, struct sk_buff *skb,\n--\nnet/ipv6/ip6_checksum.c-84-\t\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\nnet/ipv6/ip6_checksum.c:85:\t\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\nnet/ipv6/ip6_checksum.c-86-\t\tskb-\u003ecsum_offset = offsetof(struct udphdr, check);\n--\nnet/ipv6/udp.c=1322=static void udp6_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,\n--\nnet/ipv6/udp.c-1332-\t\t/* Only one fragment on the socket.  */\nnet/ipv6/udp.c:1333:\t\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\nnet/ipv6/udp.c-1334-\t\tskb-\u003ecsum_offset = offsetof(struct udphdr, check);\n--\nnet/netfilter/ipvs/ip_vs_core.c=975=void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp,\n--\nnet/netfilter/ipvs/ip_vs_core.c-1010-\t\t\t\t\t      IPPROTO_ICMPV6, 0);\nnet/netfilter/ipvs/ip_vs_core.c:1011:\tskb-\u003ecsum_start = skb_headroom(skb) + toff;\nnet/netfilter/ipvs/ip_vs_core.c-1012-\tskb-\u003ecsum_offset = offsetof(struct icmp6hdr, icmp6_cksum);\n--\nnet/netfilter/nf_nat_proto.c=437=static void nf_nat_ipv4_csum_recalc(struct sk_buff *skb,\n--\nnet/netfilter/nf_nat_proto.c-444-\t\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\nnet/netfilter/nf_nat_proto.c:445:\t\tskb-\u003ecsum_start = skb_headroom(skb) + skb_network_offset(skb) +\nnet/netfilter/nf_nat_proto.c-446-\t\t\tip_hdrlen(skb);\n--\nnet/netfilter/nf_nat_proto.c=457=static void nf_nat_ipv6_csum_recalc(struct sk_buff *skb,\n--\nnet/netfilter/nf_nat_proto.c-464-\t\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\nnet/netfilter/nf_nat_proto.c:465:\t\tskb-\u003ecsum_start = skb_headroom(skb) + skb_network_offset(skb) +\nnet/netfilter/nf_nat_proto.c-466-\t\t\t(data - (void *)skb-\u003edata);\n--\nnet/tls/tls_device_fallback.c=152=static void update_chksum(struct sk_buff *skb, int headln)\n--\nnet/tls/tls_device_fallback.c-165-\tskb-\u003eip_summed = CHECKSUM_PARTIAL;\nnet/tls/tls_device_fallback.c:166:\tskb-\u003ecsum_start = skb_transport_header(skb) - skb-\u003ehead;\nnet/tls/tls_device_fallback.c-167-\tskb-\u003ecsum_offset = offsetof(struct tcphdr, check);\n--\nnet/xdp/xsk.c=988=static int xsk_skb_metadata(struct sk_buff *skb, void *buffer,\n--\nnet/xdp/xsk.c-1010-\nnet/xdp/xsk.c:1011:\t\tskb-\u003ecsum_start = hr + csum_start;\nnet/xdp/xsk.c-1012-\t\tskb-\u003ecsum_offset = csum_offset;\n"
}

93/3 2026/10/09 10:52 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 87892
							output: 571
							thoughts: 1311
						

Thoughts:
**KMSAN Assessment: No Need for Dedicated Fuzzing**

Okay, let's break this down. First, I need to understand that `skb->csum_start` is effectively the same as calculating the transport header offset relative to the SKB's head. Got it.

Now, the main focus here is whether or not KMSAN is necessary. I need to make sure I am following the KMSAN guidelines, which are pretty clear. The key is, I only need to consider a dedicated KMSAN fuzzing session if this patch introduces *unique* uninitialized memory risks that *only* KMSAN would detect. KASAN and other standard detectors handle the usual suspects like out-of-bounds access, use-after-free, etc.

I'm checking this against the code changes.

1.  **Kernel structures sent to userspace:** Ethtool stats are the primary area of concern here. I need to make sure nothing uninitialized is leaked. But, `snapshot` is `kzalloc`'d, `total_stats` is zeroed, and the ethtool stats structure looks fully populated with explicitly written fields. The `rmnet_get_queue_stats_rx` function only writes into pre-initialized `stats`, and `rmnet_get_stats64` explicitly writes all fields. Netlink link configuration isn't touched by this patch. So, no concerns there.

2.  **Conditional logic with uninitialized variables:** Nope. All the conditionals' controlling variables are initialized before use. Nothing fishy here.

3.  **Complex data structure initialization:** The `priv->pcpu_stats` is allocated with `alloc_percpu` which zeroes it. The `coal_meta` struct is `memset`'d to zero. SKBs are allocated with `alloc_skb` and then filled via `skb_put_data` or `skb_push` and `memcpy`, so everything is initialized. No surprises.

4.  **Bounds checks exposing uninitialized memory:** Packet parsing does bounds checks. While there might be out-of-bounds reads if packets are malformed, but this would be KASAN's problem. No read of uninitialized memory.

Therefore:

Based on my analysis, this patch doesn't introduce any new uninitialized memory risks. Any memory errors are related to potential out-of-bounds reads/underflows and are already detected by KASAN. It's safe to say that this doesn't warrant KMSAN. The reasoning is:

*   The patch *explicitly* initializes all relevant data structures.
*   The code manipulates SKBs via `alloc_skb`, `skb_put_data`, and `memcpy` which initializes the SKB correctly.
*   KASAN is sufficient for catching the kinds of memory errors this patch might cause.

I need to emphasize the contrast between KASAN and KMSAN to make the conclusion clear. This patch touches the manipulation of SKB segmentation and pointers. KASAN is the tool for detecting buffer overflows, pointer corruption, and use-after-free conditions in this area. KMSAN is for catching the leakage of uninitialized kernel memory to user-space. There's no such leak here. This patch isn't increasing the chance for KMSAN bugs, so KMSAN isn't needed here.

So, `NeedsKMSAN = FALSE`. Let's document this reasoning and submit the results.



94/3 2026/10/09 10:52 tool set-results
0m Args:
{
  "KMSANReasoning": "The patch implements downlink hardware coalescing (MAPv5 coalescing header) and related statistics accounting in Qualcomm's rmnet network driver.\n\n1. Analysis of potential uninitialized memory risks:\n- Ethtool statistics: `rmnet_get_ethtool_stats` allocates `snapshot` with `kzalloc_obj`, zero-initializes `total_stats = { }`, and copies `total_stats.ethtool_stats`. The `ethtool_stats` struct group is composed strictly of 64-bit integer fields (`u64`) with no padding holes, and all fields are explicitly accumulated. The count matches `rmnet_gstrings_stats`.\n- Per-CPU statistics: `priv-\u003epcpu_stats` is allocated via `alloc_percpu()` during device initialization, ensuring all fields are zero-initialized.\n- Network stack statistics: In `rmnet_get_stats64` and `rmnet_get_queue_stats_rx`, local stats snapshots are zero-initialized (`= { }`) and copy functions write only the intended fields into structures managed by the core networking subsystem.\n- Internal metadata \u0026 SKB construction: `struct rmnet_map_coal_metadata coal_meta` is explicitly zeroed with `memset` before parsing headers. In `__rmnet_map_segment_coal_skb`, new segment SKBs allocated via `alloc_skb` have their entire valid data range (`hlen + dlen`) populated by `skb_put_data` and header `memcpy` operations; no uninitialized buffer areas remain in the delivered SKBs.\n- Control flow and branching: All local variables (`data_format`, `nlo_err_mask`, `num_nlos`, `num_pkts`, `gro`, etc.) are either explicitly initialized or set prior to being evaluated in conditional branches.\n\n2. KASAN vs KMSAN applicability:\n- The risks introduced by this change involve network packet parsing, header bounds validation, and buffer offset calculations (e.g., in `rmnet_map_coal_validate_bounds`, `rmnet_map_segment_coal_skb`, and `rmnet_map_validate_packet_len`). Any potential logic flaws in length calculations or header offsets could cause out-of-bounds buffer reads or invalid SKB operations, which are detected by standard KASAN and standard kernel assertions.\n- KMSAN is not applicable because no uninitialized memory reads or information leaks to userspace are introduced. Therefore, running a dedicated KMSAN fuzzing session is not justified.",
  "NeedsKMSAN": false
}

Results:
{
  "KMSANReasoning": "The patch implements downlink hardware coalescing (MAPv5 coalescing header) and related statistics accounting in Qualcomm's rmnet network driver.\n\n1. Analysis of potential uninitialized memory risks:\n- Ethtool statistics: `rmnet_get_ethtool_stats` allocates `snapshot` with `kzalloc_obj`, zero-initializes `total_stats = { }`, and copies `total_stats.ethtool_stats`. The `ethtool_stats` struct group is composed strictly of 64-bit integer fields (`u64`) with no padding holes, and all fields are explicitly accumulated. The count matches `rmnet_gstrings_stats`.\n- Per-CPU statistics: `priv-\u003epcpu_stats` is allocated via `alloc_percpu()` during device initialization, ensuring all fields are zero-initialized.\n- Network stack statistics: In `rmnet_get_stats64` and `rmnet_get_queue_stats_rx`, local stats snapshots are zero-initialized (`= { }`) and copy functions write only the intended fields into structures managed by the core networking subsystem.\n- Internal metadata \u0026 SKB construction: `struct rmnet_map_coal_metadata coal_meta` is explicitly zeroed with `memset` before parsing headers. In `__rmnet_map_segment_coal_skb`, new segment SKBs allocated via `alloc_skb` have their entire valid data range (`hlen + dlen`) populated by `skb_put_data` and header `memcpy` operations; no uninitialized buffer areas remain in the delivered SKBs.\n- Control flow and branching: All local variables (`data_format`, `nlo_err_mask`, `num_nlos`, `num_pkts`, `gro`, etc.) are either explicitly initialized or set prior to being evaluated in conditional branches.\n\n2. KASAN vs KMSAN applicability:\n- The risks introduced by this change involve network packet parsing, header bounds validation, and buffer offset calculations (e.g., in `rmnet_map_coal_validate_bounds`, `rmnet_map_segment_coal_skb`, and `rmnet_map_validate_packet_len`). Any potential logic flaws in length calculations or header offsets could cause out-of-bounds buffer reads or invalid SKB operations, which are detected by standard KASAN and standard kernel assertions.\n- KMSAN is not applicable because no uninitialized memory reads or information leaks to userspace are introduced. Therefore, running a dedicated KMSAN fuzzing session is not justified.",
  "NeedsKMSAN": false
}

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)