netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Anjali Singhai Jain <anjali.singhai@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 01/19] i40e: Set defport behavior for the Main VSI when in promiscuous mode
Date: Tue,  1 Sep 2015 18:13:45 -0700	[thread overview]
Message-ID: <1441156443-33381-2-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1441156443-33381-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Anjali Singhai Jain <anjali.singhai@intel.com>

This fixes bugs where the port is not receiving multicast or VLAN tagged
packets when in promiscuous mode. This can occur when a SW bridge is
created on top of the device.

This also fixes issues where the promiscuous behavior setting was not
being preserved across a reset caused by features being enabled or
disabled.

We are using defport instead of doing a true promiscuous mode because we do
not need to receive the SRIOV or VMDq VSI directed traffic which would suck
up bandwidth and is really not intended for the SW bridge.

In addition, with defport we get VLAN promiscuous behavior which is not
possible from the VSI level promiscuous setting.

Change-ID: Ie21985eac32d5af1c02e9d71c6430a90d5bab40f
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e.h      |  1 +
 drivers/net/ethernet/intel/i40e/i40e_main.c | 37 ++++++++++++++++++++++-------
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 05df21c..e746279 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -372,6 +372,7 @@ struct i40e_pf {
 #ifdef CONFIG_DEBUG_FS
 	struct dentry *i40e_dbg_pf;
 #endif /* CONFIG_DEBUG_FS */
+	bool cur_promisc;
 
 	u16 instance; /* A unique number per i40e_pf instance in the system */
 
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index a97f193..851c1a1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -1937,15 +1937,35 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
 		cur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) ||
 			       test_bit(__I40E_FILTER_OVERFLOW_PROMISC,
 					&vsi->state));
