Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net] hinic: fix wrong return value of mac-set cmd
@ 2020-09-24 1:31 Luo bin
2020-09-25 3:02 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Luo bin @ 2020-09-24 1:31 UTC (permalink / raw)
To: davem
Cc: linux-kernel, netdev, yin.yinshi, cloud.wangxiaoyun, chiqijun,
zengweiliang.zengweiliang
It should also be regarded as an error when hw return status=4 for PF's
setting mac cmd. Only if PF return status=4 to VF should this cmd be
taken special treatment.
Fixes: 7dd29ee12865 ("hinic: add sriov feature support")
Signed-off-by: Luo bin <luobin9@huawei.com>
---
drivers/net/ethernet/huawei/hinic/hinic_port.c | 6 +++---
drivers/net/ethernet/huawei/hinic/hinic_sriov.c | 12 ++----------
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_port.c b/drivers/net/ethernet/huawei/hinic/hinic_port.c
index 02cd635d6914..eb97f2d6b1ad 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_port.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_port.c
@@ -58,9 +58,9 @@ static int change_mac(struct hinic_dev *nic_dev, const u8 *addr,
sizeof(port_mac_cmd),
&port_mac_cmd, &out_size);
if (err || out_size != sizeof(port_mac_cmd) ||
- (port_mac_cmd.status &&
- port_mac_cmd.status != HINIC_PF_SET_VF_ALREADY &&
- port_mac_cmd.status != HINIC_MGMT_STATUS_EXIST)) {
+ (port_mac_cmd.status &&
+ (port_mac_cmd.status != HINIC_PF_SET_VF_ALREADY || !HINIC_IS_VF(hwif)) &&
+ port_mac_cmd.status != HINIC_MGMT_STATUS_EXIST)) {
dev_err(&pdev->dev, "Failed to change MAC, err: %d, status: 0x%x, out size: 0x%x\n",
err, port_mac_cmd.status, out_size);
return -EFAULT;
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
index 4d63680f2143..f8a26459ff65 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
@@ -38,8 +38,7 @@ static int hinic_set_mac(struct hinic_hwdev *hwdev, const u8 *mac_addr,
err = hinic_port_msg_cmd(hwdev, HINIC_PORT_CMD_SET_MAC, &mac_info,
sizeof(mac_info), &mac_info, &out_size);
if (err || out_size != sizeof(mac_info) ||
- (mac_info.status && mac_info.status != HINIC_PF_SET_VF_ALREADY &&
- mac_info.status != HINIC_MGMT_STATUS_EXIST)) {
+ (mac_info.status && mac_info.status != HINIC_MGMT_STATUS_EXIST)) {
dev_err(&hwdev->func_to_io.hwif->pdev->dev, "Failed to set MAC, err: %d, status: 0x%x, out size: 0x%x\n",
err, mac_info.status, out_size);
return -EIO;
@@ -503,8 +502,7 @@ struct hinic_sriov_info *hinic_get_sriov_info_by_pcidev(struct pci_dev *pdev)
static int hinic_check_mac_info(u8 status, u16 vlan_id)
{
- if ((status && status != HINIC_MGMT_STATUS_EXIST &&
- status != HINIC_PF_SET_VF_ALREADY) ||
+ if ((status && status != HINIC_MGMT_STATUS_EXIST) ||
(vlan_id & CHECK_IPSU_15BIT &&
status == HINIC_MGMT_STATUS_EXIST))
return -EINVAL;
@@ -546,12 +544,6 @@ static int hinic_update_mac(struct hinic_hwdev *hwdev, u8 *old_mac,
return -EINVAL;
}
- if (mac_info.status == HINIC_PF_SET_VF_ALREADY) {
- dev_warn(&hwdev->hwif->pdev->dev,
- "PF has already set VF MAC. Ignore update operation\n");
- return HINIC_PF_SET_VF_ALREADY;
- }
-
if (mac_info.status == HINIC_MGMT_STATUS_EXIST)
dev_warn(&hwdev->hwif->pdev->dev, "MAC is repeated. Ignore update operation\n");
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] hinic: fix wrong return value of mac-set cmd
2020-09-24 1:31 [PATCH net] hinic: fix wrong return value of mac-set cmd Luo bin
@ 2020-09-25 3:02 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2020-09-25 3:02 UTC (permalink / raw)
To: luobin9
Cc: linux-kernel, netdev, yin.yinshi, cloud.wangxiaoyun, chiqijun,
zengweiliang.zengweiliang
From: Luo bin <luobin9@huawei.com>
Date: Thu, 24 Sep 2020 09:31:51 +0800
> It should also be regarded as an error when hw return status=4 for PF's
> setting mac cmd. Only if PF return status=4 to VF should this cmd be
> taken special treatment.
>
> Fixes: 7dd29ee12865 ("hinic: add sriov feature support")
> Signed-off-by: Luo bin <luobin9@huawei.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] hinic: fix wrong return value of mac-set cmd
2020-09-24 0:43 ` David Miller
@ 2020-09-24 1:26 ` luobin (L)
0 siblings, 0 replies; 5+ messages in thread
From: luobin (L) @ 2020-09-24 1:26 UTC (permalink / raw)
To: David Miller
Cc: linux-kernel, netdev, yin.yinshi, cloud.wangxiaoyun, chiqijun,
zengweiliang.zengweiliang
On 2020/9/24 8:43, David Miller wrote:
> From: Luo bin <luobin9@huawei.com>
> Date: Tue, 22 Sep 2020 19:26:43 +0800
>
>> It should also be regarded as an error when hw return status=4 for PF's
>> setting mac cmd. Only if PF return status=4 to VF should this cmd be
>> taken special treatment.
>>
>> Signed-off-by: Luo bin <luobin9@huawei.com>
>
> Bug fixes require a proper Fixes: tag.
>
> Please resubmit with the corrected, thank you.
> .
>
Will fix. Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] hinic: fix wrong return value of mac-set cmd
2020-09-22 11:26 Luo bin
@ 2020-09-24 0:43 ` David Miller
2020-09-24 1:26 ` luobin (L)
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2020-09-24 0:43 UTC (permalink / raw)
To: luobin9
Cc: linux-kernel, netdev, yin.yinshi, cloud.wangxiaoyun, chiqijun,
zengweiliang.zengweiliang
From: Luo bin <luobin9@huawei.com>
Date: Tue, 22 Sep 2020 19:26:43 +0800
> It should also be regarded as an error when hw return status=4 for PF's
> setting mac cmd. Only if PF return status=4 to VF should this cmd be
> taken special treatment.
>
> Signed-off-by: Luo bin <luobin9@huawei.com>
Bug fixes require a proper Fixes: tag.
Please resubmit with the corrected, thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net] hinic: fix wrong return value of mac-set cmd
@ 2020-09-22 11:26 Luo bin
2020-09-24 0:43 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Luo bin @ 2020-09-22 11:26 UTC (permalink / raw)
To: davem
Cc: linux-kernel, netdev, yin.yinshi, cloud.wangxiaoyun, chiqijun,
zengweiliang.zengweiliang
It should also be regarded as an error when hw return status=4 for PF's
setting mac cmd. Only if PF return status=4 to VF should this cmd be
taken special treatment.
Signed-off-by: Luo bin <luobin9@huawei.com>
---
drivers/net/ethernet/huawei/hinic/hinic_port.c | 6 +++---
drivers/net/ethernet/huawei/hinic/hinic_sriov.c | 12 ++----------
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_port.c b/drivers/net/ethernet/huawei/hinic/hinic_port.c
index 02cd635d6914..eb97f2d6b1ad 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_port.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_port.c
@@ -58,9 +58,9 @@ static int change_mac(struct hinic_dev *nic_dev, const u8 *addr,
sizeof(port_mac_cmd),
&port_mac_cmd, &out_size);
if (err || out_size != sizeof(port_mac_cmd) ||
- (port_mac_cmd.status &&
- port_mac_cmd.status != HINIC_PF_SET_VF_ALREADY &&
- port_mac_cmd.status != HINIC_MGMT_STATUS_EXIST)) {
+ (port_mac_cmd.status &&
+ (port_mac_cmd.status != HINIC_PF_SET_VF_ALREADY || !HINIC_IS_VF(hwif)) &&
+ port_mac_cmd.status != HINIC_MGMT_STATUS_EXIST)) {
dev_err(&pdev->dev, "Failed to change MAC, err: %d, status: 0x%x, out size: 0x%x\n",
err, port_mac_cmd.status, out_size);
return -EFAULT;
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
index 4d63680f2143..f8a26459ff65 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
@@ -38,8 +38,7 @@ static int hinic_set_mac(struct hinic_hwdev *hwdev, const u8 *mac_addr,
err = hinic_port_msg_cmd(hwdev, HINIC_PORT_CMD_SET_MAC, &mac_info,
sizeof(mac_info), &mac_info, &out_size);
if (err || out_size != sizeof(mac_info) ||
- (mac_info.status && mac_info.status != HINIC_PF_SET_VF_ALREADY &&
- mac_info.status != HINIC_MGMT_STATUS_EXIST)) {
+ (mac_info.status && mac_info.status != HINIC_MGMT_STATUS_EXIST)) {
dev_err(&hwdev->func_to_io.hwif->pdev->dev, "Failed to set MAC, err: %d, status: 0x%x, out size: 0x%x\n",
err, mac_info.status, out_size);
return -EIO;
@@ -503,8 +502,7 @@ struct hinic_sriov_info *hinic_get_sriov_info_by_pcidev(struct pci_dev *pdev)
static int hinic_check_mac_info(u8 status, u16 vlan_id)
{
- if ((status && status != HINIC_MGMT_STATUS_EXIST &&
- status != HINIC_PF_SET_VF_ALREADY) ||
+ if ((status && status != HINIC_MGMT_STATUS_EXIST) ||
(vlan_id & CHECK_IPSU_15BIT &&
status == HINIC_MGMT_STATUS_EXIST))
return -EINVAL;
@@ -546,12 +544,6 @@ static int hinic_update_mac(struct hinic_hwdev *hwdev, u8 *old_mac,
return -EINVAL;
}
- if (mac_info.status == HINIC_PF_SET_VF_ALREADY) {
- dev_warn(&hwdev->hwif->pdev->dev,
- "PF has already set VF MAC. Ignore update operation\n");
- return HINIC_PF_SET_VF_ALREADY;
- }
-
if (mac_info.status == HINIC_MGMT_STATUS_EXIST)
dev_warn(&hwdev->hwif->pdev->dev, "MAC is repeated. Ignore update operation\n");
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-25 3:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24 1:31 [PATCH net] hinic: fix wrong return value of mac-set cmd Luo bin
2020-09-25 3:02 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2020-09-22 11:26 Luo bin
2020-09-24 0:43 ` David Miller
2020-09-24 1:26 ` luobin (L)
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).