From: Alice Michael <alice.michael@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next PATCH S95 08/12] i40evf: Validate the number of queues a PF sends
Date: Mon, 20 Aug 2018 08:12:29 -0700 [thread overview]
Message-ID: <20180820151233.14629-8-alice.michael@intel.com> (raw)
In-Reply-To: <20180820151233.14629-1-alice.michael@intel.com>
From: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
A PF can send any number of queues to the VF and the VF may not
be able to support that many. Check to see that the number of
queues is less than or equal to the max number of queues the
VF can have.
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
---
.../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 32 ++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
index 79b7be8..6579dab 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
@@ -154,6 +154,32 @@ int i40evf_send_vf_config_msg(struct i40evf_adapter *adapter)
}
/**
+ * i40evf_validate_num_queues
+ * @adapter: adapter structure
+ *
+ * Validate that the number of queues the PF has sent in
+ * VIRTCHNL_OP_GET_VF_RESOURCES is not larger than the VF can handle.
+ **/
+static void i40evf_validate_num_queues(struct i40evf_adapter *adapter)
+{
+ if (adapter->vf_res->num_queue_pairs > I40EVF_MAX_REQ_QUEUES) {
+ struct virtchnl_vsi_resource *vsi_res;
+ int i;
+
+ dev_info(&adapter->pdev->dev, "Received %d queues, but can only have a max of %d\n",
+ adapter->vf_res->num_queue_pairs,
+ I40EVF_MAX_REQ_QUEUES);
+ dev_info(&adapter->pdev->dev, "Fixing by reducing queues to %d\n",
+ I40EVF_MAX_REQ_QUEUES);
+ adapter->vf_res->num_queue_pairs = I40EVF_MAX_REQ_QUEUES;
+ for (i = 0; i < adapter->vf_res->num_vsis; i++) {
+ vsi_res = &adapter->vf_res->vsi_res[i];
+ vsi_res->num_queue_pairs = I40EVF_MAX_REQ_QUEUES;
+ }
+ }
+}
+
+/**
* i40evf_get_vf_config
* @adapter: private adapter structure
*
@@ -195,6 +221,11 @@ int i40evf_get_vf_config(struct i40evf_adapter *adapter)
err = (i40e_status)le32_to_cpu(event.desc.cookie_low);
memcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len));
+ /* some PFs send more queues than we should have so validate that
+ * we aren't getting too many queues
+ */
+ if (!err)
+ i40evf_validate_num_queues(adapter);
i40e_vf_parse_hw_config(hw, adapter->vf_res);
out_alloc:
kfree(event.msg_buf);
@@ -1329,6 +1360,7 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
I40E_MAX_VF_VSI *
sizeof(struct virtchnl_vsi_resource);
memcpy(adapter->vf_res, msg, min(msglen, len));
+ i40evf_validate_num_queues(adapter);
i40e_vf_parse_hw_config(&adapter->hw, adapter->vf_res);
if (is_zero_ether_addr(adapter->hw.mac.addr)) {
/* restore current mac address */
--
2.9.5
next prev parent reply other threads:[~2018-08-20 15:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-20 15:12 [Intel-wired-lan] [next PATCH S95 01/12] i40e: Fix VF's link state notification Alice Michael
2018-08-20 15:12 ` [Intel-wired-lan] [next PATCH S95 02/12] i40e: convert queue stats to i40e_stats array Alice Michael
2018-08-21 19:16 ` Bowers, AndrewX
2018-08-20 15:12 ` [Intel-wired-lan] [next PATCH S95 03/12] i40e: move ethtool stats boiler plate code to i40e_ethtool_stats.h Alice Michael
2018-08-21 19:17 ` Bowers, AndrewX
2018-08-20 15:12 ` [Intel-wired-lan] [next PATCH S95 04/12] i40evf: update ethtool stats code and use helper functions Alice Michael
2018-08-21 19:19 ` Bowers, AndrewX
2018-08-20 15:12 ` [Intel-wired-lan] [next PATCH S95 05/12] i40evf: Change a VF mac without reloading the VF driver Alice Michael
2018-08-21 19:29 ` Bowers, AndrewX
2018-08-29 16:34 ` Bowers, AndrewX
2018-08-20 15:12 ` [Intel-wired-lan] [next PATCH S95 06/12] i40e: fix condition of WARN_ONCE for stat strings Alice Michael
2018-08-21 19:36 ` Bowers, AndrewX
2018-08-24 1:50 ` Mauro Rodrigues
2018-08-20 15:12 ` [Intel-wired-lan] [next PATCH S95 07/12] i40e: Unset promiscuous settings on VF reset Alice Michael
2018-08-21 16:28 ` Shannon Nelson
2018-08-29 20:53 ` Bowers, AndrewX
2018-08-20 15:12 ` Alice Michael [this message]
2018-08-29 20:54 ` [Intel-wired-lan] [next PATCH S95 08/12] i40evf: Validate the number of queues a PF sends Bowers, AndrewX
2018-08-20 15:12 ` [Intel-wired-lan] [next PATCH S95 09/12] i40e: use correct length for strncpy Alice Michael
2018-08-21 16:28 ` Shannon Nelson
2018-08-23 16:11 ` Bowers, AndrewX
2018-08-20 15:12 ` [Intel-wired-lan] [next PATCH S95 10/12] i40evf: set IFF_UNICAST_FLT flag for the vf Alice Michael
2018-08-21 19:41 ` Bowers, AndrewX
2018-08-20 15:12 ` [Intel-wired-lan] [next PATCH S95 11/12] virtchnl: use u8 type for a field in the virtchnl_filter struct Alice Michael
2018-08-21 19:41 ` Bowers, AndrewX
2018-08-20 15:12 ` [Intel-wired-lan] [next PATCH S95 12/12] i40e: static analysis report from community Alice Michael
2018-08-21 19:42 ` Bowers, AndrewX
2018-08-21 16:27 ` [Intel-wired-lan] [next PATCH S95 01/12] i40e: Fix VF's link state notification Shannon Nelson
2018-08-29 20:53 ` 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=20180820151233.14629-8-alice.michael@intel.com \
--to=alice.michael@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox