Skip to contentSkip to conversation

ixgbe 82599: Query assignment of queues to Virtual Function.

PATCH In review Qinglai Xiao 2 participants 5 messages Oct 21, 2013 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixgbe 82599: Query assignment of queues to Virtual Function.

Physical Function assignes Tx/Rx queues to each VF according to different schemes[1]. By querying through mailbox, VF is able to get number of Tx/Rx queues assigned to it.

Note that current Intel ixgbe driver ixgbe-3.18.7 does not fully support mailbox message IXGBE_VF_GET_QUEUES. The service routine for IXGBE_VF_GET_QUEUES must be fixed, otherwise PF always return 1 as Tx/Rx queue number.

[1] See section 7.2.1.2.1, 7.1.2.2 and 7.10.2.7.2 of Intel 82599 10 Gbe Controller Datasheet.

---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +32 -0
index f217564..991e1b3 100644
@@ -750,6 +750,34 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 	return 0;
 }
 
+static void ixgbevf_negotiate_api(struct ixgbe_hw *hw)
+{
+	int api[] = { ixgbe_mbox_api_11,
+		      ixgbe_mbox_api_10,
+		      ixgbe_mbox_api_unknown };
+	int err = 0, idx = 0;
+
+	while (api[idx] != ixgbe_mbox_api_unknown) {
+		err = ixgbevf_negotiate_api_version(hw, api[idx]);
+		if (!err)
+			break;
+		idx++;
+	}
+}
+
+static void ixgbevf_get_queue_num(struct ixgbe_hw *hw)
+{
+	/* Traffic classes are not supported by now */
+	unsigned int tcs, tc;
+
+	/*
+	 * In case that PF fails to provide Rx/Tx queue number,
+	 * max_tx_queues and max_rx_queues remain to be 1.
+	 */
+	ixgbevf_get_queues(hw, &tcs, &tc);
+}
+
+
 /*
  * Virtual Function device init
  */
@@ -818,6 +846,10 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 		return (diag);
 	}
 
+	/* Get Rx/Tx queue count via mailbox, which is ready after reset_hw */
+	ixgbevf_negotiate_api(hw);
+	ixgbevf_get_queue_num(hw);
+
 	/* Allocate memory for storing MAC addresses */
 	eth_dev->data->mac_addrs = rte_zmalloc("ixgbevf", ETHER_ADDR_LEN *
 			hw->mac.num_rar_entries, 0);
Signature · 1 line
1.7.1

A message that is not in the archive (sent off-list or not yet received): 1382339384-44601-1-git-send-email-jigsaw-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

Hi,

21/10/2013 09:09, Qinglai Xiao :

Quoted 9 lines

Physical Function assignes Tx/Rx queues to each VF according to different schemes[1]. By querying through mailbox, VF is able to get number of Tx/Rx queues assigned to it.

Note that current Intel ixgbe driver ixgbe-3.18.7 does not fully support mailbox message IXGBE_VF_GET_QUEUES. The service routine for IXGBE_VF_GET_QUEUES must be fixed, otherwise PF always return 1 as Tx/Rx queue number.

Quoted 5 lines

[1] See section 7.2.1.2.1, 7.1.2.2 and 7.10.2.7.2 of Intel 82599 10 Gbe Controller Datasheet.

---

Thanks for the patch, your comments are clear.

Quoted 4 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +4 -0
+static void ixgbevf_negotiate_api(struct ixgbe_hw *hw)
+{
+	int api[] = { ixgbe_mbox_api_11,
+		      ixgbe_mbox_api_10,

lib/librte_pmd_ixgbe/ixgbe_ethdev.c eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv, · line 766

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +10 -0
+		      ixgbe_mbox_api_unknown };
+	int err = 0, idx = 0;
+
+	while (api[idx] != ixgbe_mbox_api_unknown) {
+		err = ixgbevf_negotiate_api_version(hw, api[idx]);
+		if (!err)
+			break;
+		idx++;
+	}
+}

I have comments about the mbox API:
1) Why not call directly ixgbevf_negotiate_api_version for ixgbe_mbox_api_11 only ? It seems that only version 1.1 supports ixgbevf_get_queues.
2) If a loop is still needed, why not use a simple "for loop" ?
3) If ixgbevf_negotiate_api is still needed, I'd prefer to have "_mbx" in its name.

