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 0853DA0032; Sat, 17 Sep 2022 04:35:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81C864021D; Sat, 17 Sep 2022 04:35:44 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id AB38B40156 for ; Sat, 17 Sep 2022 04:35:41 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTw2t67f8zpSsx; Sat, 17 Sep 2022 10:32:54 +0800 (CST) Received: from [10.67.100.224] (10.67.100.224) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 17 Sep 2022 10:35:39 +0800 Subject: Re: [PATCH v2 1/3] net/bonding: support Tx prepare To: Chas Williams <3chas3@gmail.com>, Ferruh Yigit , , , CC: , , References: <1619171202-28486-2-git-send-email-tangchengchang@huawei.com> <20220725040842.35027-1-fengchengwen@huawei.com> <20220725040842.35027-2-fengchengwen@huawei.com> <495fb2f0-60c2-f1c9-2985-0d08bb463ad0@xilinx.com> <4b4af3e8-710a-ae75-8171-331ebfe4e4f7@huawei.com> <6c91f993-b11d-987c-6d20-38ee11f9f9db@gmail.com> From: fengchengwen Message-ID: <509a1984-841a-e42c-05c1-707b024ef7a8@huawei.com> Date: Sat, 17 Sep 2022 10:35:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <6c91f993-b11d-987c-6d20-38ee11f9f9db@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.100.224] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500024.china.huawei.com (7.185.36.10) 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 Hi Chas, On 2022/9/15 0:59, Chas Williams wrote: > On 9/13/22 20:46, fengchengwen wrote: >> >> The main problem is hard to design a tx_prepare for bonding device: >> 1. as Chas Williams said, there maybe twice hash calc to get target slave >>     devices. >> 2. also more important, if the slave devices have changes(e.g. slave device >>     link down or remove), and if the changes happens between bond-tx-prepare and >>     bond-tx-burst, the output slave will changes, and this may lead to checksum >>     failed. (Note: a bond device with slave devices may from different vendors, >>     and slave devices may have different requirements, e.g. slave-A support calc >>     IPv4 pseudo-head automatic (no need driver pre-calc), but slave-B need driver >>     pre-calc). >> >> Current design cover the above two scenarios by using in-place tx-prepare. and >> in addition, bond devices are not transparent to applications, I think it's a >> practical method to provide tx-prepare support in this way. >> > > > I don't think you need to export an enable/disable routine for the use of > rte_eth_tx_prepare. It's safe to just call that routine, even if it isn't > implemented. You are just trading one branch in DPDK librte_eth_dev for a > branch in drivers/net/bonding. Our first patch was just like yours (just add tx-prepare default), but community is concerned about impacting performance. As a trade-off, I think we can add the enable/disable API. > > I think you missed fixing tx_machine in 802.3ad support. We have been using > the following patch locally which I never got around to submitting. You are right, I will send V3 fix it. > > > From a458654d68ff5144266807ef136ac3dd2adfcd98 Mon Sep 17 00:00:00 2001 > From: "Charles (Chas) Williams" > Date: Tue, 3 May 2022 16:52:37 -0400 > Subject: [PATCH] net/bonding: call rte_eth_tx_prepare before rte_eth_tx_burst > > Some PMDs might require a call to rte_eth_tx_prepare before sending the > packets for transmission. Typically, the prepare step handles the VLAN > headers, but it may need to do other things. > > Signed-off-by: Chas Williams ... >               * ring if transmission fails so the packet isn't lost. > @@ -1322,8 +1350,12 @@ bond_ethdev_tx_burst_broadcast(void *queue, struct rte_mbuf **bufs, >   >      /* Transmit burst on each active slave */ >      for (i = 0; i < num_of_slaves; i++) { > -        slave_tx_total[i] = rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id, > +        uint16_t nb_prep; > + > +        nb_prep = rte_eth_tx_prepare(slaves[i], bd_tx_q->queue_id, >                      bufs, nb_pkts); > +        slave_tx_total[i] = rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id, > +                    bufs, nb_prep); The tx-prepare may edit packet data, and the broadcast mode will send a packet to all slaves, the packet data is sent and edited at the same time. Is this likely to cause problems ? >   >          if (unlikely(slave_tx_total[i] < nb_pkts)) >              tx_failed_flag = 1;