From patchwork Fri Sep 27 21:50:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 831037 Delivered-To: patch@linaro.org Received: by 2002:a5d:66c8:0:b0:367:895a:4699 with SMTP id k8csp970323wrw; Fri, 27 Sep 2024 14:52:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU2pYJKsLFrQSWUl0k3UqB12KaPkd9qV33upKknv3kEVaj9t1iZkUugBM0p+yiocumoTGiZjg==@linaro.org X-Google-Smtp-Source: AGHT+IF8UdBaca+uP0fEMbPIKM+p719ZSB6I28B1l7+TFRRPEBw4ZINj26Gl8wcT99N31Mv8lHYg X-Received: by 2002:a05:6214:4385:b0:6cb:394f:16fa with SMTP id 6a1803df08f44-6cb3b5e4e93mr47011346d6.4.1727473943374; Fri, 27 Sep 2024 14:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727473943; cv=none; d=google.com; s=arc-20240605; b=UG+lxQBb51QbQHy7RAMhSWPTar0RgmsizbGjxm2kETjvnTnYNziffcRPy2lAysmfaS 7UX0KNK19v0rt20DaVHWcEMmvInAPjCWiIi6u+TKXppJqp2BNHtcKyfPHITGBx8LGFmh 5X2mDgrDYrZL4j4G7NF+C/DXug5p096UWkoowE+GYrc3SE/3rzXb6p38jRvnWYCG+hoE qS2wJT/ngf67s1dcmYHiGGdHR5iIQpFGEbQnknf6IdmqTJUvIYughbqTLZDsivBid40e uyinIaFi7dmoOfgQch3Cw05UDcmLKg0T7dYq+DOXgcWWqjhyJXUAed4wRMSgV49zcPV/ woTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e1vHxexCTLbdRB8r0KvJgoIHaBve1hvZ62MNg9aoNm0=; fh=RmN1jlYmXsQbVTmV9F6qW9Y8GnhBM9smQ17UMdrtna4=; b=J7i1/emL92dxqIvxavVa4CNGGw6mfzhCg1sPAY1P/hlsszsPMqfu/CKcGVY68sUKAF QSRDX93kejHyOI59iNK/eVOjZRILOiptxed1SpkKZu1wziQDtDK02uuTWMMHo2rtOOU9 rGxTJsrndUlcjssgB/m22wA4CeKRTKoLaWOY5+qWfX9OdH5YRTPNyjkqtcYgGLl+CwBB PD1u/JDR96YpnjckxLUz5BR+sqSs2XkxyiPMOvBqKOIK3BMBQz1zF8+1zm4cEAlIL5Y6 mUCylgfeZ6YteulsJcxI4TX3++lL5KMo/w/oGKvEItP+nsjIluUPUAoksNcNksYlyACv Rygw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oBMIBkWw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6cb3b6040cesi31682046d6.92.2024.09.27.14.52.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Sep 2024 14:52:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oBMIBkWw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suIrx-0001h6-3j; Fri, 27 Sep 2024 17:51:21 -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 1suIrq-0001CH-Ur for qemu-devel@nongnu.org; Fri, 27 Sep 2024 17:51:15 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1suIrp-0004XQ-Jj for qemu-devel@nongnu.org; Fri, 27 Sep 2024 17:51:14 -0400 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5398996acbeso1320321e87.1 for ; Fri, 27 Sep 2024 14:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727473871; x=1728078671; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e1vHxexCTLbdRB8r0KvJgoIHaBve1hvZ62MNg9aoNm0=; b=oBMIBkWw4/mAGSdEwQB+XCf5Ee2YWdXHuQ7fHkruq7pyb7qBrudcCXSdoCwEOGBC0g HA+t1waJj8/pRKEdP/mSSz38+dK+Pt19z4XBFpNERQdiZRGohl+zvYb92QWY+Xb6QReQ p3+fGQ5QhSn+99vQHULFdCxxvF4vBeG6HzdjR8DT3d8X2kAyAhAJ26jdH3FYCr+CnIVB rsaNMQTjogCULAVUtRr7KGh5oCa+5Feq7EshjVwRTwpXz5D2giDwyRDBkIMt2CoAgkum Wnygvd9diFfpiJCPJkHalxOs+X+drIeDw15+D4wkIUMlz+pFomtgCJ3WtS49XNslcEBt ae3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727473871; x=1728078671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e1vHxexCTLbdRB8r0KvJgoIHaBve1hvZ62MNg9aoNm0=; b=ZikVl3BM6qkedCCcz/yf3AMYhjuEhzgwaGVgS+Ya0OUm4FyIi3PxD5vwLkRlvaZ7uu eaTYkgoMjDkoIYYNszNcuPpTaexGfFzztJYQkINyk9zc6azT5dsK3oFsEdhXQ5/0OFZ8 Z5LLMOPXaOoeTYZorAPy5lQ/eftlTo5Gh0gFeoGf27PL9BrjRW61rqzwMeivSxJ1FAf1 tnENnNfzE6mROwxl/dT4cMSquENWHP1Riip9vR55YTZ/uD6bJr6jJy7GtA+paQy1eNuf r1rWPHYHfl732bFQVosiidZ+dOlvEM3+h/bRzV0H2VXiAWWaTvnyCNV4+BzMvAzBqPMv MLVQ== X-Gm-Message-State: AOJu0Yy4M2Jv0JJtTEPUDKItMexrZvGrxx3Ut1ihZwRwjE6nWId139EK /mPbWWArwH+o65vJa5TKcIfS2U3bP+1x7QiARkg8fJYkmVjZXRBr08X6p+McYB1J0x36XQlEy/8 l X-Received: by 2002:a05:6512:1384:b0:533:4327:b4cc with SMTP id 2adb3069b0e04-5389fc810ecmr3283260e87.52.1727473871210; Fri, 27 Sep 2024 14:51:11 -0700 (PDT) Received: from localhost.localdomain ([176.187.217.136]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42e90cd8c5asm111112965e9.1.2024.09.27.14.51.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 27 Sep 2024 14:51:10 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Jason Wang , Nicholas Piggin , David Gibson , qemu-ppc@nongnu.org, Alexey Kardashevskiy , Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 4/4] net/l2tpv3: Simplify LD/ST API uses Date: Fri, 27 Sep 2024 23:50:40 +0200 Message-ID: <20240927215040.20552-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240927215040.20552-1-philmd@linaro.org> References: <20240927215040.20552-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=philmd@linaro.org; helo=mail-lf1-x129.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Directly call ldn_be_p once instead of ldl_be_p / ldq_be_p. Signed-off-by: Philippe Mathieu-Daudé --- net/l2tpv3.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/l2tpv3.c b/net/l2tpv3.c index b5547cb917..7a0d5dcfe9 100644 --- a/net/l2tpv3.c +++ b/net/l2tpv3.c @@ -318,11 +318,7 @@ static int l2tpv3_verify_header(NetL2TPV3State *s, uint8_t *buf) */ if (s->cookie) { - if (s->cookie_is_64) { - cookie = ldq_be_p(buf + s->cookie_offset); - } else { - cookie = ldl_be_p(buf + s->cookie_offset) & 0xffffffffULL; - } + cookie = ldn_be_p(buf + s->cookie_offset, s->cookie_is_64 ? 8 : 4); if (cookie != s->rx_cookie) { if (!s->header_mismatch) { error_report("unknown cookie id");