diff mbox

[net,5/7] bnx2x: do not rollback VF MAC/VLAN filters we did not configure

Message ID 20170303160834.4125-6-mschmidt@redhat.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Michal Schmidt March 3, 2017, 4:08 p.m. UTC
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: Michal Schmidt <mschmidt@redhat.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 8 +++++++-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Mintz, Yuval March 5, 2017, 10:13 a.m. UTC | #1
> On failure to configure a VF MAC/VLAN filter we should not attempt to
> rollback filters that we failed to configure with -EEXIST.

Is this theoretical or did you actually manage to hit it?
If so, did it involve non-linux VFs?

Asking as linux VFs don't actually send multiple vlan/umac configurations
Via same request, and with a single filter per-message you're not expected
to ever do rollback.
Michal Schmidt March 6, 2017, 2:05 p.m. UTC | #2
Dne 5.3.2017 v 11:13 Mintz, Yuval napsal(a):
>> On failure to configure a VF MAC/VLAN filter we should not attempt to
>> rollback filters that we failed to configure with -EEXIST.
>
> Is this theoretical or did you actually manage to hit it?
> If so, did it involve non-linux VFs?
>
> Asking as linux VFs don't actually send multiple vlan/umac configurations
> Via same request, and with a single filter per-message you're not expected
> to ever do rollback.

This one is theoretical, found by reading the code, not actually hitting 
the rollback case.

Michal
diff mbox

Patch

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 9f0f851774..2068bb8f54 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -434,7 +434,9 @@  static int bnx2x_vf_mac_vlan_config(struct bnx2x *bp,
 
 	/* Add/Remove the filter */
 	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",
 			  filter->add ? "add" : "delete",
 			  (filter->type == BNX2X_VF_FILTER_VLAN_MAC) ?
@@ -444,6 +446,8 @@  static int bnx2x_vf_mac_vlan_config(struct bnx2x *bp,
 		return rc;
 	}
 
+	filter->applied = true;
+
 	return 0;
 }
 
@@ -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",
 			  i, filters->count + 1);
 		while (--i >= 0) {
+			if (!filters->filters[i].applied)
+				continue;
 			filters->filters[i].add = !filters->filters[i].add;
 			bnx2x_vf_mac_vlan_config(bp, vf, qid,
 						 &filters->filters[i],
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
index 7a6d406f4c..888d0b6632 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
@@ -114,6 +114,7 @@  struct bnx2x_vf_mac_vlan_filter {
 	(BNX2X_VF_FILTER_MAC | BNX2X_VF_FILTER_VLAN) /*shortcut*/
 
 	bool add;
+	bool applied;
 	u8 *mac;
 	u16 vid;
 };