From patchwork Mon Jan 7 05:50:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yuqi jin X-Patchwork-Id: 10749901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F38F913BF for ; Mon, 7 Jan 2019 06:02:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE3E128970 for ; Mon, 7 Jan 2019 06:02:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC14028998; Mon, 7 Jan 2019 06:02:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 43F8728970 for ; Mon, 7 Jan 2019 06:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ZhjLp2Iqz8zlGjeJdiRM121hn3uTqH7DqcJL6oxkz6A=; b=HdjTDFVbPCK9N8 tOW90jEugSPpxEIvSawd4MQQ8T1If2jN5ZP+HdUJTZjfg7k7aJWfSbvrVT6C25bYuOVoVVOQeQCVg NonsnO06VWwbpQQvCGReAgSzpCCisQUjbPIN2G1Dby5Np4qJn+cpXIN9i+smAcc/mG6PDXs95PVJW XfLLmXHysZf2ksD3CsVrzJMKFAY3mVl9A/F9ubJmt5nJQ2YrsQfkZ1bp+uvLHLdqXWuFisW2z1Xj4 q5/AbyrG3lL23bM4KUk/9CRD/xA+HbpWZDRPP2jFpI++n4HbAv2t+3KLz0JGEb9kvNOfs5nVSV4Uz SEpu3xsdg2VznMBe0uxA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggNzQ-00065b-JZ; Mon, 07 Jan 2019 06:02:20 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggNzN-00064T-Ck for linux-arm-kernel@lists.infradead.org; Mon, 07 Jan 2019 06:02:18 +0000 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4B2012A8CA6177CF9BB8; Mon, 7 Jan 2019 14:02:06 +0800 (CST) Received: from SZX1000457887.localdomain (10.21.56.152) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.408.0; Mon, 7 Jan 2019 13:53:42 +0800 From: yuqi jin To: Subject: [PATCH] net:hns3:add xps init support Date: Mon, 7 Jan 2019 13:50:59 +0800 Message-ID: <1546840259-111361-1-git-send-email-jinyuqi@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.21.56.152] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190106_220217_587781_5725898E X-CRM114-Status: GOOD ( 11.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yuqi jin , Salil Mehta , Yisen Zhuang , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP XPS settings based on CPU(s) map . we can use __netdev_pick_tx to select the transmit queue,then we can improve performance Cc: Yisen Zhuang Cc: Salil Mehta Cc: "David S. Miller" Signed-off-by: yuqi jin --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index d3b9aaf..29e2225 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -377,6 +377,30 @@ static int hns3_nic_net_up(struct net_device *netdev) return ret; } +static int hns3_config_xps(struct hns3_nic_priv *priv) +{ + struct hnae3_handle *h = priv->ae_handle; + struct hnae3_knic_private_info *kinfo = &h->kinfo; + unsigned int queue_size = kinfo->rss_size * kinfo->num_tc; + struct hns3_enet_tqp_vector *tqp_vector; + struct hns3_nic_ring_data ring_data; + int ret = 0, i; + + for (i = 0; i < queue_size; i++) { + ring_data = priv->ring_data[i]; + tqp_vector = ring_data.ring->tqp_vector; + ret = netif_set_xps_queue(kinfo->netdev, + &tqp_vector->affinity_mask, + ring_data.queue_index); + if (ret) { + netdev_err(kinfo->netdev, "ret %d xps %d\n", ret, + tqp_vector->idx); + return ret; + } + } + return ret; +} + static int hns3_nic_net_open(struct net_device *netdev) { struct hns3_nic_priv *priv = netdev_priv(netdev); @@ -409,6 +433,12 @@ static int hns3_nic_net_open(struct net_device *netdev) if (h->ae_algo->ops->set_timer_task) h->ae_algo->ops->set_timer_task(priv->ae_handle, true); + ret = hns3_config_xps(priv); + if (ret) { + netdev_err(netdev, + "hns xps init fail, ret=%d!\n", ret); + return ret; + } return 0; }