From patchwork Fri Sep 27 21:45:31 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: 831033 Delivered-To: patch@linaro.org Received: by 2002:a5d:66c8:0:b0:367:895a:4699 with SMTP id k8csp969026wrw; Fri, 27 Sep 2024 14:47:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWZHnac70wzfqbDWXSneXPjXdMOjzspjumMQjWcdOkMhjri7k6YjLIPUR/RjYNFtq6B9hQ4Ew==@linaro.org X-Google-Smtp-Source: AGHT+IEZfDjF1qoIkeeHDIJBi5hHEPUrHLaDc1fE8UN9vF0891d83Fl8gXi9BmIKMu4W37mDw62B X-Received: by 2002:a05:620a:2492:b0:7a8:364:80b0 with SMTP id af79cd13be357-7ae378c2cf8mr480789685a.47.1727473633538; Fri, 27 Sep 2024 14:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727473633; cv=none; d=google.com; s=arc-20240605; b=eyvIEbYvzLL+2dOYbQMmI/cK/Iw6B71MH/aoQRpObKhENPpM9hHOtXkdA3vNgFHAW1 ZN1kq/n/qKwYC9K11hE3bN8WpKFwiqe1B10bPMffH1ExG2Ote1pPWSVRfe33im+++5VJ by5Q09qUTGNSAZ4bdB9PPxmy0l+bG6ohb/6uINZNi1jzo6G0sge/KJcCHP8iVIgtZF5f ftYhrMpnR8gYGUTxNZxSEj3cgSkkiW5fofpEmFd0SPct+i08Xb9+y8CgZmbPqIGZLnL5 bOM4t6HFc2he4nOMFAYqIbcaRQexVpH6JR/oD1togxNR31LnUzJm96z/PzJ+OT7csIBo tPNw== 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=g3QeHlbvb1KMMNFLUbXIUYUDrJCyu1ADbrLKZLJdjPs=; b=EQwJMUo3igZLKy0gwy+I5P3WMTKRSdyYCLyOTbzzzH5iz+UvCbfDfTlrSGWf0Oj+Y0 47gIFwaANwpciB5u50JU/8XevmEPk1mFWUXPVWZMQ7Klj0jRappPKtSMhndYybzli1fl NY4bqeLDb9Ui1s5Qxh/m9NuruydNXOZ+Sj/pL9p+2nGlz/lbqtckA1QYpb9VOSPi0ypY dcUao37s218vFQ9Bju2lvySqof1/BEoaGx01gjmcyhfAblqNre1SZpAmVZ6N6bfE4h7v N4ay8bvaK29Rjvtcq6ZbRBGmhMntwnkiKgkQBzJceP+l5c+bh2KlsHdirMbsiXp4KugT Gryw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NiCuqekY; 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 af79cd13be357-7ae378713dbsi305579085a.576.2024.09.27.14.47.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Sep 2024 14:47:13 -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=NiCuqekY; 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 1suIms-0004pA-2N; Fri, 27 Sep 2024 17:46:06 -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 1suImq-0004n7-Fb for qemu-devel@nongnu.org; Fri, 27 Sep 2024 17:46:04 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1suImo-0003ws-Uo for qemu-devel@nongnu.org; Fri, 27 Sep 2024 17:46:04 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-37a413085cbso2572286f8f.1 for ; Fri, 27 Sep 2024 14:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727473561; x=1728078361; 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=NiCuqekYQvacC/zN+941Yi6PEy/hLXyBY7AG4dS3FtRi8PXf2cI+Zx2j6l3PDD5YQv kq+UgfRubfUT2i2mRi1hmcnIKb0wKcRKrjUJPbRgwdf/+1JmBoHs7k898U/KTOKoH4Io fjzS75vVlUMd7Aa8vkmD4vEc0qMzv8AcKoXX91L73Bsr7aoNPGOhbsBwOM4M/+9u5G+N gs9RoMiRTAZnv8mbdsIoH+MnU8CWU5WIQdtYVBui47x0XTi/Z93v7Rp7QGC35VQfPkRL 10BZ/aqLqaKjSIWZcMz3UHy/+7fyaFZQHWmUoQo+G5O+jzOBK3rWMGMOIccts1jcm5LU FKHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727473561; x=1728078361; 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=UyEiW1Uc6wsjHEKbguLTDz06I1XAe94yvLpxeAywg9ZTuHgpe/A8+AeGXxEz8lvGqQ W1/U7SkdmvEleF6gdyY5sRLMfdcjMSHHrD0z6QLpVDiqW8BrGJRDP+An06ybloDSJc2L ldHNncqmrxwA1I+Om1XGGUXTOj0y62/jGViIPhCRM0hS6O4Kt4dzXeCGGf7Mr+Ny+stQ OUpDhRGKKHz9GWOr2W8XMrQT8oF06CsJOFxvUsq2DlGAg+KGbGyTy7DQ+1FV0G/dyh3y Pb0u/7xb4S764zC8v2CUDOiGOWH/PcP4w686zGaFKdx4FSyrQ2Cwwvcft8/odYF8yOVB Xq5A== X-Gm-Message-State: AOJu0YyeOe4KzXBFml+5nc4vlB3YNcoGlwacVPo32dmacXMx25d63v8s /REI6tY6gk0+0EUUAT9BzBxR/7XC/6t96wB9xqzfRMjLI/CN3lsR6+M0+c21GanGk5WRfu4a9Q+ P X-Received: by 2002:a5d:500f:0:b0:374:ba78:9013 with SMTP id ffacd0b85a97d-37cd568e21cmr2908343f8f.9.1727473561121; Fri, 27 Sep 2024 14:46:01 -0700 (PDT) Received: from localhost.localdomain ([176.187.217.136]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37cd574282esm3373982f8f.104.2024.09.27.14.45.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 27 Sep 2024 14:46:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Nicholas Piggin , David Gibson , qemu-ppc@nongnu.org, Alexey Kardashevskiy , Harsh Prateek Bora , Jason Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 4/4] net/l2tpv3: Simplify LD/ST API uses Date: Fri, 27 Sep 2024 23:45:31 +0200 Message-ID: <20240927214531.20242-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240927214531.20242-1-philmd@linaro.org> References: <20240927214531.20242-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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");