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 B7F90A034D; Wed, 16 Feb 2022 14:37:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F7B1410FB; Wed, 16 Feb 2022 14:37:13 +0100 (CET) Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by mails.dpdk.org (Postfix) with ESMTP id 9D4BE40150 for ; Wed, 16 Feb 2022 14:37:11 +0100 (CET) Received: by mail-io1-f51.google.com with SMTP id h5so2267384ioj.3 for ; Wed, 16 Feb 2022 05:37:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Re1bvlW2385YFoGU65RqwWAyC9ZgsPE3eQo2zfJUu2M=; b=YrQZq8pqAOAe3b1EnJ+cu9pkeqvFovlu567wS7WgnJBhYNWZQrmZRxN/x2XlqmSGRv TN/0/UgYhkZykkQz9AT8lUdjhVEFMXgCm+kIeqmIHO/BselOuDVkRG43Ba1IywoC/0hF rWLMMBE67X4YnkRLbUvrpnoavTT2wN2Zagb/8pN7SgR0xzRTTZJfXBldPrM6AL3Bj7QV arguGhf50bafZW8yLGG7TlQgkDlU2sc5Ak9UqhnNjAmhcsA4KqA6teckDhX84B9PJ02S q/rQlfPyAhyxyXixyyM3mua/UAyuGJcD9PNzaX9FVdso1M+cGbALdWjX5B1oljSYOpwo /8vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Re1bvlW2385YFoGU65RqwWAyC9ZgsPE3eQo2zfJUu2M=; b=njmmK8POyNIX5xFy/lxQKr/f5EEYECPRwxEfY0+D1a9K1jgNg5n9nWQK6xNJkzmkc/ URte1X2JY9ZB0lCCRSXDw0l2KJ+mC912cw7LqrKaUNhmoM66yBl/vDu5um1aCkv6ool2 GpUPH7ORo7fLTq36xSWTmiM5EBHIV880DsiocJSE8Ho16Zk+WGVWTODSrLhI4FCOhe/7 cnI2Jt4+xO5CfGAs0GdmTBWJn0yZCFRksv5NF8yVUuOfXdadmvRo8EKJm1f+e1TL+lZi eaqBGvwDSaY7xA55kggvkYZfkZ9meSo6LXi/IM/T7nlJIGHO8/pv8Ae3j3gCkIKqzswL U/pQ== X-Gm-Message-State: AOAM533sx4C7nmRi2c5ADX4Qbz8P/X9WTz71KkMKD05sLw1Y8jdGm+y1 +QU1UfIRvxDLjMAUKueXGL1Y87Rw3GNnNEEADZwghk3K4kM= X-Google-Smtp-Source: ABdhPJxkc2e2i35GWiqb0tzAnMC1d0IUwKfk/XEFcOOY6T5t46EGHhdl542KtRnetXWohq0oifbEwjGjdlB5XWIScCw= X-Received: by 2002:a05:6602:2d0d:b0:633:14e4:7753 with SMTP id c13-20020a0566022d0d00b0063314e47753mr1828658iow.121.1645018630820; Wed, 16 Feb 2022 05:37:10 -0800 (PST) MIME-Version: 1.0 References: <20220119105203.1553714-1-rbhansali@marvell.com> In-Reply-To: <20220119105203.1553714-1-rbhansali@marvell.com> From: Jerin Jacob Date: Wed, 16 Feb 2022 19:06:44 +0530 Message-ID: Subject: Re: [PATCH] net/cnxk: resolve mbuf data length update issue To: Rahul Bhansali Cc: dpdk-dev , Pavan Nikhilesh , Shijith Thotton , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Jerin Jacob Content-Type: text/plain; charset="UTF-8" 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 On Wed, Jan 19, 2022 at 4:22 PM Rahul Bhansali wrote: > > If multi-segment is enabled and single segment/packet > is received, then mbuf data_len is not updated in > cn9k_nix_cqe_to_mbuf function. > Also, in case of timestamp is enabled, mbuf data_len > and pkt_len will be updated for all packets including > multi segmented packets. > > Signed-off-by: Rahul Bhansali Changed the git commit as follows and Applied to dpdk-next-net-mrvl/for-next-net. Thanks net/cnxk: fix mbuf data length If multi-segment is enabled and single segment/packet is received, then mbuf data_len is not updated in cn9k_nix_cqe_to_mbuf() function. Also, in case of timestamp is enabled, mbuf data_len and pkt_len will be updated for all packets including multi segmented packets. Fixes: 7c6bee34064f ("net/cnxk: enable PTP processing in vector Rx") Cc: stable@dpdk.org Signed-off-by: Rahul Bhansali Acked-by: Jerin Jacob > --- > Depends-on: Series-21246 ("[v2,1/4] net/cnxk: avoid command copy from Tx > queue") > > drivers/event/cnxk/cn10k_worker.h | 2 -- > drivers/event/cnxk/cn9k_worker.h | 2 -- > drivers/net/cnxk/cn10k_rx.h | 9 +++++++-- > drivers/net/cnxk/cn9k_rx.h | 18 +++++++++++------- > drivers/net/cnxk/cnxk_ethdev.h | 9 +++------ > 5 files changed, 21 insertions(+), 19 deletions(-) > > diff --git a/drivers/event/cnxk/cn10k_worker.h b/drivers/event/cnxk/cn10k_worker.h > index 1e61a6ddf0..5c36540a43 100644 > --- a/drivers/event/cnxk/cn10k_worker.h > +++ b/drivers/event/cnxk/cn10k_worker.h > @@ -174,7 +174,6 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags, > CNXK_SSO_WQE_SG_PTR); > cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, tstamp, > flags & NIX_RX_OFFLOAD_TSTAMP_F, > - flags & NIX_RX_MULTI_SEG_F, > (uint64_t *)tstamp_ptr); > wqe[0] = (uint64_t *)mbuf; > non_vec--; > @@ -266,7 +265,6 @@ cn10k_sso_hws_get_work(struct cn10k_sso_hws *ws, struct rte_event *ev, > cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, > ws->tstamp, > flags & NIX_RX_OFFLOAD_TSTAMP_F, > - flags & NIX_RX_MULTI_SEG_F, > (uint64_t *)tstamp_ptr); > gw.u64[1] = mbuf; > } else if (CNXK_EVENT_TYPE_FROM_TAG(gw.u64[0]) == > diff --git a/drivers/event/cnxk/cn9k_worker.h b/drivers/event/cnxk/cn9k_worker.h > index e44422ec25..368baae048 100644 > --- a/drivers/event/cnxk/cn9k_worker.h > +++ b/drivers/event/cnxk/cn9k_worker.h > @@ -208,7 +208,6 @@ cn9k_sso_hws_dual_get_work(uint64_t base, uint64_t pair_base, > cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, > dws->tstamp, > flags & NIX_RX_OFFLOAD_TSTAMP_F, > - flags & NIX_RX_MULTI_SEG_F, > (uint64_t *)tstamp_ptr); > gw.u64[1] = mbuf; > } > @@ -285,7 +284,6 @@ cn9k_sso_hws_get_work(struct cn9k_sso_hws *ws, struct rte_event *ev, > cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, > ws->tstamp, > flags & NIX_RX_OFFLOAD_TSTAMP_F, > - flags & NIX_RX_MULTI_SEG_F, > (uint64_t *)tstamp_ptr); > gw.u64[1] = mbuf; > } > diff --git a/drivers/net/cnxk/cn10k_rx.h b/drivers/net/cnxk/cn10k_rx.h > index 9694a3080f..45b626b089 100644 > --- a/drivers/net/cnxk/cn10k_rx.h > +++ b/drivers/net/cnxk/cn10k_rx.h > @@ -364,7 +364,13 @@ cn10k_nix_cqe_to_mbuf(const struct nix_cqe_hdr_s *cq, const uint32_t tag, > *(uint64_t *)(&mbuf->rearm_data) = val; > > if (flag & NIX_RX_MULTI_SEG_F) > - nix_cqe_xtract_mseg(rx, mbuf, val, flag); > + /* > + * For multi segment packets, mbuf length correction according > + * to Rx timestamp length will be handled later during > + * timestamp data process. > + * Hence, flag argument is not required. > + */ > + nix_cqe_xtract_mseg(rx, mbuf, val, 0); > else > mbuf->next = NULL; > } > @@ -452,7 +458,6 @@ cn10k_nix_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts, > flags); > cnxk_nix_mbuf_to_tstamp(mbuf, rxq->tstamp, > (flags & NIX_RX_OFFLOAD_TSTAMP_F), > - (flags & NIX_RX_MULTI_SEG_F), > (uint64_t *)((uint8_t *)mbuf > + data_off)); > rx_pkts[packets++] = mbuf; > diff --git a/drivers/net/cnxk/cn9k_rx.h b/drivers/net/cnxk/cn9k_rx.h > index fa4efbf80a..c883eaeb07 100644 > --- a/drivers/net/cnxk/cn9k_rx.h > +++ b/drivers/net/cnxk/cn9k_rx.h > @@ -345,13 +345,18 @@ cn9k_nix_cqe_to_mbuf(const struct nix_cqe_hdr_s *cq, const uint32_t tag, > mbuf->ol_flags = ol_flags; > *(uint64_t *)(&mbuf->rearm_data) = val; > mbuf->pkt_len = len; > - > - if (flag & NIX_RX_MULTI_SEG_F) { > - nix_cqe_xtract_mseg(rx, mbuf, val, flag); > - } else { > - mbuf->data_len = len; > + mbuf->data_len = len; > + > + if (flag & NIX_RX_MULTI_SEG_F) > + /* > + * For multi segment packets, mbuf length correction according > + * to Rx timestamp length will be handled later during > + * timestamp data process. > + * Hence, flag argument is not required. > + */ > + nix_cqe_xtract_mseg(rx, mbuf, val, 0); > + else > mbuf->next = NULL; > - } > } > > static inline uint16_t > @@ -414,7 +419,6 @@ cn9k_nix_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts, > flags); > cnxk_nix_mbuf_to_tstamp(mbuf, rxq->tstamp, > (flags & NIX_RX_OFFLOAD_TSTAMP_F), > - (flags & NIX_RX_MULTI_SEG_F), > (uint64_t *)((uint8_t *)mbuf > + data_off)); > rx_pkts[packets++] = mbuf; > diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h > index 5bfda3d815..480cc6dfa4 100644 > --- a/drivers/net/cnxk/cnxk_ethdev.h > +++ b/drivers/net/cnxk/cnxk_ethdev.h > @@ -685,14 +685,11 @@ cnxk_nix_timestamp_dynfield(struct rte_mbuf *mbuf, > static __rte_always_inline void > cnxk_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf, > struct cnxk_timesync_info *tstamp, > - const uint8_t ts_enable, const uint8_t mseg_enable, > - uint64_t *tstamp_ptr) > + const uint8_t ts_enable, uint64_t *tstamp_ptr) > { > if (ts_enable) { > - if (!mseg_enable) { > - mbuf->pkt_len -= CNXK_NIX_TIMESYNC_RX_OFFSET; > - mbuf->data_len -= CNXK_NIX_TIMESYNC_RX_OFFSET; > - } > + mbuf->pkt_len -= CNXK_NIX_TIMESYNC_RX_OFFSET; > + mbuf->data_len -= CNXK_NIX_TIMESYNC_RX_OFFSET; > > /* Reading the rx timestamp inserted by CGX, viz at > * starting of the packet data. > -- > 2.25.1 >