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 6CB9CA0545; Wed, 25 May 2022 03:09:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 149C4400EF; Wed, 25 May 2022 03:09:47 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id D85A9400D6; Wed, 25 May 2022 03:09:44 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4L7Cdt6KM4zDqRG; Wed, 25 May 2022 09:09:38 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 25 May 2022 09:09:41 +0800 From: "Min Hu (Connor)" To: CC: "Min Hu (Connor)" , , Chas Williams , Thomas Monjalon , David Marchand , Neil Horman Subject: [PATCH v2] net/bonding: fix mbuf fast free usage Date: Wed, 25 May 2022 09:08:28 +0800 Message-ID: <20220525010828.39276-1-humin29@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220521070814.35704-1-humin29@huawei.com> References: <20220521070814.35704-1-humin29@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected 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 Usage of 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload has two constraints: per-queue all mbufs comes from the same mempool and has refcnt = 1. Bonding mode Broadcast, Tx mbuf has more than one refcnt. Bonding mode 8023AD, It contains two mempools separately for LACP packets and other packets. In Tx or Rx, Fast mbuf free will operate mbuf from different mempool. This patch will prevent 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload when in bonding mode Broadcast and mode 8023AD. Fixes: 78aecefed955 ("bond: move param parsing in configure step") Cc: stable@dpdk.org Signed-off-by: Min Hu (Connor) --- v2: * fix syntax comment. --- drivers/net/bonding/rte_eth_bond_pmd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 734d1da540..7ce787d429 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -3603,6 +3603,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev) const char *name = dev->device->name; struct bond_dev_private *internals = dev->data->dev_private; struct rte_kvargs *kvlist = internals->kvlist; + uint64_t offloads; int arg_count; uint16_t port_id = dev - rte_eth_devices; uint8_t agg_mode; @@ -3663,6 +3664,16 @@ bond_ethdev_configure(struct rte_eth_dev *dev) } } + offloads = dev->data->dev_conf.txmode.offloads; + if ((offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) && + (internals->mode == BONDING_MODE_8023AD || + internals->mode == BONDING_MODE_BROADCAST)) { + RTE_BOND_LOG(WARNING, + "bond mode broadcast & 8023AD don't support MBUF_FAST_FREE offload, force disable it."); + offloads &= ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; + dev->data->dev_conf.txmode.offloads = offloads; + } + /* set the max_rx_pktlen */ internals->max_rx_pktlen = internals->candidate_max_rx_pktlen; -- 2.33.0