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 DCF9FA034F; Fri, 7 May 2021 11:27:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A4224013F; Fri, 7 May 2021 11:27:15 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 1FA1B40040 for ; Fri, 7 May 2021 11:27:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620379633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bLAPS2k5vEHjWpMMX/A9BFQkc82j0TiY+qiCFh/Q8i8=; b=BDhQ2sW8Qkd1vf59wgJ3p38DK+75wMUxnISfhV1BZQ4ijq+fQ6H1/BU0y2ejQZ/p2vhpKu T9uBuPXZX0AujrvFGvAiTpXBwEUVrAkp4wkFJDBWgsuNgbRD6dRjWevoWK72HSUjoqH3VI QRxZn4124tB5yzV6BoSCW4ApmvODtfU= Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-4jlAvPseNtOyz01kBIfTow-1; Fri, 07 May 2021 05:27:11 -0400 X-MC-Unique: 4jlAvPseNtOyz01kBIfTow-1 Received: by mail-vs1-f72.google.com with SMTP id g28-20020a67d49c0000b0290226baf5716bso4092050vsj.12 for ; Fri, 07 May 2021 02:27:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bLAPS2k5vEHjWpMMX/A9BFQkc82j0TiY+qiCFh/Q8i8=; b=N3YiTKcK4QfZz/dQmQ5n+kheuySqtQmB3gswQ7Om+ivb/kRSF07DynAkKNFtOce0al NeYUFtacCUdMmtcOxCRggoYPuDjsmFR0YaUq9bfYiIKSyz4VIrg5zkQrbeU+zpCP2vup JvGzm+H/9bxgKcWsEZtzoq2+q5Eq/fUNbHxWdwQfMVkZe9TPH3jBlWkbjpglj8kD95a+ AUlIt9OM4QDTLnxXt24G6kvyeu8C8DChYAHiKfl4JN0WAHoKj50agLNgyhvAaAiM7eSi 9Uww6r1i8KgXQdjK7pdHuhGjcxQTZaYzEx0cg8SHAyFDdK0a3lXALbKR2u4X933Cbb+h qhOg== X-Gm-Message-State: AOAM5334CuTOAlCPUZPyTmXUVM/kgMmQxLosnjDzoNsI6Io4aP+Vf9/n UKDtz9FxQz74AKQcvwGt8q0jxO4Lvwiu1IyRoiefm2noO1QmGdUJzwGccd2Mvkd1QYLbEd5v/bN 8FC8eMz6mSYGScH60mok= X-Received: by 2002:ab0:4757:: with SMTP id i23mr7656208uac.87.1620379630707; Fri, 07 May 2021 02:27:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhANQgGB6NOQANwgF1g81JqcMozYlb0ZqgZYGMyhYxzsX2cWqjIORSJeoAVytzfyQSKjMcY2MuENQT0oH7fTc= X-Received: by 2002:ab0:4757:: with SMTP id i23mr7656206uac.87.1620379630538; Fri, 07 May 2021 02:27:10 -0700 (PDT) MIME-Version: 1.0 References: <1619594455-56787-1-git-send-email-humin29@huawei.com> <1619594455-56787-6-git-send-email-humin29@huawei.com> In-Reply-To: <1619594455-56787-6-git-send-email-humin29@huawei.com> From: David Marchand Date: Fri, 7 May 2021 11:26:59 +0200 Message-ID: To: "Min Hu (Connor)" Cc: dev , "Yigit, Ferruh" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 5/5] net/hns3: select Tx prepare based on Tx offload 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 Sender: "dev" On Wed, Apr 28, 2021 at 9:21 AM Min Hu (Connor) wrote: > > From: Chengchang Tang > > Tx prepare should be called only when necessary to reduce the impact on > performance. > > For partial TX offload, users need to call rte_eth_tx_prepare() to invoke > the tx_prepare callback of PMDs. In this callback, the PMDs adjust the > packet based on the offloading used by the user. (e.g. For some PMDs, > pseudo-headers need to be calculated when the TX cksum is offloaded.) > > However, for the users, they cannot grasp all the hardware and PMDs > characteristics. As a result, users cannot decide when they need to > actually call tx_prepare. Therefore, we should assume that the user calls > rte_eth_tx_prepare() when using any Tx offloading to ensure that related > functions work properly. Whether packets need to be adjusted should be > determined by PMDs. They can make judgments in the dev_configure or > queue_setup phase. When the related function is not used, the pointer of > tx_prepare should be set to NULL to reduce the performance loss caused by > invoking rte_eth_tx_repare(). > > In this patch, if tx_prepare is not required for the offloading used by > the users, the tx_prepare pointer will be set to NULL. > > Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") > Cc: stable@dpdk.org > > Signed-off-by: Chengchang Tang > Signed-off-by: Min Hu (Connor) > --- > drivers/net/hns3/hns3_rxtx.c | 36 +++++++++++++++++++++++++++++++++--- > 1 file changed, 33 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c > index 3881a72..7ac3a48 100644 > --- a/drivers/net/hns3/hns3_rxtx.c > +++ b/drivers/net/hns3/hns3_rxtx.c > @@ -4203,17 +4203,45 @@ hns3_tx_check_simple_support(struct rte_eth_dev *dev) > return (offloads == (offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)); > } > > +static bool > +hns3_get_tx_prep_needed(struct rte_eth_dev *dev) > +{ > +#ifdef RTE_LIBRTE_ETHDEV_DEBUG > + /* always perform tx_prepare when debug */ > + return true; dev is unused in this case. http://mails.dpdk.org/archives/test-report/2021-May/193391.html -- David Marchand