Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DA7FC433B4 for ; Fri, 23 Apr 2021 09:46:39 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 74D0460725 for ; Fri, 23 Apr 2021 09:46:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74D0460725 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B489410DD; Fri, 23 Apr 2021 11:46:37 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 7EDB54067E for ; Fri, 23 Apr 2021 11:46:36 +0200 (CEST) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FRTrp5BkMz1BHCs; Fri, 23 Apr 2021 17:44:10 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Fri, 23 Apr 2021 17:46:27 +0800 From: Chengchang Tang To: CC: , , , , Date: Fri, 23 Apr 2021 17:46:42 +0800 Message-ID: <1619171202-28486-3-git-send-email-tangchengchang@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1619171202-28486-1-git-send-email-tangchengchang@huawei.com> References: <1618571071-5927-1-git-send-email-tangchengchang@huawei.com> <1619171202-28486-1-git-send-email-tangchengchang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 2/2] net/bonding: support configuring Tx offloading for bonding 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" Currently, the TX offloading of the bonding device will not take effect by using dev_configure. Because the related configuration will not be delivered to the slave devices in this way. The Tx offloading capability of the bonding device is the intersection of the capability of all slave devices. Based on this, the following functions are added to the bonding driver: 1. If a Tx offloading is within the capability of the bonding device (i.e. all the slave devices support this Tx offloading), the enabling status of the offloading of all slave devices depends on the configuration of the bonding device. 2. For the Tx offloading that is not within the Tx offloading capability of the bonding device, the enabling status of the offloading on the slave devices is irrelevant to the bonding device configuration. And it depends on the original configuration of the slave devices. Signed-off-by: Chengchang Tang --- drivers/net/bonding/rte_eth_bond_pmd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 84af348..9922657 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1712,6 +1712,8 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, struct rte_flow_error flow_error; struct bond_dev_private *internals = bonded_eth_dev->data->dev_private; + uint64_t tx_offload_cap = internals->tx_offload_capa; + uint64_t tx_offload; /* Stop slave */ errval = rte_eth_dev_stop(slave_eth_dev->data->port_id); @@ -1759,6 +1761,17 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, slave_eth_dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; + while (tx_offload_cap != 0) { + tx_offload = 1ULL << __builtin_ctzll(tx_offload_cap); + if (bonded_eth_dev->data->dev_conf.txmode.offloads & tx_offload) + slave_eth_dev->data->dev_conf.txmode.offloads |= + tx_offload; + else + slave_eth_dev->data->dev_conf.txmode.offloads &= + ~tx_offload; + tx_offload_cap &= ~tx_offload; + } + nb_rx_queues = bonded_eth_dev->data->nb_rx_queues; nb_tx_queues = bonded_eth_dev->data->nb_tx_queues; -- 2.7.4