All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arkady Gilinsky <arkady.gilinsky@harmonicinc.com>
To: "intel-wired-lan@lists.osuosl.org"
	<intel-wired-lan@lists.osuosl.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"jeffrey.t.kirsher@intel.com" <jeffrey.t.kirsher@intel.com>
Subject: [v2 PATCH net] i40e/iavf: Fix msg interface between VF and PF
Date: Fri, 8 Nov 2019 11:57:36 +0000	[thread overview]
Message-ID: <1573214249.10368.25.camel@harmonicinc.com> (raw)

From af0e91423ea6ea37b48ee8b555314fd01964335d Mon Sep 17 00:00:00 2001
From: Arkady Gilinsky <arkady.gilinsky@harmonicinc.com>
Date: Fri, 8 Nov 2019 13:48:03 +0200
Subject: [[v2] PATCH net] i40e/iavf: Fix msg interface between VF and PF

 * The original issue was that iavf driver passing TX/RX queues
   as bitmap in iavf_disable_queues and the i40e driver
   interprets this message as an absolute number in
   i40e_vc_disable_queues_msg, so the validation in the
   latter function always fail.
   The commit fixes the issue and adds validation of the
   queue bitmap to the i40e_vc_enable_queues_msg function.

Signed-off-by: Arkady Gilinsky <arkady.gilinsky@harmonicinc.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 3d2440838822..573252e9fb78 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -2347,7 +2347,9 @@ static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg)
 		goto error_param;
 	}
 
-	if ((0 == vqs->rx_queues) && (0 == vqs->tx_queues)) {
+	if ((vqs->rx_queues == 0 && vqs->tx_queues == 0) ||
+	    vqs->rx_queues >= BIT(I40E_MAX_VF_QUEUES) ||
+	    vqs->tx_queues >= BIT(I40E_MAX_VF_QUEUES)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto error_param;
 	}
@@ -2410,8 +2412,8 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg)
 	}
 
 	if ((vqs->rx_queues == 0 && vqs->tx_queues == 0) ||
-	    vqs->rx_queues > I40E_MAX_VF_QUEUES ||
-	    vqs->tx_queues > I40E_MAX_VF_QUEUES) {
+	    vqs->rx_queues >= BIT(I40E_MAX_VF_QUEUES) ||
+	    vqs->tx_queues >= BIT(I40E_MAX_VF_QUEUES)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto error_param;
 	}
-- 
2.11.0


WARNING: multiple messages have this Message-ID (diff)
From: Arkady Gilinsky <arkady.gilinsky@harmonicinc.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [v2 PATCH net] i40e/iavf: Fix msg interface between VF and PF
Date: Fri, 8 Nov 2019 11:57:36 +0000	[thread overview]
Message-ID: <1573214249.10368.25.camel@harmonicinc.com> (raw)

From af0e91423ea6ea37b48ee8b555314fd01964335d Mon Sep 17 00:00:00 2001
From: Arkady Gilinsky <arkady.gilinsky@harmonicinc.com>
Date: Fri, 8 Nov 2019 13:48:03 +0200
Subject: [[v2] PATCH net] i40e/iavf: Fix msg interface between VF and PF

?* The original issue was that iavf driver passing TX/RX queues
???as bitmap in iavf_disable_queues and the i40e driver
???interprets this message as an absolute number in
???i40e_vc_disable_queues_msg, so the validation in the
???latter function always fail.
???The commit fixes the issue and adds validation of the
???queue bitmap to the i40e_vc_enable_queues_msg function.

Signed-off-by: Arkady Gilinsky <arkady.gilinsky@harmonicinc.com>
---
?drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 8 +++++---
?1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 3d2440838822..573252e9fb78 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -2347,7 +2347,9 @@ static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg)
?		goto error_param;
?	}
?
-	if ((0 == vqs->rx_queues) && (0 == vqs->tx_queues)) {
+	if ((vqs->rx_queues == 0 && vqs->tx_queues == 0) ||
+	????vqs->rx_queues >= BIT(I40E_MAX_VF_QUEUES) ||
+	????vqs->tx_queues >= BIT(I40E_MAX_VF_QUEUES)) {
?		aq_ret = I40E_ERR_PARAM;
?		goto error_param;
?	}
@@ -2410,8 +2412,8 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg)
?	}
?
?	if ((vqs->rx_queues == 0 && vqs->tx_queues == 0) ||
-	????vqs->rx_queues > I40E_MAX_VF_QUEUES ||
-	????vqs->tx_queues > I40E_MAX_VF_QUEUES) {
+	????vqs->rx_queues >= BIT(I40E_MAX_VF_QUEUES) ||
+	????vqs->tx_queues >= BIT(I40E_MAX_VF_QUEUES)) {
?		aq_ret = I40E_ERR_PARAM;
?		goto error_param;
?	}
--?
2.11.0


             reply	other threads:[~2019-11-08 11:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08 11:57 Arkady Gilinsky [this message]
2019-11-08 11:57 ` [Intel-wired-lan] [v2 PATCH net] i40e/iavf: Fix msg interface between VF and PF Arkady Gilinsky

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=1573214249.10368.25.camel@harmonicinc.com \
    --to=arkady.gilinsky@harmonicinc.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=netdev@vger.kernel.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 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.