From patchwork Sat Jul 8 01:57:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 129395 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9F14042DFC; Sat, 8 Jul 2023 03:58:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E8A0F42D47; Sat, 8 Jul 2023 03:57:34 +0200 (CEST) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id 2E33B42D36 for ; Sat, 8 Jul 2023 03:57:31 +0200 (CEST) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1b7e66ff65fso17714825ad.0 for ; Fri, 07 Jul 2023 18:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1688781450; x=1691373450; 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=78HDkboHxTG/XRmT10zNrGhuzXGadIdppWfUSd5orjE=; b=ii3i5NGEL+zoD9f+pA+xbab3/kdNLIHWYFLQWSgYKRAYrt+gJrse5UWwkA9Cpil+yk oamEd62uW0QIq40vEgKvzsgenWYWbbG4xj38rmyS2d3tt6gJKP/m6Dow/V9wk5MUZVJP lCMojUzPPodAEqbrEV3UtzmFAwhXmOpHti9fTa2VcU2CUwHtgLnc1txuVE35uxUcZGVA IVCvccJulviBClSLFbgtJn/ZyGhx+6ZTwwHaKaNvuYVTQwlo88+V8Ef+ogxAiakH5Kgh 5xntgnQSdk8DOEEK0MPHHuq5iimNnDVE6XEsX6dcxFVCS+GU2F1+i7rKjN9sKuLcatgr 1YUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688781450; x=1691373450; 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=78HDkboHxTG/XRmT10zNrGhuzXGadIdppWfUSd5orjE=; b=QP7JYWXjDs/rK40c6lLywq5PueRouLn1pqRKUZ6mBcdRjEpHd1Snrd0gw4DPlzpp/v U8F7Fxx7Vm0MFTfycUjGIzG5//2exmqwd1ojsh6X38wRdBfnFyIvXxC9+dLNc6ujeP1G Rmf4P/RGVYEqiVqmkAgzXmz+8jt4Xnd75JgqjSuSWgmqpYcJL4MnV88NygWUF7MsPQOV Jdoxa5/UzRIbUAhkYIyha/MD52qMhTvKYFl8AtiDpnDV0R+X1p/Uay34W3OIMOCyrw4x +Qc7lWEMwxieBthxyETVdkv/UeeYQOVkavElBkOLr+XrTXqECPq64FN9y5fPSx1tR/44 16MA== X-Gm-Message-State: ABy/qLYWxBDRNr5g0J9lShMmQe5Pr2oXy4wdjqKrdyuYaKFfS4+SR9E+ lbWHtH3kRDHRYoSSqJ43+U+MSBI/9H4SgScCr4w46+cM X-Google-Smtp-Source: APBJJlH/0euE0zlCiCaG9k7HJb+c9B8SXHSaRmpZWXJsUmm0RkrTksBlD97vxQt1KL+501fAfaQxeQ== X-Received: by 2002:a17:902:d395:b0:1b9:be2e:2b40 with SMTP id e21-20020a170902d39500b001b9be2e2b40mr4570154pld.50.1688781450091; Fri, 07 Jul 2023 18:57:30 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id 24-20020a17090a035800b00263f5ac814esm2260269pjf.38.2023.07.07.18.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 18:57:29 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Aman Singh , Yuying Zhang Subject: [PATCH v5 09/11] testpmd: use rte_pktmbuf_mtod_offset Date: Fri, 7 Jul 2023 18:57:16 -0700 Message-Id: <20230708015718.75565-10-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230708015718.75565-1-stephen@networkplumber.org> References: <20230505174813.133894-1-stephen@networkplumber.org> <20230708015718.75565-1-stephen@networkplumber.org> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Replace explicit packet offset computations with rte_pktmbuf_mtod_offset(). Signed-off-by: Stephen Hemminger --- app/test-pmd/ieee1588fwd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index 386d9f10e642..3371771751dd 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -138,8 +138,8 @@ ieee1588_packet_fwd(struct fwd_stream *fs) * Check that the received PTP packet is a PTP V2 packet of type * PTP_SYNC_MESSAGE. */ - ptp_hdr = (struct ptpv2_msg *) (rte_pktmbuf_mtod(mb, char *) + - sizeof(struct rte_ether_hdr)); + ptp_hdr = rte_pktmbuf_mtod_offset(mb, struct ptpv2_msg *, + sizeof(struct rte_ether_hdr)); if (ptp_hdr->version != 0x02) { printf("Port %u Received PTP V2 Ethernet frame with wrong PTP" " protocol version 0x%x (should be 0x02)\n",