From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 74E7442DFC; Sat, 8 Jul 2023 03:57:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA6CA42D30; Sat, 8 Jul 2023 03:57:29 +0200 (CEST) Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.51]) by mails.dpdk.org (Postfix) with ESMTP id 81A2440DDB for ; Sat, 8 Jul 2023 03:57:26 +0200 (CEST) Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-1b3c503af99so2335757fac.0 for ; Fri, 07 Jul 2023 18:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1688781445; x=1691373445; 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=WCcu2dN6EjqUsiGoKbGVJPohYYLQcR8Owv9miQ51APU=; b=2E4Dh83pVtq2rX+AejtPXEIf4J/O9gycPzBINKT9LpYvzhlVl+nfHBVhXEDww5h6F6 0I54ofuLWeuU1tbXUcPVlarxOrYGaVnQkRsvboxUlNUy3GQiW1vors9+5B8GuQy+pQdm S3HDaP49HExQD41jR5EM1OHbXeiLZZwQ6vFDVU8uqJ9JqZLXg408NijnheNodeeLQ+kj rNSFpAJ6hRC9l1hNLPmyhtHhM3xNMDmCAmThCQmvxihR9GJMU9UMTL5KTacHvs+Tseu1 UkhFUnGYX7U3JYOIv0JyKt3JP9UE/iYqEQCB/5d0aBnGMGw1LsgwM27EGGXm/0hTB/gb +OuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688781445; x=1691373445; 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=WCcu2dN6EjqUsiGoKbGVJPohYYLQcR8Owv9miQ51APU=; b=YsbFlOxyCXtZkEcWIY5frn9/hWTtwvvKiR6RTxQ5oJtoB+GwCGAaVbCWh/mLRkrH0l EZL1tuUZUW4Pq71qzFzY3Cvx9tOg/z7/XgPfNzigDmS/Lr+HdKg+rdMPt7x+J9o5mJZL 6ab+HzltECIgbVIoCFbfLiyQ+FeHOFp1v0H960IGVaQ+BvP3Z7gFRt2ZKGEW7VN1VBCD 4IApXAStJXWD0UNL0SYTBD9YcROGHvrCCBMon+3IwzxNWvucU5BcLKQI4WjhetxoaxCb sUginkP3rST5Vov8gBkNI46thdxhkIRNQPzG0Q+DibksQVpb9ELlSq8G+tm1uZIfPLnW QYaQ== X-Gm-Message-State: ABy/qLYNJpFy9zNRPQ8qx5ZRhpVqFGKLyA7G8rbUWifkdaG6kj1vJKhl t1AxrqMK/XA+bnGSSy3M38rmTqUcBdhxnHNmINDImxx5 X-Google-Smtp-Source: APBJJlG/pcGjJeyrElNKYic5qPRRtzSLE6iHgbCoNuNtYBEo8ZEcxd0Wy76D2jmyXTXiRggwNESMMg== X-Received: by 2002:a05:6870:438f:b0:1b0:25b4:4b77 with SMTP id r15-20020a056870438f00b001b025b44b77mr8156666oah.14.1688781445594; Fri, 07 Jul 2023 18:57:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 18:57:25 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Chaoyong He , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH v5 05/11] net/nfp: use rte_pktmbuf_mtod_offset Date: Fri, 7 Jul 2023 18:57:12 -0700 Message-Id: <20230708015718.75565-6-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 Content-Transfer-Encoding: 8bit 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 --- drivers/net/nfp/flower/nfp_flower_cmsg.h | 3 ++- drivers/net/nfp/flower/nfp_flower_ctrl.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index f643d54d39a4..787a38dc9aa0 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -381,7 +381,8 @@ enum nfp_flower_cmsg_port_vnic_type { static inline char* nfp_flower_cmsg_get_data(struct rte_mbuf *m) { - return rte_pktmbuf_mtod(m, char *) + 4 + 4 + NFP_FLOWER_CMSG_HLEN; + return rte_pktmbuf_mtod_offset(m, char *, + 4 + 4 + NFP_FLOWER_CMSG_HLEN); } /* diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c index 4cb2c2f99e04..18823a97887d 100644 --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c @@ -389,7 +389,7 @@ nfp_flower_cmsg_rx_stats(struct nfp_flow_priv *flow_priv, uint32_t ctx_id; struct nfp_flower_stats_frame *stats; - msg = rte_pktmbuf_mtod(mbuf, char *) + NFP_FLOWER_CMSG_HLEN; + msg = rte_pktmbuf_mtod_offset(mbuf, char *, NFP_FLOWER_CMSG_HLEN); msg_len = mbuf->data_len - NFP_FLOWER_CMSG_HLEN; count = msg_len / sizeof(struct nfp_flower_stats_frame); @@ -412,7 +412,7 @@ nfp_flower_cmsg_rx_qos_stats(struct nfp_mtr_priv *mtr_priv, struct nfp_mtr *mtr; struct nfp_mtr_stats_reply *mtr_stats; - msg = rte_pktmbuf_mtod(mbuf, char *) + NFP_FLOWER_CMSG_HLEN; + msg = rte_pktmbuf_mtod_offset(mbuf, char *, NFP_FLOWER_CMSG_HLEN); mtr_stats = (struct nfp_mtr_stats_reply *)msg; profile_id = rte_be_to_cpu_32(mtr_stats->head.profile_id); -- 2.39.2