From nobody Thu Apr 2 17:19:06 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1774619925; cv=none; d=zohomail.com; s=zohoarc; b=lJJ5oNy60t2Sl2zcQ71W/LwaWy+5oCzl3tAuW6GPu1lYCCW7UzEaiMmcL0sZEEiOq0UGVlp3//k6a8CyGyDiJB64Hr51u+8XcmCgsAYXgwO8DJ+7g2zSmU2+jPSfEToKFlLM5/Xdfd+A7QR4TceAqx4kh0mbtkiKbI4O7obfaa0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774619925; h=Content-Type:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=W8WRaTNy69rr2t9xYXSgxGev8HHcrDAAnhL2X97DTr4=; b=DJCtMyTv7HkESPBGbN4si/eyXuSay6Rhki5iEnU7ow491tSf07pxpslrhIDUPxP4CmhlznYyWNUn9P6fvykF88Atr3Z3FSzJAcY4EQfLGkWpsa7/rJTCT/6p+zL+NF4fAuFNGwYBCBfnuAswQVB3E1KtJqJkRn555FWARr/pA0E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774619924943173.22040348292012; Fri, 27 Mar 2026 06:58:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w67hi-0003h1-4C; Fri, 27 Mar 2026 09:58:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w61ne-0008HX-Hd for qemu-devel@nongnu.org; Fri, 27 Mar 2026 03:40:12 -0400 Received: from va-2-18.ptr.blmpb.com ([209.127.231.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w61nc-0006tY-2y for qemu-devel@nongnu.org; Fri, 27 Mar 2026 03:40:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2311081108; d=ruijie.com.cn; t=1774597178; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=W8WRaTNy69rr2t9xYXSgxGev8HHcrDAAnhL2X97DTr4=; b=iS8XTSCySSvBMlBrdQHHZYaixzFMgDhPbPpnATFcSz190qfTVDNmsoPtH4lVpGiea3c79/ s6sdKe5OsgEJVevHSW0jNTUuxHC5K7/nx9K3WErPXwwlOBDKi2tHkHH8wnZye2Revt83sW Pm2Aqz82+Jd+9AuX1lC/PtM5zRQwVYfcBxpbB2sx2cYHb83YCTqlLV/2GXHsvtik7OP+yX B1fWMfuURUibXFI3YHZGEh1AWbc3dLtDTRashjFZ/VpUQuWccUuGCkyQzVa1APYouW8t4a gaY1vbfJFyjboDxZulXjMxE+A4eAbqOpEfiMyBlTpqGOz8WBIlhsaSZGmFiVdw== To: "qemu-devel@nongnu.org" Subject: [PATCH] net/ftgmac100: preserve full VLAN TCI in TX tag insertion From: "linhuang" Mime-Version: 1.0 X-Lms-Return-Path: Content-Type: multipart/alternative; boundary=bf2b1559142a3ed132ffbb83440f0186e7995240419e3b991980ffef6744 Date: Fri, 27 Mar 2026 15:39:35 +0800 Message-Id: <1471e413d3589b6734819bda2b59b725b74f273a.d551129b.99fc.47f6.86dc.0759227268a2@feishu.cn> Cc: "philmd@linaro.org" Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=209.127.231.18; envelope-from=linhuang@ruijie.com.cn; helo=va-2-18.ptr.blmpb.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 27 Mar 2026 09:58:14 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ruijie.com.cn) X-ZM-MESSAGEID: 1774619927100158500 --bf2b1559142a3ed132ffbb83440f0186e7995240419e3b991980ffef6744 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The VLAN tag insertion helper took vlan_tci as an 8-bit value, while the=C2=A0descriptor provides a 16-bit VLAN TCI. This truncated egress tags and caused VLAN ID corruption (for example, 4088/0x0ff8 became 248/0x00f8 at the receiver). Change vlan_tci to uint16_t=C2=A0in the TX VLAN insertion path so the full 802.1Q TCI is preserved and transmitted correctly. Signed-off-by: linhuang Reviewed-by: C=C3=A9dric Le Goater --- =C2=A0hw/net/ftgmac100.c | 2 +- =C2=A01 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c index 2f05bba11d..b3da48c343 100644 --- a/hw/net/ftgmac100.c +++ b/hw/net/ftgmac100.c @@ -498,7 +498,7 @@ static int ftgmac100_write_bd(FTGMAC100Desc *bd, dma_ad= dr_t addr) =C2=A0} =C2=A0static int ftgmac100_insert_vlan(FTGMAC100State *s, int frame_size, - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 uint8_t vlan_tci) + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint16_t vlan_tci) =C2=A0{ =C2=A0=C2=A0 =C2=A0 uint8_t *vlan_hdr =3D s->frame + (ETH_ALEN * 2); =C2=A0=C2=A0 =C2=A0 uint8_t *payload =3D vlan_hdr + sizeof(struct=C2=A0vlan= _header); -- 2.34.1 --bf2b1559142a3ed132ffbb83440f0186e7995240419e3b991980ffef6744 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8

The VLAN tag insertion helper to= ok vlan_tci as an 8-bit value, while
the descriptor provides a 16-bi= t VLAN TCI. This truncated egress tags
and caused VLAN = ID corruption (for example, 4088/0x0ff8 became
248/0x00f= 8 at the receiver).

Change vlan_tci to uint16_t&= nbsp;in the TX VLAN insertion path so the full
802.1Q TC= I is preserved and transmitted correctly.

Signed-off-by: linhuang <linhuang@ruijie.com.cn>
---
 hw/net/ftgmac100.c | 2 +-
<= /div>
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/net/ftgmac1= 00.c b/hw/net/ftgmac100.c
index 2f05bba11d..b3da48c343 = 100644
--- a/hw/net/ftgmac100.c
++= + b/hw/net/ftgmac100.c
@@ -498,7 +498,7 @@ static int f= tgmac100_write_bd(FTGMAC100Desc *bd, dma_addr_t addr)
&= nbsp;}

 = static int ftgmac100_insert_vlan(FTGMAC100State *s, int frame_size,<= /div>
-                 &nbs= p;                uint8_t vlan_tci)=
=
+               &nb= sp;                 uint16_t vlan_t= ci)
 {
     uin= t8_t *vlan_hdr =3D s->frame + (ETH_ALEN * 2);
 =     uint8_t *payload =3D vlan_hdr + sizeof(struct vlan_header);
--<= /div>
2.34.1
--bf2b1559142a3ed132ffbb83440f0186e7995240419e3b991980ffef6744--