From nobody Wed Nov 19 08:19:48 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=1615314449; cv=none; d=zohomail.com; s=zohoarc; b=WJiBYpuNill0eckFsJCpvnjAgRGJeBKFm/qLMMig959d3Q1UEkJPHbPs99vaH4UsmnFbN9QoCVym17METuJBrVJE6ASP19l8+tc/iRY7+1pwt2wcjyGe/2sOpkT/toI31p+lE9TPxLdz84BUCpXW3vCOz3QQQihwDTkPtBCHrnQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615314449; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=JZa/iUsT9VQagkte3HBQwGL7dr2S/uC8iYuWuLSPUy0=; b=Jao71EZneabLBA5GQN5/LOeiX+Bz3eW0p6aBKykJV2cBW6BlJbIC5aMHjj1gaS5r3StTjCMCQ3uC0a5S/PuhLWgPRO/SMIBMtZBoAMHwWmr0zQMTaEZ28lltifag4VG8cfj8CwnxuBMVCqc+f9dOlGpB+q5xp+QooAgoA670dxo= 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 1615314449582618.2637154923037; Tue, 9 Mar 2021 10:27:29 -0800 (PST) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-71-8AEzVEbFMw2fhEA9QgLrhg-1; Tue, 09 Mar 2021 13:27:24 -0500 Received: by mail-ej1-f69.google.com with SMTP id m4so6022906ejc.14 for ; Tue, 09 Mar 2021 10:27:23 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id be27sm9769289edb.47.2021.03.09.10.27.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 10:27:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615314446; 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=JZa/iUsT9VQagkte3HBQwGL7dr2S/uC8iYuWuLSPUy0=; b=UKbxudu5IBpaXXM49cfcI6mQbkra4eMeZP8Txe6aH/WKUKR4bALsxzgAKOI86/q8kVOSQn 41G8ifk/AL8eQcDhIsQSc1XxVgmFWARiqsRIm7OdOYlGzgsy3MkGes2ZljHjRDPLBV6TmT BpvD0E0ToWNkQWS6DVLni0Cnd/d6FeY= X-MC-Unique: 8AEzVEbFMw2fhEA9QgLrhg-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=JZa/iUsT9VQagkte3HBQwGL7dr2S/uC8iYuWuLSPUy0=; b=VDB1Rg+/GS/ELHGUx3/aw7thAXmiyEYLgbovqKj0xw71J7jbEXJgAf6Nx/3kkzlPmQ HNeczPMoERowis5CAKympHKLMNkzjQKaTbps+maAf2QodV1HudydMkTGSx+G8YMi1IGt QfdZAyb9QYTFaBnh3Eh14EDjywZ6s84cPzMP3Y40HdKeyw2ZEZu5t2lwwF2VjSQj1UKd ceN8AYYyrJofmp2bg5YaZ2aoKOMCPxG1t2C+UiIenpohvpmNbPRD1/DWWFsTDhftZbEm Ic4Jg+WTIvJVuCSfjeXrYrdsbqilXMrLtRS/Nnt6mkJlBdkArwjfQnV6bH1r0JDM6/fT drCg== X-Gm-Message-State: AOAM5335Xkb121kOMa4I4WUNyNspPosxwJ00YaUxhBMSkbRtcQuSwpwm D1mGrRnPz6AyqcSn/2YYXfzoP3dOexztnCC0Bf4awFkCvjqMAg4LIQh09LQpDfXMS4ZSj7t5xpK b0LpogEn22UYKBQ== X-Received: by 2002:a17:906:5918:: with SMTP id h24mr22273158ejq.501.1615314442562; Tue, 09 Mar 2021 10:27:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3sEMTKKT4SaFCXJqzS+fG3uLXd9yFb/u6RpsfKs75PASMey5Whnt69NulDldeWhQvBnv2/Q== X-Received: by 2002:a17:906:5918:: with SMTP id h24mr22273146ejq.501.1615314442454; Tue, 09 Mar 2021 10:27:22 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Laurent Vivier , Dmitry Fleytman , Miroslav Rezanina , Li Qiang , Paolo Bonzini , Jason Wang , Thomas Huth , Alexander Bulekov , Stefano Garzarella , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 1/6] net/eth: Simplify _eth_get_rss_ex_dst_addr() Date: Tue, 9 Mar 2021 19:27:04 +0100 Message-Id: <20210309182709.810955-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210309182709.810955-1-philmd@redhat.com> References: <20210309182709.810955-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. Reviewed-by: Miroslav Rezanina Reviewed-by: Stefano Garzarella 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