When initially testing the Camera Terminal Descriptor wTerminalType
field (buffer[4]), no mask is used. Later in the function, the MSB is
overloaded to store the descriptor subtype, and so a mask of 0x7fff
is used to check the type.
If a descriptor is specially crafted to set this overloaded bit in the
original wTerminalType field, the initial type check will fail (falling
through, without adjusting the buffer size), but the later type checks
will pass, assuming the buffer has been made suitably large, causing an
overflow.
Avoid this problem by checking for the MSB in the wTerminalType field.
If the bit is set, assume the descriptor is bad, and abort parsing it.
Originally reported here:
https://groups.google.com/forum/#!topic/syzkaller/Ot1fOE6v1d8
A similar (non-compiling) patch was provided at that time.
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 5979f33b982dca807ea802b512480bc62f81396a) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Also a missing static qualifier is added to hisi_sas_debugfs_to_reg_name().
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 5b0eeac4bed4b1a261acf3cd893f929e68814a0d) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
John Garry [Fri, 25 Jan 2019 14:22:27 +0000 (22:22 +0800)]
scsi: hisi_sas: No need to check return value of debugfs_create functions
BugLink: https://bugs.launchpad.net/bugs/1819500
When calling debugfs functions, there is no need to ever check the return
value. The function can work or not, but the code logic should never do
something different based on this.
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit c2c7e740577154e755ec373712e32e5864e88315) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 1afb4b8524797f95b15480a6654780571cde4e56) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 148e379f60c5ce0a9741ccdada46ba91579a9df7) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 971afae7cf4f784c37ea89459c1b3627bcf601ff) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 61a6ebf3f584288e68254ccaddc536fcc602e5ae) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit caefac1996764d19e4fa39d8d33651da257dcab2) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Add code for snapshot trig and generate dump directory.
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 49159a5e4175f9f7a5149e7e27f583de04e934c2) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
When we fail to allocate memory for some registers, we free the memory
and set hisi_sas_debugfs_enable as 0 to stop loading debugfs from running.
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit eb1c2b72b7694c984d520300c901f5fc1fa8ea9e) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Luo Jiaxing [Wed, 19 Dec 2018 15:56:39 +0000 (23:56 +0800)]
scsi: hisi_sas: Create root and device debugfs directories
BugLink: https://bugs.launchpad.net/bugs/1819500
This patch creates root directory at hisi_sas_init() and generates device
directory when we probe device driver.
And we remove the root directory at hisi_sas_exit(), but recursively
delete device directory when we remove device driver.
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(backported from commit ef63464bcf8feaa793e1aee4d3d186dfd1fff05f)
[dannf: trivial offset fix] Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Shiju Jose [Sun, 10 Mar 2019 06:47:51 +0000 (14:47 +0800)]
net: hns3: fix to stop multiple HNS reset due to the AER changes
BugLink: https://bugs.launchpad.net/bugs/1819535
The commit bfcb79fca19d
("PCI/ERR: Run error recovery callbacks for all affected devices")
affected the non-fatal error recovery logic for the HNS and RDMA devices.
This is because each HNS PF under PCIe bus receive callbacks
from the AER driver when an error is reported for one of the PF.
This causes unwanted PF resets because
the HNS decides which PF to reset based on the reset type set.
The HNS error handling code sets the reset type based on the hw error
type detected.
This patch provides fix for the above issue for the recovery of
the hw errors in the HNS and RDMA devices.
This patch needs backporting to the kernel v5.0+
Fixes: 332fbf576579 ("net: hns3: add handling of hw ras errors using new set of commands") Reported-by: Xiaofei Tan <tanxiaofei@huawei.com> Signed-off-by: Shiju Jose <shiju.jose@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 69b51bbb03f73e04c486f79d1556b2d9becf4dbc) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Wed, 6 Mar 2019 03:26:37 +0000 (11:26 +0800)]
net: hns3: add dma_rmb() for rx description
BugLink: https://bugs.launchpad.net/bugs/1819535
HW can not guarantee complete write desc->rx.size, even though
HNS3_RXD_VLD_B has been set. Driver needs to add dma_rmb()
instruction to make sure desc->rx.size is always valid.
Fixes: e55970950556 ("net: hns3: Add handling of GRO Pkts not fully RX'ed in NAPI poll") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d394d33bee22421b39a0bcdc51ca6d68ba308625) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fixes: e8149933b1fa ("net: hns3: remove hnae3_get_bit in data path") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f4772dee101c7ac66e395d07b3140d457901fa18) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/1819535
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d89ea4acfc039f6968f8b5a1dfae5d3cbf611444) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Huazhong Tan [Sat, 23 Feb 2019 09:22:19 +0000 (17:22 +0800)]
net: hns3: fix improper error handling for hns3_client_start
BugLink: https://bugs.launchpad.net/bugs/1819535
If hns3_client_start() failed in the hns3_client_init(),
register_dev() should be undo in its error handling.
Fixes: a6d818e31d08 ("net: hns3: Add vport alive state checking support") Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 186551284e6ec3d7c87b0e48da570816a39e9afc) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Shiju Jose [Sat, 23 Feb 2019 09:22:18 +0000 (17:22 +0800)]
net: hns3: fix setting of the hns reset_type for rdma hw errors
BugLink: https://bugs.launchpad.net/bugs/1819535
Presently the hns reset_type for the roce errors is set
in the hclge_log_and_clear_rocee_ras_error function.
This function is also called to detect and clear roce errors
while enabling the rdma error interrupts. However there is no hns
reset requested for this case. This can cause issue of wrong
reset_type used with subsequent hns reset as the
reset_type set in the above case was not cleared.
This patch moves setting of hns reset_type for the roce errors from
hclge_log_and_clear_rocee_ras_error function
to hclge_handle_rocee_ras_error.
Fixes: 630ba007f475 ("net: hns3: add handling of RDMA RAS errors") Reported-by: Huazhong Tan <tanhuazhong@huawei.com> Reported-by: Xiaofei Tan <tanxiaofei@huawei.com> Signed-off-by: Shiju Jose <shiju.jose@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit eb4c2ccbad6c688be791e0c08640a40124558c03) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Sat, 23 Feb 2019 09:22:17 +0000 (17:22 +0800)]
net: hns3: fix get VF RSS issue
BugLink: https://bugs.launchpad.net/bugs/1819535
For revision 0x20, VF shares the same RSS config with PF.
In original codes, it always return 0 when query RSS hash
key for VF. This patch fixes it by return the hash key
got from PF.
Fixes: 374ad291762a ("net: hns3: net: hns3: Add RSS general configuration support for VF") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a638b1d8cc875ae819591be787503fc1db053d5f) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Sat, 23 Feb 2019 09:22:16 +0000 (17:22 +0800)]
net: hns3: enable VF VLAN filter for each VF when initializing
BugLink: https://bugs.launchpad.net/bugs/1819535
For revision 0x21, the switch of VF VLAN filter is per function.
It's necessary to enable VF VLAN filter for each VF when initializing.
Otherwise, VF will be able to receive broadcast packets with unknown
VLAN when PF enters promisc mode.
Fixes: 64d114f0a750 ("net: hns3: Add egress/ingress vlan filter for revision 0x21") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 30ebc576d7773c7d8b53fa7941c2c56e488589fd) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c04259442395a6d9648e8dd105e9058726b2451a) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Sat, 23 Feb 2019 09:22:14 +0000 (17:22 +0800)]
net: hns3: remove hnae3_get_bit in data path
BugLink: https://bugs.launchpad.net/bugs/1819535
The hnae3_get_bit uses hnae3_get_field, and hnae3_get_field
masks the data, which is unnecessary in data path.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e8149933b1fab774e892f8ab605d241df673291c) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Sat, 23 Feb 2019 09:22:13 +0000 (17:22 +0800)]
net: hns3: replace hnae3_set_bit and hnae3_set_field in data path
BugLink: https://bugs.launchpad.net/bugs/1819535
hnae3_set_bit and hnae3_set_field masks the data before setting
the field or bit, which is unnecessary because the data is already
zero initialized.
Suggested-by: John Garry <john.garry@huawei.com> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit cde4ffada8290c803e5b68423466118e5421c774) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0cccebac710a2ac1ee9a18744e9ee24746f7d947) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Sat, 23 Feb 2019 09:22:11 +0000 (17:22 +0800)]
net: hns3: remove some ops in struct hns3_nic_ops
BugLink: https://bugs.launchpad.net/bugs/1819535
The fill_desc ops has only one implementation, and
get_rxd_bnum has not been used, so this patch removes
them.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d40fa7eeab55dc1f0ab5f81d1c53af31dbcdd9ac) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Also, only set l3_type and l4_type when necessary.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Huazhong tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 47e7b13b0aff869465585d36a8d5075fe17cb90a) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3fe13ed95dd3c4aede3313a2dd2d589c207b51d0) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2a73ac3e6c9d7cd80af731bcb699c180d95c8166) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Huazhong Tan [Wed, 20 Feb 2019 02:32:51 +0000 (10:32 +0800)]
net: hns3: clear command queue's registers when unloading VF driver
BugLink: https://bugs.launchpad.net/bugs/1819535
According to the hardware's description, the driver should clear
the command queue's registers when uloading VF driver. Otherwise,
these existing value may lead the IMP get into a wrong state.
Fixes: fedd0c15d288 ("net: hns3: Add HNS3 VF IMP(Integrated Management Proc) cmd interface") Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 34f81f049e354082f638820afe5e59bbd243fb18) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Huazhong Tan [Wed, 20 Feb 2019 02:32:50 +0000 (10:32 +0800)]
net: hns3: uninitialize command queue while unloading PF driver
BugLink: https://bugs.launchpad.net/bugs/1819535
According to the hardware's description, the driver should clear
the command queue's registers when uloading driver. Otherwise,
these existing value may lead the IMP get into a wrong state.
Also this patch adds hclge_cmd_uninit() to do the command queue
uninitialization which includes clearing registers and freeing
memory.
Fixes: 68c0a5c70614 ("net: hns3: Add HNS3 IMP(Integrated Mgmt Proc) Cmd Interface Support") Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 232d0d55fca6ab589d5267c74a376210f341d71e) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
liuzhongzhu [Wed, 20 Feb 2019 02:32:49 +0000 (10:32 +0800)]
net: hns3: Record VF vlan tables
BugLink: https://bugs.launchpad.net/bugs/1819535
Record the vlan tables that the VF sends to the chip.
After the VF exception, the PF actively clears the VF to chip config.
Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c6075b193462d9a3930fb41f587f94720658752a) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
liuzhongzhu [Wed, 20 Feb 2019 02:32:48 +0000 (10:32 +0800)]
net: hns3: Record VF unicast and multicast tables
BugLink: https://bugs.launchpad.net/bugs/1819535
Record the unicast and multicast tables that the VF sends to the chip.
After the VF exception, the PF actively clears the VF to chip config.
Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6dd86902f21d096ed7ef2dcc921ee80c73807313) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3aff0ac97391fe4181fd68f06b8fec345f7d1bc5) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d1f55d6bfcf007691a6392ca421cf5fa1b007d1c) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Weihang Li [Wed, 20 Feb 2019 02:32:45 +0000 (10:32 +0800)]
net: hns3: some bugfix of ppu(rcb) ras errors
BugLink: https://bugs.launchpad.net/bugs/1819535
The 3rd and 4th of PPU(RCB) PF Abnormal is RAS errors instead of MSI-X
like other bits. This patch adds process of handling and logging this
two bits. Otherwise, this patch modifies print message of 28th and 29th
bit of PPU MPF Abnormal errors, which keep same with other errors now.
Fixes: f69b10b317f9 ("net: hns3: handle hw errors of PPU(RCB)") Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 747fc3f351baa061b41a1e2a81821bc963e4f794) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Weihang Li [Wed, 20 Feb 2019 02:32:44 +0000 (10:32 +0800)]
net: hns3: modify print message of ssu common ecc errors
BugLink: https://bugs.launchpad.net/bugs/1819535
This patch add information of specific bit in log to be consistent
with other type of errors, so that we can know which memory of ssu
has occurred a ecc ras errors.
Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3d69e59f42bdd57c2a185da52f9579c33dec7121) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Wed, 20 Feb 2019 02:32:43 +0000 (10:32 +0800)]
net: hns3: fix port info query issue for copper port
BugLink: https://bugs.launchpad.net/bugs/1819535
In original codes, for copper port which doesn't connect to phy,
it always returns -EOPNOTSUPP when query port information. This
patch fixes it by return the port information of MAC.
Fixes: 5f373b158523 ("net: hns3: Fix speed/duplex information loss problem when executing ethtool ethx cmd of VF") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f18635d52c23594259da2f741399abc6c6f41f15) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Wed, 20 Feb 2019 02:32:42 +0000 (10:32 +0800)]
net: hns3: convert mac advertize and supported from u32 to link mode
BugLink: https://bugs.launchpad.net/bugs/1819535
The link mode with bits has been up to more than 31 for some MAC
and phy. Convert to using a linkmode bitmap, which can support all
link modes.
Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit db68ca0ef7c98bb39cb193571c63b22ca99f633f) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yonglong Liu [Wed, 20 Feb 2019 02:32:41 +0000 (10:32 +0800)]
net: hns3: Check variable is valid before assigning it to another
BugLink: https://bugs.launchpad.net/bugs/1819535
In hnae3_register_ae_dev(), ae_algo->ops is assigned to ae_dev->ops
before check that ae_algo->ops is valid.
And in hnae3_register_ae_algo(), missing check for ae_algo->ops.
This patch fixes them.
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 676131f7c53ecdd79e29fc8cfcdefe6f9f2485e8) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit bdd59d661153a59af79112676565276ae2a1f457) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c:2431:5: warning:
symbol 'hclge_set_all_vf_rst' was not declared. Should it be static?
Fixes: aa5c4f175be6 ("net: hns3: add reset handling for VF when doing PF reset") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e511f17b1fb40248e63677a6ab81a29b9b32080d) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
liuzhongzhu [Sat, 2 Feb 2019 14:39:37 +0000 (22:39 +0800)]
net: hns3: MAC table entry count function increases operation 0 value protection measures
BugLink: https://bugs.launchpad.net/bugs/1819535
When updating the available MAC VLAN table counts,
MAC VLAN table entry count function adds
operation 0 value protection measures.
Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 54a395b63e470696884fc12629b12e24d9379111) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
liuzhongzhu [Sat, 2 Feb 2019 14:39:36 +0000 (22:39 +0800)]
net: hns3: modify the upper limit judgment condition
BugLink: https://bugs.launchpad.net/bugs/1819535
In order to prevent the variable anomaly from being larger than desc_num,
the upper limit judgment condition becomes >=.
Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6104ca87e12a5119d3e53e926bb6fe468bb328e2) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Sat, 2 Feb 2019 14:39:35 +0000 (22:39 +0800)]
net: hns3: don't allow user to change vlan filter state
BugLink: https://bugs.launchpad.net/bugs/1819535
When user disables vlan filter, and adds vlan device, it won't
notify the driver the update the vlan filter. In this case, when
user enables vlan filter again, the packets with new vlan tag
will be filtered by vlan filter.
Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 77af09c6780b1394a1e888a6862d49cadc0247fa) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f9f07091b43e3a758bd197eb99ef5f011efce7fc) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
liuzhongzhu [Sat, 2 Feb 2019 14:39:33 +0000 (22:39 +0800)]
net: hns3: fix the problem that the supported port is empty
BugLink: https://bugs.launchpad.net/bugs/1819535
Run ethtool ethx when displaying device information in VF,
the supported port and link mode items will be empty.
This patch fixes it.
Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support") Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9194d18b0577a63f313a6eb2e0d4723add2c32e6) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Huazhong Tan [Sat, 2 Feb 2019 14:39:32 +0000 (22:39 +0800)]
net: hns3: fix a wrong checking in the hclge_tx_buffer_calc()
BugLink: https://bugs.launchpad.net/bugs/1819535
Only the TC is enabled, we need to check whether the buffer is enough,
otherwise it may lead to a wrong -ENOMEM case.
Fixes: 9ffe79a9c2ee ("net: hns3: Support for dynamically assigning tx buffer to TC") Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b6b4f987c5c4fe488f3f68460b9addc08482b164) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Weihang Li [Sat, 2 Feb 2019 14:39:31 +0000 (22:39 +0800)]
net: hns3: move some set_bit statement into hclge_prepare_mac_addr
BugLink: https://bugs.launchpad.net/bugs/1819535
This patch does not change the code logic. There are some same
set_bit statements called by add/rm_uc/mc_addr_common, and move
this statements into hclge_prepare_mac_addr to reduce duplicate
code.
Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3a586422a5533a6c78376a779860f48ed72b9d83) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Weihang Li [Sat, 2 Feb 2019 14:39:30 +0000 (22:39 +0800)]
net: hns3: add hclge_cmd_check_retval() to parse comman's return value
BugLink: https://bugs.launchpad.net/bugs/1819535
For simplifying the code, this patch adds hclge_cmd_check_retval() to
check the return value of the command.
Also, according the IMP's description, when there are several descriptors
in a command, then the IMP will save the return value on the last
description, so hclge_cmd_check_retval() just check the last one for this
case.
Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b671b723e0d235b516dc33c163e6296df9b4f0ca) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Sat, 2 Feb 2019 14:39:29 +0000 (22:39 +0800)]
net: hns3: code optimization for hclge_rx_buffer_calc
BugLink: https://bugs.launchpad.net/bugs/1819535
There are four steps to calcuate the rx private buffer, each step
can be done in a function to avoid code duplication and aid code
readability.
This patch adds three separate functions do the job. Also, the
function name more or less make the comment redundant, so remove
some obvious comment.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8ca754b13f3c3b99d946665385b3b76e66aab96d) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yonglong Liu [Sat, 2 Feb 2019 14:39:28 +0000 (22:39 +0800)]
net: hns3: Modify parameter type from int to bool in set_gro_en
BugLink: https://bugs.launchpad.net/bugs/1819535
The second parameter to the hook function set_gro_en is always passed in
true/false, so modify it's type from int to bool.
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1731be4c73bb4d5bbfb4b15aaab3f183ccba6fe6) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Peng Li [Sat, 2 Feb 2019 14:39:27 +0000 (22:39 +0800)]
net: hns3: fix an issue for hns3_update_new_int_gl
BugLink: https://bugs.launchpad.net/bugs/1819535
HNS3 supports setting rx-usecs|tx-usecs as 0, but it will not
update dynamically when adaptive-tx or adaptive-rx is enable.
This patch removes the Redundant check.
Fixes: a95e1f8666e9 ("net: hns3: change the time interval of int_gl calculating") Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6241e71e7207102ffc733991f7a00f74098d7da0) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9e50dc11b856f19908559bafe1a3eca0ddc632b2) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fixes: d174ea75c96a ("net: hns3: add statistics for PFC frames and MAC control frame") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 39ee6e8204b9d4bd46d57ad838fa852f5d293f99) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Wed, 30 Jan 2019 20:55:52 +0000 (04:55 +0800)]
net: hns3: keep flow director state unchanged when reset
BugLink: https://bugs.launchpad.net/bugs/1819535
In orginal codes, driver always enables flow director when
intializing. When user disable flow director with command
ethtool -K, the flow director will be enabled again after
resetting.
This patch fixes it by only enabling it when first initialzing.
Fixes: 6871af29b3ab ("net: hns3: Add reset handle for flow director") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9abeb7d8cf8719bf221bf371f97fbf0971657be3) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Wed, 30 Jan 2019 20:55:51 +0000 (04:55 +0800)]
net: hns3: stop sending keep alive msg to PF when VF is resetting
BugLink: https://bugs.launchpad.net/bugs/1819535
When VF is resetting, it can't communicate to PF with mailbox msg.
This patch adds reset state checking before sending keep alive msg
to PF.
Fixes: a6d818e31d08 ("net: hns3: Add vport alive state checking support") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c59a85c07e77a7669e5b4d2ffa878b6894ec3953) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Peng Li [Wed, 30 Jan 2019 20:55:50 +0000 (04:55 +0800)]
net: hns3: fix an issue for hclgevf_ae_get_hdev
BugLink: https://bugs.launchpad.net/bugs/1819535
HNS3 VF driver support NIC and Roce, hdev stores NIC
handle and Roce handle, should use correct parameter for
container_of.
Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit eed9535f9f716a532ec0c5d6cc7a48584acdf435) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Huazhong Tan [Wed, 30 Jan 2019 20:55:49 +0000 (04:55 +0800)]
net: hns3: fix improper error handling in the hclge_init_ae_dev()
BugLink: https://bugs.launchpad.net/bugs/1819535
While hclge_init_umv_space() failed in the hclge_init_ae_dev(),
we should undo all the operation which has been done successfully,
the last success operation maybe hclge_mac_mdio_config(), so if
hclge_init_umv_space() failed, we also need to undo it.
Fixes: 288475b2ad01 ("{topost} net: hns3: refine umv space allocation") Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9fc55413270fffe1b5ebdea03489d763c62c0305) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Wed, 30 Jan 2019 20:55:48 +0000 (04:55 +0800)]
net: hns3: fix for rss result nonuniform
BugLink: https://bugs.launchpad.net/bugs/1819535
The rss result is more uniform when use recommended hash key from
microsoft, instead of the one generated by netdev_rss_key_fill().
Also using hash algorithm "xor" is better than "toeplitz".
This patch modifies the default hash key and hash algorithm.
Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 472d7ecee20e8fea18e6223cc1d383b6c3483502) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Huazhong Tan [Wed, 30 Jan 2019 20:55:47 +0000 (04:55 +0800)]
net: hns3: fix netif_napi_del() not do problem when unloading
BugLink: https://bugs.launchpad.net/bugs/1819535
When the driver is unloading, if a global reset occurs,
unmap_ring_from_vector() in the hns3_nic_uninit_vector_data() will
fail, and hns3_nic_uninit_vector_data() just return. There may be
some netif_napi_del() not be done.
Since hardware will unmap all ring while resetting, so
hns3_nic_uninit_vector_data() should ignore this error, and do the
rest uninitialization.
Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e215278548f9ea412e2be794efa1c84c6817c657) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Huazhong Tan [Wed, 30 Jan 2019 20:55:46 +0000 (04:55 +0800)]
net: hns3: Fix NULL deref when unloading driver
BugLink: https://bugs.launchpad.net/bugs/1819535
When the driver is unloading, if there is a calling of ndo_open occurs
between phy_disconnect() and unregister_netdev(), it will end up
causing the kernel to eventually hit a NULL deref:
So this patch fixes it by modifying the timing to do phy_connect_direct()
and phy_disconnect().
Fixes: 256727da7395 ("net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC") Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c8a8045b2d0a974149d65bbe6a7acbcde93cf85b) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
For simplicity, we are not considering VF sharing the same tc
configuration as PF use case, so this patch removes the support
of TC configuration from VF and forcing VF to just use single
TC.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit de67a690cc27024c22328ce8ff3a2ed32f30fe7d) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Huazhong Tan [Wed, 30 Jan 2019 20:55:44 +0000 (04:55 +0800)]
net: hns3: change hnae3_register_ae_dev() to int
BugLink: https://bugs.launchpad.net/bugs/1819535
hnae3_register_ae_dev() may fail, and it should return a error code
to its caller, so change hnae3_register_ae_dev() return type to int.
Also, when hnae3_register_ae_dev() return error, hns3_probe() should
do some error handling and return the error code.
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 74354140a579008fd164241e3697d9c37e5b8989) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Peng Li [Wed, 30 Jan 2019 20:55:43 +0000 (04:55 +0800)]
net: hns3: use the correct interface to stop|open port
BugLink: https://bugs.launchpad.net/bugs/1819535
dev_close() stop the netdev and the service base on the netdev
will stop. But ndev->netdev_ops->ndo_stop() may only stop HW
and stack queue, the service base on the netdev can still work.
Fixes: 5668abda0931 ("net: hns3: add support for set_ringparam") Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fc0c174f4223b7340999e1b3004dbc3b3b9b06de) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fixes: 1600c3e5f23e ("net: hns3: Support "ethtool -d" for HNS3 VF driver") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8e1445a653c9f9a51fca6f80b8df82b523e1c4ba) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
liyongxin [Wed, 30 Jan 2019 20:55:41 +0000 (04:55 +0800)]
net: hns3: reuse the definition of l3 and l4 header info union
BugLink: https://bugs.launchpad.net/bugs/1819535
Union l3_hdr_info and l4_hdr_info have already been defined in
the hns3_enet.h, so it is unnecessary to define them elsewhere.
This patch removes the redundant definition, and reuses the one
defined in the hns3_enet.h.
Signed-off-by: liyongxin <liyongxin1@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1a6e552df33c0dca4fecd0a179833d1b5233012a) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Sat, 26 Jan 2019 16:49:21 +0000 (00:49 +0800)]
net: hns3: don't allow vf to enable promisc mode
BugLink: https://bugs.launchpad.net/bugs/1819535
VF can receive packets of other functions when in promisc
mode. It's not safe, so don't allow VF to enable promisc
mode.
Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f01f5559cac89e57f2420aa77abf35f2e7b09104) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Sat, 26 Jan 2019 16:49:20 +0000 (00:49 +0800)]
net: hns3: add initialization for nic state
BugLink: https://bugs.launchpad.net/bugs/1819535
This patch adds initialization for nic state, sets flag
HNS3_NIC_STATE_DOWN when initialize, clears it before
vectors and napi being enabled in the hns3_nic_net_up(),
and sets it back in the error handler.
Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b7b585c286ab021bdb1d0c14b93c58b6bfbe3ef0) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Peng Li [Sat, 26 Jan 2019 16:49:19 +0000 (00:49 +0800)]
net: hns3: add 8 BD limit for tx flow
BugLink: https://bugs.launchpad.net/bugs/1819535
A single transmit packet can span up to 8 descriptors according
to the HW limit. If a skb has more than 8 frags, driver uses
skb_copy to get a new skb which has less frags.
Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 51e8439f34962794f6c5010a44893fe58450b8df) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Sat, 26 Jan 2019 16:49:18 +0000 (00:49 +0800)]
net: hns3: call hns3_nic_set_real_num_queue with netdev down
BugLink: https://bugs.launchpad.net/bugs/1819535
hns3_client_setup_tc in enet is for updating TC configuration to
stack, and hclge_setup_tc in hclge_dcb is mainly for setting the
configuration to hardware.
This patch removes the hns3_nic_set_real_num_queue from
hns3_setup_tc in enet, and call hclge_client_setup_tc to update
TC configuration to stack with netdev down, because the netdev
down operation is done in hclge_dcb now.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1cce5eb6506d8e4924927062398e8d9ff6411536) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Sat, 26 Jan 2019 16:49:17 +0000 (00:49 +0800)]
net: hns3: remove dcb_ops->map_update in hclge_dcb
BugLink: https://bugs.launchpad.net/bugs/1819535
After doing down/uninit/init/up in hclge_dcb, it is not necessary
to call dcb_ops->map_update in enet, so hclge_map_update can be
called directly in hclge_dcb.
This is for preparing to call hns3_nic_set_real_num_queue with
netdev down when user changes mqprio configuration.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a1ef124e6e8621e9472098a7a37655ef4bace423) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Sat, 26 Jan 2019 16:49:16 +0000 (00:49 +0800)]
net: hns3: do reinitialization while mqprio configuration changed
BugLink: https://bugs.launchpad.net/bugs/1819535
When user changes the mqprio configuration, enet need to be
uninited and inited besides down'ed and up'ed, because the queue
num may change when the TC num changes.
Also, it is more suitable to do the down/unint/init/up operation
in hclge module using hclge_notify_client, because this config
change may affect PF and its VF.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c2a39d981da7a04874d3ba17ac6122b8e62ec8e1) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
liuzhongzhu [Sat, 26 Jan 2019 16:49:15 +0000 (00:49 +0800)]
net: hns3: After setting the loopback, add the status of getting MAC
BugLink: https://bugs.launchpad.net/bugs/1819535
After setting the serdes loopback, you need to determine
the status of the MAC negotiation. If a status exception
is obtained after 200ms, a timeout error is returned.
Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 350fda0a0af9d077e895c7b01a4901d354ae656e) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Sat, 26 Jan 2019 16:49:14 +0000 (00:49 +0800)]
net: hns3: fix broadcast promisc issue for revision 0x20
BugLink: https://bugs.launchpad.net/bugs/1819535
For revision 0x20, vlan filter is always bypassed when enable
broadcast promisc mode. In this case, broadcast packets with
any vlan id can be accpeted. We should disable broadcast promisc
mode until user want enable it.
Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 28673b33c75621b52971b5d5aeed0be59de0bda5) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Sat, 26 Jan 2019 16:49:13 +0000 (00:49 +0800)]
net: hns3: fix return value handle issue for hclge_set_loopback()
BugLink: https://bugs.launchpad.net/bugs/1819535
In current code, it always return 0, even loopback mode setting failed.
It's incorrect. This patch fixes return value handle for loopback test.
Fixes: 0f29fc23b21d ("net: hns3: Fix for loopback selftest failed problem") Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 47ef6deccdfffaef8f56c5021a83a774fc77ee13) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Sat, 26 Jan 2019 16:49:12 +0000 (00:49 +0800)]
net: hns3: add error handling in hclge_ieee_setets
BugLink: https://bugs.launchpad.net/bugs/1819535
Currently hclge_ieee_setets returns error directly when there is
error, which may cause netdev not up problem.
This patch adds some error handling when setting ETS configuration
fails.
Fixes: cacde272dd00 ("net: hns3: Add hclge_dcb module for the support of DCB feature") Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1821dce9ae6c6d70e9e9ea93638855e7a27797ca) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ac864c2346d087dd3739435af1b8d36be5f60c75) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 217e288c9718b383d68cacec50e37ec2c085c485) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Tue, 22 Jan 2019 23:39:38 +0000 (07:39 +0800)]
net: hns3: fix PFC not setting problem for DCB module
BugLink: https://bugs.launchpad.net/bugs/1819535
The PFC enabling is based on user priority, currently it is
based on TC, which may cause PFC not setting correctly when pri
to TC mapping is not one to one relation.
This patch adds pfc_en in tm_info to fix it.
Fixes: cacde272dd00 ("net: hns3: Add hclge_dcb module for the support of DCB feature") Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d3ad430ac531e65f29c9737f86744c425c9173ef) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
liuzhongzhu [Tue, 22 Jan 2019 23:39:37 +0000 (07:39 +0800)]
net: hns3: add statistics for PFC frames and MAC control frames
BugLink: https://bugs.launchpad.net/bugs/1819535
In the old firmware version, statistics acquisition of
PFC frames and MAC control frames is not supported.
Add command retrieves statistics for PFC frames and
MAC control frames from the firmware.
Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d174ea75c96a12287354af53dc17cb24f328f90a) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Also, zero weight of TC weight in SSU ETS module means enabling
strict priority, so do not allow zero weight when in ETS mode.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 330baff5423b143fba698f2acc9eff3cfb1a0776) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Tue, 22 Jan 2019 23:39:35 +0000 (07:39 +0800)]
net: hns3: do not return GE PFC setting err when initializing
BugLink: https://bugs.launchpad.net/bugs/1819535
GE MAC does not support PFC, when driver is initializing and MAC
is in GE Mode, ignore the fw not supported error, otherwise
initialization will fail.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 44e59e375bf7785660a250f61e802996894d148a) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Tue, 22 Jan 2019 23:39:34 +0000 (07:39 +0800)]
net: hns3: Change fw error code NOT_EXEC to NOT_SUPPORTED
BugLink: https://bugs.launchpad.net/bugs/1819535
According to firmware error code definition, the error code of 2
means NOT_SUPPORTED, this patch changes it to NOT_SUPPORTED.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4a402f47cfce904051cd8b31bef4fe2910d9dce9) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit ac574b80a1ba834be01932d8cd4976acda775a36) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Huazhong Tan [Tue, 22 Jan 2019 23:39:32 +0000 (07:39 +0800)]
net: hns3: fix bug of ethtool_ops.get_channels for VF
BugLink: https://bugs.launchpad.net/bugs/1819535
The current code returns the number of all queues that can be used and
the number of queues that have been allocated, which is incorrect.
What should be returned is the number of queues allocated for each enabled
TC and the number of queues that can be allocated.
This patch fixes it.
Fixes: 849e46077689 ("net: hns3: add ethtool_ops.get_channels support for VF") Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8be7362186bd5ccb5f6f72be49751ad2778e2636) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Tue, 22 Jan 2019 23:39:31 +0000 (07:39 +0800)]
net: hns3: fix for shaper not setting when TC num changes
BugLink: https://bugs.launchpad.net/bugs/1819535
Shaper setting does not change currently, when TC num changes,
which may cause shaper parameter not setting problem.
This patch fixes it by setting the shaper parameter when TC num
changes.
Fixes: cacde272dd00 ("net: hns3: Add hclge_dcb module for the support of DCB feature") Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9e5157ba440f2bf87071c017545d6c4ba627e501) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
This patch fixes it by not setting rss configuration to default
if user has configured the rss.
Fixes: 09f2af6405b8 ("net: hns3: add support to modify tqps number") Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 90c68a41db7d02ac031e612c0c97147a58e20515) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Jian Shen [Tue, 22 Jan 2019 23:39:29 +0000 (07:39 +0800)]
net: hns3: refactor the statistics updating for netdev
BugLink: https://bugs.launchpad.net/bugs/1819535
In origin codes, there are some statistics item are got from mac, which
also include the packets statistics of VF. It is unreasonable. This
patch fixes it by counting them in the rx/tx processing flow.
Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit d3ec4ef669379bf69891415b4f1397a26a81932c) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c376fa1aae6328beb5551e92fa84f4441fdde399) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 45e92b7e4e27a427de7e87d5c4d63d4ce7ba02ab) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Yunsheng Lin [Fri, 18 Jan 2019 08:13:14 +0000 (16:13 +0800)]
net: hns3: add HNAE3_RESTORE_CLIENT interface in enet module
BugLink: https://bugs.launchpad.net/bugs/1819535
The HNAE3_INIT_CLIENT interface is also used when changing tc
configuration, vlan/mac hardware table does not need to be restored
when tc configuration changes.
This patch adds a HNAE3_RESTORE_CLIENT interface to restore the
vlan/mac hardware table when resetting.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1f60949297ceb92f8dbf0571f5f502988bbb0273) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Huazhong Tan [Fri, 18 Jan 2019 08:13:13 +0000 (16:13 +0800)]
net: hns3: do reinitialization while ETS configuration changed
BugLink: https://bugs.launchpad.net/bugs/1819535
When the ETS information is changed, the network device needs to be
re-initialized, otherwise the information such as the receiving queue
will be incorrect.
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit af013903c5c5dc4a251e0ac49eaab9411293f9f9) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Huazhong Tan [Fri, 18 Jan 2019 08:13:12 +0000 (16:13 +0800)]
net: hns3: fix wrong combined count returned by ethtool -l
BugLink: https://bugs.launchpad.net/bugs/1819535
The current code returns the number of all queues that can be used and
the number of queues that have been allocated, which is incorrect.
What should be returned is the number of queues allocated for each enabled
TC and the number of queues that can be allocated.
This patch fixes it.
Fixes: 482d2e9c1cc7 ("net: hns3: add support to query tqps number") Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c3b9c50d1567aa12be4448fe85b09626eba2499c) Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>