Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp265240pxu; Fri, 11 Dec 2020 01:38:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJynSfENFB1yFTaZBZGDxpipwMPrJvmGI6nYXwmoZJYfxf/qpsW0JVsUJptnTg2a7M64edjg X-Received: by 2002:a50:b586:: with SMTP id a6mr10930421ede.206.1607679510725; Fri, 11 Dec 2020 01:38:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607679510; cv=none; d=google.com; s=arc-20160816; b=RoydrFNJkeRdpeMUpjcbEhwa0e93I/hpVl4kanttkvpVl6ulOkoALnJbjTtLBdat8f Yqs01GwfpRG6zUL66DRjgWyoHJ75i/o6x5y/oU9OCAFiWNWv8itLX3Av0y5EeM35sRK8 Pr4IveGz0iyJDOelpnaIiwVDJsfm6p9ncEBm3Dsqr2vC2NBTc1nNMXQ+pqCIdz+Ta+V2 LWPjAFRoI6rhvARW+awaiqbs4OKMNN7+W2DaBU5WlG/eY68ENHrMqFvLxTQlNwrCTNy+ B4d4BdUrQeO8aqDURUnJeZ5voHhw2cPmNilK8DrkdG0tb9eJpcF2lTl+tz+DxZs96tuG vXnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :dkim-signature:message-id; bh=iq0pqSxX1mbzculdH0Zd8RtRQr7z29Po+CXd/BetAlY=; b=Ue/1w/w/9UZoz2nvHtq1xRB0J5tEamwm51AkHB6rp/aJpsz7fu2hXRlalHtFSNn1O0 GqlWtQIZSSieQSqUaaj43nJo5NWQay+WExHXHH7359tganqCd0ZXlnMP9IeLK/T7WLMt jTUyf13p2kcxehFS18Erz54YZLIjcEBP7R5dcLqR6CwFoeaRtyOVniuGFs0RsgID8OuC VOfVJgcok+sKMZ8o94BbvTgjzZmJo2ayzvFavaG/Qwe+8+SYrTBVQoJHPlpH17lEN4v1 Va3oz1VB0yhq22Nu6/ckMNlV0cEFfGRuAbDMWyMAH+/JE+xr1Sii3Ivq1jikiPQmRYYk QfVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kwk5MaCx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pw18si4131317ejb.163.2020.12.11.01.37.54; Fri, 11 Dec 2020 01:38:30 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kwk5MaCx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392778AbgLJUZv (ORCPT + 99 others); Thu, 10 Dec 2020 15:25:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:43062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390070AbgLJUZ3 (ORCPT ); Thu, 10 Dec 2020 15:25:29 -0500 Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607631888; bh=qTQp+kYtNGLesjGoQz58y9Jan53hivDYnrWOoOb9muM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=kwk5MaCxi6jLgesKpFojsjEkZUOT+X/IwKNiWoSLMS1e7e0GhLQjaWr7m/IeaLg6O j0MU0v6PfQWAFlygU1TlNV3uaP5sfnqPnKDjVfJTqVaIfjtql/zzlbHRvJcGu93eeN rpyU7yEUnRuGyKq+A07XzS/vA7ZIYAf9YaoLiuBohtkLBHwEUaAi8Iv82uQfjcHUjH 2VvdNR9uKTacWhtEDgUcXwm02iaf6OVglhL4O9RFtlAqs0Ky4FqaTxB4vEvwQlKSZJ HJSGeryrvbVgeL3z1YNbZBzNTdYQTaV008kGWv8wKOS77/WUZRtvFt703MmveWOgUj ezjLG7IxKVwog== Subject: Re: [PATCH net-next 2/7] net: hns3: add support for tc mqprio offload From: Saeed Mahameed To: tanhuazhong , davem@davemloft.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kuba@kernel.org, huangdaode@huawei.com, Jian Shen Date: Thu, 10 Dec 2020 12:24:46 -0800 In-Reply-To: <42c9fd63-3e51-543e-bbbd-01e7face7c9c@huawei.com> References: <1607571732-24219-1-git-send-email-tanhuazhong@huawei.com> <1607571732-24219-3-git-send-email-tanhuazhong@huawei.com> <80b7502b700df43df7f66fa79fb9893399d0abd1.camel@kernel.org> <42c9fd63-3e51-543e-bbbd-01e7face7c9c@huawei.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-12-10 at 20:27 +0800, tanhuazhong wrote: > > On 2020/12/10 12:50, Saeed Mahameed wrote: > > On Thu, 2020-12-10 at 11:42 +0800, Huazhong Tan wrote: > > > From: Jian Shen > > > > > > Currently, the HNS3 driver only supports offload for tc number > > > and prio_tc. This patch adds support for other qopts, including > > > queues count and offset for each tc. > > > > > > When enable tc mqprio offload, it's not allowed to change > > > queue numbers by ethtool. For hardware limitation, the queue > > > number of each tc should be power of 2. > > > > > > For the queues is not assigned to each tc by average, so it's > > > should return vport->alloc_tqps for hclge_get_max_channels(). > > > > > > > The commit message needs some improvements, it is not really clear > > what > > the last two sentences are about. > > > > The hclge_get_max_channels() returns the max queue number of each TC > for > user can set by command ethool -L. In previous implement, the queues > are > assigned to each TC by average, so we return it by vport-: > alloc_tqps / num_tc. And now we can assign differrent queue number > for > each TC, so it shouldn't be divided by num_tc. What do you mean by "queues assigned to each tc by average" ? [...] > > > > + } > > > + if (hdev->vport[0].alloc_tqps < queue_sum) { > > > > can't you just allocate new tqps according to the new mqprio input > > like > > other drivers do ? how the user allocates those tqps ? > > > > maybe the name of 'alloc_tqps' is a little bit misleading, the > meaning > of this field is the total number of the available tqps in this > vport. > from your driver code it seems alloc_tqps is number of rings allocated via ethool -L. My point is, it seems like in this patch you demand for the queues to be preallocated, but what other drivers do on setup tc, they just duplicate what ever number of queues was configured prior to setup tc, num_tc times. > > > + dev_err(&hdev->pdev->dev, > > > + "qopt queue count sum should be less than > > > %u\n", > > > + hdev->vport[0].alloc_tqps); > > > + return -EINVAL; > > > + } > > > + > > > + return 0; > > > +} > > > + > > > +static void hclge_sync_mqprio_qopt(struct hnae3_tc_info > > > *tc_info, > > > + struct tc_mqprio_qopt_offload > > > *mqprio_qopt) > > > +{ > > > + int i; > > > + > > > + memset(tc_info, 0, sizeof(*tc_info)); > > > + tc_info->num_tc = mqprio_qopt->qopt.num_tc; > > > + memcpy(tc_info->prio_tc, mqprio_qopt->qopt.prio_tc_map, > > > + sizeof_field(struct hnae3_tc_info, prio_tc)); > > > + memcpy(tc_info->tqp_count, mqprio_qopt->qopt.count, > > > + sizeof_field(struct hnae3_tc_info, tqp_count)); > > > + memcpy(tc_info->tqp_offset, mqprio_qopt->qopt.offset, > > > + sizeof_field(struct hnae3_tc_info, tqp_offset)); > > > + > > > > isn't it much easier to just store a copy of tc_mqprio_qopt in you > > tc_info and then just: > > tc_info->qopt = mqprio->qopt; > > > > [...] > > The tc_mqprio_qopt_offload still contains a lot of opt hns3 driver > does > not use yet, even if the hns3 use all the opt, I still think it is > better to create our own struct, if struct tc_mqprio_qopt_offload > changes in the future, we can limit the change to the > tc_mqprio_qopt_offload convertion. > ok.