All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH S45 11/15] ice: allow host to clear administratively set VF MAC
Date: Fri, 15 May 2020 17:51:17 -0700	[thread overview]
Message-ID: <20200516005121.4963-11-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20200516005121.4963-1-anthony.l.nguyen@intel.com>

From: Brett Creeley <brett.creeley@intel.com>

Currently a user is not allowed to clear a VF's administratively set MAC
on the PF. Fix this by allowing an all zero MAC address via "ip link set
${pf_eth} vf ${vf_id} mac 00:00:00:00:00:00".

An example use case for this would be issuing a "virsh shutdown"
command on a VM. The call to iproute mentioned above is part of this flow.
Without this change the driver incorrectly rejects clearing the VF's
administratively set MAC and prints unhelpful log messages.

Also, improve the comments surrounding this change.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
---
 .../net/ethernet/intel/ice/ice_virtchnl_pf.c  | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
index f5596b45b996..abc4f2dba388 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -3912,7 +3912,7 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
 	if (ice_validate_vf_id(pf, vf_id))
 		return -EINVAL;
 
-	if (is_zero_ether_addr(mac) || is_multicast_ether_addr(mac)) {
+	if (is_multicast_ether_addr(mac)) {
 		netdev_err(netdev, "%pM not a valid unicast address\n", mac);
 		return -EINVAL;
 	}
@@ -3932,15 +3932,21 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
 		return -EINVAL;
 	}
 
-	/* copy MAC into dflt_lan_addr and trigger a VF reset. The reset
-	 * flow will use the updated dflt_lan_addr and add a MAC filter
-	 * using ice_add_mac. Also set pf_set_mac to indicate that the PF has
-	 * set the MAC address for this VF.
+	/* VF is notified of its new MAC via the PF's response to the
+	 * VIRTCHNL_OP_GET_VF_RESOURCES message after the VF has been reset
 	 */
 	ether_addr_copy(vf->dflt_lan_addr.addr, mac);
-	vf->pf_set_mac = true;
-	netdev_info(netdev, "MAC on VF %d set to %pM. VF driver will be reinitialized\n",
-		    vf_id, mac);
+	if (is_zero_ether_addr(mac)) {
+		/* VF will send VIRTCHNL_OP_ADD_ETH_ADDR message with its MAC */
+		vf->pf_set_mac = false;
+		netdev_info(netdev, "Removing MAC on VF %d. VF driver will be reinitialized\n",
+			    vf->vf_id);
+	} else {
+		/* PF will add MAC rule for the VF */
+		vf->pf_set_mac = true;
+		netdev_info(netdev, "Setting MAC %pM on VF %d. VF driver will be reinitialized\n",
+			    mac, vf_id);
+	}
 
 	ice_vc_reset_vf(vf);
 	return 0;
-- 
2.20.1


  parent reply	other threads:[~2020-05-16  0:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16  0:51 [Intel-wired-lan] [PATCH S45 01/15] ice: Refactor ice_ena_vf_mappings to split MSIX and queue mappings Tony Nguyen
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 02/15] ice: Simplify ice_sriov_configure Tony Nguyen
2020-05-28 21:39   ` Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 03/15] ice: Add helper function for clearing VPGEN_VFRTRIG Tony Nguyen
2020-05-28 21:39   ` Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 04/15] ice: Separate VF VSI initialization/creation from reset flow Tony Nguyen
2020-05-28 21:40   ` Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 05/15] ice: Renaming and simplification in VF init path Tony Nguyen
2020-05-28 21:40   ` Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 06/15] ice: Add function to set trust mode bit on reset Tony Nguyen
2020-05-28 21:41   ` Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 07/15] ice: Add functions to rebuild host VLAN/MAC config for a VF Tony Nguyen
2020-05-28 21:41   ` Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 08/15] ice: remove VM/VF disable command on CORER/GLOBR reset Tony Nguyen
2020-05-28 21:41   ` Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 09/15] ice: Refactor VF reset Tony Nguyen
2020-05-28 21:42   ` Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 10/15] ice: Refactor VF VSI release and setup functions Tony Nguyen
2020-05-28 21:42   ` Bowers, AndrewX
2020-05-16  0:51 ` Tony Nguyen [this message]
2020-05-28 21:43   ` [Intel-wired-lan] [PATCH S45 11/15] ice: allow host to clear administratively set VF MAC Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 12/15] ice: support adding 16 unicast/multicast filter on untrusted VF Tony Nguyen
2020-05-28 21:43   ` Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 13/15] ice: Fix transmit for all software offloaded VLANs Tony Nguyen
2020-05-28 21:44   ` Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 14/15] ice: Increase timeout after PFR Tony Nguyen
2020-05-28 21:44   ` Bowers, AndrewX
2020-05-16  0:51 ` [Intel-wired-lan] [PATCH S45 15/15] ice: Update ICE_PHY_TYPE_HIGH_MAX_INDEX value Tony Nguyen
2020-05-28 21:44   ` Bowers, AndrewX
2020-05-28 21:38 ` [Intel-wired-lan] [PATCH S45 01/15] ice: Refactor ice_ena_vf_mappings to split MSIX and queue mappings Bowers, AndrewX

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=20200516005121.4963-11-anthony.l.nguyen@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 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.