All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Guedes <andre.guedes@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH 03/12] igc: Change igc_add_mac_filter() returning value
Date: Wed, 18 Mar 2020 16:00:53 -0700	[thread overview]
Message-ID: <20200318230102.36952-4-andre.guedes@intel.com> (raw)
In-Reply-To: <20200318230102.36952-1-andre.guedes@intel.com>

In case of success, igc_add_mac_filter() returns the index in
adapter->mac_table where the requested filter was added. This
information, however, is not used by any caller of that function.
In fact, callers have extra code just to handle this returning
index as 0 (success).

So this patch changes the function to return 0 on success instead,
and cleans up the extra code.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 2 --
 drivers/net/ethernet/intel/igc/igc_main.c    | 7 ++-----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index 925f0979506e..9ef133fe6e40 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -1270,7 +1270,6 @@ int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)
 		err = igc_add_mac_steering_filter(adapter,
 						  input->filter.dst_addr,
 						  input->action, 0);
-		err = min_t(int, err, 0);
 		if (err)
 			return err;
 	}
@@ -1280,7 +1279,6 @@ int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)
 						  input->filter.src_addr,
 						  input->action,
 						  IGC_MAC_STATE_SRC_ADDR);
-		err = min_t(int, err, 0);
 		if (err)
 			return err;
 	}
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 5360d73d9c63..ed2648e0fbd8 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -2218,7 +2218,7 @@ static int igc_add_mac_filter(struct igc_adapter *adapter, const u8 *addr,
 		adapter->mac_table[i].state |= IGC_MAC_STATE_IN_USE | flags;
 
 		igc_rar_set_index(adapter, i);
-		return i;
+		return 0;
 	}
 
 	return -ENOSPC;
@@ -2277,11 +2277,8 @@ static int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr,
 static int igc_uc_sync(struct net_device *netdev, const unsigned char *addr)
 {
 	struct igc_adapter *adapter = netdev_priv(netdev);
-	int ret;
-
-	ret = igc_add_mac_filter(adapter, addr, adapter->num_rx_queues, 0);
 
-	return min_t(int, ret, 0);
+	return igc_add_mac_filter(adapter, addr, adapter->num_rx_queues, 0);
 }
 
 static int igc_uc_unsync(struct net_device *netdev, const unsigned char *addr)
-- 
2.25.0


  parent reply	other threads:[~2020-03-18 23:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 23:00 [Intel-wired-lan] [PATCH 00/12] igc: Refactor MAC address filtering code Andre Guedes
2020-03-18 23:00 ` [Intel-wired-lan] [PATCH 01/12] igc: Remove duplicate code in MAC filtering logic Andre Guedes
2020-03-31 19:58   ` Brown, Aaron F
2020-03-18 23:00 ` [Intel-wired-lan] [PATCH 02/12] igc: Check unsupported flag in igc_add_mac_filter() Andre Guedes
2020-03-31 19:58   ` Brown, Aaron F
2020-03-31 20:59     ` Brown, Aaron F
2020-03-18 23:00 ` Andre Guedes [this message]
2020-03-31 19:59   ` [Intel-wired-lan] [PATCH 03/12] igc: Change igc_add_mac_filter() returning value Brown, Aaron F
2020-03-18 23:00 ` [Intel-wired-lan] [PATCH 04/12] igc: Fix igc_uc_unsync() Andre Guedes
2020-03-31 19:59   ` Brown, Aaron F
2020-03-18 23:00 ` [Intel-wired-lan] [PATCH 05/12] igc: Refactor igc_rar_set_index() Andre Guedes
2020-03-31 11:22   ` Neftin, Sasha
2020-03-31 21:12     ` Andre Guedes
2020-04-01 21:51       ` Andre Guedes
2020-03-31 20:00   ` Brown, Aaron F
2020-04-01 21:36   ` [Intel-wired-lan] [PATCH v2 " Andre Guedes
2020-03-18 23:00 ` [Intel-wired-lan] [PATCH 06/12] igc: Improve address check in igc_del_mac_filter() Andre Guedes
2020-03-31 20:01   ` Brown, Aaron F
2020-03-18 23:00 ` [Intel-wired-lan] [PATCH 07/12] igc: Remove 'queue' " Andre Guedes
2020-03-31 15:53   ` Neftin, Sasha
2020-03-31 20:48     ` Brown, Aaron F
2020-03-31 20:50       ` Kirsher, Jeffrey T
2020-04-01 21:41   ` [Intel-wired-lan] [PATCH v2 " Andre Guedes
2020-03-18 23:00 ` [Intel-wired-lan] [PATCH 08/12] igc: Remove IGC_MAC_STATE_QUEUE_STEERING Andre Guedes
2020-03-31 20:55   ` Brown, Aaron F
2020-04-01  5:44   ` Neftin, Sasha
2020-04-01 21:43   ` [Intel-wired-lan] [PATCH v2 " Andre Guedes
2020-03-18 23:00 ` [Intel-wired-lan] [PATCH 09/12] igc: Remove igc_*_mac_steering_filter() wrappers Andre Guedes
2020-03-31 20:56   ` Brown, Aaron F
2020-03-18 23:01 ` [Intel-wired-lan] [PATCH 10/12] igc: Refactor igc_mac_entry_can_be_used() Andre Guedes
2020-03-31 20:56   ` Brown, Aaron F
2020-03-18 23:01 ` [Intel-wired-lan] [PATCH 11/12] igc: Refactor igc_del_mac_filter() Andre Guedes
2020-03-31 20:57   ` Brown, Aaron F
2020-03-18 23:01 ` [Intel-wired-lan] [PATCH 12/12] igc: Add debug messages to MAC filter code Andre Guedes
2020-03-31 20:57   ` Brown, Aaron F

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200318230102.36952-4-andre.guedes@intel.com \
    --to=andre.guedes@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.