From patchwork Fri Jun 24 08:59:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongdong Liu X-Patchwork-Id: 113428 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C332AA0032; Fri, 24 Jun 2022 11:00:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD27F42B75; Fri, 24 Jun 2022 11:00:39 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 6798D40A89; Fri, 24 Jun 2022 11:00:38 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LTrfn4rdtzDsTR; Fri, 24 Jun 2022 17:00:01 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 24 Jun 2022 17:00:36 +0800 From: Dongdong Liu To: , , , CC: , Dongdong Liu , Yisen Zhuang Subject: [PATCH 5/6] net/hns3: make code more clean Date: Fri, 24 Jun 2022 16:59:50 +0800 Message-ID: <20220624085951.3177-6-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220624085951.3177-1-liudongdong3@huawei.com> References: <20220624085951.3177-1-liudongdong3@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500017.china.huawei.com (7.221.188.110) 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 Delete unnecessary code and adjust code to make code more clean. Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_rxtx.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index b48da82b64..4ae07fd91d 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -1904,8 +1904,6 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, rxq->pvid_sw_discard_en = false; rxq->ptype_en = hns3_dev_get_support(hw, RXD_ADV_LAYOUT) ? true : false; rxq->configured = true; - rxq->io_base = (void *)((char *)hw->io_base + HNS3_TQP_REG_OFFSET + - idx * HNS3_TQP_REG_SIZE); rxq->io_base = (void *)((char *)hw->io_base + hns3_get_tqp_reg_offset(idx)); rxq->io_head_reg = (volatile void *)((char *)rxq->io_base + @@ -2437,10 +2435,8 @@ hns3_recv_pkts_simple(void *rx_queue, nmb = hns3_rx_alloc_buffer(rxq); if (unlikely(nmb == NULL)) { - uint16_t port_id; - - port_id = rxq->port_id; - rte_eth_devices[port_id].data->rx_mbuf_alloc_failed++; + rte_eth_devices[rxq->port_id].data-> + rx_mbuf_alloc_failed++; break; } @@ -3865,7 +3861,7 @@ hns3_prep_pkt_proc(struct hns3_tx_queue *tx_queue, struct rte_mbuf *m) #endif if (hns3_pkt_is_tso(m)) { if (hns3_pkt_need_linearized(m, m->nb_segs, - tx_queue->max_non_tso_bd_num) || + tx_queue->max_non_tso_bd_num) || hns3_check_tso_pkt_valid(m)) { rte_errno = EINVAL; return -EINVAL;