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 4A5B542DFC; Fri, 7 Jul 2023 22:39:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 585E742D13; Fri, 7 Jul 2023 22:39:20 +0200 (CEST) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 5F85442C54 for ; Fri, 7 Jul 2023 22:39:17 +0200 (CEST) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1b89e10d356so13725545ad.3 for ; Fri, 07 Jul 2023 13:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1688762356; x=1691354356; 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=e5woK1SeTJCzVaa2ZYYU9e3gDXNH9ulFcuQ51oQx98jiFaT5QHfOXKmHDNK2khYRCG ZKIswHrq9Ryuht5F3szohOa88fjwoQaOc5RipExlqSQKn/mHEC9RH8ZVgUKhNEGLsxsz gWFbINDrMjsbdme7PJVmCecTCNltu6PwzDPlAIxPD9rJLRdjy3ki7qpe5Bn8Vm04xm1m 1Ejjz5F+BE1kdXX+tgqv5kRslYEc4lea+U3c1nEvahm9vHcLKTyWFf+T5a5L3CNMgdWh 7ISb45ZLeVv49A8zXh+aRtRnopK2TPK3NIQNtvHw8/zFkAyMiuX6on9pg4hBFJ5PooK1 rReg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688762356; x=1691354356; 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=eEFjoG9dLES01d5OGr2bAwb8fdfNUFE0bwV6WSbFowOrAnhHZiVPePRRXSEAz+ztmb sf75w/WtPlGwF4ZdsYsNqb2sYcySPEvwJ76Gk0F2AIVudHX2m2HJcR8qxCQPQo5Em1vM 8ka352jAnU1MbtspYDDP4BuoKxswn8TAEdOJdITRwP3l9ejM1uiLVl/g2A0ziPgjqnRI wfNGt5m386Riw9rH5oojft1ZT0LVTEta1Jez0pmfD0rA45Bku/pCf50ixN+SQhGNUyOx JAtAyyDgj3zX98BtxJT9sFhP6Opyc05qU9DNoZ4/UrGlPO4Hqd8Xy9rafK/ZUD1fiTpq bDKw== X-Gm-Message-State: ABy/qLYG0Rh7VBUzssXhe+vQrXDjrpruH6SfYHaF4bh5drygfVxq4CAE GIFTrOgYpTcVJZ6GU6+QPGLSnxbwmzpS1/1ogcCk4Omc X-Google-Smtp-Source: APBJJlGy4trhuPiFEbBFhcfqsQAS9VCSYs8ketdXaSCuM1Zlcwz3oZRGB/IL/uSBzyaqh8052AYQLQ== X-Received: by 2002:a17:902:d2cd:b0:1b2:5ee9:aa73 with SMTP id n13-20020a170902d2cd00b001b25ee9aa73mr6148904plc.62.1688762356320; Fri, 07 Jul 2023 13:39:16 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id t15-20020a170902b20f00b001b83db0bcf2sm3640493plr.141.2023.07.07.13.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 13:39:15 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Chaoyong He , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH v4 05/11] net/nfp: use rte_pktmbuf_mtod_offset Date: Fri, 7 Jul 2023 13:39:02 -0700 Message-Id: <20230707203908.64371-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230707203908.64371-1-stephen@networkplumber.org> References: <20230505174813.133894-1-stephen@networkplumber.org> <20230707203908.64371-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