From: Nguyen, Anthony L <anthony.l.nguyen@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v1] iavf: Add waiting for response from PF in set mac
Date: Tue, 25 Jan 2022 23:36:36 +0000 [thread overview]
Message-ID: <eb3f148f9100496b07046d485eaa7080a9086043.camel@intel.com> (raw)
In-Reply-To: <20220124154553.29782-1-mateusz.palczewski@intel.com>
On Mon, 2022-01-24 at 16:45 +0100, Mateusz Palczewski wrote:
>
<snip>
> +enum iavf_critical_section_t {
> +???????__IAVF_IN_CRITICAL_TASK?????????/* cannot be interrupted */
> +};
This was removed by maintainer request. Please don't re-add it. Use the
crit_lock.
> ?#define IAVF_CLOUD_FIELD_OMAC??????????0x01
> ?#define IAVF_CLOUD_FIELD_IMAC??????????0x02
> ?#define IAVF_CLOUD_FIELD_IVLAN?0x04
> @@ -240,6 +245,7 @@ struct iavf_adapter {
> ????????struct work_struct adminq_task;
> ????????struct delayed_work client_task;
> ????????wait_queue_head_t down_waitqueue;
> +???????wait_queue_head_t vc_waitqueue;
> ????????struct iavf_q_vector *q_vectors;
> ????????struct list_head vlan_filter_list;
> ????????struct list_head mac_filter_list;
> @@ -283,6 +289,7 @@ struct iavf_adapter {
> ?#define IAVF_FLAG_LEGACY_RX????????????????????BIT(15)
> ?#define IAVF_FLAG_REINIT_ITR_NEEDED????????????BIT(16)
> ?#define IAVF_FLAG_QUEUES_DISABLED??????????????BIT(17)
> +#define IAVF_FLAG_INITIAL_MAC_SET??????????????BIT(23)
> ?/* duplicates for common code */
> ?#define IAVF_FLAG_DCB_ENABLED??????????????????0
> ????????/* flags for admin queue service task */
> @@ -550,6 +557,8 @@ void iavf_enable_vlan_stripping_v2(struct
> iavf_adapter *adapter, u16 tpid);
> ?void iavf_disable_vlan_stripping_v2(struct iavf_adapter *adapter,
> u16 tpid);
> ?void iavf_enable_vlan_insertion_v2(struct iavf_adapter *adapter, u16
> tpid);
> ?void iavf_disable_vlan_insertion_v2(struct iavf_adapter *adapter,
> u16 tpid);
> +int iavf_replace_primary_mac(struct iavf_adapter *adapter,
> +??????????????????????????? const u8 *new_mac);
> ?void
> ?iavf_set_vlan_offload_features(struct iavf_adapter *adapter,
> ?????????????????????????????? netdev_features_t prev_features,
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c
> b/drivers/net/ethernet/intel/iavf/iavf_main.c
> index a4c12a3..c816ecb 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_main.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
> @@ -873,6 +873,7 @@ struct iavf_mac_filter *iavf_add_filter(struct
> iavf_adapter *adapter,
> ?
> ????????????????list_add_tail(&f->list, &adapter->mac_filter_list);
> ????????????????f->add = true;
> +???????????????f->add_handled = false;
> ????????????????f->is_new_mac = true;
> ????????????????f->is_primary = false;
> ????????????????adapter->aq_required |= IAVF_FLAG_AQ_ADD_MAC_FILTER;
> @@ -884,47 +885,128 @@ struct iavf_mac_filter *iavf_add_filter(struct
> iavf_adapter *adapter,
> ?}
> ?
> ?/**
> - * iavf_set_mac - NDO callback to set port mac address
> - * @netdev: network interface device structure
> - * @p: pointer to an address structure
> + * iavf_replace_primary_mac - Replace current primary address
> + * @adapter: board private structure
> + * @new_mac: new mac address to be applied
> ? *
> - * Returns 0 on success, negative on failure
> + * Replace current dev_addr and send request to PF for removal of
> previous
> + * primary mac address filter and addition of new primary mac
> filter.
> + * Return 0 for success, -ENOMEM for failure.
> + *
> + * Do not call this with mac_vlan_list_lock!
> ? **/
> -static int iavf_set_mac(struct net_device *netdev, void *p)
> +int iavf_replace_primary_mac(struct iavf_adapter *adapter,
> +??????????????????????????? const u8 *new_mac)
> ?{
> -???????struct iavf_adapter *adapter = netdev_priv(netdev);
> ????????struct iavf_hw *hw = &adapter->hw;
> ????????struct iavf_mac_filter *f;
> -???????struct sockaddr *addr = p;
> -
> -???????if (!is_valid_ether_addr(addr->sa_data))
> -???????????????return -EADDRNOTAVAIL;
> -
> -???????if (ether_addr_equal(netdev->dev_addr, addr->sa_data))
> -???????????????return 0;
> ?
> ????????spin_lock_bh(&adapter->mac_vlan_list_lock);
> ?
> +???????list_for_each_entry(f, &adapter->mac_filter_list, list) {
> +???????????????f->is_primary = false;
> +???????}
> +
> ????????f = iavf_find_filter(adapter, hw->mac.addr);
> ????????if (f) {
> ????????????????f->remove = true;
> -???????????????f->is_primary = true;
> ????????????????adapter->aq_required |= IAVF_FLAG_AQ_DEL_MAC_FILTER;
prev parent reply other threads:[~2022-01-25 23:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 15:45 [Intel-wired-lan] [PATCH net-next v1] iavf: Add waiting for response from PF in set mac Mateusz Palczewski
2022-01-25 0:48 ` Nguyen, Anthony L
2022-01-25 11:19 ` Palczewski, Mateusz
2022-01-25 23:21 ` Nguyen, Anthony L
2022-01-25 23:36 ` Nguyen, Anthony L [this message]
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=eb3f148f9100496b07046d485eaa7080a9086043.camel@intel.com \
--to=anthony.l.nguyen@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox