From nobody Tue Nov 18 14:12:50 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610635853; cv=none; d=zohomail.com; s=zohoarc; b=MkI6pdbWc1045IqXARjdueFptDJuvx9d7gMeJEn0rHg6vLeFOAFA+nCRq4tagVATwNF0njaPZqJDxhb86N86vrw4W4z/gTpYCauqji8gHK0FyQTaC/SMnrseZGrYBB1kA94d8661RVWfZxTnGKCldEd3YQ3RpwQeqU9cMaifDCg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610635853; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=UeFDUXexOVQ8w+BQTvVSUnpjH22/s6ALR7P0G6tmBzI=; b=FAw51mvSIpb6zgAEi3WsgMpPSx/jbXpnYys7Rbh6WwFHnRlnyA+cB3sBU+R5DzNdYjCP6mfWR3QOtsBJXI+RKRl995wKpEMi21af2Qx0VFQZQYy9qGfYSuhf9gdf1vBcKFhEoJG7EtlnsdvO0xY1mTEYafb2ozPjrrn1YPr8srE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1610635853168396.54030730494037; Thu, 14 Jan 2021 06:50:53 -0800 (PST) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-233-3DSHknIwNt6vfz-UBI8XTg-1; Thu, 14 Jan 2021 09:50:49 -0500 Received: by mail-wr1-f72.google.com with SMTP id q18so2698324wrc.20 for ; Thu, 14 Jan 2021 06:50:49 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (13.red-83-57-169.dynamicip.rima-tde.net. [83.57.169.13]) by smtp.gmail.com with ESMTPSA id g184sm9107175wma.16.2021.01.14.06.50.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 06:50:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610635852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UeFDUXexOVQ8w+BQTvVSUnpjH22/s6ALR7P0G6tmBzI=; b=Ri1RVUFcby6V/RSydvVS3yOf03uKpKwdaTMAoB1V75A4ohrTEBt/mBbUWfjMk/MAHaMY8Q NV3EubetARhrNH7S2EkkrQ7FrnOzaorhnrANimPE6i8G7vEWuv8AFZrCKkPyhfiqfXIAsK Q5gfXnGIC8Bn0LYJDs+qxR0yNb8GyW4= X-MC-Unique: 3DSHknIwNt6vfz-UBI8XTg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UeFDUXexOVQ8w+BQTvVSUnpjH22/s6ALR7P0G6tmBzI=; b=hlzsQ7xbxGxrEFo5LGN3mqZBNv5NvOjapSOe21YRMVPUd3pBSd+1nt6RF3ZwVI9Xw5 Y2XI6ar82JUrBZ/zW5cj+xWBiONF/EqOTd76vD1Of7xPfpoMM8NXbuGMYGAY9y23aUQA 2SqL/kOFaK2MmBcCZNWWeMiBkoN/91fYDSgYK5EhOVkffERn4ryeNGztqHrQeX2srBpf PkVYpT6Y4ce6yYPLkwh+8dZSxjHjb/vdrdzkEzWLFJeerxQANUACtPtCKGLhWoG71dxx y3NGhOuS4fQYukwxAq3Isa19aHfP79KmaT3fyKHnh9xx77uBEQkI/QfuqEj2X09Pe6Ij L7gQ== X-Gm-Message-State: AOAM532AlNLiFN3i96eemsdPnvHXUGk+r0ev8MTyVkNXV7ffxLdlTtls Tk4o8MPY83jShgI0sLapHFW6j9gARPqsxlzOgdRFtxdmdZAkT0DxK0iLWa3JOd5HDRQnGCQqk4O fE6AG6nnHr3EiUw== X-Received: by 2002:a5d:4987:: with SMTP id r7mr8451051wrq.352.1610635848402; Thu, 14 Jan 2021 06:50:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmWa9x4/fLVtEl4B1CA0xkp5ae/xAG8qoD/haDpemkNXH2z14WSPXzdiimwpXw71Vt3zasMw== X-Received: by 2002:a5d:4987:: with SMTP id r7mr8451030wrq.352.1610635848242; Thu, 14 Jan 2021 06:50:48 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Miroslav Rezanina , Jason Wang , Dmitry Fleytman , Prasad J Pandit , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/2] net/eth: Simplify _eth_get_rss_ex_dst_addr() Date: Thu, 14 Jan 2021 15:50:40 +0100 Message-Id: <20210114145041.2865440-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210114145041.2865440-1-philmd@redhat.com> References: <20210114145041.2865440-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The length field is already contained in the ip6_ext_hdr structure. Check it direcly in eth_parse_ipv6_hdr() before calling _eth_get_rss_ex_dst_addr(), which gets a bit simplified. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- net/eth.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/eth.c b/net/eth.c index 1e0821c5f81..7d4dd48c1ff 100644 --- a/net/eth.c +++ b/net/eth.c @@ -407,9 +407,7 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int p= kt_frags, { struct ip6_ext_hdr_routing *rthdr =3D (struct ip6_ext_hdr_routing *) e= xt_hdr; =20 - if ((rthdr->rtype =3D=3D 2) && - (rthdr->len =3D=3D sizeof(struct in6_address) / 8) && - (rthdr->segleft =3D=3D 1)) { + if ((rthdr->rtype =3D=3D 2) && (rthdr->segleft =3D=3D 1)) { =20 size_t input_size =3D iov_size(pkt, pkt_frags); size_t bytes_read; @@ -528,10 +526,12 @@ bool eth_parse_ipv6_hdr(const struct iovec *pkt, int = pkt_frags, } =20 if (curr_ext_hdr_type =3D=3D IP6_ROUTING) { - info->rss_ex_dst_valid =3D - _eth_get_rss_ex_dst_addr(pkt, pkt_frags, - ip6hdr_off + info->full_hdr_len, - &ext_hdr, &info->rss_ex_dst); + if (ext_hdr.ip6r_len =3D=3D sizeof(struct in6_address) / 8) { + info->rss_ex_dst_valid =3D + _eth_get_rss_ex_dst_addr(pkt, pkt_frags, + ip6hdr_off + info->full_hdr_l= en, + &ext_hdr, &info->rss_ex_dst); + } } else if (curr_ext_hdr_type =3D=3D IP6_DESTINATON) { info->rss_ex_src_valid =3D _eth_get_rss_ex_src_addr(pkt, pkt_frags, --=20 2.26.2