From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Ahmed Zaki <ahmed.zaki@intel.com>,
"Michal Swiatkowski" <michal.swiatkowski@linux.intel.com>,
Rafal Romanowski <rafal.romanowski@intel.com>,
Piotr Gardocki <piotrx.gardocki@intel.com>
Subject: Re: [PATCH iwl-next v5] iavf: fix err handling for MAC replace
Date: Mon, 19 Jun 2023 10:26:31 +0200 [thread overview]
Message-ID: <ZJARN5Nj/IpdWNWQ@boxer> (raw)
In-Reply-To: <20230619080635.49412-1-przemyslaw.kitszel@intel.com>
On Mon, Jun 19, 2023 at 04:06:35AM -0400, Przemek Kitszel wrote:
> Defer removal of current primary MAC until a replacement is successfully
> added. Previous implementation would left filter list with no primary MAC.
> This was found while reading the code.
>
> The patch takes advantage of the fact that there can only be a single primary
> MAC filter at any time ([1] by Piotr)
>
> Piotr has also applied some review suggestions during our internal patch
> submittal process.
>
> [1] https://lore.kernel.org/netdev/20230614145302.902301-2-piotrx.gardocki@intel.com/
>
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
> Signed-off-by: Piotr Gardocki <piotrx.gardocki@intel.com>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
I was reviewing that:
https://lore.kernel.org/netdev/ZH8JBgiZAvNdfg4+@boxer/
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
> v5: v4 re-sent after dependencies ([1] above) has been applied to net-next
> ---
> drivers/net/ethernet/intel/iavf/iavf_main.c | 42 ++++++++++-----------
> 1 file changed, 19 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
> index f262487109f6..44304f16cdfa 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_main.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
> @@ -1040,40 +1040,36 @@ static int iavf_replace_primary_mac(struct iavf_adapter *adapter,
> const u8 *new_mac)
> {
> struct iavf_hw *hw = &adapter->hw;
> - struct iavf_mac_filter *f;
> + struct iavf_mac_filter *new_f;
> + struct iavf_mac_filter *old_f;
>
> spin_lock_bh(&adapter->mac_vlan_list_lock);
>
> - list_for_each_entry(f, &adapter->mac_filter_list, list) {
> - f->is_primary = false;
> + new_f = iavf_add_filter(adapter, new_mac);
> + if (!new_f) {
> + spin_unlock_bh(&adapter->mac_vlan_list_lock);
> + return -ENOMEM;
> }
>
> - f = iavf_find_filter(adapter, hw->mac.addr);
> - if (f) {
> - f->remove = true;
> + old_f = iavf_find_filter(adapter, hw->mac.addr);
> + if (old_f) {
> + old_f->is_primary = false;
> + old_f->remove = true;
> adapter->aq_required |= IAVF_FLAG_AQ_DEL_MAC_FILTER;
> }
> -
> - f = iavf_add_filter(adapter, new_mac);
> -
> - if (f) {
> - /* Always send the request to add if changing primary MAC
> - * even if filter is already present on the list
> - */
> - f->is_primary = true;
> - f->add = true;
> - adapter->aq_required |= IAVF_FLAG_AQ_ADD_MAC_FILTER;
> - ether_addr_copy(hw->mac.addr, new_mac);
> - }
> + /* Always send the request to add if changing primary MAC,
> + * even if filter is already present on the list
> + */
> + new_f->is_primary = true;
> + new_f->add = true;
> + adapter->aq_required |= IAVF_FLAG_AQ_ADD_MAC_FILTER;
> + ether_addr_copy(hw->mac.addr, new_mac);
>
> spin_unlock_bh(&adapter->mac_vlan_list_lock);
>
> /* schedule the watchdog task to immediately process the request */
> - if (f) {
> - mod_delayed_work(adapter->wq, &adapter->watchdog_task, 0);
> - return 0;
> - }
> - return -ENOMEM;
> + mod_delayed_work(adapter->wq, &adapter->watchdog_task, 0);
> + return 0;
> }
>
> /**
> --
> 2.40.1
>
next prev parent reply other threads:[~2023-06-19 8:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 8:06 [PATCH iwl-next v5] iavf: fix err handling for MAC replace Przemek Kitszel
2023-06-19 8:26 ` Maciej Fijalkowski [this message]
2023-06-20 8:27 ` Przemek Kitszel
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=ZJARN5Nj/IpdWNWQ@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=ahmed.zaki@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=piotrx.gardocki@intel.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rafal.romanowski@intel.com \
/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 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).