OSDN Git Service

net: hns3: refactor function hclge_parse_capability()
authorGuangbin Huang <huangguangbin2@huawei.com>
Sat, 28 Aug 2021 06:55:16 +0000 (14:55 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 28 Aug 2021 10:20:05 +0000 (11:20 +0100)
commite1d93bc6ef3bf497675f9ac2b35b79c48577b970
treed680cceb76f019f4f0a25809201b3f6da3777077
parent0fc36e37d5c0e940d6347e8c10a9fe2d8d5b0074
net: hns3: refactor function hclge_parse_capability()

The function hclge_parse_capability() uses too many if statement, and
it may add more in the future. To improve code readability, maintainability
and simplicity, refactor this function by using a bit mapping array of IMP
capabilities and driver capabilities.

Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h