All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Brett Creeley <brett.creeley@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	Andrew Bowers <andrewx.bowers@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 01/14] ice: allow host to clear administratively set VF MAC
Date: Sun, 31 May 2020 05:36:06 -0700	[thread overview]
Message-ID: <20200531123619.2887469-2-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <20200531123619.2887469-1-jeffrey.t.kirsher@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>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@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 a126e7c7663d..9550501f9279 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -3904,7 +3904,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;
 	}
@@ -3924,15 +3924,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.26.2


  reply	other threads:[~2020-05-31 12:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-31 12:36 [net-next 00/14][pull request] 100GbE Intel Wired LAN Driver Updates 2020-05-31 Jeff Kirsher
2020-05-31 12:36 ` Jeff Kirsher [this message]
2020-05-31 12:36 ` [net-next 02/14] ice: support adding 16 unicast/multicast filter on untrusted VF Jeff Kirsher
2020-05-31 12:36 ` [net-next 03/14] ice: Fix transmit for all software offloaded VLANs Jeff Kirsher
2020-05-31 12:36 ` [net-next 04/14] ice: Increase timeout after PFR Jeff Kirsher
2020-05-31 12:36 ` [net-next 05/14] ice: Update ICE_PHY_TYPE_HIGH_MAX_INDEX value Jeff Kirsher
2020-05-31 12:36 ` [net-next 06/14] ice: Reset VF for all port VLAN changes from host Jeff Kirsher
2020-05-31 12:36 ` [net-next 07/14] ice: Always clear QRXFLXP_CNTXT before writing new value Jeff Kirsher
2020-05-31 12:36 ` [net-next 08/14] ice: Fix inability to set channels when down Jeff Kirsher
2020-05-31 12:36 ` [net-next 09/14] ice: Allow VF to request reset as soon as it's initialized Jeff Kirsher
2020-05-31 12:36 ` [net-next 10/14] ice: fix function signature style format Jeff Kirsher
2020-05-31 12:36 ` [net-next 11/14] ice: fix PCI device serial number to be lowercase values Jeff Kirsher
2020-05-31 12:36 ` [net-next 12/14] ice: Use coalesce values from q_vector 0 when increasing q_vectors Jeff Kirsher
2020-05-31 12:36 ` [net-next 13/14] ice: fix aRFS after flow director delete Jeff Kirsher
2020-05-31 12:36 ` [net-next 14/14] ice: Ignore EMODE when setting PHY config Jeff Kirsher
2020-05-31 12:50 ` [net-next 00/14][pull request] 100GbE Intel Wired LAN Driver Updates 2020-05-31 Kirsher, Jeffrey T
2020-06-01 19:10 ` David Miller

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=20200531123619.2887469-2-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=andrewx.bowers@intel.com \
    --cc=brett.creeley@intel.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.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 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.