Thank you

Signature · 1 line
Thomas

A message that is not in the archive (sent off-list or not yet received): 201310211036.01561.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

author
#4 lore raw

Hi Thomas,

Thanks for comment.
The ixgbevf_negotiate_api is copied from Intel's VF driver. The while loop is not quite usual, indeed. A direct call to ixgbevf_negotiate_api_version(hw, ixgbe_mbox_api_11) is sufficient, I think. Coz PF is supposed to be satisfied with ver 1.1.
I will make another attempt with elimination of ixgbevf_negotiate_api.

Any other comment?

thx &
rgds,
-ql

Quoted 44 lines · Thomas Monjalon

Hi,

21/10/2013 09:09, Qinglai Xiao :

Quoted 9 lines

Physical Function assignes Tx/Rx queues to each VF according to different schemes[1]. By querying through mailbox, VF is able to get number of Tx/Rx queues assigned to it.

Note that current Intel ixgbe driver ixgbe-3.18.7 does not fully support mailbox message IXGBE_VF_GET_QUEUES. The service routine for IXGBE_VF_GET_QUEUES must be fixed, otherwise PF always return 1 as Tx/Rx queue number.

Quoted 5 lines

[1] See section 7.2.1.2.1, 7.1.2.2 and 7.10.2.7.2 of Intel 82599 10 Gbe Controller Datasheet.

---

Thanks for the patch, your comments are clear.

Quoted 4 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +4 -0
+static void ixgbevf_negotiate_api(struct ixgbe_hw *hw)
+{
+     int api[] = { ixgbe_mbox_api_11,
+                   ixgbe_mbox_api_10,

lib/librte_pmd_ixgbe/ixgbe_ethdev.c eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv, · line 766

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +10 -0
+                   ixgbe_mbox_api_unknown };
+     int err = 0, idx = 0;
+
+     while (api[idx] != ixgbe_mbox_api_unknown) {
+             err = ixgbevf_negotiate_api_version(hw, api[idx]);
+             if (!err)
+                     break;
+             idx++;
+     }
+}

I have comments about the mbox API:
1) Why not call directly ixgbevf_negotiate_api_version for ixgbe_mbox_api_11 only ? It seems that only version 1.1 supports ixgbevf_get_queues.
2) If a loop is still needed, why not use a simple "for loop" ?
3) If ixgbevf_negotiate_api is still needed, I'd prefer to have "_mbx" in its name.

Thank you
--
Thomas

A message that is not in the archive (sent off-list or not yet received): CAHVfvh79jQp5jUTPYHtuKf7WprMu86daa-cd8c0ffpuwMbtCrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

21/10/2013 13:28, jigsaw :

Quoted 1 line

The ixgbevf_negotiate_api is copied from Intel's VF driver.

[..]

Quoted 1 line

I will make another attempt with elimination of ixgbevf_negotiate_api.

Please, when sending a patch, be sure that there is no licensing issue.
We cannot integrate GPL code in BSD files.
By adding your "signed-off-by" line, you are certifying that the code is in the appropriate license. See "Certificate of Origin" in Linux guidelines:
https://www.kernel.org/doc/Documentation/SubmittingPatches

Signature · 1 line
Thomas

A message that is not in the archive (sent off-list or not yet received): 201310211504.59791.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

author
#8 lore raw

Sorry it was not on my mind. Next patch will not have any trace to GPL code. -ql

Quoted 12 lines · Thomas Monjalon

21/10/2013 13:28, jigsaw :

Quoted 1 line

The ixgbevf_negotiate_api is copied from Intel's VF driver.

[..]

Quoted 1 line

I will make another attempt with elimination of ixgbevf_negotiate_api.

Please, when sending a patch, be sure that there is no licensing issue.
We cannot integrate GPL code in BSD files.
By adding your "signed-off-by" line, you are certifying that the code is in the appropriate license. See "Certificate of Origin" in Linux guidelines:
https://www.kernel.org/doc/Documentation/SubmittingPatches

--
Thomas