netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Huazhong Tan <tanhuazhong@huawei.com>
Cc: David Miller <davem@davemloft.net>,
	Network Development <netdev@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	salil.mehta@huawei.com, yisen.zhuang@huawei.com,
	linuxarm@huawei.com, Yunsheng Lin <linyunsheng@huawei.com>,
	Peng Li <lipeng321@huawei.com>
Subject: Re: [PATCH net-next 02/12] net: hns3: enable DCB when TC num is one and pfc_en is non-zero
Date: Fri, 28 Jun 2019 14:47:57 -0400	[thread overview]
Message-ID: <CA+FuTSdWa0dMz15m79SLsNAw9zkp3+3MSfKiRwKnjZ7QAyq1Uw@mail.gmail.com> (raw)
In-Reply-To: <1561722618-12168-3-git-send-email-tanhuazhong@huawei.com>

On Fri, Jun 28, 2019 at 7:53 AM Huazhong Tan <tanhuazhong@huawei.com> wrote:
>
> From: Yunsheng Lin <linyunsheng@huawei.com>
>
> Currently when TC num is one, the DCB will be disabled no matter if
> pfc_en is non-zero or not.
>
> This patch enables the DCB if pfc_en is non-zero, even when TC num
> is one.
>
> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
> Signed-off-by: Peng Li <lipeng321@huawei.com>
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>

> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
> index 9edae5f..cb2fb5a 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
> @@ -597,8 +597,10 @@ static void hclge_tm_tc_info_init(struct hclge_dev *hdev)
>                 hdev->tm_info.prio_tc[i] =
>                         (i >= hdev->tm_info.num_tc) ? 0 : i;
>
> -       /* DCB is enabled if we have more than 1 TC */
> -       if (hdev->tm_info.num_tc > 1)
> +       /* DCB is enabled if we have more than 1 TC or pfc_en is
> +        * non-zero.
> +        */
> +       if (hdev->tm_info.num_tc > 1 || hdev->tm_info.pfc_en)

small nit: comments that just repeat the condition are not very informative.

More helpful might be to explain why the DCB should be enabled in both
these cases. Though such detailed comments, if useful, are better left
to the commit message usually.

>                 hdev->flag |= HCLGE_FLAG_DCB_ENABLE;
>         else
>                 hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE;
> @@ -1388,6 +1390,19 @@ void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc)
>         hclge_tm_schd_info_init(hdev);
>  }
>
> +void hclge_tm_pfc_info_update(struct hclge_dev *hdev)
> +{
> +       /* DCB is enabled if we have more than 1 TC or pfc_en is
> +        * non-zero.
> +        */
> +       if (hdev->tm_info.num_tc > 1 || hdev->tm_info.pfc_en)
> +               hdev->flag |= HCLGE_FLAG_DCB_ENABLE;
> +       else
> +               hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE;
> +
> +       hclge_pfc_info_init(hdev);
> +}

Avoid introducing this code duplication by defining a helper?

  reply	other threads:[~2019-06-28 18:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 11:50 [PATCH net-next 00/12] net: hns3: some code optimizations & cleanups & bugfixes Huazhong Tan
2019-06-28 11:50 ` [PATCH net-next 01/12] net: hns3: fix __QUEUE_STATE_STACK_XOFF not cleared issue Huazhong Tan
2019-06-28 11:50 ` [PATCH net-next 02/12] net: hns3: enable DCB when TC num is one and pfc_en is non-zero Huazhong Tan
2019-06-28 18:47   ` Willem de Bruijn [this message]
2019-06-29  1:15     ` Yunsheng Lin
2019-06-28 11:50 ` [PATCH net-next 03/12] net: hns3: change SSU's buffer allocation according to UM Huazhong Tan
2019-06-28 11:50 ` [PATCH net-next 04/12] net: hns3: add some error checking in hclge_tm module Huazhong Tan
2019-06-28 11:50 ` [PATCH net-next 05/12] net: hns3: fix a -Wformat-nonliteral compile warning Huazhong Tan
2019-06-28 11:50 ` [PATCH net-next 06/12] net: hns3: add Asym Pause support to fix autoneg problem Huazhong Tan
2019-06-28 11:50 ` [PATCH net-next 07/12] net: hns3: re-schedule reset task while VF reset fail Huazhong Tan
2019-06-28 11:50 ` [PATCH net-next 08/12] net: hns3: handle empty unknown interrupt Huazhong Tan
2019-06-28 11:50 ` [PATCH net-next 09/12] net: hns3: fix a statistics issue about l3l4 checksum error Huazhong Tan
2019-06-28 11:50 ` [PATCH net-next 10/12] net: hns3: remove unused linkmode definition Huazhong Tan
2019-06-28 11:50 ` [PATCH net-next 11/12] net: hns3: remove RXD_VLD check in hns3_handle_bdinfo Huazhong Tan
2019-06-28 11:50 ` [PATCH net-next 12/12] net: hns3: optimize the CSQ cmd error handling Huazhong Tan
2019-06-28 16:40 ` [PATCH net-next 00/12] net: hns3: some code optimizations & cleanups & bugfixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+FuTSdWa0dMz15m79SLsNAw9zkp3+3MSfKiRwKnjZ7QAyq1Uw@mail.gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=linyunsheng@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=tanhuazhong@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).