All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Jacob Keller <jacob.e.keller@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 11/17] fm10k: force LPORT delete when updating VLAN or MAC address
Date: Tue, 16 Jun 2015 06:47:22 -0700	[thread overview]
Message-ID: <1434462448-140563-12-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1434462448-140563-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Jacob Keller <jacob.e.keller@intel.com>

Currently, we don't notify the switch at all when the PF
administratively sets a new VLAN or MAC address. This causes the old
addresses to remain valid on the switch table. Since the PF is
overriding any configuration done directly by the VF, we choose to
simply re-create the LPORT for the VF. This does mean that all rules for
the VF will be dropped when we set something directly via the PF, but it
prevents some weird issues where the MAC/VLAN table retains some stale
configuration.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 38 +++++++++++++++++-----------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_iov.c b/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
index 5b08e62..94571e6 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
@@ -400,11 +400,31 @@ int fm10k_iov_configure(struct pci_dev *pdev, int num_vfs)
 	return num_vfs;
 }
 
+static inline void fm10k_reset_vf_info(struct fm10k_intfc *interface,
+				       struct fm10k_vf_info *vf_info)
+{
+	struct fm10k_hw *hw = &interface->hw;
+
+	/* assigning the MAC address will send a mailbox message */
+	fm10k_mbx_lock(interface);
+
+	/* disable LPORT for this VF which clears switch rules */
+	hw->iov.ops.reset_lport(hw, vf_info);
+
+	/* assign new MAC+VLAN for this VF */
+	hw->iov.ops.assign_default_mac_vlan(hw, vf_info);
+
+	/* re-enable the LPORT for this VF */
+	hw->iov.ops.set_lport(hw, vf_info, vf_info->vf_idx,
+			      FM10K_VF_FLAG_MULTI_CAPABLE);
+
+	fm10k_mbx_unlock(interface);
+}
+
 int fm10k_ndo_set_vf_mac(struct net_device *netdev, int vf_idx, u8 *mac)
 {
 	struct fm10k_intfc *interface = netdev_priv(netdev);
 	struct fm10k_iov_data *iov_data = interface->iov_data;
-	struct fm10k_hw *hw = &interface->hw;
 	struct fm10k_vf_info *vf_info;
 
 	/* verify SR-IOV is active and that vf idx is valid */
@@ -419,13 +439,7 @@ int fm10k_ndo_set_vf_mac(struct net_device *netdev, int vf_idx, u8 *mac)
 	vf_info = &iov_data->vf_info[vf_idx];
 	ether_addr_copy(vf_info->mac, mac);
 
-	/* assigning the MAC will send a mailbox message so lock is needed */
-	fm10k_mbx_lock(interface);
-
-	/* assign MAC address to VF */
-	hw->iov.ops.assign_default_mac_vlan(hw, vf_info);
-
-	fm10k_mbx_unlock(interface);
+	fm10k_reset_vf_info(interface, vf_info);
 
 	return 0;
 }
@@ -455,16 +469,10 @@ int fm10k_ndo_set_vf_vlan(struct net_device *netdev, int vf_idx, u16 vid,
 	/* record default VLAN ID for VF */
 	vf_info->pf_vid = vid;
 
-	/* assigning the VLAN will send a mailbox message so lock is needed */
-	fm10k_mbx_lock(interface);
-
 	/* Clear the VLAN table for the VF */
 	hw->mac.ops.update_vlan(hw, FM10K_VLAN_ALL, vf_info->vsi, false);
 
-	/* Update VF assignment and trigger reset */
-	hw->iov.ops.assign_default_mac_vlan(hw, vf_info);
-
-	fm10k_mbx_unlock(interface);
+	fm10k_reset_vf_info(interface, vf_info);
 
 	return 0;
 }
-- 
2.4.3

  parent reply	other threads:[~2015-06-16 13:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16 13:47 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2015-06-16 Jeff Kirsher
2015-06-16 13:47 ` [net-next 01/17] fm10k: fold fm10k_pull_tail into fm10k_add_rx_frag Jeff Kirsher
2015-06-16 13:47 ` [net-next 02/17] fm10k: ignore invalid multicast address entries Jeff Kirsher
2015-06-16 13:47 ` [net-next 03/17] fm10k: use correct ethernet driver Tx timestamp function Jeff Kirsher
2015-06-16 13:47 ` [net-next 04/17] fm10k: move setting shinfo inside ts_tx_enqueue Jeff Kirsher
2015-06-16 13:47 ` [net-next 05/17] fm10k: fix incorrect free on skb in ts_tx_enqueue Jeff Kirsher
2015-06-16 13:47 ` [net-next 06/17] fm10k: add call to fm10k_clean_all_rx_rings in fm10k_down Jeff Kirsher
2015-06-16 13:47 ` [net-next 07/17] fm10k: use an unsigned int for i in ethtool_get_strings Jeff Kirsher
2015-06-16 14:19   ` Sergei Shtylyov
2015-06-16 20:33     ` Keller, Jacob E
2015-06-16 20:37       ` Keller, Jacob E
2015-06-16 13:47 ` [net-next 08/17] fm10k: remove extraneous NULL check on l2_accel Jeff Kirsher
2015-06-16 13:47 ` [net-next 09/17] fm10k: trivial fixup message style to include a colon Jeff Kirsher
2015-06-16 14:16   ` Sergei Shtylyov
2015-06-16 20:33     ` Keller, Jacob E
2015-06-16 13:47 ` [net-next 10/17] fm10k: use dma_set_mask_and_coherent in fm10k_probe Jeff Kirsher
2015-06-16 14:17   ` Sergei Shtylyov
2015-06-16 13:47 ` Jeff Kirsher [this message]
2015-06-16 13:47 ` [net-next 12/17] fm10k: re-map all possible VF queues after a VFLR Jeff Kirsher
2015-06-16 13:47 ` [net-next 13/17] fm10k: pack TLV overlay structures Jeff Kirsher
2015-06-16 13:47 ` [net-next 14/17] fm10k: fix incorrect DIR_NEVATIVE bit in 1588 code Jeff Kirsher
2015-06-16 13:47 ` [net-next 15/17] fm10k: remove err_no reference in fm10k_mbx.c Jeff Kirsher
2015-06-16 13:47 ` [net-next 16/17] fm10k: fix iov_msg_lport_state_pf issue Jeff Kirsher
2015-06-16 13:47 ` [net-next 17/17] fm10k: Fix missing braces after if statement Jeff Kirsher

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=1434462448-140563-12-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=jacob.e.keller@intel.com \
    --cc=jogreene@redhat.com \
    --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.