Skip to contentSkip to conversation

ixgbe: Ensure MAC filter was added before setting MACVLAN

PATCH New Tony Nguyen 2 participants 2 messages Jul 19, 2017 – Jul 21, 2017

Subsystems (2)
lore
Share & tools
lore

Tony Nguyen

author maintainer
#0 lore raw

PATCH v2 1/1 ixgbe: Ensure MAC filter was added before setting MACVLAN

This patch adds a check to ensure that adding the MAC filter was successful before setting the MACVLAN. If it was unsuccessful, propagate the error.

---
v2:
Made changes as suggested by Joe Perches.
- Declared retval as an int
- Switched logic to return on error
- Return 0 on success

 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +6 -3
index 0760bd7..112d24c 100644
@@ -679,8 +679,9 @@ static void ixgbe_clear_vf_vlans(struct ixgbe_adapter *adapter, u32 vf)
 static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
 				int vf, int index, unsigned char *mac_addr)
 {
-	struct list_head *pos;
 	struct vf_macvlans *entry;
+	struct list_head *pos;
+	int retval = 0;
 
 	if (index <= 1) {
 		list_for_each(pos, &adapter->vf_mvs.l) {
@@ -721,13 +722,15 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
 	if (!entry || !entry->free)
 		return -ENOSPC;
 
+	retval = ixgbe_add_mac_filter(adapter, mac_addr, vf);
+	if (retval < 0)
+		return retval;
+
 	entry->free = false;
 	entry->is_macvlan = true;
 	entry->vf = vf;
 	memcpy(entry->vf_macvlan, mac_addr, ETH_ALEN);
 
-	ixgbe_add_mac_filter(adapter, mac_addr, vf);
-
 	return 0;
 }
 
Signature · 1 line
2.9.3
#1 lore raw

PATCH v2 1/1 ixgbe: Ensure MAC filter was added before setting MACVLAN

Quoted 19 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Tony Nguyen
Sent: Wednesday, July 19, 2017 3:00 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v2] ixgbe: Ensure MAC filter was added before setting MACVLAN

This patch adds a check to ensure that adding the MAC filter was successful before setting the MACVLAN. If it was unsuccessful, propagate the error.

---
v2:
Made changes as suggested by Joe Perches.
- Declared retval as an int
- Switched logic to return on error
- Return 0 on success

Quoted 2 lines
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)