Commit 84bc40c4 authored by Michal Schmidt's avatar Michal Schmidt Committed by Greg Kroah-Hartman

bnx2x: do not rollback VF MAC/VLAN filters we did not configure


[ Upstream commit 78d55054 ]

On failure to configure a VF MAC/VLAN filter we should not attempt to
rollback filters that we failed to configure with -EEXIST.
Signed-off-by: default avatarMichal Schmidt <mschmidt@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 871e4b11
...@@ -434,7 +434,9 @@ static int bnx2x_vf_mac_vlan_config(struct bnx2x *bp, ...@@ -434,7 +434,9 @@ static int bnx2x_vf_mac_vlan_config(struct bnx2x *bp,
/* Add/Remove the filter */ /* Add/Remove the filter */
rc = bnx2x_config_vlan_mac(bp, &ramrod); rc = bnx2x_config_vlan_mac(bp, &ramrod);
if (rc && rc != -EEXIST) { if (rc == -EEXIST)
return 0;
if (rc) {
BNX2X_ERR("Failed to %s %s\n", BNX2X_ERR("Failed to %s %s\n",
filter->add ? "add" : "delete", filter->add ? "add" : "delete",
(filter->type == BNX2X_VF_FILTER_VLAN_MAC) ? (filter->type == BNX2X_VF_FILTER_VLAN_MAC) ?
...@@ -444,6 +446,8 @@ static int bnx2x_vf_mac_vlan_config(struct bnx2x *bp, ...@@ -444,6 +446,8 @@ static int bnx2x_vf_mac_vlan_config(struct bnx2x *bp,
return rc; return rc;
} }
filter->applied = true;
return 0; return 0;
} }
...@@ -471,6 +475,8 @@ int bnx2x_vf_mac_vlan_config_list(struct bnx2x *bp, struct bnx2x_virtf *vf, ...@@ -471,6 +475,8 @@ int bnx2x_vf_mac_vlan_config_list(struct bnx2x *bp, struct bnx2x_virtf *vf,
BNX2X_ERR("Managed only %d/%d filters - rolling back\n", BNX2X_ERR("Managed only %d/%d filters - rolling back\n",
i, filters->count + 1); i, filters->count + 1);
while (--i >= 0) { while (--i >= 0) {
if (!filters->filters[i].applied)
continue;
filters->filters[i].add = !filters->filters[i].add; filters->filters[i].add = !filters->filters[i].add;
bnx2x_vf_mac_vlan_config(bp, vf, qid, bnx2x_vf_mac_vlan_config(bp, vf, qid,
&filters->filters[i], &filters->filters[i],
......
...@@ -114,6 +114,7 @@ struct bnx2x_vf_mac_vlan_filter { ...@@ -114,6 +114,7 @@ struct bnx2x_vf_mac_vlan_filter {
(BNX2X_VF_FILTER_MAC | BNX2X_VF_FILTER_VLAN) /*shortcut*/ (BNX2X_VF_FILTER_MAC | BNX2X_VF_FILTER_VLAN) /*shortcut*/
bool add; bool add;
bool applied;
u8 *mac; u8 *mac;
u16 vid; u16 vid;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment