On 2023-07-07 18:57:12 -0700, Stephen Hemminger wrote: > Replace explicit packet offset computations with rte_pktmbuf_mtod_offset(). > > Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
Reviewed-by: Niklas Söderlund <niklas.soderl...@corigine.com> > --- > 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 > -- Kind Regards, Niklas Söderlund