Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp978364ybk; Fri, 15 May 2020 20:00:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGU4cbGVDgxAosJy3HzUsF6YvBasUVvjZLAuTzJtSq/XKvLnI2AOKx0f68o9mWNtG3Sv8R X-Received: by 2002:a17:906:4749:: with SMTP id j9mr5834412ejs.23.1589598014994; Fri, 15 May 2020 20:00:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589598014; cv=none; d=google.com; s=arc-20160816; b=nS2egQkz3A1lSRGtgx29piWeX0dQ8qW2n/q1LUPZU8k9t57optfvea1z6OfdQ358T6 OSkjlk1q+fRpw79QAER8Zdt4JgUTOtyHg8w5Ntl0VSXNjsxBIeOiTwhZ6U4Ncw1ogfoF KBFy97fo9iQWZ6+nvsNAMje3nBRZh09QzgOIkz/XAaiL9RgqWOezHq8+GPDz025PgFGR IcHQ+4a79hM3G0udW1AdXjB0aKtHO8lpzEItpagmWXVATi2sNirdyoXSpdvV/xezQeNr 5ZzIIYuL7IikEIdFYjOc6cn6NQA7PcvE8b8URtZJqyaUPGNByII7IdpMFwWpB4tdhnld dW6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=swQ7Gz6ZvWBgXSxn0IwAtk4oNrv/w7EUFkUiPQGzeR8=; b=YmuETnVgatVwZe7PeQhXR8A6A73kVSRchjfseS8OXQQOk8q4K7ZqQXQcE1yFSiCurw 3Pb0hi3iGEENC3Ioq9z21RmHnhisQgOD0mb9Bz6VkXHCMvEB4ew8aR5H5BLSRNvCqjGQ qI/zWtv4zYeJKyi8aT5VaXzSDcNEKQ7R0BIYJ3ihNYVfy9PrU3cgJolWLKpFtH1Ob0S5 jzADyQNgmpo5ygE7pZoHsYob9e5d4DzSoYkyTgWx0whFNhN6EHC8NaT9iUvOcngDhC0w a0cHIcw7/Dmp+O1f46daSSOOxxwFreTRG1HBQUGQXRlaxnZnY47O/Bj+0fpIqYnzyZGy 2IeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g4si2333967edu.287.2020.05.15.19.59.50; Fri, 15 May 2020 20:00:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727898AbgEPC6c (ORCPT + 99 others); Fri, 15 May 2020 22:58:32 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:2077 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726247AbgEPC6c (ORCPT ); Fri, 15 May 2020 22:58:32 -0400 Received: from DGGEMM405-HUB.china.huawei.com (unknown [172.30.72.55]) by Forcepoint Email with ESMTP id D8266FC0081E0A754E42; Sat, 16 May 2020 10:58:28 +0800 (CST) Received: from dggeme758-chm.china.huawei.com (10.3.19.104) by DGGEMM405-HUB.china.huawei.com (10.3.20.213) with Microsoft SMTP Server (TLS) id 14.3.487.0; Sat, 16 May 2020 10:58:28 +0800 Received: from [10.173.219.71] (10.173.219.71) by dggeme758-chm.china.huawei.com (10.3.19.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Sat, 16 May 2020 10:58:28 +0800 Subject: Re: [PATCH net-next] hinic: add set_channels ethtool_ops support To: Michal Kubecek , CC: , , , , References: <20200515003547.27359-1-luobin9@huawei.com> <20200515181330.GC21714@lion.mk-sys.cz> From: "luobin (L)" Message-ID: <595eb127-53ce-dea7-7289-78f53fd8d6bc@huawei.com> Date: Sat, 16 May 2020 10:58:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20200515181330.GC21714@lion.mk-sys.cz> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.173.219.71] X-ClientProxiedBy: dggeme711-chm.china.huawei.com (10.1.199.107) To dggeme758-chm.china.huawei.com (10.3.19.104) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/5/16 2:13, Michal Kubecek wrote: > On Fri, May 15, 2020 at 12:35:47AM +0000, Luo bin wrote: >> add support to change TX/RX queue number with ethtool -L >> >> Signed-off-by: Luo bin >> --- >> .../net/ethernet/huawei/hinic/hinic_ethtool.c | 67 +++++++++++++++++-- >> .../net/ethernet/huawei/hinic/hinic_hw_dev.c | 7 ++ >> .../net/ethernet/huawei/hinic/hinic_hw_dev.h | 2 + >> .../net/ethernet/huawei/hinic/hinic_main.c | 5 +- >> drivers/net/ethernet/huawei/hinic/hinic_tx.c | 5 ++ >> 5 files changed, 79 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c >> index ace18d258049..92a0e3bd19c3 100644 >> --- a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c >> +++ b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c >> @@ -619,14 +619,68 @@ static void hinic_get_channels(struct net_device *netdev, >> struct hinic_dev *nic_dev = netdev_priv(netdev); >> struct hinic_hwdev *hwdev = nic_dev->hwdev; >> >> - channels->max_rx = hwdev->nic_cap.max_qps; >> - channels->max_tx = hwdev->nic_cap.max_qps; >> + channels->max_rx = 0; >> + channels->max_tx = 0; >> channels->max_other = 0; >> - channels->max_combined = 0; >> - channels->rx_count = hinic_hwdev_num_qps(hwdev); >> - channels->tx_count = hinic_hwdev_num_qps(hwdev); >> + channels->max_combined = nic_dev->max_qps; >> + channels->rx_count = 0; >> + channels->tx_count = 0; >> channels->other_count = 0; >> - channels->combined_count = 0; >> + channels->combined_count = hinic_hwdev_num_qps(hwdev); >> +} >> + >> +int hinic_set_channels(struct net_device *netdev, >> + struct ethtool_channels *channels) >> +{ >> + struct hinic_dev *nic_dev = netdev_priv(netdev); >> + unsigned int count = channels->combined_count; >> + int err; >> + >> + if (!count) { >> + netif_err(nic_dev, drv, netdev, >> + "Unsupported combined_count: 0\n"); >> + return -EINVAL; >> + } >> + >> + if (channels->tx_count || channels->rx_count || channels->other_count) { >> + netif_err(nic_dev, drv, netdev, >> + "Setting rx/tx/other count not supported\n"); >> + return -EINVAL; >> + } > With max_* reported as 0, these will be caught in ethnl_set_channels() > or ethtool_set_channels(). > ---Will fix. Thanks >> + if (!(nic_dev->flags & HINIC_RSS_ENABLE)) { >> + netif_err(nic_dev, drv, netdev, >> + "This function doesn't support RSS, only support 1 queue pair\n"); >> + return -EOPNOTSUPP; >> + } > I'm not sure if the request should fail even if requested count is > actually 1. > >> + if (count > nic_dev->max_qps) { >> + netif_err(nic_dev, drv, netdev, >> + "Combined count %d exceeds limit %d\n", >> + count, nic_dev->max_qps); >> + return -EINVAL; >> + } > As above, this check has been already performed in ethnl_set_channels() > or ethtool_set_channels(). > ---Will fix. Thanks >> + netif_info(nic_dev, drv, netdev, "Set max combined queue number from %d to %d\n", >> + hinic_hwdev_num_qps(nic_dev->hwdev), count); > We have netlink notifications now, is it necessary to log successful > changes? > ---I think it contributes to locating defects for developers. > > Michal > .