net: hns3: PF support get unicast MAC address space assigned by firmware
authorGuangbin Huang <huangguangbin2@huawei.com>
Tue, 14 Sep 2021 12:11:16 +0000 (20:11 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Sep 2021 13:32:29 +0000 (14:32 +0100)
commite435a6b5315a05a4e4e9f77679a57fd0d679e384
treed593d0a05deb2e7901e449355727dc563d3e7230
parent0ccf8511182436183c031e8a2f740ae91a02c625
net: hns3: PF support get unicast MAC address space assigned by firmware

Currently, there are two ways for PF to set the unicast MAC address space
size: specified by config parameters in firmware or set to default value.

That's mean if the config parameters in firmware is zero, driver will
divide the whole unicast MAC address space equally to 8 PFs. However, in
this case, the unicast MAC address space will be wasted a lot when the
hardware actually has less then 8 PFs. And in the other hand, if one PF has
much more VFs than other PFs, then each function of this PF will has much
less address space than other PFs.

In order to ameliorate the above two situations, introduce the third way
of unicast MAC address space assignment: firmware divides the whole unicast
MAC address space equally to functions of all PFs, and calculates the space
size of each PF according to its function number. PF queries the space size
by the querying device specification command when in initialization
process.

The third way assignment is lower priority than specified by config
parameters, only if the config parameters is zero can be used, and if
firmware does not support the third way assignment, then driver still
divides the whole unicast MAC address space equally to 8 PFs.

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