From: Jingjing Wu <jingjing.wu@intel.com>
To: dev@dpdk.org
Cc: yulong.pei@intel.com
Subject: [dpdk-dev] [PATCH] i40e: workaround for Security issue in SR-IOV mode
Date: Fri, 25 Sep 2015 16:44:38 +0800 [thread overview]
Message-ID: <1443170678-7249-1-git-send-email-jingjing.wu@intel.com> (raw)
In SR-IOV mode a VF sending LFC or PFC would throttle the entire port.
The workaround is to add a filter to drop pause frames from VFs from
sending pause frames.
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2dd9fdc..6cc2172 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -382,6 +382,30 @@ static inline void i40e_flex_payload_reg_init(struct i40e_hw *hw)
I40E_WRITE_REG(hw, I40E_GLQF_PIT(17), 0x00007440);
}
+#define I40E_FLOW_CONTROL_ETHERTYPE 0x8808
+
+/*
+ * Add a ethertype filter to drop all flow control frames transimited
+ * from VSIs.
+*/
+static void
+i40e_add_tx_flow_control_drop_filter(struct i40e_pf *pf)
+{
+ struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+ uint16_t flags = I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC |
+ I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP |
+ I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TX;
+ int ret;
+
+ ret = i40e_aq_add_rem_control_packet_filter(hw, NULL,
+ I40E_FLOW_CONTROL_ETHERTYPE, flags,
+ pf->main_vsi_seid, 0,
+ TRUE, NULL, NULL);
+ if (ret)
+ PMD_INIT_LOG(ERR, "Failed to add filter to drop flow control "
+ " frames from VSIs.");
+}
+
static int
eth_i40e_dev_init(struct rte_eth_dev *dev)
{
@@ -584,6 +608,12 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
/* enable uio intr after callback register */
rte_intr_enable(&(pci_dev->intr_handle));
+ /*
+ * Add a ethertype filter to drop all flow control frames transimited
+ * from VSIs. This is used to workaround the issue -- in SR-IOV mode
+ * where a VF sending LFC or PFC would throttle the entire port.
+ */
+ i40e_add_tx_flow_control_drop_filter(pf);
/* initialize mirror rule list */
TAILQ_INIT(&pf->mirror_list);
--
2.4.0
next reply other threads:[~2015-09-25 8:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 8:44 Jingjing Wu [this message]
2015-09-25 12:28 ` Vladislav Zolotarov
2015-10-08 2:17 ` Wu, Jingjing
2015-10-08 14:53 ` Vlad Zolotarov
2015-10-13 7:18 ` [dpdk-dev] [PATCH v2] i40e: Add a workaround to drop flow control frames from VFs Jingjing Wu
2015-10-19 6:31 ` [dpdk-dev] [PATCH v3] " Jingjing Wu
2015-10-19 8:31 ` Lu, Wenzhuo
2015-10-30 5:31 ` Zhang, Helin
2015-10-30 11:24 ` Thomas Monjalon
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=1443170678-7249-1-git-send-email-jingjing.wu@intel.com \
--to=jingjing.wu@intel.com \
--cc=dev@dpdk.org \
--cc=yulong.pei@intel.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).