Skip to contentSkip to conversation

i40e: Fix virtchnl_queue_select bitmap validation

PATCH New Jeff Kirsher 2 participants 7 messages Nov 13, 2019 – Nov 19, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40e: Fix virtchnl_queue_select bitmap validation

From: Brett Creeley <[email protected]>

Currently in i40e_vc_disable_queues_msg() we are incorrectly validating the virtchnl queue select bitmaps. The virtchnl_queue_select rx_queues and tx_queue bitmap is being compared against ICE_MAX_VF_QUEUES, but the problem is that these bitmaps can have a value greater than I40E_MAX_VF_QUEUES. Fix this by comparing the bitmaps against BIT(I40E_MAX_VF_QUEUES).

Also, add the function i40e_vc_validate_vqs_bitmaps() that checks to see if both virtchnl_queue_select bitmaps are empty along with checking that the bitmaps only have valid bits set. This function can then be used in both the queue enable and disable flows.

---
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 22 +++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +18 -4
index 6d75a35acb67..275702d8cf7a 100644
@@ -2321,6 +2321,22 @@ static int i40e_ctrl_vf_rx_rings(struct i40e_vsi *vsi, unsigned long q_map,
 	return ret;
 }
 
+/**
+ * i40e_vc_validate_vqs_bitmaps - validate Rx/Tx queue bitmaps from VIRTHCHNL
+ * @vqs: virtchnl_queue_select structure containing bitmaps to validate
+ *
+ * Returns true if validation was successful, else false.
+ */
+static bool i40e_vc_validate_vqs_bitmaps(struct virtchnl_queue_select *vqs)
+{
+	if ((!vqs->rx_queues && !vqs->tx_queues) ||
+	    vqs->rx_queue >= BIT(I40E_MAX_VF_QUEUES) ||
+	    vqs->tx_queue >= BIT(I40E_MAX_VF_QUEUES))
+	       return false;
+
+	return true;
+}
+
 /**
  * i40e_vc_enable_queues_msg
  * @vf: pointer to the VF info
@@ -2346,7 +2362,7 @@ 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 (i40e_vc_validate_vqs_bitmaps(vqs)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto error_param;
 	}
@@ -2408,9 +2424,7 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg)
 		goto error_param;
 	}
 
-	if ((vqs->rx_queues == 0 && vqs->tx_queues == 0) ||
-	    vqs->rx_queues > I40E_MAX_VF_QUEUES ||
-	    vqs->tx_queues > I40E_MAX_VF_QUEUES) {
+	if (i40e_vc_validate_vqs_bitmaps(vqs)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto error_param;
 	}
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 i40e: Fix virtchnl_queue_select bitmap validation

Comments inline

Quoted 42 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jeff Kirsher
Sent: Wednesday, November 13, 2019 11:28 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select bitmap validation

From: Brett Creeley <[email protected]>

Currently in i40e_vc_disable_queues_msg() we are incorrectly validating the virtchnl queue select bitmaps. The virtchnl_queue_select rx_queues and tx_queue bitmap is being compared against ICE_MAX_VF_QUEUES, but the problem is that these bitmaps can have a value greater than I40E_MAX_VF_QUEUES.
Fix this by comparing the bitmaps against BIT(I40E_MAX_VF_QUEUES).

Also, add the function i40e_vc_validate_vqs_bitmaps() that checks to see if both virtchnl_queue_select bitmaps are empty along with checking that the bitmaps only have valid bits set. This function can then be used in both the queue enable and disable flows.

---
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 22 +++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -0
index 6d75a35acb67..275702d8cf7a 100644
@@ -2321,6 +2321,22 @@ static int i40e_ctrl_vf_rx_rings(struct i40e_vsi *vsi,
 unsigned long q_map,
 	return ret;
 }
 
+/**
+ * i40e_vc_validate_vqs_bitmaps - validate Rx/Tx queue bitmaps from

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c static int i40e_ctrl_vf_rx_rings(struct i40e_vsi *vsi, · line 2336

Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +10 -0
+VIRTHCHNL
+ * @vqs: virtchnl_queue_select structure containing bitmaps to validate
+ *
+ * Returns true if validation was successful, else false.
+ */
+static bool i40e_vc_validate_vqs_bitmaps(struct virtchnl_queue_select
+*vqs) {
+	if ((!vqs->rx_queues && !vqs->tx_queues) ||
+	    vqs->rx_queue >= BIT(I40E_MAX_VF_QUEUES) ||
+	    vqs->tx_queue >= BIT(I40E_MAX_VF_QUEUES))

Should these not be "rx_queues" and "tx_queues"?

Quoted 37 lines
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +6 -1
+	       return false;
+
+	return true;
+}
+
 /**
  * i40e_vc_enable_queues_msg
  * @vf: pointer to the VF info
@@ -2346,7 +2362,7 @@ 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 (i40e_vc_validate_vqs_bitmaps(vqs)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto error_param;
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -3
 	}
@@ -2408,9 +2424,7 @@ static int i40e_vc_disable_queues_msg(struct
 i40e_vf *vf, u8 *msg)
 		goto error_param;
 	}
 
-	if ((vqs->rx_queues == 0 && vqs->tx_queues == 0) ||
-	    vqs->rx_queues > I40E_MAX_VF_QUEUES ||
-	    vqs->tx_queues > I40E_MAX_VF_QUEUES) {
+	if (i40e_vc_validate_vqs_bitmaps(vqs)) {
 		aq_ret = I40E_ERR_PARAM;
 		goto error_param;

}
--
2.23.0

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#2 lore raw

PATCH 1/1 i40e: Fix virtchnl_queue_select bitmap validation

This patch is causing a compile error for me. If I pop revert it my compile error goes away:
---------------------------------------------------------------
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function 'i40e_vc_validate_vqs_bitmaps':
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2333:9: error: 'struct virtchnl_queue_select' has no member named 'rx_queue'

      vqs->rx_queue >= BIT(I40E_MAX_VF_QUEUES) ||
         ^
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2334:9: error: 'struct virtchnl_queue_select' has no member named 'tx_queue'
      vqs->tx_queue >= BIT(I40E_MAX_VF_QUEUES))
         ^

make[6]: *** [drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.o] Error 1 make[6]: *** Waiting for unfinished jobs....
make[5]: *** [drivers/net/ethernet/intel/i40e] Error 2 make[4]: *** [drivers/net/ethernet/intel] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [drivers/net/ethernet] Error 2
make[2]: *** [drivers/net] Error 2
make[1]: *** [drivers] Error 2
make: *** [sub-make] Error 2

Quoted 46 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Bowers, AndrewX
Sent: Thursday, November 14, 2019 5:17 PM
To: Kirsher, Jeffrey T <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select bitmap validation

Comments inline

Quoted 10 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jeff Kirsher
Sent: Wednesday, November 13, 2019 11:28 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select bitmap validation

Quoted 3 lines

From: Brett Creeley <[email protected]>

Currently in i40e_vc_disable_queues_msg() we are incorrectly validating

the

Quoted 2 lines

virtchnl queue select bitmaps. The virtchnl_queue_select rx_queues and tx_queue bitmap is being compared against ICE_MAX_VF_QUEUES, but

the

Quoted 6 lines

problem is that these bitmaps can have a value greater than I40E_MAX_VF_QUEUES.
Fix this by comparing the bitmaps against BIT(I40E_MAX_VF_QUEUES).

Also, add the function i40e_vc_validate_vqs_bitmaps() that checks to see if both virtchnl_queue_select bitmaps are empty along with checking that

the

Quoted 9 lines

bitmaps only have valid bits set. This function can then be used in both the queue enable and disable flows.

---
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 22 +++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

<snip>

#3 lore raw

PATCH 1/1 i40e: Fix virtchnl_queue_select bitmap validation

I was getting the same thing. Taking the compiler's suggestion and changing _queue to _queues and it compiles but nobody responded to my comments.

Quoted 83 lines

-----Original Message-----
From: Brown, Aaron F
Sent: Friday, November 15, 2019 3:53 PM
To: Bowers, AndrewX <[email protected]>; Kirsher, Jeffrey T <[email protected]>; intel-wired-lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: RE: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select bitmap validation

This patch is causing a compile error for me. If I pop revert it my compile error goes away:
---------------------------------------------------------------
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function 'i40e_vc_validate_vqs_bitmaps':
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2333:9: error: 'struct virtchnl_queue_select' has no member named 'rx_queue'

      vqs->rx_queue >= BIT(I40E_MAX_VF_QUEUES) ||
         ^
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2334:9: error: 'struct
virtchnl_queue_select' has no member named 'tx_queue'
      vqs->tx_queue >= BIT(I40E_MAX_VF_QUEUES))
         ^

make[6]: *** [drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.o] Error 1 make[6]: *** Waiting for unfinished jobs....
make[5]: *** [drivers/net/ethernet/intel/i40e] Error 2 make[4]: *** [drivers/net/ethernet/intel] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [drivers/net/ethernet] Error 2
make[2]: *** [drivers/net] Error 2
make[1]: *** [drivers] Error 2
make: *** [sub-make] Error 2

Quoted 23 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Bowers, AndrewX
Sent: Thursday, November 14, 2019 5:17 PM
To: Kirsher, Jeffrey T <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select bitmap validation

Comments inline

Quoted 10 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jeff Kirsher
Sent: Wednesday, November 13, 2019 11:28 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select bitmap validation

Quoted 7 lines
Quoted 4 lines

From: Brett Creeley <[email protected]>

Currently in i40e_vc_disable_queues_msg() we are incorrectly validating

the

Quoted 2 lines

virtchnl queue select bitmaps. The virtchnl_queue_select rx_queues and tx_queue bitmap is being compared against ICE_MAX_VF_QUEUES,

but

Quoted 18 lines

the

Quoted 7 lines

problem is that these bitmaps can have a value greater than I40E_MAX_VF_QUEUES.
Fix this by comparing the bitmaps against BIT(I40E_MAX_VF_QUEUES).

Also, add the function i40e_vc_validate_vqs_bitmaps() that checks to see if both virtchnl_queue_select bitmaps are empty along with checking that

the

Quoted 9 lines

bitmaps only have valid bits set. This function can then be used in both the queue enable and disable flows.

---
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 22 +++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

<snip>

#4 lore raw

PATCH 1/1 i40e: Fix virtchnl_queue_select bitmap validation

Brett is out on vacation but you?re right Andrew, the code should use plural variables.

--
Jesse Brandeburg

Quoted 91 lines · AndrewX

I was getting the same thing. Taking the compiler's suggestion and changing _queue to _queues and it compiles but nobody responded to my comments.

Quoted 76 lines

-----Original Message-----
From: Brown, Aaron F
Sent: Friday, November 15, 2019 3:53 PM
To: Bowers, AndrewX <[email protected]>; Kirsher, Jeffrey T <[email protected]>; intel-wired-lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: RE: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select bitmap validation

This patch is causing a compile error for me. If I pop revert it my compile error goes away:
---------------------------------------------------------------
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function 'i40e_vc_validate_vqs_bitmaps':
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2333:9: error: 'struct virtchnl_queue_select' has no member named 'rx_queue'

     vqs->rx_queue >= BIT(I40E_MAX_VF_QUEUES) ||
        ^
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2334:9: error: 'struct
virtchnl_queue_select' has no member named 'tx_queue'
     vqs->tx_queue >= BIT(I40E_MAX_VF_QUEUES))
        ^

make[6]: *** [drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.o] Error 1 make[6]: *** Waiting for unfinished jobs....
make[5]: *** [drivers/net/ethernet/intel/i40e] Error 2 make[4]: *** [drivers/net/ethernet/intel] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [drivers/net/ethernet] Error 2
make[2]: *** [drivers/net] Error 2
make[1]: *** [drivers] Error 2
make: *** [sub-make] Error 2

Quoted 23 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Bowers, AndrewX
Sent: Thursday, November 14, 2019 5:17 PM
To: Kirsher, Jeffrey T <[email protected]>; intel-wired- lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select bitmap validation

Comments inline

Quoted 10 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jeff Kirsher
Sent: Wednesday, November 13, 2019 11:28 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select bitmap validation

Quoted 7 lines
Quoted 4 lines

From: Brett Creeley <[email protected]>

Currently in i40e_vc_disable_queues_msg() we are incorrectly validating

the

Quoted 2 lines

virtchnl queue select bitmaps. The virtchnl_queue_select rx_queues and tx_queue bitmap is being compared against ICE_MAX_VF_QUEUES,

but

Quoted 12 lines

the

Quoted 7 lines

problem is that these bitmaps can have a value greater than I40E_MAX_VF_QUEUES.
Fix this by comparing the bitmaps against BIT(I40E_MAX_VF_QUEUES).

Also, add the function i40e_vc_validate_vqs_bitmaps() that checks to see if both virtchnl_queue_select bitmaps are empty along with checking that

the

Quoted 3 lines

bitmaps only have valid bits set. This function can then be used in both the queue enable and disable flows.

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines

---
.../ethernet/intel/i40e/i40e_virtchnl_pf.c | 22 +++++++++++++++----

1 file changed, 18 insertions(+), 4 deletions(-)

<snip>

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#5 lore raw

PATCH 1/1 i40e: Fix virtchnl_queue_select bitmap validation

Quoted 2 lines · Jesse

Brett is out on vacation but you?re right Andrew, the code should use plural variables.

Yep, it was my fault. I fat fingered the typo when creating the patch. I have fixed the patch on my tree, just have not sent an updated patch to IWL yet, to properly reflect the change.

Quoted 110 lines
Quoted 110 lines

On Nov 15, 2019, at 16:08, Bowers, AndrewX <
andrewx.bowers at intel.com> wrote:

I was getting the same thing. Taking the compiler's suggestion and changing _queue to _queues and it compiles but nobody responded to my comments.

Quoted 102 lines

-----Original Message-----
From: Brown, Aaron F
Sent: Friday, November 15, 2019 3:53 PM
To: Bowers, AndrewX <[email protected]>; Kirsher, Jeffrey T
<[email protected]>; intel-wired-lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: RE: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select bitmap
validation

This patch is causing a compile error for me. If I pop revert it my compile
error goes away:
---------------------------------------------------------------
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function 'i40e_vc_validate_vqs_bitmaps':
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2333:9: error:
'struct
virtchnl_queue_select' has no member named 'rx_queue'

     vqs->rx_queue >= BIT(I40E_MAX_VF_QUEUES) ||
        ^
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:2334:9: error:
'struct
virtchnl_queue_select' has no member named 'tx_queue'
     vqs->tx_queue >= BIT(I40E_MAX_VF_QUEUES))
        ^

make[6]: *** [drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.o] Error 1
make[6]: *** Waiting for unfinished jobs....
make[5]: *** [drivers/net/ethernet/intel/i40e] Error 2 make[4]: *** [drivers/net/ethernet/intel] Error 2 make[4]: *** Waiting for unfinished jobs....
make[3]: *** [drivers/net/ethernet] Error 2
make[2]: *** [drivers/net] Error 2
make[1]: *** [drivers] Error 2
make: *** [sub-make] Error 2

Quoted 29 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf
Of Bowers, AndrewX
Sent: Thursday, November 14, 2019 5:17 PM
To: Kirsher, Jeffrey T <[email protected]>; intel- wired-
lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select
bitmap validation

Comments inline

Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:
intel-wired-lan-bounces at osuosl.org] On Behalf Of Jeff Kirsher
Sent: Wednesday, November 13, 2019 11:28 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky
<[email protected]>
Subject: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select
bitmap validation

Quoted 9 lines
Quoted 4 lines

From: Brett Creeley <[email protected]>

Currently in i40e_vc_disable_queues_msg() we are incorrectly validating

the

Quoted 4 lines

virtchnl queue select bitmaps. The virtchnl_queue_select rx_queues
and tx_queue bitmap is being compared against ICE_MAX_VF_QUEUES,

but

Quoted 24 lines

the

Quoted 10 lines

problem is that these bitmaps can have a value greater than I40E_MAX_VF_QUEUES.
Fix this by comparing the bitmaps against BIT(I40E_MAX_VF_QUEUES).

Also, add the function i40e_vc_validate_vqs_bitmaps() that checks to
see if both virtchnl_queue_select bitmaps are empty along with
checking that

the

Quoted 12 lines

bitmaps only have valid bits set. This function can then be used in
both the queue enable and disable flows.

Suggested-by: Arkady Gilinksky < arkady.gilinsky at harmonicinc.com>

---
.../ethernet/intel/i40e/i40e_virtchnl_pf.c | 22
+++++++++++++++----

1 file changed, 18 insertions(+), 4 deletions(-)
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

<snip>

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20191118/fcb4ade1/attachment.asc>

#6 lore raw

PATCH 1/1 i40e: Fix virtchnl_queue_select bitmap validation

In reply to Jeff Kirsher
Quoted 24 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Jeff Kirsher
Sent: Wednesday, November 13, 2019 11:28 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Creeley, Brett <[email protected]>; Arkady Gilinksky <[email protected]>
Subject: [Intel-wired-lan] [PATCH] i40e: Fix virtchnl_queue_select bitmap validation

From: Brett Creeley <[email protected]>

Currently in i40e_vc_disable_queues_msg() we are incorrectly validating the virtchnl queue select bitmaps. The virtchnl_queue_select rx_queues and tx_queue bitmap is being compared against ICE_MAX_VF_QUEUES, but the problem is that these bitmaps can have a value greater than I40E_MAX_VF_QUEUES.
Fix this by comparing the bitmaps against BIT(I40E_MAX_VF_QUEUES).

Also, add the function i40e_vc_validate_vqs_bitmaps() that checks to see if both virtchnl_queue_select bitmaps are empty along with checking that the bitmaps only have valid bits set. This function can then be used in both the queue enable and disable flows.

Quoted 5 lines
---
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 22 +++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)