lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b3d14dce-45a9-2d13-93d5-be6e5ef0c709@huawei.com>
Date:   Sat, 29 Jun 2019 09:15:05 +0800
From:   Yunsheng Lin <linyunsheng@...wei.com>
To:     Willem de Bruijn <willemdebruijn.kernel@...il.com>,
        Huazhong Tan <tanhuazhong@...wei.com>
CC:     David Miller <davem@...emloft.net>,
        Network Development <netdev@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        <salil.mehta@...wei.com>, <yisen.zhuang@...wei.com>,
        <linuxarm@...wei.com>, Peng Li <lipeng321@...wei.com>
Subject: Re: [PATCH net-next 02/12] net: hns3: enable DCB when TC num is one
 and pfc_en is non-zero

On 2019/6/29 2:47, Willem de Bruijn wrote:
> On Fri, Jun 28, 2019 at 7:53 AM Huazhong Tan <tanhuazhong@...wei.com> wrote:
>>
>> From: Yunsheng Lin <linyunsheng@...wei.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@...wei.com>
>> Signed-off-by: Peng Li <lipeng321@...wei.com>
>> Signed-off-by: Huazhong Tan <tanhuazhong@...wei.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.

Very helpful suggestion. thanks.
Will keep that in mind next time.

> 
>>                 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?
> 

Will send out a new patch to remove the code duplication by defining a helper.

> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