From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796174179; b=jzrxpdVQn3dsJDGKrDfo7eK/B+Wdd4l4bQ7/wzhvezu/alp91dCcCeY7q669QgNMSZ0w Aaa6GR0y54fHde8PrdWe4Zo6Rv67Pmiw9aZdm8swetVy9fdjNbZtN5PYS3AtS+UCkNFEI 8wPPKp9wdSh8uAmA5+u+OsYSlVrpnjiV7ZHYhZ9+diN9HLH0NphcGKDSNozH3nadU8wIm bClXLZPqR75LFwm94lUEI0KseCm0vxgWxIeMOLJOryj+/tSHZoLsqowBScWeqbXCdxU1C JUp/g7rr63PQcvK18Mm+lGM0eCfpo+3CL5OIsu1W/ATiIRLnGZevRMXpc8SCBziGE0w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796174179; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=eELQAE9twXFYKZAx+WbndRjmnxQhB+K++e50rFWoFpc=; b=2DV4puIiI7HSVrJfCoJBjP9vxRkpakVANBYptaQ5WHVGqK5pLxUnnY2YHSlg6/gizqU1 u0l2m7U5VtfRfumYxGXr5ykEd2Moi1qCkeLzaQCQX2aer58G/Da3QiQvKONu/UbpvIUas r9MjdKt+EovpB1ZLAK+20JUvedBU/4uvFxXFZpC3HeUGkCU909sZO0/LhHGUX/+7Aj5GI j3d7wqaUwPoZQ7E/RnVlWWsqnJlJcDUaWEhV8G0w/dK7E2YA9baOt8ZIdu2cJaN69+M9h kAvV07uUmzN6YhdORH6VO8PKI3yQXtTNiaP7KCjTgz1SxNrf+l501DWK2a/8cclaGUA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=HdzCxNrx; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3080B606A327 for ; Wed, 2 Dec 2026 01:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=HdzCxNrx Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED3F91F000C1; Wed, 2 Dec 2026 01:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796174179; bh=eELQAE9twXFYKZAx+WbndRjmnxQhB+K++e50rFWoFpc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=HdzCxNrxr7NWJki6G0Dj0MpHE3nsYzJ7AYAia7ILu/pQ+AmQBKVF9203izDH6m/E9 vp9hnl/keQg4jLZDo4YeMpINkS6KsPsHNkcSDmWunY+/TpkUTy8BNw9O7/RALaQe/m gOZDVzONRtmB1CPc2YsCsoDbNZcB0NRHHoji20D4J6k/yVEFel9l6OKQyMqsdBH5Pw 7fiEh4zMBHyTSN7/qNKPIKPqyA2YNS/2QiJZmtn/LpQiDwTgVs8r5qW0rEx7lABqYp Eih7+zkDz2+ibe3U1QYJOI0B5wEFF+gpvr/CWrPW1WOxZ4GnAIyJZR7zkKK4sDoBo7 Sru1KEAB5shsQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH RFC net-next 06/12] net: enic: reserve XDP head and tailroom in RX pages Reply-To: sashiko-reviews@lists.linux.dev To: "Satish Kharat" Cc: bpf@vger.kernel.org In-Reply-To: <20261130-enic-xdp-rfc-p1-20261130-v1-6-3be5458c9118@cisco.com> References: <20261130-enic-xdp-rfc-p1-20261130-v1-0-3be5458c9118@cisco.com> <20261130-enic-xdp-rfc-p1-20261130-v1-6-3be5458c9118@cisco.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 01:16:18 +0000 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] net: enic: unaligned truesize in enic_rq_alloc_buf() misaligns skb_shared_info -- commit cd93cb3238544785656020716a596e6aff1448f8 Author: Satish Kharat net: enic: reserve XDP head and tailroom in RX pages This commit adds an xdp_enabled flag to struct enic_rq and reserves XDP headroom and skb_shared_info tailroom in enic_rq_alloc_buf() when the flag is set. > diff --git a/drivers/net/ethernet/cisco/enic/enic_rq.c b/drivers/net/ethe= rnet/cisco/enic/enic_rq.c > index ccbf5c9a21d0f..82ef15296a100 100644 > --- a/drivers/net/ethernet/cisco/enic/enic_rq.c > +++ b/drivers/net/ethernet/cisco/enic/enic_rq.c > @@ -273,13 +274,17 @@ int enic_rq_alloc_buf(struct vnic_rq *rq) > struct net_device *netdev =3D enic->netdev; > struct enic_rq *erq =3D &enic->rq[rq->index]; > struct enic_rq_stats *rqstats =3D &erq->stats; > + unsigned int headroom =3D erq->xdp_enabled ? ENIC_XDP_HEADROOM : 0; > unsigned int offset =3D 0; > unsigned int len =3D netdev->mtu + VLAN_ETH_HLEN; > unsigned int os_buf_index =3D 0; > dma_addr_t dma_addr; > struct vnic_rq_buf *buf =3D rq->to_use; > struct page *page; > - unsigned int truesize =3D len; > + unsigned int truesize =3D len + headroom; > + > + if (erq->xdp_enabled) > + truesize +=3D ENIC_XDP_TAILROOM; > =20 > if (buf->os_buf) { > enic_queue_rq_desc(rq, buf->os_buf, os_buf_index, buf->dma_addr, > @@ -293,9 +298,9 @@ int enic_rq_alloc_buf(struct vnic_rq *rq) > rqstats->pp_alloc_fail++; > return -ENOMEM; > } > - buf->offset =3D offset; > + buf->offset =3D offset + headroom; > buf->truesize =3D truesize; [Severity: High] Does leaving truesize unaligned misalign struct skb_shared_info when page_pool_dev_alloc() allocates multiple fragments per page? With VLAN_ETH_HLEN (18 bytes), len + headroom + ENIC_XDP_TAILROOM is only 2-byte aligned for standard MTUs (or 1-byte aligned for odd MTUs). When a page holds more than one fragment, page_pool_alloc_netmem() passes *size by value to page_pool_alloc_frag_netmem() and leaves the caller's truesize unchanged for non-terminal fragments: include/net/page_pool/helpers.h:page_pool_alloc_netmem() { ... netmem =3D page_pool_alloc_frag_netmem(pool, offset, *size, gfp); if (unlikely(!netmem)) return 0; /* There is very likely not enough space for another fragment, so append * the remaining size to the current fragment to avoid truesize * underestimate problem. */ if (pool->frag_offset + *size > max_size) { *size =3D max_size - *offset; pool->frag_offset =3D max_size; } ... } When buf->truesize is later passed to xdp_init_buff() as frame_sz, xdp_data_hard_end() and xdp_get_shared_info_from_buff() place struct skb_shared_info at an unaligned address, causing misaligned atomic and pointer accesses. Aligning truesize with SKB_DATA_ALIGN() before calling page_pool_dev_alloc() would keep the end of the frame aligned. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130-enic-xdp-r= fc-p1-20261130-v1-0-3be5458c9118@cisco.com?part=3D6