-		ret = i40e_aq_set_vsi_unicast_promiscuous(&vsi->back->hw,
+		if (vsi->type == I40E_VSI_MAIN && pf->lan_veb != I40E_NO_VEB) {
+			/* set defport ON for Main VSI instead of true promisc
+			 * this way we will get all unicast/multicast and VLAN
+			 * promisc behavior but will not get VF or VMDq traffic
+			 * replicated on the Main VSI.
+			 */
+			if (pf->cur_promisc != cur_promisc) {
+				pf->cur_promisc = cur_promisc;
+				i40e_do_reset_safe(pf,
+						BIT(__I40E_PF_RESET_REQUESTED));
+			}
+		} else {
+			ret = i40e_aq_set_vsi_unicast_promiscuous(
+							  &vsi->back->hw,
 							  vsi->seid,
 							  cur_promisc, NULL);
-		if (ret)
-			dev_info(&pf->pdev->dev,
-				 "set uni promisc failed, err %s, aq_err %s\n",
-				 i40e_stat_str(&pf->hw, ret),
-				 i40e_aq_str(&pf->hw,
-					     pf->hw.aq.asq_last_status));
+			if (ret)
+				dev_info(&pf->pdev->dev,
+					 "set unicast promisc failed, err %d, aq_err %d\n",
+					 ret, pf->hw.aq.asq_last_status);
+			ret = i40e_aq_set_vsi_multicast_promiscuous(
+							  &vsi->back->hw,
+							  vsi->seid,
+							  cur_promisc, NULL);
+			if (ret)
+				dev_info(&pf->pdev->dev,
+					 "set multicast promisc failed, err %d, aq_err %d\n",
+					 ret, pf->hw.aq.asq_last_status);
+		}
 		ret = i40e_aq_set_vsi_broadcast(&vsi->back->hw,
 						vsi->seid,
 						cur_promisc, NULL);
@@ -4001,6 +4021,7 @@ static void i40e_vsi_close(struct i40e_vsi *vsi)
 	i40e_vsi_free_irq(vsi);
 	i40e_vsi_free_tx_resources(vsi);
 	i40e_vsi_free_rx_resources(vsi);
+	vsi->current_netdev_flags = 0;
 }
 
 /**
@@ -9312,7 +9333,7 @@ void i40e_veb_release(struct i40e_veb *veb)
 static int i40e_add_veb(struct i40e_veb *veb, struct i40e_vsi *vsi)
 {
 	struct i40e_pf *pf = veb->pf;
-	bool is_default = false;
+	bool is_default = veb->pf->cur_promisc;
 	bool is_cloud = false;
 	int ret;
 
-- 
2.4.3

  reply	other threads:[~2015-09-02  1:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02  1:13 [net-next 00/19][pull request] Intel Wired LAN Driver Updates 2015-09-01 Jeff Kirsher
2015-09-02  1:13 ` Jeff Kirsher [this message]
2015-09-02  1:13 ` [net-next 02/19] ixgbe: add new function to check for management presence Jeff Kirsher
2015-09-02  1:13 ` [net-next 03/19] ixgbe: Assign set_phy_power dynamically where needed Jeff Kirsher
2015-09-02  1:13 ` [net-next 04/19] ixgbe: Check whether FDIRCMD writes actually complete Jeff Kirsher
2015-09-02  1:13 ` [net-next 05/19] ixgbe: Add support for UDP-encapsulated tx checksum offload Jeff Kirsher
2015-09-02  3:17   ` Tom Herbert
2015-09-02 16:46     ` Rustad, Mark D
2015-09-02 17:38       ` Tom Herbert
2015-09-02 20:56         ` Or Gerlitz
2015-09-02 21:07         ` Or Gerlitz
2015-09-02 22:34           ` Tom Herbert
2015-09-02 23:21       ` Tom Herbert
2015-09-03  0:21         ` Rustad, Mark D
2015-09-02  1:13 ` [net-next 06/19] ixgbe: Add support for VXLAN RX offloads Jeff Kirsher
2015-09-02  3:31   ` Tom Herbert
2015-09-02 16:53     ` Rustad, Mark D
2015-09-02  1:13 ` [net-next 07/19] ixgbe: Add support for entering low power link up state Jeff Kirsher
2015-09-02  1:13 ` [net-next 08/19] ixgbe: add get_bus_info method for X550 Jeff Kirsher
2015-09-02  1:13 ` [net-next 09/19] ixgbe: add new bus type for intergrated I/O interface (IOSF) Jeff Kirsher
2015-09-02  1:13 ` [net-next 10/19] ixgbe: Remove unused PCI bus types Jeff Kirsher
2015-09-02  1:13 ` [net-next 11/19] ixgbe: use kzalloc for allocating one thing Jeff Kirsher
2015-09-02  1:13 ` [net-next 12/19] ixgbe: Remove second instance of lan_id variable Jeff Kirsher
2015-09-02  1:13 ` [net-next 13/19] ixgbe: cleanup to use cached mask value Jeff Kirsher
2015-09-02  1:13 ` [net-next 14/19] ixgbe: Avoid needless PHY access on copper phys Jeff Kirsher
2015-09-02  1:13 ` [net-next 15/19] ixgbe: support for ethtool set_rxfh Jeff Kirsher
2015-09-02  1:14 ` [net-next 16/19] ixgbe: fix bounds checking in ixgbe_setup_tc for 82598 Jeff Kirsher
2015-09-02  1:14 ` [net-next 17/19] ixgbe: Add support for reporting 2.5G link speed Jeff Kirsher
2015-09-02  1:14 ` [net-next 18/19] ixgbe: Remove bimodal SR-IOV disabling Jeff Kirsher
2015-09-02  1:14 ` [net-next 19/19] ixgbe: Resolve "initialized field overwritten" warnings Jeff Kirsher
2015-09-02  3:19 ` [net-next 00/19][pull request] Intel Wired LAN Driver Updates 2015-09-01 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=1441156443-33381-2-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=anjali.singhai@intel.com \
    --cc=davem@davemloft.net \
    --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 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).